Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
riteshnoronha authored Feb 19, 2025
1 parent b684277 commit 2b557ca
Showing 1 changed file with 72 additions and 109 deletions.
181 changes: 72 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,136 +14,103 @@
limitations under the License.
-->

# `pylynk`: Interlynk Python Command line utility
# `pylynk`: cmdline utility for the Interlynk Platform

Getting started with Interlynk CLI
![GitHub all releases](https://img.shields.io/github/downloads/interlynk-io/pylynk/total)

# Setup
```bash
git clone https://github.com/interlynk-io/pylynk
```

Once cloned, cd and install requirements
```bash
cd pylynk
```
`pylynk` is your primary tool to interface with interlynk's SAAS platform.

```bash
```sh
git clone https://github.com/interlynk-io/pylynk
pip3 install -r requirements.txt
```

Verify it's working by running:
python3 pylynk.py --help
````
or

```sh
python3 pylynk.py --help
docker pull ghcr.io/interlynk-io/pylynk:latest
```
# Usage

See the full PyLynk CLI help.

# Authenticate
### Authenticate
PyLynk can be authenticated by setting an environment variable `INTERLYNK_SECURITY_TOKEN` or by providing a `-token` param to all commands.
```bash
export INTERLYNK_SECURITY_TOKEN=lynk_test_GDGEB2j6jnhkzLSAQk9U3wiiQLrbNT11Y8J4
python3 pylynk.py prods
```

OR

```bash
python3 pylynk.py prods --token lynk_test_GDGEB2j6jnhkzLSAQk9U3wiiQLrbNT11Y8J4
```

OR

# List Products
```bash
export INTERLYNK_SECURITY_TOKEN=lynk_test_GDGEB2j6jnhkzLSAQk9U3wiiQLrbNT11Y8J4
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk prods
```


## List Products
```bash
python3 pylynk.py prods --table
```
Output
OR
```bash
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk prods --table
```
NAME | ID | VERSIONS | UPDATED AT |
-----------------------------------------------------------------------------------|
sbomqs | 478ba2d2-ec5c-4eec-afb7-85a72fe17bd3 | 1 | 2024-02-29 01:07:59 PST |
sbomex | e865710e-b262-4f44-9078-970052794a60 | 1 | 2024-02-29 01:05:24 PST |

```
# List Products as JSON
## List Products as JSON
```bash
python3 pylynk.py prods --json
```
Output
```
[
{
"name": "sbomqs",
"updatedAt": "2024-02-29T09:07:59Z",
"id": "478ba2d2-ec5c-4eec-afb7-85a72fe17bd3",
"versions": 1
},
{
"name": "sbomex",
"updatedAt": "2024-02-29T09:05:24Z",
"id": "e865710e-b262-4f44-9078-970052794a60",
"versions": 1
}
]
OR
```bash
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk prods --json
```

# List Environments
TBD

# List Versions
## List Versions by product ID (default environment)
## List Versions
### List Versions by product ID (default environment)
```bash
python3 pylynk.py vers --prodId 'e865710e-b262-4f44-9078-970052794a60' --table
```
Output
OR

```bash
ID | VERSION | PRIMARY COMPONENT | UPDATED AT |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
fbcc24ad-5911-4229-8943-acf863c07bb4 | sha256:5ed7e95ae79fe3fe6c4b8660f6f9e31154e64eca76ae42963a679fbb198c3951 | centos:centos7.9.2009 | 2024-02-29 01:05:24 PST |
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk vers --prodId 'e865710e-b262-4f44-9078-970052794a60' --table
```
## List Versions by product ID (default environment) as JSON

### List Versions by product ID (default environment) as JSON
```bash
python3 pylynk.py vers --prodId 'e865710e-b262-4f44-9078-970052794a60' --json
```
Output
OR
```bash
[
{
"id": "fbcc24ad-5911-4229-8943-acf863c07bb4",
"vulnRunStatus": "FINISHED",
"updatedAt": "2024-02-29T09:05:24Z",
"primaryComponent": {
"name": "centos:centos7.9.2009",
"version": "sha256:5ed7e95ae79fe3fe6c4b8660f6f9e31154e64eca76ae42963a679fbb198c3951"
}
}
]
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk vers --prodId 'e865710e-b262-4f44-9078-970052794a60' --json
```
## List Versions by product name (default environment)

### List Versions by product name (default environment)
```bash
python3 pylynk.py vers --prod 'sbom-exec' --table
```
Output
OR
```bash
ID | VERSION | PRIMARY COMPONENT | UPDATED AT |
---------------------------------------------------------------------------------------------------|
e0b1fb60-03de-4202-b316-51422351b96b | 1.3 | agdfda | 2024-02-18 17:01:17 PST |
2f576a83-0918-4749-86a8-3788dd8fd26d | 1.1 | xxx | 2024-02-18 17:01:17 PST |
5a46ab07-174f-4074-b4af-f8f83a17b822 | 1.0.1 | Implantatron Programmer | 2024-02-18 17:01:22 PST |
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk vers --prod 'sbom-exec' --table
```
## List Versions for specific environment by name


### List Versions for specific environment by name
```bash
python3 pylynk.py vers --prod 'sbomqs' --env 'production' --table
```
Output
OR
```bash
ID | VERSION | PRIMARY COMPONENT | UPDATED AT |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
6067a2f0-76b1-4b51-97cf-cc01175d66c4 | sha256:5ed7e95ae79fe3fe6c4b8660f6f9e31154e64eca76ae42963a679fbb198c3951 | centos:centos7.9.2009 | 2024-02-29 00:59:11 PST |
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk vers --prod 'sbomqs' --env 'production' --table
```
## List Versions for specific environment ID
TBD

# Status of a specific version
## Status of a specific version
The status of actions associated with SBOM is reported in three states:
1. UNKNOWN
2. NOT_STARTED
Expand All @@ -157,65 +124,61 @@ This applies to the following SBOM actions (represented with specific keys):
4. SBOM Automation Rules (Key: `automationStatus`)
5. SBOM Vulnerability Scan (Key: `vulnScanStatus`)

## Status of a specific version by version ID
### Status of a specific version by version ID
```bash
python3 pylynk.py status --prodId 'e865710e-b262-4f44-9078-970052794a60' --verId 'fbcc24ad-5911-4229-8943-acf863c07bb4'
```
Output
```bash
{
"checksStatus": "COMPLETED",
"policyStatus": "COMPLETED",
"labelingStatus": "UNKNOWN",
"automationStatus": "IN_PROGRESS",
"vulnScanStatus": "NOT_STARTED"
}
```

# Download SBOM
## Download SBOM for specific version by version ID

## Download SBOM

### Download SBOM for specific version by version ID
Run the following command to upload an SBOM:
```bash
python3 pylynk.py download --prod 'sbomex' --verId 'fbcc24ad-5911-4229-8943-acf863c07bb4'
```
Output
OR
```bash
{SBOM Data}
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk download --prod 'sbomex' --verId 'fbcc24ad-5911-4229-8943-acf863c07bb4'
```
## Download SBOM for specific version by version name

### Download SBOM for specific version by version name
Run the following command to upload an SBOM:
```bash
python3 pylynk.py download --prod 'sbomex' --env 'default' --vers 'sha256:5ed7e95ae79fe3fe6c4b8660f6f9e31154e64eca76ae42963a679fbb198c3951'
```
Output
OR
```bash
{SBOM Data}
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk download --prod 'sbomex' --env 'default' --vers 'sha256:5ed7e95ae79fe3fe6c4b8660f6f9e31154e64eca76ae42963a679fbb198c3951'
```
# Upload SBOM
## Upload SBOM to the default environment

## Upload SBOM
### Upload SBOM to the default environment
Upload SBOM file sbomqs.cdx.json to the product named **sbomqs**
```bash
python3 pylynk.py upload --prod 'sbomqs' --sbom sbomqs.cdx.json
```
Output
```
Uploaded successfully
OR
```bash
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk upload --prod 'sbomqs' --sbom sbomqs.cdx.json
```
## Upload SBOM to a specific environment


### Upload SBOM to a specific environment
Upload SBOM file sbomqs.cdx.json to the product named **sbomqs** under environment **production**
```bash
python3 pylynk.py upload --prod 'sbomqs' --env 'production' --sbom sbomqs.cdx.json
```
Output
```
Uploaded successfully
OR
```bash
docker run -e INTERLYNK_SECURITY_TOKEN ghcr.io/interlynk-io/pylynk upload --prod 'sbomqs' --env 'production' --sbom sbomqs.cdx.json
```

## Increasing the verbosity of output
### Increasing the verbosity of output
Use `--verbose` or `-v` with any command to see debug output.


## Debugging
### Debugging
To point to a different API endpoint than production
```bash
export INTERLYNK_API_URL=http://localhost:3000/lynkapi
Expand Down

0 comments on commit 2b557ca

Please sign in to comment.