Ion Connect CLI
  • 24 Aug 2023
  • 5 Minutes to read
  • Dark
    Light
  • PDF

Ion Connect CLI

  • Dark
    Light
  • PDF

Article summary

Ion-Connect is a CLI (Command-Line Interface) tool that allows you to interact with the Ion Channel API.

Installation

  1. Email support@exiger.com with a request to be provided the tool.
  2. Run the executable from the folder matching your operating system. Supported operating systems include Windows, Linux, and Darwin (includes macOS).

Running Ion Connect

To run Ion Connect, you will need to provide an API token to obtain access. Steps to obtain a token can be found here.

To prevent the need to provide the API token each time you run Ion Connect, it is recommended to run the configure command.

ion-connect configure

Alternatively, the API token can be provided via an environment variable:

IONCHANNEL_SECRET_KEY=<token> ion-connect [command]

Usage

All Ion Connect commands use the following format. See the section below for each command's flags and arguments.

ion-connect [global flags] <command> [command flags] [arguments...]
The only global flag for Ion Connect is --configure. This flag will indicate which configuration file to use. The default file is ~/.ionchannel/credentials.yaml.

Commands

Analysis

The analysis commands allow you to access analysis data.

get-analysis

Get the data from an analysis scan summary.
Usage:
  ion-connect analysis get-analysis [flags] ANALYSISID

Flags:
  -h, --help:  Help for get-analysis
  -p, --project-id string:  ID of the project (required)
  -t, --team-id string:  ID of the team for the project (required)

get-latest-analysis

Returns the latest analysis of a project.
Usage:
  ion-connect analysis get-latest-analysis [flags]

Flags:
  -h, --help:  Help for get-latest-analysis
  -p, --project-id string:  ID of the project (required)
  -t, --team-id string:  ID of the team for the project (required)


Community

The community commands allow you to access a GitHub repository and actor data.

get-repo

Returns the information about a repository.
Usage:

  ion-connect community get-repo NAME [flags]

Flags:
  -h, --help:  Help for get-repo

get-repos-for-actor

Search for public GitHub repositories that have been committed using the given GitHub public profile name.
Usage:

  ion-connect community get-repos-for-actor NAME [flags]

Flags:
  -h, --help:  Help for get-repos-for-actor


Configure

Prompts to provide the Ion Channel API key, which is stored in the default location (~/.ionchannel/credentials.yaml).
Usage:

  ion-connect configure [flags]

Flags:
  -h, --help:  Help for configure


Delivery

Access data related to delivery destinations.

create-destination

Create a delivery destination from an Ion Channel JSON file. This command can also provide a skeleton for the required JSON.
Usage:

  ion-connect delivery create-destination [flags] PATHTOJSON

Flags:
  -h, --help: Help for create-destination
        --print:  Print an example create destination json skeleton

delete-destination

Removes a single delivery destination. Requires the Destination ID, which can be obtained via the get-destinations command.
Usage:

  ion-connect delivery delete-destination [flags]

Flags:
  -d, --delivery-id string: ID of the destination to be deleted (required)
  -h, --help:  Help for delete-destination

get-destinations

Get the data for a team's delivery destinations.
Usage:

  ion-connect delivery get-destinations [flags]

Flags:
  -h, --help:  Help for get-destinations
  -t, --team-id string:  ID of the team for the deliveries (required)


Dependency

Access data related to dependencies.

resolve-dependencies-in-file

Resolve the direct and transitive dependencies from a dependency file. See Dependency Detection for information on supported file types.
Usage:

  ion-connect dependency resolve-dependencies-in-file [flags] PATHTODEPFILE

Flags:
       --flag:  Feature flag for experimental usage
  -f, --flatten: Return the list in a flattened array
  -h, --help: Help for resolve-dependencies-in-file
  -t, --type string:  Type of ecosystem or file for parsing (required)

Ecosystem Types:
  Java:  java, maven, pom.xml
  Ruby:  ruby, rubygems, gem, gemfile, gemspec
  Javascript: javascript, npm, npmjs, package.json, package, json
  Python:  python, pip, pipfile, pypi, requirements
  Go:  glide, go, golang

Project

Access data relating to projects.

add-alias

Adds a product name, version, and organization to an existing project.
Usage:

  ion-connect project add-alias NAME VERSION [ORG] [flags]

Flags:
  -h, --help: Help for add-alias
  -p, --project-id string:  ID of the project (required)
  -t, --team-id string:  ID of the team for the project (required)

create-project

Create a single project from a JSON file.
Usage:

  ion-connect project create-project [flags] PATHTOJSON

