全部產品
Search
文件中心

CloudOps Orchestration Service:CreateStateConfiguration - 建立一個終態配置

更新時間:Dec 21, 2025

建立終態配置。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

oos:CreateStateConfiguration

create

*StateConfiguration

acs:oos:{#regionId}:{#accountId}:stateconfiguration/*

  • oos:TLSVersion

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

地區 ID。

cn-hangzhou

Description

string

終態配置的描述資訊。

collect inventory data

TemplateName

string

模板名稱。內容限制為字母、數字、中劃線、底線,長度 200 字元。

ACS-ECS-InventoryDataCollection

TemplateVersion

string

版本號碼,如不填預設為最新的版本號碼。

v1

Parameters

string

參數。

{ "policy": { "ACS:Application": { "Collection": "Enabled" }, "ACS:Network": { "Collection": "Enabled" } } }

ConfigureMode

string

配置模式。 ApplyOnly:配置只應用一次(更新配置後重新應用)。 ApplyAndMonitor: 配置只應用一次,成功應用後,後續只檢查配置是否漂移。 ApplyAndAutoCorrect:總是應用配置。

ApplyOnce

ScheduleType

string

調度類型。可選值:rate。

rate

ScheduleExpression

string

調度運算式。調度間隔不得小於 30 分鐘。

1 hour

Targets

string

目標資源。

{ "ResourceType": "ALIYUN::ECS::Instance", "Filters": [ { "Type": "All", "RegionId": "cn-hangzhou", "Parameters": { "RegionId": "cn-hangzhou", "Status": "Running" } } ] }

ClientToken

string

等冪 token。

DASKJJLKADS-AHKLJHJSAKL-AJK

Tags

object

標籤。

{"Key": "oos", "Value": "inventory"}

ResourceGroupId

string

資源群組 ID。

rg-acfmxsn4m4******

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

1306108F-610C-40FD-AAD5-DA13E8B00BE9

StateConfiguration

object

終態配置。

CreateTime

string

建立時間。

2021-03-22T03:13:32Z

Targets

string

目標資源。

{ "ResourceType": "ALIYUN::ECS::Instance", "Filters": [ { "Type": "All", "RegionId": "cn-hangzhou", "Parameters": { "RegionId": "cn-hangzhou", "Status": "Running" } } ] }

Tags

object

標籤。

{"Key": "oos", "Value": "inventory"}

StateConfigurationId

string

建立產生的配置 ID。

sc-a538febe18fabcdef

ScheduleExpression

string

定時運算式。

1 hour

TemplateName

string

模板名稱。

ACS-ECS-InventoryDataCollection

TemplateVersion

string

模板版本。

v1

ConfigureMode

string

配置模式。

ApplyAndAutoCorrect

ScheduleType

string

定時類型。

rate

Parameters

object

參數。

{"policy": {"ACS:Network": {"Collection": "Enabled"}, "ACS:Application": {"Collection": "Enabled"}}}

Description

string

描述資訊。

collect inventory data

ResourceGroupId

string

資源群組 ID。

rg-acfmxsn4m4******

TemplateId

string

模板 ID。

t-1234asadf

樣本

正常返回樣本

JSON格式

{
  "RequestId": "1306108F-610C-40FD-AAD5-DA13E8B00BE9",
  "StateConfiguration": {
    "CreateTime": "2021-03-22T03:13:32Z",
    "Targets": "{     \"ResourceType\": \"ALIYUN::ECS::Instance\",     \"Filters\": [       {         \"Type\": \"All\",         \"RegionId\": \"cn-hangzhou\",         \"Parameters\": {           \"RegionId\": \"cn-hangzhou\",           \"Status\": \"Running\"         }       }     ]   }",
    "Tags": {
      "Key": "oos",
      "Value": "inventory"
    },
    "StateConfigurationId": "sc-a538febe18fabcdef",
    "ScheduleExpression": "1 hour",
    "TemplateName": "ACS-ECS-InventoryDataCollection",
    "TemplateVersion": "v1",
    "ConfigureMode": "ApplyAndAutoCorrect",
    "ScheduleType": "rate",
    "Parameters": {
      "policy": {
        "ACS:Network": {
          "Collection": "Enabled"
        },
        "ACS:Application": {
          "Collection": "Enabled"
        }
      }
    },
    "Description": "collect inventory data",
    "ResourceGroupId": "rg-acfmxsn4m4******",
    "TemplateId": "t-1234asadf"
  }
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情