All Products
Search
Document Center

Resource Orchestration Service:CreateTemplateScratch

Last Updated:Apr 10, 2024

Creates a scenario.

Operation description

You can call this operation to create a scenario that allows you to specify a resource scope on a visualized interface and easily replicate and manage the resources that you specify. For more information about scenarios, see Overview .

In this example, a scenario of the Resource Replication type is created in the China (Hangzhou) region. In the scenario, the virtual private cloud (VPC) whose ID is vpc-bp1m6fww66xbntjyc**** is replicated.

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:CreateTemplateScratchWrite
  • All Resources
    *
    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
TemplateScratchTypestringYes

The type of the scenario. Valid values:

  • ResourceImport: resource management
  • ArchitectureReplication: resource replication
  • ResourceMigration: resource migration
ArchitectureReplication
DescriptionstringNo

The description of the scenario.

Replicate a VPC.
SourceResourcesobject []No

The source resources.

ResourceIdstringYes

The ID of the resource.

vpc-bp1m6fww66xbntjyc****
ResourceTypestringYes

The type of the resource.

ALIYUN::ECS::VPC
RegionIdstringNo

The region ID.

cn-beijing
SourceTagobjectNo

The source tag.

ResourceTagsobjectYes

The source tags that consist of key-value pairs. If you want to specify only the tag key, you must leave the tag value empty. Example: {"TagKey": ""}.

You can add up to 10 source tags.

{"a": "b"}
ResourceTypeFilterarrayNo

The resource types.

stringNo

The resource type. If you specify this parameter, only the resources 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
SourceResourceGroupobjectNo

The source resource group.

ResourceGroupIdstringYes

The ID of the source resource group.

rg-acfmzawhxxc****
ResourceTypeFilterarrayNo

The resource types.

stringNo

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 resources in the specified resource group are scanned.

You can specify up to 20 resource types.

ALIYUN::ECS::VPC
PreferenceParametersobject []No

The preference parameters of the scenario.

ParameterKeystringYes

The key of the parameter.

For information about the valid values of ParameterKey, see the Additional information about request parameters section of this topic.

Note
  • PreferenceParameters is optional. If you want to specify PreferenceParameters, you must specify ParameterKey and ParameterValue.
  • If you set TemplateScratchType to ResourceImport, you must set ParameterKey to DeletionPolicy.
  • DeletionPolicy
    ParameterValuestringYes

    The value of the parameter. The value of ParameterValue varies based on the value of ParameterKey.

    For information about the valid values of ParameterValue, see the Additional information about request parameters section of this topic.

    Note PreferenceParameters is optional. If you want to specify PreferenceParameters, you must specify ParameterKey and ParameterValue.
    Retain
    LogicalIdStrategystringNo

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

    • LongTypePrefixAndIndexSuffix (default): long-type prefix + index-type suffix
    • LongTypePrefixAndHashSuffix: long-type prefix + hash-type suffix
    • ShortTypePrefixAndHashSuffix: short-type prefix + hash-type suffix
    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
    Tagsobject []No

    The tags of the scenario.

    KeystringYes

    The tag key of the scenario.

    Note Tags is optional. If you want to specify Tags, you must specify Key.
    usage
    ValuestringNo

    The tag value of the scenario.

    test
    ResourceGroupIdstringNo

    The ID of the resource group.

    rg-acfmxazb4ph6aiy****

    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 scenarios of the Resource Replication type.
    ParameterKeyParameterValue
    DeletionPolicyThe resource deletion policy. Valid values:- Retain: If you delete a stack after you replicate resources to the stack, the resources are retained.- Delete: If you delete a stack after you replicate resources to the stack, the resources are deleted by default. If you choose to 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 do not specify this parameter, the ID of the current region is used by default.Example: cn-shanghai.
    ZoneIdThe ID of the destination zone to which you want to replicate resources. If you do not specify this parameter, the following rules apply: If you replicate resources in the same region, the replicated resources are deployed in the zone where the source resources reside. If you replicate resources across regions, the replicated resources are deployed in the zone that is available for all the resources.Example: cn-shanghai.
    VpcIdThe ID of the destination VPC to which you want to replicate resources. If you do not specify this parameter, the following rules apply: If you replicate resources in the same region, the replicated resources are deployed in the VPC to which the source resources belong. If you replicate resources across regions, a new VPC is created in the destination region.Example: vpc-bp1hye0s8b69xokfu****.
    VSwitchIdThe ID of the destination vSwitch to which you want to replicate resources. If you do not specify this parameter, the following rules apply: If you replicate resources in the same region, the replicated resources are associated with the vSwitch that is used by the source resources. If you replicate resources across regions, a new vSwitch is created to associate the replicated resources in the destination region.Example: vsw-bp11ufkwqwggtm1cj****.
    InstanceDataReplicationSpecifies whether to replicate the data of Elastic Compute Service (ECS) instances. Valid values:- true: If you replicate the data in the same region, a custom image is created for the source instance and a new instance is created based on the custom image. If you replicate the data across regions, a custom image is created for the source instance and replicated to the destination region. A new instance is created based on the replica of the custom image.- false

    NoteIf you set ParameterKey to InstanceDataReplication and ParameterValue to true, you must stop the source instance before you replicate the instance data to ensure data consistency.

    • The following table describes the values of ParameterKey and ParameterValue in a scenario of the Resource Management type. NoteIn a scenario of the Resource Management type, you must set ParameterKey to DeletionPolicy.
    ParameterKeyParameterValue
    DeletionPolicyThe resource deletion policy. Valid values:- Retain: If you delete a stack after you use the stack to manage resources, the resources are retained.- Delete: If you delete a stack after you use the stack to manage resources, the resources are deleted by default. If you choose to retain specific resources when the Delete Stack dialog box appears, the resources are retained.

    Response parameters

    ParameterTypeDescriptionExample
    object
    RequestIdstring

    The ID of the request.

    84980977-22F0-5421-B30D-B201311D5DCF
    TemplateScratchIdstring

    The ID of the scenario.

    ts-7f7a704cf71c49a6****

    Examples

    Sample success responses

    JSONformat

    {
      "RequestId": "84980977-22F0-5421-B30D-B201311D5DCF",
      "TemplateScratchId": "ts-7f7a704cf71c49a6****"
    }

    Error codes

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2023-10-19The internal configuration of the API is changed, but the call is not affectedsee changesets
    Change itemChange content
    The internal configuration of the API is changed, but the call is not affected.
    2023-10-10The request parameters of the API has changedsee changesets
    Change itemChange content
    Input ParametersThe request parameters of the API has changed.
      Added Input Parameters: ResourceGroupId