From a9b5774e1721dda4c675f39af28914e883033a0d Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:18:27 +0000 Subject: [PATCH] [ECT-99] Add app key to post /api/v2/events (#2809) Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 ++++---- .generator/schemas/v2/openapi.yaml | 1 + api/datadogV2/api_events.go | 1 + tests/scenarios/features/v2/events.feature | 22 ++++++++-------------- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index e6a4b38daa2..0bf2ff11c35 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-26 13:36:08.732682", - "spec_repo_commit": "cf1aa5ea" + "regenerated": "2024-11-27 13:09:00.363837", + "spec_repo_commit": "fd3dd4d0" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-26 13:36:08.752592", - "spec_repo_commit": "cf1aa5ea" + "regenerated": "2024-11-27 13:09:00.383880", + "spec_repo_commit": "fd3dd4d0" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 581c73992ab..dbd569affab 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -31492,6 +31492,7 @@ paths: $ref: '#/components/responses/TooManyRequestsResponse' security: - apiKeyAuth: [] + appKeyAuth: [] summary: Post an event tags: - Events diff --git a/api/datadogV2/api_events.go b/api/datadogV2/api_events.go index 93b602e342c..ef3fb592aa6 100644 --- a/api/datadogV2/api_events.go +++ b/api/datadogV2/api_events.go @@ -45,6 +45,7 @@ func (a *EventsApi) CreateEvent(ctx _context.Context, body EventCreateRequestPay ctx, &localVarHeaderParams, [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, ) req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { diff --git a/tests/scenarios/features/v2/events.feature b/tests/scenarios/features/v2/events.feature index 2013c242f6c..eada249fd88 100644 --- a/tests/scenarios/features/v2/events.feature +++ b/tests/scenarios/features/v2/events.feature @@ -7,26 +7,24 @@ Feature: Events Background: Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system And an instance of "Events" API @generated @skip @team:DataDog/event-management Scenario: Get a list of events returns "Bad Request" response - Given a valid "appKeyAuth" key in the system - And new "ListEvents" request + Given new "ListEvents" request When the request is sent Then the response status is 400 Bad Request @skip-validation @team:DataDog/event-management Scenario: Get a list of events returns "OK" response - Given a valid "appKeyAuth" key in the system - And new "ListEvents" request + Given new "ListEvents" request When the request is sent Then the response status is 200 OK @replay-only @skip-validation @team:DataDog/event-management @with-pagination Scenario: Get a list of events returns "OK" response with pagination - Given a valid "appKeyAuth" key in the system - And new "ListEvents" request + Given new "ListEvents" request And request contains "filter[from]" parameter with value "now-15m" And request contains "filter[to]" parameter with value "now" And request contains "page[limit]" parameter with value 2 @@ -36,8 +34,7 @@ Feature: Events @team:DataDog/event-management Scenario: Get a quick list of events returns "OK" response - Given a valid "appKeyAuth" key in the system - And new "ListEvents" request + Given new "ListEvents" request And request contains "filter[query]" parameter with value "datadog-agent" And request contains "filter[from]" parameter with value "2020-09-17T11:48:36+01:00" And request contains "filter[to]" parameter with value "2020-09-17T12:48:36+01:00" @@ -62,16 +59,14 @@ Feature: Events @team:DataDog/event-management Scenario: Search events returns "Bad Request" response - Given a valid "appKeyAuth" key in the system - And new "SearchEvents" request + Given new "SearchEvents" request And body with value {"filter": {"from": "now-15m", "query": "service:web* AND @http.status_code:[200 TO 299]", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"} When the request is sent Then the response status is 400 Bad Request @team:DataDog/event-management Scenario: Search events returns "OK" response - Given a valid "appKeyAuth" key in the system - And new "SearchEvents" request + Given new "SearchEvents" request And body with value {"filter": {"query": "datadog-agent", "from": "2020-09-17T11:48:36+01:00", "to": "2020-09-17T12:48:36+01:00"}, "sort": "timestamp", "page": {"limit": 5}} When the request is sent Then the response status is 200 OK @@ -79,8 +74,7 @@ Feature: Events @replay-only @skip-validation @team:DataDog/event-management @with-pagination Scenario: Search events returns "OK" response with pagination - Given a valid "appKeyAuth" key in the system - And new "SearchEvents" request + Given new "SearchEvents" request And body with value {"filter": {"from": "now-15m", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"limit": 2}, "sort": "timestamp"} When the request with pagination is sent Then the response status is 200 OK