全部產品
Search
文件中心

Resource Orchestration Service:GetTemplateParameterConstraints - 擷取模版參數約束

更新時間:Jul 28, 2025

查詢範本參數的取值。

介面說明

使用說明

本文將提供一個樣本,查詢杭州地區模板{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { "ZoneInfo": { "Type": "String" }, "InstanceType": { "Type": "String" } }, "Resources": { "ECS": { "Type": "ALIYUN::ECS::Instance", "Properties": { "ZoneId": { "Ref": "ZoneInfo" }, "InstanceType": { "Ref": "InstanceType" } } } } }中參數ZoneInfo的取值。

關於本介面支援查詢的參數和模板內容,請參見參數約束查詢

調試

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

調試

授權資訊

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

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

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

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

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

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

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

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

操作

存取層級

資源類型

條件關鍵字

關聯操作

ros:GetTemplateParameterConstraints

get

*全部資源

*

請求參數

名稱

類型

必填

描述

樣本值

TemplateBody

string

模板主體的結構。長度為 1~524,288 個位元組。如果長度較長,則建議通過 HTTP POST+Body Param 的方式,將參數放在請求體中進行傳遞,避免因 URL 過長而導致請求失敗。

說明

您必須且僅能指定 TemplateBody、TemplateURL、TemplateId 和 TemplateScratchId 其中一個參數。

{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { "ZoneInfo": { "Type": "String" }, "InstanceType": { "Type": "String" } }, "Resources": { "ECS": { "Type": "ALIYUN::ECS::Instance", "Properties": { "ZoneId": { "Ref": "ZoneInfo" }, "InstanceType": { "Ref": "InstanceType" } } } } }

RegionId

string

地區 ID。
您可以調用 DescribeRegions 介面查看最新的阿里雲地區列表。

cn-hangzhou

TemplateURL

string

