项目 CLI 参考

IBM Cloud® 命令行界面( IBM Cloud CLI)为服务产品提供了更多功能。 您可以使用 IBM Cloud CLI 管理您可以访问的项目。

准备工作

  • 安装 IBM Cloud CLI
  • 运行以下命令安装 Project CLI:
ibmcloud plugin install project

IBM Cloud CLI 和插件的更新可用时,您会收到命令行通知。 确保 CLI 保持最新,以便您可以使用最新的命令。 您可以通过运行 ibmcloud plugin list 来查看所有已安装插件的当前版本。

项目

项目资源的命令。

ibmcloud project select

别名: target

选择一个项目作为当前上下文。

ibmcloud project select PROJECT_ID|PROJECT_NAME [--unset-project] [--output FORMAT] [-q, --quiet]

示例

ibmcloud project select db4da927-80bc-4161-960d-7ce2b5e1be96

或者,您也可以按项目名称进行选择

ibmcloud project select ProjectA

要取消选择项目

ibmcloud project select --unset-project

命令选项

--unset-project (bool)
未设定目标项目
--output (字符串)
选择输出格式--可以是 "json "或 "table"。(默认为 "表)
-q, --quiet (bool)
禁用详细消息。
ibmcloud project select --unset-project

ibmcloud project create

创建项目并异步设置管理工具。 通过定制配置来添加可部署体系结构。 验证并核准更改后,部署项目配置的资源。 有关更多信息,请参阅 创建项目

ibmcloud project create [--definition DEFINITION | --definition-name DEFINITION-NAME --definition-description DEFINITION-DESCRIPTION --definition-auto-deploy-mode DEFINITION-AUTO-DEPLOY-MODE --definition-monitoring-enabled=DEFINITION-MONITORING-ENABLED --definition-destroy-on-delete=DEFINITION-DESTROY-ON-DELETE --definition-store DEFINITION-STORE --definition-terraform-engine DEFINITION-TERRAFORM-ENGINE --definition-auto-deploy=DEFINITION-AUTO-DEPLOY] --location LOCATION --resource-group RESOURCE-GROUP [--configs CONFIGS] [--environments ENVIRONMENTS] [--output FORMAT] [-q, --quiet]

命令选项

--definition (ProjectPrototypeDefinition)

项目的定义。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition=@path/to/file.json

--location (字符串)

部署资源的 IBM Cloud 位置。 必需。

允许的值为: us-southus-easteu-gbeu-deca-tor

--resource-group (字符串)

在其中创建项目数据和工具的资源组名称。 必需。

最大长度为 64 个字符。 最小长度为 0 个字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]*$/ 匹配。

--configs (ProjectConfigPrototype[])

项目配置。 仅当在请求有效内容中指定了配置数组时,这些配置才包含在创建项目的响应中。

默认值为 []。 最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --configs=@path/to/file.json

--environments (EnvironmentPrototype[])

项目环境。 仅当在请求有效内容中指定了环境数组时,这些环境才包含在创建项目的响应中。

默认值为 []。 最大长度为 20 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --environments=@path/to/file.json

--definition-name (字符串)

项目的名称。 它在各个区域的帐户中都是唯一的。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 128 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)[^'"`\/<>{}\\x00-\\x1F]+$/ 匹配。

--definition-description (字符串)

项目在可部署体系结构配置中的使用的简要说明。 创建项目时可以不提供说明。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

缺省值为 。最大长度为 1024 个字符。 最小长度为 0 个字符。 该值必须与正则表达式 /^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/ 匹配。

--definition-auto-deploy-mode (字符串)

这是自动部署的高级设置,用于说明启用自动部署后的行为方式。 存在两个选项:

  1. auto_approval 将在验证后自动批准配置,无需用户确认。
  2. manual_approval 将要求用户确认批准已验证的配置,然后才开始部署配置。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

默认值为 manual_approval。 允许值为 auto_approval, manual_approval

--definition-monitoring-enabled (bool)

用于启用自动漂移检测的布尔标志。 使用此字段运行每日检查,将配置与已部署的资源进行比较,以发现任何差异。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

默认值为 false

--definition-destroy-on-delete (bool)

指示删除项目时是否取消部署资源的策略。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

默认值为 true

--definition-store (ProjectDefinitionStore)

自定义存储项目配置所需的详细信息。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-store=@path/to/file.json

--definition-terraform-engine (ProjectTerraformEngineSettings)

实验模式--用于原型设计。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-terraform-engine=@path/to/file.json

--definition-auto-deploy (bool)

布尔标志,用于启用自动部署配置。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

默认值为 false

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project create \
    --definition '{"name": "acme-microservice", "description": "A microservice to deploy on top of ACME infrastructure.", "auto_deploy_mode": "manual_approval", "monitoring_enabled": false, "destroy_on_delete": true, "store": {"type": "gh", "url": "exampleString", "token": "exampleString", "config_directory": "exampleString"}, "terraform_engine": {"id": "exampleString", "type": "terraform-enterprise"}, "auto_deploy": false}' \
    --location us-south \
    --resource-group Default \
    --configs '[{"definition": {"compliance_profile": {}, "locator_id": "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global", "members": [{"name": "exampleString", "config_id": "exampleString"}], "description": "The stage account configuration.", "name": "account-stage", "authorizations": {"trusted_profile_id": "exampleString", "method": "exampleString", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}, "environment_id": "exampleString"}, "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": "exampleString", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "compliance_profile": {}}}]'

或者,粒度选项可用于 JSON 字符串选项的子字段:

ibmcloud project create \
    --location us-south \
    --resource-group Default \
    --configs '[projectConfigPrototype]' \
    --environments '[environmentPrototype]' \
    --definition-name exampleString \
    --definition-description exampleString \
    --definition-auto-deploy-mode manual_approval \
    --definition-monitoring-enabled=false \
    --definition-destroy-on-delete=true \
    --definition-store projectDefinitionStore \
    --definition-terraform-engine projectTerraformEngineSettings \
    --definition-auto-deploy=false

ibmcloud project list

列出现有项目。 项目按标识排序。 注意:如果不设置 --all-pages 选项,命令将只检索集合的单页。

ibmcloud project list [--token TOKEN] [--limit LIMIT] [--output FORMAT] [-q, --quiet]

命令选项

--token (字符串)

服务器使用此参数来确定下一页上返回的第一个条目。 如果未指定此参数,那么将返回逻辑第一页。

缺省值为 。最大长度为 1536 个字符。 最小长度为 0 个字符。 该值必须与正则表达式 /^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/ 匹配。

--limit (int64)

返回资源的最大数量。 返回的资源数相同,但最后一页除外。

默认值为 10。 最大值为 100。 最小值为 1

--all-pages (bool)

调用多个请求来显示列表集合的所有页面。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (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",
      "destroy_on_delete" : 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",
      "destroy_on_delete" : 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" : [ ]
  } ]
}

