Cloud Cost Management

The Cloud Cost Management API allows you to set up, edit, and delete Cloud Cost Management accounts for AWS, Azure, and Google Cloud. You can query your cost data by using the Metrics endpoint and the cloud_cost data source. For more information, see the Cloud Cost Management documentation.

GET https://api.ap1.datadoghq.com/api/v2/cost/aws_cur_confighttps://api.ap2.datadoghq.com/api/v2/cost/aws_cur_confighttps://api.datadoghq.eu/api/v2/cost/aws_cur_confighttps://api.ddog-gov.com/api/v2/cost/aws_cur_confighttps://api.us2.ddog-gov.com/api/v2/cost/aws_cur_confighttps://api.datadoghq.com/api/v2/cost/aws_cur_confighttps://api.us3.datadoghq.com/api/v2/cost/aws_cur_confighttps://api.us5.datadoghq.com/api/v2/cost/aws_cur_config

Overview

List the AWS CUR configs. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Response

OK

List of AWS CUR configs.

Expand All

Field

Type

Description

data [required]

[object]

An AWS CUR config.

attributes [required]

object

Attributes for An AWS CUR config.

account_filters

object

The account filtering configuration.

excluded_accounts

[string]

The AWS account IDs to be excluded from your billing dataset. This field is used when include_new_accounts is true.

include_new_accounts

boolean

Whether or not to automatically include new member accounts by default in your billing dataset.

included_accounts

[string]

The AWS account IDs to be included in your billing dataset. This field is used when include_new_accounts is false.

account_id [required]

string

The AWS account ID.

bucket_name [required]

string

The AWS bucket name used to store the Cost and Usage Report.

bucket_region [required]

string

The region the bucket is located in.

created_at

string

The timestamp when the AWS CUR config was created.

error_messages

[string]

The error messages for the AWS CUR config.

months

int32

DEPRECATED: The number of months the report has been backfilled.

report_name [required]

string

The name of the Cost and Usage Report.

report_prefix [required]

string

The report prefix used for the Cost and Usage Report.

status [required]

string

The status of the AWS CUR.

status_updated_at

string

The timestamp when the AWS CUR config status was updated.

updated_at

string

The timestamp when the AWS CUR config status was updated.

id

string

The ID of the AWS CUR config.

type [required]

enum

Type of AWS CUR config. Allowed enum values: aws_cur_config

default: aws_cur_config

