A command line interface for running the compute nest project
Project description
ComputeNest-CLI
Project Description
computenest-cli
is a command-line tool that integrates the creation, updating, and deployment of artifacts, as well as the creation and updating of services within the ComputeNest framework. It allows users to manage their services, construct artifacts, and handle custom operations, such as custom image creation.
Requirements
- Python >= 3.7
Installation
computenest-cli
can be installed using the pip package manager.
# Install the computenest-cli
pip install computenest-cli
Usage
To use computenest-cli
, simply run the corresponding command with the required parameters. Each command comes with a --help
option to display help information about the command's usage.
List Supported Service Templates
Description
List the supported service templates. Use this command to obtain the supported service templates and get the project name,
you can use computenest-cli init-project --project_name xxx
to initial a project.
Parameters
Parameter | Required | Description | Example Value |
---|---|---|---|
--service_type |
No | Type of service. Options include private or managed . |
private |
Example:
computenest-cli list-projects --service_type private --output_path .
Initializing a Project
Description
Initialize a project by specifying the project name. This command will download the specified project to the output_path,
and you can quickly use computenest-cli import
to create a ComputeNest service by the downloaded project.
Parameters
Parameter | Required | Description | Example Value |
---|---|---|---|
--project_name |
Yes | Name of the project. | MyProject |
--output_path |
Yes | Path to the output directory where the generated files will be saved. | /path/to/output |
Example:
computenest-cli init-project --project_name springboot-package-ecs-demo --output_path .
Importing Services
Description
Create or update a service by importing a configuration file.
Parameters
Parameter | Required | Description | Example Value |
---|---|---|---|
--access_key_id |
Yes | The Access Key ID needed for authentication. | AKID1234567890 |
--access_key_secret |
Yes | The Access Key Secret required for authentication. | secret1234567890 |
--file_path |
Yes | Path to the file required for the import process. | /path/to/your/config.yaml |
--region_id |
No | The ID of the region where the service is located. | cn-hangzhou |
--service_id |
No | Unique identifier for the service. If provided, the command will attempt to match this service_id . |
service-12345 |
--service_name |
No | Name of the service. If service_id is not provided, this will be used to match the service name. |
my-service |
--version_name |
No | Name of the specific version of the service. | v1.0 |
--desc |
No | A brief description of the service. | Sample service |
--update_artifact |
No | Specify whether the artifact needs to be updated. Accepts True or False . |
True |
--icon |
No | URL to the custom icon for the service, hosted on OSS (Object Storage Service). | https://xxx/icon.png |
--security_token |
No | Security Token needed for authentication; optional. | security_token_value |
--parameters |
No | Parameters in JSON format as a string. Optional, defaults to an empty JSON object {} . |
{"key1": "value1", "key2": "value2"} |
--parameter_path |
No | Path to a parameter file. If provided, this will override the --parameters option. |
/path/to/parameters.json |
Note:
- If --service_id is provided, the command will attempt to match it uniquely and the service name can be modified. If not found, it will raise a ServiceNotFound error.
- If --service_id is not provided but --service_name is, the command will match based on the service name.
Example
computenest-cli import \
--region_id cn-hangzhou \
--update_artifact True \
--service_id service-12345 \
--service_name my-service \
--version_name v1.0 \
--icon https://xxx/icon.png \
--desc "Sample service" \
--file_path /path/to/your/config.yaml \
--access_key_id AKID1234567890 \
--access_key_secret secret1234567890 \
--security_token security_token_value \
--parameters '{"key1": "value1", "key2": "value2"}' \
--parameter_path /path/to/parameters.json
Replace $ACCESS_KEY_ID
and $ACCESS_KEY_SECRET
with your AccessKey ID and AccessKey Secret respectively.
How to get the AccessKey pair: https://help.aliyun.com/zh/id-verification/cloudauth/obtain-an-accesskey-pair
Exporting Services
Description
Export a service by specifying the service ID and the output directory.
Parameters
Parameter | Required | Description | Example Value |
---|---|---|---|
--region_id |
Yes | The ID of the region where the service is located. | cn-hangzhou |
--service_id |
Yes | Unique identifier for the service. | service-12345 |
--output_dir |
Yes | Path to the output directory where the exported files will be saved. | /path/to/output |
--version_name |
No | Name of the specific version of the service. | v1.0 |
--export_type |
No | Type of export. Options include CONFIG_ONLY and FULL_SERVICE . |
config_only |
--export_project_name |
No | Name of the project being exported. | MyExportedProject |
--export_file_name |
No | Name of the exported configuration file; defaults to config.yaml . |
my_config.yaml |
--access_key_id |
Yes | The Access Key ID needed for authentication. | AKID1234567890 |
--access_key_secret |
Yes | The Access Key Secret required for authentication. | secret1234567890 |
--security_token |
No | Security Token needed for authentication; optional. | security_token_value |
Example:
computenest-cli export \
--region_id cn-hangzhou \
--service_id service-12345 \
--version_name v1.0 \
--export_type config_only \
--output_dir /path/to/output \
--export_project_name MyExportedProject \
--export_file_name my_config.yaml \
--access_key_id AKID1234567890 \
--access_key_secret secret1234567890 \
--security_token security_token_value
Generating Files or Projects
Description
Generate a file or project by specifying the output directory.
Parameters
Parameter | Required | Description | Example Value |
---|---|---|---|
--output_path |
Yes | Path to the output directory where the generated files will be saved. | /path/to/output |
--file_path |
No | Path to the specific file to be generated. | /path/to/file.txt |
--type |
No | Type of generation. Options include file for a single file or project for the whole project. |
file |
--parameters |
No | Parameters in JSON format as a string. Defaults to an empty JSON object {} . |
{"key1": "value1"} |
--parameter_path |
No | Path to a parameter file. If provided, this will override the --parameters option. |
/path/to/parameters.json |
--overwrite , -y |
No | Confirm to overwrite the output file without a prompt if set. | (no example, just a flag) |
Example:
computenest-cli generate \
--type file \
--file_path /path/to/file.txt \
--parameters '{"key1": "value1", "key2": "value2"}' \
--output_path /path/to/output \
--parameter_path /path/to/parameters.json \
--overwrite
Getting Help
To obtain help for a specific command, add --help
after the command:
computenest-cli import --help
How to Get the AccessKey Pair
Follow the instructions to create an AccessKey pair: Create an AccessKey pair
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for computenest_cli-1.5.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c83b0d20e9e41362e2ff700565e15d6ed65914cb600098922f63a607e7d2360 |
|
MD5 | c8e8e4768fb2cdf8c2152e3eb8f0248d |
|
BLAKE2b-256 | 7aba165edf996e980a4e44b81c169bdd8f07409665a58f66596c60717c9fc7dc |