默认 JMESPath

如果用户未提供 JMESPath 查询,则默认情况下将对该命令的输出应用 JMESPath 查询。 确切的查询取决于所要求的场景和输出格式。 您可以在下表中看到每个默认 JMESPath 查询的条件:

默认 JMESPath
响应 输出 查询
成功 缺省值
projects[].{id: id, name: definition.name, state: state}
错误 缺省值
projects[].{id: id, name: definition.name, state: state}
所有页面 缺省值
projects[].{id: id, name: definition.name, state: state}

如果提供自定义 JMESPath 查询,它将取代上表中的任何 JMESPath。

ibmcloud project get

获取项目信息。

ibmcloud project get [--id ID] [--output FORMAT] [-q, --quiet]

命令选项

--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_mode" : "manual_approval",
    "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",
    "deployment_model" : "project_deployed",
    "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",
    "deployment_model" : "project_deployed",
    "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",
    "deployment_model" : "project_deployed",
    "definition" : {
      "name" : "env-stage",
      "description" : "The stage environment configuration. It includes services that are common to all the environment regions. A blueprint must be used to configure 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",
    "deployment_model" : "project_deployed",
    "definition" : {
      "name" : "region-us-south-stage",
      "description" : "The stage `us-south` configuration. A blueprint must be used to configure 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",
    "deployment_model" : "project_deployed",
    "definition" : {
      "name" : "region-eu-de-stage",
      "description" : "The stage `eu-de` configuration. A blueprint must be used to configure 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"
}

默认 JMESPath

如果用户未提供 JMESPath 查询,则默认情况下将对该命令的输出应用 JMESPath 查询。 确切的查询取决于所要求的场景和输出格式。 您可以在下表中看到每个默认 JMESPath 查询的条件:

默认 JMESPath
响应 输出 查询
成功 缺省值
{id: id, name: definition.name, state: state}
错误 缺省值
{id: id, name: definition.name, state: state}
所有页面 缺省值
{id: id, name: definition.name, state: state}

如果提供自定义 JMESPath 查询,它将取代上表中的任何 JMESPath。

ibmcloud project update

通过指定项目标识来更新项目。

ibmcloud project update [--id ID] {--definition DEFINITION | --definition-name DEFINITION-NAME --definition-description DEFINITION-DESCRIPTION --definition-auto-deploy-mode DEFINITION-AUTO-DEPLOY-MODE --definition-monitoring-enabled=DEFINITION-MONITORING-ENABLED --definition-destroy-on-delete=DEFINITION-DESTROY-ON-DELETE --definition-store DEFINITION-STORE --definition-terraform-engine DEFINITION-TERRAFORM-ENGINE --definition-auto-deploy=DEFINITION-AUTO-DEPLOY} [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--definition (ProjectDefinitionPatch)

项目的定义。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition=@path/to/file.json

--definition-name (字符串)

项目的名称。 它在各个区域的帐户中都是唯一的。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 128 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)[^'"`\/<>{}\\x00-\\x1F]+$/ 匹配。

--definition-description (字符串)

项目在可部署体系结构配置中的使用的简要说明。 创建项目时可以不提供说明。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 1024 个字符。 最小长度为 0 个字符。 该值必须与正则表达式 /^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/ 匹配。

--definition-auto-deploy-mode (字符串)

这是自动部署的高级设置,用于说明启用自动部署后的行为方式。 存在两个选项:

  1. auto_approval 将在验证后自动批准配置,无需用户确认。
  2. manual_approval 将要求用户确认批准已验证的配置,然后才开始部署配置。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

允许值为 auto_approval, manual_approval

--definition-monitoring-enabled (bool)

用于启用自动漂移检测的布尔标志。 使用此字段运行每日检查,将配置与部署的资源进行比较,以发现任何差异。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

--definition-destroy-on-delete (bool)

指示删除项目时是否取消部署资源的策略。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

--definition-store (ProjectDefinitionStore)

自定义存储项目配置所需的详细信息。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-store=@path/to/file.json

--definition-terraform-engine (ProjectTerraformEngineSettings)

实验模式--用于原型设计。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-terraform-engine=@path/to/file.json

--definition-auto-deploy (bool)

布尔标志,用于启用自动部署配置。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project update \
    --id exampleString \
    --definition '{"name": "acme-microservice", "description": "A microservice to deploy on top of ACME infrastructure.", "auto_deploy_mode": "auto_approval", "monitoring_enabled": true, "destroy_on_delete": true, "store": {"type": "gh", "url": "exampleString", "token": "exampleString", "config_directory": "exampleString"}, "terraform_engine": {"id": "exampleString", "type": "terraform-enterprise"}, "auto_deploy": true}'

或者,粒度选项可用于 JSON 字符串选项的子字段:

ibmcloud project update \
    --id exampleString \
    --definition-name exampleString \
    --definition-description exampleString \
    --definition-auto-deploy-mode auto_approval \
    --definition-monitoring-enabled=true \
    --definition-destroy-on-delete=true \
    --definition-store projectDefinitionStore \
    --definition-terraform-engine projectTerraformEngineSettings \
    --definition-auto-deploy=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_mode" : "manual_approval",
    "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",
    "deployment_model" : "project_deployed",
    "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",
    "deployment_model" : "project_deployed",
    "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",
    "deployment_model" : "project_deployed",
    "definition" : {
      "name" : "env-stage",
      "description" : "The stage environment configuration. It includes services that are common to all the environment regions. A blueprint must be used to configure 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",
    "deployment_model" : "project_deployed",
    "definition" : {
      "name" : "region-us-south-stage",
      "description" : "The stage `us-south` configuration. A blueprint must be used to configure 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",
    "deployment_model" : "project_deployed",
    "definition" : {
      "name" : "region-eu-de-stage",
      "description" : "The stage `eu-de` configuration. A blueprint must be used to configure 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] [--output FORMAT] [-q, --quiet]

命令选项

--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 选项来指定要从哪个 JSON 文件读取,例如 --definition=@path/to/file.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 选项来指定要从哪个 JSON 文件读取,例如 --definition-authorizations=@path/to/file.json

--definition-inputs (通用映射)

用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-inputs=@path/to/file.json

--definition-compliance-profile (ProjectComplianceProfile)

合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-compliance-profile=@path/to/file.json

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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", "wp_policy_id": "exampleString", "wp_instance_id": "exampleString", "wp_instance_name": "exampleString", "wp_instance_location": "us-south", "wp_zone_id": "exampleString", "wp_zone_name": "exampleString", "wp_policy_name": "exampleString"}}'

或者,粒度选项可用于 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.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] [--output FORMAT] [-q, --quiet]

命令选项

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--token (字符串)

服务器使用此参数来确定下一页上返回的第一个条目。 如果未指定此参数,那么将返回逻辑第一页。

缺省值为 。最大长度为 1536 个字符。 最小长度为 0 个字符。 该值必须与正则表达式 /^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/ 匹配。

--limit (int64)

返回资源的最大数量。 返回的资源数相同,但最后一页除外。

默认值为 10。 最大值为 100。 最小值为 1

--all-pages (bool)

调用多个请求来显示环境集合的所有页面。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (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.cloud.ibm.com/v1/projects/6fd53106-7ce6-429e-8c57-f22e832d0c4b/environments/2102afed-94c7-46fe-90f2-7fff290637b4"
  } ]
}

ibmcloud project environment

获取环境。 了解更多信息

ibmcloud project environment --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

环境标识。 必需。

最大长度为 256 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$).+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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.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] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

环境标识。 必需。

最大长度为 256 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$).+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--definition (EnvironmentDefinitionPropertiesPatch)

