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
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:GetTemplateEstimateCost | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TemplateURL | string | No | 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 |
RegionId | string | Yes | 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 |
TemplateBody | string | No | 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. |
ClientToken | string | No | 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:
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**** |
TemplateId | string | No | The value of parameter N. Maximum value of N: 200. Examples:
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**** |
TemplateVersion | string | No | 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 |
Parameters | array<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. | |
object | No | The list of parameters. | ||
ParameterKey | string | Yes | The ID of the request. | Name |
ParameterValue | string | Yes | Details of the resource. | DemoEip |
TemplateScratchId | string | No | The ID of the scenario. | ts-aa9c62feab844a6b**** |
TemplateScratchRegionId | string | 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. | cn-hangzhou |
StackId | string | No | 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
The following table describes the parameters that are contained in Resources.
Parameter | Type | Example | Description |
---|---|---|---|
Order | The information about the order. | ||
- Currency | String | CNY | The 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) |
- OriginalAmount | Long | 125 | The original price. |
- DiscountAmount | Long | 15.63 | The discount amount. |
- TradeAmount | Long | 109.37 | The transaction price, which is equal to the original price minus the discount. |
- TaxAmount | Long | 0 | The available tax amount. |
- Coupons | Array | {"Coupon": []} | The available promotions. |
- RuleIds | Array | [102204102264****] | The IDs of the promotion rules. |
InquiryType | String | Buy | The price inquiry type. Valid values:Buy: price inquiry for new resourcesModificationBuy: price inquiry for resource configuration changes |
Rules | The promotion rules. | ||
- Rule | The promotion rule. | ||
- - Name | String | Contract discount_order discount_8.750 discount | The name of the promotion rule. |
- - RuleDescId | Long | 102204102264**** | The ID of the promotion rule. |
OrderSupplement | The supplementary information about the order. | ||
- AutoRenew | Boolean | false | Specifies whether to enable auto-renewal. Valid values:truefalse |
- ChargeType | String | PrePaid | The billing method. |
- Period | Long | 1 | The subscription duration. |
- PeriodUnit | String | Month | The unit of the subscription duration. Valid values:YearMonth |
- PriceType | String | Total | The price type. |
- Quantity | Long | 1 | The quantity. |
Examples
Sample success responses
JSON
format
{
"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 time | Summary of changes | Operation |
---|---|---|
2023-06-21 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
2023-05-18 | The request parameters of the API has changed | View Change Details |