Skip to main content

Public commands

Here's how to use cwc to perfom any actions you could do with the web console and be able to code some automation/IaC scripts (i.e: shells scripts, ansible roles, terraform, etc).

Notes:

  • To checkout how to install and update the cwc cli checkout this tutorial.
  • For the commands accessible for the administrators, checkout this tutorial

Usage, help version​

cwc help # or -h or --help for getting help
cwc version # or -v or --version for getting the current version

Authentication​

Login​

cwc login -a <access_key> -s <secret_key>

In order to create the access_key and the secret_key, you can checkout this tutorial.

Default configurations​

Read the current configurations​

cwc configure get endpoint
cwc configure get provider
cwc configure get region
cwc configure get format

cwc configure ls

This command will list the available config files available on your .cwc folder in your machine.

Configure​

Configuring the default endpoint, default region, default output format and provider with:

cwc configure

You can tap enter if you want to keep the current value:

cwc configure
Default endpoint [https://api.cwcloud.tech]:
Default provider [ovh]:
Default region [UK1]:
Default format [json]:

Note: After configuring your cli a config file will be created automatically in the .cwc folder in the home directory.

You can check available providers and regions with the following commands:

cwc provider ls
cwc region ls # you have to set the provider to get the up to date list of available regions here

For each settings you also can configure with a specific command:

cwc configure set endpoint https://api.cwcloud.tech
cwc configure set provider ovh
cwc configure set region UK1
cwc configure set format json

And you can also create a config file to use with the configuration you made:

cwc configure switch <config_file_name>

This will take the config file existing in the .cwc folder you choose and set up the configuration.

If you want to import a config file existing in a different directory you can use the following command:

cwc configure import <config_file_path>

Output's formats​

The know output's format are the following:

  • plain: columns separated with spaces, usable in a shell script
  • json: JSON format, usable in more high level programing languages
  • pretty: more understandable output for human but not very usable in a program or shell scripts. This format can be punctually asked by adding -p or --pretty directly in your commands.

Bootstrap​

Install CWCloud on Kubernetes​

Basic installation​

cwc bootstrap

Installation with custom configuration​

cwc bootstrap -r <release_name> -n <namespace>
cwc bootstrap --release <release_name> --namespace <namespace>

Available flags:

  • -r or --release: Release name for deployment (default: release-0.1.0)
  • -n or --namespace: Namespace to use for deployment (default: cwcloud)
  • -k or --keep-dir: Keep the local helm directory
  • -d or --recreate-ns: Recreate the namespace
  • -o or --openshift: Use openshift cli instead of kubectl
  • -p or --value: Values to override configurations (can be repeated)

Example:

cwc bootstrap -r my-release -n production --value key=value --value key2=value2

Configure custom repository​

Interactive configuration​

cwc bootstrap configure

Direct configuration with flags​

cwc bootstrap configure -u <repo_url> -b <branch>
cwc bootstrap configure --repo-url <repo_url> --branch <branch>

Available flags:

  • -u or --repo-url: Temporary repository URL
  • -b or --branch: Temporary branch name
  • -U or --username: Username for repository authentication
  • -P or --password: Password for repository authentication
  • -r or --release: Release name for deployment (default: release-0.1.0)
  • -n or --namespace: Namespace to use for deployment (default: cwcloud)
  • -k or --keep-dir: Keep the local helm directory
  • -p or --value: Values to override configurations

Example:

cwc bootstrap configure --repo-url https://gitlab.alternative.io/helm.git --branch feature-123

Uninstall​

cwc bootstrap uninstall

Port forwarding​

cwc bootstrap pfw

Projects​

List​

cwc project ls

Note: You can add -t (or --type) flag to get filter the projects by type (either vm or k8s)

Search Project​

Search Project By ID​

cwc project ls -P <project_id>
cwc project ls --id <project_id>

Search Project By Name​

cwc project ls -n <project_name>
cwc project ls --name <project_name>

Search Project By URL​

cwc project ls -u <project_url>
cwc project ls --url <project_url>

Create​

cwc project create -n <project_name>

Notes:

  • If you want to create a project in another Gitlab instance you can provide the Gitlab host, the group id, your access token and your git username by adding these options:
    • -h or --host: Gitlab instance host
    • -t or --token: your Gitlab access token
    • -g or --git: Your Git username
    • -n or --namespace: namespace or group id where the project will be created
    • -p or --type: Project type (vm or k8s)

Delete​

Delete Project By ID​

cwc project delete -p <project_id>
cwc project delete --id <project_id>

Delete Project By Name​

cwc project delete -n <project_name>
cwc project delete --name <project_name>

Delete Project By URL​

cwc project delete -u <project_url>
cwc project delete --url <project_url>

DNS zones​

List​

cwc dnszones ls

Environments​

List​

cwc environment ls

Get by ID​

cwc environment ls -e <environment_id>
cwc environment ls --environment <environment_id>pretty

Instances​

List instances types of selected provider​

cwc instance type ls

List instances​

cwc instance ls

List instance by ID​

cwc instance ls -i <instance_id>
cwc instance ls --instance <instance_id>

Create​

cwc instance create -n <instance_name> -e <environement> -t <instance_type> -p <project_name> -z <zone>
cwc instance create -n <instance_name> -e <environement> -t <instance_type> -i <project_id> -z <zone>
cwc instance create -n <instance_name> -e <environement> -t <instance_type> -u <project_url> -z <zone>

Notes:

  • use nova zone for ovh and 1 or 2 for scaleway
  • instance_type corresponds to the provider instance sizing (i.e: DEV1-M for Scaleway)
  • use --dns_zone or -d to choose the dns zone in which the instance will be created (you can list availble zones using cwc dnszones ls)

Attach​

cwc instance attach -n <playbook_name> -t <instance_type> -p <project_name> -z <zone>

Notes:

  • use nova zone for ovh and 1 or 2 for scaleway
  • instance_type corresponds to the provider instance sizing (i.e: DEV1-M for Scaleway)

Update status​

cwc instance update -i <instance_id> -s <action>

Notes:

  • The status must be poweroff, poweron or reboot

Delete​

cwc instance delete -i <instance_id>
cwc instance delete --instance <instance_id>

Buckets / object storage​

List​

cwc bucket ls

Get by ID​

cwc bucket ls -b <bucket_id>
cwc bucket ls --bucket <bucket_id>

Renew credentials​

cwc bucket renew -b <bucket_id>
cwc bucket renew --bucket <bucket_id>

Delete​

cwc bucket delete -b <bucket_id>
cwc bucket delete --bucket <bucket_id>

OCI / Docker registries​

List​

cwc registry ls

Get by ID​

cwc registry ls -r <registry_id>
cwc registry ls --registry <registry_id>

Renew credentials​

cwc registry renew -r <registry_id>
cwc registry renew --registry <registry_id>

Delete​

cwc registry delete -r <registry_id>
cwc registry delete --registry <registry_id>

FaaS / Serverless​

Demo​

demo_cli_faas

Languages​

List​

cwc faas languages ls

Serverless functions​

List​

cwc faas function ls

Get by ID​

cwc faas function ls -f <function_id>
cwc faas function ls --function <function_id>

Create​

cwc faas function create -n <function_name> -l <language_name>
cwc faas function create --name <function_name> --language <language_name>
  • By default the function created is private if you add -p or --public flag the function becomes public.
  • There are other optional flags for direct creation:
-l # or --language: Language of the function
-r # or --regexp: regular expression for args protection
-u # or --callback-url: callback's URL
-a # or --callback-authorization-header: Authorization's header of the callback
-g # or --args arguments: (you can repeat this option for each argument's values)
-c # or --code: source code of the function
  • Instead of entering the optional flags behind each other you can enter your data with the interactive mode by adding -i or --interactive flag.

Update​

cwc faas function update -f <function_id>
cwc faas function update --function <function_id>

You can update the function by going through the interactive mode by adding -i or --interactive flag or you can pass your data directly with these optional flags:

-l # or --language: Language of the function
-r # or --regexp: regular expression for args protection
-u # or --callback-url: callback's URL
-a # or --callback-authorization-header: Authorization's header of the callback
-g # or --args arguments: (you can repeat this option for each argument's values)
-c # or --code: source code of the function

Delete​

cwc faas function delete -f <function_id>
cwc faas function delete --function <function_id>

Invocations​

List​

cwc faas invocation ls

Get by ID​

cwc faas invocation ls -i <invocation_id>
cwc faas invocation ls --invocation <invocation_id>

Create​

cwc faas invocation create -f <function_id>
cwc faas invocation create --function <function_id>
  • There is other optional flag for direct creation:
-a # or --args: arguments (you can repeat this option for each argument's values)
-s # or --synchronous: enable the synchronous mode
  • Instead of entering the optional flag you can enter your data with the interactive mode by adding -i or --interactive flag.

Delete​

cwc faas invocation delete -i <invocation_id>
cwc faas invocation delete --invocation <invocation_id>

Truncate​

cwc faas invocation truncate

Triggers​

List kinds​

cwc faas trigger kinds

List​

cwc faas trigger ls

Get by ID​

cwc faas trigger ls -t  <trigger_id>
cwc faas trigger ls --trigger <trigger_id>

Create​

cwc faas trigger create -f <function_id>
cwc faas trigger create --function <function_id>
  • There are other optional flags for direct creation:
-n # or --name: trigger's name
-k # or --kind: trigger' kind
-c # or --cron_expr: trigger's cron expression
-a # or --args: arguments (you can repeat this option for each argument's values)
  • Instead of entering the optional flag you can enter your data with the interactive mode by adding -i or --interactive flag.

Delete​

cwc faas trigger delete -t  <trigger_id>
cwc faas trigger delete --trigger <trigger_id>

Truncate​

cwc faas trigger truncate

IoT​

Object Types​

List Object Types​

cwc iot objectType ls

Note: You can add -p (or --pretty) flag to display the output in a pretty table format

Search Object Type by ID​

cwc iot objectType ls -i <object_type_id>
cwc iot objectType ls --id <object_type_id>

Create Object Type​

cwc iot objectType create -n <name> -d <decoding_function>

Options:

  • -n or --name: Name of the object type
  • -d or --decoding_function: Decoding function of the object type (required)
  • --public: Set the object type as public (optional)
  • -t or --triggers: Triggers of the object type (can be used multiple times)
  • -i or --interactive: Interactive mode for guided creation

Interactive Mode​

cwc iot objectType create -i
cwc iot objectType create --interactive

Update Object Type​

cwc iot objectType update -o <object_type_id>

Options:

  • -o or --id: The object type ID (required)
  • -n or --name: New name of the object type
  • -d or --decoding_function: New decoding function
  • --public: Update public status
  • -t or --triggers: New triggers (can be used multiple times)
  • -i or --interactive: Interactive mode for guided update

Delete Object Type​

cwc iot objectType delete -o <object_type_id>
cwc iot objectType delete --objectType <object_type_id>

Devices​

List Devices​

cwc iot device ls

Note: You can add -p (or --pretty) flag to display the output in a pretty table format

Search Device by ID​

cwc iot device ls -i <device_id>
cwc iot device ls --id <device_id>

Create Device​

cwc iot device create -u <username> -o <object_type_id>

Options:

  • -u or --username: Username of the device (email) (required)
  • -o or --object_type_id: Object type ID of the device (required)

Delete Device​

cwc iot device delete -d <device_id>
cwc iot device delete --deviceId <device_id>

Data​

Create Data​

cwc iot data create -d <device_id> -c <content>

Options:

  • -d or --device_id: Device ID of the data (required)
  • -c or --content: Content of the data (required)

Storage​

Key-Value​

List​

cwc storage kv ls

Create​

cwc storage kv create -k <key> -p <payload>
cwc storage kv create --key <key> --payload <payload>

Notes:

  • The payload must be a valid JSON string (e.g: '{"key":"value"}')
  • You can specify an optional time-to-live in hours with -t or --ttl

Update​

cwc storage kv update -k <key> -p <payload>
cwc storage kv update --key <key> --payload <payload>

Notes:

  • The payload must be a valid JSON string (e.g: '{"key":"value"}')
  • You can specify an optional time-to-live in hours with -t or --ttl

Delete​

cwc storage kv delete -k <key>
cwc storage kv delete --key <key>

Kubernetes​

Deployments​

List deployments​

cwc kubernetes deployment ls

List deployment by ID​

cwc kubernetes deployment ls -d <deployment_id>
## or
cwc kubernetes deployment ls --id <deployment_id>

Create deployment​

cwc kubernetes deployment create -n <deployment_name> -d <deployment_description> -c <cluster_id> -i <project_id> -e <environment_id>
## or
cwc kubernetes deployment create --name <deployment_name> --description <deployment_description> --cluster <cluster_id> --project <project_id> --environment <environment_id>

Delete deployment by ID​

cwc kubernetes deployment delete -d <deployment_id>
## or
cwc kubernetes deployment delete --id <deployment_id>

Email​

Send an email​

You can send an email with the following command:

cwc email -t <recepient_email> -s <subject> -c <content>

Notes:

  • There are other optional flags you can add:
    • -f to add customized expeditor email address
    • -b to add a bcc email address

Monitors​

List​

cwc monitor ls

Get by ID​

cwc monitor ls -m <monitor_id>
cwc monitor ls --monitor <monitor_id>

Note: You can add -p or --pretty flag to get a more readable output

Create​

cwc monitor create -n <monitor_name> -u <monitor_url>

Optional flags:

  • -y or --type: Type of the monitor (http, tcp) - defaults to "http"
  • -f or --family: Family of the monitor
  • -m or --method: HTTP method (GET, POST, PUT) - defaults to "GET"
  • -e or --expected_http_code: Expected HTTP response code (200, 201, 401...) - defaults to "20*"
  • -b or --body: Request body - defaults to "hello"
  • -c or --expected_contain: Expected content in the response
  • -t or --timeout: Request timeout in seconds - defaults to 30
  • -s or --username: Basic auth username
  • -p or --password: Basic auth password
  • -H or --headers: Custom headers in format "key1:value1,key2:value2"
  • -l or --level: Log level of the monitor (info, debug) - defaults to "info"
  • -k or --check_tls: Activate/Deactivate TLS certificate check - Activated by default
  • -C or --callbacks: Callbacks in format type:http,endpoint:https://exemple.com,token:123;type:mqtt,endpoint:mqtt://broker.com,topic:test

Update​

cwc monitor update -i <monitor_id>

Optional flags:

  • -y or --type: Type of the monitor (http or tcp)
  • -n or --name: Name of the monitor
  • -f or --family: Family of the monitor
  • -u or --url: URL to monitor
  • -m or --method: HTTP method (GET, POST, PUT)
  • -e or --expected_http_code: Expected HTTP response code
  • -b or --body: Request body
  • -c or --expected_contain: Expected content in the response
  • -t or --timeout: Request timeout in seconds
  • -s or --username: Basic auth username
  • -p or --password: Basic auth password
  • -H or --headers: Custom headers in format "key1:value1,key2:value2"
  • -l or --level: Log level of the monitor (info, debug) - defaults to "info"
  • -k or --check_tls: Activate/Deactivate TLS certificate check - Activated by default
  • -C or --callbacks: Callbacks in format type:http,endpoint:https://example.com,token:123;type:mqtt,endpoint:mqtt://broker.com,topic:test

Delete​

cwc monitor delete -m <monitor_id>
cwc monitor delete --monitor <monitor_id>

AI Prompt​

Send Prompt​

cwc ai prompt -a <adapter> -m "<message>"

Options:

  • -a or --adapter: The chosen AI adapter (required)
  • -m or --message: The message input to send to the AI (required)
  • -l or --list: Optional list ID to continue an existing conversation
  • -p or --pretty: Pretty print the output (optional)

Continue Conversation​

cwc ai prompt -a <adapter> -m "<message>" -l <list_id>

Get Prompt History​

cwc ai prompt history

Options:

  • -s or --start: Start index for pagination (default: 0)
  • -m or --max: Maximum results to return (default: 7)
  • -p or --pretty: Pretty print the output (optional)

Get Prompt History with Pagination​

cwc ai prompt history -s <start_index> -m <max_results>
cwc ai prompt history --start <start_index> --max <max_results>

Get Prompt Details​

cwc ai prompt details -l <list_id>
cwc ai prompt details --list <list_id>

Options:

  • -l or --list: List ID to get details for (required)
  • -p or --pretty: Pretty print the output (optional)

AI Adapters​

List All Adapters​

cwc ai adapter ls

List Only External Adapters​

cwc ai adapter ls -e
cwc ai adapter ls --external

Get Specific Adapter by ID​

cwc ai adapter ls -a <adapter_id>
cwc ai adapter ls --adapter-id <adapter_id>

Note: You can add --pretty flag to get a more readable output

Create​

cwc ai adapter create -n <adapter_name> -u <adapter_url>

Optional flags:

  • -s or --username: Username for authentication
  • -w or --password: Password for authentication
  • -t or --timeout: Timeout in seconds - defaults to 30
  • -k or --check-tls: Check TLS certificate - enabled by default
  • -p or --public: Make adapter public - defaults to false

Example:

cwc ai adapter create -n "my-adapter" -u "https://api.openai.com/v1/chat/completions" -s "myuser" -w "mypass" -t 60 -k=false -p=true

Update​

cwc ai adapter update -a <adapter_id>

Optional flags:

  • -n or --name: Name of the AI adapter
  • -u or --url: URL of the AI adapter
  • -s or --username: Username for authentication
  • -w or --password: Password for authentication
  • -t or --timeout: Timeout in seconds
  • -k or --check-tls: Check TLS certificate
  • -p or --public: Make adapter public

Example:

cwc ai adapter update -a 2080dc4f-2485-42fe-a0ba-613bbc9fd2e5 -n "updated-name" -u "https://new-api.com" -s "newuser" -w "newpass" -t 90 -=truep

Delete​

cwc ai adapter delete -a <adapter_id>
cwc ai adapter delete --adapter-id <adapter_id>

Example:

cwc ai adapter delete -a 2080dc4f-2485-42fe-a0ba-613bbc9fd2e5