用于更新的环境定义。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition=@path/to/file.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 选项来指定要从哪个 JSON 文件读取,例如 --definition-authorizations=@path/to/file.json

--definition-inputs (通用映射)

用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-inputs=@path/to/file.json

--definition-compliance-profile (ProjectComplianceProfile)

合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-compliance-profile=@path/to/file.json

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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", "wp_policy_id": "exampleString", "wp_instance_id": "exampleString", "wp_instance_name": "exampleString", "wp_instance_location": "us-south", "wp_zone_id": "exampleString", "wp_zone_name": "exampleString", "wp_policy_name": "exampleString"}}'

或者,粒度选项可用于 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.cloud.ibm.com/v1/projects/6fd53106-7ce6-429e-8c57-f22e832d0c4b/environments/2102afed-94c7-46fe-90f2-7fff290637b4"
}

ibmcloud project environment-delete

通过指定项目标识来删除项目中的环境。

ibmcloud project environment-delete --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

环境标识。 必需。

最大长度为 256 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$).+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project environment-delete \
    --project-id exampleString \
    --id exampleString

示例输出

环境删除响应示例。

{
  "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-members DEFINITION-MEMBERS --definition-uses DEFINITION-USES --definition-description DEFINITION-DESCRIPTION --definition-name DEFINITION-NAME --definition-authorizations DEFINITION-AUTHORIZATIONS --definition-inputs DEFINITION-INPUTS --definition-settings DEFINITION-SETTINGS --definition-environment-id DEFINITION-ENVIRONMENT-ID --definition-resource-crns DEFINITION-RESOURCE-CRNS] [--schematics SCHEMATICS | --schematics-workspace-crn SCHEMATICS-WORKSPACE-CRN] [--output FORMAT] [-q, --quiet]

命令选项

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--definition (ProjectConfigDefinitionPrototype)

可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition=@path/to/file.json

--schematics (SchematicsWorkspace)

用于部署此可部署体系结构的 Schematics 工作空间。

如果从现有 Schematics 工作区导入数据,而该工作区没有 cart 支持,则必须提供 locator_id。 如果使用由 cart 支持的 Schematics 工作区,则不需要 locator_id,因为 Schematics 工作区有一个。

有 3 个方案:

  1. 如果仅指定了 locator_id,那么将使用该 locator_id 实例化新的 Schematics 工作空间。
  2. 如果仅指定了示意图 workspace_crn,那么在现有示意图工作空间中找不到 locator_id 时,将返回 400
  3. 如果同时指定 Schematics workspace_crnlocator_id,如果指定的 locator_id 与现有 Schematics 工作区中的 locator_id 不一致,则会返回 400 代码。

更多信息,请参阅 创建工作区和导入 Terraform 模板。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --schematics=@path/to/file.json

--definition-compliance-profile (ProjectComplianceProfile)

合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-compliance-profile=@path/to/file.json

--definition-locator-id (字符串)

目录标识和版本标识的唯一并置,用于标识目录中的可部署体系结构。 如果从没有 cart 支持的现有 Schematics 工作区导入,则需要 locator_id。 如果使用由 cart 支持的 Schematics 工作区,则不需要 locator_id,因为 Schematics 工作区有一个。

有 3 个方案:

  1. 如果仅指定了 locator_id,那么将使用该 locator_id 实例化新的 Schematics 工作空间。
  2. 如果仅指定了示意图 workspace_crn,那么在现有示意图工作空间中找不到 locator_id 时,将返回 400
  3. 如果同时指定了 Schematics workspace_crnlocator_id,那么当指定的 locator_id 与现有 Schematics 工作空间中的 locator_id 不一致时,将返回 400 消息。 有关创建 Schematics 工作区的更多信息,请参阅 创建工作区和导入 Terraform 模板。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 512 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/ 匹配。

--definition-members (StackMember[])

堆栈中包含的成员可部署架构。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-members=@path/to/file.json

--definition-uses (ProjectConfigUses[])

该配置所引用的 Deployabe 架构。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-uses=@path/to/file.json

--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-authorizations (ProjectConfigAuth)

授权详细信息。 它可以通过使用受信任的配置文件或 Secrets Manager 中的 API 密钥进行授权。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-authorizations=@path/to/file.json

--definition-inputs (通用映射)

用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-inputs=@path/to/file.json

--definition-settings (通用映射)

用于部署配置的 Schematics 环境变量。 仅当初始创建配置时指定了设置时,这些设置才可用。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-settings=@path/to/file.json

--definition-environment-id (字符串)

项目环境 ID。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--definition-resource-crns ([]字符串)

与此配置关联的资源的 CRN。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

列表项必须与正则表达式 /^(?!\\s)(?!.*\\s$)(crn)[^'"`<>{}\\s\\x00-\\x1F]*$/ 匹配。 最大长度为 110 项。 最小长度为 0 项。

--schematics-workspace-crn (字符串)

唯一标识资源的 IBM Cloud 资源名称。 此选项为 JSON 选项 "schematics" 的子字段提供值。 它与该选项互斥。

最大长度为 512 个字符。 最小长度为 4 个字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)(crn)[^'"`<>{}\\s\\x00-\\x1F]*$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project config-create \
    --project-id exampleString \
    --definition '{"compliance_profile": {}, "locator_id": "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global", "members": [{"name": "exampleString", "config_id": "exampleString"}], "description": "The stage environment configuration.", "name": "env-stage", "authorizations": {"trusted_profile_id": "exampleString", "method": "exampleString", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}, "environment_id": "exampleString"}' \
    --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-members '[stackMember]' \
    --definition-uses '[projectConfigUses]' \
    --definition-description exampleString \
    --definition-name exampleString \
    --definition-authorizations projectConfigAuth \
    --definition-inputs '{"anyKey": "anyValue"}' \
    --definition-settings '{"anyKey": "anyValue"}' \
    --definition-environment-id exampleString \
    --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] [--output FORMAT] [-q, --quiet]

命令选项

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--token (字符串)

服务器使用此参数来确定下一页上返回的第一个条目。 如果未指定此参数,那么将返回逻辑第一页。

缺省值为 。最大长度为 1536 个字符。 最小长度为 0 个字符。 该值必须与正则表达式 /^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/ 匹配。

--limit (int64)

返回资源的最大数量。 返回的资源数相同,但最后一页除外。

默认值为 10。 最大值为 100。 最小值为 1

--all-pages (bool)

调用多个请求以显示配置集合的所有页面。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (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",
    "deployment_model" : "project_deployed",
    "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",
    "deployment_model" : "project_deployed",
    "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"
  } ]
}