{
  "data": [
    {
      "attributes": {
        "account_filters": {
          "excluded_accounts": [
            "123456789123",
            "123456789143"
          ],
          "include_new_accounts": true,
          "included_accounts": [
            "123456789123",
            "123456789143"
          ]
        },
        "account_id": "123456789123",
        "bucket_name": "dd-cost-bucket",
        "bucket_region": "us-east-1",
        "created_at": "string",
        "error_messages": [],
        "months": "integer",
        "report_name": "dd-report-name",
        "report_prefix": "dd-report-prefix",
        "status": "active",
        "status_updated_at": "string",
        "updated_at": "string"
      },
      "id": "string",
      "type": "aws_cur_config"
    }
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/aws_cur_config" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
List Cloud Cost Management AWS CUR configs returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_cost_awscur_configs()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# List Cloud Cost Management AWS CUR configs returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_cost_awscur_configs()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// List Cloud Cost Management AWS CUR configs returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListCostAWSCURConfigs(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostAWSCURConfigs`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostAWSCURConfigs`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// List Cloud Cost Management AWS CUR configs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.AwsCURConfigsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      AwsCURConfigsResponse result = apiInstance.listCostAWSCURConfigs();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#listCostAWSCURConfigs");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// List Cloud Cost Management AWS CUR configs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.list_cost_awscur_configs().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * List Cloud Cost Management AWS CUR configs returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .listCostAWSCURConfigs()
  .then((data: v2.AwsCURConfigsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/cost/aws_cur_confighttps://api.ap2.datadoghq.com/api/v2/cost/aws_cur_confighttps://api.datadoghq.eu/api/v2/cost/aws_cur_confighttps://api.ddog-gov.com/api/v2/cost/aws_cur_confighttps://api.us2.ddog-gov.com/api/v2/cost/aws_cur_confighttps://api.datadoghq.com/api/v2/cost/aws_cur_confighttps://api.us3.datadoghq.com/api/v2/cost/aws_cur_confighttps://api.us5.datadoghq.com/api/v2/cost/aws_cur_config

Overview

Create a Cloud Cost Management account for an AWS CUR config. This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

object

AWS CUR config Post data.

attributes

object

Attributes for AWS CUR config Post Request.

account_filters

object

The account filtering configuration.

excluded_accounts

[string]

The AWS account IDs to be excluded from your billing dataset. This field is used when include_new_accounts is true.

include_new_accounts

boolean

Whether or not to automatically include new member accounts by default in your billing dataset.

included_accounts

[string]

The AWS account IDs to be included in your billing dataset. This field is used when include_new_accounts is false.

account_id [required]

string

The AWS account ID.

bucket_name [required]

string

The AWS bucket name used to store the Cost and Usage Report.

bucket_region

string

The region the bucket is located in.

months

int32

The month of the report.

report_name [required]

string

The name of the Cost and Usage Report.

report_prefix [required]

string

The report prefix used for the Cost and Usage Report.

type [required]

enum

Type of AWS CUR config Post Request. Allowed enum values: aws_cur_config_post_request

default: aws_cur_config_post_request

{
  "data": {
    "attributes": {
      "account_id": "123456789123",
      "bucket_name": "dd-cost-bucket",
      "bucket_region": "us-east-1",
      "report_name": "dd-report-name",
      "report_prefix": "dd-report-prefix"
    },
    "type": "aws_cur_config_post_request"
  }
}

Response

OK

The definition of AwsCurConfigResponse object.

Expand All

Field

Type

Description

data

object

The definition of AwsCurConfigResponseData object.

attributes

object

The definition of AwsCurConfigResponseDataAttributes object.

account_filters

object

The definition of AwsCurConfigResponseDataAttributesAccountFilters object.

excluded_accounts

[string]

The account_filters excluded_accounts.

include_new_accounts

boolean

The account_filters include_new_accounts.

included_accounts

[string]

The account_filters included_accounts.

account_id

string

The attributes account_id.

bucket_name

string

The attributes bucket_name.

bucket_region

string

The attributes bucket_region.

created_at

string

The attributes created_at.

error_messages

[string]

The attributes error_messages.

months

int64

The attributes months.

report_name

string

The attributes report_name.

report_prefix

string

The attributes report_prefix.

status

string

The attributes status.

status_updated_at

string

The attributes status_updated_at.

updated_at

string

The attributes updated_at.

id

string

The AwsCurConfigResponseData id.

type [required]

enum

AWS CUR config resource type. Allowed enum values: aws_cur_config

default: aws_cur_config

{
  "data": {
    "attributes": {
      "account_filters": {
        "excluded_accounts": [
          "123456789124",
          "123456789125"
        ],
        "include_new_accounts": true
      },
      "account_id": "123456789123",
      "bucket_name": "dd-cost-bucket",
      "bucket_region": "us-east-1",
      "created_at": "2023-01-01T12:00:00.000000",
      "error_messages": [],
      "months": 36,
      "report_name": "dd-report-name",
      "report_prefix": "dd-report-prefix",
      "status": "active",
      "status_updated_at": "2023-01-01T12:00:00.000000",
      "updated_at": "2023-01-01T12:00:00.000000"
    },
    "id": "123456789123",
    "type": "aws_cur_config"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/aws_cur_config" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "account_filters": { "excluded_accounts": [ "123456789123", "123456789143" ], "include_new_accounts": true, "included_accounts": [ "123456789123", "123456789143" ] }, "account_id": "123456789123", "bucket_name": "dd-cost-bucket", "bucket_region": "us-east-1", "report_name": "dd-report-name", "report_prefix": "dd-report-prefix" }, "type": "aws_cur_config_post_request" } } EOF
// Create Cloud Cost Management AWS CUR config returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.AwsCURConfigPostRequest{
		Data: datadogV2.AwsCURConfigPostData{
			Attributes: &datadogV2.AwsCURConfigPostRequestAttributes{
				AccountId:    "123456789123",
				BucketName:   "dd-cost-bucket",
				BucketRegion: datadog.PtrString("us-east-1"),
				ReportName:   "dd-report-name",
				ReportPrefix: "dd-report-prefix",
			},
			Type: datadogV2.AWSCURCONFIGPOSTREQUESTTYPE_AWS_CUR_CONFIG_POST_REQUEST,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.CreateCostAWSCURConfig(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.CreateCostAWSCURConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.CreateCostAWSCURConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create Cloud Cost Management AWS CUR config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.AwsCURConfigPostData;
import com.datadog.api.client.v2.model.AwsCURConfigPostRequest;
import com.datadog.api.client.v2.model.AwsCURConfigPostRequestAttributes;
import com.datadog.api.client.v2.model.AwsCURConfigPostRequestType;
import com.datadog.api.client.v2.model.AwsCurConfigResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    AwsCURConfigPostRequest body =
        new AwsCURConfigPostRequest()
            .data(
                new AwsCURConfigPostData()
                    .attributes(
                        new AwsCURConfigPostRequestAttributes()
                            .accountId("123456789123")
                            .bucketName("dd-cost-bucket")
                            .bucketRegion("us-east-1")
                            .reportName("dd-report-name")
                            .reportPrefix("dd-report-prefix"))
                    .type(AwsCURConfigPostRequestType.AWS_CUR_CONFIG_POST_REQUEST));

    try {
      AwsCurConfigResponse result = apiInstance.createCostAWSCURConfig(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#createCostAWSCURConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create Cloud Cost Management AWS CUR config returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.aws_cur_config_post_data import AwsCURConfigPostData
from datadog_api_client.v2.model.aws_cur_config_post_request import AwsCURConfigPostRequest
from datadog_api_client.v2.model.aws_cur_config_post_request_attributes import AwsCURConfigPostRequestAttributes
from datadog_api_client.v2.model.aws_cur_config_post_request_type import AwsCURConfigPostRequestType

body = AwsCURConfigPostRequest(
    data=AwsCURConfigPostData(
        attributes=AwsCURConfigPostRequestAttributes(
            account_id="123456789123",
            bucket_name="dd-cost-bucket",
            bucket_region="us-east-1",
            report_name="dd-report-name",
            report_prefix="dd-report-prefix",
        ),
        type=AwsCURConfigPostRequestType.AWS_CUR_CONFIG_POST_REQUEST,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.create_cost_awscur_config(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create Cloud Cost Management AWS CUR config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::AwsCURConfigPostRequest.new({
  data: DatadogAPIClient::V2::AwsCURConfigPostData.new({
    attributes: DatadogAPIClient::V2::AwsCURConfigPostRequestAttributes.new({
      account_id: "123456789123",
      bucket_name: "dd-cost-bucket",
      bucket_region: "us-east-1",
      report_name: "dd-report-name",
      report_prefix: "dd-report-prefix",
    }),
    type: DatadogAPIClient::V2::AwsCURConfigPostRequestType::AWS_CUR_CONFIG_POST_REQUEST,
  }),
})
p api_instance.create_cost_awscur_config(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Create Cloud Cost Management AWS CUR config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::AwsCURConfigPostData;
use datadog_api_client::datadogV2::model::AwsCURConfigPostRequest;
use datadog_api_client::datadogV2::model::AwsCURConfigPostRequestAttributes;
use datadog_api_client::datadogV2::model::AwsCURConfigPostRequestType;

#[tokio::main]
async fn main() {
    let body = AwsCURConfigPostRequest::new(
        AwsCURConfigPostData::new(AwsCURConfigPostRequestType::AWS_CUR_CONFIG_POST_REQUEST)
            .attributes(
                AwsCURConfigPostRequestAttributes::new(
                    "123456789123".to_string(),
                    "dd-cost-bucket".to_string(),
                    "dd-report-name".to_string(),
                    "dd-report-prefix".to_string(),
                )
                .bucket_region("us-east-1".to_string()),
            ),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.create_cost_awscur_config(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Create Cloud Cost Management AWS CUR config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiCreateCostAWSCURConfigRequest = {
  body: {
    data: {
      attributes: {
        accountId: "123456789123",
        bucketName: "dd-cost-bucket",
        bucketRegion: "us-east-1",
        reportName: "dd-report-name",
        reportPrefix: "dd-report-prefix",
      },
      type: "aws_cur_config_post_request",
    },
  },
};

apiInstance
  .createCostAWSCURConfig(params)
  .then((data: v2.AwsCurConfigResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PATCH https://api.ap1.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}

Overview

Update the status (active/archived) and/or account filtering configuration of an AWS CUR config. This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

Cloud Account id.

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

object

AWS CUR config Patch data.

attributes [required]

object

Attributes for AWS CUR config Patch Request.

account_filters

object

The account filtering configuration.

excluded_accounts

[string]

The AWS account IDs to be excluded from your billing dataset. This field is used when include_new_accounts is true.

include_new_accounts

boolean

Whether or not to automatically include new member accounts by default in your billing dataset.

included_accounts

[string]

The AWS account IDs to be included in your billing dataset. This field is used when include_new_accounts is false.

is_enabled

boolean

Whether or not the Cloud Cost Management account is enabled.

type [required]

enum

Type of AWS CUR config Patch Request. Allowed enum values: aws_cur_config_patch_request

default: aws_cur_config_patch_request

{
  "data": {
    "attributes": {
      "is_enabled": true
    },
    "type": "aws_cur_config_patch_request"
  }
}

Response

OK

List of AWS CUR configs.

Expand All

Field

Type

Description

data [required]

[object]

An AWS CUR config.

attributes [required]

object

Attributes for An AWS CUR config.

account_filters

object

The account filtering configuration.

excluded_accounts

[string]

The AWS account IDs to be excluded from your billing dataset. This field is used when include_new_accounts is true.

include_new_accounts

boolean

Whether or not to automatically include new member accounts by default in your billing dataset.

included_accounts

[string]

The AWS account IDs to be included in your billing dataset. This field is used when include_new_accounts is false.

account_id [required]

string

The AWS account ID.

bucket_name [required]

string

The AWS bucket name used to store the Cost and Usage Report.

bucket_region [required]

string

The region the bucket is located in.

created_at

string

The timestamp when the AWS CUR config was created.

error_messages

[string]

The error messages for the AWS CUR config.

months

int32

DEPRECATED: The number of months the report has been backfilled.

report_name [required]

string

The name of the Cost and Usage Report.

report_prefix [required]

string

The report prefix used for the Cost and Usage Report.

status [required]

string

The status of the AWS CUR.

status_updated_at

string

The timestamp when the AWS CUR config status was updated.

updated_at

string

The timestamp when the AWS CUR config status was updated.

id

string

The ID of the AWS CUR config.

type [required]

enum

Type of AWS CUR config. Allowed enum values: aws_cur_config

default: aws_cur_config

{
  "data": [
    {
      "attributes": {
        "account_filters": {
          "excluded_accounts": [
            "123456789123",
            "123456789143"
          ],
          "include_new_accounts": true,
          "included_accounts": [
            "123456789123",
            "123456789143"
          ]
        },
        "account_id": "123456789123",
        "bucket_name": "dd-cost-bucket",
        "bucket_region": "us-east-1",
        "created_at": "string",
        "error_messages": [],
        "months": "integer",
        "report_name": "dd-report-name",
        "report_prefix": "dd-report-prefix",
        "status": "active",
        "status_updated_at": "string",
        "updated_at": "string"
      },
      "id": "string",
      "type": "aws_cur_config"
    }
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/aws_cur_config/${cloud_account_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "account_filters": { "excluded_accounts": [ "123456789123", "123456789143" ], "include_new_accounts": true, "included_accounts": [ "123456789123", "123456789143" ] }, "is_enabled": true }, "type": "aws_cur_config_patch_request" } } EOF
// Update Cloud Cost Management AWS CUR config returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.AwsCURConfigPatchRequest{
		Data: datadogV2.AwsCURConfigPatchData{
			Attributes: datadogV2.AwsCURConfigPatchRequestAttributes{
				IsEnabled: datadog.PtrBool(true),
			},
			Type: datadogV2.AWSCURCONFIGPATCHREQUESTTYPE_AWS_CUR_CONFIG_PATCH_REQUEST,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.UpdateCostAWSCURConfig(ctx, 100, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpdateCostAWSCURConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpdateCostAWSCURConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Update Cloud Cost Management AWS CUR config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.AwsCURConfigPatchData;
import com.datadog.api.client.v2.model.AwsCURConfigPatchRequest;
import com.datadog.api.client.v2.model.AwsCURConfigPatchRequestAttributes;
import com.datadog.api.client.v2.model.AwsCURConfigPatchRequestType;
import com.datadog.api.client.v2.model.AwsCURConfigsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    AwsCURConfigPatchRequest body =
        new AwsCURConfigPatchRequest()
            .data(
                new AwsCURConfigPatchData()
                    .attributes(new AwsCURConfigPatchRequestAttributes().isEnabled(true))
                    .type(AwsCURConfigPatchRequestType.AWS_CUR_CONFIG_PATCH_REQUEST));

    try {
      AwsCURConfigsResponse result = apiInstance.updateCostAWSCURConfig(100L, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#updateCostAWSCURConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Update Cloud Cost Management AWS CUR config returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.aws_cur_config_patch_data import AwsCURConfigPatchData
from datadog_api_client.v2.model.aws_cur_config_patch_request import AwsCURConfigPatchRequest
from datadog_api_client.v2.model.aws_cur_config_patch_request_attributes import AwsCURConfigPatchRequestAttributes
from datadog_api_client.v2.model.aws_cur_config_patch_request_type import AwsCURConfigPatchRequestType

body = AwsCURConfigPatchRequest(
    data=AwsCURConfigPatchData(
        attributes=AwsCURConfigPatchRequestAttributes(
            is_enabled=True,
        ),
        type=AwsCURConfigPatchRequestType.AWS_CUR_CONFIG_PATCH_REQUEST,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.update_cost_awscur_config(cloud_account_id=100, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Update Cloud Cost Management AWS CUR config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::AwsCURConfigPatchRequest.new({
  data: DatadogAPIClient::V2::AwsCURConfigPatchData.new({
    attributes: DatadogAPIClient::V2::AwsCURConfigPatchRequestAttributes.new({
      is_enabled: true,
    }),
    type: DatadogAPIClient::V2::AwsCURConfigPatchRequestType::AWS_CUR_CONFIG_PATCH_REQUEST,
  }),
})
p api_instance.update_cost_awscur_config(100, body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Update Cloud Cost Management AWS CUR config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::AwsCURConfigPatchData;
use datadog_api_client::datadogV2::model::AwsCURConfigPatchRequest;
use datadog_api_client::datadogV2::model::AwsCURConfigPatchRequestAttributes;
use datadog_api_client::datadogV2::model::AwsCURConfigPatchRequestType;

#[tokio::main]
async fn main() {
    let body = AwsCURConfigPatchRequest::new(AwsCURConfigPatchData::new(
        AwsCURConfigPatchRequestAttributes::new().is_enabled(true),
        AwsCURConfigPatchRequestType::AWS_CUR_CONFIG_PATCH_REQUEST,
    ));
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.update_cost_awscur_config(100, body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Update Cloud Cost Management AWS CUR config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiUpdateCostAWSCURConfigRequest = {
  body: {
    data: {
      attributes: {
        isEnabled: true,
      },
      type: "aws_cur_config_patch_request",
    },
  },
  cloudAccountId: 100,
};

apiInstance
  .updateCostAWSCURConfig(params)
  .then((data: v2.AwsCURConfigsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}

Overview

Archive a Cloud Cost Management Account. This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

Cloud Account id.

Response

No Content

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/aws_cur_config/${cloud_account_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete Cloud Cost Management AWS CUR config returns "No Content" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.delete_cost_awscur_config(
        cloud_account_id=100,
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete Cloud Cost Management AWS CUR config returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
api_instance.delete_cost_awscur_config(100)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete Cloud Cost Management AWS CUR config returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.DeleteCostAWSCURConfig(ctx, 100)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteCostAWSCURConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete Cloud Cost Management AWS CUR config returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      apiInstance.deleteCostAWSCURConfig(100L);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#deleteCostAWSCURConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Delete Cloud Cost Management AWS CUR config returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.delete_cost_awscur_config(100).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Delete Cloud Cost Management AWS CUR config returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiDeleteCostAWSCURConfigRequest = {
  cloudAccountId: 100,
};

apiInstance
  .deleteCostAWSCURConfig(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/aws_cur_config/{cloud_account_id}

Overview

Get a specific AWS CUR config.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

The unique identifier of the cloud account

Response

OK

The definition of AwsCurConfigResponse object.

Expand All

Field

Type

Description

data

object

The definition of AwsCurConfigResponseData object.

attributes

object

The definition of AwsCurConfigResponseDataAttributes object.

account_filters

object

The definition of AwsCurConfigResponseDataAttributesAccountFilters object.

excluded_accounts

[string]

The account_filters excluded_accounts.

include_new_accounts

boolean

The account_filters include_new_accounts.

included_accounts

[string]

The account_filters included_accounts.

account_id

string

The attributes account_id.

bucket_name

string

The attributes bucket_name.

bucket_region

string

The attributes bucket_region.

created_at

string

The attributes created_at.

error_messages

[string]

The attributes error_messages.

months

int64

The attributes months.

report_name

string

The attributes report_name.

report_prefix

string

The attributes report_prefix.

status

string

The attributes status.

status_updated_at

string

The attributes status_updated_at.

updated_at

string

The attributes updated_at.

id

string

The AwsCurConfigResponseData id.

type [required]

enum

AWS CUR config resource type. Allowed enum values: aws_cur_config

default: aws_cur_config

{
  "data": {
    "attributes": {
      "account_filters": {
        "excluded_accounts": [
          "123456789124",
          "123456789125"
        ],
        "include_new_accounts": true
      },
      "account_id": "123456789123",
      "bucket_name": "dd-cost-bucket",
      "bucket_region": "us-east-1",
      "created_at": "2023-01-01T12:00:00.000000",
      "error_messages": [],
      "months": 36,
      "report_name": "dd-report-name",
      "report_prefix": "dd-report-prefix",
      "status": "active",
      "status_updated_at": "2023-01-01T12:00:00.000000",
      "updated_at": "2023-01-01T12:00:00.000000"
    },
    "id": "123456789123",
    "type": "aws_cur_config"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/aws_cur_config/${cloud_account_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get cost AWS CUR config returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.get_cost_awscur_config(
        cloud_account_id=123456,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get cost AWS CUR config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.get_cost_awscur_config(123456)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get cost AWS CUR config returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.GetCostAWSCURConfig(ctx, 123456)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetCostAWSCURConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetCostAWSCURConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get cost AWS CUR config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.AwsCurConfigResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      AwsCurConfigResponse result = apiInstance.getCostAWSCURConfig(123456L);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#getCostAWSCURConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get cost AWS CUR config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.get_cost_awscur_config(123456).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get cost AWS CUR config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiGetCostAWSCURConfigRequest = {
  cloudAccountId: 123456,
};

apiInstance
  .getCostAWSCURConfig(params)
  .then((data: v2.AwsCurConfigResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/azure_uc_confighttps://api.ap2.datadoghq.com/api/v2/cost/azure_uc_confighttps://api.datadoghq.eu/api/v2/cost/azure_uc_confighttps://api.ddog-gov.com/api/v2/cost/azure_uc_confighttps://api.us2.ddog-gov.com/api/v2/cost/azure_uc_confighttps://api.datadoghq.com/api/v2/cost/azure_uc_confighttps://api.us3.datadoghq.com/api/v2/cost/azure_uc_confighttps://api.us5.datadoghq.com/api/v2/cost/azure_uc_config

Overview

List the Azure configs. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Response

OK

List of Azure accounts with configs.

Expand All

Field

Type

Description

data [required]

[object]

An Azure config pair.

attributes [required]

object

Attributes for Azure config pair.

configs [required]

[object]

An Azure config.

account_id [required]

string

The tenant ID of the Azure account.

client_id [required]

string

The client ID of the Azure account.

created_at

string

The timestamp when the Azure config was created.

dataset_type [required]

string

The dataset type of the Azure config.

error_messages

[string]

The error messages for the Azure config.

export_name [required]

string

The name of the configured Azure Export.

export_path [required]

string

The path where the Azure Export is saved.

id

string

The ID of the Azure config.

months

int32

DEPRECATED: The number of months the report has been backfilled.

scope [required]

string

The scope of your observed subscription.

status [required]

string

The status of the Azure config.

status_updated_at

string

The timestamp when the Azure config status was last updated.

storage_account [required]

string

The name of the storage account where the Azure Export is saved.

storage_container [required]

string

The name of the storage container where the Azure Export is saved.

updated_at

string

The timestamp when the Azure config was last updated.

id

string

The ID of the Azure config pair.

id

string

The ID of Cloud Cost Management account.

type [required]

enum

Type of Azure config pair. Allowed enum values: azure_uc_configs

default: azure_uc_configs

{
  "data": [
    {
      "attributes": {
        "configs": [
          {
            "account_id": "1234abcd-1234-abcd-1234-1234abcd1234",
            "client_id": "1234abcd-1234-abcd-1234-1234abcd1234",
            "created_at": "string",
            "dataset_type": "actual",
            "error_messages": [],
            "export_name": "dd-actual-export",
            "export_path": "dd-export-path",
            "id": "string",
            "months": "integer",
            "scope": "/subscriptions/1234abcd-1234-abcd-1234-1234abcd1234",
            "status": "active",
            "status_updated_at": "string",
            "storage_account": "dd-storage-account",
            "storage_container": "dd-storage-container",
            "updated_at": "string"
          }
        ],
        "id": "string"
      },
      "id": "string",
      "type": "azure_uc_configs"
    }
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/azure_uc_config" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
List Cloud Cost Management Azure configs returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_cost_azure_uc_configs()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# List Cloud Cost Management Azure configs returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_cost_azure_uc_configs()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// List Cloud Cost Management Azure configs returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListCostAzureUCConfigs(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostAzureUCConfigs`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostAzureUCConfigs`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// List Cloud Cost Management Azure configs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.AzureUCConfigsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      AzureUCConfigsResponse result = apiInstance.listCostAzureUCConfigs();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#listCostAzureUCConfigs");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// List Cloud Cost Management Azure configs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.list_cost_azure_uc_configs().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * List Cloud Cost Management Azure configs returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .listCostAzureUCConfigs()
  .then((data: v2.AzureUCConfigsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/cost/azure_uc_confighttps://api.ap2.datadoghq.com/api/v2/cost/azure_uc_confighttps://api.datadoghq.eu/api/v2/cost/azure_uc_confighttps://api.ddog-gov.com/api/v2/cost/azure_uc_confighttps://api.us2.ddog-gov.com/api/v2/cost/azure_uc_confighttps://api.datadoghq.com/api/v2/cost/azure_uc_confighttps://api.us3.datadoghq.com/api/v2/cost/azure_uc_confighttps://api.us5.datadoghq.com/api/v2/cost/azure_uc_config

Overview

Create a Cloud Cost Management account for an Azure config. This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

object

Azure config Post data.

attributes

object

Attributes for Azure config Post Request.

account_id [required]

string

The tenant ID of the Azure account.

actual_bill_config [required]

object

Bill config.

export_name [required]

string

The name of the configured Azure Export.

export_path [required]

string

The path where the Azure Export is saved.

storage_account [required]

string

The name of the storage account where the Azure Export is saved.

storage_container [required]

string

The name of the storage container where the Azure Export is saved.

amortized_bill_config [required]

object

Bill config.

export_name [required]

string

The name of the configured Azure Export.

export_path [required]

string

The path where the Azure Export is saved.

storage_account [required]

string

The name of the storage account where the Azure Export is saved.

storage_container [required]

string

The name of the storage container where the Azure Export is saved.

client_id [required]

string

The client ID of the Azure account.

scope [required]

string

The scope of your observed subscription.

type [required]

enum

Type of Azure config Post Request. Allowed enum values: azure_uc_config_post_request

default: azure_uc_config_post_request

{
  "data": {
    "attributes": {
      "account_id": "1234abcd-1234-abcd-1234-1234abcd1234",
      "actual_bill_config": {
        "export_name": "dd-actual-export",
        "export_path": "dd-export-path",
        "storage_account": "dd-storage-account",
        "storage_container": "dd-storage-container"
      },
      "amortized_bill_config": {
        "export_name": "dd-actual-export",
        "export_path": "dd-export-path",
        "storage_account": "dd-storage-account",
        "storage_container": "dd-storage-container"
      },
      "client_id": "1234abcd-1234-abcd-1234-1234abcd1234",
      "scope": "subscriptions/1234abcd-1234-abcd-1234-1234abcd1234"
    },
    "type": "azure_uc_config_post_request"
  }
}

Response

OK

Response of Azure config pair.

Expand All

Field

Type

Description

data

object

Azure config pair.

attributes [required]

object

Attributes for Azure config pair.

configs [required]

[object]

An Azure config.

account_id [required]

string

The tenant ID of the Azure account.

client_id [required]

string

The client ID of the Azure account.

created_at

string

The timestamp when the Azure config was created.

dataset_type [required]

string

The dataset type of the Azure config.

error_messages

[string]

The error messages for the Azure config.

export_name [required]

string

The name of the configured Azure Export.

export_path [required]

string

The path where the Azure Export is saved.

id

string

The ID of the Azure config.

months

int32

DEPRECATED: The number of months the report has been backfilled.

scope [required]

string

The scope of your observed subscription.

status [required]

string

The status of the Azure config.

status_updated_at

string

The timestamp when the Azure config status was last updated.

storage_account [required]

string

The name of the storage account where the Azure Export is saved.

storage_container [required]

string

The name of the storage container where the Azure Export is saved.

updated_at

string

The timestamp when the Azure config was last updated.

id

string

The ID of the Azure config pair.

id

string

The ID of Cloud Cost Management account.

type [required]

enum

Type of Azure config pair. Allowed enum values: azure_uc_configs

default: azure_uc_configs

{
  "data": {
    "attributes": {
      "configs": [
        {
          "account_id": "1234abcd-1234-abcd-1234-1234abcd1234",
          "client_id": "1234abcd-1234-abcd-1234-1234abcd1234",
          "created_at": "string",
          "dataset_type": "actual",
          "error_messages": [],
          "export_name": "dd-actual-export",
          "export_path": "dd-export-path",
          "id": "string",
          "months": "integer",
          "scope": "/subscriptions/1234abcd-1234-abcd-1234-1234abcd1234",
          "status": "active",
          "status_updated_at": "string",
          "storage_account": "dd-storage-account",
          "storage_container": "dd-storage-container",
          "updated_at": "string"
        }
      ],
      "id": "string"
    },
    "id": "string",
    "type": "azure_uc_configs"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/azure_uc_config" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "account_id": "1234abcd-1234-abcd-1234-1234abcd1234", "actual_bill_config": { "export_name": "dd-actual-export", "export_path": "dd-export-path", "storage_account": "dd-storage-account", "storage_container": "dd-storage-container" }, "amortized_bill_config": { "export_name": "dd-actual-export", "export_path": "dd-export-path", "storage_account": "dd-storage-account", "storage_container": "dd-storage-container" }, "client_id": "1234abcd-1234-abcd-1234-1234abcd1234", "scope": "/subscriptions/1234abcd-1234-abcd-1234-1234abcd1234" }, "type": "azure_uc_config_post_request" } } EOF
// Create Cloud Cost Management Azure configs returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.AzureUCConfigPostRequest{
		Data: datadogV2.AzureUCConfigPostData{
			Attributes: &datadogV2.AzureUCConfigPostRequestAttributes{
				AccountId: "1234abcd-1234-abcd-1234-1234abcd1234",
				ActualBillConfig: datadogV2.BillConfig{
					ExportName:       "dd-actual-export",
					ExportPath:       "dd-export-path",
					StorageAccount:   "dd-storage-account",
					StorageContainer: "dd-storage-container",
				},
				AmortizedBillConfig: datadogV2.BillConfig{
					ExportName:       "dd-actual-export",
					ExportPath:       "dd-export-path",
					StorageAccount:   "dd-storage-account",
					StorageContainer: "dd-storage-container",
				},
				ClientId: "1234abcd-1234-abcd-1234-1234abcd1234",
				Scope:    "subscriptions/1234abcd-1234-abcd-1234-1234abcd1234",
			},
			Type: datadogV2.AZUREUCCONFIGPOSTREQUESTTYPE_AZURE_UC_CONFIG_POST_REQUEST,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.CreateCostAzureUCConfigs(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.CreateCostAzureUCConfigs`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.CreateCostAzureUCConfigs`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create Cloud Cost Management Azure configs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.AzureUCConfigPairsResponse;
import com.datadog.api.client.v2.model.AzureUCConfigPostData;
import com.datadog.api.client.v2.model.AzureUCConfigPostRequest;
import com.datadog.api.client.v2.model.AzureUCConfigPostRequestAttributes;
import com.datadog.api.client.v2.model.AzureUCConfigPostRequestType;
import com.datadog.api.client.v2.model.BillConfig;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    AzureUCConfigPostRequest body =
        new AzureUCConfigPostRequest()
            .data(
                new AzureUCConfigPostData()
                    .attributes(
                        new AzureUCConfigPostRequestAttributes()
                            .accountId("1234abcd-1234-abcd-1234-1234abcd1234")
                            .actualBillConfig(
                                new BillConfig()
                                    .exportName("dd-actual-export")
                                    .exportPath("dd-export-path")
                                    .storageAccount("dd-storage-account")
                                    .storageContainer("dd-storage-container"))
                            .amortizedBillConfig(
                                new BillConfig()
                                    .exportName("dd-actual-export")
                                    .exportPath("dd-export-path")
                                    .storageAccount("dd-storage-account")
                                    .storageContainer("dd-storage-container"))
                            .clientId("1234abcd-1234-abcd-1234-1234abcd1234")
                            .scope("subscriptions/1234abcd-1234-abcd-1234-1234abcd1234"))
                    .type(AzureUCConfigPostRequestType.AZURE_UC_CONFIG_POST_REQUEST));

    try {
      AzureUCConfigPairsResponse result = apiInstance.createCostAzureUCConfigs(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#createCostAzureUCConfigs");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create Cloud Cost Management Azure configs returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.azure_uc_config_post_data import AzureUCConfigPostData
from datadog_api_client.v2.model.azure_uc_config_post_request import AzureUCConfigPostRequest
from datadog_api_client.v2.model.azure_uc_config_post_request_attributes import AzureUCConfigPostRequestAttributes
from datadog_api_client.v2.model.azure_uc_config_post_request_type import AzureUCConfigPostRequestType
from datadog_api_client.v2.model.bill_config import BillConfig

body = AzureUCConfigPostRequest(
    data=AzureUCConfigPostData(
        attributes=AzureUCConfigPostRequestAttributes(
            account_id="1234abcd-1234-abcd-1234-1234abcd1234",
            actual_bill_config=BillConfig(
                export_name="dd-actual-export",
                export_path="dd-export-path",
                storage_account="dd-storage-account",
                storage_container="dd-storage-container",
            ),
            amortized_bill_config=BillConfig(
                export_name="dd-actual-export",
                export_path="dd-export-path",
                storage_account="dd-storage-account",
                storage_container="dd-storage-container",
            ),
            client_id="1234abcd-1234-abcd-1234-1234abcd1234",
            scope="subscriptions/1234abcd-1234-abcd-1234-1234abcd1234",
        ),
        type=AzureUCConfigPostRequestType.AZURE_UC_CONFIG_POST_REQUEST,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.create_cost_azure_uc_configs(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create Cloud Cost Management Azure configs returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::AzureUCConfigPostRequest.new({
  data: DatadogAPIClient::V2::AzureUCConfigPostData.new({
    attributes: DatadogAPIClient::V2::AzureUCConfigPostRequestAttributes.new({
      account_id: "1234abcd-1234-abcd-1234-1234abcd1234",
      actual_bill_config: DatadogAPIClient::V2::BillConfig.new({
        export_name: "dd-actual-export",
        export_path: "dd-export-path",
        storage_account: "dd-storage-account",
        storage_container: "dd-storage-container",
      }),
      amortized_bill_config: DatadogAPIClient::V2::BillConfig.new({
        export_name: "dd-actual-export",
        export_path: "dd-export-path",
        storage_account: "dd-storage-account",
        storage_container: "dd-storage-container",
      }),
      client_id: "1234abcd-1234-abcd-1234-1234abcd1234",
      scope: "subscriptions/1234abcd-1234-abcd-1234-1234abcd1234",
    }),
    type: DatadogAPIClient::V2::AzureUCConfigPostRequestType::AZURE_UC_CONFIG_POST_REQUEST,
  }),
})
p api_instance.create_cost_azure_uc_configs(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Create Cloud Cost Management Azure configs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::AzureUCConfigPostData;
use datadog_api_client::datadogV2::model::AzureUCConfigPostRequest;
use datadog_api_client::datadogV2::model::AzureUCConfigPostRequestAttributes;
use datadog_api_client::datadogV2::model::AzureUCConfigPostRequestType;
use datadog_api_client::datadogV2::model::BillConfig;

#[tokio::main]
async fn main() {
    let body = AzureUCConfigPostRequest::new(
        AzureUCConfigPostData::new(AzureUCConfigPostRequestType::AZURE_UC_CONFIG_POST_REQUEST)
            .attributes(AzureUCConfigPostRequestAttributes::new(
                "1234abcd-1234-abcd-1234-1234abcd1234".to_string(),
                BillConfig::new(
                    "dd-actual-export".to_string(),
                    "dd-export-path".to_string(),
                    "dd-storage-account".to_string(),
                    "dd-storage-container".to_string(),
                ),
                BillConfig::new(
                    "dd-actual-export".to_string(),
                    "dd-export-path".to_string(),
                    "dd-storage-account".to_string(),
                    "dd-storage-container".to_string(),
                ),
                "1234abcd-1234-abcd-1234-1234abcd1234".to_string(),
                "subscriptions/1234abcd-1234-abcd-1234-1234abcd1234".to_string(),
            )),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.create_cost_azure_uc_configs(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Create Cloud Cost Management Azure configs returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiCreateCostAzureUCConfigsRequest = {
  body: {
    data: {
      attributes: {
        accountId: "1234abcd-1234-abcd-1234-1234abcd1234",
        actualBillConfig: {
          exportName: "dd-actual-export",
          exportPath: "dd-export-path",
          storageAccount: "dd-storage-account",
          storageContainer: "dd-storage-container",
        },
        amortizedBillConfig: {
          exportName: "dd-actual-export",
          exportPath: "dd-export-path",
          storageAccount: "dd-storage-account",
          storageContainer: "dd-storage-container",
        },
        clientId: "1234abcd-1234-abcd-1234-1234abcd1234",
        scope: "subscriptions/1234abcd-1234-abcd-1234-1234abcd1234",
      },
      type: "azure_uc_config_post_request",
    },
  },
};

apiInstance
  .createCostAzureUCConfigs(params)
  .then((data: v2.AzureUCConfigPairsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PATCH https://api.ap1.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}

Overview

Update the status of an Azure config (active/archived). This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

Cloud Account id.

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

object

Azure config Patch data.

attributes

object

Attributes for Azure config Patch Request.

is_enabled [required]

boolean

Whether or not the Cloud Cost Management account is enabled.

type [required]

enum

Type of Azure config Patch Request. Allowed enum values: azure_uc_config_patch_request

default: azure_uc_config_patch_request

{
  "data": {
    "attributes": {
      "is_enabled": true
    },
    "type": "azure_uc_config_patch_request"
  }
}

Response

OK

Response of Azure config pair.

Expand All

Field

Type

Description

data

object

Azure config pair.

attributes [required]

object

Attributes for Azure config pair.

configs [required]

[object]

An Azure config.

account_id [required]

string

The tenant ID of the Azure account.

client_id [required]

string

The client ID of the Azure account.

created_at

string

The timestamp when the Azure config was created.

dataset_type [required]

string

The dataset type of the Azure config.

error_messages

[string]

The error messages for the Azure config.

export_name [required]

string

The name of the configured Azure Export.

export_path [required]

string

The path where the Azure Export is saved.

id

string

The ID of the Azure config.

months

int32

DEPRECATED: The number of months the report has been backfilled.

scope [required]

string

The scope of your observed subscription.

status [required]

string

The status of the Azure config.

status_updated_at

string

The timestamp when the Azure config status was last updated.

storage_account [required]

string

The name of the storage account where the Azure Export is saved.

storage_container [required]

string

The name of the storage container where the Azure Export is saved.

updated_at

string

The timestamp when the Azure config was last updated.

id

string

The ID of the Azure config pair.

id

string

The ID of Cloud Cost Management account.

type [required]

enum

Type of Azure config pair. Allowed enum values: azure_uc_configs

default: azure_uc_configs

{
  "data": {
    "attributes": {
      "configs": [
        {
          "account_id": "1234abcd-1234-abcd-1234-1234abcd1234",
          "client_id": "1234abcd-1234-abcd-1234-1234abcd1234",
          "created_at": "string",
          "dataset_type": "actual",
          "error_messages": [],
          "export_name": "dd-actual-export",
          "export_path": "dd-export-path",
          "id": "string",
          "months": "integer",
          "scope": "/subscriptions/1234abcd-1234-abcd-1234-1234abcd1234",
          "status": "active",
          "status_updated_at": "string",
          "storage_account": "dd-storage-account",
          "storage_container": "dd-storage-container",
          "updated_at": "string"
        }
      ],
      "id": "string"
    },
    "id": "string",
    "type": "azure_uc_configs"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/azure_uc_config/${cloud_account_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "is_enabled": true }, "type": "azure_uc_config_patch_request" } } EOF
// Update Cloud Cost Management Azure config returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.AzureUCConfigPatchRequest{
		Data: datadogV2.AzureUCConfigPatchData{
			Attributes: &datadogV2.AzureUCConfigPatchRequestAttributes{
				IsEnabled: true,
			},
			Type: datadogV2.AZUREUCCONFIGPATCHREQUESTTYPE_AZURE_UC_CONFIG_PATCH_REQUEST,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.UpdateCostAzureUCConfigs(ctx, 100, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpdateCostAzureUCConfigs`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpdateCostAzureUCConfigs`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Update Cloud Cost Management Azure config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.AzureUCConfigPairsResponse;
import com.datadog.api.client.v2.model.AzureUCConfigPatchData;
import com.datadog.api.client.v2.model.AzureUCConfigPatchRequest;
import com.datadog.api.client.v2.model.AzureUCConfigPatchRequestAttributes;
import com.datadog.api.client.v2.model.AzureUCConfigPatchRequestType;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    AzureUCConfigPatchRequest body =
        new AzureUCConfigPatchRequest()
            .data(
                new AzureUCConfigPatchData()
                    .attributes(new AzureUCConfigPatchRequestAttributes().isEnabled(true))
                    .type(AzureUCConfigPatchRequestType.AZURE_UC_CONFIG_PATCH_REQUEST));

    try {
      AzureUCConfigPairsResponse result = apiInstance.updateCostAzureUCConfigs(100L, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#updateCostAzureUCConfigs");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Update Cloud Cost Management Azure config returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.azure_uc_config_patch_data import AzureUCConfigPatchData
from datadog_api_client.v2.model.azure_uc_config_patch_request import AzureUCConfigPatchRequest
from datadog_api_client.v2.model.azure_uc_config_patch_request_attributes import AzureUCConfigPatchRequestAttributes
from datadog_api_client.v2.model.azure_uc_config_patch_request_type import AzureUCConfigPatchRequestType

body = AzureUCConfigPatchRequest(
    data=AzureUCConfigPatchData(
        attributes=AzureUCConfigPatchRequestAttributes(
            is_enabled=True,
        ),
        type=AzureUCConfigPatchRequestType.AZURE_UC_CONFIG_PATCH_REQUEST,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.update_cost_azure_uc_configs(cloud_account_id=100, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Update Cloud Cost Management Azure config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::AzureUCConfigPatchRequest.new({
  data: DatadogAPIClient::V2::AzureUCConfigPatchData.new({
    attributes: DatadogAPIClient::V2::AzureUCConfigPatchRequestAttributes.new({
      is_enabled: true,
    }),
    type: DatadogAPIClient::V2::AzureUCConfigPatchRequestType::AZURE_UC_CONFIG_PATCH_REQUEST,
  }),
})
p api_instance.update_cost_azure_uc_configs(100, body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Update Cloud Cost Management Azure config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::AzureUCConfigPatchData;
use datadog_api_client::datadogV2::model::AzureUCConfigPatchRequest;
use datadog_api_client::datadogV2::model::AzureUCConfigPatchRequestAttributes;
use datadog_api_client::datadogV2::model::AzureUCConfigPatchRequestType;

#[tokio::main]
async fn main() {
    let body = AzureUCConfigPatchRequest::new(
        AzureUCConfigPatchData::new(AzureUCConfigPatchRequestType::AZURE_UC_CONFIG_PATCH_REQUEST)
            .attributes(AzureUCConfigPatchRequestAttributes::new(true)),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.update_cost_azure_uc_configs(100, body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Update Cloud Cost Management Azure config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiUpdateCostAzureUCConfigsRequest = {
  body: {
    data: {
      attributes: {
        isEnabled: true,
      },
      type: "azure_uc_config_patch_request",
    },
  },
  cloudAccountId: 100,
};

apiInstance
  .updateCostAzureUCConfigs(params)
  .then((data: v2.AzureUCConfigPairsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}

Overview

Archive a Cloud Cost Management Account. This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

Cloud Account id.

Response

No Content

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/azure_uc_config/${cloud_account_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete Cloud Cost Management Azure config returns "No Content" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.delete_cost_azure_uc_config(
        cloud_account_id=100,
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete Cloud Cost Management Azure config returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
api_instance.delete_cost_azure_uc_config(100)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete Cloud Cost Management Azure config returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.DeleteCostAzureUCConfig(ctx, 100)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteCostAzureUCConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete Cloud Cost Management Azure config returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      apiInstance.deleteCostAzureUCConfig(100L);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#deleteCostAzureUCConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Delete Cloud Cost Management Azure config returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.delete_cost_azure_uc_config(100).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Delete Cloud Cost Management Azure config returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiDeleteCostAzureUCConfigRequest = {
  cloudAccountId: 100,
};

apiInstance
  .deleteCostAzureUCConfig(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/azure_uc_config/{cloud_account_id}

Overview

Get a specific Azure config.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

The unique identifier of the cloud account

Response

OK

The definition of UCConfigPair object.

Expand All

Field

Type

Description

data

object

The definition of UCConfigPairData object.

attributes

object

The definition of UCConfigPairDataAttributes object.

configs

[object]

The attributes configs.

account_id

string

The items account_id.

client_id

string

The items client_id.

created_at

string

The items created_at.

dataset_type

string

The items dataset_type.

error_messages

[string]

The items error_messages.

export_name

string

The items export_name.

export_path

string

The items export_path.

id

string

The items id.

months

int64

The items months.

scope

string

The items scope.

status

string

The items status.

status_updated_at

string

The items status_updated_at.

storage_account

string

The items storage_account.

storage_container

string

The items storage_container.

updated_at

string

The items updated_at.

id

string

The UCConfigPairData id.

type [required]

enum

Azure UC configs resource type. Allowed enum values: azure_uc_configs

default: azure_uc_configs

{
  "data": {
    "attributes": {
      "configs": [
        {
          "account_id": "1234abcd-1234-abcd-1234-1234abcd1234",
          "client_id": "1234abcd-1234-abcd-1234-1234abcd1234",
          "created_at": "2023-01-01T12:00:00.000000",
          "dataset_type": "actual",
          "error_messages": [],
          "export_name": "dd-actual-export",
          "export_path": "dd-export-path",
          "id": "123456789123",
          "months": 36,
          "scope": "/subscriptions/1234abcd-1234-abcd-1234-1234abcd1234",
          "status": "active",
          "status_updated_at": "2023-01-01T12:00:00.000000",
          "storage_account": "dd-storage-account",
          "storage_container": "dd-storage-container",
          "updated_at": "2023-01-01T12:00:00.000000"
        }
      ]
    },
    "id": "123456789123",
    "type": "azure_uc_configs"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/azure_uc_config/${cloud_account_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get cost Azure UC config returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.get_cost_azure_uc_config(
        cloud_account_id=123456,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get cost Azure UC config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.get_cost_azure_uc_config(123456)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get cost Azure UC config returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.GetCostAzureUCConfig(ctx, 123456)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetCostAzureUCConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetCostAzureUCConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get cost Azure UC config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.UCConfigPair;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      UCConfigPair result = apiInstance.getCostAzureUCConfig(123456L);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#getCostAzureUCConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get cost Azure UC config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.get_cost_azure_uc_config(123456).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get cost Azure UC config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiGetCostAzureUCConfigRequest = {
  cloudAccountId: 123456,
};

apiInstance
  .getCostAzureUCConfig(params)
  .then((data: v2.UCConfigPair) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/gcp_uc_confighttps://api.ap2.datadoghq.com/api/v2/cost/gcp_uc_confighttps://api.datadoghq.eu/api/v2/cost/gcp_uc_confighttps://api.ddog-gov.com/api/v2/cost/gcp_uc_confighttps://api.us2.ddog-gov.com/api/v2/cost/gcp_uc_confighttps://api.datadoghq.com/api/v2/cost/gcp_uc_confighttps://api.us3.datadoghq.com/api/v2/cost/gcp_uc_confighttps://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config

Overview

List the Google Cloud Usage Cost configs. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Response

OK

List of Google Cloud Usage Cost configs.

Expand All

Field

Type

Description

data [required]

[object]

A Google Cloud Usage Cost config.

attributes [required]

object

Attributes for a Google Cloud Usage Cost config.

account_id [required]

string

The Google Cloud account ID.

bucket_name [required]

string

The Google Cloud bucket name used to store the Usage Cost export.

created_at

string

The timestamp when the Google Cloud Usage Cost config was created.

dataset [required]

string

The export dataset name used for the Google Cloud Usage Cost Report.

error_messages

[string]

The error messages for the Google Cloud Usage Cost config.

export_prefix [required]

string

The export prefix used for the Google Cloud Usage Cost Report.

export_project_name [required]

string

The name of the Google Cloud Usage Cost Report.

months

int32

DEPRECATED: The number of months the report has been backfilled.

project_id

string

The project_id of the Google Cloud Usage Cost report.

service_account [required]

string

The unique Google Cloud service account email.

status [required]

string

The status of the Google Cloud Usage Cost config.

status_updated_at

string

The timestamp when the Google Cloud Usage Cost config status was updated.

updated_at

string

The timestamp when the Google Cloud Usage Cost config status was updated.

id

string

The ID of the Google Cloud Usage Cost config.

type [required]

enum

Type of Google Cloud Usage Cost config. Allowed enum values: gcp_uc_config

default: gcp_uc_config

{
  "data": [
    {
      "attributes": {
        "account_id": "123456_A123BC_12AB34",
        "bucket_name": "dd-cost-bucket",
        "created_at": "string",
        "dataset": "billing",
        "error_messages": [],
        "export_prefix": "datadog_cloud_cost_usage_export",
        "export_project_name": "dd-cloud-cost-report",
        "months": "integer",
        "project_id": "my-project-123",
        "service_account": "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
        "status": "active",
        "status_updated_at": "string",
        "updated_at": "string"
      },
      "id": "string",
      "type": "gcp_uc_config"
    }
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
List Google Cloud Usage Cost configs returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_cost_gcp_usage_cost_configs()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# List Google Cloud Usage Cost configs returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_cost_gcp_usage_cost_configs()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// List Google Cloud Usage Cost configs returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListCostGCPUsageCostConfigs(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostGCPUsageCostConfigs`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostGCPUsageCostConfigs`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// List Google Cloud Usage Cost configs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.GCPUsageCostConfigsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      GCPUsageCostConfigsResponse result = apiInstance.listCostGCPUsageCostConfigs();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#listCostGCPUsageCostConfigs");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// List Google Cloud Usage Cost configs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.list_cost_gcp_usage_cost_configs().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * List Google Cloud Usage Cost configs returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .listCostGCPUsageCostConfigs()
  .then((data: v2.GCPUsageCostConfigsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/cost/gcp_uc_confighttps://api.ap2.datadoghq.com/api/v2/cost/gcp_uc_confighttps://api.datadoghq.eu/api/v2/cost/gcp_uc_confighttps://api.ddog-gov.com/api/v2/cost/gcp_uc_confighttps://api.us2.ddog-gov.com/api/v2/cost/gcp_uc_confighttps://api.datadoghq.com/api/v2/cost/gcp_uc_confighttps://api.us3.datadoghq.com/api/v2/cost/gcp_uc_confighttps://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config

Overview

Create a Cloud Cost Management account for an Google Cloud Usage Cost config. This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

object

Google Cloud Usage Cost config post data.

attributes

object

Attributes for Google Cloud Usage Cost config post request.

billing_account_id [required]

string

The Google Cloud account ID.

bucket_name [required]

string

The Google Cloud bucket name used to store the Usage Cost export.

export_dataset_name [required]

string

The export dataset name used for the Google Cloud Usage Cost report.

export_prefix

string

The export prefix used for the Google Cloud Usage Cost report.

export_project_name [required]

string

The name of the Google Cloud Usage Cost report.

service_account [required]

string

The unique Google Cloud service account email.

type [required]

enum

Type of Google Cloud Usage Cost config post request. Allowed enum values: gcp_uc_config_post_request

default: gcp_uc_config_post_request

{
  "data": {
    "attributes": {
      "billing_account_id": "123456_A123BC_12AB34",
      "bucket_name": "dd-cost-bucket",
      "export_dataset_name": "billing",
      "export_prefix": "datadog_cloud_cost_usage_export",
      "export_project_name": "dd-cloud-cost-report",
      "service_account": "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com"
    },
    "type": "gcp_uc_config_post_request"
  }
}

Response

OK

Response of Google Cloud Usage Cost config.

Expand All

Field

Type

Description

data

object

Google Cloud Usage Cost config.

attributes [required]

object

Attributes for a Google Cloud Usage Cost config.

account_id [required]

string

The Google Cloud account ID.

bucket_name [required]

string

The Google Cloud bucket name used to store the Usage Cost export.

created_at

string

The timestamp when the Google Cloud Usage Cost config was created.

dataset [required]

string

The export dataset name used for the Google Cloud Usage Cost Report.

error_messages

[string]

The error messages for the Google Cloud Usage Cost config.

export_prefix [required]

string

The export prefix used for the Google Cloud Usage Cost Report.

export_project_name [required]

string

The name of the Google Cloud Usage Cost Report.

months

int32

DEPRECATED: The number of months the report has been backfilled.

project_id

string

The project_id of the Google Cloud Usage Cost report.

service_account [required]

string

The unique Google Cloud service account email.

status [required]

string

The status of the Google Cloud Usage Cost config.

status_updated_at

string

The timestamp when the Google Cloud Usage Cost config status was updated.

updated_at

string

The timestamp when the Google Cloud Usage Cost config status was updated.

id

string

The ID of the Google Cloud Usage Cost config.

type [required]

enum

Type of Google Cloud Usage Cost config. Allowed enum values: gcp_uc_config

default: gcp_uc_config

{
  "data": {
    "attributes": {
      "account_id": "123456_A123BC_12AB34",
      "bucket_name": "dd-cost-bucket",
      "created_at": "string",
      "dataset": "billing",
      "error_messages": [],
      "export_prefix": "datadog_cloud_cost_usage_export",
      "export_project_name": "dd-cloud-cost-report",
      "months": "integer",
      "project_id": "my-project-123",
      "service_account": "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
      "status": "active",
      "status_updated_at": "string",
      "updated_at": "string"
    },
    "id": "string",
    "type": "gcp_uc_config"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "billing_account_id": "123456_A123BC_12AB34", "bucket_name": "dd-cost-bucket", "export_dataset_name": "billing", "export_prefix": "datadog_cloud_cost_usage_export", "export_project_name": "dd-cloud-cost-report", "service_account": "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com" }, "type": "gcp_uc_config_post_request" } } EOF
// Create Google Cloud Usage Cost config returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.GCPUsageCostConfigPostRequest{
		Data: datadogV2.GCPUsageCostConfigPostData{
			Attributes: &datadogV2.GCPUsageCostConfigPostRequestAttributes{
				BillingAccountId:  "123456_A123BC_12AB34",
				BucketName:        "dd-cost-bucket",
				ExportDatasetName: "billing",
				ExportPrefix:      datadog.PtrString("datadog_cloud_cost_usage_export"),
				ExportProjectName: "dd-cloud-cost-report",
				ServiceAccount:    "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
			},
			Type: datadogV2.GCPUSAGECOSTCONFIGPOSTREQUESTTYPE_GCP_USAGE_COST_CONFIG_POST_REQUEST,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.CreateCostGCPUsageCostConfig(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.CreateCostGCPUsageCostConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.CreateCostGCPUsageCostConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create Google Cloud Usage Cost config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.GCPUsageCostConfigPostData;
import com.datadog.api.client.v2.model.GCPUsageCostConfigPostRequest;
import com.datadog.api.client.v2.model.GCPUsageCostConfigPostRequestAttributes;
import com.datadog.api.client.v2.model.GCPUsageCostConfigPostRequestType;
import com.datadog.api.client.v2.model.GCPUsageCostConfigResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    GCPUsageCostConfigPostRequest body =
        new GCPUsageCostConfigPostRequest()
            .data(
                new GCPUsageCostConfigPostData()
                    .attributes(
                        new GCPUsageCostConfigPostRequestAttributes()
                            .billingAccountId("123456_A123BC_12AB34")
                            .bucketName("dd-cost-bucket")
                            .exportDatasetName("billing")
                            .exportPrefix("datadog_cloud_cost_usage_export")
                            .exportProjectName("dd-cloud-cost-report")
                            .serviceAccount(
                                "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com"))
                    .type(GCPUsageCostConfigPostRequestType.GCP_USAGE_COST_CONFIG_POST_REQUEST));

    try {
      GCPUsageCostConfigResponse result = apiInstance.createCostGCPUsageCostConfig(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#createCostGCPUsageCostConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create Google Cloud Usage Cost config returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.gcp_usage_cost_config_post_data import GCPUsageCostConfigPostData
from datadog_api_client.v2.model.gcp_usage_cost_config_post_request import GCPUsageCostConfigPostRequest
from datadog_api_client.v2.model.gcp_usage_cost_config_post_request_attributes import (
    GCPUsageCostConfigPostRequestAttributes,
)
from datadog_api_client.v2.model.gcp_usage_cost_config_post_request_type import GCPUsageCostConfigPostRequestType

body = GCPUsageCostConfigPostRequest(
    data=GCPUsageCostConfigPostData(
        attributes=GCPUsageCostConfigPostRequestAttributes(
            billing_account_id="123456_A123BC_12AB34",
            bucket_name="dd-cost-bucket",
            export_dataset_name="billing",
            export_prefix="datadog_cloud_cost_usage_export",
            export_project_name="dd-cloud-cost-report",
            service_account="dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
        ),
        type=GCPUsageCostConfigPostRequestType.GCP_USAGE_COST_CONFIG_POST_REQUEST,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.create_cost_gcp_usage_cost_config(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create Google Cloud Usage Cost config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::GCPUsageCostConfigPostRequest.new({
  data: DatadogAPIClient::V2::GCPUsageCostConfigPostData.new({
    attributes: DatadogAPIClient::V2::GCPUsageCostConfigPostRequestAttributes.new({
      billing_account_id: "123456_A123BC_12AB34",
      bucket_name: "dd-cost-bucket",
      export_dataset_name: "billing",
      export_prefix: "datadog_cloud_cost_usage_export",
      export_project_name: "dd-cloud-cost-report",
      service_account: "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
    }),
    type: DatadogAPIClient::V2::GCPUsageCostConfigPostRequestType::GCP_USAGE_COST_CONFIG_POST_REQUEST,
  }),
})
p api_instance.create_cost_gcp_usage_cost_config(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Create Google Cloud Usage Cost config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::GCPUsageCostConfigPostData;
use datadog_api_client::datadogV2::model::GCPUsageCostConfigPostRequest;
use datadog_api_client::datadogV2::model::GCPUsageCostConfigPostRequestAttributes;
use datadog_api_client::datadogV2::model::GCPUsageCostConfigPostRequestType;

#[tokio::main]
async fn main() {
    let body = GCPUsageCostConfigPostRequest::new(
        GCPUsageCostConfigPostData::new(
            GCPUsageCostConfigPostRequestType::GCP_USAGE_COST_CONFIG_POST_REQUEST,
        )
        .attributes(
            GCPUsageCostConfigPostRequestAttributes::new(
                "123456_A123BC_12AB34".to_string(),
                "dd-cost-bucket".to_string(),
                "billing".to_string(),
                "dd-cloud-cost-report".to_string(),
                "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com".to_string(),
            )
            .export_prefix("datadog_cloud_cost_usage_export".to_string()),
        ),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.create_cost_gcp_usage_cost_config(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Create Google Cloud Usage Cost config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiCreateCostGCPUsageCostConfigRequest = {
  body: {
    data: {
      attributes: {
        billingAccountId: "123456_A123BC_12AB34",
        bucketName: "dd-cost-bucket",
        exportDatasetName: "billing",
        exportPrefix: "datadog_cloud_cost_usage_export",
        exportProjectName: "dd-cloud-cost-report",
        serviceAccount:
          "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
      },
      type: "gcp_uc_config_post_request",
    },
  },
};

apiInstance
  .createCostGCPUsageCostConfig(params)
  .then((data: v2.GCPUsageCostConfigResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PATCH https://api.ap1.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}

Overview

Update the status of an Google Cloud Usage Cost config (active/archived). This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

Cloud Account id.

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

object

Google Cloud Usage Cost config patch data.

attributes [required]

object

Attributes for Google Cloud Usage Cost config patch request.

is_enabled [required]

boolean

Whether or not the Cloud Cost Management account is enabled.

type [required]

enum

Type of Google Cloud Usage Cost config patch request. Allowed enum values: gcp_uc_config_patch_request

default: gcp_uc_config_patch_request

{
  "data": {
    "attributes": {
      "is_enabled": true
    },
    "type": "gcp_uc_config_patch_request"
  }
}

Response

OK

Response of Google Cloud Usage Cost config.

Expand All

Field

Type

Description

data

object

Google Cloud Usage Cost config.

attributes [required]

object

Attributes for a Google Cloud Usage Cost config.

account_id [required]

string

The Google Cloud account ID.

bucket_name [required]

string

The Google Cloud bucket name used to store the Usage Cost export.

created_at

string

The timestamp when the Google Cloud Usage Cost config was created.

dataset [required]

string

The export dataset name used for the Google Cloud Usage Cost Report.

error_messages

[string]

The error messages for the Google Cloud Usage Cost config.

export_prefix [required]

string

The export prefix used for the Google Cloud Usage Cost Report.

export_project_name [required]

string

The name of the Google Cloud Usage Cost Report.

months

int32

DEPRECATED: The number of months the report has been backfilled.

project_id

string

The project_id of the Google Cloud Usage Cost report.

service_account [required]

string

The unique Google Cloud service account email.

status [required]

string

The status of the Google Cloud Usage Cost config.

status_updated_at

string

The timestamp when the Google Cloud Usage Cost config status was updated.

updated_at

string

The timestamp when the Google Cloud Usage Cost config status was updated.

id

string

The ID of the Google Cloud Usage Cost config.

type [required]

enum

Type of Google Cloud Usage Cost config. Allowed enum values: gcp_uc_config

default: gcp_uc_config

{
  "data": {
    "attributes": {
      "account_id": "123456_A123BC_12AB34",
      "bucket_name": "dd-cost-bucket",
      "created_at": "string",
      "dataset": "billing",
      "error_messages": [],
      "export_prefix": "datadog_cloud_cost_usage_export",
      "export_project_name": "dd-cloud-cost-report",
      "months": "integer",
      "project_id": "my-project-123",
      "service_account": "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
      "status": "active",
      "status_updated_at": "string",
      "updated_at": "string"
    },
    "id": "string",
    "type": "gcp_uc_config"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config/${cloud_account_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "is_enabled": true }, "type": "gcp_uc_config_patch_request" } } EOF
// Update Google Cloud Usage Cost config returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.GCPUsageCostConfigPatchRequest{
		Data: datadogV2.GCPUsageCostConfigPatchData{
			Attributes: datadogV2.GCPUsageCostConfigPatchRequestAttributes{
				IsEnabled: true,
			},
			Type: datadogV2.GCPUSAGECOSTCONFIGPATCHREQUESTTYPE_GCP_USAGE_COST_CONFIG_PATCH_REQUEST,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.UpdateCostGCPUsageCostConfig(ctx, 100, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpdateCostGCPUsageCostConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpdateCostGCPUsageCostConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Update Google Cloud Usage Cost config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchData;
import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchRequest;
import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchRequestAttributes;
import com.datadog.api.client.v2.model.GCPUsageCostConfigPatchRequestType;
import com.datadog.api.client.v2.model.GCPUsageCostConfigResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    GCPUsageCostConfigPatchRequest body =
        new GCPUsageCostConfigPatchRequest()
            .data(
                new GCPUsageCostConfigPatchData()
                    .attributes(new GCPUsageCostConfigPatchRequestAttributes().isEnabled(true))
                    .type(GCPUsageCostConfigPatchRequestType.GCP_USAGE_COST_CONFIG_PATCH_REQUEST));

    try {
      GCPUsageCostConfigResponse result = apiInstance.updateCostGCPUsageCostConfig(100L, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#updateCostGCPUsageCostConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Update Google Cloud Usage Cost config returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.gcp_usage_cost_config_patch_data import GCPUsageCostConfigPatchData
from datadog_api_client.v2.model.gcp_usage_cost_config_patch_request import GCPUsageCostConfigPatchRequest
from datadog_api_client.v2.model.gcp_usage_cost_config_patch_request_attributes import (
    GCPUsageCostConfigPatchRequestAttributes,
)
from datadog_api_client.v2.model.gcp_usage_cost_config_patch_request_type import GCPUsageCostConfigPatchRequestType

body = GCPUsageCostConfigPatchRequest(
    data=GCPUsageCostConfigPatchData(
        attributes=GCPUsageCostConfigPatchRequestAttributes(
            is_enabled=True,
        ),
        type=GCPUsageCostConfigPatchRequestType.GCP_USAGE_COST_CONFIG_PATCH_REQUEST,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.update_cost_gcp_usage_cost_config(cloud_account_id=100, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Update Google Cloud Usage Cost config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::GCPUsageCostConfigPatchRequest.new({
  data: DatadogAPIClient::V2::GCPUsageCostConfigPatchData.new({
    attributes: DatadogAPIClient::V2::GCPUsageCostConfigPatchRequestAttributes.new({
      is_enabled: true,
    }),
    type: DatadogAPIClient::V2::GCPUsageCostConfigPatchRequestType::GCP_USAGE_COST_CONFIG_PATCH_REQUEST,
  }),
})
p api_instance.update_cost_gcp_usage_cost_config(100, body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Update Google Cloud Usage Cost config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::GCPUsageCostConfigPatchData;
use datadog_api_client::datadogV2::model::GCPUsageCostConfigPatchRequest;
use datadog_api_client::datadogV2::model::GCPUsageCostConfigPatchRequestAttributes;
use datadog_api_client::datadogV2::model::GCPUsageCostConfigPatchRequestType;

#[tokio::main]
async fn main() {
    let body = GCPUsageCostConfigPatchRequest::new(GCPUsageCostConfigPatchData::new(
        GCPUsageCostConfigPatchRequestAttributes::new(true),
        GCPUsageCostConfigPatchRequestType::GCP_USAGE_COST_CONFIG_PATCH_REQUEST,
    ));
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.update_cost_gcp_usage_cost_config(100, body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Update Google Cloud Usage Cost config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiUpdateCostGCPUsageCostConfigRequest = {
  body: {
    data: {
      attributes: {
        isEnabled: true,
      },
      type: "gcp_uc_config_patch_request",
    },
  },
  cloudAccountId: 100,
};

apiInstance
  .updateCostGCPUsageCostConfig(params)
  .then((data: v2.GCPUsageCostConfigResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}

Overview

Archive a Cloud Cost Management account. This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

Cloud Account id.

Response

No Content

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config/${cloud_account_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete Google Cloud Usage Cost config returns "No Content" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.delete_cost_gcp_usage_cost_config(
        cloud_account_id=100,
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete Google Cloud Usage Cost config returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
api_instance.delete_cost_gcp_usage_cost_config(100)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete Google Cloud Usage Cost config returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.DeleteCostGCPUsageCostConfig(ctx, 100)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteCostGCPUsageCostConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete Google Cloud Usage Cost config returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      apiInstance.deleteCostGCPUsageCostConfig(100L);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#deleteCostGCPUsageCostConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Delete Google Cloud Usage Cost config returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.delete_cost_gcp_usage_cost_config(100).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Delete Google Cloud Usage Cost config returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiDeleteCostGCPUsageCostConfigRequest = {
  cloudAccountId: 100,
};

apiInstance
  .deleteCostGCPUsageCostConfig(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.ap2.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.datadoghq.eu/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.ddog-gov.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us2.ddog-gov.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us3.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}https://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config/{cloud_account_id}

Overview

Get a specific Google Cloud Usage Cost config.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

cloud_account_id [required]

integer

The unique identifier of the cloud account

Response

OK

The definition of GcpUcConfigResponse object.

Expand All

Field

Type

Description

data

object

The definition of GcpUcConfigResponseData object.

attributes

object

The definition of GcpUcConfigResponseDataAttributes object.

account_id

string

The attributes account_id.

bucket_name

string

The attributes bucket_name.

created_at

string

The attributes created_at.

dataset

string

The attributes dataset.

error_messages

[string]

The attributes error_messages.

export_prefix

string

The attributes export_prefix.

export_project_name

string

The attributes export_project_name.

months

int64

The attributes months.

project_id

string

The attributes project_id.

service_account

string

The attributes service_account.

status

string

The attributes status.

status_updated_at

string

The attributes status_updated_at.

updated_at

string

The attributes updated_at.

id

string

The GcpUcConfigResponseData id.

type [required]

enum

Google Cloud Usage Cost config resource type. Allowed enum values: gcp_uc_config

default: gcp_uc_config

{
  "data": {
    "attributes": {
      "account_id": "123456_A123BC_12AB34",
      "bucket_name": "dd-cost-bucket",
      "created_at": "2023-01-01T12:00:00.000000",
      "dataset": "billing",
      "error_messages": [],
      "export_prefix": "datadog_cloud_cost_usage_export",
      "export_project_name": "dd-cloud-cost-report",
      "months": 36,
      "project_id": "my-project-123",
      "service_account": "dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
      "status": "active",
      "status_updated_at": "2023-01-01T12:00:00.000000",
      "updated_at": "2023-01-01T12:00:00.000000"
    },
    "id": "123456789123",
    "type": "gcp_uc_config"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/gcp_uc_config/${cloud_account_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get Google Cloud Usage Cost config returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.get_cost_gcp_usage_cost_config(
        cloud_account_id=123456,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get Google Cloud Usage Cost config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.get_cost_gcp_usage_cost_config(123456)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get Google Cloud Usage Cost config returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.GetCostGCPUsageCostConfig(ctx, 123456)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetCostGCPUsageCostConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetCostGCPUsageCostConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get Google Cloud Usage Cost config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.GcpUcConfigResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      GcpUcConfigResponse result = apiInstance.getCostGCPUsageCostConfig(123456L);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#getCostGCPUsageCostConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get Google Cloud Usage Cost config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.get_cost_gcp_usage_cost_config(123456).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get Google Cloud Usage Cost config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiGetCostGCPUsageCostConfigRequest = {
  cloudAccountId: 123456,
};

apiInstance
  .getCostGCPUsageCostConfig(params)
  .then((data: v2.GcpUcConfigResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/tags/enrichmenthttps://api.ap2.datadoghq.com/api/v2/tags/enrichmenthttps://api.datadoghq.eu/api/v2/tags/enrichmenthttps://api.ddog-gov.com/api/v2/tags/enrichmenthttps://api.us2.ddog-gov.com/api/v2/tags/enrichmenthttps://api.datadoghq.com/api/v2/tags/enrichmenthttps://api.us3.datadoghq.com/api/v2/tags/enrichmenthttps://api.us5.datadoghq.com/api/v2/tags/enrichment

Overview

List all tag pipeline rulesets - Retrieve a list of all tag pipeline rulesets for the organization

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Response

OK

The definition of RulesetRespArray object.

Expand All

Field

Type

Description

data [required]

[object]

The RulesetRespArray data.

attributes

object

The definition of RulesetRespDataAttributes object.

created [required]

object

The definition of RulesetRespDataAttributesCreated object.

nanos

int32

The created nanos.

seconds

int64

The created seconds.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

modified [required]

object

The definition of RulesetRespDataAttributesModified object.

nanos

int32

The modified nanos.

seconds

int64

The modified seconds.

name [required]

string

The attributes name.

position [required]

int32

The attributes position.

processing_status

string

The attributes processing_status.

rules [required]

[object]

The attributes rules.

enabled [required]

boolean

The items enabled.

mapping

object

The definition of DataAttributesRulesItemsMapping object.

destination_key [required]

string

The mapping destination_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The mapping if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The mapping source_keys.

metadata

object

The items metadata.

<any-key>

string

name [required]

string

The items name.

query

object

The definition of RulesetRespDataAttributesRulesItemsQuery object.

addition [required]

object

The definition of RulesetRespDataAttributesRulesItemsQueryAddition object.

key [required]

string

The addition key.

value [required]

string

The addition value.

case_insensitivity

boolean

The query case_insensitivity.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The query if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

query [required]

string

The query query.

reference_table

object

The definition of RulesetRespDataAttributesRulesItemsReferenceTable object.

case_insensitivity

boolean

The reference_table case_insensitivity.

field_pairs [required]

[object]

The reference_table field_pairs.

input_column [required]

string

The items input_column.

output_key [required]

string

The items output_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The reference_table if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The reference_table source_keys.

table_name [required]

string

The reference_table table_name.

version [required]

int64

The attributes version.

id

string

The RulesetRespData id.

type [required]

enum

Ruleset resource type. Allowed enum values: ruleset

default: ruleset

{
  "data": [
    {
      "attributes": {
        "created": null,
        "enabled": true,
        "last_modified_user_uuid": "",
        "modified": null,
        "name": "Production Cost Allocation Rules",
        "position": 0,
        "rules": [
          {
            "enabled": true,
            "mapping": null,
            "metadata": null,
            "name": "AWS Production Account Tagging",
            "query": {
              "addition": {
                "key": "environment",
                "value": "production"
              },
              "case_insensitivity": false,
              "if_tag_exists": "do_not_apply",
              "query": "billingcurrency:\"USD\" AND account_name:\"prod-account\""
            },
            "reference_table": null
          },
          {
            "enabled": true,
            "mapping": {
              "destination_key": "team_owner",
              "if_tag_exists": "do_not_apply",
              "source_keys": [
                "account_name",
                "service"
              ]
            },
            "metadata": null,
            "name": "Team Mapping Rule",
            "query": null,
            "reference_table": null
          },
          {
            "enabled": true,
            "mapping": null,
            "metadata": null,
            "name": "New table rule with new UI",
            "query": null,
            "reference_table": {
              "case_insensitivity": true,
              "field_pairs": [
                {
                  "input_column": "status_type",
                  "output_key": "status"
                },
                {
                  "input_column": "status_description",
                  "output_key": "dess"
                }
              ],
              "if_tag_exists": "append",
              "source_keys": [
                "http_status",
                "status_description"
              ],
              "table_name": "http_status_codes"
            }
          }
        ],
        "version": 2
      },
      "id": "55ef2385-9ae1-4410-90c4-5ac1b60fec10",
      "type": "ruleset"
    },
    {
      "attributes": {
        "created": null,
        "enabled": true,
        "last_modified_user_uuid": "",
        "modified": null,
        "name": "Development Environment Rules",
        "position": 0,
        "rules": [
          {
            "enabled": true,
            "mapping": null,
            "metadata": null,
            "name": "Dev Account Cost Center",
            "query": {
              "addition": {
                "key": "cost_center",
                "value": "engineering"
              },
              "case_insensitivity": true,
              "if_tag_exists": "do_not_apply",
              "query": "account_name:\"dev-*\""
            },
            "reference_table": null
          }
        ],
        "version": 1
      },
      "id": "a7b8c9d0-1234-5678-9abc-def012345678",
      "type": "ruleset"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
List tag pipeline rulesets returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_tag_pipelines_rulesets()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# List tag pipeline rulesets returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_tag_pipelines_rulesets()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// List tag pipeline rulesets returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListTagPipelinesRulesets(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListTagPipelinesRulesets`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListTagPipelinesRulesets`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// List tag pipeline rulesets returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.RulesetRespArray;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      RulesetRespArray result = apiInstance.listTagPipelinesRulesets();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#listTagPipelinesRulesets");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// List tag pipeline rulesets returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.list_tag_pipelines_rulesets().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * List tag pipeline rulesets returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .listTagPipelinesRulesets()
  .then((data: v2.RulesetRespArray) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/tags/enrichmenthttps://api.ap2.datadoghq.com/api/v2/tags/enrichmenthttps://api.datadoghq.eu/api/v2/tags/enrichmenthttps://api.ddog-gov.com/api/v2/tags/enrichmenthttps://api.us2.ddog-gov.com/api/v2/tags/enrichmenthttps://api.datadoghq.com/api/v2/tags/enrichmenthttps://api.us3.datadoghq.com/api/v2/tags/enrichmenthttps://api.us5.datadoghq.com/api/v2/tags/enrichment

Overview

Create a new tag pipeline ruleset with the specified rules and configuration

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

data

object

The definition of CreateRulesetRequestData object.

attributes

object

The definition of CreateRulesetRequestDataAttributes object.

enabled

boolean

The attributes enabled.

rules [required]

[object]

The attributes rules.

enabled [required]

boolean

The items enabled.

mapping

object

The definition of DataAttributesRulesItemsMapping object.

destination_key [required]

string

The mapping destination_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The mapping if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The mapping source_keys.

metadata

object

The items metadata.

<any-key>

string

name [required]

string

The items name.

query

object

The definition of CreateRulesetRequestDataAttributesRulesItemsQuery object.

addition [required]

object

The definition of CreateRulesetRequestDataAttributesRulesItemsQueryAddition object.

key [required]

string

The addition key.

value [required]

string

The addition value.

case_insensitivity

boolean

The query case_insensitivity.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The query if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

query [required]

string

The query query.

reference_table

object

The definition of CreateRulesetRequestDataAttributesRulesItemsReferenceTable object.

case_insensitivity

boolean

The reference_table case_insensitivity.

field_pairs [required]

[object]

The reference_table field_pairs.

input_column [required]

string

The items input_column.

output_key [required]

string

The items output_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The reference_table if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The reference_table source_keys.

table_name [required]

string

The reference_table table_name.

id

string

The CreateRulesetRequestData id.

type [required]

enum

Create ruleset resource type. Allowed enum values: create_ruleset

default: create_ruleset

{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}

Response

OK

The definition of RulesetResp object.

Expand All

Field

Type

Description

data

object

The definition of RulesetRespData object.

attributes

object

The definition of RulesetRespDataAttributes object.

created [required]

object

The definition of RulesetRespDataAttributesCreated object.

nanos

int32

The created nanos.

seconds

int64

The created seconds.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

modified [required]

object

The definition of RulesetRespDataAttributesModified object.

nanos

int32

The modified nanos.

seconds

int64

The modified seconds.

name [required]

string

The attributes name.

position [required]

int32

The attributes position.

processing_status

string

The attributes processing_status.

rules [required]

[object]

The attributes rules.

enabled [required]

boolean

The items enabled.

mapping

object

The definition of DataAttributesRulesItemsMapping object.

destination_key [required]

string

The mapping destination_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The mapping if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The mapping source_keys.

metadata

object

The items metadata.

<any-key>

string

name [required]

string

The items name.

query

object

The definition of RulesetRespDataAttributesRulesItemsQuery object.

addition [required]

object

The definition of RulesetRespDataAttributesRulesItemsQueryAddition object.

key [required]

string

The addition key.

value [required]

string

The addition value.

case_insensitivity

boolean

The query case_insensitivity.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The query if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

query [required]

string

The query query.

reference_table

object

The definition of RulesetRespDataAttributesRulesItemsReferenceTable object.

case_insensitivity

boolean

The reference_table case_insensitivity.

field_pairs [required]

[object]

The reference_table field_pairs.

input_column [required]

string

The items input_column.

output_key [required]

string

The items output_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The reference_table if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The reference_table source_keys.

table_name [required]

string

The reference_table table_name.

version [required]

int64

The attributes version.

id

string

The RulesetRespData id.

type [required]

enum

Ruleset resource type. Allowed enum values: ruleset

default: ruleset

{
  "data": {
    "attributes": {
      "created": null,
      "enabled": true,
      "last_modified_user_uuid": "",
      "modified": null,
      "name": "Example Ruleset",
      "position": 0,
      "rules": [
        {
          "enabled": false,
          "mapping": null,
          "metadata": null,
          "name": "RC test rule edited1",
          "query": {
            "addition": {
              "key": "abc",
              "value": "ww"
            },
            "case_insensitivity": false,
            "if_tag_exists": "do_not_apply",
            "query": "billingcurrency:\"USD\" AND account_name:\"SZA96462\" AND billingcurrency:\"USD\""
          },
          "reference_table": null
        },
        {
          "enabled": true,
          "mapping": {
            "destination_key": "h",
            "if_tag_exists": "do_not_apply",
            "source_keys": [
              "accountname",
              "accountownerid"
            ]
          },
          "metadata": null,
          "name": "rule with empty source key",
          "query": null,
          "reference_table": null
        },
        {
          "enabled": true,
          "mapping": null,
          "metadata": null,
          "name": "New table rule with new UI",
          "query": null,
          "reference_table": {
            "case_insensitivity": true,
            "field_pairs": [
              {
                "input_column": "status_type",
                "output_key": "status"
              },
              {
                "input_column": "status_description",
                "output_key": "dess"
              }
            ],
            "if_tag_exists": "append",
            "source_keys": [
              "http_status",
              "status_description"
            ],
            "table_name": "http_status_codes"
          }
        }
      ],
      "version": 1
    },
    "id": "12345",
    "type": "ruleset"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "enabled": true, "rules": [ { "enabled": true, "name": "Add Cost Center Tag", "query": { "addition": { "key": "cost_center", "value": "engineering" }, "case_insensitivity": false, "if_tag_exists": "do_not_apply", "query": "account_id:\"123456789\" AND service:\"web-api\"" } } ] }, "id": "New Ruleset", "type": "create_ruleset" } } EOF
                          ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "enabled": true, "rules": [ { "enabled": true, "name": "Add Cost Center Tag", "query": { "addition": { "key": "cost_center", "value": "engineering" }, "case_insensitivity": false, "if_tag_exists": "do_not_apply", "query": "account_id:\"123456789\" AND service:\"web-api\"" } } ] }, "id": "New Ruleset", "type": "create_ruleset" } } EOF
// Create tag pipeline ruleset returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.CreateRulesetRequest{
		Data: &datadogV2.CreateRulesetRequestData{
			Attributes: &datadogV2.CreateRulesetRequestDataAttributes{
				Enabled: datadog.PtrBool(true),
				Rules: []datadogV2.CreateRulesetRequestDataAttributesRulesItems{
					{
						Enabled: true,
						Mapping: *datadogV2.NewNullableDataAttributesRulesItemsMapping(nil),
						Name:    "Add Cost Center Tag",
						Query: *datadogV2.NewNullableCreateRulesetRequestDataAttributesRulesItemsQuery(&datadogV2.CreateRulesetRequestDataAttributesRulesItemsQuery{
							Addition: *datadogV2.NewNullableCreateRulesetRequestDataAttributesRulesItemsQueryAddition(&datadogV2.CreateRulesetRequestDataAttributesRulesItemsQueryAddition{
								Key:   "cost_center",
								Value: "engineering",
							}),
							CaseInsensitivity: datadog.PtrBool(false),
							IfNotExists:       datadog.PtrBool(true),
							Query:             `account_id:"123456789" AND service:"web-api"`,
						}),
						ReferenceTable: *datadogV2.NewNullableCreateRulesetRequestDataAttributesRulesItemsReferenceTable(nil),
					},
				},
			},
			Id:   datadog.PtrString("New Ruleset"),
			Type: datadogV2.CREATERULESETREQUESTDATATYPE_CREATE_RULESET,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.CreateTagPipelinesRuleset(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.CreateTagPipelinesRuleset`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.CreateTagPipelinesRuleset`:\n%s\n", responseContent)
}
// Create tag pipeline ruleset with if_tag_exists returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.CreateRulesetRequest{
		Data: &datadogV2.CreateRulesetRequestData{
			Attributes: &datadogV2.CreateRulesetRequestDataAttributes{
				Enabled: datadog.PtrBool(true),
				Rules: []datadogV2.CreateRulesetRequestDataAttributesRulesItems{
					{
						Enabled: true,
						Mapping: *datadogV2.NewNullableDataAttributesRulesItemsMapping(nil),
						Name:    "Add Cost Center Tag",
						Query: *datadogV2.NewNullableCreateRulesetRequestDataAttributesRulesItemsQuery(&datadogV2.CreateRulesetRequestDataAttributesRulesItemsQuery{
							Addition: *datadogV2.NewNullableCreateRulesetRequestDataAttributesRulesItemsQueryAddition(&datadogV2.CreateRulesetRequestDataAttributesRulesItemsQueryAddition{
								Key:   "cost_center",
								Value: "engineering",
							}),
							CaseInsensitivity: datadog.PtrBool(false),
							IfTagExists:       datadogV2.DATAATTRIBUTESRULESITEMSIFTAGEXISTS_REPLACE.Ptr(),
							Query:             `account_id:"123456789" AND service:"web-api"`,
						}),
						ReferenceTable: *datadogV2.NewNullableCreateRulesetRequestDataAttributesRulesItemsReferenceTable(nil),
					},
				},
			},
			Id:   datadog.PtrString("New Ruleset"),
			Type: datadogV2.CREATERULESETREQUESTDATATYPE_CREATE_RULESET,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.CreateTagPipelinesRuleset(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.CreateTagPipelinesRuleset`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.CreateTagPipelinesRuleset`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create tag pipeline ruleset returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.CreateRulesetRequest;
import com.datadog.api.client.v2.model.CreateRulesetRequestData;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataAttributes;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataAttributesRulesItems;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataAttributesRulesItemsQuery;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataAttributesRulesItemsQueryAddition;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataType;
import com.datadog.api.client.v2.model.RulesetResp;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    CreateRulesetRequest body =
        new CreateRulesetRequest()
            .data(
                new CreateRulesetRequestData()
                    .attributes(
                        new CreateRulesetRequestDataAttributes()
                            .enabled(true)
                            .rules(
                                Collections.singletonList(
                                    new CreateRulesetRequestDataAttributesRulesItems()
                                        .enabled(true)
                                        .mapping(null)
                                        .name("Add Cost Center Tag")
                                        .query(
                                            new CreateRulesetRequestDataAttributesRulesItemsQuery()
                                                .addition(
                                                    new CreateRulesetRequestDataAttributesRulesItemsQueryAddition()
                                                        .key("cost_center")
                                                        .value("engineering"))
                                                .caseInsensitivity(false)
                                                .ifNotExists(true)
                                                .query(
                                                    """
account_id:"123456789" AND service:"web-api"
"""))
                                        .referenceTable(null))))
                    .id("New Ruleset")
                    .type(CreateRulesetRequestDataType.CREATE_RULESET));

    try {
      RulesetResp result = apiInstance.createTagPipelinesRuleset(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#createTagPipelinesRuleset");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// Create tag pipeline ruleset with if_tag_exists returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.CreateRulesetRequest;
import com.datadog.api.client.v2.model.CreateRulesetRequestData;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataAttributes;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataAttributesRulesItems;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataAttributesRulesItemsQuery;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataAttributesRulesItemsQueryAddition;
import com.datadog.api.client.v2.model.CreateRulesetRequestDataType;
import com.datadog.api.client.v2.model.DataAttributesRulesItemsIfTagExists;
import com.datadog.api.client.v2.model.RulesetResp;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    CreateRulesetRequest body =
        new CreateRulesetRequest()
            .data(
                new CreateRulesetRequestData()
                    .attributes(
                        new CreateRulesetRequestDataAttributes()
                            .enabled(true)
                            .rules(
                                Collections.singletonList(
                                    new CreateRulesetRequestDataAttributesRulesItems()
                                        .enabled(true)
                                        .mapping(null)
                                        .name("Add Cost Center Tag")
                                        .query(
                                            new CreateRulesetRequestDataAttributesRulesItemsQuery()
                                                .addition(
                                                    new CreateRulesetRequestDataAttributesRulesItemsQueryAddition()
                                                        .key("cost_center")
                                                        .value("engineering"))
                                                .caseInsensitivity(false)
                                                .ifTagExists(
                                                    DataAttributesRulesItemsIfTagExists.REPLACE)
                                                .query(
                                                    """
account_id:"123456789" AND service:"web-api"
"""))
                                        .referenceTable(null))))
                    .id("New Ruleset")
                    .type(CreateRulesetRequestDataType.CREATE_RULESET));

    try {
      RulesetResp result = apiInstance.createTagPipelinesRuleset(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#createTagPipelinesRuleset");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create tag pipeline ruleset returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.create_ruleset_request import CreateRulesetRequest
from datadog_api_client.v2.model.create_ruleset_request_data import CreateRulesetRequestData
from datadog_api_client.v2.model.create_ruleset_request_data_attributes import CreateRulesetRequestDataAttributes
from datadog_api_client.v2.model.create_ruleset_request_data_attributes_rules_items import (
    CreateRulesetRequestDataAttributesRulesItems,
)
from datadog_api_client.v2.model.create_ruleset_request_data_attributes_rules_items_query import (
    CreateRulesetRequestDataAttributesRulesItemsQuery,
)
from datadog_api_client.v2.model.create_ruleset_request_data_attributes_rules_items_query_addition import (
    CreateRulesetRequestDataAttributesRulesItemsQueryAddition,
)
from datadog_api_client.v2.model.create_ruleset_request_data_type import CreateRulesetRequestDataType

body = CreateRulesetRequest(
    data=CreateRulesetRequestData(
        attributes=CreateRulesetRequestDataAttributes(
            enabled=True,
            rules=[
                CreateRulesetRequestDataAttributesRulesItems(
                    enabled=True,
                    mapping=None,
                    name="Add Cost Center Tag",
                    query=CreateRulesetRequestDataAttributesRulesItemsQuery(
                        addition=CreateRulesetRequestDataAttributesRulesItemsQueryAddition(
                            key="cost_center",
                            value="engineering",
                        ),
                        case_insensitivity=False,
                        if_not_exists=True,
                        query='account_id:"123456789" AND service:"web-api"',
                    ),
                    reference_table=None,
                ),
            ],
        ),
        id="New Ruleset",
        type=CreateRulesetRequestDataType.CREATE_RULESET,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.create_tag_pipelines_ruleset(body=body)

    print(response)
"""
Create tag pipeline ruleset with if_tag_exists returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.create_ruleset_request import CreateRulesetRequest
from datadog_api_client.v2.model.create_ruleset_request_data import CreateRulesetRequestData
from datadog_api_client.v2.model.create_ruleset_request_data_attributes import CreateRulesetRequestDataAttributes
from datadog_api_client.v2.model.create_ruleset_request_data_attributes_rules_items import (
    CreateRulesetRequestDataAttributesRulesItems,
)
from datadog_api_client.v2.model.create_ruleset_request_data_attributes_rules_items_query import (
    CreateRulesetRequestDataAttributesRulesItemsQuery,
)
from datadog_api_client.v2.model.create_ruleset_request_data_attributes_rules_items_query_addition import (
    CreateRulesetRequestDataAttributesRulesItemsQueryAddition,
)
from datadog_api_client.v2.model.create_ruleset_request_data_type import CreateRulesetRequestDataType
from datadog_api_client.v2.model.data_attributes_rules_items_if_tag_exists import DataAttributesRulesItemsIfTagExists

body = CreateRulesetRequest(
    data=CreateRulesetRequestData(
        attributes=CreateRulesetRequestDataAttributes(
            enabled=True,
            rules=[
                CreateRulesetRequestDataAttributesRulesItems(
                    enabled=True,
                    mapping=None,
                    name="Add Cost Center Tag",
                    query=CreateRulesetRequestDataAttributesRulesItemsQuery(
                        addition=CreateRulesetRequestDataAttributesRulesItemsQueryAddition(
                            key="cost_center",
                            value="engineering",
                        ),
                        case_insensitivity=False,
                        if_tag_exists=DataAttributesRulesItemsIfTagExists.REPLACE,
                        query='account_id:"123456789" AND service:"web-api"',
                    ),
                    reference_table=None,
                ),
            ],
        ),
        id="New Ruleset",
        type=CreateRulesetRequestDataType.CREATE_RULESET,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.create_tag_pipelines_ruleset(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create tag pipeline ruleset returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::CreateRulesetRequest.new({
  data: DatadogAPIClient::V2::CreateRulesetRequestData.new({
    attributes: DatadogAPIClient::V2::CreateRulesetRequestDataAttributes.new({
      enabled: true,
      rules: [
        DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItems.new({
          enabled: true,
          mapping: nil,
          name: "Add Cost Center Tag",
          query: DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItemsQuery.new({
            addition: DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItemsQueryAddition.new({
              key: "cost_center",
              value: "engineering",
            }),
            case_insensitivity: false,
            if_not_exists: true,
            query: 'account_id:"123456789" AND service:"web-api"',
          }),
          reference_table: nil,
        }),
      ],
    }),
    id: "New Ruleset",
    type: DatadogAPIClient::V2::CreateRulesetRequestDataType::CREATE_RULESET,
  }),
})
p api_instance.create_tag_pipelines_ruleset(body)
# Create tag pipeline ruleset with if_tag_exists returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::CreateRulesetRequest.new({
  data: DatadogAPIClient::V2::CreateRulesetRequestData.new({
    attributes: DatadogAPIClient::V2::CreateRulesetRequestDataAttributes.new({
      enabled: true,
      rules: [
        DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItems.new({
          enabled: true,
          mapping: nil,
          name: "Add Cost Center Tag",
          query: DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItemsQuery.new({
            addition: DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItemsQueryAddition.new({
              key: "cost_center",
              value: "engineering",
            }),
            case_insensitivity: false,
            if_tag_exists: DatadogAPIClient::V2::DataAttributesRulesItemsIfTagExists::REPLACE,
            query: 'account_id:"123456789" AND service:"web-api"',
          }),
          reference_table: nil,
        }),
      ],
    }),
    id: "New Ruleset",
    type: DatadogAPIClient::V2::CreateRulesetRequestDataType::CREATE_RULESET,
  }),
})
p api_instance.create_tag_pipelines_ruleset(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Create tag pipeline ruleset returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::CreateRulesetRequest;
use datadog_api_client::datadogV2::model::CreateRulesetRequestData;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataAttributes;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataAttributesRulesItems;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataAttributesRulesItemsQuery;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataAttributesRulesItemsQueryAddition;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataType;

#[tokio::main]
async fn main() {
    let body = CreateRulesetRequest::new().data(
        CreateRulesetRequestData::new(CreateRulesetRequestDataType::CREATE_RULESET)
            .attributes(
                CreateRulesetRequestDataAttributes::new(vec![
                    CreateRulesetRequestDataAttributesRulesItems::new(
                        true,
                        "Add Cost Center Tag".to_string(),
                    )
                    .mapping(None)
                    .query(Some(
                        CreateRulesetRequestDataAttributesRulesItemsQuery::new(
                            Some(
                                CreateRulesetRequestDataAttributesRulesItemsQueryAddition::new(
                                    "cost_center".to_string(),
                                    "engineering".to_string(),
                                ),
                            ),
                            r#"account_id:"123456789" AND service:"web-api""#.to_string(),
                        )
                        .case_insensitivity(false)
                        .if_not_exists(true),
                    ))
                    .reference_table(None),
                ])
                .enabled(true),
            )
            .id("New Ruleset".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.create_tag_pipelines_ruleset(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
// Create tag pipeline ruleset with if_tag_exists returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::CreateRulesetRequest;
use datadog_api_client::datadogV2::model::CreateRulesetRequestData;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataAttributes;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataAttributesRulesItems;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataAttributesRulesItemsQuery;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataAttributesRulesItemsQueryAddition;
use datadog_api_client::datadogV2::model::CreateRulesetRequestDataType;
use datadog_api_client::datadogV2::model::DataAttributesRulesItemsIfTagExists;

#[tokio::main]
async fn main() {
    let body = CreateRulesetRequest::new().data(
        CreateRulesetRequestData::new(CreateRulesetRequestDataType::CREATE_RULESET)
            .attributes(
                CreateRulesetRequestDataAttributes::new(vec![
                    CreateRulesetRequestDataAttributesRulesItems::new(
                        true,
                        "Add Cost Center Tag".to_string(),
                    )
                    .mapping(None)
                    .query(Some(
                        CreateRulesetRequestDataAttributesRulesItemsQuery::new(
                            Some(
                                CreateRulesetRequestDataAttributesRulesItemsQueryAddition::new(
                                    "cost_center".to_string(),
                                    "engineering".to_string(),
                                ),
                            ),
                            r#"account_id:"123456789" AND service:"web-api""#.to_string(),
                        )
                        .case_insensitivity(false)
                        .if_tag_exists(DataAttributesRulesItemsIfTagExists::REPLACE),
                    ))
                    .reference_table(None),
                ])
                .enabled(true),
            )
            .id("New Ruleset".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.create_tag_pipelines_ruleset(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Create tag pipeline ruleset returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiCreateTagPipelinesRulesetRequest = {
  body: {
    data: {
      attributes: {
        enabled: true,
        rules: [
          {
            enabled: true,
            mapping: undefined,
            name: "Add Cost Center Tag",
            query: {
              addition: {
                key: "cost_center",
                value: "engineering",
              },
              caseInsensitivity: false,
              ifNotExists: true,
              query: `account_id:"123456789" AND service:"web-api"`,
            },
            referenceTable: undefined,
          },
        ],
      },
      id: "New Ruleset",
      type: "create_ruleset",
    },
  },
};

apiInstance
  .createTagPipelinesRuleset(params)
  .then((data: v2.RulesetResp) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Create tag pipeline ruleset with if_tag_exists returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiCreateTagPipelinesRulesetRequest = {
  body: {
    data: {
      attributes: {
        enabled: true,
        rules: [
          {
            enabled: true,
            mapping: undefined,
            name: "Add Cost Center Tag",
            query: {
              addition: {
                key: "cost_center",
                value: "engineering",
              },
              caseInsensitivity: false,
              ifTagExists: "replace",
              query: `account_id:"123456789" AND service:"web-api"`,
            },
            referenceTable: undefined,
          },
        ],
      },
      id: "New Ruleset",
      type: "create_ruleset",
    },
  },
};

apiInstance
  .createTagPipelinesRuleset(params)
  .then((data: v2.RulesetResp) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PATCH https://api.ap1.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.ap2.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.datadoghq.eu/api/v2/tags/enrichment/{ruleset_id}https://api.ddog-gov.com/api/v2/tags/enrichment/{ruleset_id}https://api.us2.ddog-gov.com/api/v2/tags/enrichment/{ruleset_id}https://api.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.us3.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.us5.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}

Overview

Update a tag pipeline ruleset - Update an existing tag pipeline ruleset with new rules and configuration

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

ruleset_id [required]

string

The unique identifier of the ruleset

Request

Body Data (required)

Expand All

Field

Type

Description

data

object

The definition of UpdateRulesetRequestData object.

attributes

object

The definition of UpdateRulesetRequestDataAttributes object.

enabled [required]

boolean

The attributes enabled.

last_version

int64

The attributes last_version.

rules [required]

[object]

The attributes rules.

enabled [required]

boolean

The items enabled.

mapping

object

The definition of DataAttributesRulesItemsMapping object.

destination_key [required]

string

The mapping destination_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The mapping if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The mapping source_keys.

metadata

object

The items metadata.

<any-key>

string

name [required]

string

The items name.

query

object

The definition of UpdateRulesetRequestDataAttributesRulesItemsQuery object.

addition [required]

object

The definition of UpdateRulesetRequestDataAttributesRulesItemsQueryAddition object.

key [required]

string

The addition key.

value [required]

string

The addition value.

case_insensitivity

boolean

The query case_insensitivity.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The query if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

query [required]

string

The query query.

reference_table

object

The definition of UpdateRulesetRequestDataAttributesRulesItemsReferenceTable object.

case_insensitivity

boolean

The reference_table case_insensitivity.

field_pairs [required]

[object]

The reference_table field_pairs.

input_column [required]

string

The items input_column.

output_key [required]

string

The items output_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The reference_table if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The reference_table source_keys.

table_name [required]

string

The reference_table table_name.

id

string

The UpdateRulesetRequestData id.

type [required]

enum

Update ruleset resource type. Allowed enum values: update_ruleset

default: update_ruleset

{
  "data": {
    "attributes": {
      "enabled": true,
      "last_version": 3611102,
      "rules": [
        {
          "enabled": true,
          "mapping": {
            "destination_key": "team_owner",
            "if_not_exists": true,
            "source_keys": [
              "account_name",
              "account_id"
            ]
          },
          "name": "Account Name Mapping",
          "query": null,
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "update_ruleset"
  }
}
{
  "data": {
    "attributes": {
      "enabled": true,
      "last_version": 3611102,
      "rules": [
        {
          "enabled": true,
          "mapping": {
            "destination_key": "team_owner",
            "if_tag_exists": "replace",
            "source_keys": [
              "account_name",
              "account_id"
            ]
          },
          "name": "Account Name Mapping",
          "query": null,
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "update_ruleset"
  }
}

Response

OK

The definition of RulesetResp object.

Expand All

Field

Type

Description

data

object

The definition of RulesetRespData object.

attributes

object

The definition of RulesetRespDataAttributes object.

created [required]

object

The definition of RulesetRespDataAttributesCreated object.

nanos

int32

The created nanos.

seconds

int64

The created seconds.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

modified [required]

object

The definition of RulesetRespDataAttributesModified object.

nanos

int32

The modified nanos.

seconds

int64

The modified seconds.

name [required]

string

The attributes name.

position [required]

int32

The attributes position.

processing_status

string

The attributes processing_status.

rules [required]

[object]

The attributes rules.

enabled [required]

boolean

The items enabled.

mapping

object

The definition of DataAttributesRulesItemsMapping object.

destination_key [required]

string

The mapping destination_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The mapping if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The mapping source_keys.

metadata

object

The items metadata.

<any-key>

string

name [required]

string

The items name.

query

object

The definition of RulesetRespDataAttributesRulesItemsQuery object.

addition [required]

object

The definition of RulesetRespDataAttributesRulesItemsQueryAddition object.

key [required]

string

The addition key.

value [required]

string

The addition value.

case_insensitivity

boolean

The query case_insensitivity.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The query if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

query [required]

string

The query query.

reference_table

object

The definition of RulesetRespDataAttributesRulesItemsReferenceTable object.

case_insensitivity

boolean

The reference_table case_insensitivity.

field_pairs [required]

[object]

The reference_table field_pairs.

input_column [required]

string

The items input_column.

output_key [required]

string

The items output_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The reference_table if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The reference_table source_keys.

table_name [required]

string

The reference_table table_name.

version [required]

int64

The attributes version.

id

string

The RulesetRespData id.

type [required]

enum

Ruleset resource type. Allowed enum values: ruleset

default: ruleset

{
  "data": {
    "attributes": {
      "created": null,
      "enabled": true,
      "last_modified_user_uuid": "",
      "modified": null,
      "name": "Example Ruleset",
      "position": 0,
      "rules": [
        {
          "enabled": false,
          "mapping": null,
          "metadata": null,
          "name": "RC test rule edited1",
          "query": {
            "addition": {
              "key": "abc",
              "value": "ww"
            },
            "case_insensitivity": false,
            "if_tag_exists": "do_not_apply",
            "query": "billingcurrency:\"USD\" AND account_name:\"SZA96462\" AND billingcurrency:\"USD\""
          },
          "reference_table": null
        },
        {
          "enabled": true,
          "mapping": {
            "destination_key": "h",
            "if_tag_exists": "do_not_apply",
            "source_keys": [
              "accountname",
              "accountownerid"
            ]
          },
          "metadata": null,
          "name": "rule with empty source key",
          "query": null,
          "reference_table": null
        },
        {
          "enabled": true,
          "mapping": null,
          "metadata": null,
          "name": "New table rule with new UI",
          "query": null,
          "reference_table": {
            "case_insensitivity": true,
            "field_pairs": [
              {
                "input_column": "status_type",
                "output_key": "status"
              },
              {
                "input_column": "status_description",
                "output_key": "dess"
              }
            ],
            "if_tag_exists": "append",
            "source_keys": [
              "http_status",
              "status_description"
            ],
            "table_name": "http_status_codes"
          }
        }
      ],
      "version": 1
    },
    "id": "12345",
    "type": "ruleset"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Path parameters
export ruleset_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment/${ruleset_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "enabled": true, "last_version": 1, "name": "Updated Ruleset", "rules": [ { "enabled": true, "name": "Add Cost Center Tag", "query": { "addition": { "key": "cost_center", "value": "engineering" }, "case_insensitivity": false, "if_tag_exists": "do_not_apply", "query": "account_id:\"123456789\" AND service:\"web-api\"" } }, { "enabled": true, "mapping": { "destination_key": "team_owner", "if_tag_exists": "do_not_apply", "source_keys": [ "account_name", "account_id" ] }, "name": "Account Name Mapping", "query": null }, { "enabled": true, "name": "New table rule with new UI", "query": null, "reference_table": { "case_insensitivity": true, "field_pairs": [ { "input_column": "status_type", "output_key": "status" }, { "input_column": "status_description", "output_key": "dess" } ], "if_tag_exists": "append", "source_keys": [ "http_status", "status_description" ], "table_name": "http_status_codes" } } ] }, "type": "update_ruleset" } } EOF
                          ## default
# 

# Path parameters
export ruleset_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment/${ruleset_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "enabled": true, "last_version": 1, "name": "Updated Ruleset", "rules": [ { "enabled": true, "name": "Add Cost Center Tag", "query": { "addition": { "key": "cost_center", "value": "engineering" }, "case_insensitivity": false, "if_tag_exists": "do_not_apply", "query": "account_id:\"123456789\" AND service:\"web-api\"" } }, { "enabled": true, "mapping": { "destination_key": "team_owner", "if_tag_exists": "do_not_apply", "source_keys": [ "account_name", "account_id" ] }, "name": "Account Name Mapping", "query": null }, { "enabled": true, "name": "New table rule with new UI", "query": null, "reference_table": { "case_insensitivity": true, "field_pairs": [ { "input_column": "status_type", "output_key": "status" }, { "input_column": "status_description", "output_key": "dess" } ], "if_tag_exists": "append", "source_keys": [ "http_status", "status_description" ], "table_name": "http_status_codes" } } ] }, "type": "update_ruleset" } } EOF
// Update tag pipeline ruleset returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.UpdateRulesetRequest{
		Data: &datadogV2.UpdateRulesetRequestData{
			Attributes: &datadogV2.UpdateRulesetRequestDataAttributes{
				Enabled:     true,
				LastVersion: datadog.PtrInt64(3611102),
				Rules: []datadogV2.UpdateRulesetRequestDataAttributesRulesItems{
					{
						Enabled: true,
						Mapping: *datadogV2.NewNullableDataAttributesRulesItemsMapping(&datadogV2.DataAttributesRulesItemsMapping{
							DestinationKey: "team_owner",
							IfNotExists:    datadog.PtrBool(true),
							SourceKeys: []string{
								"account_name",
								"account_id",
							},
						}),
						Name:           "Account Name Mapping",
						Query:          *datadogV2.NewNullableUpdateRulesetRequestDataAttributesRulesItemsQuery(nil),
						ReferenceTable: *datadogV2.NewNullableUpdateRulesetRequestDataAttributesRulesItemsReferenceTable(nil),
					},
				},
			},
			Id:   datadog.PtrString("New Ruleset"),
			Type: datadogV2.UPDATERULESETREQUESTDATATYPE_UPDATE_RULESET,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.UpdateTagPipelinesRuleset(ctx, "ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpdateTagPipelinesRuleset`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpdateTagPipelinesRuleset`:\n%s\n", responseContent)
}
// Update tag pipeline ruleset with if_tag_exists returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.UpdateRulesetRequest{
		Data: &datadogV2.UpdateRulesetRequestData{
			Attributes: &datadogV2.UpdateRulesetRequestDataAttributes{
				Enabled:     true,
				LastVersion: datadog.PtrInt64(3611102),
				Rules: []datadogV2.UpdateRulesetRequestDataAttributesRulesItems{
					{
						Enabled: true,
						Mapping: *datadogV2.NewNullableDataAttributesRulesItemsMapping(&datadogV2.DataAttributesRulesItemsMapping{
							DestinationKey: "team_owner",
							IfTagExists:    datadogV2.DATAATTRIBUTESRULESITEMSIFTAGEXISTS_REPLACE.Ptr(),
							SourceKeys: []string{
								"account_name",
								"account_id",
							},
						}),
						Name:           "Account Name Mapping",
						Query:          *datadogV2.NewNullableUpdateRulesetRequestDataAttributesRulesItemsQuery(nil),
						ReferenceTable: *datadogV2.NewNullableUpdateRulesetRequestDataAttributesRulesItemsReferenceTable(nil),
					},
				},
			},
			Id:   datadog.PtrString("New Ruleset"),
			Type: datadogV2.UPDATERULESETREQUESTDATATYPE_UPDATE_RULESET,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.UpdateTagPipelinesRuleset(ctx, "ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpdateTagPipelinesRuleset`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpdateTagPipelinesRuleset`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Update tag pipeline ruleset returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.DataAttributesRulesItemsMapping;
import com.datadog.api.client.v2.model.RulesetResp;
import com.datadog.api.client.v2.model.UpdateRulesetRequest;
import com.datadog.api.client.v2.model.UpdateRulesetRequestData;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataAttributes;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataAttributesRulesItems;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataType;
import java.util.Arrays;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    UpdateRulesetRequest body =
        new UpdateRulesetRequest()
            .data(
                new UpdateRulesetRequestData()
                    .attributes(
                        new UpdateRulesetRequestDataAttributes()
                            .enabled(true)
                            .lastVersion(3611102L)
                            .rules(
                                Collections.singletonList(
                                    new UpdateRulesetRequestDataAttributesRulesItems()
                                        .enabled(true)
                                        .mapping(
                                            new DataAttributesRulesItemsMapping()
                                                .destinationKey("team_owner")
                                                .ifNotExists(true)
                                                .sourceKeys(
                                                    Arrays.asList("account_name", "account_id")))
                                        .name("Account Name Mapping")
                                        .query(null)
                                        .referenceTable(null))))
                    .id("New Ruleset")
                    .type(UpdateRulesetRequestDataType.UPDATE_RULESET));

    try {
      RulesetResp result =
          apiInstance.updateTagPipelinesRuleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#updateTagPipelinesRuleset");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// Update tag pipeline ruleset with if_tag_exists returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.DataAttributesRulesItemsIfTagExists;
import com.datadog.api.client.v2.model.DataAttributesRulesItemsMapping;
import com.datadog.api.client.v2.model.RulesetResp;
import com.datadog.api.client.v2.model.UpdateRulesetRequest;
import com.datadog.api.client.v2.model.UpdateRulesetRequestData;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataAttributes;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataAttributesRulesItems;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataType;
import java.util.Arrays;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    UpdateRulesetRequest body =
        new UpdateRulesetRequest()
            .data(
                new UpdateRulesetRequestData()
                    .attributes(
                        new UpdateRulesetRequestDataAttributes()
                            .enabled(true)
                            .lastVersion(3611102L)
                            .rules(
                                Collections.singletonList(
                                    new UpdateRulesetRequestDataAttributesRulesItems()
                                        .enabled(true)
                                        .mapping(
                                            new DataAttributesRulesItemsMapping()
                                                .destinationKey("team_owner")
                                                .ifTagExists(
                                                    DataAttributesRulesItemsIfTagExists.REPLACE)
                                                .sourceKeys(
                                                    Arrays.asList("account_name", "account_id")))
                                        .name("Account Name Mapping")
                                        .query(null)
                                        .referenceTable(null))))
                    .id("New Ruleset")
                    .type(UpdateRulesetRequestDataType.UPDATE_RULESET));

    try {
      RulesetResp result =
          apiInstance.updateTagPipelinesRuleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#updateTagPipelinesRuleset");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Update tag pipeline ruleset returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.data_attributes_rules_items_mapping import DataAttributesRulesItemsMapping
from datadog_api_client.v2.model.update_ruleset_request import UpdateRulesetRequest
from datadog_api_client.v2.model.update_ruleset_request_data import UpdateRulesetRequestData
from datadog_api_client.v2.model.update_ruleset_request_data_attributes import UpdateRulesetRequestDataAttributes
from datadog_api_client.v2.model.update_ruleset_request_data_attributes_rules_items import (
    UpdateRulesetRequestDataAttributesRulesItems,
)
from datadog_api_client.v2.model.update_ruleset_request_data_type import UpdateRulesetRequestDataType

body = UpdateRulesetRequest(
    data=UpdateRulesetRequestData(
        attributes=UpdateRulesetRequestDataAttributes(
            enabled=True,
            last_version=3611102,
            rules=[
                UpdateRulesetRequestDataAttributesRulesItems(
                    enabled=True,
                    mapping=DataAttributesRulesItemsMapping(
                        destination_key="team_owner",
                        if_not_exists=True,
                        source_keys=[
                            "account_name",
                            "account_id",
                        ],
                    ),
                    name="Account Name Mapping",
                    query=None,
                    reference_table=None,
                ),
            ],
        ),
        id="New Ruleset",
        type=UpdateRulesetRequestDataType.UPDATE_RULESET,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.update_tag_pipelines_ruleset(ruleset_id="ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body=body)

    print(response)
"""
Update tag pipeline ruleset with if_tag_exists returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.data_attributes_rules_items_if_tag_exists import DataAttributesRulesItemsIfTagExists
from datadog_api_client.v2.model.data_attributes_rules_items_mapping import DataAttributesRulesItemsMapping
from datadog_api_client.v2.model.update_ruleset_request import UpdateRulesetRequest
from datadog_api_client.v2.model.update_ruleset_request_data import UpdateRulesetRequestData
from datadog_api_client.v2.model.update_ruleset_request_data_attributes import UpdateRulesetRequestDataAttributes
from datadog_api_client.v2.model.update_ruleset_request_data_attributes_rules_items import (
    UpdateRulesetRequestDataAttributesRulesItems,
)
from datadog_api_client.v2.model.update_ruleset_request_data_type import UpdateRulesetRequestDataType

body = UpdateRulesetRequest(
    data=UpdateRulesetRequestData(
        attributes=UpdateRulesetRequestDataAttributes(
            enabled=True,
            last_version=3611102,
            rules=[
                UpdateRulesetRequestDataAttributesRulesItems(
                    enabled=True,
                    mapping=DataAttributesRulesItemsMapping(
                        destination_key="team_owner",
                        if_tag_exists=DataAttributesRulesItemsIfTagExists.REPLACE,
                        source_keys=[
                            "account_name",
                            "account_id",
                        ],
                    ),
                    name="Account Name Mapping",
                    query=None,
                    reference_table=None,
                ),
            ],
        ),
        id="New Ruleset",
        type=UpdateRulesetRequestDataType.UPDATE_RULESET,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.update_tag_pipelines_ruleset(ruleset_id="ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Update tag pipeline ruleset returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::UpdateRulesetRequest.new({
  data: DatadogAPIClient::V2::UpdateRulesetRequestData.new({
    attributes: DatadogAPIClient::V2::UpdateRulesetRequestDataAttributes.new({
      enabled: true,
      last_version: 3611102,
      rules: [
        DatadogAPIClient::V2::UpdateRulesetRequestDataAttributesRulesItems.new({
          enabled: true,
          mapping: DatadogAPIClient::V2::DataAttributesRulesItemsMapping.new({
            destination_key: "team_owner",
            if_not_exists: true,
            source_keys: [
              "account_name",
              "account_id",
            ],
          }),
          name: "Account Name Mapping",
          query: nil,
          reference_table: nil,
        }),
      ],
    }),
    id: "New Ruleset",
    type: DatadogAPIClient::V2::UpdateRulesetRequestDataType::UPDATE_RULESET,
  }),
})
p api_instance.update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body)
# Update tag pipeline ruleset with if_tag_exists returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::UpdateRulesetRequest.new({
  data: DatadogAPIClient::V2::UpdateRulesetRequestData.new({
    attributes: DatadogAPIClient::V2::UpdateRulesetRequestDataAttributes.new({
      enabled: true,
      last_version: 3611102,
      rules: [
        DatadogAPIClient::V2::UpdateRulesetRequestDataAttributesRulesItems.new({
          enabled: true,
          mapping: DatadogAPIClient::V2::DataAttributesRulesItemsMapping.new({
            destination_key: "team_owner",
            if_tag_exists: DatadogAPIClient::V2::DataAttributesRulesItemsIfTagExists::REPLACE,
            source_keys: [
              "account_name",
              "account_id",
            ],
          }),
          name: "Account Name Mapping",
          query: nil,
          reference_table: nil,
        }),
      ],
    }),
    id: "New Ruleset",
    type: DatadogAPIClient::V2::UpdateRulesetRequestDataType::UPDATE_RULESET,
  }),
})
p api_instance.update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Update tag pipeline ruleset returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::DataAttributesRulesItemsMapping;
use datadog_api_client::datadogV2::model::UpdateRulesetRequest;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestData;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataAttributes;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataAttributesRulesItems;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataType;

#[tokio::main]
async fn main() {
    let body = UpdateRulesetRequest::new().data(
        UpdateRulesetRequestData::new(UpdateRulesetRequestDataType::UPDATE_RULESET)
            .attributes(
                UpdateRulesetRequestDataAttributes::new(
                    true,
                    vec![UpdateRulesetRequestDataAttributesRulesItems::new(
                        true,
                        "Account Name Mapping".to_string(),
                    )
                    .mapping(Some(
                        DataAttributesRulesItemsMapping::new(
                            "team_owner".to_string(),
                            vec!["account_name".to_string(), "account_id".to_string()],
                        )
                        .if_not_exists(true),
                    ))
                    .query(None)
                    .reference_table(None)],
                )
                .last_version(3611102),
            )
            .id("New Ruleset".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api
        .update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1".to_string(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
// Update tag pipeline ruleset with if_tag_exists returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::DataAttributesRulesItemsIfTagExists;
use datadog_api_client::datadogV2::model::DataAttributesRulesItemsMapping;
use datadog_api_client::datadogV2::model::UpdateRulesetRequest;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestData;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataAttributes;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataAttributesRulesItems;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataType;

#[tokio::main]
async fn main() {
    let body = UpdateRulesetRequest::new().data(
        UpdateRulesetRequestData::new(UpdateRulesetRequestDataType::UPDATE_RULESET)
            .attributes(
                UpdateRulesetRequestDataAttributes::new(
                    true,
                    vec![UpdateRulesetRequestDataAttributesRulesItems::new(
                        true,
                        "Account Name Mapping".to_string(),
                    )
                    .mapping(Some(
                        DataAttributesRulesItemsMapping::new(
                            "team_owner".to_string(),
                            vec!["account_name".to_string(), "account_id".to_string()],
                        )
                        .if_tag_exists(DataAttributesRulesItemsIfTagExists::REPLACE),
                    ))
                    .query(None)
                    .reference_table(None)],
                )
                .last_version(3611102),
            )
            .id("New Ruleset".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api
        .update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1".to_string(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Update tag pipeline ruleset returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiUpdateTagPipelinesRulesetRequest = {
  body: {
    data: {
      attributes: {
        enabled: true,
        lastVersion: 3611102,
        rules: [
          {
            enabled: true,
            mapping: {
              destinationKey: "team_owner",
              ifNotExists: true,
              sourceKeys: ["account_name", "account_id"],
            },
            name: "Account Name Mapping",
            query: undefined,
            referenceTable: undefined,
          },
        ],
      },
      id: "New Ruleset",
      type: "update_ruleset",
    },
  },
  rulesetId: "ee10c3ff-312f-464c-b4f6-46adaa6d00a1",
};

apiInstance
  .updateTagPipelinesRuleset(params)
  .then((data: v2.RulesetResp) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Update tag pipeline ruleset with if_tag_exists returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiUpdateTagPipelinesRulesetRequest = {
  body: {
    data: {
      attributes: {
        enabled: true,
        lastVersion: 3611102,
        rules: [
          {
            enabled: true,
            mapping: {
              destinationKey: "team_owner",
              ifTagExists: "replace",
              sourceKeys: ["account_name", "account_id"],
            },
            name: "Account Name Mapping",
            query: undefined,
            referenceTable: undefined,
          },
        ],
      },
      id: "New Ruleset",
      type: "update_ruleset",
    },
  },
  rulesetId: "ee10c3ff-312f-464c-b4f6-46adaa6d00a1",
};

apiInstance
  .updateTagPipelinesRuleset(params)
  .then((data: v2.RulesetResp) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.ap2.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.datadoghq.eu/api/v2/tags/enrichment/{ruleset_id}https://api.ddog-gov.com/api/v2/tags/enrichment/{ruleset_id}https://api.us2.ddog-gov.com/api/v2/tags/enrichment/{ruleset_id}https://api.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.us3.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.us5.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}

Overview

Delete a tag pipeline ruleset - Delete an existing tag pipeline ruleset by its ID

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

ruleset_id [required]

string

The unique identifier of the ruleset

Response

No Content

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export ruleset_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment/${ruleset_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete tag pipeline ruleset returns "No Content" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.delete_tag_pipelines_ruleset(
        ruleset_id="ee10c3ff-312f-464c-b4f6-46adaa6d00a1",
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete tag pipeline ruleset returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
api_instance.delete_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete tag pipeline ruleset returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.DeleteTagPipelinesRuleset(ctx, "ee10c3ff-312f-464c-b4f6-46adaa6d00a1")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteTagPipelinesRuleset`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete tag pipeline ruleset returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      apiInstance.deleteTagPipelinesRuleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1");
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#deleteTagPipelinesRuleset");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Delete tag pipeline ruleset returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api
        .delete_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1".to_string())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Delete tag pipeline ruleset returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiDeleteTagPipelinesRulesetRequest = {
  rulesetId: "ee10c3ff-312f-464c-b4f6-46adaa6d00a1",
};

apiInstance
  .deleteTagPipelinesRuleset(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.ap2.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.datadoghq.eu/api/v2/tags/enrichment/{ruleset_id}https://api.ddog-gov.com/api/v2/tags/enrichment/{ruleset_id}https://api.us2.ddog-gov.com/api/v2/tags/enrichment/{ruleset_id}https://api.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.us3.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.us5.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}

Overview

Get a specific tag pipeline ruleset - Retrieve a specific tag pipeline ruleset by its ID

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

ruleset_id [required]

string

The unique identifier of the ruleset

Response

OK

The definition of RulesetResp object.

Expand All

Field

Type

Description

data

object

The definition of RulesetRespData object.

attributes

object

The definition of RulesetRespDataAttributes object.

created [required]

object

The definition of RulesetRespDataAttributesCreated object.

nanos

int32

The created nanos.

seconds

int64

The created seconds.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

modified [required]

object

The definition of RulesetRespDataAttributesModified object.

nanos

int32

The modified nanos.

seconds

int64

The modified seconds.

name [required]

string

The attributes name.

position [required]

int32

The attributes position.

processing_status

string

The attributes processing_status.

rules [required]

[object]

The attributes rules.

enabled [required]

boolean

The items enabled.

mapping

object

The definition of DataAttributesRulesItemsMapping object.

destination_key [required]

string

The mapping destination_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The mapping if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The mapping source_keys.

metadata

object

The items metadata.

<any-key>

string

name [required]

string

The items name.

query

object

The definition of RulesetRespDataAttributesRulesItemsQuery object.

addition [required]

object

The definition of RulesetRespDataAttributesRulesItemsQueryAddition object.

key [required]

string

The addition key.

value [required]

string

The addition value.

case_insensitivity

boolean

The query case_insensitivity.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The query if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

query [required]

string

The query query.

reference_table

object

The definition of RulesetRespDataAttributesRulesItemsReferenceTable object.

case_insensitivity

boolean

The reference_table case_insensitivity.

field_pairs [required]

[object]

The reference_table field_pairs.

input_column [required]

string

The items input_column.

output_key [required]

string

The items output_key.

if_not_exists

boolean

DEPRECATED: Deprecated. Use if_tag_exists instead. The reference_table if_not_exists.

if_tag_exists

enum

The behavior when the tag already exists. Allowed enum values: append,do_not_apply,replace

source_keys [required]

[string]

The reference_table source_keys.

table_name [required]

string

The reference_table table_name.

version [required]

int64

The attributes version.

id

string

The RulesetRespData id.

type [required]

enum

Ruleset resource type. Allowed enum values: ruleset

default: ruleset

{
  "data": {
    "attributes": {
      "created": null,
      "enabled": true,
      "last_modified_user_uuid": "",
      "modified": null,
      "name": "Example Ruleset",
      "position": 0,
      "rules": [
        {
          "enabled": false,
          "mapping": null,
          "metadata": null,
          "name": "RC test rule edited1",
          "query": {
            "addition": {
              "key": "abc",
              "value": "ww"
            },
            "case_insensitivity": false,
            "if_tag_exists": "do_not_apply",
            "query": "billingcurrency:\"USD\" AND account_name:\"SZA96462\" AND billingcurrency:\"USD\""
          },
          "reference_table": null
        },
        {
          "enabled": true,
          "mapping": {
            "destination_key": "h",
            "if_tag_exists": "do_not_apply",
            "source_keys": [
              "accountname",
              "accountownerid"
            ]
          },
          "metadata": null,
          "name": "rule with empty source key",
          "query": null,
          "reference_table": null
        },
        {
          "enabled": true,
          "mapping": null,
          "metadata": null,
          "name": "New table rule with new UI",
          "query": null,
          "reference_table": {
            "case_insensitivity": true,
            "field_pairs": [
              {
                "input_column": "status_type",
                "output_key": "status"
              },
              {
                "input_column": "status_description",
                "output_key": "dess"
              }
            ],
            "if_tag_exists": "append",
            "source_keys": [
              "http_status",
              "status_description"
            ],
            "table_name": "http_status_codes"
          }
        }
      ],
      "version": 1
    },
    "id": "12345",
    "type": "ruleset"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export ruleset_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment/${ruleset_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a tag pipeline ruleset returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.get_tag_pipelines_ruleset(
        ruleset_id="a1e9de9b-b88e-41c6-a0cd-cc0ebd7092de",
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a tag pipeline ruleset returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.get_tag_pipelines_ruleset("a1e9de9b-b88e-41c6-a0cd-cc0ebd7092de")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a tag pipeline ruleset returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.GetTagPipelinesRuleset(ctx, "a1e9de9b-b88e-41c6-a0cd-cc0ebd7092de")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetTagPipelinesRuleset`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetTagPipelinesRuleset`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a tag pipeline ruleset returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.RulesetResp;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      RulesetResp result =
          apiInstance.getTagPipelinesRuleset("a1e9de9b-b88e-41c6-a0cd-cc0ebd7092de");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#getTagPipelinesRuleset");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get a tag pipeline ruleset returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api
        .get_tag_pipelines_ruleset("a1e9de9b-b88e-41c6-a0cd-cc0ebd7092de".to_string())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get a tag pipeline ruleset returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiGetTagPipelinesRulesetRequest = {
  rulesetId: "a1e9de9b-b88e-41c6-a0cd-cc0ebd7092de",
};

apiInstance
  .getTagPipelinesRuleset(params)
  .then((data: v2.RulesetResp) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/tags/enrichment/reorderhttps://api.ap2.datadoghq.com/api/v2/tags/enrichment/reorderhttps://api.datadoghq.eu/api/v2/tags/enrichment/reorderhttps://api.ddog-gov.com/api/v2/tags/enrichment/reorderhttps://api.us2.ddog-gov.com/api/v2/tags/enrichment/reorderhttps://api.datadoghq.com/api/v2/tags/enrichment/reorderhttps://api.us3.datadoghq.com/api/v2/tags/enrichment/reorderhttps://api.us5.datadoghq.com/api/v2/tags/enrichment/reorder

Overview

Reorder tag pipeline rulesets - Change the execution order of tag pipeline rulesets

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

[object]

The ReorderRulesetResourceArray data.

id

string

The ReorderRulesetResourceData id.

type [required]

enum

Ruleset resource type. Allowed enum values: ruleset

default: ruleset

{
  "data": [
    {
      "id": "string",
      "type": "ruleset"
    }
  ]
}

Response

Successfully reordered rulesets

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment/reorder" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": [ { "id": "55ef2385-9ae1-4410-90c4-5ac1b60fec10", "type": "ruleset" }, { "id": "a7b8c9d0-1234-5678-9abc-def012345678", "type": "ruleset" }, { "id": "f1e2d3c4-b5a6-9780-1234-567890abcdef", "type": "ruleset" } ] } EOF
"""
Reorder tag pipeline rulesets returns "Successfully reordered rulesets" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.reorder_ruleset_resource_array import ReorderRulesetResourceArray
from datadog_api_client.v2.model.reorder_ruleset_resource_data import ReorderRulesetResourceData
from datadog_api_client.v2.model.reorder_ruleset_resource_data_type import ReorderRulesetResourceDataType

body = ReorderRulesetResourceArray(
    data=[
        ReorderRulesetResourceData(
            id="55ef2385-9ae1-4410-90c4-5ac1b60fec10",
            type=ReorderRulesetResourceDataType.RULESET,
        ),
        ReorderRulesetResourceData(
            id="a7b8c9d0-1234-5678-9abc-def012345678",
            type=ReorderRulesetResourceDataType.RULESET,
        ),
        ReorderRulesetResourceData(
            id="f1e2d3c4-b5a6-9780-1234-567890abcdef",
            type=ReorderRulesetResourceDataType.RULESET,
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.reorder_tag_pipelines_rulesets(body=body)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Reorder tag pipeline rulesets returns "Successfully reordered rulesets" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::ReorderRulesetResourceArray.new({
  data: [
    DatadogAPIClient::V2::ReorderRulesetResourceData.new({
      id: "55ef2385-9ae1-4410-90c4-5ac1b60fec10",
      type: DatadogAPIClient::V2::ReorderRulesetResourceDataType::RULESET,
    }),
    DatadogAPIClient::V2::ReorderRulesetResourceData.new({
      id: "a7b8c9d0-1234-5678-9abc-def012345678",
      type: DatadogAPIClient::V2::ReorderRulesetResourceDataType::RULESET,
    }),
    DatadogAPIClient::V2::ReorderRulesetResourceData.new({
      id: "f1e2d3c4-b5a6-9780-1234-567890abcdef",
      type: DatadogAPIClient::V2::ReorderRulesetResourceDataType::RULESET,
    }),
  ],
})
api_instance.reorder_tag_pipelines_rulesets(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Reorder tag pipeline rulesets returns "Successfully reordered rulesets" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.ReorderRulesetResourceArray{
		Data: []datadogV2.ReorderRulesetResourceData{
			{
				Id:   datadog.PtrString("55ef2385-9ae1-4410-90c4-5ac1b60fec10"),
				Type: datadogV2.REORDERRULESETRESOURCEDATATYPE_RULESET,
			},
			{
				Id:   datadog.PtrString("a7b8c9d0-1234-5678-9abc-def012345678"),
				Type: datadogV2.REORDERRULESETRESOURCEDATATYPE_RULESET,
			},
			{
				Id:   datadog.PtrString("f1e2d3c4-b5a6-9780-1234-567890abcdef"),
				Type: datadogV2.REORDERRULESETRESOURCEDATATYPE_RULESET,
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.ReorderTagPipelinesRulesets(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ReorderTagPipelinesRulesets`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Reorder tag pipeline rulesets returns "Successfully reordered rulesets" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.ReorderRulesetResourceArray;
import com.datadog.api.client.v2.model.ReorderRulesetResourceData;
import com.datadog.api.client.v2.model.ReorderRulesetResourceDataType;
import java.util.Arrays;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    ReorderRulesetResourceArray body =
        new ReorderRulesetResourceArray()
            .data(
                Arrays.asList(
                    new ReorderRulesetResourceData()
                        .id("55ef2385-9ae1-4410-90c4-5ac1b60fec10")
                        .type(ReorderRulesetResourceDataType.RULESET),
                    new ReorderRulesetResourceData()
                        .id("a7b8c9d0-1234-5678-9abc-def012345678")
                        .type(ReorderRulesetResourceDataType.RULESET),
                    new ReorderRulesetResourceData()
                        .id("f1e2d3c4-b5a6-9780-1234-567890abcdef")
                        .type(ReorderRulesetResourceDataType.RULESET)));

    try {
      apiInstance.reorderTagPipelinesRulesets(body);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#reorderTagPipelinesRulesets");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Reorder tag pipeline rulesets returns "Successfully reordered rulesets" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::ReorderRulesetResourceArray;
use datadog_api_client::datadogV2::model::ReorderRulesetResourceData;
use datadog_api_client::datadogV2::model::ReorderRulesetResourceDataType;

#[tokio::main]
async fn main() {
    let body = ReorderRulesetResourceArray::new(vec![
        ReorderRulesetResourceData::new(ReorderRulesetResourceDataType::RULESET)
            .id("55ef2385-9ae1-4410-90c4-5ac1b60fec10".to_string()),
        ReorderRulesetResourceData::new(ReorderRulesetResourceDataType::RULESET)
            .id("a7b8c9d0-1234-5678-9abc-def012345678".to_string()),
        ReorderRulesetResourceData::new(ReorderRulesetResourceDataType::RULESET)
            .id("f1e2d3c4-b5a6-9780-1234-567890abcdef".to_string()),
    ]);
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.reorder_tag_pipelines_rulesets(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Reorder tag pipeline rulesets returns "Successfully reordered rulesets" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiReorderTagPipelinesRulesetsRequest = {
  body: {
    data: [
      {
        id: "55ef2385-9ae1-4410-90c4-5ac1b60fec10",
        type: "ruleset",
      },
      {
        id: "a7b8c9d0-1234-5678-9abc-def012345678",
        type: "ruleset",
      },
      {
        id: "f1e2d3c4-b5a6-9780-1234-567890abcdef",
        type: "ruleset",
      },
    ],
  },
};

apiInstance
  .reorderTagPipelinesRulesets(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/tags/enrichment/validate-queryhttps://api.ap2.datadoghq.com/api/v2/tags/enrichment/validate-queryhttps://api.datadoghq.eu/api/v2/tags/enrichment/validate-queryhttps://api.ddog-gov.com/api/v2/tags/enrichment/validate-queryhttps://api.us2.ddog-gov.com/api/v2/tags/enrichment/validate-queryhttps://api.datadoghq.com/api/v2/tags/enrichment/validate-queryhttps://api.us3.datadoghq.com/api/v2/tags/enrichment/validate-queryhttps://api.us5.datadoghq.com/api/v2/tags/enrichment/validate-query

Overview

Validate a tag pipeline query - Validate the syntax and structure of a tag pipeline query

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

data

object

The definition of RulesValidateQueryRequestData object.

attributes

object

The definition of RulesValidateQueryRequestDataAttributes object.

Query [required]

string

The attributes Query.

id

string

The RulesValidateQueryRequestData id.

type [required]

enum

Validate query resource type. Allowed enum values: validate_query

default: validate_query

{
  "data": {
    "attributes": {
      "Query": "example:query AND test:true"
    },
    "type": "validate_query"
  }
}

Response

OK

The definition of RulesValidateQueryResponse object.

Expand All

Field

Type

Description

data

object

The definition of RulesValidateQueryResponseData object.

attributes

object

The definition of RulesValidateQueryResponseDataAttributes object.

Canonical [required]

string

The attributes Canonical.

id

string

The RulesValidateQueryResponseData id.

type [required]

enum

Validate response resource type. Allowed enum values: validate_response

default: validate_response

{
  "data": {
    "attributes": {
      "Canonical": "canonical query representation"
    },
    "type": "validate_response"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment/validate-query" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "Query": "example:query AND test:true" }, "type": "validate_query" } } EOF
// Validate query returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.RulesValidateQueryRequest{
		Data: &datadogV2.RulesValidateQueryRequestData{
			Attributes: &datadogV2.RulesValidateQueryRequestDataAttributes{
				Query: "example:query AND test:true",
			},
			Type: datadogV2.RULESVALIDATEQUERYREQUESTDATATYPE_VALIDATE_QUERY,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ValidateQuery(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ValidateQuery`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ValidateQuery`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Validate query returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.RulesValidateQueryRequest;
import com.datadog.api.client.v2.model.RulesValidateQueryRequestData;
import com.datadog.api.client.v2.model.RulesValidateQueryRequestDataAttributes;
import com.datadog.api.client.v2.model.RulesValidateQueryRequestDataType;
import com.datadog.api.client.v2.model.RulesValidateQueryResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    RulesValidateQueryRequest body =
        new RulesValidateQueryRequest()
            .data(
                new RulesValidateQueryRequestData()
                    .attributes(
                        new RulesValidateQueryRequestDataAttributes()
                            .query("example:query AND test:true"))
                    .type(RulesValidateQueryRequestDataType.VALIDATE_QUERY));

    try {
      RulesValidateQueryResponse result = apiInstance.validateQuery(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#validateQuery");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Validate query returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.rules_validate_query_request import RulesValidateQueryRequest
from datadog_api_client.v2.model.rules_validate_query_request_data import RulesValidateQueryRequestData
from datadog_api_client.v2.model.rules_validate_query_request_data_attributes import (
    RulesValidateQueryRequestDataAttributes,
)
from datadog_api_client.v2.model.rules_validate_query_request_data_type import RulesValidateQueryRequestDataType

body = RulesValidateQueryRequest(
    data=RulesValidateQueryRequestData(
        attributes=RulesValidateQueryRequestDataAttributes(
            query="example:query AND test:true",
        ),
        type=RulesValidateQueryRequestDataType.VALIDATE_QUERY,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.validate_query(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Validate query returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::RulesValidateQueryRequest.new({
  data: DatadogAPIClient::V2::RulesValidateQueryRequestData.new({
    attributes: DatadogAPIClient::V2::RulesValidateQueryRequestDataAttributes.new({
      query: "example:query AND test:true",
    }),
    type: DatadogAPIClient::V2::RulesValidateQueryRequestDataType::VALIDATE_QUERY,
  }),
})
p api_instance.validate_query(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Validate query returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::RulesValidateQueryRequest;
use datadog_api_client::datadogV2::model::RulesValidateQueryRequestData;
use datadog_api_client::datadogV2::model::RulesValidateQueryRequestDataAttributes;
use datadog_api_client::datadogV2::model::RulesValidateQueryRequestDataType;

#[tokio::main]
async fn main() {
    let body = RulesValidateQueryRequest::new().data(
        RulesValidateQueryRequestData::new(RulesValidateQueryRequestDataType::VALIDATE_QUERY)
            .attributes(RulesValidateQueryRequestDataAttributes::new(
                "example:query AND test:true".to_string(),
            )),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.validate_query(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Validate query returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiValidateQueryRequest = {
  body: {
    data: {
      attributes: {
        query: "example:query AND test:true",
      },
      type: "validate_query",
    },
  },
};

apiInstance
  .validateQuery(params)
  .then((data: v2.RulesValidateQueryResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.datadoghq.eu/api/v2/cost/arbitrary_rulehttps://api.ddog-gov.com/api/v2/cost/arbitrary_rulehttps://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rulehttps://api.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.us3.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule

Overview

List all custom allocation rules - Retrieve a list of all custom allocation rules for the organization

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Response

OK

The definition of ArbitraryRuleResponseArray object.

Expand All

Field

Type

Description

data [required]

[object]

The ArbitraryRuleResponseArray data.

attributes

object

The definition of ArbitraryRuleResponseDataAttributes object.

costs_to_allocate [required]

[object]

The attributes costs_to_allocate.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

created [required]

date-time

The attributes created.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

order_id [required]

int64

The attributes order_id.

processing_status

string

The attributes processing_status.

provider [required]

[string]

The attributes provider.

rejected

boolean

The attributes rejected.

rule_name [required]

string

The attributes rule_name.

strategy [required]

object

The definition of ArbitraryRuleResponseDataAttributesStrategy object.

allocated_by

[object]

The strategy allocated_by.

allocated_tags [required]

[object]

The items allocated_tags.

key [required]

string

The items key.

value [required]

string

The items value.

percentage [required]

double

The items percentage. The numeric value format should be a 32bit float value.

allocated_by_filters

[object]

The strategy allocated_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

allocated_by_tag_keys

[string]

The strategy allocated_by_tag_keys.

based_on_costs

[object]

The strategy based_on_costs.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

based_on_timeseries

object

The rule strategy based_on_timeseries.

evaluate_grouped_by_filters

[object]

The strategy evaluate_grouped_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

evaluate_grouped_by_tag_keys

[string]

The strategy evaluate_grouped_by_tag_keys.

granularity

string

The strategy granularity.

method [required]

string

The strategy method.

type [required]

string

The attributes type.

updated [required]

date-time

The attributes updated.

version [required]

int32

The attributes version.

id

string

The ArbitraryRuleResponseData id.

type [required]

enum

Arbitrary rule resource type. Allowed enum values: arbitrary_rule

default: arbitrary_rule

meta

object

The ArbitraryRuleResponseArray meta.

total_count

int64

The meta total_count.

{
  "data": [
    {
      "attributes": {
        "costs_to_allocate": [
          {
            "condition": "like",
            "tag": "service",
            "value": "orgstore-csm*",
            "values": null
          }
        ],
        "created": "2024-11-20T03:44:37Z",
        "enabled": true,
        "last_modified_user_uuid": "user-example-uuid",
        "order_id": 1,
        "processing_status": "done",
        "provider": [
          "gcp"
        ],
        "rule_name": "gcp-orgstore-csm-team-allocation",
        "strategy": {
          "allocated_by": [
            {
              "allocated_tags": [
                {
                  "key": "team",
                  "value": "csm-activation"
                }
              ],
              "percentage": 0.34
            },
            {
              "allocated_tags": [
                {
                  "key": "team",
                  "value": "csm-agentless"
                }
              ],
              "percentage": 0.66
            }
          ],
          "method": "percent"
        },
        "type": "shared",
        "updated": "2025-09-02T21:28:32Z",
        "version": 1
      },
      "id": "19",
      "type": "arbitrary_rule"
    },
    {
      "attributes": {
        "costs_to_allocate": [
          {
            "condition": "is",
            "tag": "env",
            "value": "staging",
            "values": null
          }
        ],
        "created": "2025-05-27T18:48:05Z",
        "enabled": true,
        "last_modified_user_uuid": "user-example-uuid-2",
        "order_id": 2,
        "processing_status": "done",
        "provider": [
          "aws"
        ],
        "rule_name": "test-even-2",
        "strategy": {
          "allocated_by_tag_keys": [
            "team"
          ],
          "based_on_costs": [
            {
              "condition": "is",
              "tag": "aws_product",
              "value": "s3",
              "values": null
            }
          ],
          "granularity": "daily",
          "method": "even"
        },
        "type": "shared",
        "updated": "2025-09-03T21:00:49Z",
        "version": 1
      },
      "id": "311",
      "type": "arbitrary_rule"
    },
    {
      "attributes": {
        "costs_to_allocate": [
          {
            "condition": "is",
            "tag": "servicename",
            "value": "s3",
            "values": null
          }
        ],
        "created": "2025-03-21T20:42:40Z",
        "enabled": false,
        "last_modified_user_uuid": "user-example-uuid-3",
        "order_id": 3,
        "processing_status": "done",
        "provider": [
          "aws"
        ],
        "rule_name": "test-s3-timeseries",
        "strategy": {
          "granularity": "daily",
          "method": "proportional_timeseries"
        },
        "type": "shared",
        "updated": "2025-09-02T21:16:50Z",
        "version": 1
      },
      "id": "289",
      "type": "arbitrary_rule"
    },
    {
      "attributes": {
        "costs_to_allocate": [
          {
            "condition": "=",
            "tag": "aws_product",
            "value": "msk",
            "values": null
          },
          {
            "condition": "is",
            "tag": "product",
            "value": "null",
            "values": null
          }
        ],
        "created": "2025-08-27T14:39:31Z",
        "enabled": true,
        "last_modified_user_uuid": "user-example-uuid-4",
        "order_id": 4,
        "processing_status": "done",
        "provider": [
          "aws"
        ],
        "rule_name": "azure-unallocated-by-product-2",
        "strategy": {
          "allocated_by_tag_keys": [
            "aws_product"
          ],
          "based_on_costs": [
            {
              "condition": "=",
              "tag": "aws_product",
              "value": "msk",
              "values": null
            },
            {
              "condition": "is not",
              "tag": "product",
              "value": "null",
              "values": null
            }
          ],
          "granularity": "daily",
          "method": "proportional"
        },
        "type": "shared",
        "updated": "2025-09-02T21:28:32Z",
        "version": 1
      },
      "id": "523",
      "type": "arbitrary_rule"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
List custom allocation rules returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_custom_allocation_rules()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# List custom allocation rules returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_custom_allocation_rules()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// List custom allocation rules returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListCustomAllocationRules(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCustomAllocationRules`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCustomAllocationRules`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// List custom allocation rules returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.ArbitraryRuleResponseArray;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      ArbitraryRuleResponseArray result = apiInstance.listCustomAllocationRules();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#listCustomAllocationRules");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// List custom allocation rules returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.list_custom_allocation_rules().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * List custom allocation rules returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .listCustomAllocationRules()
  .then((data: v2.ArbitraryRuleResponseArray) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.datadoghq.eu/api/v2/cost/arbitrary_rulehttps://api.ddog-gov.com/api/v2/cost/arbitrary_rulehttps://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rulehttps://api.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.us3.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule

Overview

Create a new custom allocation rule with the specified filters and allocation strategy.

Strategy Methods:

  • PROPORTIONAL/EVEN: Allocates costs proportionally/evenly based on existing costs. Requires: granularity, allocated_by_tag_keys. Optional: based_on_costs, allocated_by_filters, evaluate_grouped_by_tag_keys, evaluate_grouped_by_filters.
  • PROPORTIONAL_TIMESERIES/EVEN_TIMESERIES: Allocates based on timeseries data. Requires: granularity, based_on_timeseries. Optional: evaluate_grouped_by_tag_keys.
  • PERCENT: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations).

Filter Conditions:

  • Use value for single-value conditions: “is”, “is not”, “contains”, “=”, “!=”, “like”, “not like”
  • Use values for multi-value conditions: “in”, “not in”
  • Cannot use both value and values simultaneously.

Supported operators: is, is not, contains, in, not in, =, !=, like, not like

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

data

object

The definition of ArbitraryCostUpsertRequestData object.

attributes

object

The definition of ArbitraryCostUpsertRequestDataAttributes object.

costs_to_allocate [required]

[object]

The attributes costs_to_allocate.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

enabled

boolean

The attributes enabled.

order_id

int64

The attributes order_id.

provider [required]

[string]

The attributes provider.

rejected

boolean

The attributes rejected.

rule_name [required]

string

The attributes rule_name.

strategy [required]

object

The definition of ArbitraryCostUpsertRequestDataAttributesStrategy object.

allocated_by

[object]

The strategy allocated_by.

allocated_tags [required]

[object]

The items allocated_tags.

key [required]

string

The items key.

value [required]

string

The items value.

percentage [required]

double

The items percentage. The numeric value format should be a 32bit float value.

allocated_by_filters

[object]

The strategy allocated_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

allocated_by_tag_keys

[string]

The strategy allocated_by_tag_keys.

based_on_costs

[object]

The strategy based_on_costs.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

based_on_timeseries

object

The strategy based_on_timeseries.

evaluate_grouped_by_filters

[object]

The strategy evaluate_grouped_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

evaluate_grouped_by_tag_keys

[string]

The strategy evaluate_grouped_by_tag_keys.

granularity

string

The strategy granularity.

method [required]

string

The strategy method.

type [required]

string

The attributes type.

id

string

The ArbitraryCostUpsertRequestData id.

type [required]

enum

Upsert arbitrary rule resource type. Allowed enum values: upsert_arbitrary_rule

default: upsert_arbitrary_rule

{
  "data": {
    "attributes": {
      "costs_to_allocate": [
        {
          "condition": "is",
          "tag": "account_id",
          "value": "123456789"
        },
        {
          "condition": "in",
          "tag": "environment",
          "value": "",
          "values": [
            "production",
            "staging"
          ]
        }
      ],
      "enabled": true,
      "order_id": 1,
      "provider": [
        "aws",
        "gcp"
      ],
      "rule_name": "example-arbitrary-cost-rule",
      "strategy": {
        "allocated_by_tag_keys": [
          "team",
          "environment"
        ],
        "based_on_costs": [
          {
            "condition": "is",
            "tag": "service",
            "value": "web-api"
          },
          {
            "condition": "not in",
            "tag": "team",
            "value": "",
            "values": [
              "legacy",
              "deprecated"
            ]
          }
        ],
        "granularity": "daily",
        "method": "proportional"
      },
      "type": "shared"
    },
    "type": "upsert_arbitrary_rule"
  }
}

Response

OK

The definition of ArbitraryRuleResponse object.

Expand All

Field

Type

Description

data

object

The definition of ArbitraryRuleResponseData object.

attributes

object

The definition of ArbitraryRuleResponseDataAttributes object.

costs_to_allocate [required]

[object]

The attributes costs_to_allocate.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

created [required]

date-time

The attributes created.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

order_id [required]

int64

The attributes order_id.

processing_status

string

The attributes processing_status.

provider [required]

[string]

The attributes provider.

rejected

boolean

The attributes rejected.

rule_name [required]

string

The attributes rule_name.

strategy [required]

object

The definition of ArbitraryRuleResponseDataAttributesStrategy object.

allocated_by

[object]

The strategy allocated_by.

allocated_tags [required]

[object]

The items allocated_tags.

key [required]

string

The items key.

value [required]

string

The items value.

percentage [required]

double

The items percentage. The numeric value format should be a 32bit float value.

allocated_by_filters

[object]

The strategy allocated_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

allocated_by_tag_keys

[string]

The strategy allocated_by_tag_keys.

based_on_costs

[object]

The strategy based_on_costs.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

based_on_timeseries

object

The rule strategy based_on_timeseries.

evaluate_grouped_by_filters

[object]

The strategy evaluate_grouped_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

evaluate_grouped_by_tag_keys

[string]

The strategy evaluate_grouped_by_tag_keys.

granularity

string

The strategy granularity.

method [required]

string

The strategy method.

type [required]

string

The attributes type.

updated [required]

date-time

The attributes updated.

version [required]

int32

The attributes version.

id

string

The ArbitraryRuleResponseData id.

type [required]

enum

Arbitrary rule resource type. Allowed enum values: arbitrary_rule

default: arbitrary_rule

{
  "data": {
    "attributes": {
      "costs_to_allocate": [
        {
          "condition": "is",
          "tag": "account_id",
          "value": "123456789",
          "values": null
        },
        {
          "condition": "in",
          "tag": "environment",
          "value": "",
          "values": [
            "production",
            "staging"
          ]
        }
      ],
      "created": "2023-01-01T12:00:00Z",
      "enabled": true,
      "last_modified_user_uuid": "user-123-uuid",
      "order_id": 1,
      "provider": [
        "aws",
        "gcp"
      ],
      "rule_name": "Example custom allocation rule",
      "strategy": {
        "allocated_by_tag_keys": [
          "team",
          "environment"
        ],
        "based_on_costs": [
          {
            "condition": "is",
            "tag": "service",
            "value": "web-api",
            "values": null
          },
          {
            "condition": "not in",
            "tag": "team",
            "value": "",
            "values": [
              "legacy",
              "deprecated"
            ]
          }
        ],
        "granularity": "daily",
        "method": "proportional"
      },
      "type": "shared",
      "updated": "2023-01-01T12:00:00Z",
      "version": 1
    },
    "id": "123",
    "type": "arbitrary_rule"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "costs_to_allocate": [ { "condition": "is", "tag": "account_id", "value": "123456789" }, { "condition": "in", "tag": "environment", "value": "", "values": [ "production", "staging" ] } ], "enabled": true, "order_id": 1, "provider": [ "aws", "gcp" ], "rule_name": "example-arbitrary-cost-rule", "strategy": { "allocated_by_tag_keys": [ "team", "environment" ], "based_on_costs": [ { "condition": "is", "tag": "service", "value": "web-api" }, { "condition": "not in", "tag": "team", "value": "", "values": [ "legacy", "deprecated" ] } ], "granularity": "daily", "method": "proportional" }, "type": "shared" }, "type": "upsert_arbitrary_rule" } } EOF
// Create custom allocation rule returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.ArbitraryCostUpsertRequest{
		Data: &datadogV2.ArbitraryCostUpsertRequestData{
			Attributes: &datadogV2.ArbitraryCostUpsertRequestDataAttributes{
				CostsToAllocate: []datadogV2.ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems{
					{
						Condition: "is",
						Tag:       "account_id",
						Value:     datadog.PtrString("123456789"),
					},
					{
						Condition: "in",
						Tag:       "environment",
						Value:     datadog.PtrString(""),
						Values: *datadog.NewNullableList(&[]string{
							"production",
							"staging",
						}),
					},
				},
				Enabled: datadog.PtrBool(true),
				OrderId: datadog.PtrInt64(1),
				Provider: []string{
					"aws",
					"gcp",
				},
				RuleName: "example-arbitrary-cost-rule",
				Strategy: datadogV2.ArbitraryCostUpsertRequestDataAttributesStrategy{
					AllocatedByTagKeys: []string{
						"team",
						"environment",
					},
					BasedOnCosts: []datadogV2.ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems{
						{
							Condition: "is",
							Tag:       "service",
							Value:     datadog.PtrString("web-api"),
						},
						{
							Condition: "not in",
							Tag:       "team",
							Value:     datadog.PtrString(""),
							Values: *datadog.NewNullableList(&[]string{
								"legacy",
								"deprecated",
							}),
						},
					},
					Granularity: datadog.PtrString("daily"),
					Method:      "proportional",
				},
				Type: "shared",
			},
			Type: datadogV2.ARBITRARYCOSTUPSERTREQUESTDATATYPE_UPSERT_ARBITRARY_RULE,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.CreateCustomAllocationRule(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.CreateCustomAllocationRule`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.CreateCustomAllocationRule`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create custom allocation rule returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequest;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestData;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataAttributes;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataAttributesStrategy;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataType;
import com.datadog.api.client.v2.model.ArbitraryRuleResponse;
import java.util.Arrays;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    ArbitraryCostUpsertRequest body =
        new ArbitraryCostUpsertRequest()
            .data(
                new ArbitraryCostUpsertRequestData()
                    .attributes(
                        new ArbitraryCostUpsertRequestDataAttributes()
                            .costsToAllocate(
                                Arrays.asList(
                                    new ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems()
                                        .condition("is")
                                        .tag("account_id")
                                        .value("123456789"),
                                    new ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems()
                                        .condition("in")
                                        .tag("environment")
                                        .value("")
                                        .values(Arrays.asList("production", "staging"))))
                            .enabled(true)
                            .orderId(1L)
                            .provider(Arrays.asList("aws", "gcp"))
                            .ruleName("example-arbitrary-cost-rule")
                            .strategy(
                                new ArbitraryCostUpsertRequestDataAttributesStrategy()
                                    .allocatedByTagKeys(Arrays.asList("team", "environment"))
                                    .basedOnCosts(
                                        Arrays.asList(
                                            new ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems()
                                                .condition("is")
                                                .tag("service")
                                                .value("web-api"),
                                            new ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems()
                                                .condition("not in")
                                                .tag("team")
                                                .value("")
                                                .values(Arrays.asList("legacy", "deprecated"))))
                                    .granularity("daily")
                                    .method("proportional"))
                            .type("shared"))
                    .type(ArbitraryCostUpsertRequestDataType.UPSERT_ARBITRARY_RULE));

    try {
      ArbitraryRuleResponse result = apiInstance.createCustomAllocationRule(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#createCustomAllocationRule");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create custom allocation rule returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.arbitrary_cost_upsert_request import ArbitraryCostUpsertRequest
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data import ArbitraryCostUpsertRequestData
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_attributes import (
    ArbitraryCostUpsertRequestDataAttributes,
)
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_attributes_costs_to_allocate_items import (
    ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems,
)
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_attributes_strategy import (
    ArbitraryCostUpsertRequestDataAttributesStrategy,
)
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_attributes_strategy_based_on_costs_items import (
    ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems,
)
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_type import ArbitraryCostUpsertRequestDataType

body = ArbitraryCostUpsertRequest(
    data=ArbitraryCostUpsertRequestData(
        attributes=ArbitraryCostUpsertRequestDataAttributes(
            costs_to_allocate=[
                ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems(
                    condition="is",
                    tag="account_id",
                    value="123456789",
                ),
                ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems(
                    condition="in",
                    tag="environment",
                    value="",
                    values=[
                        "production",
                        "staging",
                    ],
                ),
            ],
            enabled=True,
            order_id=1,
            provider=[
                "aws",
                "gcp",
            ],
            rule_name="example-arbitrary-cost-rule",
            strategy=ArbitraryCostUpsertRequestDataAttributesStrategy(
                allocated_by_tag_keys=[
                    "team",
                    "environment",
                ],
                based_on_costs=[
                    ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems(
                        condition="is",
                        tag="service",
                        value="web-api",
                    ),
                    ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems(
                        condition="not in",
                        tag="team",
                        value="",
                        values=[
                            "legacy",
                            "deprecated",
                        ],
                    ),
                ],
                granularity="daily",
                method="proportional",
            ),
            type="shared",
        ),
        type=ArbitraryCostUpsertRequestDataType.UPSERT_ARBITRARY_RULE,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.create_custom_allocation_rule(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create custom allocation rule returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::ArbitraryCostUpsertRequest.new({
  data: DatadogAPIClient::V2::ArbitraryCostUpsertRequestData.new({
    attributes: DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributes.new({
      costs_to_allocate: [
        DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems.new({
          condition: "is",
          tag: "account_id",
          value: "123456789",
        }),
        DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems.new({
          condition: "in",
          tag: "environment",
          value: "",
          values: [
            "production",
            "staging",
          ],
        }),
      ],
      enabled: true,
      order_id: 1,
      provider: [
        "aws",
        "gcp",
      ],
      rule_name: "example-arbitrary-cost-rule",
      strategy: DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesStrategy.new({
        allocated_by_tag_keys: [
          "team",
          "environment",
        ],
        based_on_costs: [
          DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems.new({
            condition: "is",
            tag: "service",
            value: "web-api",
          }),
          DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems.new({
            condition: "not in",
            tag: "team",
            value: "",
            values: [
              "legacy",
              "deprecated",
            ],
          }),
        ],
        granularity: "daily",
        method: "proportional",
      }),
      type: "shared",
    }),
    type: DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataType::UPSERT_ARBITRARY_RULE,
  }),
})
p api_instance.create_custom_allocation_rule(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Create custom allocation rule returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequest;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestData;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataAttributes;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataAttributesStrategy;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataType;

#[tokio::main]
async fn main() {
    let body = ArbitraryCostUpsertRequest::new().data(
        ArbitraryCostUpsertRequestData::new(
            ArbitraryCostUpsertRequestDataType::UPSERT_ARBITRARY_RULE,
        )
        .attributes(
            ArbitraryCostUpsertRequestDataAttributes::new(
                vec![
                    ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems::new(
                        "is".to_string(),
                        "account_id".to_string(),
                    )
                    .value("123456789".to_string()),
                    ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems::new(
                        "in".to_string(),
                        "environment".to_string(),
                    )
                    .value("".to_string())
                    .values(Some(vec!["production".to_string(), "staging".to_string()])),
                ],
                vec!["aws".to_string(), "gcp".to_string()],
                "example-arbitrary-cost-rule".to_string(),
                ArbitraryCostUpsertRequestDataAttributesStrategy::new("proportional".to_string())
                    .allocated_by_tag_keys(vec!["team".to_string(), "environment".to_string()])
                    .based_on_costs(vec![
                        ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems::new(
                            "is".to_string(),
                            "service".to_string(),
                        )
                        .value("web-api".to_string()),
                        ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems::new(
                            "not in".to_string(),
                            "team".to_string(),
                        )
                        .value("".to_string())
                        .values(Some(vec!["legacy".to_string(), "deprecated".to_string()])),
                    ])
                    .granularity("daily".to_string()),
                "shared".to_string(),
            )
            .enabled(true)
            .order_id(1),
        ),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.create_custom_allocation_rule(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Create custom allocation rule returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiCreateCustomAllocationRuleRequest = {
  body: {
    data: {
      attributes: {
        costsToAllocate: [
          {
            condition: "is",
            tag: "account_id",
            value: "123456789",
          },
          {
            condition: "in",
            tag: "environment",
            value: "",
            values: ["production", "staging"],
          },
        ],
        enabled: true,
        orderId: 1,
        provider: ["aws", "gcp"],
        ruleName: "example-arbitrary-cost-rule",
        strategy: {
          allocatedByTagKeys: ["team", "environment"],
          basedOnCosts: [
            {
              condition: "is",
              tag: "service",
              value: "web-api",
            },
            {
              condition: "not in",
              tag: "team",
              value: "",
              values: ["legacy", "deprecated"],
            },
          ],
          granularity: "daily",
          method: "proportional",
        },
        type: "shared",
      },
      type: "upsert_arbitrary_rule",
    },
  },
};

apiInstance
  .createCustomAllocationRule(params)
  .then((data: v2.ArbitraryRuleResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PATCH https://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.datadoghq.eu/api/v2/cost/arbitrary_rule/{rule_id}https://api.ddog-gov.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us3.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}

Overview

Update an existing custom allocation rule with new filters and allocation strategy.

Strategy Methods:

  • PROPORTIONAL/EVEN: Allocates costs proportionally/evenly based on existing costs. Requires: granularity, allocated_by_tag_keys. Optional: based_on_costs, allocated_by_filters, evaluate_grouped_by_tag_keys, evaluate_grouped_by_filters.
  • PROPORTIONAL_TIMESERIES/EVEN_TIMESERIES: Allocates based on timeseries data. Requires: granularity, based_on_timeseries. Optional: evaluate_grouped_by_tag_keys.
  • PERCENT: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations).
  • USAGE_METRIC: Allocates based on usage metrics (implementation varies).

Filter Conditions:

  • Use value for single-value conditions: “is”, “is not”, “contains”, “=”, “!=”, “like”, “not like”
  • Use values for multi-value conditions: “in”, “not in”
  • Cannot use both value and values simultaneously.

Supported operators: is, is not, contains, in, not in, =, !=, like, not like

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

rule_id [required]

integer

The unique identifier of the custom allocation rule

Request

Body Data (required)

Expand All

Field

Type

Description

data

object

The definition of ArbitraryCostUpsertRequestData object.

attributes

object

The definition of ArbitraryCostUpsertRequestDataAttributes object.

costs_to_allocate [required]

[object]

The attributes costs_to_allocate.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

enabled

boolean

The attributes enabled.

order_id

int64

The attributes order_id.

provider [required]

[string]

The attributes provider.

rejected

boolean

The attributes rejected.

rule_name [required]

string

The attributes rule_name.

strategy [required]

object

The definition of ArbitraryCostUpsertRequestDataAttributesStrategy object.

allocated_by

[object]

The strategy allocated_by.

allocated_tags [required]

[object]

The items allocated_tags.

key [required]

string

The items key.

value [required]

string

The items value.

percentage [required]

double

The items percentage. The numeric value format should be a 32bit float value.

allocated_by_filters

[object]

The strategy allocated_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

allocated_by_tag_keys

[string]

The strategy allocated_by_tag_keys.

based_on_costs

[object]

The strategy based_on_costs.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

based_on_timeseries

object

The strategy based_on_timeseries.

evaluate_grouped_by_filters

[object]

The strategy evaluate_grouped_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

evaluate_grouped_by_tag_keys

[string]

The strategy evaluate_grouped_by_tag_keys.

granularity

string

The strategy granularity.

method [required]

string

The strategy method.

type [required]

string

The attributes type.

id

string

The ArbitraryCostUpsertRequestData id.

type [required]

enum

Upsert arbitrary rule resource type. Allowed enum values: upsert_arbitrary_rule

default: upsert_arbitrary_rule

{
  "data": {
    "attributes": {
      "costs_to_allocate": [
        {
          "condition": "is",
          "tag": "account_id",
          "value": "123456789",
          "values": []
        },
        {
          "condition": "in",
          "tag": "environment",
          "value": "",
          "values": [
            "production",
            "staging"
          ]
        }
      ],
      "enabled": true,
      "order_id": 1,
      "provider": [
        "aws",
        "gcp"
      ],
      "rule_name": "example-arbitrary-cost-rule",
      "strategy": {
        "allocated_by_tag_keys": [
          "team",
          "environment"
        ],
        "based_on_costs": [
          {
            "condition": "is",
            "tag": "service",
            "value": "web-api",
            "values": []
          },
          {
            "condition": "not in",
            "tag": "team",
            "value": "",
            "values": [
              "legacy",
              "deprecated"
            ]
          }
        ],
        "granularity": "daily",
        "method": "proportional"
      },
      "type": "shared"
    },
    "type": "upsert_arbitrary_rule"
  }
}

Response

OK

The definition of ArbitraryRuleResponse object.

Expand All

Field

Type

Description

data

object

The definition of ArbitraryRuleResponseData object.

attributes

object

The definition of ArbitraryRuleResponseDataAttributes object.

costs_to_allocate [required]

[object]

The attributes costs_to_allocate.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

created [required]

date-time

The attributes created.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

order_id [required]

int64

The attributes order_id.

processing_status

string

The attributes processing_status.

provider [required]

[string]

The attributes provider.

rejected

boolean

The attributes rejected.

rule_name [required]

string

The attributes rule_name.

strategy [required]

object

The definition of ArbitraryRuleResponseDataAttributesStrategy object.

allocated_by

[object]

The strategy allocated_by.

allocated_tags [required]

[object]

The items allocated_tags.

key [required]

string

The items key.

value [required]

string

The items value.

percentage [required]

double

The items percentage. The numeric value format should be a 32bit float value.

allocated_by_filters

[object]

The strategy allocated_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

allocated_by_tag_keys

[string]

The strategy allocated_by_tag_keys.

based_on_costs

[object]

The strategy based_on_costs.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

based_on_timeseries

object

The rule strategy based_on_timeseries.

evaluate_grouped_by_filters

[object]

The strategy evaluate_grouped_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

evaluate_grouped_by_tag_keys

[string]

The strategy evaluate_grouped_by_tag_keys.

granularity

string

The strategy granularity.

method [required]

string

The strategy method.

type [required]

string

The attributes type.

updated [required]

date-time

The attributes updated.

version [required]

int32

The attributes version.

id

string

The ArbitraryRuleResponseData id.

type [required]

enum

Arbitrary rule resource type. Allowed enum values: arbitrary_rule

default: arbitrary_rule

{
  "data": {
    "attributes": {
      "costs_to_allocate": [
        {
          "condition": "is",
          "tag": "account_id",
          "value": "123456789",
          "values": null
        },
        {
          "condition": "in",
          "tag": "environment",
          "value": "",
          "values": [
            "production",
            "staging"
          ]
        }
      ],
      "created": "2023-01-01T12:00:00Z",
      "enabled": true,
      "last_modified_user_uuid": "user-123-uuid",
      "order_id": 1,
      "provider": [
        "aws",
        "gcp"
      ],
      "rule_name": "Example custom allocation rule",
      "strategy": {
        "allocated_by_tag_keys": [
          "team",
          "environment"
        ],
        "based_on_costs": [
          {
            "condition": "is",
            "tag": "service",
            "value": "web-api",
            "values": null
          },
          {
            "condition": "not in",
            "tag": "team",
            "value": "",
            "values": [
              "legacy",
              "deprecated"
            ]
          }
        ],
        "granularity": "daily",
        "method": "proportional"
      },
      "type": "shared",
      "updated": "2023-01-01T12:00:00Z",
      "version": 1
    },
    "id": "123",
    "type": "arbitrary_rule"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Path parameters
export rule_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/${rule_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "costs_to_allocate": [ { "condition": "is", "tag": "account_id", "value": "123456789" }, { "condition": "in", "tag": "environment", "value": "", "values": [ "production", "staging" ] } ], "enabled": true, "order_id": 1, "provider": [ "aws", "gcp" ], "rule_name": "example-arbitrary-cost-rule", "strategy": { "allocated_by_tag_keys": [ "team", "environment" ], "based_on_costs": [ { "condition": "is", "tag": "service", "value": "web-api" }, { "condition": "not in", "tag": "team", "value": "", "values": [ "legacy", "deprecated" ] } ], "granularity": "daily", "method": "proportional" }, "type": "shared" }, "type": "upsert_arbitrary_rule" } } EOF
// Update custom allocation rule returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.ArbitraryCostUpsertRequest{
		Data: &datadogV2.ArbitraryCostUpsertRequestData{
			Attributes: &datadogV2.ArbitraryCostUpsertRequestDataAttributes{
				CostsToAllocate: []datadogV2.ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems{
					{
						Condition: "is",
						Tag:       "account_id",
						Value:     datadog.PtrString("123456789"),
						Values:    *datadog.NewNullableList(&[]string{}),
					},
					{
						Condition: "in",
						Tag:       "environment",
						Value:     datadog.PtrString(""),
						Values: *datadog.NewNullableList(&[]string{
							"production",
							"staging",
						}),
					},
				},
				Enabled: datadog.PtrBool(true),
				OrderId: datadog.PtrInt64(1),
				Provider: []string{
					"aws",
					"gcp",
				},
				RuleName: "example-arbitrary-cost-rule",
				Strategy: datadogV2.ArbitraryCostUpsertRequestDataAttributesStrategy{
					AllocatedByTagKeys: []string{
						"team",
						"environment",
					},
					BasedOnCosts: []datadogV2.ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems{
						{
							Condition: "is",
							Tag:       "service",
							Value:     datadog.PtrString("web-api"),
							Values:    *datadog.NewNullableList(&[]string{}),
						},
						{
							Condition: "not in",
							Tag:       "team",
							Value:     datadog.PtrString(""),
							Values: *datadog.NewNullableList(&[]string{
								"legacy",
								"deprecated",
							}),
						},
					},
					Granularity: datadog.PtrString("daily"),
					Method:      "proportional",
				},
				Type: "shared",
			},
			Type: datadogV2.ARBITRARYCOSTUPSERTREQUESTDATATYPE_UPSERT_ARBITRARY_RULE,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.UpdateCustomAllocationRule(ctx, 683, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpdateCustomAllocationRule`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpdateCustomAllocationRule`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Update custom allocation rule returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequest;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestData;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataAttributes;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataAttributesStrategy;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems;
import com.datadog.api.client.v2.model.ArbitraryCostUpsertRequestDataType;
import com.datadog.api.client.v2.model.ArbitraryRuleResponse;
import java.util.Arrays;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    ArbitraryCostUpsertRequest body =
        new ArbitraryCostUpsertRequest()
            .data(
                new ArbitraryCostUpsertRequestData()
                    .attributes(
                        new ArbitraryCostUpsertRequestDataAttributes()
                            .costsToAllocate(
                                Arrays.asList(
                                    new ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems()
                                        .condition("is")
                                        .tag("account_id")
                                        .value("123456789"),
                                    new ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems()
                                        .condition("in")
                                        .tag("environment")
                                        .value("")
                                        .values(Arrays.asList("production", "staging"))))
                            .enabled(true)
                            .orderId(1L)
                            .provider(Arrays.asList("aws", "gcp"))
                            .ruleName("example-arbitrary-cost-rule")
                            .strategy(
                                new ArbitraryCostUpsertRequestDataAttributesStrategy()
                                    .allocatedByTagKeys(Arrays.asList("team", "environment"))
                                    .basedOnCosts(
                                        Arrays.asList(
                                            new ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems()
                                                .condition("is")
                                                .tag("service")
                                                .value("web-api"),
                                            new ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems()
                                                .condition("not in")
                                                .tag("team")
                                                .value("")
                                                .values(Arrays.asList("legacy", "deprecated"))))
                                    .granularity("daily")
                                    .method("proportional"))
                            .type("shared"))
                    .type(ArbitraryCostUpsertRequestDataType.UPSERT_ARBITRARY_RULE));

    try {
      ArbitraryRuleResponse result = apiInstance.updateCustomAllocationRule(683L, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#updateCustomAllocationRule");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Update custom allocation rule returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.arbitrary_cost_upsert_request import ArbitraryCostUpsertRequest
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data import ArbitraryCostUpsertRequestData
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_attributes import (
    ArbitraryCostUpsertRequestDataAttributes,
)
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_attributes_costs_to_allocate_items import (
    ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems,
)
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_attributes_strategy import (
    ArbitraryCostUpsertRequestDataAttributesStrategy,
)
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_attributes_strategy_based_on_costs_items import (
    ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems,
)
from datadog_api_client.v2.model.arbitrary_cost_upsert_request_data_type import ArbitraryCostUpsertRequestDataType

body = ArbitraryCostUpsertRequest(
    data=ArbitraryCostUpsertRequestData(
        attributes=ArbitraryCostUpsertRequestDataAttributes(
            costs_to_allocate=[
                ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems(
                    condition="is",
                    tag="account_id",
                    value="123456789",
                    values=[],
                ),
                ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems(
                    condition="in",
                    tag="environment",
                    value="",
                    values=[
                        "production",
                        "staging",
                    ],
                ),
            ],
            enabled=True,
            order_id=1,
            provider=[
                "aws",
                "gcp",
            ],
            rule_name="example-arbitrary-cost-rule",
            strategy=ArbitraryCostUpsertRequestDataAttributesStrategy(
                allocated_by_tag_keys=[
                    "team",
                    "environment",
                ],
                based_on_costs=[
                    ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems(
                        condition="is",
                        tag="service",
                        value="web-api",
                        values=[],
                    ),
                    ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems(
                        condition="not in",
                        tag="team",
                        value="",
                        values=[
                            "legacy",
                            "deprecated",
                        ],
                    ),
                ],
                granularity="daily",
                method="proportional",
            ),
            type="shared",
        ),
        type=ArbitraryCostUpsertRequestDataType.UPSERT_ARBITRARY_RULE,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.update_custom_allocation_rule(rule_id=683, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Update custom allocation rule returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::ArbitraryCostUpsertRequest.new({
  data: DatadogAPIClient::V2::ArbitraryCostUpsertRequestData.new({
    attributes: DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributes.new({
      costs_to_allocate: [
        DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems.new({
          condition: "is",
          tag: "account_id",
          value: "123456789",
          values: [],
        }),
        DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems.new({
          condition: "in",
          tag: "environment",
          value: "",
          values: [
            "production",
            "staging",
          ],
        }),
      ],
      enabled: true,
      order_id: 1,
      provider: [
        "aws",
        "gcp",
      ],
      rule_name: "example-arbitrary-cost-rule",
      strategy: DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesStrategy.new({
        allocated_by_tag_keys: [
          "team",
          "environment",
        ],
        based_on_costs: [
          DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems.new({
            condition: "is",
            tag: "service",
            value: "web-api",
            values: [],
          }),
          DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems.new({
            condition: "not in",
            tag: "team",
            value: "",
            values: [
              "legacy",
              "deprecated",
            ],
          }),
        ],
        granularity: "daily",
        method: "proportional",
      }),
      type: "shared",
    }),
    type: DatadogAPIClient::V2::ArbitraryCostUpsertRequestDataType::UPSERT_ARBITRARY_RULE,
  }),
})
p api_instance.update_custom_allocation_rule(683, body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Update custom allocation rule returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequest;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestData;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataAttributes;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataAttributesStrategy;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems;
use datadog_api_client::datadogV2::model::ArbitraryCostUpsertRequestDataType;

#[tokio::main]
async fn main() {
    let body = ArbitraryCostUpsertRequest::new().data(
        ArbitraryCostUpsertRequestData::new(
            ArbitraryCostUpsertRequestDataType::UPSERT_ARBITRARY_RULE,
        )
        .attributes(
            ArbitraryCostUpsertRequestDataAttributes::new(
                vec![
                    ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems::new(
                        "is".to_string(),
                        "account_id".to_string(),
                    )
                    .value("123456789".to_string())
                    .values(Some(vec![])),
                    ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems::new(
                        "in".to_string(),
                        "environment".to_string(),
                    )
                    .value("".to_string())
                    .values(Some(vec!["production".to_string(), "staging".to_string()])),
                ],
                vec!["aws".to_string(), "gcp".to_string()],
                "example-arbitrary-cost-rule".to_string(),
                ArbitraryCostUpsertRequestDataAttributesStrategy::new("proportional".to_string())
                    .allocated_by_tag_keys(vec!["team".to_string(), "environment".to_string()])
                    .based_on_costs(vec![
                        ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems::new(
                            "is".to_string(),
                            "service".to_string(),
                        )
                        .value("web-api".to_string())
                        .values(Some(vec![])),
                        ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems::new(
                            "not in".to_string(),
                            "team".to_string(),
                        )
                        .value("".to_string())
                        .values(Some(vec!["legacy".to_string(), "deprecated".to_string()])),
                    ])
                    .granularity("daily".to_string()),
                "shared".to_string(),
            )
            .enabled(true)
            .order_id(1),
        ),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.update_custom_allocation_rule(683, body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Update custom allocation rule returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiUpdateCustomAllocationRuleRequest = {
  body: {
    data: {
      attributes: {
        costsToAllocate: [
          {
            condition: "is",
            tag: "account_id",
            value: "123456789",
            values: [],
          },
          {
            condition: "in",
            tag: "environment",
            value: "",
            values: ["production", "staging"],
          },
        ],
        enabled: true,
        orderId: 1,
        provider: ["aws", "gcp"],
        ruleName: "example-arbitrary-cost-rule",
        strategy: {
          allocatedByTagKeys: ["team", "environment"],
          basedOnCosts: [
            {
              condition: "is",
              tag: "service",
              value: "web-api",
              values: [],
            },
            {
              condition: "not in",
              tag: "team",
              value: "",
              values: ["legacy", "deprecated"],
            },
          ],
          granularity: "daily",
          method: "proportional",
        },
        type: "shared",
      },
      type: "upsert_arbitrary_rule",
    },
  },
  ruleId: 683,
};

apiInstance
  .updateCustomAllocationRule(params)
  .then((data: v2.ArbitraryRuleResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.datadoghq.eu/api/v2/cost/arbitrary_rule/{rule_id}https://api.ddog-gov.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us3.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}

Overview

Delete a custom allocation rule - Delete an existing custom allocation rule by its ID

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

rule_id [required]

integer

The unique identifier of the custom allocation rule

Response

No Content

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export rule_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/${rule_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete custom allocation rule returns "No Content" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.delete_custom_allocation_rule(
        rule_id=683,
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete custom allocation rule returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
api_instance.delete_custom_allocation_rule(683)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete custom allocation rule returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.DeleteCustomAllocationRule(ctx, 683)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteCustomAllocationRule`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete custom allocation rule returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      apiInstance.deleteCustomAllocationRule(683L);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#deleteCustomAllocationRule");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Delete custom allocation rule returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.delete_custom_allocation_rule(683).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Delete custom allocation rule returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiDeleteCustomAllocationRuleRequest = {
  ruleId: 683,
};

apiInstance
  .deleteCustomAllocationRule(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.datadoghq.eu/api/v2/cost/arbitrary_rule/{rule_id}https://api.ddog-gov.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us3.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/{rule_id}

Overview

Get a specific custom allocation rule - Retrieve a specific custom allocation rule by its ID

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

rule_id [required]

integer

The unique identifier of the custom allocation rule

Response

OK

The definition of ArbitraryRuleResponse object.

Expand All

Field

Type

Description

data

object

The definition of ArbitraryRuleResponseData object.

attributes

object

The definition of ArbitraryRuleResponseDataAttributes object.

costs_to_allocate [required]

[object]

The attributes costs_to_allocate.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

created [required]

date-time

The attributes created.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

order_id [required]

int64

The attributes order_id.

processing_status

string

The attributes processing_status.

provider [required]

[string]

The attributes provider.

rejected

boolean

The attributes rejected.

rule_name [required]

string

The attributes rule_name.

strategy [required]

object

The definition of ArbitraryRuleResponseDataAttributesStrategy object.

allocated_by

[object]

The strategy allocated_by.

allocated_tags [required]

[object]

The items allocated_tags.

key [required]

string

The items key.

value [required]

string

The items value.

percentage [required]

double

The items percentage. The numeric value format should be a 32bit float value.

allocated_by_filters

[object]

The strategy allocated_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

allocated_by_tag_keys

[string]

The strategy allocated_by_tag_keys.

based_on_costs

[object]

The strategy based_on_costs.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

based_on_timeseries

object

The rule strategy based_on_timeseries.

evaluate_grouped_by_filters

[object]

The strategy evaluate_grouped_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

evaluate_grouped_by_tag_keys

[string]

The strategy evaluate_grouped_by_tag_keys.

granularity

string

The strategy granularity.

method [required]

string

The strategy method.

type [required]

string

The attributes type.

updated [required]

date-time

The attributes updated.

version [required]

int32

The attributes version.

id

string

The ArbitraryRuleResponseData id.

type [required]

enum

Arbitrary rule resource type. Allowed enum values: arbitrary_rule

default: arbitrary_rule

{
  "data": {
    "attributes": {
      "costs_to_allocate": [
        {
          "condition": "is",
          "tag": "account_id",
          "value": "123456789",
          "values": null
        },
        {
          "condition": "in",
          "tag": "environment",
          "value": "",
          "values": [
            "production",
            "staging"
          ]
        }
      ],
      "created": "2023-01-01T12:00:00Z",
      "enabled": true,
      "last_modified_user_uuid": "user-123-uuid",
      "order_id": 1,
      "provider": [
        "aws",
        "gcp"
      ],
      "rule_name": "Example custom allocation rule",
      "strategy": {
        "allocated_by_tag_keys": [
          "team",
          "environment"
        ],
        "based_on_costs": [
          {
            "condition": "is",
            "tag": "service",
            "value": "web-api",
            "values": null
          },
          {
            "condition": "not in",
            "tag": "team",
            "value": "",
            "values": [
              "legacy",
              "deprecated"
            ]
          }
        ],
        "granularity": "daily",
        "method": "proportional"
      },
      "type": "shared",
      "updated": "2023-01-01T12:00:00Z",
      "version": 1
    },
    "id": "123",
    "type": "arbitrary_rule"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export rule_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/${rule_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get custom allocation rule returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.get_custom_allocation_rule(
        rule_id=683,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get custom allocation rule returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.get_custom_allocation_rule(683)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get custom allocation rule returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.GetCustomAllocationRule(ctx, 683)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetCustomAllocationRule`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetCustomAllocationRule`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get custom allocation rule returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.ArbitraryRuleResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      ArbitraryRuleResponse result = apiInstance.getCustomAllocationRule(683L);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#getCustomAllocationRule");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get custom allocation rule returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.get_custom_allocation_rule(683).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get custom allocation rule returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiGetCustomAllocationRuleRequest = {
  ruleId: 683,
};

apiInstance
  .getCustomAllocationRule(params)
  .then((data: v2.ArbitraryRuleResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.datadoghq.eu/api/v2/cost/arbitrary_rule/reorderhttps://api.ddog-gov.com/api/v2/cost/arbitrary_rule/reorderhttps://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rule/reorderhttps://api.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.us3.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/reorder

Overview

Reorder custom allocation rules - Change the execution order of custom allocation rules.

Important: You must provide the complete list of all rule IDs in the desired execution order. The API will reorder ALL rules according to the provided sequence.

Rules are executed in the order specified, with lower indices (earlier in the array) having higher priority.

Example: If you have rules with IDs [123, 456, 789] and want to change order from 123→456→789 to 456→123→789, send: [{“id”: “456”}, {“id”: “123”}, {“id”: “789”}]

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

[object]

The ReorderRuleResourceArray data.

id

string

The ReorderRuleResourceData id.

type [required]

enum

Arbitrary rule resource type. Allowed enum values: arbitrary_rule

default: arbitrary_rule

{
  "data": [
    {
      "id": "string",
      "type": "arbitrary_rule"
    }
  ]
}

Response

Successfully reordered rules

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/reorder" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": [ { "id": "456", "type": "arbitrary_rule" }, { "id": "123", "type": "arbitrary_rule" }, { "id": "789", "type": "arbitrary_rule" } ] } EOF
"""
Reorder custom allocation rules returns "Successfully reordered rules" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.reorder_rule_resource_array import ReorderRuleResourceArray
from datadog_api_client.v2.model.reorder_rule_resource_data import ReorderRuleResourceData
from datadog_api_client.v2.model.reorder_rule_resource_data_type import ReorderRuleResourceDataType

body = ReorderRuleResourceArray(
    data=[
        ReorderRuleResourceData(
            id="456",
            type=ReorderRuleResourceDataType.ARBITRARY_RULE,
        ),
        ReorderRuleResourceData(
            id="123",
            type=ReorderRuleResourceDataType.ARBITRARY_RULE,
        ),
        ReorderRuleResourceData(
            id="789",
            type=ReorderRuleResourceDataType.ARBITRARY_RULE,
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.reorder_custom_allocation_rules(body=body)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Reorder custom allocation rules returns "Successfully reordered rules" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::ReorderRuleResourceArray.new({
  data: [
    DatadogAPIClient::V2::ReorderRuleResourceData.new({
      id: "456",
      type: DatadogAPIClient::V2::ReorderRuleResourceDataType::ARBITRARY_RULE,
    }),
    DatadogAPIClient::V2::ReorderRuleResourceData.new({
      id: "123",
      type: DatadogAPIClient::V2::ReorderRuleResourceDataType::ARBITRARY_RULE,
    }),
    DatadogAPIClient::V2::ReorderRuleResourceData.new({
      id: "789",
      type: DatadogAPIClient::V2::ReorderRuleResourceDataType::ARBITRARY_RULE,
    }),
  ],
})
api_instance.reorder_custom_allocation_rules(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Reorder custom allocation rules returns "Successfully reordered rules" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.ReorderRuleResourceArray{
		Data: []datadogV2.ReorderRuleResourceData{
			{
				Id:   datadog.PtrString("456"),
				Type: datadogV2.REORDERRULERESOURCEDATATYPE_ARBITRARY_RULE,
			},
			{
				Id:   datadog.PtrString("123"),
				Type: datadogV2.REORDERRULERESOURCEDATATYPE_ARBITRARY_RULE,
			},
			{
				Id:   datadog.PtrString("789"),
				Type: datadogV2.REORDERRULERESOURCEDATATYPE_ARBITRARY_RULE,
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.ReorderCustomAllocationRules(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ReorderCustomAllocationRules`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Reorder custom allocation rules returns "Successfully reordered rules" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.ReorderRuleResourceArray;
import com.datadog.api.client.v2.model.ReorderRuleResourceData;
import com.datadog.api.client.v2.model.ReorderRuleResourceDataType;
import java.util.Arrays;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    ReorderRuleResourceArray body =
        new ReorderRuleResourceArray()
            .data(
                Arrays.asList(
                    new ReorderRuleResourceData()
                        .id("456")
                        .type(ReorderRuleResourceDataType.ARBITRARY_RULE),
                    new ReorderRuleResourceData()
                        .id("123")
                        .type(ReorderRuleResourceDataType.ARBITRARY_RULE),
                    new ReorderRuleResourceData()
                        .id("789")
                        .type(ReorderRuleResourceDataType.ARBITRARY_RULE)));

    try {
      apiInstance.reorderCustomAllocationRules(body);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudCostManagementApi#reorderCustomAllocationRules");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Reorder custom allocation rules returns "Successfully reordered rules" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::ReorderRuleResourceArray;
use datadog_api_client::datadogV2::model::ReorderRuleResourceData;
use datadog_api_client::datadogV2::model::ReorderRuleResourceDataType;

#[tokio::main]
async fn main() {
    let body = ReorderRuleResourceArray::new(vec![
        ReorderRuleResourceData::new(ReorderRuleResourceDataType::ARBITRARY_RULE)
            .id("456".to_string()),
        ReorderRuleResourceData::new(ReorderRuleResourceDataType::ARBITRARY_RULE)
            .id("123".to_string()),
        ReorderRuleResourceData::new(ReorderRuleResourceDataType::ARBITRARY_RULE)
            .id("789".to_string()),
    ]);
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.reorder_custom_allocation_rules(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Reorder custom allocation rules returns "Successfully reordered rules" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiReorderCustomAllocationRulesRequest = {
  body: {
    data: [
      {
        id: "456",
        type: "arbitrary_rule",
      },
      {
        id: "123",
        type: "arbitrary_rule",
      },
      {
        id: "789",
        type: "arbitrary_rule",
      },
    ],
  },
};

apiInstance
  .reorderCustomAllocationRules(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/custom_costshttps://api.ap2.datadoghq.com/api/v2/cost/custom_costshttps://api.datadoghq.eu/api/v2/cost/custom_costshttps://api.ddog-gov.com/api/v2/cost/custom_costshttps://api.us2.ddog-gov.com/api/v2/cost/custom_costshttps://api.datadoghq.com/api/v2/cost/custom_costshttps://api.us3.datadoghq.com/api/v2/cost/custom_costshttps://api.us5.datadoghq.com/api/v2/cost/custom_costs

Overview

List the Custom Costs files. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

page[number]

integer

Page number for pagination

page[size]

integer

Page size for pagination

filter[status]

string

Filter by file status

filter[name]

string

Filter files by name with case-insensitive substring matching.

filter[provider]

array

Filter by provider.

sort

string

Sort key with optional descending prefix

Response

OK

Response for List Custom Costs files.

Expand All

Field

Type

Description

data

[object]

List of Custom Costs files.

attributes

object

Schema of a Custom Costs 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.

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 List Custom Costs endpoints.

count_by_status

object

Number of Custom Costs files per status.

<any-key>

int64

providers

[string]

List of available providers.

total_filtered_count

int64

Number of Custom Costs files returned by the List Custom Costs endpoint

version

string

Version of Custom Costs file

{
  "data": [
    {
      "attributes": {
        "billed_cost": 100.5,
        "billing_currency": "USD",
        "charge_period": {
          "end": 1706745600000,
          "start": 1704067200000
        },
        "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": {
    "count_by_status": {
      "<any-key>": "integer"
    },
    "providers": [],
    "total_filtered_count": "integer",
    "version": "string"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/custom_costs" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
List Custom Costs files returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_custom_costs_files()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# List Custom Costs files returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_custom_costs_files()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// List Custom Costs files returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListCustomCostsFiles(ctx, *datadogV2.NewListCustomCostsFilesOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCustomCostsFiles`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCustomCostsFiles`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// List Custom Costs files returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.CustomCostsFileListResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      CustomCostsFileListResponse result = apiInstance.listCustomCostsFiles();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#listCustomCostsFiles");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// List Custom Costs files returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::api_cloud_cost_management::ListCustomCostsFilesOptionalParams;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api
        .list_custom_costs_files(ListCustomCostsFilesOptionalParams::default())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * List Custom Costs files returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .listCustomCostsFiles()
  .then((data: v2.CustomCostsFileListResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v2/cost/custom_costshttps://api.ap2.datadoghq.com/api/v2/cost/custom_costshttps://api.datadoghq.eu/api/v2/cost/custom_costshttps://api.ddog-gov.com/api/v2/cost/custom_costshttps://api.us2.ddog-gov.com/api/v2/cost/custom_costshttps://api.datadoghq.com/api/v2/cost/custom_costshttps://api.us3.datadoghq.com/api/v2/cost/custom_costshttps://api.us5.datadoghq.com/api/v2/cost/custom_costs

Overview

Upload a Custom Costs file. This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

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

[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]

Response

Accepted

Response for Uploaded Custom Costs files.

Expand All

Field

Type

Description

data

object

JSON API format for a Custom Costs file.

attributes

object

Schema of a Custom Costs 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.

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 Upload 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
      },
      "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"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                          ## default
# 

# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/custom_costs" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF [ { "BilledCost": 100.5, "BillingCurrency": "USD", "ChargeDescription": "Monthly usage charge for my service", "ChargePeriodEnd": "2023-02-28", "ChargePeriodStart": "2023-02-01" } ] EOF
// Upload Custom Costs File returns "Accepted" response

package main

import (
	"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"
)

func main() {
	body := []datadogV2.CustomCostsFileLineItem{
		{
			ProviderName:      datadog.PtrString("my_provider"),
			ChargePeriodStart: datadog.PtrString("2023-05-06"),
			ChargePeriodEnd:   datadog.PtrString("2023-06-06"),
			ChargeDescription: datadog.PtrString("my_description"),
			BilledCost:        datadog.PtrFloat64(250),
			BillingCurrency:   datadog.PtrString("USD"),
			Tags: map[string]string{
				"key": "value",
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.UploadCustomCostsFile(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UploadCustomCostsFile`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UploadCustomCostsFile`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Upload Custom Costs File returns "Accepted" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.CustomCostsFileLineItem;
import com.datadog.api.client.v2.model.CustomCostsFileUploadResponse;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    List<CustomCostsFileLineItem> body =
        Collections.singletonList(
            new CustomCostsFileLineItem()
                .providerName("my_provider")
                .chargePeriodStart("2023-05-06")
                .chargePeriodEnd("2023-06-06")
                .chargeDescription("my_description")
                .billedCost(250.0)
                .billingCurrency("USD")
                .tags(Map.ofEntries(Map.entry("key", "value"))));

    try {
      CustomCostsFileUploadResponse result = apiInstance.uploadCustomCostsFile(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#uploadCustomCostsFile");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Upload Custom Costs File returns "Accepted" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem

body = [
    CustomCostsFileLineItem(
        provider_name="my_provider",
        charge_period_start="2023-05-06",
        charge_period_end="2023-06-06",
        charge_description="my_description",
        billed_cost=250.0,
        billing_currency="USD",
        tags=dict(
            key="value",
        ),
    ),
]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.upload_custom_costs_file(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Upload Custom Costs File returns "Accepted" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = [
  DatadogAPIClient::V2::CustomCostsFileLineItem.new({
    provider_name: "my_provider",
    charge_period_start: "2023-05-06",
    charge_period_end: "2023-06-06",
    charge_description: "my_description",
    billed_cost: 250,
    billing_currency: "USD",
    tags: {
      key: "value",
    },
  }),
]
p api_instance.upload_custom_costs_file(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Upload Custom Costs File returns "Accepted" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::CustomCostsFileLineItem;
use std::collections::BTreeMap;

#[tokio::main]
async fn main() {
    let body = vec![CustomCostsFileLineItem::new()
        .billed_cost(250.0 as f64)
        .billing_currency("USD".to_string())
        .charge_description("my_description".to_string())
        .charge_period_end("2023-06-06".to_string())
        .charge_period_start("2023-05-06".to_string())
        .provider_name("my_provider".to_string())
        .tags(BTreeMap::from([("key".to_string(), "value".to_string())]))];
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.upload_custom_costs_file(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Upload Custom Costs File returns "Accepted" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiUploadCustomCostsFileRequest = {
  body: [
    {
      providerName: "my_provider",
      chargePeriodStart: "2023-05-06",
      chargePeriodEnd: "2023-06-06",
      chargeDescription: "my_description",
      billedCost: 250,
      billingCurrency: "USD",
      tags: {
        key: "value",
      },
    },
  ],
};

apiInstance
  .uploadCustomCostsFile(params)
  .then((data: v2.CustomCostsFileUploadResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/cost/custom_costs/{file_id}https://api.ap2.datadoghq.com/api/v2/cost/custom_costs/{file_id}https://api.datadoghq.eu/api/v2/cost/custom_costs/{file_id}https://api.ddog-gov.com/api/v2/cost/custom_costs/{file_id}https://api.us2.ddog-gov.com/api/v2/cost/custom_costs/{file_id}https://api.datadoghq.com/api/v2/cost/custom_costs/{file_id}https://api.us3.datadoghq.com/api/v2/cost/custom_costs/{file_id}https://api.us5.datadoghq.com/api/v2/cost/custom_costs/{file_id}

Overview

Delete the specified Custom Costs file.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

file_id [required]

string

File ID.

Response

No Content

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export file_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/custom_costs/${file_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete Custom Costs file returns "No Content" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.delete_custom_costs_file(
        file_id="file_id",
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete Custom Costs file returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
api_instance.delete_custom_costs_file("file_id")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete Custom Costs file returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.DeleteCustomCostsFile(ctx, "file_id")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteCustomCostsFile`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete Custom Costs file returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      apiInstance.deleteCustomCostsFile("file_id");
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#deleteCustomCostsFile");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Delete Custom Costs file returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.delete_custom_costs_file("file_id".to_string()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Delete Custom Costs file returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiDeleteCustomCostsFileRequest = {
  fileId: "file_id",
};

apiInstance
  .deleteCustomCostsFile(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/custom_costs/{file_id}https://api.ap2.datadoghq.com/api/v2/cost/custom_costs/{file_id}https://api.datadoghq.eu/api/v2/cost/custom_costs/{file_id}https://api.ddog-gov.com/api/v2/cost/custom_costs/{file_id}https://api.us2.ddog-gov.com/api/v2/cost/custom_costs/{file_id}https://api.datadoghq.com/api/v2/cost/custom_costs/{file_id}https://api.us3.datadoghq.com/api/v2/cost/custom_costs/{file_id}https://api.us5.datadoghq.com/api/v2/cost/custom_costs/{file_id}

Overview

Fetch the specified Custom Costs file.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

file_id [required]

string

File ID.

Response

OK

Response for Get Custom Costs files.

Expand All

Field

Type

Description

data

object

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"
  }
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export file_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/custom_costs/${file_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get Custom Costs file returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.get_custom_costs_file(
        file_id="file_id",
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get Custom Costs file returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.get_custom_costs_file("file_id")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get Custom Costs file returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.GetCustomCostsFile(ctx, "file_id")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetCustomCostsFile`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetCustomCostsFile`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get Custom Costs file returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.CustomCostsFileGetResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      CustomCostsFileGetResponse result = apiInstance.getCustomCostsFile("file_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#getCustomCostsFile");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get Custom Costs file returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.get_custom_costs_file("file_id".to_string()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get Custom Costs file returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiGetCustomCostsFileRequest = {
  fileId: "file_id",
};

apiInstance
  .getCustomCostsFile(params)
  .then((data: v2.CustomCostsFileGetResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/budgetshttps://api.ap2.datadoghq.com/api/v2/cost/budgetshttps://api.datadoghq.eu/api/v2/cost/budgetshttps://api.ddog-gov.com/api/v2/cost/budgetshttps://api.us2.ddog-gov.com/api/v2/cost/budgetshttps://api.datadoghq.com/api/v2/cost/budgetshttps://api.us3.datadoghq.com/api/v2/cost/budgetshttps://api.us5.datadoghq.com/api/v2/cost/budgets

Overview

List budgets.

Response

OK

An array of budgets.

Expand All

Field

Type

Description

data [required]

[object]

The BudgetArray data.

attributes

object

The attributes of a budget.

created_at

int64

The timestamp when the budget was created.

created_by

string

The id of the user that created the budget.

end_month

int64

The month when the budget ends.

entries

[object]

The list of monthly budget entries.

amount

double

The budgeted amount for this entry.

month

int64

The month this budget entry applies to, in YYYYMM format.

tag_filters

[object]

The list of tag filters that scope this budget entry to specific resources.

tag_key

string

The tag key to filter on.

tag_value

string

The tag value to filter on.

metrics_query

string

The cost query used to track against the budget.

name

string

The name of the budget.

org_id

int64

The id of the org the budget belongs to.

start_month

int64

The month when the budget starts.

total_amount

double

The sum of all budget entries' amounts.

updated_at

int64

The timestamp when the budget was last updated.

updated_by

string

The id of the user that created the budget.

id

string

The id of the budget.

type [required]

string

The type of the object, must be budget.

{
  "data": [
    {
      "attributes": {
        "created_at": 1741011342772,
        "created_by": "user1",
        "end_month": 202502,
        "metrics_query": "aws.cost.amortized{service:ec2} by {service}",
        "name": "my budget",
        "org_id": 123,
        "start_month": 202501,
        "total_amount": 1000,
        "updated_at": 1741011342772,
        "updated_by": "user2"
      },
      "id": "00000000-0a0a-0a0a-aaa0-00000000000a",
      "type": "budget"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/budgets" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
List budgets returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_budgets()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# List budgets returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_budgets()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// List budgets returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListBudgets(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListBudgets`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListBudgets`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// List budgets returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.BudgetArray;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      BudgetArray result = apiInstance.listBudgets();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#listBudgets");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// List budgets returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.list_budgets().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * List budgets returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .listBudgets()
  .then((data: v2.BudgetArray) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v2/cost/budgethttps://api.ap2.datadoghq.com/api/v2/cost/budgethttps://api.datadoghq.eu/api/v2/cost/budgethttps://api.ddog-gov.com/api/v2/cost/budgethttps://api.us2.ddog-gov.com/api/v2/cost/budgethttps://api.datadoghq.com/api/v2/cost/budgethttps://api.us3.datadoghq.com/api/v2/cost/budgethttps://api.us5.datadoghq.com/api/v2/cost/budget

Overview

Create a new budget or update an existing one.

Request

Body Data (required)

Expand All

Field

Type

Description

data

object

A budget and all its entries.

attributes

object

The attributes of a budget.

created_at

int64

The timestamp when the budget was created.

created_by

string

The id of the user that created the budget.

end_month

int64

The month when the budget ends.

entries

[object]

The list of monthly budget entries.

amount

double

The budgeted amount for this entry.

month

int64

The month this budget entry applies to, in YYYYMM format.

tag_filters

[object]

The list of tag filters that scope this budget entry to specific resources.

tag_key

string

The tag key to filter on.

tag_value

string

The tag value to filter on.

metrics_query

string

The cost query used to track against the budget.

name

string

The name of the budget.

org_id

int64

The id of the org the budget belongs to.

start_month

int64

The month when the budget starts.

total_amount

double

The sum of all budget entries' amounts.

updated_at

int64

The timestamp when the budget was last updated.

updated_by

string

The id of the user that created the budget.

id

string

The BudgetWithEntriesData id.

type

string

The type of the object, must be budget.

{
  "data": {
    "attributes": {
      "created_at": 1738258683590,
      "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a",
      "end_month": 202502,
      "entries": [
        {
          "amount": "number",
          "month": "integer",
          "tag_filters": [
            {
              "tag_key": "string",
              "tag_value": "string"
            }
          ]
        }
      ],
      "metrics_query": "aws.cost.amortized{service:ec2} by {service}",
      "name": "my budget",
      "org_id": 123,
      "start_month": 202501,
      "total_amount": 1000,
      "updated_at": 1738258683590,
      "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"
    },
    "id": "00000000-0a0a-0a0a-aaa0-00000000000a",
    "type": ""
  }
}

Response

OK

The definition of the BudgetWithEntries object.

Expand All

Field

Type

Description

data

object

A budget and all its entries.

attributes

object

The attributes of a budget.

created_at

int64

The timestamp when the budget was created.

created_by

string

The id of the user that created the budget.

end_month

int64

The month when the budget ends.

entries

[object]

The list of monthly budget entries.

amount

double

The budgeted amount for this entry.

month

int64

The month this budget entry applies to, in YYYYMM format.

tag_filters

[object]

The list of tag filters that scope this budget entry to specific resources.

tag_key

string

The tag key to filter on.

tag_value

string

The tag value to filter on.

metrics_query

string

The cost query used to track against the budget.

name

string

The name of the budget.

org_id

int64

The id of the org the budget belongs to.

start_month

int64

The month when the budget starts.

total_amount

double

The sum of all budget entries' amounts.

updated_at

int64

The timestamp when the budget was last updated.

updated_by

string

The id of the user that created the budget.

id

string

The BudgetWithEntriesData id.

type

string

The type of the object, must be budget.

{
  "data": {
    "attributes": {
      "created_at": 1738258683590,
      "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a",
      "end_month": 202502,
      "entries": [
        {
          "amount": "number",
          "month": "integer",
          "tag_filters": [
            {
              "tag_key": "string",
              "tag_value": "string"
            }
          ]
        }
      ],
      "metrics_query": "aws.cost.amortized{service:ec2} by {service}",
      "name": "my budget",
      "org_id": 123,
      "start_month": 202501,
      "total_amount": 1000,
      "updated_at": 1738258683590,
      "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"
    },
    "id": "00000000-0a0a-0a0a-aaa0-00000000000a",
    "type": ""
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  ## default
# 

# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/budget" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a" }, "id": "00000000-0a0a-0a0a-aaa0-00000000000a", "type": "" } } EOF
"""
Create or update a budget returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.budget_attributes import BudgetAttributes
from datadog_api_client.v2.model.budget_with_entries import BudgetWithEntries
from datadog_api_client.v2.model.budget_with_entries_data import BudgetWithEntriesData
from datadog_api_client.v2.model.budget_with_entries_data_attributes_entries_items import (
    BudgetWithEntriesDataAttributesEntriesItems,
)
from datadog_api_client.v2.model.budget_with_entries_data_attributes_entries_items_tag_filters_items import (
    BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems,
)

body = BudgetWithEntries(
    data=BudgetWithEntriesData(
        attributes=BudgetAttributes(
            created_at=1738258683590,
            created_by="00000000-0a0a-0a0a-aaa0-00000000000a",
            end_month=202502,
            entries=[
                BudgetWithEntriesDataAttributesEntriesItems(
                    tag_filters=[
                        BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems(),
                    ],
                ),
            ],
            metrics_query="aws.cost.amortized{service:ec2} by {service}",
            name="my budget",
            org_id=123,
            start_month=202501,
            total_amount=1000.0,
            updated_at=1738258683590,
            updated_by="00000000-0a0a-0a0a-aaa0-00000000000a",
        ),
        id="00000000-0a0a-0a0a-aaa0-00000000000a",
        type="",
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.upsert_budget(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create or update a budget returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::BudgetWithEntries.new({
  data: DatadogAPIClient::V2::BudgetWithEntriesData.new({
    attributes: DatadogAPIClient::V2::BudgetAttributes.new({
      created_at: 1738258683590,
      created_by: "00000000-0a0a-0a0a-aaa0-00000000000a",
      end_month: 202502,
      entries: [
        DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItems.new({
          tag_filters: [
            DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems.new({}),
          ],
        }),
      ],
      metrics_query: "aws.cost.amortized{service:ec2} by {service}",
      name: "my budget",
      org_id: 123,
      start_month: 202501,
      total_amount: 1000,
      updated_at: 1738258683590,
      updated_by: "00000000-0a0a-0a0a-aaa0-00000000000a",
    }),
    id: "00000000-0a0a-0a0a-aaa0-00000000000a",
    type: "",
  }),
})
p api_instance.upsert_budget(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Create or update a budget returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.BudgetWithEntries{
		Data: &datadogV2.BudgetWithEntriesData{
			Attributes: &datadogV2.BudgetAttributes{
				CreatedAt: datadog.PtrInt64(1738258683590),
				CreatedBy: datadog.PtrString("00000000-0a0a-0a0a-aaa0-00000000000a"),
				EndMonth:  datadog.PtrInt64(202502),
				Entries: []datadogV2.BudgetWithEntriesDataAttributesEntriesItems{
					{
						TagFilters: []datadogV2.BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems{
							{},
						},
					},
				},
				MetricsQuery: datadog.PtrString("aws.cost.amortized{service:ec2} by {service}"),
				Name:         datadog.PtrString("my budget"),
				OrgId:        datadog.PtrInt64(123),
				StartMonth:   datadog.PtrInt64(202501),
				TotalAmount:  datadog.PtrFloat64(1000),
				UpdatedAt:    datadog.PtrInt64(1738258683590),
				UpdatedBy:    datadog.PtrString("00000000-0a0a-0a0a-aaa0-00000000000a"),
			},
			Id:   datadog.PtrString("00000000-0a0a-0a0a-aaa0-00000000000a"),
			Type: datadog.PtrString(""),
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.UpsertBudget(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpsertBudget`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpsertBudget`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create or update a budget returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.BudgetAttributes;
import com.datadog.api.client.v2.model.BudgetWithEntries;
import com.datadog.api.client.v2.model.BudgetWithEntriesData;
import com.datadog.api.client.v2.model.BudgetWithEntriesDataAttributesEntriesItems;
import com.datadog.api.client.v2.model.BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    BudgetWithEntries body =
        new BudgetWithEntries()
            .data(
                new BudgetWithEntriesData()
                    .attributes(
                        new BudgetAttributes()
                            .createdAt(1738258683590L)
                            .createdBy("00000000-0a0a-0a0a-aaa0-00000000000a")
                            .endMonth(202502L)
                            .entries(
                                Collections.singletonList(
                                    new BudgetWithEntriesDataAttributesEntriesItems()
                                        .tagFilters(
                                            Collections.singletonList(
                                                new BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems()))))
                            .metricsQuery("aws.cost.amortized{service:ec2} by {service}")
                            .name("my budget")
                            .orgId(123L)
                            .startMonth(202501L)
                            .totalAmount(1000.0)
                            .updatedAt(1738258683590L)
                            .updatedBy("00000000-0a0a-0a0a-aaa0-00000000000a"))
                    .id("00000000-0a0a-0a0a-aaa0-00000000000a")
                    .type(""));

    try {
      BudgetWithEntries result = apiInstance.upsertBudget(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#upsertBudget");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Create or update a budget returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::BudgetAttributes;
use datadog_api_client::datadogV2::model::BudgetWithEntries;
use datadog_api_client::datadogV2::model::BudgetWithEntriesData;
use datadog_api_client::datadogV2::model::BudgetWithEntriesDataAttributesEntriesItems;
use datadog_api_client::datadogV2::model::BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems;

#[tokio::main]
async fn main() {
    let body = BudgetWithEntries::new().data(
        BudgetWithEntriesData::new()
            .attributes(
                BudgetAttributes::new()
                    .created_at(1738258683590)
                    .created_by("00000000-0a0a-0a0a-aaa0-00000000000a".to_string())
                    .end_month(202502)
                    .entries(vec![BudgetWithEntriesDataAttributesEntriesItems::new()
                        .tag_filters(vec![
                            BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems::new(),
                        ])])
                    .metrics_query("aws.cost.amortized{service:ec2} by {service}".to_string())
                    .name("my budget".to_string())
                    .org_id(123)
                    .start_month(202501)
                    .total_amount(1000.0 as f64)
                    .updated_at(1738258683590)
                    .updated_by("00000000-0a0a-0a0a-aaa0-00000000000a".to_string()),
            )
            .id("00000000-0a0a-0a0a-aaa0-00000000000a".to_string())
            .type_("".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.upsert_budget(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Create or update a budget returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiUpsertBudgetRequest = {
  body: {
    data: {
      attributes: {
        createdAt: 1738258683590,
        createdBy: "00000000-0a0a-0a0a-aaa0-00000000000a",
        endMonth: 202502,
        entries: [
          {
            tagFilters: [{}],
          },
        ],
        metricsQuery: "aws.cost.amortized{service:ec2} by {service}",
        name: "my budget",
        orgId: 123,
        startMonth: 202501,
        totalAmount: 1000,
        updatedAt: 1738258683590,
        updatedBy: "00000000-0a0a-0a0a-aaa0-00000000000a",
      },
      id: "00000000-0a0a-0a0a-aaa0-00000000000a",
      type: "",
    },
  },
};

apiInstance
  .upsertBudget(params)
  .then((data: v2.BudgetWithEntries) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/cost/budget/validatehttps://api.ap2.datadoghq.com/api/v2/cost/budget/validatehttps://api.datadoghq.eu/api/v2/cost/budget/validatehttps://api.ddog-gov.com/api/v2/cost/budget/validatehttps://api.us2.ddog-gov.com/api/v2/cost/budget/validatehttps://api.datadoghq.com/api/v2/cost/budget/validatehttps://api.us3.datadoghq.com/api/v2/cost/budget/validatehttps://api.us5.datadoghq.com/api/v2/cost/budget/validate

Overview

Validate a budget configuration without creating or modifying it

Request

Body Data (required)

Expand All

Field

Type

Description

data

object

The data object for a budget validation request, containing the resource type, ID, and budget attributes to validate.

attributes

object

The attributes of a budget including all its monthly entries.

created_at

int64

The timestamp when the budget was created.

created_by

string

The ID of the user that created the budget.

end_month

int64

The month when the budget ends, in YYYYMM format.

entries

[object]

The list of monthly budget entries.

amount

double

The budgeted amount for this entry.

month

int64

The month this budget entry applies to, in YYYYMM format.

tag_filters

[object]

The list of tag filters that scope this budget entry to specific resources.

tag_key

string

The tag key to filter on.

tag_value

string

The tag value to filter on.

metrics_query

string

The cost query used to track spending against the budget.

name

string

The name of the budget.

org_id

int64

The ID of the organization the budget belongs to.

start_month

int64

The month when the budget starts, in YYYYMM format.

total_amount

double

The total budget amount across all entries.

updated_at

int64

The timestamp when the budget was last updated.

updated_by

string

The ID of the user that last updated the budget.

id

string

The unique identifier of the budget to validate.

type [required]

enum

Budget resource type. Allowed enum values: budget

default: budget

{
  "data": {
    "attributes": {
      "created_at": "integer",
      "created_by": "string",
      "end_month": "integer",
      "entries": [
        {
          "amount": "number",
          "month": "integer",
          "tag_filters": [
            {
              "tag_key": "string",
              "tag_value": "string"
            }
          ]
        }
      ],
      "metrics_query": "string",
      "name": "string",
      "org_id": "integer",
      "start_month": "integer",
      "total_amount": "number",
      "updated_at": "integer",
      "updated_by": "string"
    },
    "id": "string",
    "type": "budget"
  }
}

Response

OK

The response object for a budget validation request, containing the validation result data.

Expand All

Field

Type

Description

data

object

The data object for a budget validation response, containing the resource type, ID, and validation attributes.

attributes

object

The attributes of a budget validation response, including any validation errors and the validity status.

errors

[string]

A list of validation error messages for the budget.

valid

boolean

Whether the budget configuration is valid.

id

string

The unique identifier of the budget being validated.

type [required]

enum

Budget validation resource type. Allowed enum values: budget_validation

default: budget_validation

{
  "data": {
    "attributes": {
      "errors": [],
      "valid": true
    },
    "id": "budget_validation",
    "type": "budget_validation"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/budget/validate" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [ { "amount": 500, "month": 202501, "tag_filters": [ { "tag_key": "service", "tag_value": "ec2" } ] }, { "amount": 500, "month": 202502, "tag_filters": [ { "tag_key": "service", "tag_value": "ec2" } ] } ], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a" }, "id": "1", "type": "budget" } } EOF
"""
Validate budget returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.budget_validation_request import BudgetValidationRequest
from datadog_api_client.v2.model.budget_validation_request_data import BudgetValidationRequestData
from datadog_api_client.v2.model.budget_with_entries_data_attributes import BudgetWithEntriesDataAttributes
from datadog_api_client.v2.model.budget_with_entries_data_attributes_entries_items import (
    BudgetWithEntriesDataAttributesEntriesItems,
)
from datadog_api_client.v2.model.budget_with_entries_data_attributes_entries_items_tag_filters_items import (
    BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems,
)
from datadog_api_client.v2.model.budget_with_entries_data_type import BudgetWithEntriesDataType

body = BudgetValidationRequest(
    data=BudgetValidationRequestData(
        attributes=BudgetWithEntriesDataAttributes(
            created_at=1738258683590,
            created_by="00000000-0a0a-0a0a-aaa0-00000000000a",
            end_month=202502,
            entries=[
                BudgetWithEntriesDataAttributesEntriesItems(
                    amount=500.0,
                    month=202501,
                    tag_filters=[
                        BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems(
                            tag_key="service",
                            tag_value="ec2",
                        ),
                    ],
                ),
                BudgetWithEntriesDataAttributesEntriesItems(
                    amount=500.0,
                    month=202502,
                    tag_filters=[
                        BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems(
                            tag_key="service",
                            tag_value="ec2",
                        ),
                    ],
                ),
            ],
            metrics_query="aws.cost.amortized{service:ec2} by {service}",
            name="my budget",
            org_id=123,
            start_month=202501,
            total_amount=1000.0,
            updated_at=1738258683590,
            updated_by="00000000-0a0a-0a0a-aaa0-00000000000a",
        ),
        id="1",
        type=BudgetWithEntriesDataType.BUDGET,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.validate_budget(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Validate budget returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::BudgetValidationRequest.new({
  data: DatadogAPIClient::V2::BudgetValidationRequestData.new({
    attributes: DatadogAPIClient::V2::BudgetWithEntriesDataAttributes.new({
      created_at: 1738258683590,
      created_by: "00000000-0a0a-0a0a-aaa0-00000000000a",
      end_month: 202502,
      entries: [
        DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItems.new({
          amount: 500,
          month: 202501,
          tag_filters: [
            DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems.new({
              tag_key: "service",
              tag_value: "ec2",
            }),
          ],
        }),
        DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItems.new({
          amount: 500,
          month: 202502,
          tag_filters: [
            DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems.new({
              tag_key: "service",
              tag_value: "ec2",
            }),
          ],
        }),
      ],
      metrics_query: "aws.cost.amortized{service:ec2} by {service}",
      name: "my budget",
      org_id: 123,
      start_month: 202501,
      total_amount: 1000,
      updated_at: 1738258683590,
      updated_by: "00000000-0a0a-0a0a-aaa0-00000000000a",
    }),
    id: "1",
    type: DatadogAPIClient::V2::BudgetWithEntriesDataType::BUDGET,
  }),
})
p api_instance.validate_budget(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Validate budget returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.BudgetValidationRequest{
		Data: &datadogV2.BudgetValidationRequestData{
			Attributes: &datadogV2.BudgetWithEntriesDataAttributes{
				CreatedAt: datadog.PtrInt64(1738258683590),
				CreatedBy: datadog.PtrString("00000000-0a0a-0a0a-aaa0-00000000000a"),
				EndMonth:  datadog.PtrInt64(202502),
				Entries: []datadogV2.BudgetWithEntriesDataAttributesEntriesItems{
					{
						Amount: datadog.PtrFloat64(500),
						Month:  datadog.PtrInt64(202501),
						TagFilters: []datadogV2.BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems{
							{
								TagKey:   datadog.PtrString("service"),
								TagValue: datadog.PtrString("ec2"),
							},
						},
					},
					{
						Amount: datadog.PtrFloat64(500),
						Month:  datadog.PtrInt64(202502),
						TagFilters: []datadogV2.BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems{
							{
								TagKey:   datadog.PtrString("service"),
								TagValue: datadog.PtrString("ec2"),
							},
						},
					},
				},
				MetricsQuery: datadog.PtrString("aws.cost.amortized{service:ec2} by {service}"),
				Name:         datadog.PtrString("my budget"),
				OrgId:        datadog.PtrInt64(123),
				StartMonth:   datadog.PtrInt64(202501),
				TotalAmount:  datadog.PtrFloat64(1000),
				UpdatedAt:    datadog.PtrInt64(1738258683590),
				UpdatedBy:    datadog.PtrString("00000000-0a0a-0a0a-aaa0-00000000000a"),
			},
			Id:   datadog.PtrString("1"),
			Type: datadogV2.BUDGETWITHENTRIESDATATYPE_BUDGET,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ValidateBudget(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ValidateBudget`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ValidateBudget`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Validate budget returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.BudgetValidationRequest;
import com.datadog.api.client.v2.model.BudgetValidationRequestData;
import com.datadog.api.client.v2.model.BudgetValidationResponse;
import com.datadog.api.client.v2.model.BudgetWithEntriesDataAttributes;
import com.datadog.api.client.v2.model.BudgetWithEntriesDataAttributesEntriesItems;
import com.datadog.api.client.v2.model.BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems;
import com.datadog.api.client.v2.model.BudgetWithEntriesDataType;
import java.util.Arrays;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    BudgetValidationRequest body =
        new BudgetValidationRequest()
            .data(
                new BudgetValidationRequestData()
                    .attributes(
                        new BudgetWithEntriesDataAttributes()
                            .createdAt(1738258683590L)
                            .createdBy("00000000-0a0a-0a0a-aaa0-00000000000a")
                            .endMonth(202502L)
                            .entries(
                                Arrays.asList(
                                    new BudgetWithEntriesDataAttributesEntriesItems()
                                        .amount(500.0)
                                        .month(202501L)
                                        .tagFilters(
                                            Collections.singletonList(
                                                new BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems()
                                                    .tagKey("service")
                                                    .tagValue("ec2"))),
                                    new BudgetWithEntriesDataAttributesEntriesItems()
                                        .amount(500.0)
                                        .month(202502L)
                                        .tagFilters(
                                            Collections.singletonList(
                                                new BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems()
                                                    .tagKey("service")
                                                    .tagValue("ec2")))))
                            .metricsQuery("aws.cost.amortized{service:ec2} by {service}")
                            .name("my budget")
                            .orgId(123L)
                            .startMonth(202501L)
                            .totalAmount(1000.0)
                            .updatedAt(1738258683590L)
                            .updatedBy("00000000-0a0a-0a0a-aaa0-00000000000a"))
                    .id("1")
                    .type(BudgetWithEntriesDataType.BUDGET));

    try {
      BudgetValidationResponse result = apiInstance.validateBudget(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#validateBudget");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Validate budget returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::BudgetValidationRequest;
use datadog_api_client::datadogV2::model::BudgetValidationRequestData;
use datadog_api_client::datadogV2::model::BudgetWithEntriesDataAttributes;
use datadog_api_client::datadogV2::model::BudgetWithEntriesDataAttributesEntriesItems;
use datadog_api_client::datadogV2::model::BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems;
use datadog_api_client::datadogV2::model::BudgetWithEntriesDataType;

#[tokio::main]
async fn main() {
    let body = BudgetValidationRequest::new().data(
        BudgetValidationRequestData::new(BudgetWithEntriesDataType::BUDGET)
            .attributes(
                BudgetWithEntriesDataAttributes::new()
                    .created_at(1738258683590)
                    .created_by("00000000-0a0a-0a0a-aaa0-00000000000a".to_string())
                    .end_month(202502)
                    .entries(vec![
                        BudgetWithEntriesDataAttributesEntriesItems::new()
                            .amount(500.0 as f64)
                            .month(202501)
                            .tag_filters(vec![
                                BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems::new()
                                    .tag_key("service".to_string())
                                    .tag_value("ec2".to_string()),
                            ]),
                        BudgetWithEntriesDataAttributesEntriesItems::new()
                            .amount(500.0 as f64)
                            .month(202502)
                            .tag_filters(vec![
                                BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems::new()
                                    .tag_key("service".to_string())
                                    .tag_value("ec2".to_string()),
                            ]),
                    ])
                    .metrics_query("aws.cost.amortized{service:ec2} by {service}".to_string())
                    .name("my budget".to_string())
                    .org_id(123)
                    .start_month(202501)
                    .total_amount(1000.0 as f64)
                    .updated_at(1738258683590)
                    .updated_by("00000000-0a0a-0a0a-aaa0-00000000000a".to_string()),
            )
            .id("1".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.validate_budget(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Validate budget returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiValidateBudgetRequest = {
  body: {
    data: {
      attributes: {
        createdAt: 1738258683590,
        createdBy: "00000000-0a0a-0a0a-aaa0-00000000000a",
        endMonth: 202502,
        entries: [
          {
            amount: 500,
            month: 202501,
            tagFilters: [
              {
                tagKey: "service",
                tagValue: "ec2",
              },
            ],
          },
          {
            amount: 500,
            month: 202502,
            tagFilters: [
              {
                tagKey: "service",
                tagValue: "ec2",
              },
            ],
          },
        ],
        metricsQuery: "aws.cost.amortized{service:ec2} by {service}",
        name: "my budget",
        orgId: 123,
        startMonth: 202501,
        totalAmount: 1000,
        updatedAt: 1738258683590,
        updatedBy: "00000000-0a0a-0a0a-aaa0-00000000000a",
      },
      id: "1",
      type: "budget",
    },
  },
};

apiInstance
  .validateBudget(params)
  .then((data: v2.BudgetValidationResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/cost/budget/csv/validatehttps://api.ap2.datadoghq.com/api/v2/cost/budget/csv/validatehttps://api.datadoghq.eu/api/v2/cost/budget/csv/validatehttps://api.ddog-gov.com/api/v2/cost/budget/csv/validatehttps://api.us2.ddog-gov.com/api/v2/cost/budget/csv/validatehttps://api.datadoghq.com/api/v2/cost/budget/csv/validatehttps://api.us3.datadoghq.com/api/v2/cost/budget/csv/validatehttps://api.us5.datadoghq.com/api/v2/cost/budget/csv/validate

Overview

Response

OK

Response containing validation errors.

Expand All

Field

Type

Description

errors

[object]

The ValidationResponse errors.

meta [required]

object

Describes additional metadata for validation errors, including field names and error messages.

field

string

The field name that caused the error.

id

string

The ID of the component in which the error occurred.

message [required]

string

The detailed error message.

title [required]

string

A short, human-readable summary of the error.

{
  "errors": [
    {
      "meta": {
        "field": "region",
        "id": "datadog-agent-source",
        "message": "Field 'region' is required"
      },
      "title": "Field 'region' is required"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/budget/csv/validate" \ -H "Accept: application/json"
"""
Validate CSV budget returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.validate_csv_budget()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" python3 "example.py"
# Validate CSV budget returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.validate_csv_budget()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" rb "example.rb"
// Validate CSV budget returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ValidateCsvBudget(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ValidateCsvBudget`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ValidateCsvBudget`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" go run "main.go"
// Validate CSV budget returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.ValidationResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      ValidationResponse result = apiInstance.validateCsvBudget();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#validateCsvBudget");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" java "Example.java"
// Validate CSV budget returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.validate_csv_budget().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" cargo run
/**
 * Validate CSV budget returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .validateCsvBudget()
  .then((data: v2.ValidationResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/budget/{budget_id}https://api.ap2.datadoghq.com/api/v2/cost/budget/{budget_id}https://api.datadoghq.eu/api/v2/cost/budget/{budget_id}https://api.ddog-gov.com/api/v2/cost/budget/{budget_id}https://api.us2.ddog-gov.com/api/v2/cost/budget/{budget_id}https://api.datadoghq.com/api/v2/cost/budget/{budget_id}https://api.us3.datadoghq.com/api/v2/cost/budget/{budget_id}https://api.us5.datadoghq.com/api/v2/cost/budget/{budget_id}

Overview

Get a budget

Arguments

Path Parameters

Name

Type

Description

budget_id [required]

string

Budget id.

Response

OK

The definition of the BudgetWithEntries object.

Expand All

Field

Type

Description

data

object

A budget and all its entries.

attributes

object

The attributes of a budget.

created_at

int64

The timestamp when the budget was created.

created_by

string

The id of the user that created the budget.

end_month

int64

The month when the budget ends.

entries

[object]

The list of monthly budget entries.

amount

double

The budgeted amount for this entry.

month

int64

The month this budget entry applies to, in YYYYMM format.

tag_filters

[object]

The list of tag filters that scope this budget entry to specific resources.

tag_key

string

The tag key to filter on.

tag_value

string

The tag value to filter on.

metrics_query

string

The cost query used to track against the budget.

name

string

The name of the budget.

org_id

int64

The id of the org the budget belongs to.

start_month

int64

The month when the budget starts.

total_amount

double

The sum of all budget entries' amounts.

updated_at

int64

The timestamp when the budget was last updated.

updated_by

string

The id of the user that created the budget.

id

string

The BudgetWithEntriesData id.

type

string

The type of the object, must be budget.

{
  "data": {
    "attributes": {
      "created_at": 1738258683590,
      "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a",
      "end_month": 202502,
      "entries": [
        {
          "amount": "number",
          "month": "integer",
          "tag_filters": [
            {
              "tag_key": "string",
              "tag_value": "string"
            }
          ]
        }
      ],
      "metrics_query": "aws.cost.amortized{service:ec2} by {service}",
      "name": "my budget",
      "org_id": 123,
      "start_month": 202501,
      "total_amount": 1000,
      "updated_at": 1738258683590,
      "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"
    },
    "id": "00000000-0a0a-0a0a-aaa0-00000000000a",
    "type": ""
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export budget_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/budget/${budget_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get budget returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.get_budget(
        budget_id="budget_id",
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get budget returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.get_budget("budget_id")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get budget returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.GetBudget(ctx, "budget_id")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.GetBudget`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetBudget`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get budget returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.BudgetWithEntries;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      BudgetWithEntries result = apiInstance.getBudget("budget_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#getBudget");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get budget returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.get_budget("budget_id".to_string()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get budget returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiGetBudgetRequest = {
  budgetId: "budget_id",
};

apiInstance
  .getBudget(params)
  .then((data: v2.BudgetWithEntries) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/cost/budget/{budget_id}https://api.ap2.datadoghq.com/api/v2/cost/budget/{budget_id}https://api.datadoghq.eu/api/v2/cost/budget/{budget_id}https://api.ddog-gov.com/api/v2/cost/budget/{budget_id}https://api.us2.ddog-gov.com/api/v2/cost/budget/{budget_id}https://api.datadoghq.com/api/v2/cost/budget/{budget_id}https://api.us3.datadoghq.com/api/v2/cost/budget/{budget_id}https://api.us5.datadoghq.com/api/v2/cost/budget/{budget_id}

Overview

Delete a budget

Arguments

Path Parameters

Name

Type

Description

budget_id [required]

string

Budget id.

Response

No Content

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export budget_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/budget/${budget_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete budget returns "No Content" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    api_instance.delete_budget(
        budget_id="budget_id",
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete budget returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
api_instance.delete_budget("budget_id")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete budget returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	r, err := api.DeleteBudget(ctx, "budget_id")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.DeleteBudget`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete budget returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      apiInstance.deleteBudget("budget_id");
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#deleteBudget");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Delete budget returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.delete_budget("budget_id".to_string()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Delete budget returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

const params: v2.CloudCostManagementApiDeleteBudgetRequest = {
  budgetId: "budget_id",
};

apiInstance
  .deleteBudget(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/cost/oci_confighttps://api.ap2.datadoghq.com/api/v2/cost/oci_confighttps://api.datadoghq.eu/api/v2/cost/oci_confighttps://api.ddog-gov.com/api/v2/cost/oci_confighttps://api.us2.ddog-gov.com/api/v2/cost/oci_confighttps://api.datadoghq.com/api/v2/cost/oci_confighttps://api.us3.datadoghq.com/api/v2/cost/oci_confighttps://api.us5.datadoghq.com/api/v2/cost/oci_config

Overview

List the OCI configs. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Response

OK

List of OCI configs.

Expand All

Field

Type

Description

data [required]

[object]

An OCI config.

attributes [required]

object

Attributes for an OCI config.

account_id [required]

string

The OCID of the OCI tenancy.

created_at [required]

string

The timestamp when the OCI config was created.

error_messages

[string]

The error messages for the OCI config.

status [required]

string

The status of the OCI config.

status_updated_at [required]

string

The timestamp when the OCI config status was last updated.

updated_at [required]

string

The timestamp when the OCI config was last updated.

id [required]

string

The ID of the OCI config.

type [required]

enum

Type of OCI config. Allowed enum values: oci_config

default: oci_config

{
  "data": [
    {
      "attributes": {
        "account_id": "ocid1.tenancy.oc1..example",
        "created_at": "2026-01-01T12:00:00Z",
        "error_messages": [],
        "status": "active",
        "status_updated_at": "2026-01-01T12:00:00Z",
        "updated_at": "2026-01-01T12:00:00Z"
      },
      "id": "1",
      "type": "oci_config"
    }
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/oci_config" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

GET https://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rule/statushttps://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rule/statushttps://api.datadoghq.eu/api/v2/cost/arbitrary_rule/statushttps://api.ddog-gov.com/api/v2/cost/arbitrary_rule/statushttps://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rule/statushttps://api.datadoghq.com/api/v2/cost/arbitrary_rule/statushttps://api.us3.datadoghq.com/api/v2/cost/arbitrary_rule/statushttps://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/status

Overview

List the processing status of all custom allocation rules. Returns only the ID and processing status for each rule.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Response

OK

Processing statuses for all custom allocation rules in the specified organization.

Expand All

Field

Type

Description

data [required]

[object]

Processing status for a custom allocation rule.

attributes [required]

object

Processing status for a custom allocation rule.

processing_status [required]

string

The processing status of the custom allocation rule.

id [required]

string

The unique identifier of the custom allocation rule.

type [required]

enum

Custom allocation rule status resource type. Allowed enum values: arbitrary_rule_status

default: arbitrary_rule_status

{
  "data": [
    {
      "attributes": {
        "processing_status": "processing"
      },
      "id": "123",
      "type": "arbitrary_rule_status"
    },
    {
      "attributes": {
        "processing_status": "done"
      },
      "id": "456",
      "type": "arbitrary_rule_status"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/status" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

GET https://api.ap1.datadoghq.com/api/v2/tags/enrichment/statushttps://api.ap2.datadoghq.com/api/v2/tags/enrichment/statushttps://api.datadoghq.eu/api/v2/tags/enrichment/statushttps://api.ddog-gov.com/api/v2/tags/enrichment/statushttps://api.us2.ddog-gov.com/api/v2/tags/enrichment/statushttps://api.datadoghq.com/api/v2/tags/enrichment/statushttps://api.us3.datadoghq.com/api/v2/tags/enrichment/statushttps://api.us5.datadoghq.com/api/v2/tags/enrichment/status

Overview

List the processing status of all tag pipeline rulesets. Returns only the ID and processing status for each ruleset.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Response

OK

Processing statuses for all tag pipeline rulesets in the specified organization.

Expand All

Field

Type

Description

data [required]

[object]

Processing status for a tag pipeline ruleset.

attributes [required]

object

Processing status for a tag pipeline ruleset.

processing_status [required]

string

The processing status of the ruleset.

id [required]

string

The unique identifier of the ruleset.

type [required]

enum

Ruleset status resource type. Allowed enum values: ruleset_status

default: ruleset_status

{
  "data": [
    {
      "attributes": {
        "processing_status": "processing"
      },
      "id": "55ef2385-9ae1-4410-90c4-5ac1b60fec10",
      "type": "ruleset_status"
    },
    {
      "attributes": {
        "processing_status": "done"
      },
      "id": "a7b8c9d0-1234-5678-9abc-def012345678",
      "type": "ruleset_status"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/tags/enrichment/status" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

GET https://api.ap1.datadoghq.com/api/v2/cost/tag_descriptionshttps://api.ap2.datadoghq.com/api/v2/cost/tag_descriptionshttps://api.datadoghq.eu/api/v2/cost/tag_descriptionshttps://api.ddog-gov.com/api/v2/cost/tag_descriptionshttps://api.us2.ddog-gov.com/api/v2/cost/tag_descriptionshttps://api.datadoghq.com/api/v2/cost/tag_descriptionshttps://api.us3.datadoghq.com/api/v2/cost/tag_descriptionshttps://api.us5.datadoghq.com/api/v2/cost/tag_descriptions

Overview

List Cloud Cost Management tag key descriptions for the organization. Use filter[cloud] to scope the result to a single cloud provider; when omitted, both cross-cloud defaults and cloud-specific descriptions are returned. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

filter[cloud]

string

Filter descriptions to a specific cloud provider (for example, aws). Omit to return descriptions across all clouds.

Response

OK

List of Cloud Cost Management tag key descriptions for the organization, optionally filtered to a single cloud provider.

Expand All

Field

Type

Description

data [required]

[object]

List of tag key descriptions.

attributes [required]

object

Human-readable description and metadata attached to a Cloud Cost Management tag key, optionally scoped to a single cloud provider.

cloud [required]

string

Cloud provider this description applies to (for example, aws). Empty when the description is the cross-cloud default for the tag key.

created_at [required]

string

Timestamp when the description was created, in RFC 3339 format.

description [required]

string

The human-readable description for the tag key.

source [required]

enum

Origin of the description. human indicates the description was written by a user, ai_generated was produced by AI, and datadog is a default supplied by Datadog. Allowed enum values: human,ai_generated,datadog

tag_key [required]

string

The tag key this description applies to.

updated_at [required]

string

Timestamp when the description was last updated, in RFC 3339 format.

id [required]

string

Stable identifier of the tag description. Equals the tag key when the description is the cross-cloud default; encodes both the cloud and the tag key when the description is cloud-specific.

type [required]

enum

Type of the Cloud Cost Management tag description resource. Allowed enum values: cost_tag_description

default: cost_tag_description

{
  "data": [
    {
      "attributes": {
        "cloud": "aws",
        "created_at": "2026-01-01T12:00:00Z",
        "description": "AWS account that owns this cost.",
        "source": "human",
        "tag_key": "account_id",
        "updated_at": "2026-01-01T12:00:00Z"
      },
      "id": "account_id",
      "type": "cost_tag_description"
    }
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tag_descriptions" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in Preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/anomalieshttps://api.ap2.datadoghq.com/api/v2/cost/anomalieshttps://api.datadoghq.eu/api/v2/cost/anomalieshttps://api.ddog-gov.com/api/v2/cost/anomalieshttps://api.us2.ddog-gov.com/api/v2/cost/anomalieshttps://api.datadoghq.com/api/v2/cost/anomalieshttps://api.us3.datadoghq.com/api/v2/cost/anomalieshttps://api.us5.datadoghq.com/api/v2/cost/anomalies

Overview

List detected Cloud Cost Management anomalies for the organization.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

start

integer

Start time as Unix milliseconds. Defaults to the start of the latest stable seven-day window.

end

integer

End time as Unix milliseconds. Defaults to the end of the latest stable seven-day window.

filter

string

Optional JSON object mapping cost tag keys to allowed values, for example {"team":["payments"],"env":["prod"]}. Filters match anomaly dimensions or correlated tags.

min_anomalous_threshold

string

Minimum absolute anomalous cost change to include. Numeric value; defaults to 1.

min_cost_threshold

string

Minimum absolute actual cost to include. Numeric value; defaults to 0.

dismissal_cause

string

Filter by resolution state. Use none for unresolved anomalies, all or * for resolved anomalies, or a comma-separated list of causes.

order_by

string

Sort field. One of start_date, end_date, duration, max_cost, anomalous_cost, or dismissal_date. Defaults to anomalous_cost.

order

string

Sort direction. One of asc or desc. Defaults to desc.

limit

integer

Maximum number of anomalies to return. Defaults to 200.

offset

integer

Pagination offset. Defaults to 0.

provider_ids

array

Optional repeated cloud or SaaS provider filters, such as aws, gcp, azure, Oracle, datadog, OpenAI, or Anthropic.

Response

OK

Response object containing a list of detected Cloud Cost Management anomalies and aggregated totals.

Expand All

Field

Type

Description

data

object

Resource wrapper for the list of cost anomalies and aggregated totals.

attributes [required]

object

Cost anomaly results and aggregated totals for the queried window.

anomalies [required]

[object]

The list of cost anomalies that match the request.

actual_cost [required]

double

Actual cost incurred during the anomaly window.

anomalous_cost_change [required]

double

Anomalous cost change relative to the expected baseline.

anomaly_end [required]

int64

Anomaly end timestamp in Unix milliseconds.

anomaly_start [required]

int64

Anomaly start timestamp in Unix milliseconds.

correlated_tags [required]

object

Map of correlated tag keys to the list of correlated tag values.

<any-key>

[string]

The list of correlated values for the tag key.

dimensions [required]

object

Map of cost dimension keys to their values for the anomaly grouping.

<any-key>

string

The dimension value.

dismissal

object

Resolution metadata for an anomaly that has been dismissed.

cause [required]

string

Reason the anomaly was dismissed.

dismissal_id [required]

string

Unique identifier of the dismissal record.

message [required]

string

Optional message explaining the dismissal.

updated_at [required]

int64

Timestamp of the last dismissal update in Unix milliseconds.

updated_by [required]

string

Identifier of the user that last updated the dismissal.

max_cost [required]

double

Maximum cost observed during the anomaly window.

provider [required]

string

Cloud or SaaS provider associated with the anomaly (for example aws, gcp, azure).

query [required]

string

The metrics query that detected the anomaly.

uuid [required]

string

The unique identifier of the anomaly.

avg_daily_anomalous_cost [required]

double

Average daily anomalous cost change across the queried window.

total_actual_cost [required]

double

Total actual cost spent across the queried window for the matching providers.

total_anomalous_cost [required]

double

Sum of the anomalous cost change across all returned anomalies.

total_count [required]

int64

Total number of anomalies that match the request.

id [required]

string

Static identifier of the cost anomalies collection resource.

type [required]

enum

Type of the cost anomalies collection resource. Must be anomalies. Allowed enum values: anomalies

default: anomalies

{
  "data": {
    "attributes": {
      "anomalies": [
        {
          "actual_cost": 3001.24,
          "anomalous_cost_change": 1250.75,
          "anomaly_end": 1730429150000,
          "anomaly_start": 1730259950000,
          "correlated_tags": {
            "<any-key>": []
          },
          "dimensions": {
            "<any-key>": "string"
          },
          "dismissal": {
            "cause": "false_positive",
            "dismissal_id": "12345678-1234-1234-1234-123456789abc",
            "message": "This was expected due to planned infrastructure changes.",
            "updated_at": 1730344150000,
            "updated_by": "user@example.com"
          },
          "max_cost": 5000.5,
          "provider": "aws",
          "query": "sum:aws.cost.net.amortized{aws_cost_type IN (Usage,DiscountedUsage,SavingsPlanCoveredUsage) AND aws_product NOT IN (supportenterprise) AND service:\"ec2\"}.rollup(sum, daily)",
          "uuid": "b0a6aaa9-3c4c-48cb-9447-a0d1338b3e09"
        }
      ],
      "avg_daily_anomalous_cost": 625.375,
      "total_actual_cost": 3001.24,
      "total_anomalous_cost": 1250.75,
      "total_count": 1
    },
    "id": "anomalies",
    "type": "anomalies"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/anomalies" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in Preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/anomalies/{anomaly_id}https://api.ap2.datadoghq.com/api/v2/cost/anomalies/{anomaly_id}https://api.datadoghq.eu/api/v2/cost/anomalies/{anomaly_id}https://api.ddog-gov.com/api/v2/cost/anomalies/{anomaly_id}https://api.us2.ddog-gov.com/api/v2/cost/anomalies/{anomaly_id}https://api.datadoghq.com/api/v2/cost/anomalies/{anomaly_id}https://api.us3.datadoghq.com/api/v2/cost/anomalies/{anomaly_id}https://api.us5.datadoghq.com/api/v2/cost/anomalies/{anomaly_id}

Overview

Get a detected Cloud Cost Management anomaly by UUID.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

anomaly_id [required]

string

The UUID of the cost anomaly.

Response

OK

Response object containing a single Cloud Cost Management anomaly.

Expand All

Field

Type

Description

data

object

Resource wrapper for a single cost anomaly.

attributes [required]

object

A single detected Cloud Cost Management anomaly.

actual_cost [required]

double

Actual cost incurred during the anomaly window.

anomalous_cost_change [required]

double

Anomalous cost change relative to the expected baseline.

anomaly_end [required]

int64

Anomaly end timestamp in Unix milliseconds.

anomaly_start [required]

int64

Anomaly start timestamp in Unix milliseconds.

correlated_tags [required]

object

Map of correlated tag keys to the list of correlated tag values.

<any-key>

[string]

The list of correlated values for the tag key.

dimensions [required]

object

Map of cost dimension keys to their values for the anomaly grouping.

<any-key>

string

The dimension value.

dismissal

object

Resolution metadata for an anomaly that has been dismissed.

cause [required]

string

Reason the anomaly was dismissed.

dismissal_id [required]

string

Unique identifier of the dismissal record.

message [required]

string

Optional message explaining the dismissal.

updated_at [required]

int64

Timestamp of the last dismissal update in Unix milliseconds.

updated_by [required]

string

Identifier of the user that last updated the dismissal.

max_cost [required]

double

Maximum cost observed during the anomaly window.

provider [required]

string

Cloud or SaaS provider associated with the anomaly (for example aws, gcp, azure).

query [required]

string

The metrics query that detected the anomaly.

uuid [required]

string

The unique identifier of the anomaly.

id [required]

string

The unique identifier of the anomaly.

type [required]

enum

Type of the cost anomalies collection resource. Must be anomalies. Allowed enum values: anomalies

default: anomalies

{
  "data": {
    "attributes": {
      "actual_cost": 3001.24,
      "anomalous_cost_change": 1250.75,
      "anomaly_end": 1730429150000,
      "anomaly_start": 1730259950000,
      "correlated_tags": {
        "<any-key>": []
      },
      "dimensions": {
        "<any-key>": "string"
      },
      "dismissal": {
        "cause": "false_positive",
        "dismissal_id": "12345678-1234-1234-1234-123456789abc",
        "message": "This was expected due to planned infrastructure changes.",
        "updated_at": 1730344150000,
        "updated_by": "user@example.com"
      },
      "max_cost": 5000.5,
      "provider": "aws",
      "query": "sum:aws.cost.net.amortized{aws_cost_type IN (Usage,DiscountedUsage,SavingsPlanCoveredUsage) AND aws_product NOT IN (supportenterprise) AND service:\"ec2\"}.rollup(sum, daily)",
      "uuid": "b0a6aaa9-3c4c-48cb-9447-a0d1338b3e09"
    },
    "id": "b0a6aaa9-3c4c-48cb-9447-a0d1338b3e09",
    "type": "anomalies"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export anomaly_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/anomalies/${anomaly_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

GET https://api.ap1.datadoghq.com/api/v2/cost/tagshttps://api.ap2.datadoghq.com/api/v2/cost/tagshttps://api.datadoghq.eu/api/v2/cost/tagshttps://api.ddog-gov.com/api/v2/cost/tagshttps://api.us2.ddog-gov.com/api/v2/cost/tagshttps://api.datadoghq.com/api/v2/cost/tagshttps://api.us3.datadoghq.com/api/v2/cost/tagshttps://api.us5.datadoghq.com/api/v2/cost/tags

Overview

List Cloud Cost Management tags for a given metric. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

filter[metric]

string

The Cloud Cost Management metric to scope the tags to. When omitted, returns tags across all metrics.

filter[match]

string

A substring used to filter the returned tags by name.

filter[tags]

array

Filter to return only tags that appear with the given key:value tag values. For example, filter[tags]=providername:aws returns tags found on the same cost data, such as aws_instance_type:t3.micro and aws_instance_type:m5.large.

filter[tag_keys]

array

Restrict the returned tags to those whose key matches one of the given tag keys.

page[size]

integer

Controls the size of the internal tag search scope. This does not restrict the number of tags returned in the response. Defaults to 50, maximum 10000.

Response

OK

A list of Cloud Cost Management tags.

Expand All

Field

Type

Description

data [required]

[object]

The list of Cloud Cost Management tags.

attributes [required]

object

Attributes of a Cloud Cost Management tag.

sources [required]

[string]

List of sources that define this tag.

value [required]

string

The tag value in key:value format.

id [required]

string

The tag identifier, equal to its key:value representation.

type [required]

enum

Type of the Cloud Cost Management tag resource. Allowed enum values: cost_tag

default: cost_tag

{
  "data": [
    {
      "attributes": {
        "sources": [
          "focus"
        ],
        "value": "providername:aws"
      },
      "id": "providername:aws",
      "type": "cost_tag"
    },
    {
      "attributes": {
        "sources": [
          "focus"
        ],
        "value": "providername:gcp"
      },
      "id": "providername:gcp",
      "type": "cost_tag"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tags" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

GET https://api.ap1.datadoghq.com/api/v2/cost/tag_keyshttps://api.ap2.datadoghq.com/api/v2/cost/tag_keyshttps://api.datadoghq.eu/api/v2/cost/tag_keyshttps://api.ddog-gov.com/api/v2/cost/tag_keyshttps://api.us2.ddog-gov.com/api/v2/cost/tag_keyshttps://api.datadoghq.com/api/v2/cost/tag_keyshttps://api.us3.datadoghq.com/api/v2/cost/tag_keyshttps://api.us5.datadoghq.com/api/v2/cost/tag_keys

Overview

List Cloud Cost Management tag keys. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

filter[metric]

string

The Cloud Cost Management metric to scope the tag keys to. When omitted, returns tag keys across all metrics.

filter[tags]

array

Filter to return only tag keys that appear with the given key:value tag values. For example, filter[tags]=providername:aws returns tag keys found on the same cost data, such as is_aws_ec2_compute and aws_instance_type.

Response

OK

A list of Cloud Cost Management tag keys.

Expand All

Field

Type

Description

data [required]

[object]

The list of Cloud Cost Management tag keys.

attributes [required]

object

Attributes of a Cloud Cost Management tag key.

details

object

Additional details for a Cloud Cost Management tag key, including its description and example tag values.

description [required]

string

Description of the tag key.

tag_values [required]

[string]

Example tag values observed for this tag key.

sources [required]

[string]

List of sources that define this tag key.

value [required]

string

The tag key name.

id [required]

string

The tag key identifier.

type [required]

enum

Type of the Cloud Cost Management tag key resource. Allowed enum values: cost_tag_key

default: cost_tag_key

{
  "data": [
    {
      "attributes": {
        "sources": [
          "focus"
        ],
        "value": "providername"
      },
      "id": "providername",
      "type": "cost_tag_key"
    },
    {
      "attributes": {
        "sources": [],
        "value": "service"
      },
      "id": "service",
      "type": "cost_tag_key"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tag_keys" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

GET https://api.ap1.datadoghq.com/api/v2/cost/tag_keys/{tag_key}https://api.ap2.datadoghq.com/api/v2/cost/tag_keys/{tag_key}https://api.datadoghq.eu/api/v2/cost/tag_keys/{tag_key}https://api.ddog-gov.com/api/v2/cost/tag_keys/{tag_key}https://api.us2.ddog-gov.com/api/v2/cost/tag_keys/{tag_key}https://api.datadoghq.com/api/v2/cost/tag_keys/{tag_key}https://api.us3.datadoghq.com/api/v2/cost/tag_keys/{tag_key}https://api.us5.datadoghq.com/api/v2/cost/tag_keys/{tag_key}

Overview

Get details for a specific Cloud Cost Management tag key, including example tag values and description. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

tag_key [required]

string

The Cloud Cost Management tag key. Tag keys can contain forward slashes (for example, kubernetes/instance).

Query Strings

Name

Type

Description

filter[metric]

string

The Cloud Cost Management metric to scope the tag key details to. When omitted, returns details across all metrics.

page[size]

integer

Controls the size of the internal tag value search scope. This does not restrict the number of example tag values returned in the response. Defaults to 50, maximum 10000.

Response

OK

A single Cloud Cost Management tag key.

Expand All

Field

Type

Description

data [required]

object

A Cloud Cost Management tag key.

attributes [required]

object

Attributes of a Cloud Cost Management tag key.

details

object

Additional details for a Cloud Cost Management tag key, including its description and example tag values.

description [required]

string

Description of the tag key.

tag_values [required]

[string]

Example tag values observed for this tag key.

sources [required]

[string]

List of sources that define this tag key.

value [required]

string

The tag key name.

id [required]

string

The tag key identifier.

type [required]

enum

Type of the Cloud Cost Management tag key resource. Allowed enum values: cost_tag_key

default: cost_tag_key

{
  "data": {
    "attributes": {
      "details": {
        "description": "The cloud provider name reported for the cost line item.",
        "tag_values": [
          "aws",
          "gcp",
          "azure"
        ]
      },
      "sources": [
        "focus"
      ],
      "value": "providername"
    },
    "id": "providername",
    "type": "cost_tag_key"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export tag_key="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tag_keys/${tag_key}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/commitments/utilization/scalarhttps://api.ap2.datadoghq.com/api/v2/cost/commitments/utilization/scalarhttps://api.datadoghq.eu/api/v2/cost/commitments/utilization/scalarhttps://api.ddog-gov.com/api/v2/cost/commitments/utilization/scalarhttps://api.us2.ddog-gov.com/api/v2/cost/commitments/utilization/scalarhttps://api.datadoghq.com/api/v2/cost/commitments/utilization/scalarhttps://api.us3.datadoghq.com/api/v2/cost/commitments/utilization/scalarhttps://api.us5.datadoghq.com/api/v2/cost/commitments/utilization/scalar

Overview

Get scalar utilization metrics for cloud commitment programs, including utilization percentage and unused cost. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

provider [required]

enum

Cloud provider for commitment programs (aws or azure).
Allowed enum values: aws, azure

product [required]

string

Cloud product identifier (for example, ec2, rds, virtualmachines).

start [required]

integer

Start of the query time range in Unix milliseconds.

end [required]

integer

End of the query time range in Unix milliseconds.

filterBy

string

Optional filter expression to narrow down results.

commitmentType

enum

Type of commitment to query. ri for Reserved Instances, sp for Savings Plans. Defaults to ri.
Allowed enum values: ri, sp

Response

OK

Response containing scalar utilization metrics for cloud commitment programs.

Expand All

Field

Type

Description

columns [required]

[object]

Array of scalar columns in the response.

meta

object

Metadata for a scalar column, including unit information.

unit [required]

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

name [required]

string

The column name.

type [required]

enum

The column type. "group" for dimension columns, "number" for metric columns. Allowed enum values: group,number

values [required]

[]

Values for a scalar column. Arrays of strings for group columns, numbers for value columns.

product_breakdown

[object]

Array of per-product utilization breakdown entries.

product [required]

string

The cloud product name.

utilization [required]

double

The utilization percentage for the product.

{
  "columns": [
    {
      "meta": {
        "unit": {
          "family": "percentage",
          "id": 17,
          "name": "percent",
          "plural": "percent",
          "scale_factor": 1,
          "short_name": "%"
        }
      },
      "name": "utilization",
      "type": "group",
      "values": [
        0.85,
        0.72
      ]
    }
  ],
  "product_breakdown": [
    {
      "product": "ec2",
      "utilization": 0.85
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export provider="aws"
export product="ec2"
export start="1.6935264e+12"
export end="1.6961184e+12"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/commitments/utilization/scalar?provider=${provider}&product=${product}&start=${start}&end=${end}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/commitments/coverage/scalarhttps://api.ap2.datadoghq.com/api/v2/cost/commitments/coverage/scalarhttps://api.datadoghq.eu/api/v2/cost/commitments/coverage/scalarhttps://api.ddog-gov.com/api/v2/cost/commitments/coverage/scalarhttps://api.us2.ddog-gov.com/api/v2/cost/commitments/coverage/scalarhttps://api.datadoghq.com/api/v2/cost/commitments/coverage/scalarhttps://api.us3.datadoghq.com/api/v2/cost/commitments/coverage/scalarhttps://api.us5.datadoghq.com/api/v2/cost/commitments/coverage/scalar

Overview

Get scalar coverage metrics for cloud commitment programs, including hours and cost coverage percentages. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

provider [required]

enum

Cloud provider for commitment programs (aws or azure).
Allowed enum values: aws, azure

product [required]

string

Cloud product identifier (for example, ec2, rds, virtualmachines).

start [required]

integer

Start of the query time range in Unix milliseconds.

end [required]

integer

End of the query time range in Unix milliseconds.

filterBy

string

Optional filter expression to narrow down results.

Response

OK

Response containing scalar coverage metrics for cloud commitment programs.

Expand All

Field

Type

Description

columns [required]

[object]

Array of scalar columns in the response.

meta

object

Metadata for a scalar column, including unit information.

unit [required]

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

name [required]

string

The column name.

type [required]

enum

The column type. "group" for dimension columns, "number" for metric columns. Allowed enum values: group,number

values [required]

[]

Values for a scalar column. Arrays of strings for group columns, numbers for value columns.

{
  "columns": [
    {
      "meta": {
        "unit": {
          "family": "percentage",
          "id": 17,
          "name": "percent",
          "plural": "percent",
          "scale_factor": 1,
          "short_name": "%"
        }
      },
      "name": "utilization",
      "type": "group",
      "values": [
        0.85,
        0.72
      ]
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export provider="aws"
export product="ec2"
export start="1.6935264e+12"
export end="1.6961184e+12"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/commitments/coverage/scalar?provider=${provider}&product=${product}&start=${start}&end=${end}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/commitments/on-demand-hot-spots/scalarhttps://api.ap2.datadoghq.com/api/v2/cost/commitments/on-demand-hot-spots/scalarhttps://api.datadoghq.eu/api/v2/cost/commitments/on-demand-hot-spots/scalarhttps://api.ddog-gov.com/api/v2/cost/commitments/on-demand-hot-spots/scalarhttps://api.us2.ddog-gov.com/api/v2/cost/commitments/on-demand-hot-spots/scalarhttps://api.datadoghq.com/api/v2/cost/commitments/on-demand-hot-spots/scalarhttps://api.us3.datadoghq.com/api/v2/cost/commitments/on-demand-hot-spots/scalarhttps://api.us5.datadoghq.com/api/v2/cost/commitments/on-demand-hot-spots/scalar

Overview

Get scalar on-demand hot-spots data for cloud commitment programs, showing per-dimension breakdowns of on-demand spending with coverage metrics and potential savings. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

provider [required]

enum

Cloud provider for commitment programs (aws or azure).
Allowed enum values: aws, azure

product [required]

string

Cloud product identifier (for example, ec2, rds, virtualmachines).

start [required]

integer

Start of the query time range in Unix milliseconds.

end [required]

integer

End of the query time range in Unix milliseconds.

filterBy

string

Optional filter expression to narrow down results.

Response

OK

Response containing scalar on-demand hot-spots data for cloud commitment programs.

Expand All

Field

Type

Description

columns [required]

[object]

Array of scalar columns in the response.

meta

object

Metadata for a scalar column, including unit information.

unit [required]

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

name [required]

string

The column name.

type [required]

enum

The column type. "group" for dimension columns, "number" for metric columns. Allowed enum values: group,number

values [required]

[]

Values for a scalar column. Arrays of strings for group columns, numbers for value columns.

meta

object

Metadata for the on-demand hot-spots scalar response.

on_demand_filters [required]

string

Active on-demand filters applied to the response.

total [required]

[object]

Array of scalar columns in the response.

meta

object

Metadata for a scalar column, including unit information.

unit [required]

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

name [required]

string

The column name.

type [required]

enum

The column type. "group" for dimension columns, "number" for metric columns. Allowed enum values: group,number

values [required]

[]

Values for a scalar column. Arrays of strings for group columns, numbers for value columns.

{
  "columns": [
    {
      "meta": {
        "unit": {
          "family": "percentage",
          "id": 17,
          "name": "percent",
          "plural": "percent",
          "scale_factor": 1,
          "short_name": "%"
        }
      },
      "name": "utilization",
      "type": "group",
      "values": [
        0.85,
        0.72
      ]
    }
  ],
  "meta": {
    "on_demand_filters": "region:us-east-1"
  },
  "total": [
    {
      "meta": {
        "unit": {
          "family": "percentage",
          "id": 17,
          "name": "percent",
          "plural": "percent",
          "scale_factor": 1,
          "short_name": "%"
        }
      },
      "name": "utilization",
      "type": "group",
      "values": [
        0.85,
        0.72
      ]
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export provider="aws"
export product="ec2"
export start="1.6935264e+12"
export end="1.6961184e+12"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/commitments/on-demand-hot-spots/scalar?provider=${provider}&product=${product}&start=${start}&end=${end}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/commitments/savings/scalarhttps://api.ap2.datadoghq.com/api/v2/cost/commitments/savings/scalarhttps://api.datadoghq.eu/api/v2/cost/commitments/savings/scalarhttps://api.ddog-gov.com/api/v2/cost/commitments/savings/scalarhttps://api.us2.ddog-gov.com/api/v2/cost/commitments/savings/scalarhttps://api.datadoghq.com/api/v2/cost/commitments/savings/scalarhttps://api.us3.datadoghq.com/api/v2/cost/commitments/savings/scalarhttps://api.us5.datadoghq.com/api/v2/cost/commitments/savings/scalar

Overview

Get scalar savings metrics for cloud commitment programs, including realized savings and effective savings rate. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

provider [required]

enum

Cloud provider for commitment programs (aws or azure).
Allowed enum values: aws, azure

product [required]

string

Cloud product identifier (for example, ec2, rds, virtualmachines).

start [required]

integer

Start of the query time range in Unix milliseconds.

end [required]

integer

End of the query time range in Unix milliseconds.

filterBy

string

Optional filter expression to narrow down results.

Response

OK

Response containing scalar savings metrics for cloud commitment programs.

Expand All

Field

Type

Description

columns [required]

[object]

Array of scalar columns in the response.

meta

object

Metadata for a scalar column, including unit information.

unit [required]

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

name [required]

string

The column name.

type [required]

enum

The column type. "group" for dimension columns, "number" for metric columns. Allowed enum values: group,number

values [required]

[]

Values for a scalar column. Arrays of strings for group columns, numbers for value columns.

{
  "columns": [
    {
      "meta": {
        "unit": {
          "family": "percentage",
          "id": 17,
          "name": "percent",
          "plural": "percent",
          "scale_factor": 1,
          "short_name": "%"
        }
      },
      "name": "utilization",
      "type": "group",
      "values": [
        0.85,
        0.72
      ]
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export provider="aws"
export product="ec2"
export start="1.6935264e+12"
export end="1.6961184e+12"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/commitments/savings/scalar?provider=${provider}&product=${product}&start=${start}&end=${end}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/commitments/savings/timeserieshttps://api.ap2.datadoghq.com/api/v2/cost/commitments/savings/timeserieshttps://api.datadoghq.eu/api/v2/cost/commitments/savings/timeserieshttps://api.ddog-gov.com/api/v2/cost/commitments/savings/timeserieshttps://api.us2.ddog-gov.com/api/v2/cost/commitments/savings/timeserieshttps://api.datadoghq.com/api/v2/cost/commitments/savings/timeserieshttps://api.us3.datadoghq.com/api/v2/cost/commitments/savings/timeserieshttps://api.us5.datadoghq.com/api/v2/cost/commitments/savings/timeseries

Overview

Get timeseries savings metrics for cloud commitment programs, including actual cost, on-demand equivalent cost, realized savings, and effective savings rate over time. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

provider [required]

enum

Cloud provider for commitment programs (aws or azure).
Allowed enum values: aws, azure

product [required]

string

Cloud product identifier (for example, ec2, rds, virtualmachines).

start [required]

integer

Start of the query time range in Unix milliseconds.

end [required]

integer

End of the query time range in Unix milliseconds.

filterBy

string

Optional filter expression to narrow down results.

Response

OK

Response containing timeseries savings metrics for cloud commitment programs.

Expand All

Field

Type

Description

actual_cost [required]

object

A timeseries metric containing timestamps, series values, and optional unit metadata.

series [required]

object

Timeseries data as a map of series names to their corresponding value arrays.

<any-key>

[number]

A series of numeric values for a timeseries metric.

times [required]

[integer]

Unix timestamps in seconds for the timeseries data points.

unit

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

effective_savings_rate [required]

object

A timeseries metric containing timestamps, series values, and optional unit metadata.

series [required]

object

Timeseries data as a map of series names to their corresponding value arrays.

<any-key>

[number]

A series of numeric values for a timeseries metric.

times [required]

[integer]

Unix timestamps in seconds for the timeseries data points.

unit

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

on_demand_equivalent_cost [required]

object

A timeseries metric containing timestamps, series values, and optional unit metadata.

series [required]

object

Timeseries data as a map of series names to their corresponding value arrays.

<any-key>

[number]

A series of numeric values for a timeseries metric.

times [required]

[integer]

Unix timestamps in seconds for the timeseries data points.

unit

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

realized_savings [required]

object

A timeseries metric containing timestamps, series values, and optional unit metadata.

series [required]

object

Timeseries data as a map of series names to their corresponding value arrays.

<any-key>

[number]

A series of numeric values for a timeseries metric.

times [required]

[integer]

Unix timestamps in seconds for the timeseries data points.

unit

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

{
  "actual_cost": {
    "series": {
      "<any-key>": []
    },
    "times": [
      1693526400,
      1693612800
    ],
    "unit": {
      "family": "percentage",
      "id": 17,
      "name": "percent",
      "plural": "percent",
      "scale_factor": 1,
      "short_name": "%"
    }
  },
  "effective_savings_rate": {
    "series": {
      "<any-key>": []
    },
    "times": [
      1693526400,
      1693612800
    ],
    "unit": {
      "family": "percentage",
      "id": 17,
      "name": "percent",
      "plural": "percent",
      "scale_factor": 1,
      "short_name": "%"
    }
  },
  "on_demand_equivalent_cost": {
    "series": {
      "<any-key>": []
    },
    "times": [
      1693526400,
      1693612800
    ],
    "unit": {
      "family": "percentage",
      "id": 17,
      "name": "percent",
      "plural": "percent",
      "scale_factor": 1,
      "short_name": "%"
    }
  },
  "realized_savings": {
    "series": {
      "<any-key>": []
    },
    "times": [
      1693526400,
      1693612800
    ],
    "unit": {
      "family": "percentage",
      "id": 17,
      "name": "percent",
      "plural": "percent",
      "scale_factor": 1,
      "short_name": "%"
    }
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export provider="aws"
export product="ec2"
export start="1.6935264e+12"
export end="1.6961184e+12"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/commitments/savings/timeseries?provider=${provider}&product=${product}&start=${start}&end=${end}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/commitments/utilization/timeserieshttps://api.ap2.datadoghq.com/api/v2/cost/commitments/utilization/timeserieshttps://api.datadoghq.eu/api/v2/cost/commitments/utilization/timeserieshttps://api.ddog-gov.com/api/v2/cost/commitments/utilization/timeserieshttps://api.us2.ddog-gov.com/api/v2/cost/commitments/utilization/timeserieshttps://api.datadoghq.com/api/v2/cost/commitments/utilization/timeserieshttps://api.us3.datadoghq.com/api/v2/cost/commitments/utilization/timeserieshttps://api.us5.datadoghq.com/api/v2/cost/commitments/utilization/timeseries

Overview

Get timeseries utilization metrics for cloud commitment programs, including used and unused cost series over time. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

provider [required]

enum

Cloud provider for commitment programs (aws or azure).
Allowed enum values: aws, azure

product [required]

string

Cloud product identifier (for example, ec2, rds, virtualmachines).

start [required]

integer

Start of the query time range in Unix milliseconds.

end [required]

integer

End of the query time range in Unix milliseconds.

filterBy

string

Optional filter expression to narrow down results.

commitmentType

enum

Type of commitment to query. ri for Reserved Instances, sp for Savings Plans. Defaults to ri.
Allowed enum values: ri, sp

Response

OK

Response containing timeseries utilization metrics for cloud commitment programs.

Expand All

Field

Type

Description

series [required]

object

Timeseries data as a map of series names to their corresponding value arrays.

<any-key>

[number]

A series of numeric values for a timeseries metric.

times [required]

[integer]

Unix timestamps in seconds for the timeseries data points.

unit

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

{
  "series": {
    "<any-key>": []
  },
  "times": [
    1693526400,
    1693612800
  ],
  "unit": {
    "family": "percentage",
    "id": 17,
    "name": "percent",
    "plural": "percent",
    "scale_factor": 1,
    "short_name": "%"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export provider="aws"
export product="ec2"
export start="1.6935264e+12"
export end="1.6961184e+12"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/commitments/utilization/timeseries?provider=${provider}&product=${product}&start=${start}&end=${end}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/commitments/coverage/timeserieshttps://api.ap2.datadoghq.com/api/v2/cost/commitments/coverage/timeserieshttps://api.datadoghq.eu/api/v2/cost/commitments/coverage/timeserieshttps://api.ddog-gov.com/api/v2/cost/commitments/coverage/timeserieshttps://api.us2.ddog-gov.com/api/v2/cost/commitments/coverage/timeserieshttps://api.datadoghq.com/api/v2/cost/commitments/coverage/timeserieshttps://api.us3.datadoghq.com/api/v2/cost/commitments/coverage/timeserieshttps://api.us5.datadoghq.com/api/v2/cost/commitments/coverage/timeseries

Overview

Get timeseries coverage metrics for cloud commitment programs, broken down by coverage type (Reserved Instances, Savings Plans, On-Demand, and Spot) for both hours and cost. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

provider [required]

enum

Cloud provider for commitment programs (aws or azure).
Allowed enum values: aws, azure

product [required]

string

Cloud product identifier (for example, ec2, rds, virtualmachines).

start [required]

integer

Start of the query time range in Unix milliseconds.

end [required]

integer

End of the query time range in Unix milliseconds.

filterBy

string

Optional filter expression to narrow down results.

Response

OK

Response containing timeseries coverage metrics for cloud commitment programs.

Expand All

Field

Type

Description

cost [required]

object

A timeseries metric containing timestamps, series values, and optional unit metadata.

series [required]

object

Timeseries data as a map of series names to their corresponding value arrays.

<any-key>

[number]

A series of numeric values for a timeseries metric.

times [required]

[integer]

Unix timestamps in seconds for the timeseries data points.

unit

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

hours [required]

object

A timeseries metric containing timestamps, series values, and optional unit metadata.

series [required]

object

Timeseries data as a map of series names to their corresponding value arrays.

<any-key>

[number]

A series of numeric values for a timeseries metric.

times [required]

[integer]

Unix timestamps in seconds for the timeseries data points.

unit

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

{
  "cost": {
    "series": {
      "<any-key>": []
    },
    "times": [
      1693526400,
      1693612800
    ],
    "unit": {
      "family": "percentage",
      "id": 17,
      "name": "percent",
      "plural": "percent",
      "scale_factor": 1,
      "short_name": "%"
    }
  },
  "hours": {
    "series": {
      "<any-key>": []
    },
    "times": [
      1693526400,
      1693612800
    ],
    "unit": {
      "family": "percentage",
      "id": 17,
      "name": "percent",
      "plural": "percent",
      "scale_factor": 1,
      "short_name": "%"
    }
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export provider="aws"
export product="ec2"
export start="1.6935264e+12"
export end="1.6961184e+12"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/commitments/coverage/timeseries?provider=${provider}&product=${product}&start=${start}&end=${end}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/commitments/commitment-listhttps://api.ap2.datadoghq.com/api/v2/cost/commitments/commitment-listhttps://api.datadoghq.eu/api/v2/cost/commitments/commitment-listhttps://api.ddog-gov.com/api/v2/cost/commitments/commitment-listhttps://api.us2.ddog-gov.com/api/v2/cost/commitments/commitment-listhttps://api.datadoghq.com/api/v2/cost/commitments/commitment-listhttps://api.us3.datadoghq.com/api/v2/cost/commitments/commitment-listhttps://api.us5.datadoghq.com/api/v2/cost/commitments/commitment-list

Overview

Get a list of individual cloud commitments (Reserved Instances or Savings Plans) with their utilization details. The response schema varies based on the provider, product, and commitment type. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

provider [required]

enum

Cloud provider for commitment programs (aws or azure).
Allowed enum values: aws, azure

product [required]

string

Cloud product identifier (for example, ec2, rds, virtualmachines).

start [required]

integer

Start of the query time range in Unix milliseconds.

end [required]

integer

End of the query time range in Unix milliseconds.

filterBy

string

Optional filter expression to narrow down results.

commitmentType

enum

Type of commitment to query. ri for Reserved Instances, sp for Savings Plans. Defaults to ri.
Allowed enum values: ri, sp

Response

OK

Response containing a list of cloud commitment details.

Expand All

Field

Type

Description

commitments [required]

[ <oneOf>]

Array of commitment items.

Option 1

object

AWS EC2 Reserved Instance commitment details.

availability_zone

string

The availability zone of the reservation.

commitment_id [required]

string

The unique identifier of the Reserved Instance.

expiration_date

string

The expiration date of the commitment.

instance_type [required]

string

The EC2 instance type.

number_of_nfus

double

The number of Normalized Capacity Units.

number_of_reservations

double

The number of reserved instances.

offering_class [required]

string

The offering class of the Reserved Instance.

operating_system [required]

string

The operating system of the Reserved Instance.

purchase_option [required]

string

The payment option for the Reserved Instance.

region [required]

string

The AWS region of the Reserved Instance.

start_date

string

The start date of the commitment.

term_length

double

The term length in years.

utilization

double

The utilization percentage of the commitment.

Option 2

object

AWS RDS Reserved Instance commitment details.

commitment_id [required]

string

The unique identifier of the Reserved Instance.

database_engine [required]

string

The database engine of the Reserved Instance.

expiration_date

string

The expiration date of the commitment.

instance_type [required]

string

The RDS instance type.

is_multi_az

boolean

Whether the Reserved Instance is Multi-AZ.

number_of_nfus

double

The number of Normalized Capacity Units.

number_of_reservations

double

The number of reserved instances.

purchase_option [required]

string

The payment option for the Reserved Instance.

region [required]

string

The AWS region of the Reserved Instance.

start_date

string

The start date of the commitment.

term_length

double

The term length in years.

utilization

double

The utilization percentage of the commitment.

Option 3

object

AWS ElastiCache Reserved Instance commitment details.

cache_engine [required]

string

The cache engine type of the Reserved Instance.

commitment_id [required]

string

The unique identifier of the Reserved Instance.

expiration_date

string

The expiration date of the commitment.

instance_type [required]

string

The ElastiCache instance type.

number_of_nfus

double

The number of Normalized Capacity Units.

number_of_reservations

double

The number of reserved instances.

purchase_option [required]

string

The payment option for the Reserved Instance.

region [required]

string

The AWS region of the Reserved Instance.

start_date

string

The start date of the commitment.

term_length

double

The term length in years.

utilization

double

The utilization percentage of the commitment.

Option 4

object

AWS Savings Plan commitment details.

commitment_id [required]

string

The unique identifier of the Savings Plan.

committed_spend_per_hour

double

The hourly committed spend for the Savings Plan.

expiration_date

string

The expiration date of the commitment.

purchase_option [required]

string

The payment option for the Savings Plan.

savings_plan_type [required]

string

The Savings Plan type.

start_date

string

The start date of the commitment.

term_length

double

The term length in years.

utilization

double

The utilization percentage of the commitment.

Option 5

object

Azure Virtual Machine Reserved Instance commitment details.

benefit_name [required]

string

The display name of the Azure reservation.

commitment_id [required]

string

The unique identifier of the Reserved Instance.

expiration_date

string

The expiration date of the commitment.

instance_type [required]

string

The Azure VM instance type.

meter_sub_category [required]

string

The Azure meter sub-category for the reservation.

region [required]

string

The Azure region of the Reserved Instance.

start_date

string

The start date of the commitment.

status [required]

enum

Status of an Azure VM Reserved Instance. Allowed enum values: running,expired,cancelled

term_length

double

The term length in years.

utilization

double

The utilization percentage of the commitment.

Option 6

object

Azure Compute Savings Plan commitment details.

benefit_name [required]

string

The display name of the Azure Savings Plan.

commitment_id [required]

string

The unique identifier of the Savings Plan.

committed_spend_per_hour

double

The hourly committed spend for the Savings Plan.

expiration_date

string

The expiration date of the commitment.

start_date

string

The start date of the commitment.

term_length

double

The term length in years.

utilization

double

The utilization percentage of the commitment.

meta

object

Metadata for a commitments list response.

committed_spend_unit

object

Unit metadata for a numeric metric.

family [required]

string

The unit family (for example, percentage or money).

id [required]

int64

The unit identifier.

name [required]

string

The unit name (for example, percent or dollar).

plural [required]

string

The plural form of the unit name.

scale_factor [required]

double

The scale factor for the unit.

short_name [required]

string

The abbreviated unit name (for example, % or $).

{
  "commitments": [
    {
      "availability_zone": "us-east-1a",
      "commitment_id": "ri-0123456789abcdef0",
      "expiration_date": "2025-12-31T00:00:00Z",
      "instance_type": "m5.xlarge",
      "number_of_nfus": 8,
      "number_of_reservations": 2,
      "offering_class": "standard",
      "operating_system": "Linux",
      "purchase_option": "All Upfront",
      "region": "us-east-1",
      "start_date": "2023-01-01T00:00:00Z",
      "term_length": 1,
      "utilization": 0.85
    }
  ],
  "meta": {
    "committed_spend_unit": {
      "family": "percentage",
      "id": 17,
      "name": "percent",
      "plural": "percent",
      "scale_factor": 1,
      "short_name": "%"
    }
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export provider="aws"
export product="ec2"
export start="1.6935264e+12"
export end="1.6961184e+12"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/commitments/commitment-list?provider=${provider}&product=${product}&start=${start}&end=${end}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/tag_metadatahttps://api.ap2.datadoghq.com/api/v2/cost/tag_metadatahttps://api.datadoghq.eu/api/v2/cost/tag_metadatahttps://api.ddog-gov.com/api/v2/cost/tag_metadatahttps://api.us2.ddog-gov.com/api/v2/cost/tag_metadatahttps://api.datadoghq.com/api/v2/cost/tag_metadatahttps://api.us3.datadoghq.com/api/v2/cost/tag_metadatahttps://api.us5.datadoghq.com/api/v2/cost/tag_metadata

Overview

List Cloud Cost Management tag key metadata, including row counts, cost covered, cardinality, and a sample of top tag values per cloud account. Use filter[daily]=true to return daily rows instead of the default monthly roll-up. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

filter[month] [required]

string

The month to scope the query to, in YYYY-MM format.

filter[provider]

string

Filter results to a specific provider. Common cloud values are aws, azure, gcp, Oracle (OCI), and custom. SaaS billing integrations (for example, Snowflake, MongoDB, Databricks) are also accepted using their display-name string. Values are case-sensitive.

filter[metric]

string

Filter results to a specific Cloud Cost Management metric (for example, aws.cost.net.amortized). When omitted, every available metric for the requested period is returned.

filter[tag_key]

string

Restrict results to a single tag key.

filter[daily]

enum

When true, return one row per day with the day in the date attribute. Defaults to the monthly roll-up when omitted.
Allowed enum values: true, false

Response

OK

List of Cloud Cost Management tag key metadata entries for the requested period.

Expand All

Field

Type

Description

data [required]

[object]

List of tag key metadata entries.

attributes [required]

object

Attributes of a Cloud Cost Management tag key metadata entry.

cardinality_by_account [required]

object

Number of unique tag values observed for this tag key, keyed by cloud account ID.

<any-key>

int64

Number of unique tag values observed in the account.

cost_covered [required]

double

Total cost (in the report currency) of cost line items that carry this tag key for the requested period.

date

string

The day this row corresponds to, in YYYY-MM-DD format. Present only when filter[daily]=true; omitted for the monthly roll-up returned by default.

metric [required]

string

The Cloud Cost Management metric this row aggregates, for example aws.cost.net.amortized.

row_count [required]

int64

Number of cost rows that carry this tag key over the requested period.

tag_sources [required]

[string]

Origins where this tag key was observed (for example, aws-user-defined).

top_values_by_account [required]

object

A sample of the most frequent tag values observed for this tag key, keyed by cloud account ID.

<any-key>

[string]

A sample of the most frequent tag values observed in the account.

id [required]

string

A composite identifier of the form tag_key:metric for monthly roll-ups, or tag_key:metric:YYYY-MM-DD when filter[daily]=true.

type [required]

enum

Type of the Cloud Cost Management tag key metadata resource. Allowed enum values: cost_tag_key_metadata

default: cost_tag_key_metadata

{
  "data": [
    {
      "attributes": {
        "cardinality_by_account": {
          "123456789012": 42
        },
        "cost_covered": 1234.56,
        "metric": "aws.cost.net.amortized",
        "row_count": 100,
        "tag_sources": [
          "aws-user-defined"
        ],
        "top_values_by_account": {
          "123456789012": [
            "prod",
            "staging"
          ]
        }
      },
      "id": "env:aws.cost.net.amortized",
      "type": "cost_tag_key_metadata"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export filter[month]="2026-02"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tag_metadata?filter[month]=${filter[month]}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/tag_metadata/tag_sourceshttps://api.ap2.datadoghq.com/api/v2/cost/tag_metadata/tag_sourceshttps://api.datadoghq.eu/api/v2/cost/tag_metadata/tag_sourceshttps://api.ddog-gov.com/api/v2/cost/tag_metadata/tag_sourceshttps://api.us2.ddog-gov.com/api/v2/cost/tag_metadata/tag_sourceshttps://api.datadoghq.com/api/v2/cost/tag_metadata/tag_sourceshttps://api.us3.datadoghq.com/api/v2/cost/tag_metadata/tag_sourceshttps://api.us5.datadoghq.com/api/v2/cost/tag_metadata/tag_sources

Overview

List Cloud Cost Management tag keys observed for the requested period, along with the origin sources that produced them (for example, aws-user-defined, custom). This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

filter[month] [required]

string

The month to scope the query to, in YYYY-MM format.

filter[provider]

string

Filter results to a specific provider. Common cloud values are aws, azure, gcp, Oracle (OCI), and custom. SaaS billing integrations (for example, Snowflake, MongoDB, Databricks) are also accepted using their display-name string. Values are case-sensitive.

Response

OK

List of Cloud Cost Management tag keys with their origin sources for the requested period.

Expand All

Field

Type

Description

data [required]

[object]

List of tag keys with their origin sources.

attributes [required]

object

Attributes of a Cloud Cost Management tag source.

tag_key [required]

string

The tag key name.

tag_sources [required]

[string]

Origins where this tag key was observed (for example, aws-user-defined).

id [required]

string

The tag key identifier. Equal to the empty-tag sentinel __empty_tag_key__ when the tag key is empty.

type [required]

enum

Type of the Cloud Cost Management tag source resource. Allowed enum values: cost_tag_key_source

default: cost_tag_key_source

{
  "data": [
    {
      "attributes": {
        "tag_key": "env",
        "tag_sources": [
          "aws-user-defined",
          "custom"
        ]
      },
      "id": "env",
      "type": "cost_tag_key_source"
    },
    {
      "attributes": {
        "tag_key": "service",
        "tag_sources": [
          "aws"
        ]
      },
      "id": "service",
      "type": "cost_tag_key_source"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export filter[month]="2026-02"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tag_metadata/tag_sources?filter[month]=${filter[month]}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/tag_metadata/metricshttps://api.ap2.datadoghq.com/api/v2/cost/tag_metadata/metricshttps://api.datadoghq.eu/api/v2/cost/tag_metadata/metricshttps://api.ddog-gov.com/api/v2/cost/tag_metadata/metricshttps://api.us2.ddog-gov.com/api/v2/cost/tag_metadata/metricshttps://api.datadoghq.com/api/v2/cost/tag_metadata/metricshttps://api.us3.datadoghq.com/api/v2/cost/tag_metadata/metricshttps://api.us5.datadoghq.com/api/v2/cost/tag_metadata/metrics

Overview

List Cloud Cost Management metrics that have data for the requested period. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

filter[month] [required]

string

The month to scope the query to, in YYYY-MM format.

filter[provider]

string

Filter results to a specific provider. Common cloud values are aws, azure, gcp, Oracle (OCI), and custom. SaaS billing integrations (for example, Snowflake, MongoDB, Databricks) are also accepted using their display-name string. Values are case-sensitive.

Response

OK

List of available Cloud Cost Management metrics for the requested period.

Expand All

Field

Type

Description

data [required]

[object]

List of available metrics.

id [required]

string

The metric name, for example aws.cost.net.amortized.

type [required]

enum

Type of the Cloud Cost Management available metric resource. Allowed enum values: cost_metric

default: cost_metric

{
  "data": [
    {
      "id": "aws.cost.net.amortized",
      "type": "cost_metric"
    },
    {
      "id": "gcp.cost.amortized",
      "type": "cost_metric"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export filter[month]="2026-02"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tag_metadata/metrics?filter[month]=${filter[month]}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/tag_metadata/orchestratorshttps://api.ap2.datadoghq.com/api/v2/cost/tag_metadata/orchestratorshttps://api.datadoghq.eu/api/v2/cost/tag_metadata/orchestratorshttps://api.ddog-gov.com/api/v2/cost/tag_metadata/orchestratorshttps://api.us2.ddog-gov.com/api/v2/cost/tag_metadata/orchestratorshttps://api.datadoghq.com/api/v2/cost/tag_metadata/orchestratorshttps://api.us3.datadoghq.com/api/v2/cost/tag_metadata/orchestratorshttps://api.us5.datadoghq.com/api/v2/cost/tag_metadata/orchestrators

Overview

List container orchestrators (for example, kubernetes, ecs) detected in Cloud Cost Management data for the requested period. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

filter[month] [required]

string

The month to scope the query to, in YYYY-MM format.

filter[provider]

string

Filter results to a specific provider. Common cloud values are aws, azure, gcp, Oracle (OCI), and custom. SaaS billing integrations (for example, Snowflake, MongoDB, Databricks) are also accepted using their display-name string. Values are case-sensitive.

Response

OK

List of container orchestrators detected in Cloud Cost Management data for the requested period.

Expand All

Field

Type

Description

data [required]

[object]

List of detected container orchestrators.

id [required]

string

The orchestrator name, for example kubernetes or ecs.

type [required]

enum

Type of the Cloud Cost Management orchestrator resource. Allowed enum values: cost_orchestrator

default: cost_orchestrator

{
  "data": [
    {
      "id": "ecs",
      "type": "cost_orchestrator"
    },
    {
      "id": "kubernetes",
      "type": "cost_orchestrator"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export filter[month]="2026-02"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tag_metadata/orchestrators?filter[month]=${filter[month]}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

GET https://api.ap1.datadoghq.com/api/v2/cost/tag_metadata/currencyhttps://api.ap2.datadoghq.com/api/v2/cost/tag_metadata/currencyhttps://api.datadoghq.eu/api/v2/cost/tag_metadata/currencyhttps://api.ddog-gov.com/api/v2/cost/tag_metadata/currencyhttps://api.us2.ddog-gov.com/api/v2/cost/tag_metadata/currencyhttps://api.datadoghq.com/api/v2/cost/tag_metadata/currencyhttps://api.us3.datadoghq.com/api/v2/cost/tag_metadata/currencyhttps://api.us5.datadoghq.com/api/v2/cost/tag_metadata/currency

Overview

Get the dominant billing currency observed in Cloud Cost Management data for the requested period. The response wraps the currency in a JSON:API data array containing at most one entry; the array is empty when no currency data is available. This endpoint requires the cloud_cost_management_read permission.

OAuth apps require the cloud_cost_management_read authorization scope to access this endpoint.

Arguments

Query Strings

Name

Type

Description

filter[month] [required]

string

The month to scope the query to, in YYYY-MM format.

filter[provider]

string

Filter results to a specific provider. Common cloud values are aws, azure, gcp, Oracle (OCI), and custom. SaaS billing integrations (for example, Snowflake, MongoDB, Databricks) are also accepted using their display-name string. Values are case-sensitive.

Response

OK

The dominant Cloud Cost Management billing currency for the requested period. The data array contains at most one entry, and is empty when no currency data is available.

Expand All

Field

Type

Description

data [required]

[object]

The dominant billing currency. Empty when no data is available, or a single entry otherwise.

id [required]

string

The currency code (for example, USD).

type [required]

enum

Type of the Cloud Cost Management billing currency resource. Allowed enum values: cost_currency

default: cost_currency

{
  "data": [
    {
      "id": "USD",
      "type": "cost_currency"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Required query arguments
export filter[month]="2026-02"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/tag_metadata/currency?filter[month]=${filter[month]}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"