Skip to content

Commit 49ec9ba

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 7d00058d of spec repo (#1069)
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 062a727 commit 49ec9ba

12 files changed

+262
-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-06-24 13:49:10.713024",
8-
"spec_repo_commit": "f1bd5a77"
7+
"regenerated": "2022-06-27 07:09:06.278108",
8+
"spec_repo_commit": "7d00058d"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.2",
12-
"regenerated": "2022-06-24 13:49:10.724901",
13-
"spec_repo_commit": "f1bd5a77"
12+
"regenerated": "2022-06-27 07:09:06.300567",
13+
"spec_repo_commit": "7d00058d"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12935,6 +12935,81 @@ paths:
1293512935
x-menu-order: 39
1293612936
x-undo:
1293712937
type: safe
12938+
/api/v2/usage/estimated_cost_by_org:
12939+
get:
12940+
description: Get estimated cost across multi-org account.
12941+
operationId: GetEstimatedCostByOrg
12942+
parameters:
12943+
- description: 'Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]`
12944+
for cost beginning this month. Either start_month or start_date should be
12945+
specified, but not both.'
12946+
in: query
12947+
name: start_month
12948+
required: false
12949+
schema:
12950+
format: date-time
12951+
type: string
12952+
- description: 'Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]`
12953+
for cost ending this month.'
12954+
in: query
12955+
name: end_month
12956+
required: false
12957+
schema:
12958+
format: date-time
12959+
type: string
12960+
- description: 'Datetime in ISO-8601 format, UTC, precise to day: `[YYYY-MM-DD]`
12961+
for cost beginning this day. Either start_month or start_date should be
12962+
specified, but not both.'
12963+
in: query
12964+
name: start_date
12965+
required: false
12966+
schema:
12967+
format: date-time
12968+
type: string
12969+
- description: 'Datetime in ISO-8601 format, UTC, precise to day: `[YYYY-MM-DD]`
12970+
for cost ending this day.'
12971+
in: query
12972+
name: end_date
12973+
required: false
12974+
schema:
12975+
format: date-time
12976+
type: string
12977+
responses:
12978+
'200':
12979+
content:
12980+
application/json;datetime-format=rfc3339:
12981+
schema:
12982+
$ref: '#/components/schemas/CostByOrgResponse'
12983+
description: OK
12984+
'400':
12985+
content:
12986+
application/json;datetime-format=rfc3339:
12987+
schema:
12988+
$ref: '#/components/schemas/APIErrorResponse'
12989+
description: Bad Request
12990+
'403':
12991+
content:
12992+
application/json;datetime-format=rfc3339:
12993+
schema:
12994+
$ref: '#/components/schemas/APIErrorResponse'
12995+
description: Forbidden - User is not authorized
12996+
'429':
12997+
content:
12998+
application/json;datetime-format=rfc3339:
12999+
schema:
13000+
$ref: '#/components/schemas/APIErrorResponse'
13001+
description: Too many requests
13002+
security:
13003+
- apiKeyAuth: []
13004+
appKeyAuth: []
13005+
- AuthZ:
13006+
- usage_read
13007+
summary: Get estimated cost across multi-org account
13008+
tags:
13009+
- Usage Metering
13010+
x-menu-order: 39
13011+
x-undo:
13012+
type: safe
1293813013
/api/v2/usage/lambda_traced_invocations:
1293913014
get:
1294013015
description: Get hourly usage for Lambda Traced Invocations.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Get estimated cost across multi-org account returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = UsageMeteringApi(api_client)
11+
response = api_instance.get_estimated_cost_by_org()
12+
13+
print(response)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Get estimated cost across multi-org account with month 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_estimated_cost_by_org(
14+
start_month=(datetime.now() + relativedelta(days=-5)).isoformat(timespec="seconds"),
15+
end_month=(datetime.now() + relativedelta(days=-3)).isoformat(timespec="seconds"),
16+
)
17+
18+
print(response)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Get estimated cost across multi-org account with date 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_estimated_cost_by_org(
14+
start_date=(datetime.now() + relativedelta(days=-5)).isoformat(timespec="seconds"),
15+
end_date=(datetime.now() + relativedelta(days=-3)).isoformat(timespec="seconds"),
16+
)
17+
18+
print(response)

src/datadog_api_client/v2/api/usage_metering_api.py

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-04-25T17:07:01.561Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
accept:
6+
- application/json;datetime-format=rfc3339
7+
method: GET
8+
uri: https://api.datadoghq.com/api/v2/usage/estimated_cost_by_org?start_date=2022-04-20T17%3A07%3A01.561Z&end_date=2022-04-22T17%3A07%3A01.561Z
9+
response:
10+
body:
11+
string: '{"data":[{"attributes":{"org_name":"RQ Dummy Tests","public_id":"fasjyydbcgwwc2uc","total_cost":73.17,"charges":[{"charge_type":"committed","cost":0,"product_name":"infra_host"},{"charge_type":"on_demand","cost":72,"product_name":"synthetics_api_tests"},{"charge_type":"committed","cost":1.17,"product_name":"infra_host"}],"date":"2022-04-25T17:00:00+00:00"},"type":"cost_by_org","id":"5d1702ab10f060719ae5aa1fd7ba09e3d7e0fb371b8319051c616a1fcad254e9"}]}
12+
13+
'
14+
headers:
15+
content-type:
16+
- application/json
17+
status:
18+
code: 200
19+
message: OK
20+
version: 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-04-25T17:07:01.561Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
accept:
6+
- application/json;datetime-format=rfc3339
7+
method: GET
8+
uri: https://api.datadoghq.com/api/v2/usage/estimated_cost_by_org?start_month=2022-04-20T17%3A07%3A01.561Z&end_month=2022-04-22T17%3A07%3A01.561Z
9+
response:
10+
body:
11+
string: '{"data":[{"attributes":{"org_name":"RQ Dummy Tests","public_id":"fasjyydbcgwwc2uc","total_cost":73.17,"charges":[{"charge_type":"committed","cost":0,"product_name":"infra_host"},{"charge_type":"on_demand","cost":72,"product_name":"synthetics_api_tests"},{"charge_type":"committed","cost":1.17,"product_name":"infra_host"}],"date":"2022-04-25T17:00:00+00:00"},"type":"cost_by_org","id":"5d1702ab10f060719ae5aa1fd7ba09e3d7e0fb371b8319051c616a1fcad254e9"}]}
12+
13+
'
14+
headers:
15+
content-type:
16+
- application/json
17+
status:
18+
code: 200
19+
message: OK
20+
version: 1

0 commit comments

Comments
 (0)