From 1b2ecd92db5268e4a90db9aa8197ed26ec54c98f Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 4 Sep 2025 16:33:39 +0000 Subject: [PATCH] Regenerate client from commit dd160d0 of spec repo --- .generator/schemas/v2/openapi.yaml | 70 ++++- .../v2/dora-metrics/DeleteDORADeployment.ts | 21 ++ examples/v2/dora-metrics/DeleteDORAFailure.ts | 21 ++ features/support/scenarios_model_mapping.ts | 14 + features/v2/dora_metrics.feature | 28 +- features/v2/undo.json | 12 + .../apis/DORAMetricsApi.ts | 264 ++++++++++++++++++ packages/datadog-api-client-v2/index.ts | 2 + 8 files changed, 429 insertions(+), 3 deletions(-) create mode 100644 examples/v2/dora-metrics/DeleteDORADeployment.ts create mode 100644 examples/v2/dora-metrics/DeleteDORAFailure.ts diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b0d3125fb5b7..1944773f563f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -52524,6 +52524,39 @@ paths: permissions: - dora_metrics_read /api/v2/dora/deployments/{deployment_id}: + delete: + description: Use this API endpoint to delete a deployment event. + operationId: DeleteDORADeployment + parameters: + - description: The ID of the deployment event to delete. + in: path + name: deployment_id + required: true + schema: + type: string + responses: + '202': + description: Accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + - appKeyAuth: [] + summary: Delete a deployment event + tags: + - DORA Metrics + x-permission: + operator: OR + permissions: + - dora_metrics_write get: description: Use this API endpoint to get a deployment event. operationId: GetDORADeployment @@ -52647,6 +52680,39 @@ paths: permissions: - dora_metrics_read /api/v2/dora/failures/{failure_id}: + delete: + description: Use this API endpoint to delete a failure event. + operationId: DeleteDORAFailure + parameters: + - description: The ID of the failure event to delete. + in: path + name: failure_id + required: true + schema: + type: string + responses: + '202': + description: Accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + - appKeyAuth: [] + summary: Delete a failure event + tags: + - DORA Metrics + x-permission: + operator: OR + permissions: + - dora_metrics_write get: description: Use this API endpoint to get a failure event. operationId: GetDORAFailure @@ -70392,8 +70458,8 @@ tags: See the [Container Monitoring page](https://docs.datadoghq.com/containers/) for more information. name: Containers -- description: 'Search or send events for DORA Metrics to measure and improve your - software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/) +- description: 'Search, send or delete events for DORA Metrics to measure and improve + your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/) for more information. diff --git a/examples/v2/dora-metrics/DeleteDORADeployment.ts b/examples/v2/dora-metrics/DeleteDORADeployment.ts new file mode 100644 index 000000000000..aad70a692acf --- /dev/null +++ b/examples/v2/dora-metrics/DeleteDORADeployment.ts @@ -0,0 +1,21 @@ +/** + * Delete a deployment event returns "Accepted" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.DORAMetricsApi(configuration); + +const params: v2.DORAMetricsApiDeleteDORADeploymentRequest = { + deploymentId: "{unique_lower}", +}; + +apiInstance + .deleteDORADeployment(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/dora-metrics/DeleteDORAFailure.ts b/examples/v2/dora-metrics/DeleteDORAFailure.ts new file mode 100644 index 000000000000..9a2b49a7cf61 --- /dev/null +++ b/examples/v2/dora-metrics/DeleteDORAFailure.ts @@ -0,0 +1,21 @@ +/** + * Delete a failure event returns "Accepted" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.DORAMetricsApi(configuration); + +const params: v2.DORAMetricsApiDeleteDORAFailureRequest = { + failureId: "{unique_lower}", +}; + +apiInstance + .deleteDORAFailure(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 677ca5041177..6987d1658ce0 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -4801,6 +4801,13 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "DORAFetchResponse", }, + "v2.DeleteDORADeployment": { + "deploymentId": { + "type": "string", + "format": "", + }, + "operationResponseType": "{}", + }, "v2.CreateDORAFailure": { "body": { "type": "DORAFailureRequest", @@ -4822,6 +4829,13 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "DORAFetchResponse", }, + "v2.DeleteDORAFailure": { + "failureId": { + "type": "string", + "format": "", + }, + "operationResponseType": "{}", + }, "v2.CreateDORAIncident": { "body": { "type": "DORAFailureRequest", diff --git a/features/v2/dora_metrics.feature b/features/v2/dora_metrics.feature index acc8230e3616..9bbcc1fbf30d 100644 --- a/features/v2/dora_metrics.feature +++ b/features/v2/dora_metrics.feature @@ -1,6 +1,6 @@ @endpoint(dora-metrics) @endpoint(dora-metrics-v2) Feature: DORA Metrics - Search or send events for DORA Metrics to measure and improve your + Search, send or delete events for DORA Metrics to measure and improve your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/) for more information. **Note**: DORA Metrics are not available in the US1-FED site. @@ -9,6 +9,32 @@ Feature: DORA Metrics Given a valid "apiKeyAuth" key in the system And an instance of "DORAMetrics" API + @team:DataDog/ci-app-backend + Scenario: Delete a deployment event returns "Accepted" response + Given new "DeleteDORADeployment" request + And request contains "deployment_id" parameter with value "{unique_lower}" + When the request is sent + Then the response status is 202 Accepted + + @team:DataDog/ci-app-backend + Scenario: Delete a deployment event returns "Bad Request" response + Given new "DeleteDORADeployment" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/ci-app-backend + Scenario: Delete a failure event returns "Accepted" response + Given new "DeleteDORAFailure" request + And request contains "failure_id" parameter with value "{unique_lower}" + When the request is sent + Then the response status is 202 Accepted + + @team:DataDog/ci-app-backend + Scenario: Delete a failure event returns "Bad Request" response + Given new "DeleteDORAFailure" request + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/ci-app-backend Scenario: Get a deployment event returns "Bad Request" response Given new "GetDORADeployment" request diff --git a/features/v2/undo.json b/features/v2/undo.json index b3731714ef65..fba9377a4961 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -955,6 +955,12 @@ "type": "safe" } }, + "DeleteDORADeployment": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "GetDORADeployment": { "tag": "DORA Metrics", "undo": { @@ -973,6 +979,12 @@ "type": "safe" } }, + "DeleteDORAFailure": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "GetDORAFailure": { "tag": "DORA Metrics", "undo": { diff --git a/packages/datadog-api-client-v2/apis/DORAMetricsApi.ts b/packages/datadog-api-client-v2/apis/DORAMetricsApi.ts index 8a190b833726..3ce28acc0994 100644 --- a/packages/datadog-api-client-v2/apis/DORAMetricsApi.ts +++ b/packages/datadog-api-client-v2/apis/DORAMetricsApi.ts @@ -142,6 +142,72 @@ export class DORAMetricsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async deleteDORADeployment( + deploymentId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'deploymentId' is not null or undefined + if (deploymentId === null || deploymentId === undefined) { + throw new RequiredError("deploymentId", "deleteDORADeployment"); + } + + // Path Params + const localVarPath = "/api/v2/dora/deployments/{deployment_id}".replace( + "{deployment_id}", + encodeURIComponent(String(deploymentId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.DORAMetricsApi.deleteDORADeployment") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async deleteDORAFailure( + failureId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'failureId' is not null or undefined + if (failureId === null || failureId === undefined) { + throw new RequiredError("failureId", "deleteDORAFailure"); + } + + // Path Params + const localVarPath = "/api/v2/dora/failures/{failure_id}".replace( + "{failure_id}", + encodeURIComponent(String(failureId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.DORAMetricsApi.deleteDORAFailure") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async getDORADeployment( deploymentId: string, _options?: Configuration @@ -535,6 +601,146 @@ export class DORAMetricsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteDORADeployment + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteDORADeployment(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 202) { + return; + } + if (response.httpStatusCode === 400) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 403 || response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteDORAFailure + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteDORAFailure(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 202) { + return; + } + if (response.httpStatusCode === 400) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 403 || response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -881,6 +1087,22 @@ export interface DORAMetricsApiCreateDORAIncidentRequest { body: DORAFailureRequest; } +export interface DORAMetricsApiDeleteDORADeploymentRequest { + /** + * The ID of the deployment event to delete. + * @type string + */ + deploymentId: string; +} + +export interface DORAMetricsApiDeleteDORAFailureRequest { + /** + * The ID of the failure event to delete. + * @type string + */ + failureId: string; +} + export interface DORAMetricsApiGetDORADeploymentRequest { /** * The ID of the deployment event. @@ -1006,6 +1228,48 @@ export class DORAMetricsApi { }); } + /** + * Use this API endpoint to delete a deployment event. + * @param param The request object + */ + public deleteDORADeployment( + param: DORAMetricsApiDeleteDORADeploymentRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.deleteDORADeployment( + param.deploymentId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteDORADeployment(responseContext); + }); + }); + } + + /** + * Use this API endpoint to delete a failure event. + * @param param The request object + */ + public deleteDORAFailure( + param: DORAMetricsApiDeleteDORAFailureRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.deleteDORAFailure( + param.failureId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteDORAFailure(responseContext); + }); + }); + } + /** * Use this API endpoint to get a deployment event. * @param param The request object diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index dd08ae93d91f..51c7647f9468 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -206,6 +206,8 @@ export { DORAMetricsApiCreateDORADeploymentRequest, DORAMetricsApiCreateDORAFailureRequest, DORAMetricsApiCreateDORAIncidentRequest, + DORAMetricsApiDeleteDORADeploymentRequest, + DORAMetricsApiDeleteDORAFailureRequest, DORAMetricsApiGetDORADeploymentRequest, DORAMetricsApiGetDORAFailureRequest, DORAMetricsApiListDORADeploymentsRequest,