Updates a scenario.
In this topic, the ts-7f7a704cf71c49a6****
scenario that is created in the China (Hangzhou) region is updated. In this scenario,
the ID of the virtual private cloud (VPC) is updated to ts-7f7a704cf71c49a6****
.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | UpdateTemplateScratch |
The operation that you want to perform. Set the value to UpdateTemplateScratch. |
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 | Yes | ts-7f7a704cf71c49a6**** |
The ID of the scenario. |
Description | String | No | Replicates a VPC. |
The description of the scenario. |
SourceResources | Array | No |
The source resource. |
|
ResourceId | String | Yes | vpc-bp1m6fww66xbntjyc**** |
The ID of the resource. |
ResourceType | String | Yes | ALIYUN::ECS::VPC |
The type of the resource. |
SourceTag | Object | No |
The source tag. |
|
ResourceTags | Map | Yes | {"a": "b"} |
The source tags that consist of key-value pairs. If you want to specify only the tag key, you must set the tag value to an empty string. Example: {"TagKey": ""}. You can configure up to 10 source tags. |
ResourceTypeFilter | Array of String | No | ALIYUN::ECS::VPC |
The filter for resource types. If you specify this parameter, only the resources of the specified types and have the specified tags are scanned. If you do not specify this parameter, all resources that have the specified tags are scanned. You can specify up to 20 resource types. |
SourceResourceGroup | Object | No |
The source resource group. |
|
ResourceGroupId | String | Yes | rg-acfmzawhxxc**** |
The ID of the source resource group. |
ResourceTypeFilter | Array of String | No | ALIYUN::ECS::VPC |
The filter for resource types. If you specify this parameter, only the resources of the specified types and in the specified resource groups are scanned. If you do not specify this parameter, all the resources in the specified resource groups are scanned. You can specify up to 20 resource types. |
PreferenceParameters | Array | No |
The parameters that are configured in the scenario. |
|
ParameterKey | String | Yes | DeletionPolicy |
The name of a request parameter. For more information about ParameterKey, see Additional description of request parameters. Note
|
ParameterValue | String | Yes | Retain |
The value of a request parameter. The value of ParameterValue varies based on the value of ParameterKey. For more information about ParameterValue, see Additional description of request parameters. Note PreferenceParameters is optional. If you set PreferenceParameters, you must specify
both ParameterKey and ParameterValue.
|
LogicalIdStrategy | String | No | LongTypePrefixAndIndexSuffix |
The generation policy of the logical ID. Default value: LongTypePrefixAndIndexSuffix. Valid values:
|
ClientToken | String | No | 123e4567-e89b-12d3-a456-42665544**** |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among the different requests. The token can be up to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_). For more information, see How to ensure idempotence. |
ExecutionMode | String | No | Sync |
The execution mode. Default value: Async. Valid values:
Note If you have a wide scope of resources, Sync takes longer. If you set ExecutionMode
to Sync, we recommend that you set ClientToken to prevent the execution from timing
out.
|
Additional description of request parameters
For more information about common request parameters, see Common parameters.
In request parameters, the values of ParameterKey and ParameterValue vary based on the scenario types.
- The following table describes the values of ParameterKey and ParameterValue in the
resource replication scenario.
ParameterKey
ParameterValue
DeletionPolicy
The resource deletion policy. Valid values:
- Retain: retains resources. If you delete a stack after you replicate resources to the stack, the resources are retained.
- Delete: deletes resources. If you delete a stack after you replicate resources to the stack, all the resources are deleted by default. If you retain some resources when you delete the stack, the resources that you no longer need are deleted.
RegionId
The destination region to which you want to replicate the resource. If you do not specify a destination region, the resource is replicated to the region where the source resource resides.
Example: cn-shanghai.
ZoneId
The destination zone to which you want to replicate the resource. If you replicate the resource in the same region but you do not specify the destination zone, the resource is replicated to the zone where the source resource resides. If you replicate the resource across zones, the resource is replicated to the zone that all resources support.
Example: cn-shanghai-b.
VpcId
The destination VPC to which you want to replicate the resource. If you replicate the resource in the same region but you do not specify the destination VPC, the resource is replicated to the VPC to which the source resource belongs. If you replicate the resource across regions, a new VPC is created in the destination region.
Example: vpc-bp1hye0s8b69xokfu****.
VSwitchId
The destination vSwitch. If you replicate the resource in the same region but you do not specify the destination vSwitch, the vSwitch that is associated with the source resource is used. If you replicate the resource across regions, a new vSwitch is created in the destination region.
Example: vsw-bp11ufkwqwggtm1cj****.
InstanceDataReplication
Specifies whether to replicate the Elastic Compute Service (ECS) instance data. Valid values:
- true: replicates ECS instance data. If you replicate the resource in the same region, a custom image is created for the source instance and new instances are created based on the custom image. If you replicate the resource across regions, a custom image is created for the source instance and replicated to the destination region. New instances are created based on the custom image.
- false: does not replicate ECS instance data.
Note If you set ParameterKey to InstanceDataReplication and ParameterValue to true, you must stop the source instance before you replicate the resource to ensure data consistency. -
The following table describes the values of ParameterKey and ParameterValue in the resource management scenario.Note In the resource management scenario, you must set ParameterKey to DeletionPolicy.
ParameterKey
ParameterValue
DeletionPolicy
The resource deletion policy. Valid values:
- Retain: retains resources. If you delete a stack that you use to manage resources, all the resources in the stack are automatically retained.
- Delete: deletes resources. If you delete a stack that you use to manage resources, all the resources in the stack are automatically deleted. If you want to retain some resources when you delete the stack, only the resources that you no longer need are deleted.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 221DA822-B8CF-50DF-A9D2-BA197BF97BD5 |
The ID of the request. |
TemplateScratchId | String | ts-7f7a704cf71c49a6**** |
The ID of the scenario. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=UpdateTemplateScratch
&RegionId=cn-hangzhou
&TemplateScratchId=ts-7f7a704cf71c49a6****
&SourceResources=[{"ResourceId":"vpc-bp1m6fww66xbntjyc****","ResourceType":"ALIYUN::ECS::VPC"}]
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<UpdateTemplateScratchResponse>
<RequestId>221DA822-B8CF-50DF-A9D2-BA197BF97BD5</RequestId>
<TemplateScratchId>ts-7f7a704cf71c49a6****</TemplateScratchId>
</UpdateTemplateScratchResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "221DA822-B8CF-50DF-A9D2-BA197BF97BD5",
"TemplateScratchId" : "ts-7f7a704cf71c49a6****"
}
Error codes
For a list of error codes, visit the API Error Center.