專案 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'。(預設為 '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'。(預設為 '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

列出現有的專案。 專案依 ID 排序。 注意:如果沒有設定 --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'。(預設為 '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
回應 輸出 查詢
成功 預設值
表格 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 (字串)

唯一專案 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
回應 輸出 查詢
成功 預設值
表格 {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

透過指定專案 ID 來更新專案。

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 (字串)

唯一專案 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'。(預設為 '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

透過指定 ID 來刪除專案文件。 只有在刪除專案的所有資源後,才能刪除專案。

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

指令選項

--id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

範例

ibmcloud project delete \
    --id exampleString

輸出範例

對刪除專案之要求的範例回應。

{
  "id" : "4059955c-ccb3-4fd3-aa48-34e3b8334f80"
}

環境

「環境」資源的指令。

ibmcloud project environment-create

建立環境以將相關配置分組在一起,並在它們之間共用值,以更輕鬆地部署。 如需相關資訊,請參閱 建立環境

ibmcloud project environment-create [--project-id PROJECT-ID] [--definition DEFINITION | --definition-description DEFINITION-DESCRIPTION --definition-name DEFINITION-NAME --definition-authorizations DEFINITION-AUTHORIZATIONS --definition-inputs DEFINITION-INPUTS --definition-compliance-profile DEFINITION-COMPLIANCE-PROFILE]

指令選項

--project-id (字串)

唯一專案 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'。(預設為 '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 (字串)

唯一專案 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'。(預設為 '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 (字串)

環境 ID。 必要。

最大長度為 256 字元。 最小長度為 1 字元。 值必須符合正規表示式 /^(?!\\s)(?!.*\\s$).+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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

透過指定環境 ID 來更新環境。 進一步瞭解

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 (字串)

環境 ID。 必要。

最大長度為 256 字元。 最小長度為 1 字元。 值必須符合正規表示式 /^(?!\\s)(?!.*\\s$).+$/

--project-id (字串)

唯一專案 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'。(預設為 '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

指定環境 ID 來刪除專案中的環境。

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

指令選項

--id (字串)

環境 ID。 必要。

最大長度為 256 字元。 最小長度為 1 字元。 值必須符合正規表示式 /^(?!\\s)(?!.*\\s$).+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--definition (ProjectConfigDefinitionPrototype)

可以改為透過使用其他選項設定個別欄位來提供此 JSON 選項。 它與這些選項互斥。

提供一個 JSON 字串選項,或透過提供一個以 @ 開頭的 filepath 選項,指定要從中讀取的 JSON 檔案,例如 --definition=@path/to/file.json

--schematics (SchematicsWorkspace)

用於部署此可部署架構的 Schematics 工作區。

如果從沒有 cart 支援的現有 Schematics 工作區匯入資料,則必須提供 locator_id。 如果使用由 cart 支援的 Schematics 工作區,則不需要 locator_id,因為 Schematics 工作區有一個。

有 3 個實務範例:

  1. 如果僅指定 locator_id,則會使用該 locator_id 實例化新的 Schematics 工作區。
  2. 如果僅指定 Schematics workspace_crn,則在現有 Schematics 工作區中找不到 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 (字串)

型錄 ID 和版本 ID 的唯一連結,用來識別型錄中的可部署架構。 如果從沒有 cart 支援的現有 Schematics 工作區匯入,則需要 locator_id。 如果使用由 cart 支援的 Schematics 工作區,則不需要 locator_id,因為 Schematics 工作區有一個。

有 3 個實務範例:

  1. 如果僅指定 locator_id,則會使用該 locator_id 實例化新的 Schematics 工作區。
  2. 如果僅指定 Schematics workspace_crn,則在現有 Schematics 工作區中找不到 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'。(預設為 '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 (字串)

唯一專案 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'。(預設為 '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
回應 輸出 查詢
成功 預設值
表格 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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

範例

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

預設 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

指定 ID 來更新專案中的配置。 進一步瞭解

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 (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--id (字串)

唯一配置 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 (字串)

型錄 ID 和版本 ID 的唯一連結,用來識別型錄中的可部署架構。 如果從沒有 cart 支援的現有 Schematics 工作區匯入,則需要 locator_id。 如果使用由 cart 支援的 Schematics 工作區,則不需要 locator_id,因為 Schematics 工作區有一個。

有 3 個實務範例:

  1. 如果僅指定 locator_id,則會使用該 locator_id 實例化新的 Schematics 工作區。
  2. 如果僅指定 Schematics workspace_crn,則在現有 Schematics 工作區中找不到 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'。(預設為 '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

指定專案的 ID 來刪除專案中的配置。

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

指令選項

--id (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 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 (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--id (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--comment (字串)

關於專案草稿動作的說明。 如果此動作是強制核准草案組態,則必須包含非空的註解。 必要。

最大長度為 1024 字元。 最小長度為 1 字元。 值必須符合正規表示式 /^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--comment (字串)

關於專案草稿動作的說明。 如果此動作是強制核准草案組態,則必須包含非空的註解。

最大長度為 1024 字元。 最小長度為 1 字元。 值必須符合正規表示式 /^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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

對專案中的特定配置執行驗證檢查。 檢查包括建立或更新具有計劃工作的相關聯 Schematics 工作區、執行 CRA 掃描及成本預估。

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

指令選項

--id (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--definition (ProjectConfigDefinitionPrototype)

可以改為透過使用其他選項設定個別欄位來提供此 JSON 選項。 它與這些選項互斥。

提供一個 JSON 字串選項,或透過提供一個以 @ 開頭的 filepath 選項,指定要從中讀取的 JSON 檔案,例如 --definition=@path/to/file.json

--schematics (SchematicsWorkspace)

用於部署此可部署架構的 Schematics 工作區。

如果從沒有 cart 支援的現有 Schematics 工作區匯入資料,則必須提供 locator_id。 如果使用由 cart 支援的 Schematics 工作區,則不需要 locator_id,因為 Schematics 工作區有一個。

有 3 個實務範例:

  1. 如果僅指定 locator_id,則會使用該 locator_id 實例化新的 Schematics 工作區。
  2. 如果僅指定 Schematics workspace_crn,則在現有 Schematics 工作區中找不到 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 (字串)

型錄 ID 和版本 ID 的唯一連結,用來識別型錄中的可部署架構。 如果從沒有 cart 支援的現有 Schematics 工作區匯入,則需要 locator_id。 如果使用由 cart 支援的 Schematics 工作區,則不需要 locator_id,因為 Schematics 工作區有一個。

有 3 個實務範例:

  1. 如果僅指定 locator_id,則會使用該 locator_id 實例化新的 Schematics 工作區。
  2. 如果僅指定 Schematics workspace_crn,則在現有 Schematics 工作區中找不到 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'。(預設為 '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::

輸出範例

prevalidate 的結果物件。

{
  "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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--result-id (字串)

取得預先驗證事件的唯一識別碼。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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

取消部署專案的配置資源。 此作業會取消部署使用特定配置所部署的所有資源。 組態資源可透過使用 get 專案組態 API 與完整的 metadata 來追蹤。

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

指令選項

--id (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--schematics (SchematicsWorkspace)

用於部署此可部署架構的 Schematics 工作區。

如果從沒有 cart 支援的現有 Schematics 工作區匯入資料,則必須提供 locator_id。 如果使用由 cart 支援的 Schematics 工作區,則不需要 locator_id,因為 Schematics 工作區有一個。

有 3 個實務範例:

  1. 如果僅指定 locator_id,則會使用該 locator_id 實例化新的 Schematics 工作區。
  2. 如果僅指定 Schematics workspace_crn,則在現有 Schematics 工作區中找不到 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 (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 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 (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 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 (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一配置 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--settings (StackDefinitionExportRequest)

專用型錄匯出要求的有效負載。 可以改為透過使用其他選項設定個別欄位來提供此 JSON 選項。 它與這些選項互斥。

提供一個 JSON 字串選項,或透過提供一個以 @ 開頭的 filepath 選項,指定要從中讀取的 JSON 檔案,例如 --settings=@path/to/file.json

--settings-catalog-id (字串)

要發佈的型錄 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 (字串)

要發佈的產品 ID。 此選項提供 JSON 選項 'settings' 的子欄位值。 它與該選項互斥。

最大長度為 36 字元。 值必須符合正規表示式 /^[\\-0-9a-zA-Z]+$/

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--output (字串)

選擇輸出格式 - 可以是 'json'、'yaml'、'tui「或」table'。(預設為 '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 (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--id (字串)

唯一配置 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
回應 輸出 查詢
成功 預設值
表格 versions
錯誤 預設值
表格 versions
所有頁面 預設值
表格 versions

如果提供自訂的 JMESPath 查詢,則會取代上表中的任何 JMESPath。

ibmcloud project config-version

擷取專案中特定版本的配置。

ibmcloud project config-version [--project-id PROJECT-ID] --id ID --version VERSION

指令選項

--project-id (字串)

唯一專案 ID。 必要。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--id (字串)

唯一配置 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

指定專案 ID 來刪除配置版本。

ibmcloud project config-version-delete [--project-id PROJECT-ID] --id ID --version VERSION

指令選項

--project-id (字串)

唯一專案 ID。 如果未選擇專案,則必須填寫。

最大長度為 128 字元。 值必須符合正規表示式 /^[\\.\\-0-9a-zA-Z]+$/

--id (字串)

唯一配置 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]