{"id":19411521,"url":"https://github.com/volcengine/volcengine-cli","last_synced_at":"2025-04-24T10:33:50.465Z","repository":{"id":63649516,"uuid":"569523388","full_name":"volcengine/volcengine-cli","owner":"volcengine","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-25T12:51:30.000Z","size":1731,"stargazers_count":8,"open_issues_count":4,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-25T14:30:16.797Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/volcengine.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-23T02:37:49.000Z","updated_at":"2024-07-25T12:51:18.000Z","dependencies_parsed_at":"2023-12-28T13:49:57.834Z","dependency_job_id":"5e120899-a436-4db1-984b-5dd2340d34d8","html_url":"https://github.com/volcengine/volcengine-cli","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fvolcengine-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fvolcengine-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fvolcengine-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volcengine%2Fvolcengine-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/volcengine","download_url":"https://codeload.github.com/volcengine/volcengine-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223950355,"owners_count":17230460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T12:21:50.692Z","updated_at":"2024-11-10T12:21:51.341Z","avatar_url":"https://github.com/volcengine.png","language":"Go","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"## Volcengine Command Line Tools\n### 特别说明\n为了便于用户使用，从v1.0.20版本开始，火山引擎CLI工具命令前缀由“volcengine-cli”  更新为“ve”。低版本不受影响，请升级到v1.0.20及以后版本的用户及时更新指令前缀（可参考alias命令统一设置）。\n\n###  概述\n1. 火山引擎-命令行工具\n2. Go版本最低1.5+ 推荐是用1.12+\n\n### 安装 火山引擎CLI \n\n#### 通过release获取客户端\n1. https://github.com/volcengine/volcengine-cli/releases 获取最新版本\n2. 下载对应操作系统的版本 解压使用\n\n#### 自行编译获取客户端\n\n1. 使用build.sh编译客户端\n    ```shell\n    # 如果是mac \n    sh build.sh darwin\n    mv ve-darwin ve\n    # 如果是windows\n    sh build.sh windows\n    mv ve-windows ve\n    # 如果是linux\n    sh build.sh linux\n    mv ve-linux ve\n    ```\n\n\n​    \n\n### 配置 火山引擎CLI\n\n将 火山引擎CLI 配置进环境变量\n\n1. 检查一下 $PATH 系统变量是否存在 /usr/local/bin，若没有则请您根据实际情况为 火山引擎CLI 设置可用的环境变量\n\n2. 执行下面的命令，将 ve 拷贝至 /usr/local/bin 目录下即可使用\n\n    ```shell\n    sudo cp ve /usr/local/bin\n    ```\n\n\n\n#### 配置凭证\n\n调用服务需要用到 AK，SK，region，可以通过以下两种方式进行配置\n1. 通过 ve configure set 设置，示例\n\n   ```shell\n   ve configure set --profile test --region cn-beijing --access-key ak --secret-key sk\n   ```\n   支持参数及相关说明\n\n   ```shell\n   profile: 配置名称，如果 profile 已存在，则该命令会修改已有配置；否则就会新建配置，并将当前使用的profile指定为新配置\n   access-key: 您的 AK\n   secret-key: 您的 SK\n   region: 地域，如 cn-beijing\n   session-token: 如果使用角色扮演，需要提供\n   disable-ssl: 是否禁用 ssl，默认为 false\n   endpoint: 可以不填，默认值为 open.volcengineapi.com\n   ```\n\n2. 若配置文件中无配置，则会尝试从 export 的环境变量中读取配置\n   ```shell\n   export VOLCENGINE_ACCESS_KEY=AK\n   export VOLCENGINE_SECRET_KEY=SK\n   export VOLCENGINE_REGION=cn-bejing\n   \n   # 是否禁用SSL, 不设置的话默认为false\n   export VOLCENGINE_DISABLE_SSL=false\n   \n   # 如果使用角色扮演，需要提供\n   export VOLCENGINE_SESSION_TOKEN=sessionToken\n   ```\n\n\n\n#### configure命令的其他操作\n\n1. 火山引擎CLI使用configure配置profile之后，会优先使用profile中的鉴权信息进行接口签名访问\n2. 新增或者修改profile后，当前configure中的默认使用profile会被切换到新增或者修改的profile上\n3. 如果存在多个profile，请在调用接口前，使用ve configure profile --profile [配置名] 进行切换，以保证正确的使用\n\n###### 获取指定配置(profile)信息\n\n```shell\nve configure get --profile [配置名]\n```\n\n其中 profile 为可选字段，若不指定 profile 字段则会展示当前配置；若指定了 profile 则 火山引擎CLI 会尝试获取指定配置并展示\n\n若配置不存在，则返回的配置字段全为默认值\n\n\n\n###### 显示当前所有配置(profile)信息\n\n```shell\nve configure list\n```\n\n###### 切换当前使用的配置(profile)信息 请确保版本大于或者等于\u003e=1.0.16\n\n```shell\nve configure profile --profile [配置名]\n```\n\n其中 profile 为必选字段，指定了 profile 则 火山引擎CLI 会尝试获切换当前的配值\n\n若配置不存在，当前的配置不会发生切换，并且会给出错误的提示\n\n\n###### 新建/修改配置(profile)\n\n```shell\nve configure set --profile [配置名] --region [地区] --access-key [用户的AK] --secret-key [用户的SK] --endpoint [地区对应的endpoint]\n```\n\n新建或者修改配置后，当前的使用配置会切换到修改的配置上\n\n新建配置时必须指定 profile 字段和 region 字段，修改已有配置必须指定 profile 字段\n\n其余可指定的字段：\n\n- access-key\n- secret-key\n- region\n- session-token\n- disable-ssl\n\n各个字段的作用您可以参考上节中 \"支持参数及相关说明\" 部分\n\n\n\n###### 删除配置(profile)\n\n```shell\nve configure delete --profile [配置名]\n```\n\n删除配置时必须指定 profile 字段以指示需要删除的配置名\n\n若待删除的是当前正在使用的配置，则删除成功后 火山引擎CLI 会尝试从剩余的配置中随机挑选一个作为当前配置\n\n\n\n#### 配置自动补全\n\n使用 ve completion --help 可以查看各种终端下配置自动补全的方式，用户可以根据提示信息自己选择是否配置自动补全功能\n\n\u003cbr/\u003e\n\n##### Bash\n\n火山引擎CLI 的 Bash 补全脚本可以通过 ve completion bash 进行查看，在 shell 中导入该自动补全脚本，即可开启自动补全功能\n\n###### 1. 安装 bash-completion\n\n火山引擎CLI 补全脚本依赖于工具 bash-completiom，所以你必须先安装并启用它（可以用命令 type _init_completion 检查 bash-completion 是否已安装）\n\n1. 安装：yum install bash-completion 或 apt-get install bash-completion\n\n2. 启用 bash-completion：source /usr/share/bash-completion/bash_completion\n\n    建议将 source /usr/share/bash-completion/bash_completion 添加至 ~/.bashrc 中\n\n3. 检查 bash-completion 是否安装成功：执行 type _init_completion 验证 bash-completion 的安装状态\n\n\n\n###### 2. 配置自动补全\n\n按以下步骤配置即可在 Bash 下开启自动补全功能：\n\n1. echo 'source \u003c(ve completion bash)' \u003e\u003e ~/.bashrc\n2. ve completion bash \u003e /etc/bash_completion.d/ve\n\n之后重新加载 Shell （或者 source ~/.bashrc） 后即可生效\n\n\n\n若出现 _get_comp_words_by_ref: command not found 的错误，请再次检查 bash-completion 是否安装配置成功\n\n\u003cbr/\u003e\n\n##### Zsh\n\n火山引擎CLI 的 Zsh 补全脚本可以通过 ve completion zsh 进行查看，在 shell 中导入该自动补全脚本，即可开启自动补全功能\n\n按以下步骤配置即可在 Zsh 下开启自动补全功能：\n\n1. Zsh 中启用 compinit：\n    echo \"autoload -U compinit; compinit\" \u003e\u003e ~/.zshrc\n2. 配置自动补全\n    ve completion zsh \u003e \"${fpath[1]}/_ve\"\n\n之后重新加载 Shell （或者 source ~/.zshrc） 后即可生效\n\n\n\n\n\n#### 配置颜色 \n\n使用 ve enable-color 可以开启彩色显示功能\n\n使用 ve disable-color 可以关闭彩色显示功能\n\n\n\n\n### 使用 火山引擎CLI\n#### 查询支持的服务列表及服务下支持的接口列表\n\n1. 查询支持的服务列表\n   ```shell\n   ve [-h|--help]\n   ```\n2. 查询服务下支持的接口列表\n   ```shell\n   ve ecs [-h|--help]\n   ```\n\n\n\n#### 调用API\n\n使用 火山引擎CLI 调用 API 时，基本命令结构如下：\n\n```shell\nve \u003cservice name\u003e \u003caction\u003e [--parameter1 value1 --parameter2 value2 ...]\n```\n\n您可以使用 ve \u0026lt;service name\u0026gt; \u0026lt;action\u0026gt; --help 查看想要调用的API的参数列表、返回结果等信息，例如：ve ecs DescribeInstances --help\n\n若需要查看更详细的信息，您也可以在 https://www.volcengine.com/docs 进行查阅\n\n\u003cbr/\u003e\n\n以下提供一些代码示例：\n\n- 基本使用\n\n    ```shell\n    ve ecs DescribeInstances\n    ```\n\n    ```shell\n    ve rds_mysql ListDBInstanceIPLists --InstanceId \"xxxxxx\"\n    ```\n\n- 支持传入 JSON\n\n    ```shell\n    ve rds_mysql ModifyDBInstanceIPList --InstanceId \"xxxxxx\" --GroupName \"xxxxxx\" --IPList '[\"10.20.30.40\", \"50.60.70.80\"]'\n    ```\n\n- 对于 ContentType 为 application/json 的请求，火山引擎CLI 还支持直接将 body 作为 JSON 数据传入\n\n    ```shell\n    ve rds_mysql ModifyDBInstanceIPList --body '{\"InstanceId\":\"xxxxxx\", \"GroupName\": \"xxxxxx\", \"IPList\": [\"10.20.30.40\", \"50.60.70.80\"]}'\n    ```\n\n    \n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolcengine%2Fvolcengine-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvolcengine%2Fvolcengine-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolcengine%2Fvolcengine-cli/lists"}