Updates a scenario.
Operation description
In this example, a scenario whose ID is ts-7f7a704cf71c49a6****
is used. The scenario is created in the China (Hangzhou) region. In the scenario, the ID of a virtual private cloud (VPC) is updated to vpc-bp1m6fww66xbntjyc****
.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ros:UpdateTemplateScratch | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the scenario. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
TemplateScratchId | string | Yes | The ID of the scenario. | ts-7f7a704cf71c49a6**** |
Description | string | No | The description of the scenario. | The description of the scenario. |
SourceResources | object [] | No | The source resources. If you specify SourceResources when TemplateScratchType is set to ArchitectureDetection, the system detects the architecture of all resources that are associated with the specified source resources. For example, if you set the value of SourceResources to an ID of a Classic Load Balancer (CLB) instance, the system detects the architecture of resources, such as Elastic Compute Service (ECS) instances, vSwitches, and virtual private clouds (VPCs), that are associated with the CLB instance. If you set TemplateScratchType to ArchitectureDetection, you can specify up to 20 source resources for SourceResources. In other cases, you can specify up to 200 source resources. | |
ResourceId | string | Yes | The resource ID. | vpc-bp1m6fww66xbntjyc**** |
ResourceType | string | Yes | The resource type. | ALIYUN::ECS::VPC |
SourceTag | object | No | The source tag. | |
ResourceTags | object | Yes | 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": ""}. If you set TemplateScratchType to ArchitectureDetection, you can add up to five source tags. In other cases, you can add up to 10 source tags. | {"a": "b"} |
ResourceTypeFilter | array | No | The resource types for filtering resources. | |
string | No | The resource type for filtering resources. If you specify this parameter, only the resources that are of the specified type 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. | ALIYUN::ECS::VPC | |
SourceResourceGroup | object | No | The source resource group. | |
ResourceGroupId | string | Yes | The ID of the source resource group. | rg-acfmzawhxxc**** |
ResourceTypeFilter | array | No | The resource types. | |
string | No | The resource type. If you specify this parameter, only the resources of the specified type and in the specified resource group are scanned. If you do not specify this parameter, all the resources in the specified resource group are scanned. You can specify up to 20 resource types. | ALIYUN::ECS::VPC | |
PreferenceParameters | object [] | No | The preference parameters of the resource scenario. | |
ParameterKey | string | Yes | The parameter name. For more information about the valid values of ParameterKey, see the "Additional information about request parameters" section of this topic. Note
| DeletionPolicy |
ParameterValue | string | Yes | The parameter value. The value of ParameterValue varies based on the value of ParameterKey. For more information about the valid values of ParameterKey, see the "Additional information about request parameters" section of this topic. Note
PreferenceParameters is optional. If you specify PreferenceParameters, you must specify both ParameterKey and ParameterValue.
| Retain |
LogicalIdStrategy | string | No | The policy based on which the logical ID is generated. Valid values:
Note
If you set TemplateScratchType to ArchitectureDetection, the default value of LogicalIdStrategy is LongTypePrefixAndHashSuffix. In other cases, the default value of LogicalIdStrategy is LongTypePrefixAndIndexSuffix.
| LongTypePrefixAndIndexSuffix |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. | 123e4567-e89b-12d3-a456-42665544**** |
ExecutionMode | string | No | The execution mode. Valid values:
Note
If you have a wide scope of resources, Sync takes longer. If you set ExecutionMode to Sync, we recommend that you specify ClientToken to prevent the execution timeout.
| Sync |
ResourceGroupId | string | No | The ID of the resource group. | rg-acfmxazb4ph6aiy**** |
Additional information about request parameters
For more information about common request parameters, see Common parameters.
In request parameters, the values of ParameterKey and ParameterValue vary based on scenario types.
- The following table describes the values of ParameterKey and ParameterValue that are supported by a resource replication scenario.
ParameterKey | ParameterValue |
---|---|
DeletionPolicy | The deletion policy for resources. Valid values:Retain: retains resources when you delete the stack to which the resources are replicated.Delete: deletes resources by default when you delete the stack to which the resources are replicated. If you retain specific resources when the Delete Stack dialog box appears, the resources are retained. |
RegionId | The destination region in which the resources you want to replicate reside. If you do not specify a destination region, the region of the source resources is used for the replicated resources.Example: cn-shanghai. |
ZoneId | The destination zone in which the resources you want to replicate reside. If you replicate resources in the same region and you do not specify a destination zone, the zone of the source resources is used for the replicated resources. If you replicate resources across regions and you do not specify a destination zone, the system filters zones that are supported by all resources.Example: cn-shanghai-b. |
VpcId | The destination VPC in which the resources you want to replicate reside. If you replicate resources in the same region and you do not specify a destination VPC, the VPC of the source resources is used for the replicated resources. If you replicate resources across regions and you do not specify a destination VPC, the system automatically creates a VPC in the destination region.Example: vpc-bp1hye0s8b69xokfu****. |
VSwitchId | The destination vSwitch to which the resources you want to replicate are connected. If you replicate resources in the same region and you do not specify a destination vSwitch, the vSwitch of the source resources is used for the replicated resources. If you replicate resources across regions and you do not specify a destination vSwitch, the system automatically creates a vSwitch in the destination region.Example: vsw-bp11ufkwqwggtm1cj****. |
InstanceDataReplication | Specifies whether to replicate ECS instance data. Valid value:true: replicates ECS instance data. If you replicate the data in the same region, the system creates a custom image for the source instance and creates an instance based on the image. If you replicate the data across regions, the system creates a custom image for the source instance, replicates the image to the destination region, and then creates an instance based on the image.false: does not replicate ECS instance data. |
Note If you set ParameterKey to InstanceDataReplication and ParameterValue to true, we recommend that you replicate resources after the source instance is stopped. This ensures data consistency.
- The following table describes the values of ParameterKey and ParameterValue that are supported by a resource management scenario.
Note For a resource management scenario, you must set ParameterKey to DeletionPolicy.
ParameterKey | ParameterValue |
---|---|
DeletionPolicy | The deletion policy for resources. Valid values:Retain: retains resources when you delete the stack that you use to manage the resources.Delete: deletes resources by default when you delete the stack that you use to manage the resources. If you retain specific resources when the Delete Stack dialog box appears, the resources are retained. |
- The following table describes the values of ParameterKey and ParameterValue that are supported by a resource detection scenario.
ParameterKey | ParameterValue |
---|---|
RegionIds | One or more regions. Separate multiple regions with commas (,). If you do not specify a region, the region of the resource scenario is used. You cannot specify both RegionIds and SourceResources. |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "221DA822-B8CF-50DF-A9D2-BA197BF97BD5",
"TemplateScratchId": "ts-7f7a704cf71c49a6****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||
---|---|---|---|---|---|---|
2023-10-10 | The request parameters of the API has changed | see changesets | ||||
|