Skip to content
Merged
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
1 change: 1 addition & 0 deletions api/datadog/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ func NewConfiguration() *Configuration {
"v2.ListCostTagKeySources": false,
"v2.ListCostTagMetadata": false,
"v2.ListCostTagMetadataMetrics": false,
"v2.ListCostTagMetadataMonths": false,
"v2.ListCostTagMetadataOrchestrators": false,
"v2.SearchCostRecommendations": false,
"v2.CreateDashboardSecureEmbed": false,
Expand Down
88 changes: 88 additions & 0 deletions api/datadogV2/api_cloud_cost_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -4026,6 +4026,94 @@ func (a *CloudCostManagementApi) ListCostTagMetadataMetrics(ctx _context.Context
return localVarReturnValue, localVarHTTPResponse, nil
}

// ListCostTagMetadataMonths List Cloud Cost Management tag metadata months.
// List months that have Cloud Cost Management tag metadata for a given provider,
// ordered most-recent first. The response is capped at 36 months.
func (a *CloudCostManagementApi) ListCostTagMetadataMonths(ctx _context.Context, filterProvider string) (CostTagMetadataMonthsResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarReturnValue CostTagMetadataMonthsResponse
)

operationId := "v2.ListCostTagMetadataMonths"
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
if !isOperationEnabled {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
}
if isOperationEnabled && a.Client.Cfg.Debug {
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
}

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CloudCostManagementApi.ListCostTagMetadataMonths")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/cost/tag_metadata/months"

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarQueryParams.Add("filter[provider]", datadog.ParameterToString(filterProvider, ""))
localVarHeaderParams["Accept"] = "application/json"

if a.Client.Cfg.DelegatedTokenConfig != nil {
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
if err != nil {
return localVarReturnValue, nil, err
}
} else {
datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
}
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

// ListCostTagMetadataOrchestratorsOptionalParameters holds optional parameters for ListCostTagMetadataOrchestrators.
type ListCostTagMetadataOrchestratorsOptionalParameters struct {
FilterProvider *string
Expand Down
1 change: 1 addition & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
// - [CloudCostManagementApi.ListCostTagKeys]
// - [CloudCostManagementApi.ListCostTagMetadata]
// - [CloudCostManagementApi.ListCostTagMetadataMetrics]
// - [CloudCostManagementApi.ListCostTagMetadataMonths]
// - [CloudCostManagementApi.ListCostTagMetadataOrchestrators]
// - [CloudCostManagementApi.ListCostTags]
// - [CloudCostManagementApi.ListCustomAllocationRules]
Expand Down
145 changes: 145 additions & 0 deletions api/datadogV2/model_cost_tag_metadata_month.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"fmt"

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

// CostTagMetadataMonth A month that has Cloud Cost Management tag metadata available for a given provider.
type CostTagMetadataMonth struct {
// The month, in `YYYY-MM` format.
Id string `json:"id"`
// Type of the Cloud Cost Management tag metadata month resource.
Type CostTagMetadataMonthType `json:"type"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewCostTagMetadataMonth instantiates a new CostTagMetadataMonth object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewCostTagMetadataMonth(id string, typeVar CostTagMetadataMonthType) *CostTagMetadataMonth {
this := CostTagMetadataMonth{}
this.Id = id
this.Type = typeVar
return &this
}

// NewCostTagMetadataMonthWithDefaults instantiates a new CostTagMetadataMonth object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewCostTagMetadataMonthWithDefaults() *CostTagMetadataMonth {
this := CostTagMetadataMonth{}
var typeVar CostTagMetadataMonthType = COSTTAGMETADATAMONTHTYPE_COST_TAG_METADATA_MONTH
this.Type = typeVar
return &this
}

// GetId returns the Id field value.
func (o *CostTagMetadataMonth) GetId() string {
if o == nil {
var ret string
return ret
}
return o.Id
}

// GetIdOk returns a tuple with the Id field value
// and a boolean to check if the value has been set.
func (o *CostTagMetadataMonth) GetIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Id, true
}

// SetId sets field value.
func (o *CostTagMetadataMonth) SetId(v string) {
o.Id = v
}

// GetType returns the Type field value.
func (o *CostTagMetadataMonth) GetType() CostTagMetadataMonthType {
if o == nil {
var ret CostTagMetadataMonthType
return ret
}
return o.Type
}

// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *CostTagMetadataMonth) GetTypeOk() (*CostTagMetadataMonthType, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}

// SetType sets field value.
func (o *CostTagMetadataMonth) SetType(v CostTagMetadataMonthType) {
o.Type = v
}

// MarshalJSON serializes the struct using spec logic.
func (o CostTagMetadataMonth) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["id"] = o.Id
toSerialize["type"] = o.Type

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *CostTagMetadataMonth) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Id *string `json:"id"`
Type *CostTagMetadataMonthType `json:"type"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Id == nil {
return fmt.Errorf("required field id missing")
}
if all.Type == nil {
return fmt.Errorf("required field type missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"})
} else {
return err
}

hasInvalidField := false
o.Id = *all.Id
if !all.Type.IsValid() {
hasInvalidField = true
} else {
o.Type = *all.Type
}

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
Loading
Loading