Skip to content

Commit

Permalink
Regenerate client from commit ba295a2c of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Oct 25, 2024
1 parent 6d5518b commit 50d7db6
Show file tree
Hide file tree
Showing 13 changed files with 1,022 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-24 20:04:20.108446",
"spec_repo_commit": "aaacb8db"
"regenerated": "2024-10-25 15:40:14.231863",
"spec_repo_commit": "ba295a2c"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-24 20:04:20.126796",
"spec_repo_commit": "aaacb8db"
"regenerated": "2024-10-25 15:40:14.250594",
"spec_repo_commit": "ba295a2c"
}
}
}
131 changes: 131 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,73 @@ components:
- storage_account
- storage_container
type: object
BillingDimensionsMappingBody:
description: Billing dimensions mapping data.
items:
$ref: '#/components/schemas/BillingDimensionsMappingBodyItem'
type: array
BillingDimensionsMappingBodyItem:
description: The mapping data for each billing dimension.
properties:
attributes:
$ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributes'
id:
description: ID of the billing dimension.
type: string
type:
$ref: '#/components/schemas/ActiveBillingDimensionsType'
type: object
BillingDimensionsMappingBodyItemAttributes:
description: Mapping of billing dimensions to endpoint keys.
properties:
endpoints:
description: List of supported endpoints with their keys mapped to the billing_dimension.
items:
$ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributesEndpointsItems'
type: array
in_app_label:
description: Label used for the billing dimension in the Plan & Usage charts.
example: APM Hosts
type: string
timestamp:
description: 'Month in ISO-8601 format, UTC, precise to second: `[YYYY-MM-DDThh:mm:ss]`.'
format: date-time
type: string
type: object
BillingDimensionsMappingBodyItemAttributesEndpointsItems:
description: An endpoint's keys mapped to the billing_dimension.
properties:
id:
description: The URL for the endpoint.
example: api/v1/usage/billable-summary
type: string
keys:
description: The billing dimension.
example:
- apm_host_top99p
- apm_host_sum
items:
example: apm_host_top99p
type: string
type: array
status:
$ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus'
type: object
BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus:
description: Denotes whether or not mapping keys were available for this endpoint.
enum:
- OK
- NOT_FOUND
type: string
x-enum-varnames:
- OK
- NOT_FOUND
BillingDimensionsMappingResponse:
description: Billing dimensions mapping response.
properties:
data:
$ref: '#/components/schemas/BillingDimensionsMappingBody'
type: object
BulkMuteFindingsRequest:
description: The new bulk mute finding request.
properties:
Expand Down Expand Up @@ -40070,6 +40137,70 @@ paths:
operator: OR
permissions:
- usage_read
/api/v2/usage/billing_dimension_mapping:
get:
description: 'Get a mapping of billing dimensions to the corresponding keys
for the supported usage metering public API endpoints.

Mapping data is updated on a monthly cadence.


This endpoint is only accessible for [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/).'
operationId: GetBillingDimensionMapping
parameters:
- description: Datetime in ISO-8601 format, UTC, for mappings beginning this
month. Defaults to the current month.
in: query
name: filter[month]
required: false
schema:
format: date-time
type: string
- description: String to specify whether to retrieve active billing dimension
mappings for the contract or all available mappings. Allowed views are `active`
and `all`. Defaults to `active`.
in: query
name: filter[view]
required: false
schema:
default: active
type: string
responses:
'200':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/BillingDimensionsMappingResponse'
description: OK
'400':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden - User is not authorized
'429':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Too many requests
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- usage_read
summary: Get billing dimension mapping for usage endpoints
tags:
- Usage Metering
x-unstable: '**Note**: This endpoint is in Preview.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/usage/cost_by_org:
get:
deprecated: true
Expand Down
1 change: 1 addition & 0 deletions api/datadog/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ func NewConfiguration() *Configuration {
"v2.ListAPIs": false,
"v2.UpdateOpenAPI": false,
"v2.GetActiveBillingDimensions": false,
"v2.GetBillingDimensionMapping": false,
"v2.GetMonthlyCostAttribution": false,
"v2.CreateDORADeployment": false,
"v2.CreateDORAIncident": false,
Expand Down
118 changes: 118 additions & 0 deletions api/datadogV2/api_usage_metering.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,124 @@ func (a *UsageMeteringApi) GetActiveBillingDimensions(ctx _context.Context) (Act
return localVarReturnValue, localVarHTTPResponse, nil
}

// GetBillingDimensionMappingOptionalParameters holds optional parameters for GetBillingDimensionMapping.
type GetBillingDimensionMappingOptionalParameters struct {
FilterMonth *time.Time
FilterView *string
}

// NewGetBillingDimensionMappingOptionalParameters creates an empty struct for parameters.
func NewGetBillingDimensionMappingOptionalParameters() *GetBillingDimensionMappingOptionalParameters {
this := GetBillingDimensionMappingOptionalParameters{}
return &this
}

// WithFilterMonth sets the corresponding parameter name and returns the struct.
func (r *GetBillingDimensionMappingOptionalParameters) WithFilterMonth(filterMonth time.Time) *GetBillingDimensionMappingOptionalParameters {
r.FilterMonth = &filterMonth
return r
}

// WithFilterView sets the corresponding parameter name and returns the struct.
func (r *GetBillingDimensionMappingOptionalParameters) WithFilterView(filterView string) *GetBillingDimensionMappingOptionalParameters {
r.FilterView = &filterView
return r
}

// GetBillingDimensionMapping Get billing dimension mapping for usage endpoints.
// Get a mapping of billing dimensions to the corresponding keys for the supported usage metering public API endpoints.
// Mapping data is updated on a monthly cadence.
//
// This endpoint is only accessible for [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/).
func (a *UsageMeteringApi) GetBillingDimensionMapping(ctx _context.Context, o ...GetBillingDimensionMappingOptionalParameters) (BillingDimensionsMappingResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarReturnValue BillingDimensionsMappingResponse
optionalParams GetBillingDimensionMappingOptionalParameters
)

if len(o) > 1 {
return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetBillingDimensionMappingOptionalParameters is allowed")
}
if len(o) == 1 {
optionalParams = o[0]
}

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

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

localVarPath := localBasePath + "/api/v2/usage/billing_dimension_mapping"

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if optionalParams.FilterMonth != nil {
localVarQueryParams.Add("filter[month]", datadog.ParameterToString(*optionalParams.FilterMonth, ""))
}
if optionalParams.FilterView != nil {
localVarQueryParams.Add("filter[view]", datadog.ParameterToString(*optionalParams.FilterView, ""))
}
localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339"

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
}

// GetCostByOrgOptionalParameters holds optional parameters for GetCostByOrg.
type GetCostByOrgOptionalParameters struct {
EndMonth *time.Time
Expand Down
1 change: 1 addition & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
// - [TeamsApi.UpdateTeamMembership]
// - [TeamsApi.UpdateTeamPermissionSetting]
// - [UsageMeteringApi.GetActiveBillingDimensions]
// - [UsageMeteringApi.GetBillingDimensionMapping]
// - [UsageMeteringApi.GetCostByOrg]
// - [UsageMeteringApi.GetEstimatedCostByOrg]
// - [UsageMeteringApi.GetHistoricalCostByOrg]
Expand Down
Loading

0 comments on commit 50d7db6

Please sign in to comment.