默认 JMESPath

如果用户未提供 JMESPath 查询,则默认情况下将对该命令的输出应用 JMESPath 查询。 确切的查询取决于所要求的场景和输出格式。 您可以在下表中看到每个默认 JMESPath 查询的条件:

默认 JMESPath
响应 输出 查询
成功 缺省值
configs[].{id: id, name: definition.name, project_name: project.definition.name, state: state, state_code: state_code, version: version}
错误 缺省值
configs[].{id: id, name: definition.name, project_name: project.definition.name, state: state, state_code: state_code, version: version}
所有页面 缺省值
configs[].{id: id, name: definition.name, project_name: project.definition.name, state: state, state_code: state_code, version: version}

如果提供自定义 JMESPath 查询,它将取代上表中的任何 JMESPath。

ibmcloud project config

在特定项目中检索指定的项目配置。

ibmcloud project config --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q,--quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

示例

ibmcloud project config \
    --project-id exampleString \
    --id exampleString

默认 JMESPath

如果用户未提供 JMESPath 查询,则默认情况下将对该命令的输出应用 JMESPath 查询。 确切的查询取决于所要求的场景和输出格式。 您可以在下表中看到每个默认 JMESPath 查询的条件:

默认 JMESPath
响应 输出 查询
成功 缺省值
{id: id, name: definition.name, project_name: project.definition.name, state: state, state_code: state_code, version: version}
错误 缺省值
{id: id, name: definition.name, project_name: project.definition.name, state: state, state_code: state_code, version: version}
所有页面 缺省值
{id: id, name: definition.name, project_name: project.definition.name, state: state, state_code: state_code, version: version}

如果提供自定义 JMESPath 查询,它将取代上表中的任何 JMESPath。

ibmcloud project config-update

通过指定标识来更新项目中的配置。 了解更多信息

ibmcloud project config-update --id ID {--definition DEFINITION | --definition-compliance-profile DEFINITION-COMPLIANCE-PROFILE --definition-locator-id DEFINITION-LOCATOR-ID --definition-members DEFINITION-MEMBERS --definition-uses DEFINITION-USES --definition-description DEFINITION-DESCRIPTION --definition-name DEFINITION-NAME --definition-authorizations DEFINITION-AUTHORIZATIONS --definition-inputs DEFINITION-INPUTS --definition-settings DEFINITION-SETTINGS --definition-environment-id DEFINITION-ENVIRONMENT-ID --definition-resource-crns DEFINITION-RESOURCE-CRNS} [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--definition (ProjectConfigDefinitionPatch)

可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition=@path/to/file.json

--definition-compliance-profile (ProjectComplianceProfile)

合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-compliance-profile=@path/to/file.json

--definition-locator-id (字符串)

目录标识和版本标识的唯一并置,用于标识目录中的可部署体系结构。 如果从没有 cart 支持的现有 Schematics 工作区导入,则需要 locator_id。 如果使用由 cart 支持的 Schematics 工作区,则不需要 locator_id,因为 Schematics 工作区有一个。

有 3 个方案:

  1. 如果仅指定了 locator_id,那么将使用该 locator_id 实例化新的 Schematics 工作空间。
  2. 如果仅指定了示意图 workspace_crn,那么在现有示意图工作空间中找不到 locator_id 时,将返回 400
  3. 如果同时指定了 Schematics workspace_crnlocator_id,那么当指定的 locator_id 与现有 Schematics 工作空间中的 locator_id 不一致时,将返回 400 消息。 有关创建 Schematics 工作区的更多信息,请参阅 创建工作区和导入 Terraform 模板。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 512 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/ 匹配。

--definition-members (StackMember[])

堆栈中包含的成员可部署架构。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-members=@path/to/file.json

--definition-uses (ProjectConfigUses[])

该配置所引用的 Deployabe 架构。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-uses=@path/to/file.json

--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-authorizations (ProjectConfigAuth)

授权详细信息。 您可以在 Secrets Manager中使用可信概要文件或 API 密钥进行授权。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-authorizations=@path/to/file.json

--definition-inputs (通用映射)

用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-inputs=@path/to/file.json

--definition-settings (通用映射)

用于部署配置的 Schematics 环境变量。 仅当初始创建配置时指定了设置时,这些设置才可用。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-settings=@path/to/file.json

--definition-environment-id (字符串)

项目环境 ID。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--definition-resource-crns ([]字符串)

与此配置关联的资源的 CRN。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

列表项必须与正则表达式 /^(?!\\s)(?!.*\\s$)(crn)[^'"`<>{}\\s\\x00-\\x1F]*$/ 匹配。 最大长度为 110 项。 最小长度为 0 项。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project config-update \
    --project-id exampleString \
    --id exampleString \
    --definition '{"compliance_profile": {}, "locator_id": "exampleString", "members": [{"name": "exampleString", "config_id": "exampleString"}], "description": "exampleString", "name": "env-stage", "authorizations": {"trusted_profile_id": "exampleString", "method": "exampleString", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}, "environment_id": "exampleString"}'

或者,粒度选项可用于 JSON 字符串选项的子字段:

ibmcloud project config-update \
    --project-id exampleString \
    --id exampleString \
    --definition-compliance-profile projectComplianceProfile \
    --definition-locator-id exampleString \
    --definition-members '[stackMember]' \
    --definition-uses '[projectConfigUses]' \
    --definition-description exampleString \
    --definition-name exampleString \
    --definition-authorizations projectConfigAuth \
    --definition-inputs '{"anyKey": "anyValue"}' \
    --definition-settings '{"anyKey": "anyValue"}' \
    --definition-environment-id exampleString

ibmcloud project config-delete

通过指定项目标识来删除项目中的配置。

ibmcloud project config-delete --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-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 --id ID --comment COMMENT [--project-id PROJECT-ID]

命令选项

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--comment (字符串)

关于项目行动草案的说明。 如果该操作是对配置草案进行强制批准,则必须包含一个非空注释。 必需。

最大长度为 1024 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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_model" : "project_deployed",
  "references" : { }
}

ibmcloud project config-approve

核准并将配置编辑合并到主配置。

ibmcloud project config-approve --id ID --comment COMMENT [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--comment (字符串)

关于项目行动草案的说明。 如果该操作是对配置草案进行强制批准,则必须包含一个非空注释。

最大长度为 1024 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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_model" : "project_deployed",
  "references" : { }
}

ibmcloud project config-validate

对项目中的特定配置运行验证检查。 此检查包括使用计划作业,运行 CRA 扫描和成本估算来创建或更新关联的 Schematics 工作空间。

ibmcloud project config-validate --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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_model" : "project_deployed",
  "references" : { }
}

