Skip to content

Commit 436b6f2

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Clarify additionalProperties note is SDK-only; add per-language access patterns (#1716)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 2daea0f commit 436b6f2

7 files changed

Lines changed: 141 additions & 39 deletions

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22813,10 +22813,11 @@ components:
2281322813
description: |-
2281422814
Response with hourly report of all data billed by Datadog for all organizations.
2281522815

22816-
Newly added billing dimensions and usage types appear as untyped keys on the
22817-
`additionalProperties` map instead of as typed fields. Call
22818-
`GET /api/v2/usage/summary/available_fields` to enumerate every key returned
22819-
at this response level—both typed fields and `additionalProperties` keys.
22816+
For SDK users only: all fields at this response level are accessible through the
22817+
`additionalProperties` map. Existing typed-field getters are unchanged. New billing
22818+
dimensions will not have typed-field getters. Use
22819+
[Get available fields for usage summary](https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields)
22820+
to enumerate every available key.
2282022821
properties:
2282122822
agent_host_top99p:
2282222823
description: Shows the 99th percentile of all agent hosts over all hours in the current date for all organizations.
@@ -24115,10 +24116,11 @@ components:
2411524116
description: |-
2411624117
Global hourly report of all data billed by Datadog for a given organization.
2411724118

24118-
Newly added billing dimensions and usage types appear as untyped keys on the
24119-
`additionalProperties` map instead of as typed fields. Call
24120-
`GET /api/v2/usage/summary/available_fields` to enumerate every key returned
24121-
at this response level—both typed fields and `additionalProperties` keys.
24119+
For SDK users only: all fields at this response level are accessible through the
24120+
`additionalProperties` map. Existing typed-field getters are unchanged. New billing
24121+
dimensions will not have typed-field getters. Use
24122+
[Get available fields for usage summary](https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields)
24123+
to enumerate every available key.
2412224124
properties:
2412324125
account_name:
2412424126
description: The account name.
@@ -25436,10 +25438,11 @@ components:
2543625438
Response summarizing all usage aggregated across the months in the request for
2543725439
all organizations, and broken down by month and by organization.
2543825440

25439-
Newly added billing dimensions and usage types appear as untyped keys on the
25440-
`additionalProperties` map instead of as typed fields. Call
25441-
`GET /api/v2/usage/summary/available_fields` to enumerate every key returned
25442-
at this response level—both typed fields and `additionalProperties` keys.
25441+
For SDK users only: all fields at this response level are accessible through the
25442+
`additionalProperties` map. Existing typed-field getters are unchanged. New billing
25443+
dimensions will not have typed-field getters. Use
25444+
[Get available fields for usage summary](https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields)
25445+
to enumerate every available key.
2544325446
properties:
2544425447
agent_host_top99p_sum:
2544525448
description: Shows the 99th percentile of all agent hosts over all hours in the current month for all organizations.
@@ -43215,11 +43218,12 @@ paths:
4321543218
description: |-
4321643219
Get all usage across your account.
4321743220

43218-
Newly added billing dimensions and usage types appear as untyped keys on the
43219-
`additionalProperties` map of `UsageSummaryResponse`, `UsageSummaryDate`, and
43220-
`UsageSummaryDateOrg` instead of as typed fields. Call
43221-
`GET /api/v2/usage/summary/available_fields` to enumerate every key returned
43222-
at each response level—both typed fields and `additionalProperties` keys.
43221+
For SDK users only: all fields on `UsageSummaryResponse`, `UsageSummaryDate`, and
43222+
`UsageSummaryDateOrg` are accessible through each object's `additionalProperties` map.
43223+
Existing typed-field getters are unchanged. New billing dimensions will not have
43224+
typed-field getters. Use
43225+
[Get available fields for usage summary](https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields)
43226+
to enumerate every available key at each response level.
4322343227

4322443228
This endpoint is only accessible for [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/).
4322543229
operationId: GetUsageSummary

.generator/schemas/v2/openapi.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187306,6 +187306,37 @@ paths:
187306187306
dimensions and usage types added after the v1 schema freeze).
187307187307

