Skip to content

Commit e5fa307

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Documentation for beta /v2/usage/billing_dimension_mapping (#1806)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 82aaf40 commit e5fa307

File tree

17 files changed

+701
-4
lines changed

17 files changed

+701
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-10-31 15:33:09.830606",
8-
"spec_repo_commit": "a7602fa1"
7+
"regenerated": "2024-10-31 16:03:59.641141",
8+
"spec_repo_commit": "a11da7b5"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-31 15:33:09.849847",
13-
"spec_repo_commit": "a7602fa1"
12+
"regenerated": "2024-10-31 16:03:59.659376",
13+
"spec_repo_commit": "a11da7b5"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,6 +2186,74 @@ components:
21862186
- storage_account
21872187
- storage_container
21882188
type: object
2189+
BillingDimensionsMappingBody:
2190+
description: Billing dimensions mapping data.
2191+
items:
2192+
$ref: '#/components/schemas/BillingDimensionsMappingBodyItem'
2193+
type: array
2194+
BillingDimensionsMappingBodyItem:
2195+
description: The mapping data for each billing dimension.
2196+
properties:
2197+
attributes:
2198+
$ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributes'
2199+
id:
2200+
description: ID of the billing dimension.
2201+
type: string
2202+
type:
2203+
$ref: '#/components/schemas/ActiveBillingDimensionsType'
2204+
type: object
2205+
BillingDimensionsMappingBodyItemAttributes:
2206+
description: Mapping of billing dimensions to endpoint keys.
2207+
properties:
2208+
endpoints:
2209+
description: List of supported endpoints with their keys mapped to the billing_dimension.
2210+
items:
2211+
$ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributesEndpointsItems'
2212+
type: array
2213+
in_app_label:
2214+
description: Label used for the billing dimension in the Plan & Usage charts.
2215+
example: APM Hosts
2216+
type: string
2217+
timestamp:
2218+
description: 'Month in ISO-8601 format, UTC, and precise to the second:
2219+
`[YYYY-MM-DDThh:mm:ss]`.'
2220+
format: date-time
2221+
type: string
2222+
type: object
2223+
BillingDimensionsMappingBodyItemAttributesEndpointsItems:
2224+
description: An endpoint's keys mapped to the billing_dimension.
2225+
properties:
2226+
id:
2227+
description: The URL for the endpoint.
2228+
example: api/v1/usage/billable-summary
2229+
type: string
2230+
keys:
2231+
description: The billing dimension.
2232+
example:
2233+
- apm_host_top99p
2234+
- apm_host_sum
2235+
items:
2236+
example: apm_host_top99p
2237+
type: string
2238+
type: array
2239+
status:
2240+
$ref: '#/components/schemas/BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus'
2241+
type: object
2242+
BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus:
2243+
description: Denotes whether mapping keys were available for this endpoint.
2244+
enum:
2245+
- OK
2246+
- NOT_FOUND
2247+
type: string
2248+
x-enum-varnames:
2249+
- OK
2250+
- NOT_FOUND
2251+
BillingDimensionsMappingResponse:
2252+
description: Billing dimensions mapping response.
2253+
properties:
2254+
data:
2255+
$ref: '#/components/schemas/BillingDimensionsMappingBody'
2256+
type: object
21892257
BulkMuteFindingsRequest:
21902258
description: The new bulk mute finding request.
21912259
properties:
@@ -41037,6 +41105,70 @@ paths:
4103741105
operator: OR
4103841106
permissions:
4103941107
- usage_read
41108+
/api/v2/usage/billing_dimension_mapping:
41109+
get:
41110+
description: 'Get a mapping of billing dimensions to the corresponding keys
41111+
for the supported usage metering public API endpoints.
41112+
41113+
Mapping data is updated on a monthly cadence.
41114+
41115+
41116+
This endpoint is only accessible to [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/).'
41117+
operationId: GetBillingDimensionMapping
41118+
parameters:
41119+
- description: Datetime in ISO-8601 format, UTC, and for mappings beginning
41120+
this month. Defaults to the current month.
41121+
in: query
41122+
name: filter[month]
41123+
required: false
41124+
schema:
41125+
format: date-time
41126+
type: string
41127+
- description: String to specify whether to retrieve active billing dimension
41128+
mappings for the contract or for all available mappings. Allowed views have
41129+
the string `active` or `all`. Defaults to `active`.
41130+
in: query
41131+
name: filter[view]
41132+
required: false
41133+
schema:
41134+
default: active
41135+
type: string
41136+
responses:
41137+
'200':
41138+
content:
41139+
application/json;datetime-format=rfc3339:
41140+
schema:
41141+
$ref: '#/components/schemas/BillingDimensionsMappingResponse'
41142+
description: OK
41143+
'400':
41144+
content:
41145+
application/json;datetime-format=rfc3339:
41146+
schema:
41147+
$ref: '#/components/schemas/APIErrorResponse'
41148+
description: Bad Request
41149+
'403':
41150+
content:
41151+
application/json;datetime-format=rfc3339:
41152+
schema:
41153+
$ref: '#/components/schemas/APIErrorResponse'
41154+
description: Forbidden - User is not authorized
41155+
'429':
41156+
content:
41157+
application/json;datetime-format=rfc3339:
41158+
schema:
41159+
$ref: '#/components/schemas/APIErrorResponse'
41160+
description: Too many requests
41161+
security:
41162+
- apiKeyAuth: []
41163+
appKeyAuth: []
41164+
- AuthZ:
41165+
- usage_read
41166+
summary: Get billing dimension mapping for usage endpoints
41167+
tags:
41168+
- Usage Metering
41169+
x-unstable: '**Note**: This endpoint is in Preview.
41170+
41171+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
4104041172
/api/v2/usage/cost_by_org:
4104141173
get:
4104241174
deprecated: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2024-10-28T16:04:40.774Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"log": {
3+
"_recordingName": "Usage Metering/Get billing dimension mapping for usage endpoints returns \"Bad Request\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "49fc3efb4f23bbdeb855c3d4aa87f91c",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 0,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json;datetime-format=rfc3339"
22+
}
23+
],
24+
"headersSize": 562,
25+
"httpVersion": "HTTP/1.1",
26+
"method": "GET",
27+
"queryString": [],
28+
"url": "https://api.datadoghq.com/api/v2/usage/billing_dimension_mapping"
29+
},
30+
"response": {
31+
"bodySize": 205,
32+
"content": {
33+
"mimeType": "application/vnd.api+json",
34+
"size": 205,
35+
"text": "{\"errors\":[{\"id\":null,\"links\":null,\"status\":\"400\",\"code\":null,\"title\":\"Bad Request\",\"detail\":\"API called with non-parent org keys. Data is only available at the root level org\",\"source\":null,\"meta\":null}]}"
36+
},
37+
"cookies": [],
38+
"headers": [
39+
{
40+
"name": "content-type",
41+
"value": "application/vnd.api+json"
42+
}
43+
],
44+
"headersSize": 358,
45+
"httpVersion": "HTTP/1.1",
46+
"redirectURL": "",
47+
"status": 400,
48+
"statusText": "Bad Request"
49+
},
50+
"startedDateTime": "2024-10-28T16:04:40.783Z",
51+
"time": 526
52+
}
53+
],
54+
"pages": [],
55+
"version": "1.2"
56+
}
57+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Get billing dimension mapping for usage endpoints returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.getBillingDimensionMapping"] = true;
9+
const apiInstance = new v2.UsageMeteringApi(configuration);
10+
11+
apiInstance
12+
.getBillingDimensionMapping()
13+
.then((data: v2.BillingDimensionsMappingResponse) => {
14+
console.log(
15+
"API called successfully. Returned data: " + JSON.stringify(data)
16+
);
17+
})
18+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3183,6 +3183,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
31833183
},
31843184
"operationResponseType": "UsageApplicationSecurityMonitoringResponse",
31853185
},
3186+
"v2.GetBillingDimensionMapping": {
3187+
"filterMonth": {
3188+
"type": "Date",
3189+
"format": "date-time",
3190+
},
3191+
"filterView": {
3192+
"type": "string",
3193+
"format": "",
3194+
},
3195+
"operationResponseType": "BillingDimensionsMappingResponse",
3196+
},
31863197
"v2.GetCostByOrg": {
31873198
"startMonth": {
31883199
"type": "Date",

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,6 +2494,12 @@
24942494
"type": "safe"
24952495
}
24962496
},
2497+
"GetBillingDimensionMapping": {
2498+
"tag": "Usage Metering",
2499+
"undo": {
2500+
"type": "safe"
2501+
}
2502+
},
24972503
"GetCostByOrg": {
24982504
"tag": "Usage Metering",
24992505
"undo": {

features/v2/usage_metering.feature

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ Feature: Usage Metering
4848
When the request is sent
4949
Then the response status is 200 OK
5050

51+
@team:DataDog/revenue-query
52+
Scenario: Get billing dimension mapping for usage endpoints returns "Bad Request" response
53+
Given operation "GetBillingDimensionMapping" enabled
54+
And new "GetBillingDimensionMapping" request
55+
When the request is sent
56+
Then the response status is 400 Bad Request
57+
58+
@skip @team:DataDog/revenue-query
59+
Scenario: Get billing dimension mapping for usage endpoints returns "OK" response
60+
Given operation "GetBillingDimensionMapping" enabled
61+
And new "GetBillingDimensionMapping" request
62+
When the request is sent
63+
Then the response status is 200 OK
64+
5165
@generated @skip @team:DataDog/revenue-query
5266
Scenario: Get cost across multi-org account returns "Bad Request" response
5367
Given new "GetCostByOrg" request

packages/datadog-api-client-common/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ export function createConfiguration(
228228
"v2.listAPIs": false,
229229
"v2.updateOpenAPI": false,
230230
"v2.getActiveBillingDimensions": false,
231+
"v2.getBillingDimensionMapping": false,
231232
"v2.getMonthlyCostAttribution": false,
232233
"v2.createDORADeployment": false,
233234
"v2.createDORAIncident": false,

0 commit comments

Comments
 (0)