ibmcloud project config-prevalidate

对通过 API 传递的配置进行验证检查。 检查包括创建 Schematics 工作区和计划任务、运行 CRA 扫描和成本估算。

ibmcloud project config-prevalidate --id ID [--project-id PROJECT-ID] {--definition DEFINITION | --definition-compliance-profile DEFINITION-COMPLIANCE-PROFILE --definition-locator-id DEFINITION-LOCATOR-ID --definition-members DEFINITION-MEMBERS --definition-uses DEFINITION-USES --definition-description DEFINITION-DESCRIPTION --definition-name DEFINITION-NAME --definition-authorizations DEFINITION-AUTHORIZATIONS --definition-inputs DEFINITION-INPUTS --definition-settings DEFINITION-SETTINGS --definition-environment-id DEFINITION-ENVIRONMENT-ID --definition-resource-crns DEFINITION-RESOURCE-CRNS} [--schematics SCHEMATICS | --schematics-workspace-crn SCHEMATICS-WORKSPACE-CRN] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--definition (ProjectConfigDefinitionPrototype)

可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition=@path/to/file.json

--schematics (SchematicsWorkspace)

用于部署此可部署体系结构的 Schematics 工作空间。

如果从现有 Schematics 工作区导入数据,而该工作区没有 cart 支持,则必须提供 locator_id。 如果使用由 cart 支持的 Schematics 工作区,则不需要 locator_id,因为 Schematics 工作区有一个。

有 3 个方案:

  1. 如果仅指定了 locator_id,那么将使用该 locator_id 实例化新的 Schematics 工作空间。
  2. 如果仅指定了示意图 workspace_crn,那么在现有示意图工作空间中找不到 locator_id 时,将返回 400
  3. 如果同时指定 Schematics workspace_crnlocator_id,如果指定的 locator_id 与现有 Schematics 工作区中的 locator_id 不一致,则会返回 400 代码。

更多信息,请参阅 创建工作区和导入 Terraform 模板。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --schematics=@path/to/file.json

--definition-compliance-profile (ProjectComplianceProfile)

合规性所需的概要文件。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-compliance-profile=@path/to/file.json

--definition-locator-id (字符串)

目录标识和版本标识的唯一并置,用于标识目录中的可部署体系结构。 如果从没有 cart 支持的现有 Schematics 工作区导入,则需要 locator_id。 如果使用由 cart 支持的 Schematics 工作区,则不需要 locator_id,因为 Schematics 工作区有一个。

有 3 个方案:

  1. 如果仅指定了 locator_id,那么将使用该 locator_id 实例化新的 Schematics 工作空间。
  2. 如果仅指定了示意图 workspace_crn,那么在现有示意图工作空间中找不到 locator_id 时,将返回 400
  3. 如果同时指定了 Schematics workspace_crnlocator_id,那么当指定的 locator_id 与现有 Schematics 工作空间中的 locator_id 不一致时,将返回 400 消息。 有关创建 Schematics 工作区的更多信息,请参阅 创建工作区和导入 Terraform 模板。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 512 个字符。 最小长度为 1 字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)[\\.0-9a-z-A-Z_-]+$/ 匹配。

--definition-members (StackMember[])

堆栈中包含的成员可部署架构。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-members=@path/to/file.json

--definition-uses (ProjectConfigUses[])

该配置所引用的 Deployabe 架构。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-uses=@path/to/file.json

--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-authorizations (ProjectConfigAuth)

授权详细信息。 您可以在 Secrets Manager中使用可信概要文件或 API 密钥进行授权。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-authorizations=@path/to/file.json

--definition-inputs (通用映射)

用于配置定义和环境的输入变量。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-inputs=@path/to/file.json

--definition-settings (通用映射)

用于部署配置的 Schematics 环境变量。 仅当初始创建配置时指定了设置时,这些设置才可用。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --definition-settings=@path/to/file.json

--definition-environment-id (字符串)

项目环境 ID。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--definition-resource-crns ([]字符串)

与此配置关联的资源的 CRN。 此选项为 JSON 选项 "definition" 的子字段提供值。 它与该选项互斥。

