From 5a96a038782dcf6963f6c0cec41b5471ca7cd377 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 3 Nov 2022 21:25:39 +0000 Subject: [PATCH] Regenerate client from commit 80ceb851 of spec repo --- .apigentools-info | 8 ++--- .generator/schemas/v2/openapi.yaml | 4 ++- api/datadogV2/api_usage_metering.go | 3 +- .../GetEstimatedCostByOrg_2734954020.go | 30 ------------------- .../GetEstimatedCostByOrg_3186693804.go | 2 +- ...t_date_returns_Bad_Request_response.freeze | 2 +- ...art_date_returns_Bad_Request_response.yaml | 2 +- ...ith_start_month_returns_OK_response.freeze | 1 + ..._with_start_month_returns_OK_response.yaml | 20 +++++++++++++ .../features/v2/usage_metering.feature | 12 ++------ 10 files changed, 35 insertions(+), 49 deletions(-) delete mode 100644 examples/v2/usage-metering/GetEstimatedCostByOrg_2734954020.go create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_start_month_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_start_month_returns_OK_response.yaml diff --git a/.apigentools-info b/.apigentools-info index a12096d94a5..cd65e1bff6e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2022-11-02 20:10:47.186007", - "spec_repo_commit": "7c5579df" + "regenerated": "2022-11-03 21:24:28.972210", + "spec_repo_commit": "80ceb851" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2022-11-02 20:10:47.202972", - "spec_repo_commit": "7c5579df" + "regenerated": "2022-11-03 21:24:28.985090", + "spec_repo_commit": "80ceb851" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9c8c923bf77..e9d590c56c8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16461,7 +16461,9 @@ paths: get: description: 'Get estimated cost across multi-org and single root-org accounts. - Estimated cost data is only available for the current month and previous month. + Estimated cost data is only available for the current month and previous month + + and is delayed by up to 72 hours from when it was incurred. To access historical costs prior to this, use the `/historical_cost` endpoint.' operationId: GetEstimatedCostByOrg diff --git a/api/datadogV2/api_usage_metering.go b/api/datadogV2/api_usage_metering.go index 49b0239f958..ac799ae8171 100644 --- a/api/datadogV2/api_usage_metering.go +++ b/api/datadogV2/api_usage_metering.go @@ -250,7 +250,8 @@ func (a *UsageMeteringApi) buildGetEstimatedCostByOrgRequest(ctx _context.Contex // GetEstimatedCostByOrg Get estimated cost across your account. // Get estimated cost across multi-org and single root-org accounts. -// Estimated cost data is only available for the current month and previous month. +// Estimated cost data is only available for the current month and previous month +// and is delayed by up to 72 hours from when it was incurred. // To access historical costs prior to this, use the `/historical_cost` endpoint. func (a *UsageMeteringApi) GetEstimatedCostByOrg(ctx _context.Context, o ...GetEstimatedCostByOrgOptionalParameters) (CostByOrgResponse, *_nethttp.Response, error) { req, err := a.buildGetEstimatedCostByOrgRequest(ctx, o...) diff --git a/examples/v2/usage-metering/GetEstimatedCostByOrg_2734954020.go b/examples/v2/usage-metering/GetEstimatedCostByOrg_2734954020.go deleted file mode 100644 index 7cb8f82b973..00000000000 --- a/examples/v2/usage-metering/GetEstimatedCostByOrg_2734954020.go +++ /dev/null @@ -1,30 +0,0 @@ -// GetEstimatedCostByOrg with start_date returns "OK" response - -package main - -import ( - "context" - "encoding/json" - "fmt" - "os" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" - "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" -) - -func main() { - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewUsageMeteringApi(apiClient) - resp, r, err := api.GetEstimatedCostByOrg(ctx, *datadogV2.NewGetEstimatedCostByOrgOptionalParameters().WithView("sub-org").WithStartDate(time.Now().AddDate(0, 0, -5))) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetEstimatedCostByOrg`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - - responseContent, _ := json.MarshalIndent(resp, "", " ") - fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetEstimatedCostByOrg`:\n%s\n", responseContent) -} diff --git a/examples/v2/usage-metering/GetEstimatedCostByOrg_3186693804.go b/examples/v2/usage-metering/GetEstimatedCostByOrg_3186693804.go index a47028502d8..a1339d5f457 100644 --- a/examples/v2/usage-metering/GetEstimatedCostByOrg_3186693804.go +++ b/examples/v2/usage-metering/GetEstimatedCostByOrg_3186693804.go @@ -18,7 +18,7 @@ func main() { configuration := datadog.NewConfiguration() apiClient := datadog.NewAPIClient(configuration) api := datadogV2.NewUsageMeteringApi(apiClient) - resp, r, err := api.GetEstimatedCostByOrg(ctx, *datadogV2.NewGetEstimatedCostByOrgOptionalParameters().WithView("sub-org").WithStartMonth(time.Now().AddDate(0, 0, -5))) + resp, r, err := api.GetEstimatedCostByOrg(ctx, *datadogV2.NewGetEstimatedCostByOrgOptionalParameters().WithView("sub-org").WithStartMonth(time.Now())) if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetEstimatedCostByOrg`: %v\n", err) diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.freeze index cc76d917ab4..0428b0666bc 100644 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.freeze @@ -1 +1 @@ -2022-09-23T14:04:15.545Z \ No newline at end of file +2022-11-03T21:08:41.229Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.yaml index 2edd54bb6b3..7a8c58c63fd 100644 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_both_start_month_and_start_date_returns_Bad_Request_response.yaml @@ -6,7 +6,7 @@ interactions: Accept: - application/json;datetime-format=rfc3339 method: GET - 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 + 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 response: body: '{"errors":["API called with non-parent org keys. Data is only available at the root level org"]}' diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_start_month_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_start_month_returns_OK_response.freeze new file mode 100644 index 00000000000..10f2fc79bd8 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_start_month_returns_OK_response.freeze @@ -0,0 +1 @@ +2022-11-03T21:02:59.317Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_start_month_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_start_month_returns_OK_response.yaml new file mode 100644 index 00000000000..b98e6dc5d91 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Usage_Metering/Scenario_GetEstimatedCostByOrg_with_start_month_returns_OK_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json;datetime-format=rfc3339 + method: GET + url: https://api.datadoghq.com/api/v2/usage/estimated_cost?start_month=2022-11-03T21%3A02%3A59.317Z&view=sub-org + response: + body: '{"data":[]} + + ' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +version: 1 diff --git a/tests/scenarios/features/v2/usage_metering.feature b/tests/scenarios/features/v2/usage_metering.feature index 11ec67a035f..20376e778ac 100644 --- a/tests/scenarios/features/v2/usage_metering.feature +++ b/tests/scenarios/features/v2/usage_metering.feature @@ -166,23 +166,15 @@ Feature: Usage Metering Scenario: GetEstimatedCostByOrg with both start_month and start_date returns "Bad Request" response Given new "GetEstimatedCostByOrg" request And request contains "view" parameter with value "sub-org" - And request contains "start_month" parameter with value "{{ timeISO('now - 3d') }}" + And request contains "start_month" parameter with value "{{ timeISO('now') }}" And request contains "start_date" parameter with value "{{ timeISO('now - 3d') }}" When the request is sent Then the response status is 400 Bad Request @replay-only @team:DataDog/red-zone-revenue-query - Scenario: GetEstimatedCostByOrg with start_date returns "OK" response - Given new "GetEstimatedCostByOrg" request - And request contains "view" parameter with value "sub-org" - And request contains "start_date" parameter with value "{{ timeISO('now - 5d') }}" - When the request is sent - Then the response status is 200 OK - - @skip @team:DataDog/red-zone-revenue-query Scenario: GetEstimatedCostByOrg with start_month returns "OK" response Given new "GetEstimatedCostByOrg" request And request contains "view" parameter with value "sub-org" - And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}" + And request contains "start_month" parameter with value "{{ timeISO('now') }}" When the request is sent Then the response status is 200 OK