Queries the list of scenarios.

This topic provides an example on how to query the list of scenarios. In this example, the scenarios that are created in the China (Hangzhou) region are queried. The following scenarios are returned: resource management and resource replication scenarios.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesListTemplateScratches

The operation that you want to perform. Set the value to ListTemplateScratches.

RegionIdStringYescn-hangzhou

The ID of the region in which the scenario is created.

You can call the DescribeRegions operation to query the most recent region list.

TemplateScratchIdStringNots-7f7a704cf71c49a6****

The ID of the scenario.

TemplateScratchTypeStringNoArchitectureReplication

The type of the scenario. Valid values:

  • ResourceImport: resource management
  • ArchitectureReplication: resource replication
StatusStringNo["GENERATE_COMPLETE"]

The state of the scenario. Valid values:

  • GENERATE_IN_PROGRESS: The scenario is being created.
  • GENERATE_COMPLETE: The scenario is created.
  • GENERATE_FAILED: The scenario fails to be created.
Tags.N.KeyStringYesusage

The key of tag N that is added to the scenario.

Note The Tags parameter is optional. If you specify the Tags parameter, you must specify the Tags.N.Key parameter.
Tags.N.ValueStringNotest

The value of tag N that is added to the scenario.

PageSizeIntegerNo10

The number of entries to return on each page.

Maximum value: 50.

Default value: 10.

PageNumberIntegerNo1

The number of the page to return.

Pages start from page 1.

Default value: 1.

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeExampleDescription
RequestIdStringD1C09606-C58B-558F-9B4E-5BF263D17D09

The ID of the request.

TotalCountInteger2

The total number of scenarios.

PageNumberInteger1

The page number of the returned page.

PageSizeInteger10

The number of entries returned per page.

TemplateScratchesArray of TemplateScratch

The list of scenarios.

TemplateScratchIdStringts-48ad85d66cca4620****

The ID of the scenario.

TemplateScratchTypeStringResourceImport

The type of the scenario. Valid values:

  • ResourceImport: resource management
  • ArchitectureReplication: resource replication
StatusStringGENERATE_COMPLETE

The state of the scenario.

StatusReasonStringResource ALIYUN::ECS::VPC vpc-m5eauuq80anx59v28**** could not be found for template scratch.

The reason why the scenario fails to be created.

Note This parameter is returned only if the Status parameter is set to GENERATE_FAILED.
FailedCodeStringInvalidZoneId

The status code of the scenario that fails to be created.

Note This parameter is returned only if the Status parameter is set to GENERATE_FAILED.
PreferenceParametersArray of PreferenceParameter

The parameters that are configured for the scenario.

ParameterKeyStringDeletionPolicy

The name of the parameter.

ParameterValueStringRetain

The value of the parameter.

DescriptionStringManages the virtual private cloud (VPC) resource.

The description of the scenario.

SourceResourcesArray of SourceResource

The source resources.

ResourceIdStringvpc-m5eauuq80anx59v28****

The ID of the resource.

ResourceTypeStringALIYUN::ECS::VPC

The resource type.

SourceTagObject

The source tag.

ResourceTagsMap

The source tags.

ResourceTypeFilterArray of StringALIYUN::ECS::VPC

The filter for resource types.

SourceResourceGroupObject

The source resource group.

ResourceGroupIdStringrg-acfmzawhxxc****

The ID of the source resource group.

ResourceTypeFilterArray of StringALIYUN::ECS::VPC

The filter for resource types.

LogicalIdStrategyStringLongTypePrefixAndIndexSuffix

The policy based on which the logical ID is generated. Default value: LongTypePrefixAndIndexSuffix. Valid values:

  • LongTypePrefixAndIndexSuffix: long-type prefix + index-type suffix
  • LongTypePrefixAndHashSuffix: long-type prefix + hash-type suffix
  • ShortTypePrefixAndHashSuffix: short-type prefix + hash-type suffix
TagsArray of Tags

The tags of the scenario.

