Cost
A Cost is a resource of raw cost data collected by the cost_analysis.DataSource.
Package : spaceone.api.cost_analysis.v1
Cost
Cost Methods:
create
Creates a new Cost. When creating a Cost, if the parameter provider is not entered, the default value of the parameter will be the provider information of the DataSource which collected the raw data of the Cost from the provider. The parameter billed_at is the data of when the cost is billed. While the DataSource collects the cost data, if the billed_at data does not exist, the value will be replaced with the created_at data indicating when the Cost is created. If the cost data collected is based on USD, the Cost is created without the currency exchange.
POST /cost-analysis/v1/cost/create
{{< tabs " create " >}}
{{< tab "Request Example" >}}
cost (double)
Requiredproject_id (string)
Requireddata_source_id (string)
Requiredbilled_date (string)
Requiredusage_quantity (double)
usage_unit (float)
provider (string)
region_code (string)
product (string)
usage_type (string)
resource (string)
tags (Struct)
additional_info (Struct)
service_account_id (string)
{{< highlight json >}} { "cost": 142, "usage_quantity": 84532, "usage_unit": "GB", "provider": "aws", "region_code": "ap-northeast-1", "product": "AWSDataTransfer", "account": "722069360300", "usage_type": "data-transfer.out", "additional_info": { "raw_usage_type": "APN1-DataTransfer-Out-Bytes" }, "tags": { "Environment": "Dev" }, "data_source_id": "ds-fcba92ca73b1" } {{< /highlight >}} {{< /tab >}}
{{< tab "Response Example" >}}
cost_id (string)
Requiredcost (double)
Requiredusage_quantity (double)
Requiredusage_unit (string)
Requiredprovider (string)
Requiredregion_code (string)
Requiredregion_key (string)
Requiredproduct (string)
Requiredusage_type (string)
Requiredresource (string)
Requiredtags (Struct)
Requiredadditional_info (Struct)
Requireddata (Struct)
Requireddomain_id (string)
Requiredworkspace_id (string)
Requiredproject_id (string)
Requiredservice_account_id (string)
Requireddata_source_id (string)
Requiredaccount_id (string)
Requiredbilled_year (string)
Requiredbilled_month (string)
Requiredbilled_date (string)
Required
{{< highlight json >}} { "cost_id": "cost-c5aae7712ec9", "cost": 142, "usage_quantity": 84532, "usage_unit": "GB", "provider": "aws", "region_code": "ap-northeast-1", "product": "AWSDataTransfer", "usage_type": "data-transfer.out", "additional_info": { "raw_usage_type": "APN1-DataTransfer-Out-Bytes" }, "tags": { "Environment": "Dev" }, "data_source_id": "ds-fcba92ca73b1" "domain_id": "domain-58010aa2e451", "billed_year": "2022", "billed_month": "2022-07", "billed_date": "2022-07-19" } {{< /highlight >}} {{< /tab >}}
{{< /tabs >}}
delete
Deletes a specific Cost. You must specify the cost_id of the Cost to delete.
POST /cost-analysis/v1/cost/delete
{{< tabs " delete " >}}
{{< tab "Request Example" >}}
cost_id (string)
Required
{{< highlight json >}} { "cost_id": "cost-2ad052ed03d7" } {{< /highlight >}} {{< /tab >}}
{{< /tabs >}}
get
Gets a specific Cost. Prints detailed information about the Cost, including region_code and account.
POST /cost-analysis/v1/cost/get
{{< tabs " get " >}}
{{< tab "Request Example" >}}
cost_id (string)
Required
{{< highlight json >}} { "cost_id": "cost-2ad052ed03d7" } {{< /highlight >}} {{< /tab >}}
{{< tab "Response Example" >}}
cost_id (string)
Requiredcost (double)
Requiredusage_quantity (double)
Requiredusage_unit (string)
Requiredprovider (string)
Requiredregion_code (string)
Requiredregion_key (string)
Requiredproduct (string)
Requiredusage_type (string)
Requiredresource (string)
Requiredtags (Struct)
Requiredadditional_info (Struct)
Requireddata (Struct)
Requireddomain_id (string)
Requiredworkspace_id (string)
Requiredproject_id (string)
Requiredservice_account_id (string)
Requireddata_source_id (string)
Requiredaccount_id (string)
Requiredbilled_year (string)
Requiredbilled_month (string)
Requiredbilled_date (string)
Required
{{< highlight json >}} { "cost_id": "cost-c5aae7712ec9", "cost": 142, "usage_quantity": 84532, "usage_unit": "GB", "provider": "aws", "region_code": "ap-northeast-1", "product": "AWSDataTransfer", "usage_type": "data-transfer.out", "additional_info": { "raw_usage_type": "APN1-DataTransfer-Out-Bytes" }, "tags": { "Environment": "Dev" }, "data_source_id": "ds-fcba92ca73b1" "domain_id": "domain-58010aa2e451", "billed_year": "2022", "billed_month": "2022-07", "billed_date": "2022-07-19" } {{< /highlight >}} {{< /tab >}}
{{< /tabs >}}
list
Gets a list of all Costs. You can use a query to get a filtered list of Costs.
POST /cost-analysis/v1/cost/list
{{< tabs " list " >}}
{{< tab "Request Example" >}}
data_source_id (string)
Requiredquery (Query)
cost_id (string)
provider (string)
region_code (string)
region_key (string)
product (string)
usage_type (string)
resource (string)
workspace_id (string)
project_id (string)
project_group_id (string)
service_account_id (string)
billed_year (string)
billed_month (string)
billed_date (string)
{{< highlight json >}} { "query": {} } {{< /highlight >}} {{< /tab >}}
{{< tab "Response Example" >}}
results (CostInfo)
RepeatedRequiredtotal_count (int32)
Required
{{< highlight json >}} { "results": [ { "cost_id": "cost-c5aae7712ec9", "cost": 142, "usage_quantity": 84532, "usage_unit": "GB", "provider": "aws", "region_code": "ap-northeast-1", "product": "AWSDataTransfer", "usage_type": "data-transfer.out", "additional_info": { "raw_usage_type": "APN1-DataTransfer-Out-Bytes" }, "tags": { "Environment": "Dev" }, "data_source_id": "ds-fcba92ca73b1" "domain_id": "domain-58010aa2e451", "billed_year": "2022", "billed_month": "2022-07", "billed_date": "2022-07-19" }, { "cost_id": "cost-1d5e1b0dbf82", "cost": 78, "usage_quantity": 34523, "usage_unit": "Count", "provider": "aws", "region_code": "ap-northeast-1", "product": "AWSQueueService" "additional_info": { "raw_usage_type": "APN1-Requests-Tier1" }, "tags": {}, "data_source_id": "ds-fcba92ca73b1", "domain_id": "domain-58010aa2e451", "billed_year": "2022", "billed_month": "2022-07", "billed_date": "2022-07-20" } ], "total_count": 307066 } {{< /highlight >}} {{< /tab >}}
{{< /tabs >}}
analyze
Gets the Cost information of specific products based on the time granularity: DAILY, MONTHLY, or ACCUMULATED. For DAILY granularity, this method can get the Cost data of at most 31 days. For MONTHLY or ACCUMULATED granularity, this method can get the Cost data of at most 12 months.
POST /cost-analysis/v1/cost/analyze
stat
POST /cost-analysis/v1/cost/stat
Message
CostAnalyzeQuery
query (TimeSeriesAnalyzeQuery)
Requireddata_source_id (string)
Required
CostInfo
cost_id (string)
Requiredcost (double)
Requiredusage_quantity (double)
Requiredusage_unit (string)
Requiredprovider (string)
Requiredregion_code (string)
Requiredregion_key (string)
Requiredproduct (string)
Requiredusage_type (string)
Requiredresource (string)
Requiredtags (Struct)
Requiredadditional_info (Struct)
Requireddata (Struct)
Requireddomain_id (string)
Requiredworkspace_id (string)
Requiredproject_id (string)
Requiredservice_account_id (string)
Requireddata_source_id (string)
Requiredaccount_id (string)
Requiredbilled_year (string)
Requiredbilled_month (string)
Requiredbilled_date (string)
Required
CostQuery
data_source_id (string)
Requiredquery (Query)
cost_id (string)
provider (string)
region_code (string)
region_key (string)
product (string)
usage_type (string)
resource (string)
workspace_id (string)
project_id (string)
project_group_id (string)
service_account_id (string)
billed_year (string)
billed_month (string)
billed_date (string)
CostRequest
cost_id (string)
Required
CostStatQuery
query (StatisticsQuery)
Requireddata_source_id (string)
CostsInfo
results (CostInfo)
RepeatedRequiredtotal_count (int32)
Required
CreateCostRequest
cost (double)
Requiredproject_id (string)
Requireddata_source_id (string)
Requiredbilled_date (string)
Requiredusage_quantity (double)
usage_unit (float)
provider (string)
region_code (string)
product (string)
usage_type (string)
resource (string)
tags (Struct)
additional_info (Struct)
service_account_id (string)
Last updated