diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 147e01bf6b94..17d8b9eef1df 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16975,6 +16975,89 @@ components: - started_at - finished_at type: object + DORADeploymentPatchRemediation: + description: Remediation details for the deployment. + properties: + id: + description: The ID of the remediation action. + example: eG42zNIkVjM + type: string + type: + $ref: '#/components/schemas/DORADeploymentPatchRemediationType' + required: + - id + - type + type: object + DORADeploymentPatchRemediationType: + description: The type of remediation action taken. + enum: + - rollback + - rollforward + example: rollback + type: string + x-enum-varnames: + - ROLLBACK + - ROLLFORWARD + DORADeploymentPatchRequest: + description: Request to patch a DORA deployment event. + example: + data: + attributes: + change_failure: true + remediation: + id: eG42zNIkVjM + type: rollback + id: z_RwVLi7v4Y + type: dora_deployment_patch_request + properties: + data: + $ref: '#/components/schemas/DORADeploymentPatchRequestData' + required: + - data + type: object + DORADeploymentPatchRequestAttributes: + description: Attributes for patching a DORA deployment event. + properties: + change_failure: + description: Indicates whether the deployment resulted in a change failure. + example: true + type: boolean + remediation: + $ref: '#/components/schemas/DORADeploymentPatchRemediation' + type: object + DORADeploymentPatchRequestData: + description: The JSON:API data for patching a deployment. + example: + attributes: + change_failure: true + remediation: + id: eG42zNIkVjM + type: rollback + id: z_RwVLi7v4Y + type: dora_deployment_patch_request + properties: + attributes: + $ref: '#/components/schemas/DORADeploymentPatchRequestAttributes' + id: + description: The ID of the deployment to patch. + example: z_RwVLi7v4Y + type: string + type: + $ref: '#/components/schemas/DORADeploymentPatchRequestDataType' + required: + - type + - id + - attributes + type: object + DORADeploymentPatchRequestDataType: + default: dora_deployment_patch_request + description: JSON:API type for DORA deployment patch request. + enum: + - dora_deployment_patch_request + example: dora_deployment_patch_request + type: string + x-enum-varnames: + - DORA_DEPLOYMENT_PATCH_REQUEST DORADeploymentRequest: description: Request to create a DORA deployment event. properties: @@ -74157,6 +74240,46 @@ paths: operator: OR permissions: - dora_metrics_read + patch: + description: Use this API endpoint to patch a deployment event. + operationId: PatchDORADeployment + parameters: + - description: The ID of the deployment event. + in: path + name: deployment_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DORADeploymentPatchRequest' + required: true + 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: Patch a deployment event + tags: + - DORA Metrics + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - dora_metrics_write /api/v2/dora/failure: post: description: 'Use this API endpoint to provide failure data. diff --git a/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Accepted-response.frozen b/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Accepted-response.frozen new file mode 100644 index 000000000000..53c8b2fcbba8 --- /dev/null +++ b/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Accepted-response.frozen @@ -0,0 +1 @@ +2026-01-29T09:25:52.032Z \ No newline at end of file diff --git a/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Accepted-response.yml b/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Accepted-response.yml new file mode 100644 index 000000000000..a7f7b658ea97 --- /dev/null +++ b/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Accepted-response.yml @@ -0,0 +1,46 @@ +http_interactions: +- recorded_at: Thu, 29 Jan 2026 09:25:52 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"finished_at":1769678752000000000,"git":{"commit_sha":"66adc9350f2cc9b250b69abddab733dd55e1a588","repository_url":"https://github.com/organization/example-repository"},"id":"08a3dbc57bb781a5","service":"shopist","started_at":1769675152000000000,"version":"v1.12.07"}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/dora/deployment + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"08a3dbc57bb781a5","type":"dora_deployment"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Thu, 29 Jan 2026 09:25:52 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"change_failure":true,"remediation":{"id":"eG42zNIkVjM","type":"rollback"}},"id":"08a3dbc57bb781a5","type":"dora_deployment_patch_request"}}' + headers: + Accept: + - '*/*' + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/dora/deployments/08a3dbc57bb781a5 + response: + body: + encoding: UTF-8 + string: '{"data":null}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Bad-Request-response.frozen b/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..52bae6cfe7f0 --- /dev/null +++ b/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2026-01-29T09:25:52.758Z \ No newline at end of file diff --git a/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Bad-Request-response.yml b/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..42d2217b355d --- /dev/null +++ b/cassettes/features/v2/dora_metrics/Patch-a-deployment-event-returns-Bad-Request-response.yml @@ -0,0 +1,47 @@ +http_interactions: +- recorded_at: Thu, 29 Jan 2026 09:25:52 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"finished_at":1769678752000000000,"git":{"commit_sha":"66adc9350f2cc9b250b69abddab733dd55e1a588","repository_url":"https://github.com/organization/example-repository"},"id":"bf100f167795c925","service":"shopist","started_at":1769675152000000000,"version":"v1.12.07"}}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/dora/deployment + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"bf100f167795c925","type":"dora_deployment"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Thu, 29 Jan 2026 09:25:52 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"change_failure":true,"remediation":{"id":"eG42zNIkVjM","type":"wrong_type"}},"id":"bf100f167795c925","type":"dora_deployment_patch_request"}}' + headers: + Accept: + - '*/*' + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/dora/deployments/bf100f167795c925 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"type\" must be one of \"rollback rollforward\""}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/examples/v2/dora-metrics/PatchDORADeployment.rb b/examples/v2/dora-metrics/PatchDORADeployment.rb new file mode 100644 index 000000000000..a61a3907ebb3 --- /dev/null +++ b/examples/v2/dora-metrics/PatchDORADeployment.rb @@ -0,0 +1,19 @@ +# Patch a deployment event returns "Accepted" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DORAMetricsAPI.new + +body = DatadogAPIClient::V2::DORADeploymentPatchRequest.new({ + data: DatadogAPIClient::V2::DORADeploymentPatchRequestData.new({ + attributes: DatadogAPIClient::V2::DORADeploymentPatchRequestAttributes.new({ + change_failure: true, + remediation: DatadogAPIClient::V2::DORADeploymentPatchRemediation.new({ + id: "eG42zNIkVjM", + type: DatadogAPIClient::V2::DORADeploymentPatchRemediationType::ROLLBACK, + }), + }), + id: "z_RwVLi7v4Y", + type: DatadogAPIClient::V2::DORADeploymentPatchRequestDataType::DORA_DEPLOYMENT_PATCH_REQUEST, + }), +}) +p api_instance.patch_dora_deployment("deployment_id", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 6674c3b1a047..11103315e1fe 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1981,6 +1981,10 @@ "v2.GetDORADeployment" => { "deployment_id" => "String", }, + "v2.PatchDORADeployment" => { + "deployment_id" => "String", + "body" => "DORADeploymentPatchRequest", + }, "v2.CreateDORAFailure" => { "body" => "DORAFailureRequest", }, diff --git a/features/v2/dora_metrics.feature b/features/v2/dora_metrics.feature index b11b0fc74df5..7a3275b54bf7 100644 --- a/features/v2/dora_metrics.feature +++ b/features/v2/dora_metrics.feature @@ -104,6 +104,24 @@ Feature: DORA Metrics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ci-app-backend + Scenario: Patch a deployment event returns "Accepted" response + Given a valid "appKeyAuth" key in the system + And new "PatchDORADeployment" request + And request contains "deployment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"change_failure": true, "remediation": {"id": "eG42zNIkVjM", "type": "rollback"}}, "id": "z_RwVLi7v4Y", "type": "dora_deployment_patch_request"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Patch a deployment event returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "PatchDORADeployment" request + And request contains "deployment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"change_failure": true, "remediation": {"id": "eG42zNIkVjM", "type": "rollback"}}, "id": "z_RwVLi7v4Y", "type": "dora_deployment_patch_request"}} + When the request is sent + Then the response status is 400 Bad Request + @skip @team:DataDog/ci-app-backend Scenario: Send a deployment event returns "Bad Request" response Given new "CreateDORADeployment" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 5a347bddf111..307294e0212a 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1448,6 +1448,12 @@ "type": "safe" } }, + "PatchDORADeployment": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "CreateDORAFailure": { "tag": "DORA Metrics", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1b7a7bac0e8b..05b2bd7fda00 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2083,6 +2083,12 @@ def overrides "v2.dora_deployment_fetch_response" => "DORADeploymentFetchResponse", "v2.dora_deployment_object" => "DORADeploymentObject", "v2.dora_deployment_object_attributes" => "DORADeploymentObjectAttributes", + "v2.dora_deployment_patch_remediation" => "DORADeploymentPatchRemediation", + "v2.dora_deployment_patch_remediation_type" => "DORADeploymentPatchRemediationType", + "v2.dora_deployment_patch_request" => "DORADeploymentPatchRequest", + "v2.dora_deployment_patch_request_attributes" => "DORADeploymentPatchRequestAttributes", + "v2.dora_deployment_patch_request_data" => "DORADeploymentPatchRequestData", + "v2.dora_deployment_patch_request_data_type" => "DORADeploymentPatchRequestDataType", "v2.dora_deployment_request" => "DORADeploymentRequest", "v2.dora_deployment_request_attributes" => "DORADeploymentRequestAttributes", "v2.dora_deployment_request_data" => "DORADeploymentRequestData", diff --git a/lib/datadog_api_client/v2/api/dora_metrics_api.rb b/lib/datadog_api_client/v2/api/dora_metrics_api.rb index 7ca71f17eae0..efa4afb3422b 100644 --- a/lib/datadog_api_client/v2/api/dora_metrics_api.rb +++ b/lib/datadog_api_client/v2/api/dora_metrics_api.rb @@ -635,5 +635,77 @@ def list_dora_failures_with_http_info(body, opts = {}) end return data, status_code, headers end + + # Patch a deployment event. + # + # @see #patch_dora_deployment_with_http_info + def patch_dora_deployment(deployment_id, body, opts = {}) + patch_dora_deployment_with_http_info(deployment_id, body, opts) + nil + end + + # Patch a deployment event. + # + # Use this API endpoint to patch a deployment event. + # + # @param deployment_id [String] The ID of the deployment event. + # @param body [DORADeploymentPatchRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def patch_dora_deployment_with_http_info(deployment_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DORAMetricsAPI.patch_dora_deployment ...' + end + # verify the required parameter 'deployment_id' is set + if @api_client.config.client_side_validation && deployment_id.nil? + fail ArgumentError, "Missing the required parameter 'deployment_id' when calling DORAMetricsAPI.patch_dora_deployment" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling DORAMetricsAPI.patch_dora_deployment" + end + # resource path + local_var_path = '/api/v2/dora/deployments/{deployment_id}'.sub('{deployment_id}', CGI.escape(deployment_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :patch_dora_deployment, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DORAMetricsAPI#patch_dora_deployment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_remediation.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_remediation.rb new file mode 100644 index 000000000000..ef2abc4afa0e --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_remediation.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Remediation details for the deployment. + class DORADeploymentPatchRemediation + include BaseGenericModel + + # The ID of the remediation action. + attr_reader :id + + # The type of remediation action taken. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'DORADeploymentPatchRemediationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DORADeploymentPatchRemediation` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_remediation_type.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_remediation_type.rb new file mode 100644 index 000000000000..ec7f461b8633 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_remediation_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of remediation action taken. + class DORADeploymentPatchRemediationType + include BaseEnumModel + + ROLLBACK = "rollback".freeze + ROLLFORWARD = "rollforward".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_request.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_request.rb new file mode 100644 index 000000000000..9df3c5c3f33c --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to patch a DORA deployment event. + class DORADeploymentPatchRequest + include BaseGenericModel + + # The JSON:API data for patching a deployment. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DORADeploymentPatchRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DORADeploymentPatchRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_request_attributes.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_request_attributes.rb new file mode 100644 index 000000000000..18489c1aac09 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_request_attributes.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for patching a DORA deployment event. + class DORADeploymentPatchRequestAttributes + include BaseGenericModel + + # Indicates whether the deployment resulted in a change failure. + attr_accessor :change_failure + + # Remediation details for the deployment. + attr_accessor :remediation + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_failure' => :'change_failure', + :'remediation' => :'remediation' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_failure' => :'Boolean', + :'remediation' => :'DORADeploymentPatchRemediation' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DORADeploymentPatchRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_failure') + self.change_failure = attributes[:'change_failure'] + end + + if attributes.key?(:'remediation') + self.remediation = attributes[:'remediation'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_failure == o.change_failure && + remediation == o.remediation && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_failure, remediation, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_request_data.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_request_data.rb new file mode 100644 index 000000000000..69fbbb4f6c60 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_request_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API data for patching a deployment. + class DORADeploymentPatchRequestData + include BaseGenericModel + + # Attributes for patching a DORA deployment event. + attr_reader :attributes + + # The ID of the deployment to patch. + attr_reader :id + + # JSON:API type for DORA deployment patch request. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'DORADeploymentPatchRequestAttributes', + :'id' => :'String', + :'type' => :'DORADeploymentPatchRequestDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DORADeploymentPatchRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_request_data_type.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_request_data_type.rb new file mode 100644 index 000000000000..f3cf5242b6f3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_request_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API type for DORA deployment patch request. + class DORADeploymentPatchRequestDataType + include BaseEnumModel + + DORA_DEPLOYMENT_PATCH_REQUEST = "dora_deployment_patch_request".freeze + end +end