Skip to content

Commit c04e581

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update example for GetEstimatedCostByOrg (#1741)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 92a9c3e commit c04e581

10 files changed

+35
-49
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.4",
7-
"regenerated": "2022-11-02 20:10:47.186007",
8-
"spec_repo_commit": "7c5579df"
7+
"regenerated": "2022-11-04 18:42:25.256115",
8+
"spec_repo_commit": "af3f11fc"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2022-11-02 20:10:47.202972",
13-
"spec_repo_commit": "7c5579df"
12+
"regenerated": "2022-11-04 18:42:25.269568",
13+
"spec_repo_commit": "af3f11fc"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16461,7 +16461,9 @@ paths:
1646116461
get:
1646216462
description: 'Get estimated cost across multi-org and single root-org accounts.
1646316463

16464-
Estimated cost data is only available for the current month and previous month.
16464+
Estimated cost data is only available for the current month and previous month
16465+
16466+
and is delayed by up to 72 hours from when it was incurred.
1646516467

1646616468
To access historical costs prior to this, use the `/historical_cost` endpoint.'
1646716469
operationId: GetEstimatedCostByOrg

api/datadogV2/api_usage_metering.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ func (a *UsageMeteringApi) buildGetEstimatedCostByOrgRequest(ctx _context.Contex
250250

251251
// GetEstimatedCostByOrg Get estimated cost across your account.
252252
// Get estimated cost across multi-org and single root-org accounts.
253-
// Estimated cost data is only available for the current month and previous month.
253+
// Estimated cost data is only available for the current month and previous month
254+
// and is delayed by up to 72 hours from when it was incurred.
254255
// To access historical costs prior to this, use the `/historical_cost` endpoint.
255256
func (a *UsageMeteringApi) GetEstimatedCostByOrg(ctx _context.Context, o ...GetEstimatedCostByOrgOptionalParameters) (CostByOrgResponse, *_nethttp.Response, error) {
256257
req, err := a.buildGetEstimatedCostByOrgRequest(ctx, o...)

examples/v2/usage-metering/GetEstimatedCostByOrg_2734954020.go

Lines changed: 0 additions & 30 deletions
This file was deleted.

examples/v2/usage-metering/GetEstimatedCostByOrg_3186693804.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func main() {
1818
configuration := datadog.NewConfiguration()
1919
apiClient := datadog.NewAPIClient(configuration)
2020
api := datadogV2.NewUsageMeteringApi(apiClient)
21-
resp, r, err := api.GetEstimatedCostByOrg(ctx, *datadogV2.NewGetEstimatedCostByOrgOptionalParameters().WithView("sub-org").WithStartMonth(time.Now().AddDate(0, 0, -5)))
21+
resp, r, err := api.GetEstimatedCostByOrg(ctx, *datadogV2.NewGetEstimatedCostByOrgOptionalParameters().WithView("sub-org").WithStartMonth(time.Now()))
2222

2323
if err != nil {
2424
fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetEstimatedCostByOrg`: %v\n", err)
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-09-23T14:04:15.545Z
1+
2022-11-03T21:08:41.229Z

tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interactions:
66
Accept:
77
- application/json;datetime-format=rfc3339
88
method: GET
9-
url: https://api.datadoghq.com/api/v2/usage/estimated_cost?view=sub-org&start_month=2022-09-20T14%3A04%3A15.545Z&start_date=2022-09-20T14%3A04%3A15.545Z
9+
url: https://api.datadoghq.com/api/v2/usage/estimated_cost?view=sub-org&start_month=2022-11-03T21%3A08%3A41.229Z&start_date=2022-10-31T21%3A08%3A41.229Z
1010
response:
1111
body: '{"errors":["API called with non-parent org keys. Data is only available
1212
at the root level org"]}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-11-04T18:40:14.021Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
interactions:
2+
- request:
3+
body: ''
4+
form: {}
5+
headers:
6+
Accept:
7+
- application/json;datetime-format=rfc3339
8+
method: GET
9+
url: https://api.datadoghq.com/api/v2/usage/estimated_cost?view=sub-org&start_month=2022-11-04T18%3A40%3A14.021Z
10+
response:
11+
body: '{"data":[]}
12+
13+
'
14+
code: 200
15+
duration: ''
16+
headers:
17+
Content-Type:
18+
- application/json
19+
status: 200 OK
20+
version: 1

tests/scenarios/features/v2/usage_metering.feature

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,23 +166,15 @@ Feature: Usage Metering
166166
Scenario: GetEstimatedCostByOrg with both start_month and start_date returns "Bad Request" response
167167
Given new "GetEstimatedCostByOrg" request
168168
And request contains "view" parameter with value "sub-org"
169-
And request contains "start_month" parameter with value "{{ timeISO('now - 3d') }}"
169+
And request contains "start_month" parameter with value "{{ timeISO('now') }}"
170170
And request contains "start_date" parameter with value "{{ timeISO('now - 3d') }}"
171171
When the request is sent
172172
Then the response status is 400 Bad Request
173173

174174
@replay-only @team:DataDog/red-zone-revenue-query
175-
Scenario: GetEstimatedCostByOrg with start_date returns "OK" response
176-
Given new "GetEstimatedCostByOrg" request
177-
And request contains "view" parameter with value "sub-org"
178-
And request contains "start_date" parameter with value "{{ timeISO('now - 5d') }}"
179-
When the request is sent
180-
Then the response status is 200 OK
181-
182-
@skip @team:DataDog/red-zone-revenue-query
183175
Scenario: GetEstimatedCostByOrg with start_month returns "OK" response
184176
Given new "GetEstimatedCostByOrg" request
185177
And request contains "view" parameter with value "sub-org"
186-
And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}"
178+
And request contains "start_month" parameter with value "{{ timeISO('now') }}"
187179
When the request is sent
188180
Then the response status is 200 OK

0 commit comments

Comments
 (0)