列表项必须与正则表达式 /^(?!\\s)(?!.*\\s$)(crn)[^'"`<>{}\\s\\x00-\\x1F]*$/ 匹配。 最大长度为 110 项。 最小长度为 0 项。

--schematics-workspace-crn (字符串)

唯一标识资源的 IBM Cloud 资源名称。 此选项为 JSON 选项 "schematics" 的子字段提供值。 它与该选项互斥。

最大长度为 512 个字符。 最小长度为 4 个字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)(crn)[^'"`<>{}\\s\\x00-\\x1F]*$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project config-prevalidate \
    --project-id exampleString \
    --id exampleString \
    --definition '{"compliance_profile": {}, "locator_id": "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global", "members": [{"name": "exampleString", "config_id": "exampleString"}], "description": "The stage environment configuration.", "name": "env-stage", "authorizations": {"trusted_profile_id": "exampleString", "method": "exampleString", "api_key": "exampleString"}, "inputs": {"anyKey": "anyValue"}, "settings": {"anyKey": "anyValue"}, "environment_id": "exampleString"}' \
    --schematics '{"workspace_crn": "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"}'

或者,粒度选项可用于 JSON 字符串选项的子字段:

ibmcloud project config-prevalidate \
    --project-id exampleString \
    --id exampleString \
    --definition-compliance-profile projectComplianceProfile \
    --definition-locator-id exampleString \
    --definition-members '[stackMember]' \
    --definition-uses '[projectConfigUses]' \
    --definition-description exampleString \
    --definition-name exampleString \
    --definition-authorizations projectConfigAuth \
    --definition-inputs '{"anyKey": "anyValue"}' \
    --definition-settings '{"anyKey": "anyValue"}' \
    --definition-environment-id exampleString \
    --schematics-workspace-crn crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::

示例输出

预验证的结果对象。

{
  "result_id" : "293c3c36-a094-4115-a12b-de0a9ca39be5"
}

ibmcloud project get-prevalidate

使用密钥检索预验证结果。

ibmcloud project get-prevalidate --id ID --result-id RESULT-ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--result-id (字符串)

用于获取预验证事件的唯一标识符。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project get-prevalidate \
    --project-id exampleString \
    --id exampleString \
    --result-id exampleString

示例输出

获取预验证结果的响应示例。

{
  "cost_estimate" : { },
  "cra_logs" : {
    "cra_version" : "2.0.4",
    "status" : "passed"
  },
  "job" : {
    "id" : "ba98208b61efa490153b72adfd672251",
    "summary" : {
      "version" : "1.0.5",
      "plan_summary" : { },
      "apply_summary" : { },
      "destroy_summary" : { },
      "message_summary" : { },
      "plan_messages" : { },
      "apply_messages" : { },
      "destroy_messages" : { }
    }
  },
  "result" : "succeeded"
}

ibmcloud project config-deploy

部署项目的配置。 此操作为异步操作,可通过使用带有完整元数据的获取项目配置 API 进行跟踪。

ibmcloud project config-deploy --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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_model" : "project_deployed",
  "references" : { }
}

ibmcloud project config-undeploy

取消部署项目的配置资源。 此操作将取消部署使用特定配置部署的所有资源。 可使用带有完整元数据的获取项目配置 API 跟踪配置资源。

ibmcloud project config-undeploy --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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_model" : "project_deployed",
  "references" : { }
}

ibmcloud project config-sync

通过分析关联的管道运行和 Schematics 工作空间日志来同步项目配置,以将配置恢复到工作状态。

ibmcloud project config-sync --id ID [--schematics SCHEMATICS | --schematics-workspace-crn SCHEMATICS-WORKSPACE-CRN] [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--schematics (SchematicsWorkspace)

用于部署此可部署体系结构的 Schematics 工作空间。

如果从现有 Schematics 工作区导入数据,而该工作区没有 cart 支持,则必须提供 locator_id。 如果使用由 cart 支持的 Schematics 工作区,则不需要 locator_id,因为 Schematics 工作区有一个。

有 3 个方案:

  1. 如果仅指定了 locator_id,那么将使用该 locator_id 实例化新的 Schematics 工作空间。
  2. 如果仅指定了示意图 workspace_crn,那么在现有示意图工作空间中找不到 locator_id 时,将返回 400
  3. 如果同时指定 Schematics workspace_crnlocator_id,如果指定的 locator_id 与现有 Schematics 工作区中的 locator_id 不一致,则会返回 400 代码。

更多信息,请参阅 创建工作区和导入 Terraform 模板。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --schematics=@path/to/file.json

--schematics-workspace-crn (字符串)

唯一标识资源的 IBM Cloud 资源名称。 此选项为 JSON 选项 "schematics" 的子字段提供值。 它与该选项互斥。

最大长度为 512 个字符。 最小长度为 4 个字符。 该值必须与正则表达式 /^(?!\\s)(?!.*\\s$)(crn)[^'"`<>{}\\s\\x00-\\x1F]*$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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" : "",
    "account_id" : "499b176abb3e1c9727df87ae48b27c7b",
    "location" : "us-south",
    "resource_status" : "active",
    "tags" : [ ],
    "service_tags" : [ ],
    "catalog_tags" : [ ]
  }, {
    "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" : "",
    "account_id" : "499b176abb3e1c9727df87ae48b27c7b",
    "location" : "us-south",
    "resource_status" : "active",
    "tags" : [ ],
    "service_tags" : [ ],
    "catalog_tags" : [ ]
  } ],
  "resources_count" : 2
}

ibmcloud project stack-definition-create

在堆栈级别定义用户需要配置的输入以及成员级别的输入值。 这些值会在可部署架构栈导出到私有目录时包含在目录条目中,并且是可部署架构栈部署所必需的。 可将引用添加到值中,或在成员级别明确添加值。

ibmcloud project stack-definition-create --id ID {--stack-definition STACK-DEFINITION | --stack-definition-inputs STACK-DEFINITION-INPUTS --stack-definition-outputs STACK-DEFINITION-OUTPUTS} [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--stack-definition (StackDefinitionBlockPrototype)

堆栈定义的定义块。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --stack-definition=@path/to/file.json

--stack-definition-inputs (StackDefinitionInputVariable[])

定义用户需要在堆栈级别配置的输入。 将可部署体系结构堆栈导出到专用目录时,这些输入将包含在目录条目中。 此选项为 JSON 选项 "stack-definition" 的子字段提供值。 它与该选项互斥。

最大长度为 300 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --stack-definition-inputs=@path/to/file.json

--stack-definition-outputs (StackDefinitionOutputVariable[])

与此堆栈定义关联的输出。 此选项为 JSON 选项 "stack-definition" 的子字段提供值。 它与该选项互斥。

最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --stack-definition-outputs=@path/to/file.json

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project stack-definition-create \
    --project-id exampleString \
    --id exampleString \
    --stack-definition '{"inputs": [{"name": "region", "type": "string", "description": "The IBM Cloud location where a resource is deployed.", "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,
      "description" : "The IBM Cloud location where a resource is deployed."
    }, {
      "name" : "resource_group",
      "type" : "string",
      "default" : "Default",
      "required" : true,
      "hidden" : false,
      "description" : "The IBM Cloud resource group where a resource is deployed."
    } ],
    "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
      } ]
    } ]
  },
  "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",
  "references" : { }
}

