Skip to content

Commit f029e26

Browse files
api-clients-generation-pipeline[bot]jirikuncarci.datadog-api-spec
authored
Add endpoint to retrieve hourly usage attribution (#724)
* Fix indentation * Serialize to ISO with fixed precission and Z suffix * Update api_client.mustache * Regenerate client from commit 861a3c0 of spec repo Co-authored-by: Jiri Kuncar <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: Jiri Kuncar <[email protected]> Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent cc4bb66 commit f029e26

27 files changed

+999
-16
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.5.1.dev2",
7-
"regenerated": "2021-12-22 15:41:09.807167",
8-
"spec_repo_commit": "fa551a3"
7+
"regenerated": "2021-12-22 22:13:14.689727",
8+
"spec_repo_commit": "861a3c0"
99
},
1010
"v2": {
1111
"apigentools_version": "1.5.1.dev2",
12-
"regenerated": "2021-12-22 15:41:10.250595",
13-
"spec_repo_commit": "fa551a3"
12+
"regenerated": "2021-12-22 22:13:15.130923",
13+
"spec_repo_commit": "861a3c0"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 167 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3365,6 +3365,95 @@ components:
33653365
format: int64
33663366
type: integer
33673367
type: object
3368+
HourlyUsageAttributionBody:
3369+
description: The usage for one set of tags for one hour.
3370+
properties:
3371+
hour:
3372+
description: The hour for the usage.
3373+
format: date-time
3374+
type: string
3375+
org_name:
3376+
description: The name of the organization.
3377+
type: string
3378+
public_id:
3379+
description: The organization public ID.
3380+
type: string
3381+
tag_config_source:
3382+
description: The source of the usage attribution tag configuration and the
3383+
selected tags in the format of `<source_org_name>:::<selected tag 1>///<selected
3384+
tag 2>///<selected tag 3>`.
3385+
type: string
3386+
tags:
3387+
$ref: '#/components/schemas/UsageAttributionTagNames'
3388+
total_usage_sum:
3389+
description: Total product usage for the given tags within the hour.
3390+
format: double
3391+
type: number
3392+
updated_at:
3393+
description: Shows the most recent hour in the current month for all organizations
3394+
where usages are calculated.
3395+
type: string
3396+
usage_type:
3397+
$ref: '#/components/schemas/HourlyUsageAttributionUsageType'
3398+
type: object
3399+
HourlyUsageAttributionMetadata:
3400+
description: The object containing document metadata.
3401+
properties:
3402+
pagination:
3403+
$ref: '#/components/schemas/HourlyUsageAttributionPagination'
3404+
type: object
3405+
HourlyUsageAttributionPagination:
3406+
description: The metadata for the current pagination.
3407+
properties:
3408+
next_record_id:
3409+
description: The cursor to get the next results (if any). To make the next
3410+
request, use the same parameters and add `next_record_id`.
3411+
type: string
3412+
type: object
3413+
HourlyUsageAttributionResponse:
3414+
description: Response containing the hourly usage attribution by tag(s).
3415+
properties:
3416+
metadata:
3417+
$ref: '#/components/schemas/HourlyUsageAttributionMetadata'
3418+
usage:
3419+
description: Get the hourly usage attribution by tag(s).
3420+
items:
3421+
$ref: '#/components/schemas/HourlyUsageAttributionBody'
3422+
type: array
3423+
type: object
3424+
HourlyUsageAttributionUsageType:
3425+
description: Supported products for hourly usage attribution requests.
3426+
enum:
3427+
- api_usage
3428+
- apm_host_usage
3429+
- browser_usage
3430+
- container_usage
3431+
- custom_timeseries_usage
3432+
- fargate_usage
3433+
- functions_usage
3434+
- indexed_logs_usage
3435+
- infra_host_usage
3436+
- invocations_usage
3437+
- npm_host_usage
3438+
- profiled_container_usage
3439+
- profiled_host_usage
3440+
- snmp_usage
3441+
type: string
3442+
x-enum-varnames:
3443+
- API_USAGE
3444+
- APM_HOST_USAGE
3445+
- BROWSER_USAGE
3446+
- CONTAINER_USAGE
3447+
- CUSTOM_TIMESERIES_USAGE
3448+
- FARGATE_USAGE
3449+
- FUNCTIONS_USAGE
3450+
- INDEXED_LOGS_USAGE
3451+
- INFRA_HOST_USAGE
3452+
- INVOCATIONS_USAGE
3453+
- NPM_HOST_USAGE
3454+
- PROFILED_CONTAINER_USAGE
3455+
- PROFILED_HOST_USAGE
3456+
- SNMP_USAGE
33683457
IFrameWidgetDefinition:
33693458
description: The iframe widget allows you to embed a portion of any other web
33703459
page on your dashboard. Only available on FREE layout dashboards.
@@ -24261,7 +24350,7 @@ paths:
2426124350
summary: Get hourly usage for audit logs
2426224351
tags:
2426324352
- Usage Metering
24264-
x-menu-order: 31
24353+
x-menu-order: 32
2426524354
x-undo:
2426624355
type: safe
2426724356
/api/v1/usage/aws_lambda:
@@ -24409,7 +24498,7 @@ paths:
2440924498
summary: Get hourly usage for CSPM
2441024499
tags:
2441124500
- Usage Metering
24412-
x-menu-order: 30
24501+
x-menu-order: 31
2441324502
x-undo:
2441424503
type: safe
2441524504
/api/v1/usage/cws:
@@ -24464,7 +24553,7 @@ paths:
2446424553
summary: Get hourly usage for Cloud Workload Security
2446524554
tags:
2446624555
- Usage Metering
24467-
x-menu-order: 32
24556+
x-menu-order: 33
2446824557
x-undo:
2446924558
type: safe
2447024559
/api/v1/usage/dbm:
@@ -24514,7 +24603,7 @@ paths:
2451424603
summary: Get hourly usage for Database Monitoring
2451524604
tags:
2451624605
- Usage Metering
24517-
x-menu-order: 33
24606+
x-menu-order: 34
2451824607
x-undo:
2451924608
type: safe
2452024609
/api/v1/usage/fargate:
@@ -24623,6 +24712,78 @@ paths:
2462324712
x-menu-order: 1
2462424713
x-undo:
2462524714
type: safe
24715+
/api/v1/usage/hourly-attribution:
24716+
get:
24717+
description: Get Hourly Usage Attribution.
24718+
operationId: GetHourlyUsageAttribution
24719+
parameters:
24720+
- description: 'Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]`
24721+
for usage beginning at this hour.'
24722+
in: query
24723+
name: start_hr
24724+
required: true
24725+
schema:
24726+
format: date-time
24727+
type: string
24728+
- description: 'Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]`
24729+
for usage ending
24730+
24731+
**before** this hour.'
24732+
in: query
24733+
name: end_hr
24734+
required: false
24735+
schema:
24736+
format: date-time
24737+
type: string
24738+
- description: Usage type to retrieve.
24739+
in: query
24740+
name: usage_type
24741+
required: true
24742+
schema:
24743+
$ref: '#/components/schemas/HourlyUsageAttributionUsageType'
24744+
- description: List following results with a next_record_id provided in the
24745+
previous query.
24746+
in: query
24747+
name: next_record_id
24748+
required: false
24749+
schema:
24750+
type: string
24751+
- description: Comma separated list of tags used to group usage. If no value
24752+
is provided the usage will not be broken down by tags.
24753+
in: query
24754+
name: tag_breakdown_keys
24755+
required: false
24756+
schema:
24757+
type: string
24758+
responses:
24759+
'200':
24760+
content:
24761+
application/json;datetime-format=rfc3339:
24762+
schema:
24763+
$ref: '#/components/schemas/HourlyUsageAttributionResponse'
24764+
description: OK
24765+
'403':
24766+
content:
24767+
application/json;datetime-format=rfc3339:
24768+
schema:
24769+
$ref: '#/components/schemas/APIErrorResponse'
24770+
description: Forbidden - User is not authorized
24771+
'429':
24772+
$ref: '#/components/responses/TooManyRequestsResponse'
24773+
security:
24774+
- apiKeyAuth: []
24775+
appKeyAuth: []
24776+
- AuthZ:
24777+
- usage_read
24778+
summary: Get Hourly Usage Attribution
24779+
tags:
24780+
- Usage Metering
24781+
x-menu-order: 30
24782+
x-undo:
24783+
type: safe
24784+
x-unstable: '**Note**: This endpoint is in public beta.
24785+
24786+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
2462624787
/api/v1/usage/incident-management:
2462724788
get:
2462824789
description: Get hourly usage for incident management.
@@ -25218,7 +25379,7 @@ paths:
2521825379
summary: Get hourly usage for RUM Units
2521925380
tags:
2522025381
- Usage Metering
25221-
x-menu-order: 35
25382+
x-menu-order: 36
2522225383
x-undo:
2522325384
type: safe
2522425385
/api/v1/usage/rum_sessions:
@@ -25328,7 +25489,7 @@ paths:
2532825489
summary: Get hourly usage for Sensitive Data Scanner
2532925490
tags:
2533025491
- Usage Metering
25331-
x-menu-order: 34
25492+
x-menu-order: 35
2533225493
x-undo:
2533325494
type: safe
2533425495
/api/v1/usage/snmp:

.generator/templates/api_client.mustache

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ class ApiClient(object):
219219
elif isinstance(obj, (str, int, float, none_type, bool)):
220220
return obj
221221
elif isinstance(obj, (datetime, date)):
222-
return obj.isoformat()
222+
if obj.tzinfo is not None:
223+
return obj.isoformat()
224+
return obj.strftime('%Y-%m-%dT%H:%M:%S') + obj.strftime('.%f')[:4] + 'Z'
223225
elif isinstance(obj, ModelSimple):
224226
return cls.sanitize_for_serialization(obj.value)
225227
elif isinstance(obj, (list, tuple)):

.generator/templates/model_templates/method_init_simple.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333

3434
self.value = value
3535

36-
self._check_kw_args(kwargs)
36+
self._check_kw_args(kwargs)

docs/v1/HourlyUsageAttributionBody.md

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v1/HourlyUsageAttributionMetadata.md

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v1/HourlyUsageAttributionPagination.md

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v1/HourlyUsageAttributionResponse.md

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v1/HourlyUsageAttributionUsageType.md

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v1/README.md

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)