diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d3505929ef55..8a6b2eecc25b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21602,6 +21602,82 @@ components: - type - attributes type: object + IncidentCreatePageAttributes: + description: Attributes for creating a page from an incident. + properties: + description: + description: Description of the page. + example: Page created for incident response + nullable: true + type: string + services: + description: List of services associated with the page. + example: + - web-service + - api-service + items: + type: string + nullable: true + type: array + tags: + description: List of tags for the page. + example: + - urgent + - production + items: + type: string + nullable: true + type: array + target: + $ref: '#/components/schemas/IncidentPageTarget' + title: + description: Title of the page. + example: Incident Response Page + type: string + required: + - title + - target + type: object + IncidentCreatePageFromIncidentData: + description: Data for creating a page from an incident. + properties: + attributes: + $ref: '#/components/schemas/IncidentCreatePageAttributes' + type: + $ref: '#/components/schemas/IncidentPageType' + required: + - type + - attributes + type: object + IncidentCreatePageFromIncidentRequest: + description: Request to create a page from an incident. + properties: + data: + $ref: '#/components/schemas/IncidentCreatePageFromIncidentData' + required: + - data + type: object + IncidentCreatePageResponse: + description: Response from creating a page from an incident. + properties: + data: + $ref: '#/components/schemas/IncidentCreatePageResponseData' + required: + - data + type: object + IncidentCreatePageResponseData: + description: Data from creating a page. + properties: + id: + description: The UUID of the created page. + example: 00000000-0000-0000-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/IncidentPageIdType' + required: + - id + - type + type: object IncidentCreateRelationships: description: The relationships the incident will have with other resources once created. @@ -22586,6 +22662,48 @@ components: - id - type type: object + IncidentPageIdType: + description: Incident page ID type. + enum: + - page_uuid + example: page_uuid + type: string + x-enum-varnames: + - PAGE_UUID + IncidentPageTarget: + description: Target for creating a page from an incident. + properties: + identifier: + description: The identifier of the target (team handle, team UUID, or user + UUID). + example: team-handle + type: string + type: + $ref: '#/components/schemas/IncidentPageTargetType' + required: + - type + - identifier + type: object + IncidentPageTargetType: + description: Type of page target for incident pages. + enum: + - team_handle + - team_uuid + - user_uuid + example: team_handle + type: string + x-enum-varnames: + - TEAM_HANDLE + - TEAM_UUID + - USER_UUID + IncidentPageType: + description: Incident page type. + enum: + - page + example: page + type: string + x-enum-varnames: + - PAGE IncidentPostmortemType: default: incident_postmortems description: Incident postmortem resource type. @@ -50878,6 +50996,7 @@ components: is not required to set downtimes. monitors_read: View monitors. monitors_write: Edit, delete, and resolve individual monitors. + oncall_page: Create and manage on-call pages. org_connections_read: Read cross organization connections. org_connections_write: Create, edit, and delete cross organization connections. org_management: Edit org configurations, including authentication and @@ -59667,6 +59786,54 @@ paths: 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}/page: + post: + description: Create a page from an incident. + operationId: CreatePageFromIncident + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentCreatePageFromIncidentRequest' + description: Page creation request payload. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentCreatePageResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + - oncall_page + summary: Create a page from an incident + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - incident_read + - oncall_page + 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}/relationships/integrations: get: description: Get all integration metadata for an incident. diff --git a/examples/v2/incidents/CreatePageFromIncident.rb b/examples/v2/incidents/CreatePageFromIncident.rb new file mode 100644 index 000000000000..99feb4ae4bfa --- /dev/null +++ b/examples/v2/incidents/CreatePageFromIncident.rb @@ -0,0 +1,30 @@ +# Create a page from an incident returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_page_from_incident".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::IncidentCreatePageFromIncidentRequest.new({ + data: DatadogAPIClient::V2::IncidentCreatePageFromIncidentData.new({ + attributes: DatadogAPIClient::V2::IncidentCreatePageAttributes.new({ + description: "Page created for incident response", + services: [ + "web-service", + "api-service", + ], + tags: [ + "urgent", + "production", + ], + target: DatadogAPIClient::V2::IncidentPageTarget.new({ + identifier: "team-handle", + type: DatadogAPIClient::V2::IncidentPageTargetType::TEAM_HANDLE, + }), + title: "Incident Response Page", + }), + type: DatadogAPIClient::V2::IncidentPageType::PAGE, + }), +}) +p api_instance.create_page_from_incident("incident_id", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index bb9b639b4075..7af877405973 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1944,6 +1944,10 @@ "incident_id" => "String", "impact_id" => "String", }, + "v2.CreatePageFromIncident" => { + "incident_id" => "String", + "body" => "IncidentCreatePageFromIncidentRequest", + }, "v2.ListIncidentIntegrations" => { "incident_id" => "String", }, diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index 74ae965968fd..1b6eb3821ae1 100644 --- a/features/v2/incidents.feature +++ b/features/v2/incidents.feature @@ -21,6 +21,33 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "Bad Request" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "Not Found" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "OK" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Create an incident attachment returns "OK" response Given operation "UpdateIncidentAttachments" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 6fcf52fcedc9..985aaa0d7b35 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1423,6 +1423,13 @@ "type": "idempotent" } }, + "CreatePageFromIncident": { + "tag": "Incidents", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, "ListIncidentIntegrations": { "tag": "Incidents", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 7754333a417e..7a0589d6e4c4 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -227,6 +227,7 @@ def initialize "v2.create_incident_notification_template": false, "v2.create_incident_todo": false, "v2.create_incident_type": false, + "v2.create_page_from_incident": false, "v2.delete_incident": false, "v2.delete_incident_impact": false, "v2.delete_incident_integration": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 9abbf586d9ee..a86f3be3d953 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2223,6 +2223,11 @@ def overrides "v2.incident_attachment_update_response" => "IncidentAttachmentUpdateResponse", "v2.incident_create_attributes" => "IncidentCreateAttributes", "v2.incident_create_data" => "IncidentCreateData", + "v2.incident_create_page_attributes" => "IncidentCreatePageAttributes", + "v2.incident_create_page_from_incident_data" => "IncidentCreatePageFromIncidentData", + "v2.incident_create_page_from_incident_request" => "IncidentCreatePageFromIncidentRequest", + "v2.incident_create_page_response" => "IncidentCreatePageResponse", + "v2.incident_create_page_response_data" => "IncidentCreatePageResponseData", "v2.incident_create_relationships" => "IncidentCreateRelationships", "v2.incident_create_request" => "IncidentCreateRequest", "v2.incident_field_attributes" => "IncidentFieldAttributes", @@ -2286,6 +2291,10 @@ def overrides "v2.incident_notification_template_type" => "IncidentNotificationTemplateType", "v2.incident_notification_template_update_attributes" => "IncidentNotificationTemplateUpdateAttributes", "v2.incident_notification_template_update_data" => "IncidentNotificationTemplateUpdateData", + "v2.incident_page_id_type" => "IncidentPageIdType", + "v2.incident_page_target" => "IncidentPageTarget", + "v2.incident_page_target_type" => "IncidentPageTargetType", + "v2.incident_page_type" => "IncidentPageType", "v2.incident_postmortem_type" => "IncidentPostmortemType", "v2.incident_related_object" => "IncidentRelatedObject", "v2.incident_responders_type" => "IncidentRespondersType", diff --git a/lib/datadog_api_client/v2/api/incidents_api.rb b/lib/datadog_api_client/v2/api/incidents_api.rb index 32466309cba4..9e1d81af73be 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -551,6 +551,84 @@ def create_incident_type_with_http_info(body, opts = {}) return data, status_code, headers end + # Create a page from an incident. + # + # @see #create_page_from_incident_with_http_info + def create_page_from_incident(incident_id, body, opts = {}) + data, _status_code, _headers = create_page_from_incident_with_http_info(incident_id, body, opts) + data + end + + # Create a page from an incident. + # + # Create a page from an incident. + # + # @param incident_id [String] The UUID of the incident. + # @param body [IncidentCreatePageFromIncidentRequest] Page creation request payload. + # @param opts [Hash] the optional parameters + # @return [Array<(IncidentCreatePageResponse, Integer, Hash)>] IncidentCreatePageResponse data, response status code and response headers + def create_page_from_incident_with_http_info(incident_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_page_from_incident".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_page_from_incident") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_page_from_incident")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_page_from_incident ...' + 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_page_from_incident" + 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_page_from_incident" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/page'.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] || 'IncidentCreatePageResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_page_from_incident, + :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_page_from_incident\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete an existing incident. # # @see #delete_incident_with_http_info diff --git a/lib/datadog_api_client/v2/models/incident_create_page_attributes.rb b/lib/datadog_api_client/v2/models/incident_create_page_attributes.rb new file mode 100644 index 000000000000..0db28dd52216 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_create_page_attributes.rb @@ -0,0 +1,188 @@ +=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 creating a page from an incident. + class IncidentCreatePageAttributes + include BaseGenericModel + + # Description of the page. + attr_accessor :description + + # List of services associated with the page. + attr_accessor :services + + # List of tags for the page. + attr_accessor :tags + + # Target for creating a page from an incident. + attr_reader :target + + # Title of the page. + attr_reader :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'services' => :'services', + :'tags' => :'tags', + :'target' => :'target', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'services' => :'Array', + :'tags' => :'Array', + :'target' => :'IncidentPageTarget', + :'title' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'description', + :'services', + :'tags', + ]) + 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::IncidentCreatePageAttributes` 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?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'services') + if (value = attributes[:'services']).is_a?(Array) + self.services = value + end + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'target') + self.target = attributes[:'target'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + 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 @target.nil? + return false if @title.nil? + true + end + + # Custom attribute writer method with validation + # @param target [Object] Object to be assigned + # @!visibility private + def target=(target) + if target.nil? + fail ArgumentError, 'invalid value for "target", target cannot be nil.' + end + @target = target + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + @title = title + 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 && + description == o.description && + services == o.services && + tags == o.tags && + target == o.target && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, services, tags, target, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_create_page_from_incident_data.rb b/lib/datadog_api_client/v2/models/incident_create_page_from_incident_data.rb new file mode 100644 index 000000000000..6e5ee286f85e --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_create_page_from_incident_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 + # Data for creating a page from an incident. + class IncidentCreatePageFromIncidentData + include BaseGenericModel + + # Attributes for creating a page from an incident. + attr_reader :attributes + + # Incident page 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' => :'IncidentCreatePageAttributes', + :'type' => :'IncidentPageType' + } + 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::IncidentCreatePageFromIncidentData` 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/incident_create_page_from_incident_request.rb b/lib/datadog_api_client/v2/models/incident_create_page_from_incident_request.rb new file mode 100644 index 000000000000..eca95399d0f1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_create_page_from_incident_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 create a page from an incident. + class IncidentCreatePageFromIncidentRequest + include BaseGenericModel + + # Data for creating a page from an incident. + 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' => :'IncidentCreatePageFromIncidentData' + } + 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::IncidentCreatePageFromIncidentRequest` 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/incident_create_page_response.rb b/lib/datadog_api_client/v2/models/incident_create_page_response.rb new file mode 100644 index 000000000000..a0f41f348e25 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_create_page_response.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 + # Response from creating a page from an incident. + class IncidentCreatePageResponse + include BaseGenericModel + + # Data from creating a page. + 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' => :'IncidentCreatePageResponseData' + } + 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::IncidentCreatePageResponse` 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/incident_create_page_response_data.rb b/lib/datadog_api_client/v2/models/incident_create_page_response_data.rb new file mode 100644 index 000000000000..cc7c24a1a9dc --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_create_page_response_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 + # Data from creating a page. + class IncidentCreatePageResponseData + include BaseGenericModel + + # The UUID of the created page. + attr_reader :id + + # Incident page ID type. + 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' => :'IncidentPageIdType' + } + 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::IncidentCreatePageResponseData` 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/incident_page_id_type.rb b/lib/datadog_api_client/v2/models/incident_page_id_type.rb new file mode 100644 index 000000000000..79d53ee0032a --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_page_id_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 + # Incident page ID type. + class IncidentPageIdType + include BaseEnumModel + + PAGE_UUID = "page_uuid".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_page_target.rb b/lib/datadog_api_client/v2/models/incident_page_target.rb new file mode 100644 index 000000000000..a57159bd0783 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_page_target.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 + # Target for creating a page from an incident. + class IncidentPageTarget + include BaseGenericModel + + # The identifier of the target (team handle, team UUID, or user UUID). + attr_reader :identifier + + # Type of page target for incident pages. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'identifier' => :'identifier', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'identifier' => :'String', + :'type' => :'IncidentPageTargetType' + } + 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::IncidentPageTarget` 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?(:'identifier') + self.identifier = attributes[:'identifier'] + 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 @identifier.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param identifier [Object] Object to be assigned + # @!visibility private + def identifier=(identifier) + if identifier.nil? + fail ArgumentError, 'invalid value for "identifier", identifier cannot be nil.' + end + @identifier = identifier + 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 && + identifier == o.identifier && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [identifier, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_page_target_type.rb b/lib/datadog_api_client/v2/models/incident_page_target_type.rb new file mode 100644 index 000000000000..1b2017445e6b --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_page_target_type.rb @@ -0,0 +1,28 @@ +=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 + # Type of page target for incident pages. + class IncidentPageTargetType + include BaseEnumModel + + TEAM_HANDLE = "team_handle".freeze + TEAM_UUID = "team_uuid".freeze + USER_UUID = "user_uuid".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_page_type.rb b/lib/datadog_api_client/v2/models/incident_page_type.rb new file mode 100644 index 000000000000..995329a9112b --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_page_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 + # Incident page type. + class IncidentPageType + include BaseEnumModel + + PAGE = "page".freeze + end +end