Flags:
  -h, --help:  Help for create-project
        --print:  Print an example create project json skeleton

create-project-spdx

Create a project from an SPDX file.
Usage:

  ion-connect project create-projects-spdx [flags] PATHTOSPDX

Flags:
  -h, --help:  Help for create-projects-spdx
  -d, --include-dependencies: True if dependency packages should be imported as projects (default: true) (default true)
        --poc-email string: Point of Contact (PoC) email to be used for the project
        --poc-name string: Point of Contact (PoC) name to be used for the project
  -r,  --ruleset-id string: ID of the ruleset for the project (required)
        --spdx-version string: SPDX version 2.1 or 2.2 to import (default: 2.1)
  -t,  --team-id string:  ID of the team for the project (required)

create-projects-csv

Create projects from an Ion Channel CSV file.
Usage:

  ion-connect project create-projects-csv [flags] PATHTOCSV

Flags:
  -h, --help: Help for create-projects-csv
  -t, --team-id string:  ID of the team for the project (required)

get-project

Get the data for a single project.
Usage:

  ion-connect project get-project [flags]

Flags:
  -h, --help: Help for get-project
  -p, --project-id string: ID of the project (required)
  -t, --team-id string:  ID of the team for the project (required)

get-projects

Get the data for projects in a team.
Usage:

  ion-connect project get-projects [flags]

Flags:
  -h, --help: Help for get-projects
        --limit int: Maximum count of projects (default 10)
        --offset int: Beginning index for project set
  -t,  --team-id string:  ID of the team for the project (required)

set-source

Changes the source of a project.
Usage:

  ion-connect project set-source LOCATION [flags]

Flags:
  -h, --help: Help for set-source
  -p, --project-id string:  ID of the project (required)

set-type

Changes the project type. Also allows the changing of the project's source and branch when applicable. Source types include git, artifact, s3, svn, and source_unavailable.
Usage:

  ion-connect project set-type TYPE [SOURCE] [BRANCH] [flags]

Flags:
  -h, --help: Help for set-type
  -p, --project-id string: ID of the project (required)
  -b, --source-branch-name string: Source branch of project
  -s, --source-location string:  Source location of project (required except for source_unavailable type)


Report

Access data relating to analyses, evaluations, and their associations.

export-data

Returns a report summary for the provided json list of projects.
Usage:
ion-connect report export-data [flags] PATHTOJSON

Flags:
 -h, --help: Help for export-data
       --print:  Print an example export data json skeleton. ids is 1-n project ids.

get-analysis

Get a full analysis report. This command provides more detailed information than the data provided by the analysis command.
Usage:
ion-connect report get-analysis [flags] <analysis_id>

Flags:
  -h, --help:  Help for get-analysis
  -p, --project-id string: ID of the project (required)
  -t, --team-id string: ID of the team for the project (required)

Example:
  ion-connect report get-analysis -p <project_id> -t <team_id>  <analysis_id>

Scanner

Initiate analyses and get results.

analyze-project

Request an analysis of a project and get information about the analysis request.
Usage:
ion-connect scanner analyze-project [flags]

Flags:
  -h, --help:  Help for analyze-project
  -p, --project-id string: ID of the project (required)
  -t, --team-id string: ID of the team for the project (required)
  -b, --branch string: Name of the branch if the project maps to a repository

Example:
  ion-connect scanner analyze-project -p <project_id> -t <team_id>

get-analysis-status

Get analysis status and scan results.
Usage:
ion-connect scanner get-analysis-status [flags] <analysis_id>

Flags:
  -h, --help:  Help for get-analysis-status
  -p, --project-id string: ID of the project (required)
  -t, --team-id string: ID of the team containing the project (required)

Example:
  ion-connect scanner get-analysis-status -p <project_id> -t <team_id> <analysis_id>

Search

Search for known data about a software artifact. Using the -t flag, you can change the type of resource to search. Options are repos, products, packages, and reports (all three).
Usage:
ion-connect search [flags]

Flags:
  -h, --help:  Help for search
  -q, --query string: String text to search for known software artifacts.
  -t, --tbs string: Requests that the search is performed against the provided resource type (default "products").

Example:
  ion-connect search -q ruby -t products

Version

Get the version of Ion Connect that is installed
Usage:
ion-connect version [flags]

Flags:
  -h, --help:  Help for version

Vulnerability

Access data relating to vulnerabilities and their associations.

get-vulnerabilities

Usage:
ion-connect vulnerability get-vulnerabilities [flags] NAME [VERSION]

Flags:
   -h, --help:  Help for get-vulnerabilities

Current up to version 0.31.0


Was this article helpful?

What's Next