KeyStringusage1

The tag key of the scenario.

ValueStringtest1

The tag value of the scenario.

CreateTimeString2021-12-07T08:06:44

The time at which the scenario was created.

The time follows the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss format. The time is displayed in UTC.

UpdateTimeString2021-12-07T08:06:44

The time at which the scenario was updated.

The time follows the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss format. The time is displayed in UTC.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListTemplateScratches
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListTemplateScratchesResponse>
    <RequestId>D1C09606-C58B-558F-9B4E-5BF263D17D09</RequestId>
    <TotalCount>2</TotalCount>
    <PageNumber>1</PageNumber>
    <PageSize>10</PageSize>
    <TemplateScratches>
        <TemplateScratchId>ts-48ad85d66cca4620****</TemplateScratchId>
        <TemplateScratchType>ResourceImport</TemplateScratchType>
        <Status>GENERATE_COMPLETE</Status>
        <StatusReason>Resource ALIYUN::ECS::VPC vpc-m5eauuq80anx59v28**** could not be found for template scratch.</StatusReason>
        <FailedCode>InvalidZoneId</FailedCode>
        <PreferenceParameters>
            <ParameterKey>DeletionPolicy</ParameterKey>
            <ParameterValue>Retain</ParameterValue>
        </PreferenceParameters>
        <Description> Manages the VPC resource. </Description>
        <SourceResources>
            <ResourceId>vpc-m5eauuq80anx59v28****</ResourceId>
            <ResourceType>ALIYUN::ECS::VPC</ResourceType>
        </SourceResources>
        <SourceTag>
            <ResourceTypeFilter>ALIYUN::ECS::VPC</ResourceTypeFilter>
        </SourceTag>
        <SourceResourceGroup>
            <ResourceGroupId>rg-acfmzawhxxc****</ResourceGroupId>
            <ResourceTypeFilter>ALIYUN::ECS::VPC</ResourceTypeFilter>
        </SourceResourceGroup>
        <LogicalIdStrategy>LongTypePrefixAndIndexSuffix</LogicalIdStrategy>
        <Tags>
            <Key>usage1</Key>
            <Value>test1</Value>
        </Tags>
        <CreateTime>2021-12-07T08:06:44</CreateTime>
        <UpdateTime>2021-12-07T08:06:44</UpdateTime>
    </TemplateScratches>
</ListTemplateScratchesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "D1C09606-C58B-558F-9B4E-5BF263D17D09",
  "TotalCount" : 2,
  "PageNumber" : 1,
  "PageSize" : 10,
  "TemplateScratches" : {
    "TemplateScratchId" : "ts-48ad85d66cca4620****",
    "TemplateScratchType" : "ResourceImport",
    "Status" : "GENERATE_COMPLETE",
    "StatusReason" : "Resource ALIYUN::ECS::VPC vpc-m5eauuq80anx59v28**** could not be found for template scratch.",
    "FailedCode" : "InvalidZoneId",
    "PreferenceParameters" : {
      "ParameterKey" : "DeletionPolicy",
      "ParameterValue" : "Retain"
    },
    "Description" : "Manages the VPC resource",
    "SourceResources" : {
      "ResourceId" : "vpc-m5eauuq80anx59v28****",
      "ResourceType" : "ALIYUN::ECS::VPC"
    },
    "SourceTag" : {
      "ResourceTypeFilter" : "ALIYUN::ECS::VPC"
    },
    "SourceResourceGroup" : {
      "ResourceGroupId" : "rg-acfmzawhxxc****",
      "ResourceTypeFilter" : "ALIYUN::ECS::VPC"
    },
    "LogicalIdStrategy" : "LongTypePrefixAndIndexSuffix",
    "Tags" : {
      "Key" : "usage1",
      "Value" : "test1"
    },
    "CreateTime" : "2021-12-07T08:06:44",
    "UpdateTime" : "2021-12-07T08:06:44"
  }
}

Error codes

For a list of error codes, see Service error codes.