包含模板主體的檔案的位置。URL 必須指向位於 Web 服務器(HTTP 或 HTTPS)或阿里雲 OSS 儲存空間(例如:oss://ros/template/demo 或 oss://ros/template/demo?RegionId=cn-hangzhou)中的模板,模板的最大長度為 524,288 個位元組。如未指定 OSS 地區,預設與介面參數 RegionId 相同。

說明

您必須且僅能指定 TemplateBody、TemplateURL 和 TemplateId 其中一個參數。

oss://ros-template/demo

TemplateId

string

模板 ID。支援共用模板和私人模板。

說明

您必須且僅能指定 TemplateBody、TemplateURL 和 TemplateId 其中一個參數。

5ecd1e10-b0e9-4389-a565-e4c15efc****

TemplateVersion

string

模板版本。如果不指定,預設取最新版本。

說明

TemplateVersion 僅在指定 TemplateId 時生效。

v1

Parameters

array<object>

模板中已定義的參數。

object

ParameterKey

string

模板中已定義的參數的名稱。

說明

Parameters 為選擇性參數。若指定了 Parameters,則 ParameterKey 為必選參數。

ZoneInfo

ParameterValue

string

模板中已定義的參數的取值。

說明

Parameters 為選擇性參數。若指定了 Parameters,則 ParameterValue 為必選參數。

cn-hangzhou-h

ParametersKeyFilter

array

需要查詢的參數列表。

string

需要查詢的參數。

ZoneInfo

ClientToken

string

保證請求的等冪性。 該值由用戶端產生,並且必須是全域唯一的。長度不超過 64 個字元,可包含英文字母、數字、短劃線(-)和底線(_)。 更多資訊,請參見如何保證等冪性

123e4567-e89b-12d3-a456-42665544****

ParametersOrder

array

參數依賴關係。

string

參數依賴關係的順序。

說明

預設按照模板中Metadata參數的依賴關係。

["ZoneId", "InstanceType"]

StackId

string

資源棧 ID。

當填寫此參數時,表示查詢變更配置情境的參數約束。

c754d2a4-28f1-46df-b557-9586173a****

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

9816785B-BCF8-514D-8B76-C1EC2BC954FC

ParameterConstraints

array<object>

參數約束資訊。

object

ParameterKey

string

參數的名稱。

ZoneInfo

Type

string

參數的類型。

String

AllowedValues

array

參數的取值列表。

string

參數的取值。

cn-hangzhou-h

Behavior

string

參數的行為。取值:

  • NoLimit:無限制,此參數沒有取值限制。

  • NotSupport:不支援,此參數不支援查詢取值。

  • QueryError:查詢失敗。

說明

當查詢結果沒有返回 AllowedValues 時,會額外返回 Behavior 和 BehaviorReason,說明參數的行為和原因。

NoLimit

BehaviorReason

string

參數行為出現的原因。

No resource property refer to the parameter

AssociationParameterNames

array

關聯參數列表。

string

關聯參數名稱的列表。

InstanceType

IllegalValueByParameterConstraints

array

不符合參數約束的值列表。

說明

當查詢結果有返回 AllowedValues 時,會額外返回 IllegalValueByParameterConstraints 和 IllegalValueByRules,說明被參數約束和模板規則過濾掉的不合法的值。

any

不符合參數約束的值。

說明

當查詢結果返回AllowedValues時,會同時返回被參數約束和模板規則過濾掉的不合法的值IllegalValueByParameterConstraintsIllegalValueByRules

cn-hangzhou-h

IllegalValueByRules

array

不符合模板規則的值列表。

說明

當查詢結果有返回 AllowedValues 時,會額外返回 IllegalValueByParameterConstraints 和 IllegalValueByRules,說明被參數約束和模板規則過濾掉的不合法的值。

any

不符合模板規則的值。

說明

當查詢結果返回AllowedValues時,會同時返回被參數約束和模板規則過濾掉的不合法的值IllegalValueByParameterConstraintsIllegalValueByRules

cn-hangzhou-h

NotSupportResources

array<object>

不支援的資源詳情。

object

不支援的資源詳情。

Behavior取值為NotSupport時,返回該資訊。

ResourceType

string

資源類型。

ALIYUN::ECS::InstanceGroup

PropertyName

string

資源屬性名稱。

InstanceName

QueryErrors

array<object>

查詢失敗的詳情。

object

查詢失敗的詳情。

Behavior取值為QueryError時,返回該資訊。

ErrorMessage

string

錯誤詳情。

ALIYUN::ECS::InstanceGroup

ResourceName

string

資源名稱。

MyECS

ResourceType

string

資源類型。

InstanceType is needed while query DataDisk

OriginalConstraints

array<object>

原始約束資訊。

object

原始約束資訊。

ResourceName

string

模板中定義的資源名稱。

MyECS

AllowedValues

array

參數的取值列表。

any

參數的取值。

cn-hangzhou-a

ResourceType

string

資源類型。

ALIYUN::ECS::InstanceGroup

PropertyName

string

屬性名稱。

ZoneId

Behavior

string

參數的行為。

QueryError

BehaviorReason

string

參數行為出現的原因。

No resource property refer to the parameter

PropertiesData

string

參數約束查詢過程中使用的查詢參數。

{ "ZoneId":"cn-hangzhou-h", "SystemDiskCategory":"cloud_essd" }

RequestInfo

string

參數約束查詢過程中,調用雲產品查詢介面的請求資訊。

ecs:2014-05-26:DescribeAvailableResource:4C5B6929-EB64-5086-A821-9CCB553A5AE9

QueryTimeoutDetails

array<object>

查詢逾時的詳情。

object

查詢逾時的詳情。

ResourceType

string

資源類型。

ALIYUN::RDS::DBInstance

ResourceName

string

資源名稱。

rds

ErrorMessage

string

錯誤資訊。

query property SlaveZoneIds.* in resource rds error, error message: query 8 seconds timeout

樣本

正常返回樣本

JSON格式

{
  "RequestId": "9816785B-BCF8-514D-8B76-C1EC2BC954FC",
  "ParameterConstraints": [
    {
      "ParameterKey": "ZoneInfo",
      "Type": "String",
      "AllowedValues": [
        "cn-hangzhou-h"
      ],
      "Behavior": "NoLimit",
      "BehaviorReason": "No resource property refer to the parameter",
      "AssociationParameterNames": [
        "InstanceType"
      ],
      "IllegalValueByParameterConstraints": [
        "cn-hangzhou-h"
      ],
      "IllegalValueByRules": [
        "cn-hangzhou-h"
      ],
      "NotSupportResources": [
        {
          "ResourceType": "ALIYUN::ECS::InstanceGroup",
          "PropertyName": "InstanceName"
        }
      ],
      "QueryErrors": [
        {
          "ErrorMessage": "ALIYUN::ECS::InstanceGroup",
          "ResourceName": "MyECS",
          "ResourceType": "InstanceType is needed while query DataDisk"
        }
      ],
      "OriginalConstraints": [
        {
          "ResourceName": "MyECS",
          "AllowedValues": [
            "cn-hangzhou-a"
          ],
          "ResourceType": "ALIYUN::ECS::InstanceGroup\n",
          "PropertyName": "ZoneId",
          "Behavior": "QueryError",
          "BehaviorReason": "No resource property refer to the parameter",
          "PropertiesData": "{\n    \"ZoneId\":\"cn-hangzhou-h\",\n    \"SystemDiskCategory\":\"cloud_essd\"\n}",
          "RequestInfo": "ecs:2014-05-26:DescribeAvailableResource:4C5B6929-EB64-5086-A821-9CCB553A5AE9"
        }
      ],
      "QueryTimeoutDetails": [
        {
          "ResourceType": "ALIYUN::RDS::DBInstance",
          "ResourceName": "rds",
          "ErrorMessage": "query property SlaveZoneIds.* in resource rds error, error message: query 8 seconds timeout"
        }
      ]
    }
  ]
}

錯誤碼

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

變更歷史

更多資訊,參考變更詳情