Bash SDK

Supported methods

The following SDK methods are supported by the Bash SDK:

  • Secret
  • Config
  • Track

Secret

Access the current team's secret store.

Subcommands:

Get:

USAGE:

sdk secret get <KEY>

ARGS:

<KEY>    The key of the desired secret in the secret store

Set:

USAGE:

sdk secret set --key <KEY> --value <VALUE>

OPTIONS:

-k, --key <KEY>        The key to set the secret under in the secret store
-v, --value <VALUE>    The value to set in the secret store

Example:

sdk secret set --key='secret1' --value='shh'
secret=$(sdk secret get secret1)
echo $secret

Output:

shh

Config

Access the current team's configuration store.

Subcommands:

Get:

USAGE:

sdk config get <KEY>

or

sdk config get --all

ARGS:

<KEY>    The key of the desired value in the configuration store

Set:

USAGE:

sdk config set --key <KEY> --value <VALUE>

OPTIONS:

-k, --key <KEY>        The key to set the value under in the configuration store
-v, --value <VALUE>    The value to set in the configuration store

Example:

cto-ai config set --key='myop_target_domain' --value='cto.ai'
domain=$(cto-ai config get myop_target_domain)
echo $domain

Output:

cto.ai

Track

Track a workflow event.

USAGE:

sdk track [OPTIONS] <EVENT> [PARAM]...

OPTIONS:

-e, --error <ERROR>    An error string to report

ARGS:

<EVENT>       The event name to track
<PARAM>...    Parameters for the tracking event. Takes key:value metadata entries or tags as strings without colons

Example:

sdk track deploy production image:jifejfdkdkdi3930 

Result:

Sends an analytics event to The Ops Platform with event deploy, tag production, and metadata {image: jifejfdkdkdi3930}.

Events

Note: This feature is coming soon.

Retrieve workflow events that were sent with sdk.track

USAGE:

sdk events [OPTIONS] <TEAM> [FILTERS]...

OPTIONS:

-e, --error <ERROR>    An error string to report

ARGS:

<TEAM>       The Team to retrieve events for.
<FILTERS>...    Filter the events you want to retrieve. Takes key:value metadata entries or tags as strings without colons

Example:

sdk events backend deploy image:jifejfdkdkdi3930 

Result:

Retrieves a list of workflow events from The Ops Platform with from team backend, tag deploy, and metadata {image: jifejfdkdkdi3930}.