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
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": "2023-11-16 17:18:50.463919",
"spec_repo_commit": "0e97d7dd"
"regenerated": "2023-11-16 18:34:28.089542",
"spec_repo_commit": "973bd612"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-11-16 17:18:50.487034",
"spec_repo_commit": "0e97d7dd"
"regenerated": "2023-11-16 18:34:28.104136",
"spec_repo_commit": "973bd612"
}
}
}
82 changes: 82 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,47 @@ components:
type: string
x-enum-varnames:
- API_KEYS
ActiveBillingDimensionsAttributes:
description: List of active billing dimensions.
properties:
month:
description: 'Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]`.'
format: date-time
type: string
values:
description: 'List of active billing dimensions. Example: `[infra_host,
apm_host, serverless_infra]`.'
items:
description: A given billing dimension in a list.
example: infra_host
type: string
type: array
type: object
ActiveBillingDimensionsBody:
description: Active billing dimensions data.
properties:
attributes:
$ref: '#/components/schemas/ActiveBillingDimensionsAttributes'
id:
description: Unique ID of the response.
type: string
type:
$ref: '#/components/schemas/ActiveBillingDimensionsType'
type: object
ActiveBillingDimensionsResponse:
description: Active billing dimensions response.
properties:
data:
$ref: '#/components/schemas/ActiveBillingDimensionsBody'
type: object
ActiveBillingDimensionsType:
default: billing_dimensions
description: Type of active billing dimensions data.
enum:
- billing_dimensions
type: string
x-enum-varnames:
- BILLING_DIMENSIONS
ApmRetentionFilterType:
default: apm_retention_filter
description: The type of the resource.
Expand Down Expand Up @@ -20823,6 +20864,47 @@ paths:
resultsPath: data
x-unstable: '**Note**: This endpoint is in public beta.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/cost_by_tag/active_billing_dimensions:
get:
description: Get active billing dimensions for cost attribution. Cost data for
a given month becomes available no later than the 17th of the following month.
operationId: GetActiveBillingDimensions
responses:
'200':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/ActiveBillingDimensionsResponse'
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 active billing dimensions for cost attribution
tags:
- Usage Metering
x-unstable: '**Note**: This endpoint is in public beta.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/current_user/application_keys:
get:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-11-16T16:03:39.691Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions examples/v2/usage-metering/GetActiveBillingDimensions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Get active billing dimensions for cost attribution returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.get_active_billing_dimensions".to_sym] = true
end
api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new
p api_instance.get_active_billing_dimensions()
82 changes: 41 additions & 41 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,47 @@
"page_size" => "Integer",
"page_cursor" => "String",
},
"v2.GetUsageApplicationSecurityMonitoring" => {
"start_hr" => "Time",
"end_hr" => "Time",
},
"v2.GetCostByOrg" => {
"start_month" => "Time",
"end_month" => "Time",
},
"v2.GetEstimatedCostByOrg" => {
"view" => "String",
"start_month" => "Time",
"end_month" => "Time",
"start_date" => "Time",
"end_date" => "Time",
},
"v2.GetHistoricalCostByOrg" => {
"view" => "String",
"start_month" => "Time",
"end_month" => "Time",
},
"v2.GetHourlyUsage" => {
"filter_timestamp_start" => "Time",
"filter_timestamp_end" => "Time",
"filter_product_families" => "String",
"filter_include_descendants" => "Boolean",
"filter_include_breakdown" => "Boolean",
"filter_versions" => "String",
"page_limit" => "Integer",
"page_next_record_id" => "String",
},
"v2.GetUsageLambdaTracedInvocations" => {
"start_hr" => "Time",
"end_hr" => "Time",
},
"v2.GetUsageObservabilityPipelines" => {
"start_hr" => "Time",
"end_hr" => "Time",
},
"v2.GetProjectedCost" => {
"view" => "String",
},
"v2.DeleteDashboardListItems" => {
"dashboard_list_id" => "Integer",
"body" => "DashboardListDeleteItemsRequest",
Expand Down Expand Up @@ -1793,47 +1834,6 @@
"team_id" => "String",
"body" => "IncidentTeamUpdateRequest",
},
"v2.GetUsageApplicationSecurityMonitoring" => {
"start_hr" => "Time",
"end_hr" => "Time",
},
"v2.GetCostByOrg" => {
"start_month" => "Time",
"end_month" => "Time",
},
"v2.GetEstimatedCostByOrg" => {
"view" => "String",
"start_month" => "Time",
"end_month" => "Time",
"start_date" => "Time",
"end_date" => "Time",
},
"v2.GetHistoricalCostByOrg" => {
"view" => "String",
"start_month" => "Time",
"end_month" => "Time",
},
"v2.GetHourlyUsage" => {
"filter_timestamp_start" => "Time",
"filter_timestamp_end" => "Time",
"filter_product_families" => "String",
"filter_include_descendants" => "Boolean",
"filter_include_breakdown" => "Boolean",
"filter_versions" => "String",
"page_limit" => "Integer",
"page_next_record_id" => "String",
},
"v2.GetUsageLambdaTracedInvocations" => {
"start_hr" => "Time",
"end_hr" => "Time",
},
"v2.GetUsageObservabilityPipelines" => {
"start_hr" => "Time",
"end_hr" => "Time",
},
"v2.GetProjectedCost" => {
"view" => "String",
},
"v2.SendInvitations" => {
"body" => "UserInvitationsRequest",
},
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@
"type": "safe"
}
},
"GetActiveBillingDimensions": {
"tag": "Usage Metering",
"undo": {
"type": "safe"
}
},
"ListCurrentUserApplicationKeys": {
"tag": "Key Management",
"undo": {
Expand Down
14 changes: 14 additions & 0 deletions features/v2/usage_metering.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ Feature: Usage Metering
And a valid "appKeyAuth" key in the system
And an instance of "UsageMetering" API

@generated @skip @team:DataDog/red-zone-revenue-query
Scenario: Get active billing dimensions for cost attribution returns "Bad Request" response
Given operation "GetActiveBillingDimensions" enabled
And new "GetActiveBillingDimensions" request
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/red-zone-revenue-query
Scenario: Get active billing dimensions for cost attribution returns "OK" response
Given operation "GetActiveBillingDimensions" enabled
And new "GetActiveBillingDimensions" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/red-zone-revenue-query
Scenario: Get cost across multi-org account returns "Bad Request" response
Given new "GetCostByOrg" request
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def initialize
"v2.create_ci_app_pipeline_event": false,
"v2.list_container_images": false,
"v2.list_containers": false,
"v2.get_active_billing_dimensions": false,
"v2.list_events": false,
"v2.search_events": false,
"v2.create_incident": false,
Expand Down
4 changes: 4 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,10 @@ def overrides
"v1.widget_vertical_align" => "WidgetVerticalAlign",
"v1.widget_view_mode" => "WidgetViewMode",
"v1.widget_viz_type" => "WidgetVizType",
"v2.active_billing_dimensions_attributes" => "ActiveBillingDimensionsAttributes",
"v2.active_billing_dimensions_body" => "ActiveBillingDimensionsBody",
"v2.active_billing_dimensions_response" => "ActiveBillingDimensionsResponse",
"v2.active_billing_dimensions_type" => "ActiveBillingDimensionsType",
"v2.api_error_response" => "APIErrorResponse",
"v2.api_key_create_attributes" => "APIKeyCreateAttributes",
"v2.api_key_create_data" => "APIKeyCreateData",
Expand Down
66 changes: 66 additions & 0 deletions lib/datadog_api_client/v2/api/usage_metering_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,72 @@ def initialize(api_client = DatadogAPIClient::APIClient.default)
@api_client = api_client
end

# Get active billing dimensions for cost attribution.
#
# @see #get_active_billing_dimensions_with_http_info
def get_active_billing_dimensions(opts = {})
data, _status_code, _headers = get_active_billing_dimensions_with_http_info(opts)
data
end

# Get active billing dimensions for cost attribution.
#
# Get active billing dimensions for cost attribution. Cost data for a given month becomes available no later than the 17th of the following month.
#
# @param opts [Hash] the optional parameters
# @return [Array<(ActiveBillingDimensionsResponse, Integer, Hash)>] ActiveBillingDimensionsResponse data, response status code and response headers
def get_active_billing_dimensions_with_http_info(opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.get_active_billing_dimensions".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_active_billing_dimensions")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_active_billing_dimensions"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_active_billing_dimensions ...'
end
# resource path
local_var_path = '/api/v2/cost_by_tag/active_billing_dimensions'

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json;datetime-format=rfc3339'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body]

# return_type
return_type = opts[:debug_return_type] || 'ActiveBillingDimensionsResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

new_options = opts.merge(
:operation => :get_active_billing_dimensions,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: UsageMeteringAPI#get_active_billing_dimensions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get cost across multi-org account.
#
# @see #get_cost_by_org_with_http_info
Expand Down
Loading