The Cloud Cost Management API allows you to set up, edit, and delete Cloud Cost Management accounts for AWS and Azure. See the Cloud Cost Management page for more information.
/**
* List Cloud Cost Management AWS CUR configs returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);apiInstance.listCostAWSCURConfigs().then((data: v2.AwsCURConfigsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
List the AWS accounts in an organization by calling ‘organizations:ListAccounts’ from the specified management account.
This endpoint requires the cloud_cost_management_read authorization scope.
"""
List related AWS accounts returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.cloud_cost_management_apiimportCloudCostManagementApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=CloudCostManagementApi(api_client)response=api_instance.list_aws_related_accounts(filter_management_account_id="123456789123",)print(response)
# List related AWS accounts returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::CloudCostManagementAPI.newpapi_instance.list_aws_related_accounts("123456789123")
// List related AWS accounts returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewCloudCostManagementApi(apiClient)resp,r,err:=api.ListAWSRelatedAccounts(ctx,"123456789123")iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `CloudCostManagementApi.ListAWSRelatedAccounts`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `CloudCostManagementApi.ListAWSRelatedAccounts`:\n%s\n",responseContent)}
/**
* List related AWS accounts returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);constparams: v2.CloudCostManagementApiListAWSRelatedAccountsRequest={filterManagementAccountId:"123456789123",};apiInstance.listAWSRelatedAccounts(params).then((data: v2.AWSRelatedAccountsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
JSON API format of for a Custom Costs file with content.
attributes
object
Schema of a cost file's metadata.
billed_cost
double
Total cost in the cost file.
billing_currency
string
Currency used in the Custom Costs file.
charge_period
object
Usage charge period of a Custom Costs file.
end
double
End of the usage of the Custom Costs file.
start
double
Start of the usage of the Custom Costs file.
content
[object]
Detail of the line items from the Custom Costs file.
BilledCost
double
Total cost in the cost file.
BillingCurrency
string
Currency used in the Custom Costs file.
ChargeDescription
string
Description for the line item cost.
ChargePeriodEnd
string
End date of the usage charge.
ChargePeriodStart
string
Start date of the usage charge.
ProviderName
string
Name of the provider for the line item.
Tags
object
Additional tags for the line item.
<any-key>
string
name
string
Name of the Custom Costs file.
provider_names
[string]
Providers contained in the Custom Costs file.
status
string
Status of the Custom Costs file.
uploaded_at
double
Timestamp in millisecond of the upload time of the Custom Costs file.
uploaded_by
object
Metadata of the user that has uploaded the Custom Costs file.
email
string
The name of the Custom Costs file.
icon
string
The name of the Custom Costs file.
name
string
Name of the user.
id
string
ID of the Custom Costs metadata.
type
string
Type of the Custom Costs file metadata.
meta
object
Meta for the response from the Get Custom Costs endpoints.
version
string
Version of Custom Costs file
{"data":{"attributes":{"billed_cost":100.5,"billing_currency":"USD","charge_period":{"end":1706745600000,"start":1704067200000},"content":[{"BilledCost":100.5,"BillingCurrency":"USD","ChargeDescription":"Monthly usage charge for my service","ChargePeriodEnd":"2023-02-28","ChargePeriodStart":"2023-02-01","ProviderName":"string","Tags":{"<any-key>":"string"}}],"name":"my_file.json","provider_names":["my_provider"],"status":"active","uploaded_at":1704067200000,"uploaded_by":{"email":"email.test@datadohq.com","icon":"icon.png","name":"Test User"}},"id":"string","type":"string"},"meta":{"version":"string"}}