Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19897,6 +19897,45 @@ components:
x-enum-varnames:
- "TRUE"
- "FALSE"
CostTagMetadataMonth:
description: A month that has Cloud Cost Management tag metadata available for a given provider.
properties:
id:
description: The month, in `YYYY-MM` format.
example: "2026-04"
type: string
type:
$ref: "#/components/schemas/CostTagMetadataMonthType"
required:
- id
- type
type: object
CostTagMetadataMonthType:
default: cost_tag_metadata_month
description: Type of the Cloud Cost Management tag metadata month resource.
enum:
- cost_tag_metadata_month
example: cost_tag_metadata_month
type: string
x-enum-varnames:
- COST_TAG_METADATA_MONTH
CostTagMetadataMonthsResponse:
description: List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months.
example:
data:
- id: "2026-04"
type: cost_tag_metadata_month
- id: "2026-03"
type: cost_tag_metadata_month
properties:
data:
description: List of months that have tag metadata available.
items:
$ref: "#/components/schemas/CostTagMetadataMonth"
type: array
required:
- data
type: object
CostTagType:
default: cost_tag
description: Type of the Cloud Cost Management tag resource.
Expand Down Expand Up @@ -111135,6 +111174,68 @@ paths:
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/cost/tag_metadata/months:
get:
description: |-
List months that have Cloud Cost Management tag metadata for a given provider,
ordered most-recent first. The response is capped at 36 months.
operationId: ListCostTagMetadataMonths
parameters:
- description: |-
Provider to scope the query to. Use the value of the `providername` tag in CCM
(for example, `aws`, `azure`, `gcp`, `Oracle`, `Confluent Cloud`, `Snowflake`).
For costs uploaded through the Custom Costs API, use `custom`.
Values are case-sensitive.
example: aws
in: query
name: filter[provider]
required: true
schema:
type: string
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
- id: "2026-04"
type: cost_tag_metadata_month
- id: "2026-03"
type: cost_tag_metadata_month
schema:
$ref: "#/components/schemas/CostTagMetadataMonthsResponse"
description: OK
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/APIErrorResponse"
description: Bad Request
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/APIErrorResponse"
description: Forbidden
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- cloud_cost_management_read
summary: List Cloud Cost Management tag metadata months
tags:
- Cloud Cost Management
"x-permission":
operator: OR
permissions:
- cloud_cost_management_read
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/cost/tag_metadata/orchestrators:
get:
description: List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period.
Expand Down
16 changes: 16 additions & 0 deletions features/v2/cloud_cost_management.feature
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,22 @@ Feature: Cloud Cost Management
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/cloud-cost-management
Scenario: List Cloud Cost Management tag metadata months returns "Bad Request" response
Given operation "ListCostTagMetadataMonths" enabled
And new "ListCostTagMetadataMonths" request
And request contains "filter[provider]" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/cloud-cost-management
Scenario: List Cloud Cost Management tag metadata months returns "OK" response
Given operation "ListCostTagMetadataMonths" enabled
And new "ListCostTagMetadataMonths" request
And request contains "filter[provider]" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/cloud-cost-management
Scenario: List Cloud Cost Management tag sources returns "Bad Request" response
Given operation "ListCostTagKeySources" enabled
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,12 @@
"type": "safe"
}
},
"ListCostTagMetadataMonths": {
"tag": "Cloud Cost Management",
"undo": {
"type": "safe"
}
},
"ListCostTagMetadataOrchestrators": {
"tag": "Cloud Cost Management",
"undo": {
Expand Down
7 changes: 7 additions & 0 deletions private/bdd_runner/src/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7515,6 +7515,13 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
},
operationResponseType: "CostMetricsResponse",
},
"CloudCostManagementApi.V2.ListCostTagMetadataMonths": {
filterProvider: {
type: "string",
format: "",
},
operationResponseType: "CostTagMetadataMonthsResponse",
},
"CloudCostManagementApi.V2.ListCostTagMetadataOrchestrators": {
filterMonth: {
type: "string",
Expand Down
157 changes: 157 additions & 0 deletions services/cloud_cost_management/src/v2/CloudCostManagementApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import { CostTagKeyResponse } from "./models/CostTagKeyResponse";
import { CostTagKeySourcesResponse } from "./models/CostTagKeySourcesResponse";
import { CostTagKeysResponse } from "./models/CostTagKeysResponse";
import { CostTagMetadataDailyFilter } from "./models/CostTagMetadataDailyFilter";
import { CostTagMetadataMonthsResponse } from "./models/CostTagMetadataMonthsResponse";
import { CostTagsResponse } from "./models/CostTagsResponse";
import { CreateRulesetRequest } from "./models/CreateRulesetRequest";
import { CustomCostsFileGetResponse } from "./models/CustomCostsFileGetResponse";
Expand Down Expand Up @@ -2709,6 +2710,67 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory
return requestContext;
}

public async listCostTagMetadataMonths(
filterProvider: string,
_options?: Configuration,
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations[
"CloudCostManagementApi.v2.listCostTagMetadataMonths"
]
) {
throw new Error(
"Unstable operation 'listCostTagMetadataMonths' is disabled. Enable it by setting `configuration.unstableOperations['CloudCostManagementApi.v2.listCostTagMetadataMonths'] = true`",
);
}

// verify required parameter 'filterProvider' is not null or undefined
if (filterProvider === null || filterProvider === undefined) {
throw new RequiredError("filterProvider", "listCostTagMetadataMonths");
}

// Path Params
const localVarPath = "/api/v2/cost/tag_metadata/months";

// Make Request Context
const { server, overrides } = _config.getServerAndOverrides(
"CloudCostManagementApi.v2.listCostTagMetadataMonths",
CloudCostManagementApi.operationServers,
);
const requestContext = server.makeRequestContext(
localVarPath,
HttpMethod.GET,
overrides,
);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);

