All Products
Search
Document Center

Resource Orchestration Service:UpdateTemplateScratch

Last Updated:Sep 12, 2024

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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.
OperationAccess levelResource typeCondition keyAssociated operation
ros:UpdateTemplateScratchupdate
  • TemplateScratch
    acs:ros:{#regionId}:{#accountId}:templatescratch/{#templatescratchId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the scenario.

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

cn-hangzhou
TemplateScratchIdstringYes

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****
DescriptionstringNo

The description of the scenario.

The description of the scenario.
SourceResourcesarray<object>No

The source resources.

Note You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.
objectNo

The source resource.

ResourceIdstringYes

The resource ID.

vpc-bp1m6fww66xbntjyc****
ResourceTypestringYes

The resource type.

ALIYUN::ECS::VPC
SourceTagobjectNo

The source tag.

Note You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.
ResourceTagsobjectYes

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"}
ResourceTypeFilterarrayNo

The resource types for filtering resources.

stringNo

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
SourceResourceGroupobjectNo

The source resource group.

Note You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.
ResourceGroupIdstringYes

The ID of the source resource group.

rg-acfmzawhxxc****
ResourceTypeFilterarrayNo

The resource types for filtering resources.

stringNo

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
PreferenceParametersarray<object>No

The preference parameters of the resource scenario.

objectNo

The preference parameter of the scenario.

ParameterKeystringYes

The parameter name.

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.
  • If you set TemplateScratchType to ResourceImport, you must set ParameterKey to DeletionPolicy.
  • DeletionPolicy
    ParameterValuestringYes

    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
    LogicalIdStrategystringNo

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

    • LongTypePrefixAndIndexSuffix: long-type prefix + index-type suffix
    • LongTypePrefixAndHashSuffix: long-type prefix + hash-type suffix
    • ShortTypePrefixAndHashSuffix: short-type prefix + hash-type suffix
    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
    ClientTokenstringNo

    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****
    ExecutionModestringNo

    The execution mode. Valid values:

    • Async (default)
    • Sync
    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
    ResourceGroupIdstringNo

    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.

    ParameterKeyParameterValue
    DeletionPolicyThe 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.
    RegionIdThe 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.
    ZoneIdThe 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.
    VpcIdThe 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****.
    VSwitchIdThe 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****.
    InstanceDataReplicationSpecifies 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.

    ParameterKeyParameterValue
    DeletionPolicyThe 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.

    ParameterKeyParameterValue
    RegionIdsOne 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

    ParameterTypeDescriptionExample
    object
    RequestIdstring

    The ID of the request.

    221DA822-B8CF-50DF-A9D2-BA197BF97BD5
    TemplateScratchIdstring

    The ID of the scenario.

    ts-7f7a704cf71c49a6****

    Examples

    Sample success responses

    JSONformat

    {
      "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 timeSummary of changesOperation
    2023-10-10The request parameters of the API has changedView Change Details