From 757d378f8482523543806acdb77b1922509d3189 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 21 Nov 2025 12:24:16 +0000 Subject: [PATCH] Regenerate client from commit 1943b0b of spec repo --- .generator/schemas/v2/openapi.yaml | 52 +++++ features/v2/deployment_gates.feature | 17 ++ features/v2/undo.json | 6 + .../src/support/scenarios_model_mapping.ts | 7 + .../src/v2/DeploymentGatesApi.ts | 183 ++++++++++++++++++ services/deployment_gates/src/v2/index.ts | 2 + .../v2/models/DeploymentGateRulesResponse.ts | 43 ++++ .../src/v2/models/TypingInfo.ts | 2 + 8 files changed, 312 insertions(+) create mode 100644 services/deployment_gates/src/v2/models/DeploymentGateRulesResponse.ts diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb715496a..746ddbe0fcb3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16644,6 +16644,14 @@ components: required: - id type: object + DeploymentGateRulesResponse: + description: Response for a deployment gate rules. + properties: + data: + items: + $ref: '#/components/schemas/DeploymentRuleResponseData' + type: array + type: object DeploymentMetadata: description: Metadata object containing the publication creation information. properties: @@ -64391,6 +64399,50 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/deployment_gates/{gate_id}/rules: + get: + description: Endpoint to get rules for a deployment gate. + operationId: GetDeploymentGateRules + parameters: + - description: The ID of the deployment gate. + in: path + name: gate_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentGateRulesResponse' + description: OK + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get rules for a deployment gate + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_read + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' post: description: Endpoint to create a deployment rule. A gate for the rule must already exist. diff --git a/features/v2/deployment_gates.feature b/features/v2/deployment_gates.feature index e4023c5650b1..cb0c5a1262d6 100644 --- a/features/v2/deployment_gates.feature +++ b/features/v2/deployment_gates.feature @@ -207,6 +207,23 @@ Feature: Deployment Gates When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get rules for a deployment gate returns "Bad request." response + Given operation "GetDeploymentGateRules" enabled + And new "GetDeploymentGateRules" request + And request contains "gate_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request. + + @team:DataDog/ci-app-backend + Scenario: Get rules for a deployment gate returns "OK" response + Given there is a valid "deployment_gate" in the system + And operation "GetDeploymentGateRules" enabled + And new "GetDeploymentGateRules" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + When the request is sent + Then the response status is 200 OK + @team:DataDog/ci-app-backend Scenario: Update deployment gate returns "Bad Request" response Given operation "UpdateDeploymentGate" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 3799e64e630d..619834eec839 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1323,6 +1323,12 @@ "type": "unsafe" } }, + "GetDeploymentGateRules": { + "tag": "Deployment Gates", + "undo": { + "type": "safe" + } + }, "CreateDeploymentRule": { "tag": "Deployment Gates", "undo": { diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index a918b3e7a5c9..4047a771cad6 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -5330,6 +5330,13 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "DeploymentGateResponse", }, + "DeploymentGatesApi.V2.GetDeploymentGateRules": { + gateId: { + type: "string", + format: "", + }, + operationResponseType: "DeploymentGateRulesResponse", + }, "DeploymentGatesApi.V2.CreateDeploymentRule": { gateId: { type: "string", diff --git a/services/deployment_gates/src/v2/DeploymentGatesApi.ts b/services/deployment_gates/src/v2/DeploymentGatesApi.ts index 7072e65499f8..d0a4c7927936 100644 --- a/services/deployment_gates/src/v2/DeploymentGatesApi.ts +++ b/services/deployment_gates/src/v2/DeploymentGatesApi.ts @@ -26,6 +26,7 @@ import { APIErrorResponse } from "./models/APIErrorResponse"; import { CreateDeploymentGateParams } from "./models/CreateDeploymentGateParams"; import { CreateDeploymentRuleParams } from "./models/CreateDeploymentRuleParams"; import { DeploymentGateResponse } from "./models/DeploymentGateResponse"; +import { DeploymentGateRulesResponse } from "./models/DeploymentGateRulesResponse"; import { DeploymentRuleResponse } from "./models/DeploymentRuleResponse"; import { HTTPCDGatesBadRequestResponse } from "./models/HTTPCDGatesBadRequestResponse"; import { HTTPCDGatesNotFoundResponse } from "./models/HTTPCDGatesNotFoundResponse"; @@ -330,6 +331,60 @@ export class DeploymentGatesApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async getDeploymentGateRules( + gateId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "DeploymentGatesApi.v2.getDeploymentGateRules" + ] + ) { + throw new Error( + "Unstable operation 'getDeploymentGateRules' is disabled. Enable it by setting `configuration.unstableOperations['DeploymentGatesApi.v2.getDeploymentGateRules'] = true`", + ); + } + + // verify required parameter 'gateId' is not null or undefined + if (gateId === null || gateId === undefined) { + throw new RequiredError("gateId", "getDeploymentGateRules"); + } + + // Path Params + const localVarPath = "/api/v2/deployment_gates/{gate_id}/rules".replace( + "{gate_id}", + encodeURIComponent(String(gateId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "DeploymentGatesApi.v2.getDeploymentGateRules", + DeploymentGatesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async getDeploymentRule( gateId: string, id: string, @@ -1060,6 +1115,105 @@ export class DeploymentGatesApiResponseProcessor { ); } + /** + * 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 getDeploymentGateRules + * @throws ApiException if the response code was not in [200, 299] + */ + public async getDeploymentGateRules( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: DeploymentGateRulesResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "DeploymentGateRulesResponse", + ) as DeploymentGateRulesResponse; + return body; + } + if (response.httpStatusCode === 400) { + const bodyText = parse(await response.body.text(), contentType); + let body: HTTPCDGatesBadRequestResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "HTTPCDGatesBadRequestResponse", + ) as HTTPCDGatesBadRequestResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if ( + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + if (response.httpStatusCode === 500) { + const bodyText = parse(await response.body.text(), contentType); + let body: HTTPCIAppErrors; + try { + body = deserialize( + bodyText, + TypingInfo, + "HTTPCIAppErrors", + ) as HTTPCIAppErrors; + } 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) { + const body: DeploymentGateRulesResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "DeploymentGateRulesResponse", + "", + ) as DeploymentGateRulesResponse; + return body; + } + + 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 @@ -1469,6 +1623,14 @@ export interface DeploymentGatesApiGetDeploymentGateRequest { id: string; } +export interface DeploymentGatesApiGetDeploymentGateRulesRequest { + /** + * The ID of the deployment gate. + * @type string + */ + gateId: string; +} + export interface DeploymentGatesApiGetDeploymentRuleRequest { /** * The ID of the deployment gate. @@ -1638,6 +1800,27 @@ export class DeploymentGatesApi { }); } + /** + * Endpoint to get rules for a deployment gate. + * @param param The request object + */ + public getDeploymentGateRules( + param: DeploymentGatesApiGetDeploymentGateRulesRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.getDeploymentGateRules( + param.gateId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getDeploymentGateRules(responseContext); + }); + }); + } + /** * Endpoint to get a deployment rule. * @param param The request object diff --git a/services/deployment_gates/src/v2/index.ts b/services/deployment_gates/src/v2/index.ts index 39795012091b..de18c8169ccb 100644 --- a/services/deployment_gates/src/v2/index.ts +++ b/services/deployment_gates/src/v2/index.ts @@ -4,6 +4,7 @@ export { DeploymentGatesApiDeleteDeploymentGateRequest, DeploymentGatesApiDeleteDeploymentRuleRequest, DeploymentGatesApiGetDeploymentGateRequest, + DeploymentGatesApiGetDeploymentGateRulesRequest, DeploymentGatesApiGetDeploymentRuleRequest, DeploymentGatesApiUpdateDeploymentGateRequest, DeploymentGatesApiUpdateDeploymentRuleRequest, @@ -23,6 +24,7 @@ export { DeploymentGateResponseData } from "./models/DeploymentGateResponseData" export { DeploymentGateResponseDataAttributes } from "./models/DeploymentGateResponseDataAttributes"; export { DeploymentGateResponseDataAttributesCreatedBy } from "./models/DeploymentGateResponseDataAttributesCreatedBy"; export { DeploymentGateResponseDataAttributesUpdatedBy } from "./models/DeploymentGateResponseDataAttributesUpdatedBy"; +export { DeploymentGateRulesResponse } from "./models/DeploymentGateRulesResponse"; export { DeploymentRuleDataType } from "./models/DeploymentRuleDataType"; export { DeploymentRuleOptionsFaultyDeploymentDetection } from "./models/DeploymentRuleOptionsFaultyDeploymentDetection"; export { DeploymentRuleOptionsMonitor } from "./models/DeploymentRuleOptionsMonitor"; diff --git a/services/deployment_gates/src/v2/models/DeploymentGateRulesResponse.ts b/services/deployment_gates/src/v2/models/DeploymentGateRulesResponse.ts new file mode 100644 index 000000000000..982c029cf679 --- /dev/null +++ b/services/deployment_gates/src/v2/models/DeploymentGateRulesResponse.ts @@ -0,0 +1,43 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { DeploymentRuleResponseData } from "./DeploymentRuleResponseData"; + +/** + * Response for a deployment gate rules. + */ +export class DeploymentGateRulesResponse { + "data"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DeploymentGateRulesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/deployment_gates/src/v2/models/TypingInfo.ts b/services/deployment_gates/src/v2/models/TypingInfo.ts index 555c97f3f461..f2838e8e733c 100644 --- a/services/deployment_gates/src/v2/models/TypingInfo.ts +++ b/services/deployment_gates/src/v2/models/TypingInfo.ts @@ -12,6 +12,7 @@ import { DeploymentGateResponseData } from "./DeploymentGateResponseData"; import { DeploymentGateResponseDataAttributes } from "./DeploymentGateResponseDataAttributes"; import { DeploymentGateResponseDataAttributesCreatedBy } from "./DeploymentGateResponseDataAttributesCreatedBy"; import { DeploymentGateResponseDataAttributesUpdatedBy } from "./DeploymentGateResponseDataAttributesUpdatedBy"; +import { DeploymentGateRulesResponse } from "./DeploymentGateRulesResponse"; import { DeploymentRuleOptionsFaultyDeploymentDetection } from "./DeploymentRuleOptionsFaultyDeploymentDetection"; import { DeploymentRuleOptionsMonitor } from "./DeploymentRuleOptionsMonitor"; import { DeploymentRuleResponse } from "./DeploymentRuleResponse"; @@ -63,6 +64,7 @@ export const TypingInfo: ModelTypingInfo = { DeploymentGateResponseDataAttributesCreatedBy, DeploymentGateResponseDataAttributesUpdatedBy: DeploymentGateResponseDataAttributesUpdatedBy, + DeploymentGateRulesResponse: DeploymentGateRulesResponse, DeploymentRuleOptionsFaultyDeploymentDetection: DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor: DeploymentRuleOptionsMonitor,