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:
Method | Request | Response |
---|---|---|
create | CreateCostRequest | CostInfo |
delete | CostRequest | Empty |
get | CostRequest | CostInfo |
list | CostQuery | CostsInfo |
analyze | CostAnalyzeQuery | Struct |
stat | CostStatQuery | Struct |
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
cost (double)
Required
project_id (string)
Required
data_source_id (string)
Required
billed_date (string)
Required
usage_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)
{
"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"
}
cost_id (string)
Required
cost (double)
Required
usage_quantity (double)
Required
usage_unit (string)
Required
provider (string)
Required
region_code (string)
Required
region_key (string)
Required
product (string)
Required
usage_type (string)
Required
resource (string)
Required
tags (Struct)
Required
additional_info (Struct)
Required
data (Struct)
Required
domain_id (string)
Required
workspace_id (string)
Required
project_id (string)
Required
service_account_id (string)
Required
data_source_id (string)
Required
account_id (string)
Required
billed_year (string)
Required
billed_month (string)
Required
billed_date (string)
Required
{
"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"
}
delete #
Deletes a specific Cost. You must specify the cost_id
of the Cost to delete.
POST /cost-analysis/v1/cost/delete
get #
Gets a specific Cost. Prints detailed information about the Cost, including region_code
and account
.
POST /cost-analysis/v1/cost/get
cost_id (string)
Required
cost (double)
Required
usage_quantity (double)
Required
usage_unit (string)
Required
provider (string)
Required
region_code (string)
Required
region_key (string)
Required
product (string)
Required
usage_type (string)
Required
resource (string)
Required
tags (Struct)
Required
additional_info (Struct)
Required
data (Struct)
Required
domain_id (string)
Required
workspace_id (string)
Required
project_id (string)
Required
service_account_id (string)
Required
data_source_id (string)
Required
account_id (string)
Required
billed_year (string)
Required
billed_month (string)
Required
billed_date (string)
Required
{
"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"
}
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
data_source_id (string)
Required
query (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)
{
"query": {}
}
results (CostInfo)
Repeated
Required
total_count (int32)
Required
{
"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
}
analyze #
Gets the Cost information of specific product
s 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)
Required
data_source_id (string)
Required
CostInfo #
cost_id (string)
Required
cost (double)
Required
usage_quantity (double)
Required
usage_unit (string)
Required
provider (string)
Required
region_code (string)
Required
region_key (string)
Required
product (string)
Required
usage_type (string)
Required
resource (string)
Required
tags (Struct)
Required
additional_info (Struct)
Required
data (Struct)
Required
domain_id (string)
Required
workspace_id (string)
Required
project_id (string)
Required
service_account_id (string)
Required
data_source_id (string)
Required
account_id (string)
Required
billed_year (string)
Required
billed_month (string)
Required
billed_date (string)
Required
CostQuery #
data_source_id (string)
Required
query (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)
Required
data_source_id (string)
CostsInfo #
results (CostInfo)
Repeated
Required
total_count (int32)
Required
CreateCostRequest #
cost (double)
Required
project_id (string)
Required
data_source_id (string)
Required
billed_date (string)
Required
usage_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)