Skip to content

Commit a1a2b56

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 448d6aae of spec repo (#1084)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent ae42e3c commit a1a2b56

18 files changed

+781
-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.2",
7-
"regenerated": "2022-07-19 15:15:18.691073",
8-
"spec_repo_commit": "d2c0157b"
7+
"regenerated": "2022-07-19 16:28:26.812126",
8+
"spec_repo_commit": "448d6aae"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.2",
12-
"regenerated": "2022-07-19 15:15:18.813197",
13-
"spec_repo_commit": "d2c0157b"
12+
"regenerated": "2022-07-19 16:28:26.832274",
13+
"spec_repo_commit": "448d6aae"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,84 @@ components:
16831683
required:
16841684
- message
16851685
type: object
1686+
HourlyUsage:
1687+
description: Hourly usage for a product family for an org.
1688+
properties:
1689+
attributes:
1690+
$ref: '#/components/schemas/HourlyUsageAttributes'
1691+
id:
1692+
description: Unique ID of the response.
1693+
type: string
1694+
type:
1695+
$ref: '#/components/schemas/UsageTimeSeriesType'
1696+
type: object
1697+
HourlyUsageAttributes:
1698+
description: Attributes of hourly usage for a product family for an org for
1699+
a time period.
1700+
properties:
1701+
measurements:
1702+
description: List of the measured usage values for the product family for
1703+
the org for the time period.
1704+
items:
1705+
$ref: '#/components/schemas/HourlyUsageMeasurement'
1706+
type: array
1707+
org_name:
1708+
description: The organization name.
1709+
type: string
1710+
product_family:
1711+
description: The product for which usage is being reported.
1712+
type: string
1713+
public_id:
1714+
description: The organization public ID.
1715+
type: string
1716+
region:
1717+
description: The region of the Datadog instance that the organization belongs
1718+
to.
1719+
type: string
1720+
timestamp:
1721+
description: Datetime in ISO-8601 format, UTC. The hour for the usage.
1722+
format: date-time
1723+
type: string
1724+
type: object
1725+
HourlyUsageMeasurement:
1726+
description: Usage amount for a given usage type.
1727+
properties:
1728+
usage_type:
1729+
description: Type of usage.
1730+
type: string
1731+
value:
1732+
description: Contains the number measured for the given usage_type during
1733+
the hour.
1734+
format: int64
1735+
nullable: true
1736+
type: integer
1737+
type: object
1738+
HourlyUsageMetadata:
1739+
description: The object containing document metadata.
1740+
properties:
1741+
pagination:
1742+
$ref: '#/components/schemas/HourlyUsagePagination'
1743+
type: object
1744+
HourlyUsagePagination:
1745+
description: The metadata for the current pagination.
1746+
properties:
1747+
next_record_id:
1748+
description: The cursor to get the next results (if any). To make the next
1749+
request, use the same parameters and add `next_record_id`.
1750+
nullable: true
1751+
type: string
1752+
type: object
1753+
HourlyUsageResponse:
1754+
description: Hourly usage response.
1755+
properties:
1756+
data:
1757+
description: Response containing hourly usage.
1758+
items:
1759+
$ref: '#/components/schemas/HourlyUsage'
1760+
type: array
1761+
meta:
1762+
$ref: '#/components/schemas/HourlyUsageMetadata'
1763+
type: object
16861764
HourlyUsageType:
16871765
description: Usage type that is being measured.
16881766
enum:
@@ -13382,6 +13460,120 @@ paths:
1338213460
x-menu-order: 39
1338313461
x-undo:
1338413462
type: safe
13463+
/api/v2/usage/hourly_usage:
13464+
get:
13465+
description: Get hourly usage by product family
13466+
operationId: GetHourlyUsage
13467+
parameters:
13468+
- description: 'Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh]
13469+
for usage beginning at this hour.'
13470+
in: query
13471+
name: filter[timestamp][start]
13472+
required: true
13473+
schema:
13474+
format: date-time
13475+
type: string
13476+
- description: 'Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh]
13477+
for usage ending **before** this hour.'
13478+
in: query
13479+
name: filter[timestamp][end]
13480+
required: false
13481+
schema:
13482+
format: date-time
13483+
type: string
13484+
- description: 'Comma separated list of product families to retrieve. Available
13485+
families are `all`, `analyzed_logs`,
13486+
13487+
`application_security`, `audit_logs`, `serverless`, `ci_app`, `cspm`, `cws`,
13488+
`dbm`, `fargate`,
13489+
13490+
`infra_hosts`, `incident_management`, `indexed_logs`, `indexed_spans`, `ingested_spans`,
13491+
`iot`,
13492+
13493+
`lambda_traced_invocations`, `logs`, `network_flows`, `network_hosts`, `observability_pipelines`,
13494+
13495+
`online_archive`, `profiling`, `rum`, `rum_browser_sessions`, `rum_mobile_sessions`,
13496+
`sds`, `snmp`,
13497+
13498+
`synthetics_api`, `synthetics_browser`, and `timeseries`.'
13499+
in: query
13500+
name: filter[product_families]
13501+
required: true
13502+
schema:
13503+
type: string
13504+
- description: Include child org usage in the response. Defaults to false.
13505+
in: query
13506+
name: filter[include_descendants]
13507+
required: false
13508+
schema:
13509+
default: false
13510+
type: boolean
13511+
- description: 'Comma separated list of product family versions to use in the
13512+
format `product_family:version`. For example,
13513+
13514+
`infra_hosts:1.0.0`. If this parameter is not used, the API will use the
13515+
latest version of each requested
13516+
13517+
product family. Currently all families have one version `1.0.0`.'
13518+
in: query
13519+
name: filter[versions]
13520+
required: false
13521+
schema:
13522+
type: string
13523+
- description: Maximum number of results to return (between 1 and 500) - defaults
13524+
to 500 if limit not specified.
13525+
in: query
13526+
name: page[limit]
13527+
required: false
13528+
schema:
13529+
default: 500
13530+
format: int32
13531+
maximum: 500
13532+
minimum: 1
13533+
type: integer
13534+
- description: List following results with a next_record_id provided in the
13535+
previous query.
13536+
in: query
13537+
name: page[next_record_id]
13538+
required: false
13539+
schema:
13540+
type: string
13541+
responses:
13542+
'200':
13543+
content:
13544+
application/json;datetime-format=rfc3339:
13545+
schema:
13546+
$ref: '#/components/schemas/HourlyUsageResponse'
13547+
description: OK
13548+
'400':
13549+
content:
13550+
application/json;datetime-format=rfc3339:
13551+
schema:
13552+
$ref: '#/components/schemas/APIErrorResponse'
13553+
description: Bad Request
13554+
'403':
13555+
content:
13556+
application/json;datetime-format=rfc3339:
13557+
schema:
13558+
$ref: '#/components/schemas/APIErrorResponse'
13559+
description: Forbidden - User is not authorized
13560+
'429':
13561+
content:
13562+
application/json;datetime-format=rfc3339:
13563+
schema:
13564+
$ref: '#/components/schemas/APIErrorResponse'
13565+
description: Too many requests
13566+
security:
13567+
- apiKeyAuth: []
13568+
appKeyAuth: []
13569+
- AuthZ:
13570+
- usage_read
13571+
summary: Get hourly usage by product family
13572+
tags:
13573+
- Usage Metering
13574+
x-menu-order: 40
13575+
x-undo:
13576+
type: safe
1338513577
/api/v2/usage/lambda_traced_invocations:
1338613578
get:
1338713579
description: Get hourly usage for Lambda Traced Invocations.

docs/datadog_api_client.v2.model.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,48 @@ full\_application\_key\_attributes
624624
:members:
625625
:show-inheritance:
626626

627+
hourly\_usage
628+
-------------
629+
630+
.. automodule:: datadog_api_client.v2.model.hourly_usage
631+
:members:
632+
:show-inheritance:
633+
634+
hourly\_usage\_attributes
635+
-------------------------
636+
637+
.. automodule:: datadog_api_client.v2.model.hourly_usage_attributes
638+
:members:
639+
:show-inheritance:
640+
641+
hourly\_usage\_measurement
642+
--------------------------
643+
644+
.. automodule:: datadog_api_client.v2.model.hourly_usage_measurement
645+
:members:
646+
:show-inheritance:
647+
648+
hourly\_usage\_metadata
649+
-----------------------
650+
651+
.. automodule:: datadog_api_client.v2.model.hourly_usage_metadata
652+
:members:
653+
:show-inheritance:
654+
655+
hourly\_usage\_pagination
656+
-------------------------
657+
658+
.. automodule:: datadog_api_client.v2.model.hourly_usage_pagination
659+
:members:
660+
:show-inheritance:
661+
662+
hourly\_usage\_response
663+
-----------------------
664+
665+
.. automodule:: datadog_api_client.v2.model.hourly_usage_response
666+
:members:
667+
:show-inheritance:
668+
627669
hourly\_usage\_type
628670
-------------------
629671

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Get hourly usage by product family returns "OK" response
3+
"""
4+
5+
from datetime import datetime
6+
from dateutil.relativedelta import relativedelta
7+
from datadog_api_client import ApiClient, Configuration
8+
from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi
9+
10+
configuration = Configuration()
11+
with ApiClient(configuration) as api_client:
12+
api_instance = UsageMeteringApi(api_client)
13+
response = api_instance.get_hourly_usage(
14+
filter_timestamp_start=(datetime.now() + relativedelta(days=-3)),
15+
filter_product_families="infra_hosts",
16+
)
17+
18+
print(response)

0 commit comments

Comments
 (0)