187308187308
This endpoint is only accessible for [parent-level organizations](https://docs.datadoghq.com/account_management/multi_organization/).
187309+
187310+
Go example:
187311+
187312+
```go
187313+
fields, _, err := api.GetUsageSummaryAvailableFields(ctx)
187314+
attr := fields.Data.GetAttributes()
187315+
187316+
// resp is the *UsageSummaryResponse returned by api.GetUsageSummary(ctx, ...)
187317+
// Layer 1: UsageSummaryResponse
187318+
for _, key := range attr.GetResponseFields() {
187319+
if val, ok := resp.AdditionalProperties[key]; ok {
187320+
fmt.Println(key, val.(json.Number))
187321+
}
187322+
}
187323+
// Layer 2: UsageSummaryDate (per month)
187324+
for _, date := range resp.GetUsage() {
187325+
for _, key := range attr.GetDateFields() {
187326+
if val, ok := date.AdditionalProperties[key]; ok {
187327+
fmt.Println(key, val.(json.Number))
187328+
}
187329+
}
187330+
// Layer 3: UsageSummaryDateOrg (per org per month)
187331+
for _, org := range date.GetOrgs() {
187332+
for _, key := range attr.GetDateOrgFields() {
187333+
if val, ok := org.AdditionalProperties[key]; ok {
187334+
fmt.Println(key, val.(json.Number))
187335+
}
187336+
}
187337+
}
187338+
}
187339+
```
187309187340
operationId: GetUsageSummaryAvailableFields
187310187341
responses:
187311187342
"200":

src/datadogV1/api/api_usage_metering.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5284,11 +5284,12 @@ impl UsageMeteringAPI {
52845284

52855285
/// Get all usage across your account.
52865286
///
5287-
/// Newly added billing dimensions and usage types appear as untyped keys on the
5288-
/// `additionalProperties` map of `UsageSummaryResponse`, `UsageSummaryDate`, and
5289-
/// `UsageSummaryDateOrg` instead of as typed fields. Call
5290-
/// `GET /api/v2/usage/summary/available_fields` to enumerate every key returned
5291-
/// at each response level—both typed fields and `additionalProperties` keys.
5287+
/// For SDK users only: all fields on `UsageSummaryResponse`, `UsageSummaryDate`, and
5288+
/// `UsageSummaryDateOrg` are accessible through each object's `additionalProperties` map.
5289+
/// Existing typed-field getters are unchanged. New billing dimensions will not have
5290+
/// typed-field getters. Use
5291+
/// [Get available fields for usage summary](<https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields>)
5292+
/// to enumerate every available key at each response level.
52925293
///
52935294
/// This endpoint is only accessible for [parent-level organizations](<https://docs.datadoghq.com/account_management/multi_organization/>).
52945295
pub async fn get_usage_summary(
@@ -5316,11 +5317,12 @@ impl UsageMeteringAPI {
53165317

53175318
/// Get all usage across your account.
53185319
///
5319-
/// Newly added billing dimensions and usage types appear as untyped keys on the
5320-
/// `additionalProperties` map of `UsageSummaryResponse`, `UsageSummaryDate`, and
5321-
/// `UsageSummaryDateOrg` instead of as typed fields. Call
5322-
/// `GET /api/v2/usage/summary/available_fields` to enumerate every key returned
5323-
/// at each response level—both typed fields and `additionalProperties` keys.
5320+
/// For SDK users only: all fields on `UsageSummaryResponse`, `UsageSummaryDate`, and
5321+
/// `UsageSummaryDateOrg` are accessible through each object's `additionalProperties` map.
5322+
/// Existing typed-field getters are unchanged. New billing dimensions will not have
5323+
/// typed-field getters. Use
5324+
/// [Get available fields for usage summary](<https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields>)
5325+
/// to enumerate every available key at each response level.
53245326
///
53255327
/// This endpoint is only accessible for [parent-level organizations](<https://docs.datadoghq.com/account_management/multi_organization/>).
53265328
pub async fn get_usage_summary_with_http_info(

src/datadogV1/model/model_usage_summary_date.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ use std::fmt::{self, Formatter};
88

99
/// Response with hourly report of all data billed by Datadog for all organizations.
1010
///
11-
/// Newly added billing dimensions and usage types appear as untyped keys on the
12-
/// `additionalProperties` map instead of as typed fields. Call
13-
/// `GET /api/v2/usage/summary/available_fields` to enumerate every key returned
14-
/// at this response level—both typed fields and `additionalProperties` keys.
11+
/// For SDK users only: all fields at this response level are accessible through the
12+
/// `additionalProperties` map. Existing typed-field getters are unchanged. New billing
13+
/// dimensions will not have typed-field getters. Use
14+
/// [Get available fields for usage summary](<https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields>)
15+
/// to enumerate every available key.
1516
#[non_exhaustive]
1617
#[skip_serializing_none]
1718
#[derive(Clone, Debug, PartialEq, Serialize)]

src/datadogV1/model/model_usage_summary_date_org.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ use std::fmt::{self, Formatter};
88

99
/// Global hourly report of all data billed by Datadog for a given organization.
1010
///
11-
/// Newly added billing dimensions and usage types appear as untyped keys on the
12-
/// `additionalProperties` map instead of as typed fields. Call
13-
/// `GET /api/v2/usage/summary/available_fields` to enumerate every key returned
14-
/// at this response level—both typed fields and `additionalProperties` keys.
11+
/// For SDK users only: all fields at this response level are accessible through the
12+
/// `additionalProperties` map. Existing typed-field getters are unchanged. New billing
13+
/// dimensions will not have typed-field getters. Use
14+
/// [Get available fields for usage summary](<https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields>)
15+
/// to enumerate every available key.
1516
#[non_exhaustive]
1617
#[skip_serializing_none]
1718
#[derive(Clone, Debug, PartialEq, Serialize)]

src/datadogV1/model/model_usage_summary_response.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ use std::fmt::{self, Formatter};
99
/// Response summarizing all usage aggregated across the months in the request for
1010
/// all organizations, and broken down by month and by organization.
1111
///
12-
/// Newly added billing dimensions and usage types appear as untyped keys on the
13-
/// `additionalProperties` map instead of as typed fields. Call
14-
/// `GET /api/v2/usage/summary/available_fields` to enumerate every key returned
15-
/// at this response level—both typed fields and `additionalProperties` keys.
12+
/// For SDK users only: all fields at this response level are accessible through the
13+
/// `additionalProperties` map. Existing typed-field getters are unchanged. New billing
14+
/// dimensions will not have typed-field getters. Use
15+
/// [Get available fields for usage summary](<https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-summary-available-fields>)
16+
/// to enumerate every available key.
1617
#[non_exhaustive]
1718
#[skip_serializing_none]
1819
#[derive(Clone, Debug, PartialEq, Serialize)]

src/datadogV2/api/api_usage_metering.rs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,6 +2207,37 @@ impl UsageMeteringAPI {
22072207
/// dimensions and usage types added after the v1 schema freeze).
22082208
///
22092209
/// This endpoint is only accessible for [parent-level organizations](<https://docs.datadoghq.com/account_management/multi_organization/>).
2210+
///
2211+
/// Go example:
2212+
///
2213+
/// ```go
2214+
/// fields, _, err := api.GetUsageSummaryAvailableFields(ctx)
2215+
/// attr := fields.Data.GetAttributes()
2216+
///
2217+
/// // resp is the *UsageSummaryResponse returned by api.GetUsageSummary(ctx, ...)
2218+
/// // Layer 1: UsageSummaryResponse
2219+
/// for _, key := range attr.GetResponseFields() {
2220+
/// if val, ok := resp.AdditionalProperties[key]; ok {
2221+
/// fmt.Println(key, val.(json.Number))
2222+
/// }
2223+
/// }
2224+
/// // Layer 2: UsageSummaryDate (per month)
2225+
/// for _, date := range resp.GetUsage() {
2226+
/// for _, key := range attr.GetDateFields() {
2227+
/// if val, ok := date.AdditionalProperties[key]; ok {
2228+
/// fmt.Println(key, val.(json.Number))
2229+
/// }
2230+
/// }
2231+
/// // Layer 3: UsageSummaryDateOrg (per org per month)
2232+
/// for _, org := range date.GetOrgs() {
2233+
/// for _, key := range attr.GetDateOrgFields() {
2234+
/// if val, ok := org.AdditionalProperties[key]; ok {
2235+
/// fmt.Println(key, val.(json.Number))
2236+
/// }
2237+
/// }
2238+
/// }
2239+
/// }
2240+
/// ```
22102241
pub async fn get_usage_summary_available_fields(
22112242
&self,
22122243
) -> Result<
@@ -2237,6 +2268,37 @@ impl UsageMeteringAPI {
22372268
/// dimensions and usage types added after the v1 schema freeze).
22382269
///
22392270
/// This endpoint is only accessible for [parent-level organizations](<https://docs.datadoghq.com/account_management/multi_organization/>).
2271+
///
2272+
/// Go example:
2273+
///
2274+
/// ```go
2275+
/// fields, _, err := api.GetUsageSummaryAvailableFields(ctx)
2276+
/// attr := fields.Data.GetAttributes()
2277+
///
2278+
/// // resp is the *UsageSummaryResponse returned by api.GetUsageSummary(ctx, ...)
2279+
/// // Layer 1: UsageSummaryResponse
2280+
/// for _, key := range attr.GetResponseFields() {
2281+
/// if val, ok := resp.AdditionalProperties[key]; ok {
2282+
/// fmt.Println(key, val.(json.Number))
2283+
/// }
2284+
/// }
2285+
/// // Layer 2: UsageSummaryDate (per month)
2286+
/// for _, date := range resp.GetUsage() {
2287+
/// for _, key := range attr.GetDateFields() {
2288+
/// if val, ok := date.AdditionalProperties[key]; ok {
2289+
/// fmt.Println(key, val.(json.Number))
2290+
/// }
2291+
/// }
2292+
/// // Layer 3: UsageSummaryDateOrg (per org per month)
2293+
/// for _, org := range date.GetOrgs() {
2294+
/// for _, key := range attr.GetDateOrgFields() {
2295+
/// if val, ok := org.AdditionalProperties[key]; ok {
2296+
/// fmt.Println(key, val.(json.Number))
2297+
/// }
2298+
/// }
2299+
/// }
2300+
/// }
2301+
/// ```
22402302
pub async fn get_usage_summary_available_fields_with_http_info(
22412303
&self,
22422304
) -> Result<

0 commit comments

Comments
 (0)