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

Parameter Type Required Example Description
Action String Yes ListTemplateScratches

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

RegionId String Yes cn-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.

TemplateScratchId String No ts-7f7a704cf71c49a6****

The ID of the scenario.

TemplateScratchType String No ArchitectureReplication

The type of the scenario. Valid values:

  • ResourceImport: resource management
  • ArchitectureReplication: resource replication
Status String No 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.Key String Yes usage

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.Value String No test

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

PageSize Integer No 10

The number of entries to return on each page.

Maximum value: 50.

Default value: 10.

PageNumber Integer No 1

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

Parameter Type Example Description
RequestId String D1C09606-C58B-558F-9B4E-5BF263D17D09

The ID of the request.

TotalCount Integer 2

The total number of scenarios.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 10

The number of entries returned per page.

TemplateScratches Array of TemplateScratch

The list of scenarios.

TemplateScratchId String ts-48ad85d66cca4620****

The ID of the scenario.

TemplateScratchType String ResourceImport

The type of the scenario. Valid values:

  • ResourceImport: resource management
  • ArchitectureReplication: resource replication
Status String GENERATE_COMPLETE

The state of the scenario.

StatusReason String Resource 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.
FailedCode String InvalidZoneId

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.
PreferenceParameters Array of PreferenceParameter

The parameters that are configured for the scenario.

ParameterKey String DeletionPolicy

The name of the parameter.

ParameterValue String Retain

The value of the parameter.

Description String Manages the virtual private cloud (VPC) resource.

The description of the scenario.

SourceResources Array of SourceResource

The source resources.

ResourceId String vpc-m5eauuq80anx59v28****

The ID of the resource.

ResourceType String ALIYUN::ECS::VPC

The resource type.

SourceTag Object

The source tag.

ResourceTags Map

The source tags.

ResourceTypeFilter Array of String ALIYUN::ECS::VPC

The filter for resource types.

SourceResourceGroup Object

The source resource group.

ResourceGroupId String rg-acfmzawhxxc****

The ID of the source resource group.

ResourceTypeFilter Array of String ALIYUN::ECS::VPC

The filter for resource types.

LogicalIdStrategy String LongTypePrefixAndIndexSuffix

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
Tags Array of Tags

The tags of the scenario.

Key String usage1

The tag key of the scenario.

Value String test1

The tag value of the scenario.

CreateTime String 2021-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.

UpdateTime String 2021-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.