// Set User-Agent
if (this.userAgent) {
requestContext.setHeaderParam("User-Agent", this.userAgent);
}

// Query Params
if (filterProvider !== undefined) {
requestContext.setQueryParam(
"filter[provider]",
serialize(filterProvider, TypingInfo, "string", ""),
"",
);
}

// Apply auth methods
applySecurityAuthentication(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
"AuthZ",
]);

return requestContext;
}

public async listCostTagMetadataOrchestrators(
filterMonth: string,
filterProvider?: string,
Expand Down Expand Up @@ -6253,6 +6315,66 @@ export class CloudCostManagementApiResponseProcessor {
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to listCostTagMetadataMonths
* @throws ApiException if the response code was not in [200, 299]
*/
public async listCostTagMetadataMonths(
response: ResponseContext,
): Promise<CostTagMetadataMonthsResponse> {
const contentType = normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body: CostTagMetadataMonthsResponse = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"CostTagMetadataMonthsResponse",
) as CostTagMetadataMonthsResponse;
return body;
}
if (
response.httpStatusCode === 400 ||
response.httpStatusCode === 403 ||
response.httpStatusCode === 429
) {
const bodyText = parse(await response.body.text(), contentType);
let body: APIErrorResponse;
try {
body = deserialize(
bodyText,
TypingInfo,
"APIErrorResponse",
) as APIErrorResponse;
} catch (error) {
logger.debug(`Got error deserializing error: ${error}`);
throw new ApiException<APIErrorResponse>(
response.httpStatusCode,
bodyText,
);
}
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: CostTagMetadataMonthsResponse = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"CostTagMetadataMonthsResponse",
"",
) as CostTagMetadataMonthsResponse;
return body;
}

const body = (await response.body.text()) || "";
throw new ApiException<string>(
response.httpStatusCode,
'Unknown API Status Code!\nBody: "' + body + '"',
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down Expand Up @@ -7944,6 +8066,17 @@ export interface CloudCostManagementApiListCostTagMetadataMetricsRequest {
filterProvider?: string;
}

export interface CloudCostManagementApiListCostTagMetadataMonthsRequest {
/**
* Provider to scope the query to. Use the value of the `providername` tag in CCM
* (for example, `aws`, `azure`, `gcp`, `Oracle`, `Confluent Cloud`, `Snowflake`).
* For costs uploaded through the Custom Costs API, use `custom`.
* Values are case-sensitive.
* @type string
*/
filterProvider: string;
}

export interface CloudCostManagementApiListCostTagMetadataOrchestratorsRequest {
/**
* The month to scope the query to, in `YYYY-MM` format.
Expand Down Expand Up @@ -9116,6 +9249,30 @@ export class CloudCostManagementApi {
});
}

/**
* List months that have Cloud Cost Management tag metadata for a given provider,
* ordered most-recent first. The response is capped at 36 months.
* @param param The request object
*/
public listCostTagMetadataMonths(
param: CloudCostManagementApiListCostTagMetadataMonthsRequest,
options?: Configuration,
): Promise<CostTagMetadataMonthsResponse> {
const requestContextPromise = this.requestFactory.listCostTagMetadataMonths(
param.filterProvider,
options,
);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.listCostTagMetadataMonths(
responseContext,
);
});
});
}

/**
* List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period.
* @param param The request object
Expand Down
4 changes: 4 additions & 0 deletions services/cloud_cost_management/src/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export {
CloudCostManagementApiListCostTagKeysRequest,
CloudCostManagementApiListCostTagMetadataRequest,
CloudCostManagementApiListCostTagMetadataMetricsRequest,
CloudCostManagementApiListCostTagMetadataMonthsRequest,
CloudCostManagementApiListCostTagMetadataOrchestratorsRequest,
CloudCostManagementApiListCostTagsRequest,
CloudCostManagementApiListCustomCostsFilesRequest,
Expand Down Expand Up @@ -200,6 +201,9 @@ export { CostTagKeySourceType } from "./models/CostTagKeySourceType";
export { CostTagKeysResponse } from "./models/CostTagKeysResponse";
export { CostTagKeyType } from "./models/CostTagKeyType";
export { CostTagMetadataDailyFilter } from "./models/CostTagMetadataDailyFilter";
export { CostTagMetadataMonth } from "./models/CostTagMetadataMonth";
export { CostTagMetadataMonthsResponse } from "./models/CostTagMetadataMonthsResponse";
export { CostTagMetadataMonthType } from "./models/CostTagMetadataMonthType";
export { CostTagsResponse } from "./models/CostTagsResponse";
export { CostTagType } from "./models/CostTagType";
export { CreateRulesetRequest } from "./models/CreateRulesetRequest";
Expand Down
Loading
Loading