diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f11972d91d04..3abfaf3ebf61 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -41880,6 +41880,83 @@ components: type: string x-enum-varnames: - PERMISSIONS + PostmortemAttachmentRequest: + properties: + data: + $ref: '#/components/schemas/PostmortemAttachmentRequestData' + required: + - data + type: object + PostmortemAttachmentRequestAttributes: + description: Postmortem attachment attributes + properties: + cells: + description: The cells of the postmortem + items: + $ref: '#/components/schemas/PostmortemCell' + type: array + content: + description: The content of the postmortem + example: '# Incident Report - IR-123 + + [...]' + type: string + postmortem_template_id: + description: The ID of the postmortem template + example: 93645509-874e-45c4-adfa-623bfeaead89-123 + type: string + title: + description: The title of the postmortem + example: Postmortem-IR-123 + type: string + type: object + PostmortemAttachmentRequestData: + description: Postmortem attachment data + properties: + attributes: + $ref: '#/components/schemas/PostmortemAttachmentRequestAttributes' + type: + $ref: '#/components/schemas/IncidentAttachmentType' + required: + - type + - attributes + type: object + PostmortemCell: + description: A cell in the postmortem + properties: + attributes: + $ref: '#/components/schemas/PostmortemCellAttributes' + id: + description: The unique identifier of the cell + example: cell-1 + type: string + type: + $ref: '#/components/schemas/PostmortemCellType' + type: object + PostmortemCellAttributes: + description: Attributes of a postmortem cell + properties: + definition: + $ref: '#/components/schemas/PostmortemCellDefinition' + type: object + PostmortemCellDefinition: + description: Definition of a postmortem cell + properties: + content: + description: The content of the cell in markdown format + example: '## Incident Summary + + This incident was caused by...' + type: string + type: object + PostmortemCellType: + description: The postmortem cell resource type. + enum: + - markdown + example: markdown + type: string + x-enum-varnames: + - MARKDOWN Powerpack: description: Powerpacks are templated groups of dashboard widgets you can save from an existing dashboard and turn into reusable packs in the widget tray. @@ -71685,6 +71762,46 @@ paths: - incident_write x-unstable: '**Note**: This endpoint is in Preview. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/attachments/postmortems: + post: + description: Create a postmortem attachment for an incident. + operationId: CreateIncidentPostmortemAttachment + parameters: + - description: The ID of the incident + in: path + name: incident_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemAttachmentRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/Attachment' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create postmortem attachment + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in public beta and it''s subject to + change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/{incident_id}/attachments/{attachment_id}: delete: diff --git a/examples/v2/incidents/CreateIncidentPostmortemAttachment.rb b/examples/v2/incidents/CreateIncidentPostmortemAttachment.rb new file mode 100644 index 000000000000..00a7b70a65e3 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentPostmortemAttachment.rb @@ -0,0 +1,30 @@ +# Create postmortem attachment returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_incident_postmortem_attachment".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::PostmortemAttachmentRequest.new({ + data: DatadogAPIClient::V2::PostmortemAttachmentRequestData.new({ + attributes: DatadogAPIClient::V2::PostmortemAttachmentRequestAttributes.new({ + cells: [ + DatadogAPIClient::V2::PostmortemCell.new({ + attributes: DatadogAPIClient::V2::PostmortemCellAttributes.new({ + definition: DatadogAPIClient::V2::PostmortemCellDefinition.new({ + content: '## Incident Summary\nThis incident was caused by...', + }), + }), + id: "cell-1", + type: DatadogAPIClient::V2::PostmortemCellType::MARKDOWN, + }), + ], + content: '# Incident Report - IR-123\n[...]', + postmortem_template_id: "93645509-874e-45c4-adfa-623bfeaead89-123", + title: "Postmortem-IR-123", + }), + type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS, + }), +}) +p api_instance.create_incident_postmortem_attachment("00000000-0000-0000-0000-000000000000", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 909e6202543f..a0f480622dbc 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2140,6 +2140,10 @@ "include" => "String", "body" => "CreateAttachmentRequest", }, + "v2.CreateIncidentPostmortemAttachment" => { + "incident_id" => "String", + "body" => "PostmortemAttachmentRequest", + }, "v2.DeleteIncidentAttachment" => { "incident_id" => "String", "attachment_id" => "Object", diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index a101f5f4af44..23e5882fa750 100644 --- a/features/v2/incidents.feature +++ b/features/v2/incidents.feature @@ -253,6 +253,24 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem attachment returns "Bad Request" response + Given operation "CreateIncidentPostmortemAttachment" enabled + And new "CreateIncidentPostmortemAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"content": "## Incident Summary\nThis incident was caused by..."}}, "id": "cell-1", "type": "markdown"}], "content": "# Incident Report - IR-123\n[...]", "postmortem_template_id": "93645509-874e-45c4-adfa-623bfeaead89-123", "title": "Postmortem-IR-123"}, "type": "incident_attachments"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem attachment returns "Created" response + Given operation "CreateIncidentPostmortemAttachment" enabled + And new "CreateIncidentPostmortemAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"content": "## Incident Summary\nThis incident was caused by..."}}, "id": "cell-1", "type": "markdown"}], "content": "# Incident Report - IR-123\n[...]", "postmortem_template_id": "93645509-874e-45c4-adfa-623bfeaead89-123", "title": "Postmortem-IR-123"}, "type": "incident_attachments"}} + When the request is sent + Then the response status is 201 Created + @generated @skip @team:Datadog/incident-app Scenario: Delete a notification template returns "Bad Request" response Given operation "DeleteIncidentNotificationTemplate" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 421fd8933730..59046d30f0b6 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1734,6 +1734,14 @@ "type": "unsafe" } }, + "CreateIncidentPostmortemAttachment": { + "tag": "Incidents", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, "DeleteIncidentAttachment": { "tag": "Incidents", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index cdd2bdf2c018..a050d85bf5a8 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -253,6 +253,7 @@ def initialize "v2.create_incident_integration": false, "v2.create_incident_notification_rule": false, "v2.create_incident_notification_template": false, + "v2.create_incident_postmortem_attachment": false, "v2.create_incident_todo": false, "v2.create_incident_type": false, "v2.delete_incident": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 5cfdf83ee17c..76c337d245ca 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3561,6 +3561,13 @@ def overrides "v2.permission_attributes" => "PermissionAttributes", "v2.permissions_response" => "PermissionsResponse", "v2.permissions_type" => "PermissionsType", + "v2.postmortem_attachment_request" => "PostmortemAttachmentRequest", + "v2.postmortem_attachment_request_attributes" => "PostmortemAttachmentRequestAttributes", + "v2.postmortem_attachment_request_data" => "PostmortemAttachmentRequestData", + "v2.postmortem_cell" => "PostmortemCell", + "v2.postmortem_cell_attributes" => "PostmortemCellAttributes", + "v2.postmortem_cell_definition" => "PostmortemCellDefinition", + "v2.postmortem_cell_type" => "PostmortemCellType", "v2.powerpack" => "Powerpack", "v2.powerpack_attributes" => "PowerpackAttributes", "v2.powerpack_data" => "PowerpackData", diff --git a/lib/datadog_api_client/v2/api/incidents_api.rb b/lib/datadog_api_client/v2/api/incidents_api.rb index ca8a628c1db8..9f76aa5e4ea7 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -474,6 +474,84 @@ def create_incident_notification_template_with_http_info(body, opts = {}) return data, status_code, headers end + # Create postmortem attachment. + # + # @see #create_incident_postmortem_attachment_with_http_info + def create_incident_postmortem_attachment(incident_id, body, opts = {}) + data, _status_code, _headers = create_incident_postmortem_attachment_with_http_info(incident_id, body, opts) + data + end + + # Create postmortem attachment. + # + # Create a postmortem attachment for an incident. + # + # @param incident_id [String] The ID of the incident + # @param body [PostmortemAttachmentRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(Attachment, Integer, Hash)>] Attachment data, response status code and response headers + def create_incident_postmortem_attachment_with_http_info(incident_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_postmortem_attachment".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_postmortem_attachment") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_postmortem_attachment")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_postmortem_attachment ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.create_incident_postmortem_attachment" + 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 IncidentsAPI.create_incident_postmortem_attachment" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/attachments/postmortems'.sub('{incident_id}', CGI.escape(incident_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(['application/json']) + # 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] || 'Attachment' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_incident_postmortem_attachment, + :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::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#create_incident_postmortem_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create an incident todo. # # @see #create_incident_todo_with_http_info diff --git a/lib/datadog_api_client/v2/models/postmortem_attachment_request.rb b/lib/datadog_api_client/v2/models/postmortem_attachment_request.rb new file mode 100644 index 000000000000..47280012f206 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_attachment_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 + # + class PostmortemAttachmentRequest + include BaseGenericModel + + # Postmortem attachment data + 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' => :'PostmortemAttachmentRequestData' + } + 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::PostmortemAttachmentRequest` 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/postmortem_attachment_request_attributes.rb b/lib/datadog_api_client/v2/models/postmortem_attachment_request_attributes.rb new file mode 100644 index 000000000000..5fb6b224dddb --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_attachment_request_attributes.rb @@ -0,0 +1,137 @@ +=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 + # Postmortem attachment attributes + class PostmortemAttachmentRequestAttributes + include BaseGenericModel + + # The cells of the postmortem + attr_accessor :cells + + # The content of the postmortem + attr_accessor :content + + # The ID of the postmortem template + attr_accessor :postmortem_template_id + + # The title of the postmortem + attr_accessor :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'cells' => :'cells', + :'content' => :'content', + :'postmortem_template_id' => :'postmortem_template_id', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'cells' => :'Array', + :'content' => :'String', + :'postmortem_template_id' => :'String', + :'title' => :'String' + } + 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::PostmortemAttachmentRequestAttributes` 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?(:'cells') + if (value = attributes[:'cells']).is_a?(Array) + self.cells = value + end + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'postmortem_template_id') + self.postmortem_template_id = attributes[:'postmortem_template_id'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + 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 && + cells == o.cells && + content == o.content && + postmortem_template_id == o.postmortem_template_id && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [cells, content, postmortem_template_id, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/postmortem_attachment_request_data.rb b/lib/datadog_api_client/v2/models/postmortem_attachment_request_data.rb new file mode 100644 index 000000000000..227f3b3ae76e --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_attachment_request_data.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 + # Postmortem attachment data + class PostmortemAttachmentRequestData + include BaseGenericModel + + # Postmortem attachment attributes + attr_reader :attributes + + # The incident attachment resource type. + 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', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PostmortemAttachmentRequestAttributes', + :'type' => :'IncidentAttachmentType' + } + 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::PostmortemAttachmentRequestData` 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?(:'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 @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 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 && + 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, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/postmortem_cell.rb b/lib/datadog_api_client/v2/models/postmortem_cell.rb new file mode 100644 index 000000000000..3c42d770d377 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_cell.rb @@ -0,0 +1,125 @@ +=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 + # A cell in the postmortem + class PostmortemCell + include BaseGenericModel + + # Attributes of a postmortem cell + attr_accessor :attributes + + # The unique identifier of the cell + attr_accessor :id + + # The postmortem cell resource type. + attr_accessor :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' => :'PostmortemCellAttributes', + :'id' => :'String', + :'type' => :'PostmortemCellType' + } + 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::PostmortemCell` 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 + + # 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/postmortem_cell_attributes.rb b/lib/datadog_api_client/v2/models/postmortem_cell_attributes.rb new file mode 100644 index 000000000000..1d296c6ed914 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_cell_attributes.rb @@ -0,0 +1,105 @@ +=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 of a postmortem cell + class PostmortemCellAttributes + include BaseGenericModel + + # Definition of a postmortem cell + attr_accessor :definition + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'definition' => :'definition' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'definition' => :'PostmortemCellDefinition' + } + 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::PostmortemCellAttributes` 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?(:'definition') + self.definition = attributes[:'definition'] + 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 && + definition == o.definition && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [definition, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/postmortem_cell_definition.rb b/lib/datadog_api_client/v2/models/postmortem_cell_definition.rb new file mode 100644 index 000000000000..79d791c56143 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_cell_definition.rb @@ -0,0 +1,105 @@ +=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 + # Definition of a postmortem cell + class PostmortemCellDefinition + include BaseGenericModel + + # The content of the cell in markdown format + attr_accessor :content + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'content' => :'content' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'content' => :'String' + } + 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::PostmortemCellDefinition` 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?(:'content') + self.content = attributes[:'content'] + 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 && + content == o.content && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [content, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/postmortem_cell_type.rb b/lib/datadog_api_client/v2/models/postmortem_cell_type.rb new file mode 100644 index 000000000000..f8c9fea32a73 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_cell_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 + # The postmortem cell resource type. + class PostmortemCellType + include BaseEnumModel + + MARKDOWN = "markdown".freeze + end +end