ibmcloud project stack-definition

检索与配置关联的堆栈定义。

ibmcloud project stack-definition --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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,
      "description" : "The IBM Cloud location where a resource is deployed."
    }, {
      "name" : "resource_group",
      "type" : "string",
      "default" : "Default",
      "required" : true,
      "hidden" : false,
      "description" : "The IBM Cloud resource group where a resource is deployed."
    } ],
    "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
      } ]
    } ]
  },
  "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",
  "references" : { }
}

ibmcloud project stack-definition-update

更新与配置关联的堆栈定义。

ibmcloud project stack-definition-update --id ID {--stack-definition STACK-DEFINITION | --stack-definition-inputs STACK-DEFINITION-INPUTS --stack-definition-outputs STACK-DEFINITION-OUTPUTS} [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--stack-definition (StackDefinitionBlockPrototype)

堆栈定义的定义块。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --stack-definition=@path/to/file.json

--stack-definition-inputs (StackDefinitionInputVariable[])

定义用户需要在堆栈级别配置的输入。 将可部署体系结构堆栈导出到专用目录时,这些输入将包含在目录条目中。 此选项为 JSON 选项 "stack-definition" 的子字段提供值。 它与该选项互斥。

最大长度为 300 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --stack-definition-inputs=@path/to/file.json

--stack-definition-outputs (StackDefinitionOutputVariable[])

与此堆栈定义关联的输出。 此选项为 JSON 选项 "stack-definition" 的子字段提供值。 它与该选项互斥。

最大长度为 100 项。 最小长度为 0 项。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --stack-definition-outputs=@path/to/file.json

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project stack-definition-update \
    --project-id exampleString \
    --id exampleString \
    --stack-definition '{"inputs": [{"name": "region", "type": "string", "description": "The IBM Cloud location where a resource is deployed.", "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,
      "description" : "The IBM Cloud location where a resource is deployed."
    } ],
    "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 --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 PROJECT_ID] [--output FORMAT] [-q, --quiet]

命令选项

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--settings (StackDefinitionExportRequest)

专用目录导出请求的有效内容。 可以通过使用其他选项设置各个字段来提供此 JSON 选项。 它与这些选项互斥。

提供一个 JSON 字符串选项,或通过提供一个以 @ 开头的 filepath 选项来指定要从哪个 JSON 文件读取,例如 --settings=@path/to/file.json

--settings-catalog-id (字符串)

要发布的目录标识。 此选项为 JSON 选项 "settings" 的子字段提供值。 它与该选项互斥。

最大长度为 36 个字符。 该值必须与正则表达式 /^[\\-0-9a-zA-Z]+$/ 匹配。

--settings-target-version (字符串)

新版本产品的 semver 值。 此选项为 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 (字符串)

当前搭载软件的变化。 仅在产品类型为模块或解决方案时有效。 请参阅 flavor Catalog 的进口产品。 此选项为 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]+$/ 匹配。

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--output (字符串)

选择输出格式--可以是 "json"、"yaml"、"tui "或 "table"。(默认为 "表)

-q, --quiet (bool)

禁用详细消息。

示例

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": []}'

或者,粒度选项可用于 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 '[]'

示例输出

将堆栈定义导出到专用目录的样本响应

{
  "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",
  "tags" : [ ]
}

ibmcloud project config-versions

检索特定项目中项目配置的先前版本和当前版本的列表。

ibmcloud project config-versions --id ID [--project-id PROJECT-ID] [--output FORMAT] [-q, --quiet]

命令选项

--project-id (字符串)

唯一项目标识。 如果未选择项目,则为必填项。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

--id (字符串)

唯一配置标识。 必需。

最大长度为 128 个字符。 该值必须与正则表达式 /^[\\.\\-0-9a-zA-Z]+$/ 匹配。

-q, --quiet (bool)

禁用详细消息。

示例

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"
  } ]
}

默认 JMESPath

如果用户未提供 JMESPath 查询,则默认情况下将对该命令的输出应用 JMESPath 查询。 确切的查询取决于所要求的场景和输出格式。 您可以在下表中看到每个默认 JMESPath 查询的条件:

默认 JMESPath
响应 输出 查询
成功 缺省值
versions
错误 缺省值
versions
所有页面 缺省值
versions

如果提供自定义 JMESPath 查询,它将取代上表中的任何 JMESPath。

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)

配置版本。 必需。

最大值为 10000。 最小值为 0

-q, --quiet (bool)

禁用详细消息。

示例

ibmcloud project config-version \
    --project-id exampleString \
    --id exampleString \
    --version 0

V2 配置

V2Configurations 资源的命令。

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)

配置版本。 必需。

最大值为 10000。 最小值为 0

示例

ibmcloud project config-version-delete \
    --project-id exampleString \
    --id exampleString \
    --version 0

示例输出

用于删除配置的请求的示例响应。

{
  "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",
    "wp_policy_id" : "exampleString",
    "wp_instance_id" : "exampleString",
    "wp_instance_name" : "exampleString",
    "wp_instance_location" : "us-south",
    "wp_zone_id" : "exampleString",
    "wp_zone_name" : "exampleString",
    "wp_policy_name" : "exampleString"
  }
}

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",
    "wp_policy_id" : "exampleString",
    "wp_instance_id" : "exampleString",
    "wp_instance_name" : "exampleString",
    "wp_instance_location" : "us-south",
    "wp_zone_id" : "exampleString",
    "wp_zone_name" : "exampleString",
    "wp_policy_name" : "exampleString"
  }
}

EnvironmentPrototype[]

下面的示例显示了 EnvironmentPrototype[] 对象的格式。


[ {
  "definition" : {
    "description" : "exampleString",
    "name" : "exampleString",
    "authorizations" : {
      "trusted_profile_id" : "exampleString",
      "method" : "exampleString",
      "api_key" : "exampleString"
    },
    "inputs" : {
      "anyKey" : "anyValue"
    },
    "compliance_profile" : { }
  }
} ]

