All Products
Search
Document Center

Resource Orchestration Service:GetTemplateEstimateCost

Last Updated:Sep 12, 2024

Queries the estimated prices of the resources in a template.

Operation description

  • For more information about the resources that support price inquiry in Resource Orchestration Service (ROS) templates, see the "Resource types that support price inquiry" section of the Estimate resource prices topic.
  • For more information about the resources that support price inquiry in Terraform templates, see the "ROS resources supported by Terraform" section of the ROS features and resources supported by Terraform topic.

The following sample code provides an example on how to query the estimated price of an elastic IP address (EIP) that you want to create based on a template. In this example, the following template is used:

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "Isp": {
      "Type": "String",
      "Default": "BGP"
    },
    "Name": {
      "Type": "String",
      "Default": "test"
    },
    "Netmode": {
      "Type": "String",
      "Default": "public"
    },
    "Bandwidth": {
      "Type": "Number",
      "Default": 5
    }
  },
  "Resources": {
    "NewEip": {
      "Type": "ALIYUN::VPC::EIP",
      "Properties": {
        "InstanceChargeType": "Prepaid",
        "PricingCycle": "Month",
        "Isp": {
          "Ref": "Isp"
        },
        "Period": 1,
        "DeletionProtection": false,
        "AutoPay": false,
        "Name": {
          "Ref": "Name"
        },
        "InternetChargeType": "PayByTraffic",
        "Netmode": {
          "Ref": "Netmode"
        },
        "Bandwidth": {
          "Ref": "Bandwidth"
        }
      }
    }
  }
}

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:GetTemplateEstimateCostget
  • Template
    acs:ros:{#regionId}:{#accountId}:template/{#TemplateId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TemplateURLstringNo

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 the value is unique among different requests.

The token can be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_).

For more information, see Ensure idempotence.

oss://ros-template/demo
RegionIdstringYes

The ID of the template. This parameter applies to shared and private templates.

Note You must specify only one of the following parameters: TemplateBody, TemplateURL, TemplateId, and TemplateScratchId.
cn-hangzhou
TemplateBodystringNo

The structure that contains the template body. The template body must be 1 to 524,288 bytes in length. If the length of the template body exceeds the upper limit, we recommend that you add parameters to the HTTP POST request body to prevent request failures caused by excessively long URLs.

Note You must and can specify only one of the following parameters: TemplateBody, TemplateURL, TemplateId, and TemplateScratchId.
The parameters.
ClientTokenstringNo

The name of parameter N. If you do not specify the name and value of a parameter, ROS uses the default name and value that are specified in the template.

Maximum value of N: 200.

Examples:

  • Parameters.1.ParameterKey: Name
  • Parameters.2.ParameterKey: Netmode
Note The Parameters parameter is optional. If you want to specify Parameters, you must specify both Parameters.N.ParameterKey and Parameters.N.ParameterValue.
123e4567-e89b-12d3-a456-42665544****
TemplateIdstringNo

The value of parameter N.

Maximum value of N: 200.

Examples:

  • Parameters.1.ParameterValue: DemoEip
  • Parameters.2.ParameterValue: public
Note The Parameters parameter is optional. If you want to specify Parameters, you must specify both Parameters.N.ParameterKey and Parameters.N.ParameterValue.
5ecd1e10-b0e9-4389-a565-e4c15efc****
TemplateVersionstringNo

The ID of the scenario.

For more information about how to query the IDs of scenarios, see ListTemplateScratches .

Note You must specify only one of the following parameters: TemplateBody, TemplateURL, TemplateId, and TemplateScratchId.
v1
Parametersarray<object>No

The region ID of the scenario. The default value is the same as the value of the RegionId parameter.

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

objectNo

The list of parameters.

ParameterKeystringYes

The ID of the request.

Name
ParameterValuestringYes

Details of the resource.

DemoEip
TemplateScratchIdstringNo

The ID of the scenario.

ts-aa9c62feab844a6b****
TemplateScratchRegionIdstringNo

The region ID of the scenario. The default value is the same as the value of the RegionId parameter.

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

cn-hangzhou
StackIdstringNo

The stack ID.

This parameter is used to query the estimated price in a configuration change scenario.

Assume that the specified stack contains only one Elastic Compute Service (ECS) instance and the instance type is ecs.s6-c1m2.large. You downgrade the instance type to ecs.s6-c1m1.small and specify a new ApsaraDB RDS instance in the template that is used for the price inquiry. The queried result is the sum of the downgrade refund of the ECS instance and the price of the new ApsaraDB RDS instance.

c754d2a4-28f1-46df-b557-9586173a****

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

6DEA36EF-C97D-5658-A4AC-4F5DB08D1A89
Resourcesobject

The resource details.

[{'LogicalResourceIdPattern': 'wait1', 'ResourceType': 'time_sleep', 'ResourcePath': 'wait1'}, {'LogicalResourceIdPattern': 'wait2', 'ResourceType': 'time_sleep', 'ResourcePath': 'wait2'}]

The following table describes the parameters that are contained in Resources.

ParameterTypeExampleDescription
OrderThe information about the order.
- CurrencyStringCNYThe currency unit. Valid values:CNY: This value is available only on the China site (aliyun.com).USD: This value is available only on the international site (alibabacloud.com)
- OriginalAmountLong125The original price.
- DiscountAmountLong15.63The discount amount.
- TradeAmountLong109.37The transaction price, which is equal to the original price minus the discount.
- TaxAmountLong0The available tax amount.
- CouponsArray{"Coupon": []}The available promotions.
- RuleIdsArray[102204102264****]The IDs of the promotion rules.
InquiryTypeStringBuyThe price inquiry type. Valid values:Buy: price inquiry for new resourcesModificationBuy: price inquiry for resource configuration changes
RulesThe promotion rules.
- RuleThe promotion rule.
- - NameStringContract discount_order discount_8.750 discountThe name of the promotion rule.
- - RuleDescIdLong102204102264****The ID of the promotion rule.
OrderSupplementThe supplementary information about the order.
- AutoRenewBooleanfalseSpecifies whether to enable auto-renewal. Valid values:truefalse
- ChargeTypeStringPrePaidThe billing method.
- PeriodLong1The subscription duration.
- PeriodUnitStringMonthThe unit of the subscription duration. Valid values:YearMonth
- PriceTypeStringTotalThe price type.
- QuantityLong1The quantity.

Examples

Sample success responses

JSONformat

{
  "RequestId": "6DEA36EF-C97D-5658-A4AC-4F5DB08D1A89",
  "Resources": {
    "test": "test",
    "test2": 1
  }
}

Error codes

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

Change history

Change timeSummary of changesOperation
2023-06-21The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-05-18The request parameters of the API has changedView Change Details