diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 95f5775c6b9..0f936d8d3a9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -45141,6 +45141,92 @@ components: type: string x-enum-varnames: - MARKDOWN + PostmortemTemplateAttributesRequest: + properties: + name: + description: The name of the template + example: Standard Postmortem Template + type: string + required: + - name + type: object + PostmortemTemplateAttributesResponse: + properties: + createdAt: + description: When the template was created + example: '2026-01-13T17:15:53.208340Z' + format: date-time + type: string + modifiedAt: + description: When the template was last modified + example: '2026-01-13T17:15:53.208340Z' + format: date-time + type: string + name: + description: The name of the template + example: Standard Postmortem Template + type: string + required: + - name + - createdAt + - modifiedAt + type: object + PostmortemTemplateDataRequest: + properties: + attributes: + $ref: '#/components/schemas/PostmortemTemplateAttributesRequest' + type: + $ref: '#/components/schemas/PostmortemTemplateType' + required: + - type + - attributes + type: object + PostmortemTemplateDataResponse: + properties: + attributes: + $ref: '#/components/schemas/PostmortemTemplateAttributesResponse' + id: + description: The ID of the template + example: template-456 + type: string + type: + $ref: '#/components/schemas/PostmortemTemplateType' + required: + - id + - type + - attributes + type: object + PostmortemTemplateRequest: + properties: + data: + $ref: '#/components/schemas/PostmortemTemplateDataRequest' + required: + - data + type: object + PostmortemTemplateResponse: + properties: + data: + $ref: '#/components/schemas/PostmortemTemplateDataResponse' + required: + - data + type: object + PostmortemTemplateType: + description: Postmortem template resource type + enum: + - postmortem_template + example: postmortem_template + type: string + x-enum-varnames: + - POSTMORTEM_TEMPLATE + PostmortemTemplatesResponse: + properties: + data: + items: + $ref: '#/components/schemas/PostmortemTemplateDataResponse' + type: array + required: + - data + type: object 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. @@ -78136,6 +78222,184 @@ paths: - incident_notification_settings_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/config/postmortem-templates: + get: + description: Retrieve a list of all postmortem templates for incidents. + operationId: ListIncidentPostmortemTemplates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplatesResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List postmortem templates + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create a new postmortem template for incidents. + operationId: CreateIncidentPostmortemTemplate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create postmortem template + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/config/postmortem-templates/{template_id}: + delete: + description: Delete a postmortem template. + operationId: DeleteIncidentPostmortemTemplate + parameters: + - description: The ID of the postmortem template + in: path + name: template_id + required: true + schema: + example: template-456 + type: string + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete postmortem template + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Retrieve details of a specific postmortem template. + operationId: GetIncidentPostmortemTemplate + parameters: + - description: The ID of the postmortem template + in: path + name: template_id + required: true + schema: + example: template-456 + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get postmortem template + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: Update an existing postmortem template. + operationId: UpdateIncidentPostmortemTemplate + parameters: + - description: The ID of the postmortem template + in: path + name: template_id + required: true + schema: + example: template-456 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update postmortem template + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/config/types: get: diff --git a/examples/v2/incidents/CreateIncidentPostmortemTemplate.rb b/examples/v2/incidents/CreateIncidentPostmortemTemplate.rb new file mode 100644 index 00000000000..5f83cd3c739 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentPostmortemTemplate.rb @@ -0,0 +1,17 @@ +# Create postmortem template returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_incident_postmortem_template".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::PostmortemTemplateRequest.new({ + data: DatadogAPIClient::V2::PostmortemTemplateDataRequest.new({ + attributes: DatadogAPIClient::V2::PostmortemTemplateAttributesRequest.new({ + name: "Standard Postmortem Template", + }), + type: DatadogAPIClient::V2::PostmortemTemplateType::POSTMORTEM_TEMPLATE, + }), +}) +p api_instance.create_incident_postmortem_template(body) diff --git a/examples/v2/incidents/DeleteIncidentPostmortemTemplate.rb b/examples/v2/incidents/DeleteIncidentPostmortemTemplate.rb new file mode 100644 index 00000000000..f02aba4e5db --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentPostmortemTemplate.rb @@ -0,0 +1,8 @@ +# Delete postmortem template returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_incident_postmortem_template".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +api_instance.delete_incident_postmortem_template("template-456") diff --git a/examples/v2/incidents/GetIncidentPostmortemTemplate.rb b/examples/v2/incidents/GetIncidentPostmortemTemplate.rb new file mode 100644 index 00000000000..502f06f0f69 --- /dev/null +++ b/examples/v2/incidents/GetIncidentPostmortemTemplate.rb @@ -0,0 +1,8 @@ +# Get postmortem template returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_incident_postmortem_template".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +p api_instance.get_incident_postmortem_template("template-456") diff --git a/examples/v2/incidents/ListIncidentPostmortemTemplates.rb b/examples/v2/incidents/ListIncidentPostmortemTemplates.rb new file mode 100644 index 00000000000..daf7012b132 --- /dev/null +++ b/examples/v2/incidents/ListIncidentPostmortemTemplates.rb @@ -0,0 +1,8 @@ +# List postmortem templates returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_incident_postmortem_templates".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +p api_instance.list_incident_postmortem_templates() diff --git a/examples/v2/incidents/UpdateIncidentPostmortemTemplate.rb b/examples/v2/incidents/UpdateIncidentPostmortemTemplate.rb new file mode 100644 index 00000000000..6a721b93762 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentPostmortemTemplate.rb @@ -0,0 +1,17 @@ +# Update postmortem template returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_incident_postmortem_template".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::PostmortemTemplateRequest.new({ + data: DatadogAPIClient::V2::PostmortemTemplateDataRequest.new({ + attributes: DatadogAPIClient::V2::PostmortemTemplateAttributesRequest.new({ + name: "Standard Postmortem Template", + }), + type: DatadogAPIClient::V2::PostmortemTemplateType::POSTMORTEM_TEMPLATE, + }), +}) +p api_instance.update_incident_postmortem_template("template-456", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index f9f955f3192..833c5168665 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2151,6 +2151,19 @@ "include" => "String", "body" => "PatchIncidentNotificationTemplateRequest", }, + "v2.CreateIncidentPostmortemTemplate" => { + "body" => "PostmortemTemplateRequest", + }, + "v2.DeleteIncidentPostmortemTemplate" => { + "template_id" => "String", + }, + "v2.GetIncidentPostmortemTemplate" => { + "template_id" => "String", + }, + "v2.UpdateIncidentPostmortemTemplate" => { + "template_id" => "String", + "body" => "PostmortemTemplateRequest", + }, "v2.ListIncidentTypes" => { "include_deleted" => "Boolean", }, diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index db706355841..a683c2cac14 100644 --- a/features/v2/incidents.feature +++ b/features/v2/incidents.feature @@ -290,6 +290,22 @@ Feature: Incidents When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem template returns "Bad Request" response + Given operation "CreateIncidentPostmortemTemplate" enabled + And new "CreateIncidentPostmortemTemplate" request + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem template returns "Created" response + Given operation "CreateIncidentPostmortemTemplate" enabled + And new "CreateIncidentPostmortemTemplate" request + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + 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 @@ -537,6 +553,30 @@ Feature: Incidents When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/incident-app + Scenario: Delete postmortem template returns "Bad Request" response + Given operation "DeleteIncidentPostmortemTemplate" enabled + And new "DeleteIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Delete postmortem template returns "No Content" response + Given operation "DeleteIncidentPostmortemTemplate" enabled + And new "DeleteIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/incident-app + Scenario: Delete postmortem template returns "Not Found" response + Given operation "DeleteIncidentPostmortemTemplate" enabled + And new "DeleteIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Get a list of an incident's integration metadata returns "Bad Request" response Given operation "ListIncidentIntegrations" enabled @@ -811,6 +851,30 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Get postmortem template returns "Bad Request" response + Given operation "GetIncidentPostmortemTemplate" enabled + And new "GetIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Get postmortem template returns "Not Found" response + Given operation "GetIncidentPostmortemTemplate" enabled + And new "GetIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Get postmortem template returns "OK" response + Given operation "GetIncidentPostmortemTemplate" enabled + And new "GetIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Get the details of an incident returns "Bad Request" response Given operation "GetIncident" enabled @@ -940,6 +1004,20 @@ Feature: Incidents Then the response status is 200 OK And the response "data" has length 0 + @generated @skip @team:DataDog/incident-app + Scenario: List postmortem templates returns "Bad Request" response + Given operation "ListIncidentPostmortemTemplates" enabled + And new "ListIncidentPostmortemTemplates" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: List postmortem templates returns "OK" response + Given operation "ListIncidentPostmortemTemplates" enabled + And new "ListIncidentPostmortemTemplates" request + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Remove commander from an incident returns "OK" response Given operation "UpdateIncident" enabled @@ -1270,3 +1348,30 @@ Feature: Incidents And the response "data.id" has the same value as "notification_template.data.id" And the response "data.attributes.name" has the same value as "unique" And the response "data.attributes.category" is equal to "update" + + @generated @skip @team:DataDog/incident-app + Scenario: Update postmortem template returns "Bad Request" response + Given operation "UpdateIncidentPostmortemTemplate" enabled + And new "UpdateIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update postmortem template returns "Not Found" response + Given operation "UpdateIncidentPostmortemTemplate" enabled + And new "UpdateIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Update postmortem template returns "OK" response + Given operation "UpdateIncidentPostmortemTemplate" enabled + And new "UpdateIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 7e549784ee6..c77dfee3356 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1761,6 +1761,43 @@ "type": "idempotent" } }, + "ListIncidentPostmortemTemplates": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentPostmortemTemplate": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentPostmortemTemplate", + "parameters": [ + { + "name": "template_id", + "source": "" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentPostmortemTemplate": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentPostmortemTemplate": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentPostmortemTemplate": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListIncidentTypes": { "tag": "Incidents", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 1c3d360ecc9..f51747c826e 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -256,6 +256,7 @@ def initialize "v2.create_incident_notification_rule": false, "v2.create_incident_notification_template": false, "v2.create_incident_postmortem_attachment": false, + "v2.create_incident_postmortem_template": false, "v2.create_incident_todo": false, "v2.create_incident_type": false, "v2.delete_global_incident_handle": false, @@ -264,6 +265,7 @@ def initialize "v2.delete_incident_integration": false, "v2.delete_incident_notification_rule": false, "v2.delete_incident_notification_template": false, + "v2.delete_incident_postmortem_template": false, "v2.delete_incident_todo": false, "v2.delete_incident_type": false, "v2.get_global_incident_settings": false, @@ -271,6 +273,7 @@ def initialize "v2.get_incident_integration": false, "v2.get_incident_notification_rule": false, "v2.get_incident_notification_template": false, + "v2.get_incident_postmortem_template": false, "v2.get_incident_todo": false, "v2.get_incident_type": false, "v2.list_global_incident_handles": false, @@ -278,6 +281,7 @@ def initialize "v2.list_incident_integrations": false, "v2.list_incident_notification_rules": false, "v2.list_incident_notification_templates": false, + "v2.list_incident_postmortem_templates": false, "v2.list_incidents": false, "v2.list_incident_todos": false, "v2.list_incident_types": false, @@ -289,6 +293,7 @@ def initialize "v2.update_incident_integration": false, "v2.update_incident_notification_rule": false, "v2.update_incident_notification_template": false, + "v2.update_incident_postmortem_template": false, "v2.update_incident_todo": false, "v2.update_incident_type": false, "v2.create_jira_issue_template": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 8bcf2052b62..3b93703f265 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3770,6 +3770,14 @@ def overrides "v2.postmortem_cell_attributes" => "PostmortemCellAttributes", "v2.postmortem_cell_definition" => "PostmortemCellDefinition", "v2.postmortem_cell_type" => "PostmortemCellType", + "v2.postmortem_template_attributes_request" => "PostmortemTemplateAttributesRequest", + "v2.postmortem_template_attributes_response" => "PostmortemTemplateAttributesResponse", + "v2.postmortem_template_data_request" => "PostmortemTemplateDataRequest", + "v2.postmortem_template_data_response" => "PostmortemTemplateDataResponse", + "v2.postmortem_template_request" => "PostmortemTemplateRequest", + "v2.postmortem_template_response" => "PostmortemTemplateResponse", + "v2.postmortem_templates_response" => "PostmortemTemplatesResponse", + "v2.postmortem_template_type" => "PostmortemTemplateType", "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 13ff0ab08e5..5f2fec4b906 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -631,6 +631,79 @@ def create_incident_postmortem_attachment_with_http_info(incident_id, body, opts return data, status_code, headers end + # Create postmortem template. + # + # @see #create_incident_postmortem_template_with_http_info + def create_incident_postmortem_template(body, opts = {}) + data, _status_code, _headers = create_incident_postmortem_template_with_http_info(body, opts) + data + end + + # Create postmortem template. + # + # Create a new postmortem template for incidents. + # + # @param body [PostmortemTemplateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(PostmortemTemplateResponse, Integer, Hash)>] PostmortemTemplateResponse data, response status code and response headers + def create_incident_postmortem_template_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_postmortem_template".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_postmortem_template") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_postmortem_template")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_postmortem_template ...' + 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_template" + end + # resource path + local_var_path = '/api/v2/incidents/config/postmortem-templates' + + # 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] || 'PostmortemTemplateResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_incident_postmortem_template, + :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_template\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 @@ -1284,6 +1357,77 @@ def delete_incident_notification_template_with_http_info(id, opts = {}) return data, status_code, headers end + # Delete postmortem template. + # + # @see #delete_incident_postmortem_template_with_http_info + def delete_incident_postmortem_template(template_id, opts = {}) + delete_incident_postmortem_template_with_http_info(template_id, opts) + nil + end + + # Delete postmortem template. + # + # Delete a postmortem template. + # + # @param template_id [String] The ID of the postmortem template + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_incident_postmortem_template_with_http_info(template_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_incident_postmortem_template".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_incident_postmortem_template") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_incident_postmortem_template")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.delete_incident_postmortem_template ...' + end + # verify the required parameter 'template_id' is set + if @api_client.config.client_side_validation && template_id.nil? + fail ArgumentError, "Missing the required parameter 'template_id' when calling IncidentsAPI.delete_incident_postmortem_template" + end + # resource path + local_var_path = '/api/v2/incidents/config/postmortem-templates/{template_id}'.sub('{template_id}', CGI.escape(template_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(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_incident_postmortem_template, + :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::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#delete_incident_postmortem_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete an incident todo. # # @see #delete_incident_todo_with_http_info @@ -1792,6 +1936,77 @@ def get_incident_notification_template_with_http_info(id, opts = {}) return data, status_code, headers end + # Get postmortem template. + # + # @see #get_incident_postmortem_template_with_http_info + def get_incident_postmortem_template(template_id, opts = {}) + data, _status_code, _headers = get_incident_postmortem_template_with_http_info(template_id, opts) + data + end + + # Get postmortem template. + # + # Retrieve details of a specific postmortem template. + # + # @param template_id [String] The ID of the postmortem template + # @param opts [Hash] the optional parameters + # @return [Array<(PostmortemTemplateResponse, Integer, Hash)>] PostmortemTemplateResponse data, response status code and response headers + def get_incident_postmortem_template_with_http_info(template_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_incident_postmortem_template".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_incident_postmortem_template") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_incident_postmortem_template")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.get_incident_postmortem_template ...' + end + # verify the required parameter 'template_id' is set + if @api_client.config.client_side_validation && template_id.nil? + fail ArgumentError, "Missing the required parameter 'template_id' when calling IncidentsAPI.get_incident_postmortem_template" + end + # resource path + local_var_path = '/api/v2/incidents/config/postmortem-templates/{template_id}'.sub('{template_id}', CGI.escape(template_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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PostmortemTemplateResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_incident_postmortem_template, + :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::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#get_incident_postmortem_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get incident todo details. # # @see #get_incident_todo_with_http_info @@ -2358,6 +2573,72 @@ def list_incident_notification_templates_with_http_info(opts = {}) return data, status_code, headers end + # List postmortem templates. + # + # @see #list_incident_postmortem_templates_with_http_info + def list_incident_postmortem_templates(opts = {}) + data, _status_code, _headers = list_incident_postmortem_templates_with_http_info(opts) + data + end + + # List postmortem templates. + # + # Retrieve a list of all postmortem templates for incidents. + # + # @param opts [Hash] the optional parameters + # @return [Array<(PostmortemTemplatesResponse, Integer, Hash)>] PostmortemTemplatesResponse data, response status code and response headers + def list_incident_postmortem_templates_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_incident_postmortem_templates".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_incident_postmortem_templates") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_incident_postmortem_templates")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.list_incident_postmortem_templates ...' + end + # resource path + local_var_path = '/api/v2/incidents/config/postmortem-templates' + + # 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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PostmortemTemplatesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_incident_postmortem_templates, + :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::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#list_incident_postmortem_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a list of incidents. # # @see #list_incidents_with_http_info @@ -3252,6 +3533,84 @@ def update_incident_notification_template_with_http_info(id, body, opts = {}) return data, status_code, headers end + # Update postmortem template. + # + # @see #update_incident_postmortem_template_with_http_info + def update_incident_postmortem_template(template_id, body, opts = {}) + data, _status_code, _headers = update_incident_postmortem_template_with_http_info(template_id, body, opts) + data + end + + # Update postmortem template. + # + # Update an existing postmortem template. + # + # @param template_id [String] The ID of the postmortem template + # @param body [PostmortemTemplateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(PostmortemTemplateResponse, Integer, Hash)>] PostmortemTemplateResponse data, response status code and response headers + def update_incident_postmortem_template_with_http_info(template_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_incident_postmortem_template".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_incident_postmortem_template") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_incident_postmortem_template")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.update_incident_postmortem_template ...' + end + # verify the required parameter 'template_id' is set + if @api_client.config.client_side_validation && template_id.nil? + fail ArgumentError, "Missing the required parameter 'template_id' when calling IncidentsAPI.update_incident_postmortem_template" + 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.update_incident_postmortem_template" + end + # resource path + local_var_path = '/api/v2/incidents/config/postmortem-templates/{template_id}'.sub('{template_id}', CGI.escape(template_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] || 'PostmortemTemplateResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_incident_postmortem_template, + :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: IncidentsAPI#update_incident_postmortem_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update an incident todo. # # @see #update_incident_todo_with_http_info diff --git a/lib/datadog_api_client/v2/models/postmortem_template_attributes_request.rb b/lib/datadog_api_client/v2/models/postmortem_template_attributes_request.rb new file mode 100644 index 00000000000..ec997c7c2cb --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_template_attributes_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 PostmortemTemplateAttributesRequest + include BaseGenericModel + + # The name of the template + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'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::PostmortemTemplateAttributesRequest` 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?(:'name') + self.name = attributes[:'name'] + 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 @name.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + 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 && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/postmortem_template_attributes_response.rb b/lib/datadog_api_client/v2/models/postmortem_template_attributes_response.rb new file mode 100644 index 00000000000..74e680e9929 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_template_attributes_response.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 + # + class PostmortemTemplateAttributesResponse + include BaseGenericModel + + # When the template was created + attr_reader :created_at + + # When the template was last modified + attr_reader :modified_at + + # The name of the template + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'createdAt', + :'modified_at' => :'modifiedAt', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'modified_at' => :'Time', + :'name' => :'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::PostmortemTemplateAttributesResponse` 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?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 @created_at.nil? + return false if @modified_at.nil? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param modified_at [Object] Object to be assigned + # @!visibility private + def modified_at=(modified_at) + if modified_at.nil? + fail ArgumentError, 'invalid value for "modified_at", modified_at cannot be nil.' + end + @modified_at = modified_at + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + 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 && + created_at == o.created_at && + modified_at == o.modified_at && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, modified_at, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/postmortem_template_data_request.rb b/lib/datadog_api_client/v2/models/postmortem_template_data_request.rb new file mode 100644 index 00000000000..f8dc577f9ea --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_template_data_request.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 + # + class PostmortemTemplateDataRequest + include BaseGenericModel + + # + attr_reader :attributes + + # Postmortem template 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' => :'PostmortemTemplateAttributesRequest', + :'type' => :'PostmortemTemplateType' + } + 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::PostmortemTemplateDataRequest` 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_template_data_response.rb b/lib/datadog_api_client/v2/models/postmortem_template_data_response.rb new file mode 100644 index 00000000000..6de6ca5018e --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_template_data_response.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 + # + class PostmortemTemplateDataResponse + include BaseGenericModel + + # + attr_reader :attributes + + # The ID of the template + attr_reader :id + + # Postmortem template 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', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PostmortemTemplateAttributesResponse', + :'id' => :'String', + :'type' => :'PostmortemTemplateType' + } + 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::PostmortemTemplateDataResponse` 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/postmortem_template_request.rb b/lib/datadog_api_client/v2/models/postmortem_template_request.rb new file mode 100644 index 00000000000..48eba54504c --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_template_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 PostmortemTemplateRequest + include BaseGenericModel + + # + 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' => :'PostmortemTemplateDataRequest' + } + 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::PostmortemTemplateRequest` 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_template_response.rb b/lib/datadog_api_client/v2/models/postmortem_template_response.rb new file mode 100644 index 00000000000..7d693adbcc9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_template_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 + # + class PostmortemTemplateResponse + include BaseGenericModel + + # + 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' => :'PostmortemTemplateDataResponse' + } + 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::PostmortemTemplateResponse` 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_template_type.rb b/lib/datadog_api_client/v2/models/postmortem_template_type.rb new file mode 100644 index 00000000000..97518204d33 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_template_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 + # Postmortem template resource type + class PostmortemTemplateType + include BaseEnumModel + + POSTMORTEM_TEMPLATE = "postmortem_template".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/postmortem_templates_response.rb b/lib/datadog_api_client/v2/models/postmortem_templates_response.rb new file mode 100644 index 00000000000..85b06874066 --- /dev/null +++ b/lib/datadog_api_client/v2/models/postmortem_templates_response.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 + # + class PostmortemTemplatesResponse + include BaseGenericModel + + # + 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' => :'Array' + } + 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::PostmortemTemplatesResponse` 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') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + 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