Estimating the Price of an Execution Plan
Function
EstimateExecutionPlanPrice
This API queries the price of new resources in an existing execution plan. Currently, price inquiry is supported in the following billing modes: yearly/monthly, pay-per-use, and free. Other billing modes, such as spot pricing, do not support price inquiry.
Note:
-
Some resource attributes may contain default values and are related to price inquiry parameters. If they are not declared for the resources in your template, the inquiry result may be inaccurate.
-
The price inquiry result is an estimation for reference only.
-
If the depends_on variable is used in the template, for example, the mandatory fields for price inquiry of resource A depend on the creation of resource B, resource A does not support price query.
-
Price inquiry is not supported for when a data source's flavor.id is transferred.
-
-
Price inquiry is not supported for images.
-
Price inquiry is supported for a limited number of resources in the template. Currently, a maximum of 12 yearly/monthly-billed resources and 24 pay-per-use resources are supported.
-
Resources that support price inquiry and parameters required for price inquiry:
-
huaweicloud_cce_cluster:
-
Supported billing modes: yearly/monthly and pay-per-use
-
-
huaweicloud_css_cluster:
-
Supported billing mode: pay-per-use
-
-
huaweicloud_evs_volume:
-
Supported billing modes: yearly/monthly and pay-per-use
-
Parameter required for price inquiry: size (disk specifications)
-
-
huaweicloud_compute_instance:
-
Supported billing modes: yearly/monthly and pay-per-use
-
Parameters required for price inquiry: flavor_id, flavor_name (either flavor_id or flavor_name must be specified.), and system_disk_size.
-
-
huaweicloud_vpc_bandwidth:
-
Supported billing mode: pay-per-use
-
Parameter required for price inquiry: charge_mode supports only bandwidth.
-
-
huaweicloud_vpc_eip:
-
Supported billing modes: yearly/monthly and pay-per-use
-
Parameter required for price inquiry: bandwidth.size
-
-
huaweicloud_gaussdb_redis_instance:
-
Supported billing modes: yearly/monthly and pay-per-use
-
-
huaweicloud_nat_gateway:
-
Supported billing mode: pay-per-use
-
-
huaweicloud_rds_instance:
-
Supported billing modes: yearly/monthly and pay-per-use
-
-
huaweicloud_sfs_turbo:
-
Supported billing mode: pay-per-use
-
Parameter required for price inquiry: share_type (file system type)
-
-
huaweicloud_dms_kafka_instance:
-
Supported billing mode: pay-per-use
-
Parameters required for price inquiry: either flavor_id or product_id, and storage_space
-
-
huaweicloud_dcs_instance:
-
Supported billing modes: yearly/monthly and pay-per-use
-
-
huaweicloud_gaussdb_mysql_instance:
-
Supported billing modes: yearly/monthly and pay-per-use
-
Parameters required for price inquiry: proxy_node_number (number of proxy nodes) and volume_size (storage space of mounted volumes)
-
-
huaweicloud_vpc:
-
Supported billing mode: free
-
-
huaweicloud_drs_job:
-
Supported billing mode: pay-per-use
-
-
huaweicloud_apig_instance:
-
Supported billing mode: pay-per-use
-
-
-
URI
GET /v1/{project_id}/stacks/{stack_name}/execution-plans/{execution_plan_name}/prices
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
A project ID is obtained by calling an API or from the console. Minimum: 3 Maximum: 64 |
stack_name |
Yes |
String |
A stack name is unique within its domain (domain_id), region, and project (project_id). It is case-sensitive and starts with a letter. Only letters, digits, underscores (_), and hyphens (-) are allowed. Minimum: 1 Maximum: 128 |
execution_plan_name |
Yes |
String |
An execution plan name is unique within its domain (domain_id), region, project (project_id), and stack (stack_id). It is case-sensitive and starts with a letter. Only letters, digits, underscores (_), and hyphens (-) are allowed. Minimum: 1 Maximum: 128 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
stack_id |
No |
String |
Unique stack ID. It is a UUID generated by RFS when a stack is created. Stack names are unique at one specific time, so you can create a stack named HelloWorld and another stack with the same name after deleting the first one. For parallel development, team members may want to ensure that they are operating the stack they created, not one with the same name created by other members after deleting the previous one. To avoid this mismatch, check the ID, since RFS ensures each stack has a unique ID that does not change with updates. If the stack_id value differs from the current stack ID, 400 is returned. Minimum: 36 Maximum: 36 |
execution_plan_id |
No |
String |
Unique execution plan ID. A UUID is generated by RFS when an execution plan is created. Execution plan names are unique at one specific time, so you can create an execution plan named HelloWorld and another execution plan with the same name after deleting the first one. For parallel development, team members may want to ensure that they are operating the execution plan they created, not one with the same name created by other members after deleting the previous one. To avoid this mismatch, check the ID, since RFS ensures each execution plan has a unique ID that does not change with updates. If the execution_plan_id value differs from the current execution plan ID, 400 is returned. Minimum: 36 Maximum: 36 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Client-Request-Id |
Yes |
String |
A unique request ID is specified by a user to locate a request. UUID is recommended. Minimum: 36 Maximum: 128 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
currency |
String |
Currency, which can be:
Enumeration values:
|
items |
Array of ItemsResponse objects |
Inquiry results of all resources in an execution plan. |
Parameter |
Type |
Description |
---|---|---|
resource_type |
String |
Resource type. For example, in the following HCL template, the value of resource_type is huaweicloud_vpc. resource "huaweicloud_vpc" "my_hello_world_vpc" { name = "test_vpc" } In a JSON template, the value of resource_type is huaweicloud_vpc. { "resource": { "huaweicloud_vpc": { "my_hello_world_vpc": { "name": "test_vpc" } } } } |
resource_name |
String |
Resource name. The default value is the logical name of a resource. For example, in the following HCL template, the value of resource_name is my_hello_world_vpc. resource "huaweicloud_vpc" "my_hello_world_vpc" { name = "test_vpc" } In a JSON template, the value of resource_name is my_hello_world_vpc. { "resource": { "huaweicloud_vpc": { "my_hello_world_vpc": { "name": "test_vpc" } } } } |
index |
String |
Resource index. If count or for_each is used in a template, index is returned. If index appears, resource_name and index can be used to identify a resource. If count is used in a template, index is a number starting from 0. For example, in the following HCL template, huaweicloud_vpc.my_hello_world_vpc[0] and huaweicloud_vpc.my_hello_world_vpc[1] identify two resources. resource "huaweicloud_vpc" "my_hello_world_vpc" { count = 2 name = "test_vpc" } In a JSON template, huaweicloud_vpc.my_hello_world_vpc[0] and huaweicloud_vpc.my_hello_world_vpc[1] identify two resources. { "resource": { "huaweicloud_vpc": { "my_hello_world_vpc": { "name": "test_vpc", "count": 2 } } } } If for_each is used in a template, index is a user-defined string. For example, in the following HCL template, huaweicloud_vpc.my_hello_world_vpc["vpc1"] and huaweicloud_vpc.my_hello_world_vpc["vpc2"] identify two resources. resource "huaweicloud_vpc" "my_hello_world_vpc" { for_each = { "vpc1" = "test_vpc" "vpc2" = "test_vpc" } name = each.value } In a JSON template, huaweicloud_vpc.my_hello_world_vpc["vpc1"] and huaweicloud_vpc.my_hello_world_vpc["vpc2"] identify two resources. { "resource": { "huaweicloud_vpc": { "my_hello_world_vpc": { "for_each": { "vpc1": "test_vpc", "vpc2": "test_vpc" } "name": "${each.value}" } } } } |
supported |
Boolean |
Whether price inquiry is supported for the resource or its variables. |
unsupported_message |
String |
Causes for not supporting price inquiry. |
resource_price |
Array of ResourcePriceResponse objects |
Price inquiry information of the resource. If the resource supports yearly/monthly or pay-per-use billing, or the resource is free of charge, this field is returned. If the resource does not support price inquiry, this field is not returned. |
Parameter |
Type |
Description |
---|---|---|
charge_mode |
String |
Billing mode.
Enumeration values:
|
sale_price |
Double |
Final price of the resource (only website, commercial, and partner discounts are considered, and promotion discounts and coupons are excluded). The value is rounded up to two decimal places. The default currency is USD. |
discount |
Double |
Total discounted price of the resource. The value is rounded up to two decimal places. The default currency is USD. |
original_price |
Double |
Original price of the resource. The value is rounded up to two decimal places. The default currency is USD. |
period_type |
String |
Billing unit. If the resource supports yearly/monthly or pay-per-use billing, this field is returned. If the resource is free of charge, this field is not returned.
Enumeration values:
|
period_count |
Integer |
Billed amount of the resource. This parameter must be used together with period_type. If the resource is billed in yearly/monthly or pay-per-use mode, this field is returned. If the resource is free of charge, this field is not returned.
|
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 429
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Example Requests
-
Estimate the price of an execution plan. The execution plan contains a new VPC resource.
GET https://{endpoint}/v1/ba2b9930c977f71edaeaa3a5e96a8ff1/stacks/my_hello_world_stack/execution-plans/my_first_execution_plan/prices
-
Estimate the price of an execution plan. The execution plan contains a new VPC resource. A stack ID and an execution plan ID are provided to check whether they match the current stack and execution plan.
GET https://{endpoint}/v1/ba2b9930c977f71edaeaa3a5e96a8ff1/stacks/my_hello_world_stack/execution-plans/my_first_execution_plan/prices?stack_id=ea6a4f0e-ee8a-494e-b12a-8be4a1e65af2&execution_plan_id=fb5e781e-a27d-46e2-9954-242753857a9f
Example Responses
Status code: 200
Price inquired.
{ "currency" : "CNY", "items" : [ { "resource_type" : "huaweicloud_vpc", "resource_name" : "vpc", "resource_price" : [ { "charge_mode" : "FREE", "discount" : 0, "original_price" : 0, "sale_price" : 0 } ], "supported" : true } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
Price inquired. |
400 |
Invalid request. |
401 |
Authentication failed. |
403 |
The user does not have the permission to call this API. |
404 |
The execution plan does not exist. |
429 |
Too frequent requests. |
500 |
Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.