ProjectComplianceProfile

下面的示例显示了 ProjectComplianceProfile 对象的格式。


{
  "id" : "exampleString",
  "instance_id" : "exampleString",
  "instance_location" : "us-south",
  "attachment_id" : "someattachmentid",
  "profile_name" : "SCCProfilev1.0",
  "wp_policy_id" : "exampleString",
  "wp_instance_id" : "exampleString",
  "wp_instance_name" : "exampleString",
  "wp_instance_location" : "us-south",
  "wp_zone_id" : "exampleString",
  "wp_zone_name" : "exampleString",
  "wp_policy_name" : "exampleString"
}

ProjectConfigAuth

下面的示例显示了 ProjectConfigAuth 对象的格式。


{
  "trusted_profile_id" : "Profile-9ac10c5c-195c-41ef-b465-68a6b6dg5f12",
  "method" : "trusted_profile",
  "api_key" : "exampleString"
}

ProjectConfigDefinitionPatch

下面的示例显示了 ProjectConfigDefinitionPatch 对象的格式。


{
  "compliance_profile" : { },
  "locator_id" : "exampleString",
  "members" : [ {
    "name" : "exampleString",
    "config_id" : "exampleString"
  } ],
  "description" : "exampleString",
  "name" : "env-stage",
  "authorizations" : {
    "trusted_profile_id" : "exampleString",
    "method" : "exampleString",
    "api_key" : "exampleString"
  },
  "inputs" : {
    "anyKey" : "anyValue"
  },
  "settings" : {
    "anyKey" : "anyValue"
  },
  "environment_id" : "exampleString"
}

ProjectConfigDefinitionPrototype

下面的示例显示了 ProjectConfigDefinitionPrototype 对象的格式。


{
  "compliance_profile" : { },
  "locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
  "members" : [ {
    "name" : "exampleString",
    "config_id" : "exampleString"
  } ],
  "description" : "The stage environment configuration.",
  "name" : "env-stage",
  "authorizations" : {
    "trusted_profile_id" : "exampleString",
    "method" : "exampleString",
    "api_key" : "exampleString"
  },
  "inputs" : {
    "anyKey" : "anyValue"
  },
  "settings" : {
    "anyKey" : "anyValue"
  },
  "environment_id" : "exampleString"
}

ProjectConfigPrototype[]

下面的示例显示了 ProjectConfigPrototype[] 对象的格式。


[ {
  "definition" : {
    "compliance_profile" : { },
    "locator_id" : "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.018edf04-e772-4ca2-9785-03e8e03bef72-global",
    "members" : [ {
      "name" : "exampleString",
      "config_id" : "exampleString"
    } ],
    "description" : "The stage account configuration.",
    "name" : "account-stage",
    "authorizations" : {
      "trusted_profile_id" : "exampleString",
      "method" : "exampleString",
      "api_key" : "exampleString"
    },
    "inputs" : {
      "anyKey" : "anyValue"
    },
    "settings" : {
      "anyKey" : "anyValue"
    },
    "environment_id" : "exampleString"
  },
  "schematics" : {
    "workspace_crn" : "crn:v1:staging:public:project:us-south:a/4e1c48fcf8ac33c0a2441e4139f189ae:bf40ad13-b107-446a-8286-c6d576183bb1::"
  }
} ]

ProjectDefinitionPatch

下面的示例显示了 ProjectDefinitionPatch 对象的格式。


{
  "name" : "acme-microservice",
  "description" : "A microservice to deploy on top of ACME infrastructure.",
  "auto_deploy_mode" : "auto_approval",
  "monitoring_enabled" : true,
  "destroy_on_delete" : true,
  "store" : {
    "type" : "gh",
    "url" : "exampleString",
    "token" : "exampleString",
    "config_directory" : "exampleString"
  },
  "terraform_engine" : {
    "id" : "exampleString",
    "type" : "terraform-enterprise"
  },
  "auto_deploy" : true
}

ProjectDefinitionStore

下面的示例显示了 ProjectDefinitionStore 对象的格式。


{
  "type" : "gh",
  "url" : "exampleString",
  "token" : "exampleString",
  "config_directory" : "exampleString"
}

ProjectPrototypeDefinition

下面的示例显示了 ProjectPrototypeDefinition 对象的格式。


{
  "name" : "acme-microservice",
  "description" : "A microservice to deploy on top of ACME infrastructure.",
  "auto_deploy_mode" : "manual_approval",
  "monitoring_enabled" : false,
  "destroy_on_delete" : true,
  "store" : {
    "type" : "gh",
    "url" : "exampleString",
    "token" : "exampleString",
    "config_directory" : "exampleString"
  },
  "terraform_engine" : {
    "id" : "exampleString",
    "type" : "terraform-enterprise"
  },
  "auto_deploy" : false
}

ProjectTerraformEngineSettings

下面的示例显示了 ProjectTerraformEngineSettings 对象的格式。


{
  "id" : "exampleString",
  "type" : "terraform-enterprise"
}

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" : "The IBM Cloud location where a resource is deployed.",
    "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" : [ ]
}

StackDefinitionInputVariable

下面的示例显示了 StackDefinitionInputVariable 对象的格式。


{
  "name" : "exampleString",
  "type" : "array",
  "description" : "exampleString",
  "default" : "exampleString",
  "required" : false,
  "hidden" : false
}

StackDefinitionOutputVariable

下面的示例显示了 StackDefinitionOutputVariable 对象的格式。


{
  "name" : "exampleString",
  "value" : "exampleString"
}

StackMember

下面的示例显示了 StackMember 对象的格式。


{
  "name" : "exampleString",
  "config_id" : "exampleString"
}

IBM Cloud 项目的其他相关命令

以下命令不是项目 CLI 插件的一部分,但您可以使用这些命令来完成与项目相关的任务,例如将标记附加到项目。 此列表并非详尽列出可用于项目的所有相关命令。 相反,此列表是您探索可用于项目的其他命令的起点。

以下某些命令可能需要先安装其特定插件,然后才能运行这些插件。

运行 ibmcloud resource tag-attach 以将标记附加到项目:

ibmcloud resource tag-attach --tag-names TAG --resource-id PROJECT-CRN
ibmcloud resource search "service_tags:\"schematics::project_id:PROJECT_ID\""

运行 ibmcloud schematics logs 以检索 Schematics 工作空间的日志文件:

ibmcloud schematics logs --id WORKSPACE_ID [--act-id ACTION_ID]