このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

Cloud Cost Management

The Cloud Cost Management API allows you to set up, edit, and delete Cloud Cost Management accounts for AWS and Azure. 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.datadoghq.eu/api/v2/cost/aws_cur_confighttps://api.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

概要

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.

応答

OK

List of AWS CUR configs.

Expand All

フィールド

種類

説明

data

[object]

An AWS CUR config.

attributes [required]

object

Attributes for An AWS CUR config.

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

int64

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_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": "integer",
      "type": "aws_cur_config"
    }
  ]
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.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.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}

概要

Update the status of an AWS CUR 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.

引数

パスパラメーター

名前

種類

説明

cloud_account_id [required]

string

Cloud Account id.

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

data [required]

object

AWS CUR config Patch data.

attributes [required]

object

Attributes for AWS CUR config Patch Request.

is_enabled [required]

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"
  }
}

応答

OK

List of AWS CUR configs.

Expand All

フィールド

種類

説明

data

[object]

An AWS CUR config.

attributes [required]

object

Attributes for An AWS CUR config.

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

int64

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_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": "integer",
      "type": "aws_cur_config"
    }
  ]
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                          # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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": { "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: 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.comddog-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("100", 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.comddog-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.comddog-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.comddog-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(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".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.comddog-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.comddog-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.datadoghq.eu/api/v2/cost/aws_cur_confighttps://api.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

概要

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.

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

data [required]

object

AWS CUR config Post data.

attributes [required]

object

Attributes for AWS CUR config Post Request.

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.

is_enabled

boolean

Whether or not the Cloud Cost Management account is enabled.

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"
  }
}

応答

OK

Response of AWS CUR config.

Expand All

フィールド

種類

説明

data

object

AWS CUR config.

attributes [required]

object

Attributes for An AWS CUR config.

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

int64

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_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": "integer",
    "type": "aws_cur_config"
  }
}

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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_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.comddog-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.comddog-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.comddog-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.comddog-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(
        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()),
        AwsCURConfigPostRequestType::AWS_CUR_CONFIG_POST_REQUEST,
    ));
    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.comddog-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.comddog-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.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.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}

概要

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.

引数

パスパラメーター

名前

種類

説明

cloud_account_id [required]

string

Cloud Account id.

応答

No Content

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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.comddog-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.comddog-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.comddog-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("100");
    } 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.comddog-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".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.comddog-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.comddog-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.datadoghq.eu/api/v2/cost/azure_uc_confighttps://api.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

概要

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.

応答

OK

List of Azure accounts with configs.

Expand All

フィールド

種類

説明

data

[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

int64

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

int64

The ID of the Azure config pair.

id

int64

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": "integer",
            "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": "integer"
      },
      "id": "integer",
      "type": "azure_uc_configs"
    }
  ]
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.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.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}

概要

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.

引数

パスパラメーター

名前

種類

説明

cloud_account_id [required]

string

Cloud Account id.

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

data [required]

object

Azure config Patch data.

attributes [required]

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"
  }
}

応答

OK

Response of Azure config pair.

Expand All

フィールド

種類

説明

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

int64

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

int64

The ID of the Azure config pair.

id

int64

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": "integer",
          "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": "integer"
    },
    "id": "integer",
    "type": "azure_uc_configs"
  }
}

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                          # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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.comddog-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("100", 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.comddog-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.comddog-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.comddog-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(
        AzureUCConfigPatchRequestAttributes::new(true),
        AzureUCConfigPatchRequestType::AZURE_UC_CONFIG_PATCH_REQUEST,
    ));
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api
        .update_cost_azure_uc_configs("100".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.comddog-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.comddog-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.datadoghq.eu/api/v2/cost/azure_uc_confighttps://api.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

概要

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.

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

data [required]

object

Azure config Post data.

attributes [required]

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.

is_enabled

boolean

Whether or not the Cloud Cost Management account is enabled.

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",
      "is_enabled": true,
      "scope": "subscriptions/1234abcd-1234-abcd-1234-1234abcd1234"
    },
    "type": "azure_uc_config_post_request"
  }
}

応答

OK

Response of Azure config pair.

Expand All

フィールド

種類

説明

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

int64

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

