Updates a scenario.
Operation description
Resource replication scenario
Resource Orchestration Service (ROS) allows you to update a resource replication scenario. The updates that you make to a resource replication scenario do not affect the stack that is generated by using the resource scenario. You can call the GenerateTemplateByScratch operation to generate a template for the resource scenario.
Resource migration scenario
-
If you want to update a resource migration scenario in which the migrated source resources are retained, you can delete the source resources to manage the updated resource migration scenario. You can also call the GenerateTemplateByScratch operation to generate a template for the resource scenario.
**
Note Make sure that the source resources that you want to delete from a resource migration scenario are associated only with the resource scenario. Otherwise, the source resources fail to be deleted.
-
If you want to update a resource migration scenario in which the migrated source resources are deleted, you can only call the GenerateTemplateByScratch operation to generate a template for the resource scenario.
Resource management scenario
If you want to update a resource management scenario after you use the resource scenario to manage resources, you can only call the GenerateTemplateByScratch operation to generate a template for the resource scenario.
Resource detection scenario
After you update a resource detection scenario, ROS obtains the most recent data from Resource Center and renders the architecture diagram.
This topic provides an example on how to update a resource scenario. In this example, the ID of a virtual private cloud (VPC) in a resource scenario whose ID is ts-7f7a704cf71c49a6****
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 | update |
|
| 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 resource scenario. The valid values of the ParameterKey and ParameterValue request parameters vary based on the IDs of different types of resource scenarios. For more information, see the "Additional information about request parameters" section of this topic. Note
You can call the ListTemplateScratches operation to query the ID of a resource scenario.
| ts-7f7a704cf71c49a6**** |
Description | string | No | The description of the scenario. | The description of the scenario. |
SourceResources | array<object> | No | The source resources. Note
You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.
| |
object | No | The source resource. | ||
ResourceId | string | Yes | The resource ID. | vpc-bp1m6fww66xbntjyc**** |
ResourceType | string | Yes | The resource type. | ALIYUN::ECS::VPC |
SourceTag | object | No | The source tag. Note
You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.
| |
ResourceTags | object | Yes | The source tags. A tag contains a tag key and a tag value. If you want to specify only the tag key, you must leave the tag value empty. Example: {"TagKey": ""}. If you set TemplateScratchType to ArchitectureDetection, you can add up to 5 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 the resource types, ROS scans only the resources that are of the specified types and have the specified tags. If you do not specify the resource types, ROS scans all resources that have the specified tags. You can specify up to 20 resource types. | ALIYUN::ECS::VPC | |
SourceResourceGroup | object | No | The source resource group. Note
You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.
| |
ResourceGroupId | string | Yes | The ID of the source resource group. | rg-acfmzawhxxc**** |
ResourceTypeFilter | array | No | The resource types for filtering resources. | |
string | No | The resource type for filtering resources. If you specify the resource types, ROS scans only the resources that are of the specified types and belong to the specified resource group. If you do not specify the resource types, ROS scans all resources that belong to the specified resource group. You can specify up to 20 resource types. | ALIYUN::ECS::VPC | |
PreferenceParameters | array<object> | No | The preference parameters of the resource scenario. | |
object | No | The preference parameter of the 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.
The valid values of the ParameterKey and ParameterValue request parameters vary based on resource scenario types.
Resource replication scenario
The following table describes the valid values of the ParameterKey and ParameterValue request parameters when you set TemplateScratchId to the ID of 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 ID of the destination region to which you want to replicate resources. If you leave this parameter empty, the region of the source resources is used for the replicated resources.Example: cn-shanghai. |
ZoneId | The ID of the destination zone to which you want to replicate resources. If you replicate resources in the same region and you leave this parameter empty, the zone of the source resources is used for the replicated resources. If you replicate resources across regions and you leave this parameter empty, the system filters the zones that are supported by all resources.Example: cn-shanghai-b. |
VpcId | The ID of the destination VPC to which you want to replicate resources. If you replicate resources in the same region and you leave this parameter empty, the VPC of the source resources is used for the replicated resources. If you replicate resources across regions and you leave this parameter empty, the system automatically creates a VPC in the destination region.Example: vpc-bp1hye0s8b69xokfu****. |
VSwitchId | The ID of the destination vSwitch to which you want to replicate resources. If you replicate resources in the same region and you leave this parameter empty, the vSwitch of the source resources is used for the replicated resources. If you replicate resources across regions and you leave this parameter empty, the system automatically creates a vSwitch in the destination region.Example: vsw-bp11ufkwqwggtm1cj****. |
InstanceDataReplication | Specifies whether to replicate Elastic Compute Service (ECS) instance data. Valid values: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.
Resource management scenario
The following table describes the valid values of the ParameterKey and ParameterValue request parameters when you set TemplateScratchId to the ID of 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. |
Resource detection scenario
The following table describes the valid values of the ParameterKey and ParameterValue request parameters when you set TemplateScratchId to the ID of a resource detection scenario.
ParameterKey | ParameterValue |
---|---|
RegionIds | One or more region IDs. Separate multiple region IDs with commas (,). If you leave this parameter empty, 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 | View Change Details |