项目 CLI 参考
IBM Cloud® 命令行界面 (CLI) 为服务产品提供额外功能。 您可以使用 IBM Cloud CLI 来管理您有权访问的项目。
准备工作
-
安装 IBM Cloud CLI。
-
运行以下命令安装Project CLI:
ibmcloud plugin install project
当 IBM Cloud CLI 和插件的更新可用时,将在命令行上通知您。 确保 CLI 保持最新,以便您可以使用最新的命令。 您可以通过运行 ibmcloud plugin list
来查看所有已安装插件的当前版本。
IBM Cloud CLI 需要 Java™ 1.8.0。
项目
项目资源的命令。
ibmcloud project create
创建项目并异步设置管理工具。 通过定制配置来添加可部署体系结构。 验证并核准更改后,部署项目配置的资源。 有关更多信息,请参阅 创建项目。
ibmcloud project create [--definition DEFINITION | --definition-name DEFINITION-NAME --definition-destroy-on-delete=DEFINITION-DESTROY-ON-DELETE --definition-description DEFINITION-DESCRIPTION --definition-auto-deploy=DEFINITION-AUTO-DEPLOY --definition-monitoring-enabled=DEFINITION-MONITORING-ENABLED] --location LOCATION --resource-group RESOURCE-GROUP [--configs CONFIGS] [--environments ENVIRONMENTS]
命令选项
--definition
(ProjectPrototypeDefinition
)-
项目的定义。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --location
(字符串)-
部署资源的 IBM Cloud 位置。 必需。
允许的值为:
us-south
,us-east
,eu-gb
,eu-de
和ca-tor
。 --resource-group
(字符串)-
在其中创建项目数据和工具的资源组名称。 必需。
最大长度为
64
个字符。 最小长度为0
个字符。 The value must match the regular expression/^(?!\\s)(?!.*\\s$)[^'"
<>{}\x00-\x1F]*$/`. --configs
(ProjectConfigPrototype[]
)-
项目配置。 仅当在请求有效内容中指定了配置数组时,这些配置才包含在创建项目的响应中。
默认值为
[]
。 最多长度为100
项。 最少长度为0
项。提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--configs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --environments
(EnvironmentPrototype[]
)-
项目环境。 仅当在请求有效内容中指定了环境数组时,这些环境才包含在创建项目的响应中。
默认值为
[]
。 最多长度为20
项。 最少长度为0
项。提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--environments=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-name
(字符串)-
项目的名称。 它在各个区域的帐户中都是唯一的。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 最小长度为1
个字符。 值必须与正则表达式/^(?!\\s)(?!.*\\s$)[^'"
<>{}\x00-\x1F]+$/` 匹配。 --definition-destroy-on-delete
(bool)-
指示删除项目时是否取消部署资源的策略。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
默认值为
true
。 --definition-description
(字符串)-
项目在可部署体系结构配置中的使用的简要说明。 您可以在不提供描述的情况下创建项目。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
缺省值为
1024
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --definition-auto-deploy
(bool)-
布尔标志,用于启用自动部署。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
默认值为
false
。 --definition-monitoring-enabled
(bool)-
用于启用自动漂移检测的布尔标志。 使用此字段来运行每日检查,以将配置与已部署的资源进行比较,从而检测任何差异。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
默认值为
false
。
示例
ibmcloud project create \
--definition '{"name": "acme-microservice", "destroy_on_delete": true, "description": "A microservice to deploy on top of ACME infrastructure.", "auto_deploy": false, "monitoring_enabled": false}' \
--location us-south \
--resource-group Default \
--configs '[{"definition": {"compliance_profile": {"id": "exampleString", "instance_id": "exampleString", "instance_location": "us-south", "attachment_id": "exampleString", "profile_name": "exampleString"}, "locator_id": "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global", "description": "The stage account configuration.", "name": "account-stage", "environment_id": "exampleString", "authorizations": {"trusted_profile_id": "exampleString", "method": "api_key", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}, "schematics": {"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}}]' \
--environments '[{"definition": {"description": "exampleString", "name": "exampleString", "authorizations": {"trusted_profile_id": "exampleString", "method": "api_key", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "compliance_profile": {"id": "exampleString", "instance_id": "exampleString", "instance_location": "us-south", "attachment_id": "exampleString", "profile_name": "exampleString"}}}]'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project create \
--location us-south \
--resource-group Default \
--configs '[projectConfigPrototype]' \
--environments '[environmentPrototype]' \
--definition-name exampleString \
--definition-destroy-on-delete=true \
--definition-description exampleString \
--definition-auto-deploy=false \
--definition-monitoring-enabled=false
ibmcloud project list
列出现有项目。 项目按标识排序。 注意:如果未设置 --all-pages
选项,则命令仅检索集合的单页。
ibmcloud project list [--token TOKEN] [--limit LIMIT]
命令选项
--token
(字符串)-
服务器使用此参数来确定下一页上返回的第一个条目。 如果未指定此参数,那么将返回逻辑第一页。
缺省值为
1536
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --limit
(int64)-
返回的最大资源数量。 返回的资源数相同,但最后一页除外。
默认值为
10
。 最大值为100
。 最小值为1
。 --all-pages
(bool)-
启动多个请求以显示列表中所有页面。
示例
ibmcloud project list \
--token exampleString \
--limit 10
示例输出
用于列出项目的示例请求。
{
"limit" : 10,
"first" : {
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"next" : {
"href" : "https://projects.api.cloud.ibm.com/v1/projects/12349050-1234-ac97-0000-ba5a12fe9087"
},
"projects" : [ {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.service.url/v1/projects/cfbf901-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"description" : "A project example.",
"name" : "iaas-infra-prestage-env",
"auto_deploy" : false,
"destroy_on_delete" : false,
"monitoring_enabled" : false
},
"location" : "us-south",
"state" : "ready",
"resource_group" : "Default",
"resource_group_id" : "f37d2637ea814cfd9a1742683a713d24",
"cumulative_needs_attention_view" : [ {
"event" : "project.instance.update"
}, {
"event_id" : "489f0090-6d7c-4af5-8f20-9106543e4974"
}, {
"config_id" : "069ab83e-5016-4bf2-bd50-cc95cf678293"
}, {
"config_version" : 1
} ]
}, {
"id" : "1123ed42-4356-efa1-1101-235900fe9087",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.service.url/v1/projects/cfbf901-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"description" : "A project example.",
"name" : "iaas-infra-stage-env",
"auto_deploy" : false,
"destroy_on_delete" : false,
"monitoring_enabled" : false
},
"crn" : "crn:v1:staging:public:project:eu-de:a/06580d923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"location" : "eu-gb",
"state" : "ready",
"resource_group" : "Default",
"resource_group_id" : "f37d2637ea814cfd9a1742683a713d24",
"cumulative_needs_attention_view" : [ ]
} ]
}
ibmcloud project get
获取项目信息。
ibmcloud project get --id ID
命令选项
--id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project get \
--id exampleString
示例输出
用于检索具有配置的项目的样本响应。
{
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.service.url/v1/projects/cfbf901-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "acme-microservice",
"description" : "A microservice to deploy on top of ACME infrastructure.",
"auto_deploy" : false,
"destroy_on_delete" : true,
"monitoring_enabled" : false
},
"configs" : [ {
"id" : "673d79e4-52bf-4184-b8e9-d3ca3c110f96",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "common-variables",
"description" : "The common-variables configuration."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/673d79e4-52bf-4184-b8e9-d3ca3c110f96",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"modified_at" : "2023-02-22T19:51:23.253Z",
"update_available" : false,
"version" : 1
}, {
"id" : "4a1d4ba2-54ba-43a7-975a-d82b5a7612d1",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "account-stage",
"description" : "The stage account configuration. The stage account hosts test environments prestage, performance, stage. This configuration configures services that are common to all these environments and regions. It's a `terraform_template` type of configuration that points to a GitHub repository that hosts the terraform modules that a Schematics workspace can deploy."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/4a1d4ba2-54ba-43a7-975a-d82b5a7612d1",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"update_available" : false,
"modified_at" : "2023-02-22T19:51:23.253Z",
"version" : 1
}, {
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "env-stage",
"description" : "The stage environment configuration. It includes services that are common to all the environment regions. You must have a blueprint that configures all the services that are common to the stage regions. It's a `terraform_template` type of configuration that points to a GitHub repository that hosts the Terraform modules that a Schematics workspace can deploy."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/293c3c36-a094-4115-a12b-de0a9ca39be5",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"update_available" : false,
"modified_at" : "2023-02-22T19:51:23.253Z",
"version" : 1
}, {
"id" : "596e8656-9d4b-41a5-8340-b0cbe8bd374a",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "region-us-south-stage",
"description" : "The stage `us-south` configuration. You must have a blueprint that configures the Virtual Private Cloud and Red Hat OpenShift stage `us-south`."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/596e8656-9d4b-41a5-8340-b0cbe8bd374a",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"update_available" : false,
"modified_at" : "2023-02-22T19:51:23.253Z",
"version" : 1
}, {
"id" : "9c7afed6-17fb-4c56-a13d-440a78f936bd",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "region-eu-de-stage",
"description" : "The stage `eu-de` configuration. You must have a blueprint that configures the Virtual Private Cloud and Red Hat OpenShift stage `eu-de`."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/9c7afed6-17fb-4c56-a13d-440a78f936bd",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"update_available" : false,
"modified_at" : "2023-02-22T19:51:23.253Z",
"version" : 1
} ],
"environments" : [ {
"id" : "b0c44146-1ef6-40c2-82ba-74d51149770a",
"definition" : {
"name" : "dev-environment",
"description" : "The development environment."
},
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"created_at" : "2023-02-10T10:05:35.787Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/environments/b0c44146-1ef6-40c2-82ba-74d51149770a"
} ],
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"cumulative_needs_attention_view" : [ {
"event" : "project.instance.update"
}, {
"event_id" : "489f0090-6d7c-4af5-8f20-9106543e4974"
}, {
"config_id" : "069ab83e-5016-4bf2-bd50-cc95cf678293"
}, {
"config_version" : 1
} ],
"event_notifications_crn" : "crn:v1:staging:public:event-notifications:us-south:a/06580c923e40314421d3b6cb40c01c68:instance-id::",
"location" : "us-south",
"resource_group" : "Default",
"resource_group_id" : "f37d2637ea814cfd9a1742683a713d24",
"state" : "ready"
}
ibmcloud project update
通过指定项目标识来更新项目。
ibmcloud project update --id ID [--definition DEFINITION | --definition-name DEFINITION-NAME --definition-destroy-on-delete=DEFINITION-DESTROY-ON-DELETE --definition-auto-deploy=DEFINITION-AUTO-DEPLOY --definition-description DEFINITION-DESCRIPTION --definition-monitoring-enabled=DEFINITION-MONITORING-ENABLED]
命令选项
--id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --definition
(ProjectPatchDefinitionBlock
)-
项目的定义。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-name
(字符串)-
项目的名称。 它在各个区域的帐户中都是唯一的。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 最小长度为1
个字符。 值必须与正则表达式/^(?!\\s)(?!.*\\s$)[^'"
<>{}\x00-\x1F]+$/` 匹配。 --definition-destroy-on-delete
(bool)-
指示删除项目时是否破坏资源的策略。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
--definition-auto-deploy
(bool)-
布尔标志,用于启用自动部署。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
--definition-description
(字符串)-
项目在可部署体系结构配置中的使用的简要说明。 您可以在不提供描述的情况下创建项目。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
1024
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --definition-monitoring-enabled
(bool)-
布尔标志,用于启用自动漂移检测。 使用此字段来运行每日检查,以将配置与已部署的资源进行比较,从而检测任何差异。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
示例
ibmcloud project update \
--id exampleString \
--definition '{"name": "acme-microservice", "destroy_on_delete": true, "auto_deploy": true, "description": "A microservice to deploy on top of ACME infrastructure.", "monitoring_enabled": true}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project update \
--id exampleString \
--definition-name exampleString \
--definition-destroy-on-delete=true \
--definition-auto-deploy=true \
--definition-description exampleString \
--definition-monitoring-enabled=true
示例输出
用于检索具有配置的项目的样本响应。
{
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.service.url/v1/projects/cfbf901-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "acme-microservice",
"description" : "A microservice to deploy on top of ACME infrastructure.",
"auto_deploy" : false,
"destroy_on_delete" : true,
"monitoring_enabled" : false
},
"configs" : [ {
"id" : "673d79e4-52bf-4184-b8e9-d3ca3c110f96",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "common-variables",
"description" : "The common-variables configuration."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/673d79e4-52bf-4184-b8e9-d3ca3c110f96",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"modified_at" : "2023-02-22T19:51:23.253Z",
"update_available" : false,
"version" : 1
}, {
"id" : "4a1d4ba2-54ba-43a7-975a-d82b5a7612d1",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "account-stage",
"description" : "The stage account configuration. The stage account hosts test environments prestage, performance, stage. This configuration configures services that are common to all these environments and regions. It's a `terraform_template` type of configuration that points to a GitHub repository that hosts the terraform modules that a Schematics workspace can deploy."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/4a1d4ba2-54ba-43a7-975a-d82b5a7612d1",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"update_available" : false,
"modified_at" : "2023-02-22T19:51:23.253Z",
"version" : 1
}, {
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "env-stage",
"description" : "The stage environment configuration. It includes services that are common to all the environment regions. You must have a blueprint that configures all the services that are common to the stage regions. It's a `terraform_template` type of configuration that points to a GitHub repository that hosts the Terraform modules that a Schematics workspace can deploy."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/293c3c36-a094-4115-a12b-de0a9ca39be5",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"update_available" : false,
"modified_at" : "2023-02-22T19:51:23.253Z",
"version" : 1
}, {
"id" : "596e8656-9d4b-41a5-8340-b0cbe8bd374a",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "region-us-south-stage",
"description" : "The stage `us-south` configuration. You must have a blueprint that configures the Virtual Private Cloud and Red Hat OpenShift stage `us-south`."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/596e8656-9d4b-41a5-8340-b0cbe8bd374a",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"update_available" : false,
"modified_at" : "2023-02-22T19:51:23.253Z",
"version" : 1
}, {
"id" : "9c7afed6-17fb-4c56-a13d-440a78f936bd",
"created_at" : "2023-02-22T19:51:23.253Z",
"definition" : {
"name" : "region-eu-de-stage",
"description" : "The stage `eu-de` configuration. You must have a blueprint that configures the Virtual Private Cloud and Red Hat OpenShift stage `eu-de`."
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/9c7afed6-17fb-4c56-a13d-440a78f936bd",
"is_draft" : true,
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"state" : "draft",
"update_available" : false,
"modified_at" : "2023-02-22T19:51:23.253Z",
"version" : 1
} ],
"environments" : [ {
"id" : "b0c44146-1ef6-40c2-82ba-74d51149770a",
"definition" : {
"name" : "dev-environment",
"description" : "The development environment."
},
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"created_at" : "2023-02-10T10:05:35.787Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/environments/b0c44146-1ef6-40c2-82ba-74d51149770a"
} ],
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"cumulative_needs_attention_view" : [ {
"event" : "project.instance.update"
}, {
"event_id" : "489f0090-6d7c-4af5-8f20-9106543e4974"
}, {
"config_id" : "069ab83e-5016-4bf2-bd50-cc95cf678293"
}, {
"config_version" : 1
} ],
"event_notifications_crn" : "crn:v1:staging:public:event-notifications:us-south:a/06580c923e40314421d3b6cb40c01c68:instance-id::",
"location" : "us-south",
"resource_group" : "Default",
"resource_group_id" : "f37d2637ea814cfd9a1742683a713d24",
"state" : "ready"
}
ibmcloud project delete
通过指定标识来删除项目文档。 只有在删除项目的所有资源之后,才能删除该项目。
ibmcloud project delete --id ID
命令选项
--id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project delete \
--id exampleString
示例输出
用于删除项目的请求的示例响应。
{
"id" : "4059955c-ccb3-4fd3-aa48-34e3b8334f80"
}
环境
用于环境资源的命令。
ibmcloud project environment-create
创建环境以将相关配置分组在一起,并在这些配置之间共享值,从而更轻松地进行部署。 有关更多信息,请参阅 创建环境。
ibmcloud project environment-create --project-id PROJECT-ID [--definition DEFINITION | --definition-description DEFINITION-DESCRIPTION --definition-name DEFINITION-NAME --definition-authorizations DEFINITION-AUTHORIZATIONS --definition-inputs DEFINITION-INPUTS --definition-compliance-profile DEFINITION-COMPLIANCE-PROFILE]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --definition
(EnvironmentDefinitionRequiredProperties
)-
环境定义。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-description
(字符串)-
环境的描述。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
缺省值为
1024
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --definition-name
(字符串)-
环境的名称。 它在各个项目和区域的帐户中都是独一无二的。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 最小长度为1
个字符。 值必须与正则表达式/^(?!\\s)(?!.*\\s$)[^'"
<>{}\x00-\x1F]+$/` 匹配。 --definition-authorizations
(ProjectConfigAuth
)-
授权详细信息。 您可以在 Secrets Manager中使用可信概要文件或 API 密钥进行授权。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-authorizations=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-inputs
(通用映射)-
用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-inputs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-compliance-profile
(ProjectComplianceProfile
)-
合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-compliance-profile=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。
示例
ibmcloud project environment-create \
--project-id exampleString \
--definition '{"description": "The environment development.", "name": "development", "authorizations": {"trusted_profile_id": "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12", "method": "trusted_profile", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "compliance_profile": {"id": "some-profile-id", "instance_id": "some-instance-id", "instance_location": "us-south", "attachment_id": "some-attachment-id", "profile_name": "some-profile-name"}}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project environment-create \
--project-id exampleString \
--definition-description exampleString \
--definition-name exampleString \
--definition-authorizations projectConfigAuth \
--definition-inputs '{"anyKey": "anyValue"}' \
--definition-compliance-profile projectComplianceProfile
示例输出
样本环境响应。
{
"id" : "env123",
"definition" : {
"name" : "development",
"description" : "The environment development.",
"authorizations" : {
"method" : "trusted_profile",
"trusted_profile_id" : "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12"
},
"inputs" : {
"resource_group" : "stage",
"region" : "us-south"
},
"compliance_profile" : {
"id" : "some-profile-id",
"instance_id" : "some-instance-id",
"instance_location" : "us-south",
"profile_name" : "some-profile-name",
"attachment_id" : "some-attachment-id"
}
},
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"created_at" : "2023-06-29T03:28:14.709Z",
"modified_at" : "2023-06-29T03:28:14.709Z",
"href" : "https://projects.api.test.cloud.ibm.com/v1/projects/6fd53106-7ce6-429e-8c57-f22e832d0c4b/environments/2102afed-94c7-46fe-90f2-7fff290637b4"
}
ibmcloud project environments
列出所有可用环境。 有关更多信息,请参阅 创建环境。 注意:如果未设置 --all-pages
选项,则命令仅检索集合的单页。
ibmcloud project environments --project-id PROJECT-ID [--token TOKEN] [--limit LIMIT]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --token
(字符串)-
服务器使用此参数来确定下一页上返回的第一个条目。 如果未指定此参数,那么将返回逻辑第一页。
缺省值为
1536
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --limit
(int64)-
返回的最大资源数量。 返回的资源数相同,但最后一页除外。
默认值为
10
。 最大值为100
。 最小值为1
。 --all-pages
(bool)-
启动多个请求,以显示环境集合的所有页面。
示例
ibmcloud project environments \
--project-id exampleString \
--token exampleString \
--limit 10
示例输出
列表的样本环境响应。
{
"limit" : 1,
"first" : {
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/environments?limit=1"
},
"next" : {
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/environments?limit=1&token=da969bff-vf9q-3t1t-b677-d6rt5c0de54e"
},
"environments" : [ {
"id" : "env123",
"definition" : {
"name" : "development",
"description" : "The environment development.",
"authorizations" : {
"method" : "trusted_profile",
"trusted_profile_id" : "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12"
},
"inputs" : {
"resource_group" : "stage",
"region" : "us-south"
},
"compliance_profile" : {
"id" : "some-profile-id",
"instance_id" : "some-instance-id",
"instance_location" : "us-south",
"profile_name" : "some-profile-name",
"attachment_id" : "some-attachment-id"
}
},
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"created_at" : "2023-06-29T03:28:14.709Z",
"modified_at" : "2023-06-29T03:28:14.709Z",
"href" : "https://projects.api.test.cloud.ibm.com/v1/projects/6fd53106-7ce6-429e-8c57-f22e832d0c4b/environments/2102afed-94c7-46fe-90f2-7fff290637b4"
} ]
}
ibmcloud project environment
获取环境。 了解更多信息。
ibmcloud project environment --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
环境标识。 必需。
最大长度为
256
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^(?!\\s)(?!.*\\s$).+$/
匹配。
示例
ibmcloud project environment \
--project-id exampleString \
--id exampleString
示例输出
样本环境响应。
{
"id" : "env123",
"definition" : {
"name" : "development",
"description" : "The environment development.",
"authorizations" : {
"method" : "trusted_profile",
"trusted_profile_id" : "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12"
},
"inputs" : {
"resource_group" : "stage",
"region" : "us-south"
},
"compliance_profile" : {
"id" : "some-profile-id",
"instance_id" : "some-instance-id",
"instance_location" : "us-south",
"profile_name" : "some-profile-name",
"attachment_id" : "some-attachment-id"
}
},
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"created_at" : "2023-06-29T03:28:14.709Z",
"modified_at" : "2023-06-29T03:28:14.709Z",
"href" : "https://projects.api.test.cloud.ibm.com/v1/projects/6fd53106-7ce6-429e-8c57-f22e832d0c4b/environments/2102afed-94c7-46fe-90f2-7fff290637b4"
}
ibmcloud project environment-update
通过指定环境标识来更新环境。 了解更多信息。
ibmcloud project environment-update --project-id PROJECT-ID --id ID [--definition DEFINITION | --definition-description DEFINITION-DESCRIPTION --definition-name DEFINITION-NAME --definition-authorizations DEFINITION-AUTHORIZATIONS --definition-inputs DEFINITION-INPUTS --definition-compliance-profile DEFINITION-COMPLIANCE-PROFILE]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
环境标识。 必需。
最大长度为
256
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^(?!\\s)(?!.*\\s$).+$/
匹配。 --definition
(EnvironmentDefinitionPropertiesPatch
)-
用于更新的环境定义。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-description
(字符串)-
环境的描述。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
1024
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --definition-name
(字符串)-
环境的名称。 它在各个项目和区域的帐户中都是独一无二的。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 最小长度为1
个字符。 值必须与正则表达式/^(?!\\s)(?!.*\\s$)[^'"
<>{}\x00-\x1F]+$/` 匹配。 --definition-authorizations
(ProjectConfigAuth
)-
授权详细信息。 您可以在 Secrets Manager中使用可信概要文件或 API 密钥进行授权。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-authorizations=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-inputs
(通用映射)-
用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-inputs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-compliance-profile
(ProjectComplianceProfile
)-
合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-compliance-profile=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。
示例
ibmcloud project environment-update \
--project-id exampleString \
--id exampleString \
--definition '{"description": "The environment development.", "name": "development", "authorizations": {"trusted_profile_id": "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12", "method": "trusted_profile", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "compliance_profile": {"id": "some-profile-id", "instance_id": "some-instance-id", "instance_location": "us-south", "attachment_id": "some-attachment-id", "profile_name": "some-profile-name"}}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project environment-update \
--project-id exampleString \
--id exampleString \
--definition-description exampleString \
--definition-name exampleString \
--definition-authorizations projectConfigAuth \
--definition-inputs '{"anyKey": "anyValue"}' \
--definition-compliance-profile projectComplianceProfile
示例输出
样本环境响应。
{
"id" : "env123",
"definition" : {
"name" : "development",
"description" : "The environment development.",
"authorizations" : {
"method" : "trusted_profile",
"trusted_profile_id" : "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12"
},
"inputs" : {
"resource_group" : "stage",
"region" : "us-south"
},
"compliance_profile" : {
"id" : "some-profile-id",
"instance_id" : "some-instance-id",
"instance_location" : "us-south",
"profile_name" : "some-profile-name",
"attachment_id" : "some-attachment-id"
}
},
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"created_at" : "2023-06-29T03:28:14.709Z",
"modified_at" : "2023-06-29T03:28:14.709Z",
"href" : "https://projects.api.test.cloud.ibm.com/v1/projects/6fd53106-7ce6-429e-8c57-f22e832d0c4b/environments/2102afed-94c7-46fe-90f2-7fff290637b4"
}
ibmcloud project environment-delete
通过指定项目标识来删除项目中的环境。
ibmcloud project environment-delete --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
环境标识。 必需。
最大长度为
256
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^(?!\\s)(?!.*\\s$).+$/
匹配。
示例
ibmcloud project environment-delete \
--project-id exampleString \
--id exampleString
示例输出
示例 environment delete
响应。
{
"id" : "env123"
}
配置
配置资源的命令。
ibmcloud project config-create
将配置添加到项目中。
ibmcloud project config-create --project-id PROJECT-ID [--definition DEFINITION | --definition-compliance-profile DEFINITION-COMPLIANCE-PROFILE --definition-locator-id DEFINITION-LOCATOR-ID --definition-description DEFINITION-DESCRIPTION --definition-name DEFINITION-NAME --definition-environment-id DEFINITION-ENVIRONMENT-ID --definition-authorizations DEFINITION-AUTHORIZATIONS --definition-inputs DEFINITION-INPUTS --definition-settings DEFINITION-SETTINGS --definition-members DEFINITION-MEMBERS --definition-resource-crns DEFINITION-RESOURCE-CRNS] [--schematics SCHEMATICS | --schematics-workspace-crn SCHEMATICS-WORKSPACE-CRN]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --definition
(ProjectConfigDefinitionPrototype
)-
可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --schematics
(SchematicsWorkspace
)-
用于部署此可部署体系结构的 Schematics 工作空间。
如果要从购物车不支持的现有 Schematics 工作空间导入数据,那么必须提供
locator_id
。 如果您使用的是由购物车支持的 Schematics 工作空间,那么不需要locator_id
,因为 Schematics 工作空间具有一个。存在 3 种情况:
- 如果仅指定了
locator_id
,那么将使用该locator_id
实例化新的 Schematics 工作空间。 - 如果仅指定了示意图
workspace_crn
,那么在现有示意图工作空间中找不到locator_id
时,将返回400
。 - 如果同时指定了 Schematics
workspace_crn
和locator_id
,如果指定的locator_id
与现有 Schematics 工作区中的locator_id
不一致,将返回400
代码。
有关更多信息,请参阅 创建工作空间和导入 Terraform 模板。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--schematics=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 - 如果仅指定了
--definition-compliance-profile
(ProjectComplianceProfile
)-
合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-compliance-profile=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-locator-id
(字符串)-
目录标识和版本标识的唯一并置,用于标识目录中的可部署体系结构。 如果从现有的Schematics工作区导入,而该工作区没有 cart 支持,则需要
locator_id
。 如果您使用的是由购物车支持的 Schematics 工作空间,那么不需要locator_id
,因为 Schematics 工作空间具有此工作空间。存在 3 种情况:
- 如果仅指定了
locator_id
,那么将使用该locator_id
实例化新的 Schematics 工作空间。 - 如果仅指定了示意图
workspace_crn
,那么在现有示意图工作空间中找不到locator_id
时,将返回400
。 - 如果同时指定了 Schematics
workspace_crn
和locator_id
,那么当指定的locator_id
与现有 Schematics 工作空间中的locator_id
不一致时,将返回400
消息。 有关创建 Schematics 工作区的更多信息,请参阅 创建工作区和导入 Terraform 模板。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
512
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/
匹配。 - 如果仅指定了
--definition-description
(字符串)-
项目配置描述。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
缺省值为
1024
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --definition-name
(字符串)-
配置名称。 它在各个项目和区域的帐户中都是独一无二的。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/
匹配。 --definition-environment-id
(字符串)-
项目环境的ID。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --definition-authorizations
(ProjectConfigAuth
)-
授权详细信息。 您可以在 Secrets Manager中使用可信概要文件或 API 密钥进行授权。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-authorizations=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-inputs
(通用映射)-
用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-inputs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-settings
(通用映射)-
用于部署配置的 Schematics 环境变量。 仅当初始创建配置时指定了设置时,这些设置才可用。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-settings=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 - 实验
--definition-members
(StackConfigMember[]
) -
堆栈中包含的可部署架构成员。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最多长度为
100
项。 最少长度为0
项。提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-members=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-resource-crns
([]字符串)-
与此配置关联的资源的 CRN。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
The list items must match the regular expression
/(?!\\s)(?!.*\\s$)^(crn)[^'"
<>{}\s\x00-\x1F]*/. The maximum length is
110items. The minimum length is
0` items. --schematics-workspace-crn
(字符串)-
唯一标识资源的 IBM Cloud 资源名称。 此选项为 JSON 选项 "schematics" 的子字段提供值。 它与该选项互斥。
最大长度为
512
个字符。 最小长度为4
个字符。 The value must match the regular expression/(?!\\s)(?!.*\\s$)^(crn)[^'"
<>{}\s\x00-\x1F]*/`.
示例
ibmcloud project config-create \
--project-id exampleString \
--definition '{"compliance_profile": {"id": "exampleString", "instance_id": "exampleString", "instance_location": "us-south", "attachment_id": "exampleString", "profile_name": "exampleString"}, "locator_id": "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global", "description": "The stage environment configuration.", "name": "env-stage", "environment_id": "exampleString", "authorizations": {"trusted_profile_id": "exampleString", "method": "api_key", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}' \
--schematics '{"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project config-create \
--project-id exampleString \
--definition-compliance-profile projectComplianceProfile \
--definition-locator-id exampleString \
--definition-description exampleString \
--definition-name exampleString \
--definition-environment-id exampleString \
--definition-authorizations projectConfigAuth \
--definition-inputs '{"anyKey": "anyValue"}' \
--definition-settings '{"anyKey": "anyValue"}' \
--schematics-workspace-crn crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::
ibmcloud project configs
检索配置集合。 注意:如果未设置 --all-pages
选项,则命令仅检索集合的单页。
ibmcloud project configs --project-id PROJECT-ID [--token TOKEN] [--limit LIMIT]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --token
(字符串)-
服务器使用此参数来确定下一页上返回的第一个条目。 如果未指定此参数,那么将返回逻辑第一页。
缺省值为
1536
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --limit
(int64)-
返回的最大资源数量。 返回的资源数相同,但最后一页除外。
默认值为
10
。 最大值为100
。 最小值为1
。 --all-pages
(bool)-
启动多个请求,以显示配置集合的所有页面。
示例
ibmcloud project configs \
--project-id exampleString \
--token exampleString \
--limit 10
示例输出
用于获取项目配置的请求的示例响应。
{
"limit" : 2,
"first" : {
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs?limit=2"
},
"next" : {
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs?limit=2&token=da969bff-vf9q-3t1t-b677-d6rt5c0de54e"
},
"configs" : [ {
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5",
"definition" : {
"name" : "env-stage",
"description" : "The stage environment configuration."
},
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"version" : 1,
"state" : "validated",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/db268db0-160b-4911-8f93-89659000a927/configs/293c3c36-a094-4115-a12b-de0a9ca39be5"
}, {
"id" : "9c7afed6-17fb-4c56-a13d-440a78f936bd",
"definition" : {
"name" : "region-eu-de-stage",
"description" : "The stage `eu-de` configuration."
},
"approved_version" : {
"definition" : {
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global"
},
"version" : 1,
"state" : "approved",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/db268db0-160b-4911-8f93-89659000a927/configs/9c7afed6-17fb-4c56-a13d-440a78f936bd/versions/1"
},
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"version" : 2,
"state" : "draft",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/db268db0-160b-4911-8f93-89659000a927/configs/9c7afed6-17fb-4c56-a13d-440a78f936bd"
} ]
}
ibmcloud project config
在特定项目中检索指定的项目配置。 有关项目配置的更多信息,请参阅 监视配置及其资源的状态。
ibmcloud project config --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project config \
--project-id exampleString \
--id exampleString
ibmcloud project config-update
通过指定标识来更新项目中的配置。 了解更多信息。
ibmcloud project config-update --project-id PROJECT-ID --id ID [--definition DEFINITION | --definition-compliance-profile DEFINITION-COMPLIANCE-PROFILE --definition-locator-id DEFINITION-LOCATOR-ID --definition-description DEFINITION-DESCRIPTION --definition-name DEFINITION-NAME --definition-environment-id DEFINITION-ENVIRONMENT-ID --definition-authorizations DEFINITION-AUTHORIZATIONS --definition-inputs DEFINITION-INPUTS --definition-settings DEFINITION-SETTINGS --definition-resource-crns DEFINITION-RESOURCE-CRNS --definition-members DEFINITION-MEMBERS]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --definition
(ProjectConfigDefinitionPatch
)-
可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-compliance-profile
(ProjectComplianceProfile
)-
合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-compliance-profile=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-locator-id
(字符串)-
目录标识和版本标识的唯一并置,用于标识目录中的可部署体系结构。 如果从现有的Schematics工作区导入,而该工作区没有 cart 支持,则需要
locator_id
。 如果您使用的是由购物车支持的 Schematics 工作空间,那么不需要locator_id
,因为 Schematics 工作空间具有此工作空间。有 3 个方案:
- 如果仅指定了
locator_id
,那么将使用该locator_id
实例化新的 Schematics 工作空间。 - 如果仅指定了示意图
workspace_crn
,那么在现有示意图工作空间中找不到locator_id
时,将返回400
。 - 如果同时指定了 Schematics
workspace_crn
和locator_id
,那么当指定的locator_id
与现有 Schematics 工作空间中的locator_id
不一致时,将返回400
消息。 有关创建 Schematics 工作区的更多信息,请参阅 创建工作区和导入 Terraform 模板。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
512
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/
匹配。 - 如果仅指定了
--definition-description
(字符串)-
项目配置描述。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
1024
个字符。 最小长度为0
个字符。 该值必须与正则表达式/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/
匹配。 --definition-name
(字符串)-
配置名称。 它在各个项目和区域的帐户中都是独一无二的。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/
匹配。 --definition-environment-id
(字符串)-
项目环境的ID。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --definition-authorizations
(ProjectConfigAuth
)-
授权详细信息。 您可以在 Secrets Manager中使用可信概要文件或 API 密钥进行授权。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-authorizations=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-inputs
(通用映射)-
用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-inputs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-settings
(通用映射)-
用于部署配置的 Schematics 环境变量。 仅当初始创建配置时指定了设置时,这些设置才可用。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-settings=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --definition-resource-crns
([]字符串)-
与此配置关联的资源的 CRN。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
The list items must match the regular expression
/(?!\\s)(?!.*\\s$)^(crn)[^'"
<>{}\s\x00-\x1F]*/. The maximum length is
110items. The minimum length is
0` items. - 实验
--definition-members
(StackConfigMember[]
) -
堆栈中包含的可部署架构成员。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。
最多长度为
100
项。 最少长度为0
项。提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--definition-members=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。
示例
ibmcloud project config-update \
--project-id exampleString \
--id exampleString \
--definition '{"compliance_profile": {"id": "exampleString", "instance_id": "exampleString", "instance_location": "us-south", "attachment_id": "exampleString", "profile_name": "exampleString"}, "locator_id": "exampleString", "description": "exampleString", "name": "env-stage", "environment_id": "exampleString", "authorizations": {"trusted_profile_id": "exampleString", "method": "api_key", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project config-update \
--project-id exampleString \
--id exampleString \
--definition-compliance-profile projectComplianceProfile \
--definition-locator-id exampleString \
--definition-description exampleString \
--definition-name exampleString \
--definition-environment-id exampleString \
--definition-authorizations projectConfigAuth \
--definition-inputs '{"anyKey": "anyValue"}' \
--definition-settings '{"anyKey": "anyValue"}'
ibmcloud project config-delete
通过指定项目标识来删除项目中的配置。
ibmcloud project config-delete --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project config-delete \
--project-id exampleString \
--id exampleString
示例输出
用于删除配置的请求的示例响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5"
}
ibmcloud project config-force-approve
使用核准注释强制对主配置进行核准配置编辑。
ibmcloud project config-force-approve --project-id PROJECT-ID --id ID --comment COMMENT
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --comment
(字符串)-
关于项目行动草案的说明。 如果此操作是对草稿配置的强制核准,那么必须包含非空注释。 必需。
最大长度为
1024
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]+$/
匹配。
示例
ibmcloud project config-force-approve \
--project-id exampleString \
--id exampleString \
--comment 'Approving the changes'
示例输出
对可部署体系结构配置草稿的请求的示例响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5",
"definition" : {
"name" : "env-stage",
"description" : "The stage environment configuration.",
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"inputs" : {
"account_id" : "ref:/configs/account-stage/inputs/account_id",
"resource_group" : "stage",
"access_tags" : [ "env:stage" ],
"logdna_name" : "The name of the LogDNA stage service instance.",
"sysdig_name" : "The name of the SysDig stage service instance."
}
},
"is_draft" : true,
"version" : 2,
"outputs" : [ {
"name" : "resource_group_id"
}, {
"name" : "logdna_id"
}, {
"name" : "sysdig_id"
} ],
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"schematics" : {
"workspace_crn" : "crn:v1:staging:public:schematics:us-south:a/38acaf4469814090a4e675dc0c317a0d:95ad49de-ab96-4e7d-a08c-45c38aa448e6:workspace:us-south.workspace.service.e0106139"
},
"state" : "validated",
"update_available" : true,
"needs_attention_state" : [ ],
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/b0c44146-1ef6-40c2-82ba-74d51149770a",
"deployment_mode" : "project_deployed"
}
ibmcloud project config-approve
核准并将配置编辑合并到主配置。
ibmcloud project config-approve --project-id PROJECT-ID --id ID [--comment COMMENT]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --comment
(字符串)-
关于项目行动草案的说明。 如果此操作是对草稿配置的强制核准,那么必须包含非空注释。
最大长度为
1024
个字符。 最小长度为1
个字符。 该值必须与正则表达式/^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]+$/
匹配。
示例
ibmcloud project config-approve \
--project-id exampleString \
--id exampleString \
--comment 'Approving the changes'
示例输出
对可部署体系结构配置草稿的请求的示例响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5",
"definition" : {
"name" : "env-stage",
"description" : "The stage environment configuration.",
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"inputs" : {
"account_id" : "ref:/configs/account-stage/inputs/account_id",
"resource_group" : "stage",
"access_tags" : [ "env:stage" ],
"logdna_name" : "The name of the LogDNA stage service instance.",
"sysdig_name" : "The name of the SysDig stage service instance."
}
},
"is_draft" : true,
"version" : 2,
"outputs" : [ {
"name" : "resource_group_id"
}, {
"name" : "logdna_id"
}, {
"name" : "sysdig_id"
} ],
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"schematics" : {
"workspace_crn" : "crn:v1:staging:public:schematics:us-south:a/38acaf4469814090a4e675dc0c317a0d:95ad49de-ab96-4e7d-a08c-45c38aa448e6:workspace:us-south.workspace.service.e0106139"
},
"state" : "validated",
"update_available" : true,
"needs_attention_state" : [ ],
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/b0c44146-1ef6-40c2-82ba-74d51149770a",
"deployment_mode" : "project_deployed"
}
ibmcloud project config-validate
对项目中的特定配置运行验证检查。 此检查包括使用计划作业,运行 CRA 扫描和成本估算来创建或更新关联的 Schematics 工作空间。
ibmcloud project config-validate --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project config-validate \
--project-id exampleString \
--id exampleString
示例输出
对可部署体系结构配置草稿的请求的示例响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5",
"definition" : {
"name" : "env-stage",
"description" : "The stage environment configuration.",
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"inputs" : {
"account_id" : "ref:/configs/account-stage/inputs/account_id",
"resource_group" : "stage",
"access_tags" : [ "env:stage" ],
"logdna_name" : "The name of the LogDNA stage service instance.",
"sysdig_name" : "The name of the SysDig stage service instance."
}
},
"is_draft" : true,
"version" : 2,
"outputs" : [ {
"name" : "resource_group_id"
}, {
"name" : "logdna_id"
}, {
"name" : "sysdig_id"
} ],
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"schematics" : {
"workspace_crn" : "crn:v1:staging:public:schematics:us-south:a/38acaf4469814090a4e675dc0c317a0d:95ad49de-ab96-4e7d-a08c-45c38aa448e6:workspace:us-south.workspace.service.e0106139"
},
"state" : "validated",
"update_available" : true,
"needs_attention_state" : [ ],
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/b0c44146-1ef6-40c2-82ba-74d51149770a",
"deployment_mode" : "project_deployed"
}
ibmcloud project config-deploy
部署项目的配置。 此操作为异步操作,可使用带有完整元数据的 get project configuration
API 进行跟踪。
ibmcloud project config-deploy --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project config-deploy \
--project-id exampleString \
--id exampleString
示例输出
对可部署体系结构配置草稿的请求的示例响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5",
"definition" : {
"name" : "env-stage",
"description" : "The stage environment configuration.",
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"inputs" : {
"account_id" : "ref:/configs/account-stage/inputs/account_id",
"resource_group" : "stage",
"access_tags" : [ "env:stage" ],
"logdna_name" : "The name of the LogDNA stage service instance.",
"sysdig_name" : "The name of the SysDig stage service instance."
}
},
"is_draft" : true,
"version" : 2,
"outputs" : [ {
"name" : "resource_group_id"
}, {
"name" : "logdna_id"
}, {
"name" : "sysdig_id"
} ],
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"schematics" : {
"workspace_crn" : "crn:v1:staging:public:schematics:us-south:a/38acaf4469814090a4e675dc0c317a0d:95ad49de-ab96-4e7d-a08c-45c38aa448e6:workspace:us-south.workspace.service.e0106139"
},
"state" : "validated",
"update_available" : true,
"needs_attention_state" : [ ],
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/b0c44146-1ef6-40c2-82ba-74d51149770a",
"deployment_mode" : "project_deployed"
}
ibmcloud project config-undeploy
取消部署项目的配置资源。 此操作将取消部署使用特定配置部署的所有资源。 您可以使用带有完整元数据的 get project configuration
API 进行跟踪。
ibmcloud project config-undeploy --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project config-undeploy \
--project-id exampleString \
--id exampleString
示例输出
对可部署体系结构配置草稿的请求的示例响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5",
"definition" : {
"name" : "env-stage",
"description" : "The stage environment configuration.",
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"inputs" : {
"account_id" : "ref:/configs/account-stage/inputs/account_id",
"resource_group" : "stage",
"access_tags" : [ "env:stage" ],
"logdna_name" : "The name of the LogDNA stage service instance.",
"sysdig_name" : "The name of the SysDig stage service instance."
}
},
"is_draft" : true,
"version" : 2,
"outputs" : [ {
"name" : "resource_group_id"
}, {
"name" : "logdna_id"
}, {
"name" : "sysdig_id"
} ],
"project" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "iaas-infra-prestage-env"
},
"crn" : "crn:v1:staging:public:project:us-south:a/06580c923e40314421d3b6cb40c01c68:cfbf9050-ab8e-ac97-b01b-ab5af830be8a::",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"schematics" : {
"workspace_crn" : "crn:v1:staging:public:schematics:us-south:a/38acaf4469814090a4e675dc0c317a0d:95ad49de-ab96-4e7d-a08c-45c38aa448e6:workspace:us-south.workspace.service.e0106139"
},
"state" : "validated",
"update_available" : true,
"needs_attention_state" : [ ],
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/configs/b0c44146-1ef6-40c2-82ba-74d51149770a",
"deployment_mode" : "project_deployed"
}
ibmcloud project config-sync
通过分析关联的管道运行和 Schematics 工作空间日志来同步项目配置,以将配置恢复到工作状态。
ibmcloud project config-sync --project-id PROJECT-ID --id ID [--schematics SCHEMATICS | --schematics-workspace-crn SCHEMATICS-WORKSPACE-CRN]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --schematics
(SchematicsWorkspace
)-
用于部署此可部署体系结构的 Schematics 工作空间。
如果要从购物车不支持的现有 Schematics 工作空间导入数据,那么必须提供
locator_id
。 如果您使用的是由购物车支持的 Schematics 工作空间,那么不需要locator_id
,因为 Schematics 工作空间具有一个。有 3 个方案:
- 如果仅指定了
locator_id
,那么将使用该locator_id
实例化新的 Schematics 工作空间。 - 如果仅指定了示意图
workspace_crn
,那么在现有示意图工作空间中找不到locator_id
时,将返回400
。 - 如果同时指定了 Schematics
workspace_crn
和locator_id
,如果指定的locator_id
与现有 Schematics 工作区中的locator_id
不一致,将返回400
代码。
有关更多信息,请参阅 创建工作空间和导入 Terraform 模板。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--schematics=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 - 如果仅指定了
--schematics-workspace-crn
(字符串)-
唯一标识资源的 IBM Cloud 资源名称。 此选项为 JSON 选项 "schematics" 的子字段提供值。 它与该选项互斥。
最大长度为
512
个字符。 最小长度为4
个字符。 The value must match the regular expression/(?!\\s)(?!.*\\s$)^(crn)[^'"
<>{}\s\x00-\x1F]*/`.
示例
ibmcloud project config-sync \
--project-id exampleString \
--id exampleString \
--schematics '{"workspace_crn": "crn:v1:staging:public:schematics:us-south:a/38acaf4469814090a4e675dc0c317a0d:95ad49de-ab96-4e7d-a08c-45c38aa448e6:workspace:us-south.workspace.service.e0106139"}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project config-sync \
--project-id exampleString \
--id exampleString \
--schematics-workspace-crn crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::
ibmcloud project config-resources
列出由配置部署的资源。
ibmcloud project config-resources --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project config-resources \
--project-id exampleString \
--id exampleString
示例输出
用于获取项目配置资源的请求的示例响应。
{
"resources" : [ {
"resource_crn" : "crn:v1:staging:public:toolchain:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::",
"resource_name" : "toolchain_instance",
"resource_type" : "ibm_cd_toolchain",
"resource_tainted" : false,
"resource_group_name" : ""
}, {
"resource_crn" : "crn:v1:staging:public:cloud-object-storage:global:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::",
"resource_name" : "cos_bucket_instance",
"resource_type" : "ibm_cos_bucket",
"resource_tainted" : false,
"resource_group_name" : ""
} ],
"resources_count" : 2
}
ibmcloud project stack-definition-create
试验版
在堆栈级别定义用户需要配置的输入以及成员级别的输入值。 当可部署架构栈导出到私有目录时,这些值将包含在目录条目中。 它们是部署可部署架构栈所必需的。 您可以添加对值的引用,或者在成员级别显式添加值。
ibmcloud project stack-definition-create --project-id PROJECT-ID --id ID [--stack-definition STACK-DEFINITION | --stack-definition-inputs STACK-DEFINITION-INPUTS --stack-definition-outputs STACK-DEFINITION-OUTPUTS]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --stack-definition
(StackDefinitionBlockPrototype
)-
堆栈定义的定义块。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--stack-definition=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --stack-definition-inputs
(StackDefinitionInputVariable[]
)-
定义用户需要在堆栈级别配置的输入。 将可部署体系结构堆栈导出到专用目录时,这些输入将包含在目录条目中。 此选项为 JSON 选项 "stack-definition" 的子字段提供值。 它与该选项互斥。
最多长度为
100
项。 最少长度为0
项。提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--stack-definition-inputs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --stack-definition-outputs
(StackDefinitionOutputVariable[]
)-
与此堆栈定义关联的输出。 此选项为 JSON 选项 "stack-definition" 的子字段提供值。 它与该选项互斥。
最多长度为
100
项。 最少长度为0
项。提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--stack-definition-outputs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。
示例
ibmcloud project stack-definition-create \
--project-id exampleString \
--id exampleString \
--stack-definition '{"inputs": [{"name": "region", "type": "string", "description": "exampleString", "default": "us-south", "required": true, "hidden": false}], "outputs": [{"name": "vpc_cluster_id", "value": "cluster_id"}]}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project stack-definition-create \
--project-id exampleString \
--id exampleString \
--stack-definition-inputs '[stackDefinitionInputVariable]' \
--stack-definition-outputs '[stackDefinitionOutputVariable]'
示例输出
来自创建堆栈模板操作的样本响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca6678a",
"stack_definition" : {
"inputs" : [ {
"name" : "region",
"type" : "string",
"required" : true,
"default" : "us-south",
"hidden" : false
}, {
"name" : "resource_group",
"type" : "string",
"default" : "Default"
} ],
"outputs" : [ {
"name" : "vpc_cluster_id",
"value" : "cluster_id"
} ],
"members" : [ {
"name" : "foundation-deployable-architecture",
"version_locator" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"inputs" : [ {
"name" : "region",
"value" : "us-south"
}, {
"name" : "cluster_name",
"value" : "foundation-cluster"
} ]
}, {
"name" : "middleware-architecture",
"version_locator" : "01e1a9ad-534b-4ab9-996a-b8f2a8653d5c.4d86732e-04b9-4dab-bfdc-5b514d86ecd8",
"inputs" : [ {
"name" : "kube_version",
"value" : 1.29
} ]
} ]
},
"state" : "draft",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"configuration" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "stack-bottom-up-example"
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/template"
}
ibmcloud project stack-definition
试验版
检索与配置关联的堆栈定义。
ibmcloud project stack-definition --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project stack-definition \
--project-id exampleString \
--id exampleString
示例输出
来自创建堆栈模板操作的样本响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca6678a",
"stack_definition" : {
"inputs" : [ {
"name" : "region",
"type" : "string",
"required" : true,
"default" : "us-south",
"hidden" : false
}, {
"name" : "resource_group",
"type" : "string",
"default" : "Default"
} ],
"outputs" : [ {
"name" : "vpc_cluster_id",
"value" : "cluster_id"
} ],
"members" : [ {
"name" : "foundation-deployable-architecture",
"version_locator" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"inputs" : [ {
"name" : "region",
"value" : "us-south"
}, {
"name" : "cluster_name",
"value" : "foundation-cluster"
} ]
}, {
"name" : "middleware-architecture",
"version_locator" : "01e1a9ad-534b-4ab9-996a-b8f2a8653d5c.4d86732e-04b9-4dab-bfdc-5b514d86ecd8",
"inputs" : [ {
"name" : "kube_version",
"value" : 1.29
} ]
} ]
},
"state" : "draft",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"configuration" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "stack-bottom-up-example"
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/template"
}
ibmcloud project stack-definition-update
试验版
更新与配置关联的堆栈定义。
ibmcloud project stack-definition-update --project-id PROJECT-ID --id ID [--stack-definition STACK-DEFINITION | --stack-definition-inputs STACK-DEFINITION-INPUTS --stack-definition-outputs STACK-DEFINITION-OUTPUTS]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --stack-definition
(StackDefinitionBlockPrototype
)-
堆栈定义的定义块。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--stack-definition=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --stack-definition-inputs
(StackDefinitionInputVariable[]
)-
定义用户需要在堆栈级别配置的输入。 将可部署体系结构堆栈导出到专用目录时,这些输入将包含在目录条目中。 此选项为 JSON 选项 "stack-definition" 的子字段提供值。 它与该选项互斥。
最多长度为
100
项。 最少长度为0
项。提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--stack-definition-inputs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --stack-definition-outputs
(StackDefinitionOutputVariable[]
)-
与此堆栈定义关联的输出。 此选项为 JSON 选项 "stack-definition" 的子字段提供值。 它与该选项互斥。
最多长度为
100
项。 最少长度为0
项。提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--stack-definition-outputs=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。
示例
ibmcloud project stack-definition-update \
--project-id exampleString \
--id exampleString \
--stack-definition '{"inputs": [{"name": "region", "type": "string", "description": "exampleString", "default": "eu-gb", "required": true, "hidden": false}], "outputs": [{"name": "exampleString", "value": "exampleString"}]}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project stack-definition-update \
--project-id exampleString \
--id exampleString \
--stack-definition-inputs '[stackDefinitionInputVariable]' \
--stack-definition-outputs '[stackDefinitionOutputVariable]'
示例输出
来自补丁堆栈模板操作的样本响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca6678a",
"stack_definition" : {
"inputs" : [ {
"name" : "region",
"type" : "string",
"required" : true,
"default" : "eu-gb",
"hidden" : false
} ],
"outputs" : [ {
"name" : "vpc_cluster_id",
"value" : "cluster_id"
} ],
"members" : [ {
"name" : "foundation-deployable-architecture",
"version_locator" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"inputs" : [ {
"name" : "cluster_name",
"value" : "foundation-cluster"
} ]
} ]
},
"state" : "draft",
"created_at" : "2023-02-22T19:51:23.253Z",
"modified_at" : "2023-02-22T19:51:23.253Z",
"configuration" : {
"id" : "cfbf9050-ab8e-ac97-b01b-ab5af830be8a",
"definition" : {
"name" : "stack-bottom-up-example"
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a"
},
"href" : "https://projects.api.cloud.ibm.com/v1/projects/cfbf9050-ab8e-ac97-b01b-ab5af830be8a/template"
}
ibmcloud project stack-definition-export
试验版
将可部署体系结构堆栈导出到专用目录。 必须先验证并部署堆栈中的所有成员可部署体系结构,然后才能导出堆栈。 在导出堆栈之前,堆栈定义也必须存在。 您可以将堆栈导出为新产品,或导出为现有产品的新版本。
ibmcloud project stack-definition-export --project-id PROJECT-ID --id ID [--settings SETTINGS | --settings-catalog-id SETTINGS-CATALOG-ID --settings-target-version SETTINGS-TARGET-VERSION --settings-variation SETTINGS-VARIATION --settings-label SETTINGS-LABEL --settings-tags SETTINGS-TAGS --settings-product-id SETTINGS-PRODUCT-ID]
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --settings
(StackDefinitionExportRequest
)-
专用目录导出请求的有效内容。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。
提供一个 JSON 字符串选项,或通过提供一个以
@
开头的 filepath 选项(例如--settings=@path/to/file.json
),指定一个要从其中读取的 JSON 文件。 --settings-catalog-id
(字符串)-
要发布的目录标识。 此选项为 JSON 选项 "settings" 的子字段提供值。 它与该选项互斥。
最大长度为
36
个字符。 该值必须与正则表达式/^[\\-0-9a-zA-Z]+$/
匹配。 --settings-target-version
(字符串)-
新版本产品的服务器值。 此选项为 JSON 选项 "settings" 的子字段提供值。 它与该选项互斥。
最大长度为
60
个字符。 最小长度为5
个字符。 该值必须与正则表达式/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/
匹配。 --settings-variation
(字符串)-
此产品新版本的变体。 此选项为 JSON 选项 "settings" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 该值必须与正则表达式/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/
匹配。 --settings-label
(字符串)-
产品标签。 此选项为 JSON 选项 "settings" 的子字段提供值。 它与该选项互斥。
最大长度为
128
个字符。 该值必须与正则表达式/^[a-zA-Z0-9][a-zA-Z0-9-_ ]*$/
匹配。 --settings-tags
([]字符串)-
与目录产品关联的标记。 此选项为 JSON 选项 "settings" 的子字段提供值。 它与该选项互斥。
列表项必须与正则表达式
/^[a-zA-Z0-9][a-zA-Z0-9-_]*$/
匹配。 最多长度为10
项。 最少长度为0
项。 --settings-product-id
(字符串)-
要发布的产品标识。 此选项为 JSON 选项 "settings" 的子字段提供值。 它与该选项互斥。
最大长度为
36
个字符。 该值必须与正则表达式/^[\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project stack-definition-export \
--project-id exampleString \
--id exampleString \
--settings '{"catalog_id": "01e1a9ad-534b-4ab9-996a-b8f2a8653d5c", "target_version": "exampleString", "variation": "exampleString", "label": "Stack Deployable Architecture", "tags": ["exampleString","anotherTestString"]}'
或者,粒度选项可用于 JSON 字符串选项的子字段:
ibmcloud project stack-definition-export \
--project-id exampleString \
--id exampleString \
--settings-catalog-id exampleString \
--settings-target-version exampleString \
--settings-variation exampleString \
--settings-label exampleString \
--settings-tags exampleString,anotherTestString
示例输出
将堆栈定义导出到专用目录的样本响应
{
"catalog_id" : "01e1a9ad-534b-4ab9-996a-b8f2a8653d5c",
"product_id" : "b60b5876-d074-478a-ac73-f979898c527b",
"version_locator" : "01e1a9ad-534b-4ab9-996a-b8f2a8653d5c.f9f73bdb-5c7d-4ea6-82ef-9debc6340df8",
"kind" : "terraform",
"format" : "stack"
}
ibmcloud project config-versions
检索特定项目中项目配置的先前版本和当前版本的列表。
ibmcloud project config-versions --project-id PROJECT-ID --id ID
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。
示例
ibmcloud project config-versions \
--project-id exampleString \
--id exampleString
示例输出
用于列出项目配置草稿的请求的示例响应。
{
"versions" : [ {
"definition" : {
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global"
},
"version" : 1,
"state" : "approved",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/db268db0-160b-4911-8f93-89659000a927/configs/293c3c36-a094-4115-a12b-de0a9ca39be5/versions/1"
}, {
"definition" : {
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global"
},
"version" : 2,
"state" : "validated",
"href" : "https://projects.api.cloud.ibm.com/v1/projects/db268db0-160b-4911-8f93-89659000a927/configs/293c3c36-a094-4115-a12b-de0a9ca39be5/versions/2"
} ]
}
ibmcloud project config-version
检索项目中配置的特定版本。
ibmcloud project config-version --project-id PROJECT-ID --id ID --version VERSION
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --version
(int64)-
配置版本。 必需。
示例
ibmcloud project config-version \
--project-id exampleString \
--id exampleString \
--version 38
ibmcloud project config-version-delete
通过指定项目标识来删除配置版本。
ibmcloud project config-version-delete --project-id PROJECT-ID --id ID --version VERSION
命令选项
--project-id
(字符串)-
唯一项目标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --id
(字符串)-
唯一配置标识。 必需。
最大长度为
128
个字符。 该值必须与正则表达式/^[\\.\\-0-9a-zA-Z]+$/
匹配。 --version
(int64)-
配置版本。 必需。
示例
ibmcloud project config-version-delete \
--project-id exampleString \
--id exampleString \
--version 38
示例输出
用于删除配置的请求的示例响应。
{
"id" : "293c3c36-a094-4115-a12b-de0a9ca39be5"
}
模式示例
以下模式示例表示需要为命令选项指定的数据。 这些示例对数据结构进行建模,并包含期望值类型的占位符值。 运行命令时,请将这些值替换为适用于您的环境的相应值。
EnvironmentDefinitionPropertiesPatch
以下示例显示EnvironmentDefinitionPropertiesPatch的格式。
{
"description" : "The environment development.",
"name" : "development",
"authorizations" : {
"trusted_profile_id" : "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12",
"method" : "trusted_profile",
"api_key" : "exampleString"
},
"inputs" : {
"anyKey" : "anyValue"
},
"compliance_profile" : {
"id" : "some-profile-id",
"instance_id" : "some-instance-id",
"instance_location" : "us-south",
"attachment_id" : "some-attachment-id",
"profile_name" : "some-profile-name"
}
}
EnvironmentDefinitionRequiredProperties
以下示例显示EnvironmentDefinitionRequiredProperties的格式。
{
"description" : "The environment development.",
"name" : "development",
"authorizations" : {
"trusted_profile_id" : "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12",
"method" : "trusted_profile",
"api_key" : "exampleString"
},
"inputs" : {
"anyKey" : "anyValue"
},
"compliance_profile" : {
"id" : "some-profile-id",
"instance_id" : "some-instance-id",
"instance_location" : "us-south",
"attachment_id" : "some-attachment-id",
"profile_name" : "some-profile-name"
}
}
EnvironmentPrototype[]
以下示例显示了 EnvironmentPrototype 的格式 []目的。
[ {
"definition" : {
"description" : "exampleString",
"name" : "exampleString",
"authorizations" : {
"trusted_profile_id" : "exampleString",
"method" : "api_key",
"api_key" : "exampleString"
},
"inputs" : {
"anyKey" : "anyValue"
},
"compliance_profile" : {
"id" : "exampleString",
"instance_id" : "exampleString",
"instance_location" : "us-south",
"attachment_id" : "exampleString",
"profile_name" : "exampleString"
}
}
} ]
ProjectComplianceProfile
以下示例显示ProjectComplianceProfile的格式。
{
"id" : "some-profile-id",
"instance_id" : "some-instance-id",
"instance_location" : "us-south",
"attachment_id" : "some-attachment-id",
"profile_name" : "some-profile-name"
}
ProjectConfigAuth
以下示例显示ProjectConfigAuth的格式。
{
"trusted_profile_id" : "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12",
"method" : "trusted_profile",
"api_key" : "exampleString"
}
ProjectConfigDefinitionPatch
以下示例显示了 ProjectConfigDefinitionPatch的格式。
{
"compliance_profile" : {
"id" : "exampleString",
"instance_id" : "exampleString",
"instance_location" : "us-south",
"attachment_id" : "exampleString",
"profile_name" : "exampleString"
},
"locator_id" : "exampleString",
"description" : "exampleString",
"name" : "env-stage",
"environment_id" : "exampleString",
"authorizations" : {
"trusted_profile_id" : "exampleString",
"method" : "api_key",
"api_key" : "exampleString"
},
"inputs" : {
"anyKey" : "anyValue"
},
"settings" : {
"anyKey" : "anyValue"
}
}
ProjectConfigDefinitionPrototype
以下示例显示ProjectConfigDefinitionPrototype的格式。
{
"compliance_profile" : {
"id" : "exampleString",
"instance_id" : "exampleString",
"instance_location" : "us-south",
"attachment_id" : "exampleString",
"profile_name" : "exampleString"
},
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"description" : "The stage environment configuration.",
"name" : "env-stage",
"environment_id" : "exampleString",
"authorizations" : {
"trusted_profile_id" : "exampleString",
"method" : "api_key",
"api_key" : "exampleString"
},
"inputs" : {
"anyKey" : "anyValue"
},
"settings" : {
"anyKey" : "anyValue"
}
}
ProjectConfigPrototype[]
以下示例显示了 ProjectConfigPrototype 的格式 []目的。
[ {
"definition" : {
"compliance_profile" : {
"id" : "exampleString",
"instance_id" : "exampleString",
"instance_location" : "us-south",
"attachment_id" : "exampleString",
"profile_name" : "exampleString"
},
"locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
"description" : "The stage account configuration.",
"name" : "account-stage",
"environment_id" : "exampleString",
"authorizations" : {
"trusted_profile_id" : "exampleString",
"method" : "api_key",
"api_key" : "exampleString"
},
"inputs" : {
"anyKey" : "anyValue"
},
"settings" : {
"anyKey" : "anyValue"
}
},
"schematics" : {
"workspace_crn" : "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"
}
} ]
ProjectPatchDefinitionBlock
以下示例显示ProjectPatchDefinitionBlock的格式。
{
"name" : "acme-microservice",
"destroy_on_delete" : true,
"auto_deploy" : true,
"description" : "A microservice to deploy on top of ACME infrastructure.",
"monitoring_enabled" : true
}
ProjectPrototypeDefinition
以下示例显示ProjectPrototypeDefinition的格式。
{
"name" : "acme-microservice",
"destroy_on_delete" : true,
"description" : "A microservice to deploy on top of ACME infrastructure.",
"auto_deploy" : false,
"monitoring_enabled" : false
}
SchematicsWorkspace
以下示例显示SchematicsWorkspace的格式。
{
"workspace_crn" : "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"
}
StackDefinitionBlockPrototype
试验版
以下示例显示StackDefinitionBlockPrototype的格式。
{
"inputs" : [ {
"name" : "region",
"type" : "string",
"description" : "exampleString",
"default" : "us-south",
"required" : true,
"hidden" : false
} ],
"outputs" : [ {
"name" : "vpc_cluster_id",
"value" : "cluster_id"
} ]
}
StackDefinitionExportRequest
试验版
以下示例显示了 StackDefinitionExportRequest的格式。
{
"catalog_id" : "01e1a9ad-534b-4ab9-996a-b8f2a8653d5c",
"target_version" : "exampleString",
"variation" : "exampleString",
"label" : "Stack Deployable Architecture",
"tags" : [ "exampleString", "anotherExampleString" ]
}
IBM Cloud 项目的其他相关命令
以下命令不是项目 CLI 插件的一部分,但您可以使用这些命令来完成与项目相关的任务,例如将标记附加到项目。 此列表并非详尽列出可用于项目的所有相关命令。 相反,此列表是您探索可用于项目的其他命令的起点。
以下某些命令可能需要先安装其特定插件,然后才能运行这些插件。
运行 ibmcloud resource tag-attach
以将标记附加到项目:
ibmcloud resource tag-attach --tag-names TAG --resource-id PROJECT-CRN
运行 ibmcloud resource search
以检索由项目中的配置创建的帐户中的所有资源:
ibmcloud resource search "service_tags:\"schematics::project_id:PROJECT_ID\""
运行 ibmcloud schematics logs
以检索 Schematics 工作空间的日志文件:
ibmcloud schematics logs --id WORKSPACE_ID [--act-id ACTION_ID]