int64

The ID of the Azure config pair.

id

int64

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": "integer",
          "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": "integer"
    },
    "id": "integer",
    "type": "azure_uc_configs"
  }
}

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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", "is_enabled": true, "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",
				IsEnabled: datadog.PtrBool(true),
				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.comddog-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")
                            .isEnabled(true)
                            .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.comddog-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",
            is_enabled=True,
            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.comddog-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",
      is_enabled: true,
      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.comddog-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(
        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(),
        )
        .is_enabled(true),
        AzureUCConfigPostRequestType::AZURE_UC_CONFIG_POST_REQUEST,
    ));
    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.comddog-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",
        isEnabled: true,
        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.comddog-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.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.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}

概要

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.

引数

パスパラメーター

名前

種類

説明

cloud_account_id [required]

string

Cloud Account id.

応答

No Content

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Path parameters
export cloud_account_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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.comddog-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.comddog-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.comddog-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("100");
    } 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.comddog-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".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.comddog-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.comddog-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/enabledhttps://api.datadoghq.eu/api/v2/cost/enabledhttps://api.ddog-gov.com/api/v2/cost/enabledhttps://api.datadoghq.com/api/v2/cost/enabledhttps://api.us3.datadoghq.com/api/v2/cost/enabledhttps://api.us5.datadoghq.com/api/v2/cost/enabled

概要

Get the Cloud Cost Management activity. This endpoint requires the cloud_cost_management_read permission.

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

応答

OK

Response for Cloud Cost activity.

Expand All

フィールド

種類

説明

data

object

Cloud Cost Activity.

attributes [required]

object

Attributes for Cloud Cost activity.

is_enabled [required]

boolean

Whether or not the cloud account is enabled.

type [required]

enum

Type of Cloud Cost Activity. Allowed enum values: cloud_cost_activity

default: cloud_cost_activity

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

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cost/enabled" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Cloud Cost Enabled 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_cloud_cost_activity()

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Cloud Cost Enabled returns "OK" response

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

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Cloud Cost Enabled 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.GetCloudCostActivity(ctx)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.GetCloudCostActivity`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Cloud Cost Enabled 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.CloudCostActivityResponse;

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

    try {
      CloudCostActivityResponse result = apiInstance.getCloudCostActivity();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#getCloudCostActivity");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Cloud Cost Enabled 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_cloud_cost_activity().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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Cloud Cost Enabled returns "OK" response
 */

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

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

apiInstance
  .getCloudCostActivity()
  .then((data: v2.CloudCostActivityResponse) => {
    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.comddog-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.datadoghq.eu/api/v2/cost/custom_costshttps://api.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

概要

List the Custom Costs files.

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

応答

OK

Response for List Custom Costs files.

Expand All

フィールド

種類

説明

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.

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": {
    "total_filtered_count": "integer",
    "version": "string"
  }
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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.comddog-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.comddog-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)

	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.comddog-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.comddog-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;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.list_custom_costs_files().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.comddog-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.comddog-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.datadoghq.eu/api/v2/cost/custom_costshttps://api.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

概要

Upload a Custom Costs file.

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

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

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"
    }
  }
]

応答

Accepted

Response for Uploaded Custom Costs files.

Expand All

フィールド

種類

説明

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"
  }
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                          # Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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 [ { "ProviderName": "my_provider", "ChargePeriodStart": "2023-05-06", "ChargePeriodEnd": "2023-06-06", "ChargeDescription": "my_description", "BilledCost": 250, "BillingCurrency": "USD", "Tags": { "key": "value" } } ] 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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.datadoghq.eu/api/v2/cost/custom_costs/{file_id}https://api.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}

概要

Fetch the specified Custom Costs file.

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

引数

パスパラメーター

名前

種類

説明

file_id [required]

string

File ID.

応答

OK

Response for Get Custom Costs files.

Expand All

フィールド

種類

説明

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

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Path parameters
export file_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.datadoghq.eu/api/v2/cost/custom_costs/{file_id}https://api.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}

概要

Delete the specified Custom Costs file.

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

引数

パスパラメーター

名前

種類

説明

file_id [required]

string

File ID.

応答

No Content

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Path parameters
export file_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"