diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 147e01bf6b94..dd99f81d8923 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -28876,6 +28876,27 @@ components: x-enum-varnames: - USERS - ATTACHMENTS + IncidentRelationshipData: + description: Incident relationship data + properties: + id: + description: Incident identifier + example: 00000000-0000-0000-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/IncidentResourceType' + required: + - type + - id + type: object + IncidentResourceType: + description: Incident resource type + enum: + - incidents + example: incidents + type: string + x-enum-varnames: + - INCIDENTS IncidentRespondersType: description: The incident responders type. enum: @@ -31569,6 +31590,87 @@ components: $ref: '#/components/schemas/Case3rdPartyTicketStatus' readOnly: true type: object + JiraIssueCreateAttributes: + description: Jira issue creation attributes + properties: + fields: + additionalProperties: {} + description: Additional Jira fields + example: {} + type: object + issue_type_id: + description: Jira issue type ID + example: '10001' + type: string + jira_account_id: + description: Jira account ID + example: '1234' + type: string + project_id: + description: Jira project ID + example: '5678' + type: string + required: + - jira_account_id + - project_id + - issue_type_id + type: object + JiraIssueCreateData: + description: Jira issue creation data + properties: + attributes: + $ref: '#/components/schemas/JiraIssueCreateAttributes' + type: + $ref: '#/components/schemas/JiraIssueResourceType' + required: + - type + - attributes + type: object + JiraIssueCreateRequest: + description: Jira issue creation request + properties: + data: + $ref: '#/components/schemas/JiraIssueCreateData' + required: + - data + type: object + JiraIssueLinkAttributes: + description: Jira issue link attributes + properties: + jira_issue_url: + description: URL of the Jira issue + example: https://jira.example.com/browse/PROJ-123 + type: string + required: + - jira_issue_url + type: object + JiraIssueLinkData: + description: Jira issue link data + properties: + attributes: + $ref: '#/components/schemas/JiraIssueLinkAttributes' + type: + $ref: '#/components/schemas/JiraIssueResourceType' + required: + - type + - attributes + type: object + JiraIssueLinkRequest: + description: Jira issue link request + properties: + data: + $ref: '#/components/schemas/JiraIssueLinkData' + required: + - data + type: object + JiraIssueResourceType: + description: Jira issue resource type + enum: + - issues + example: issues + type: string + x-enum-varnames: + - ISSUES JiraIssueResult: description: Jira issue information properties: @@ -36989,6 +37091,30 @@ components: meta: $ref: '#/components/schemas/MonthlyCostAttributionMeta' type: object + NotebookCreateData: + description: Notebook creation data + properties: + type: + $ref: '#/components/schemas/NotebookResourceType' + required: + - type + type: object + NotebookCreateRequest: + description: Notebook creation request + properties: + data: + $ref: '#/components/schemas/NotebookCreateData' + required: + - data + type: object + NotebookResourceType: + description: Notebook resource type + enum: + - notebook + example: notebook + type: string + x-enum-varnames: + - NOTEBOOK NotebookTriggerWrapper: description: Schema for a Notebook-based trigger. properties: @@ -46606,6 +46732,14 @@ components: - id - type type: object + RelationshipToIncidentRequest: + description: Relationship to incident request + properties: + data: + $ref: '#/components/schemas/IncidentRelationshipData' + required: + - data + type: object RelationshipToIncidentResponderData: description: Relationship to impact object. properties: @@ -56613,6 +56747,47 @@ components: $ref: '#/components/schemas/Case3rdPartyTicketStatus' readOnly: true type: object + ServiceNowTicketCreateAttributes: + description: ServiceNow ticket creation attributes + properties: + assignment_group: + description: ServiceNow assignment group + example: IT Support + type: string + instance_name: + description: ServiceNow instance name + example: my-instance + type: string + required: + - instance_name + type: object + ServiceNowTicketCreateData: + description: ServiceNow ticket creation data + properties: + attributes: + $ref: '#/components/schemas/ServiceNowTicketCreateAttributes' + type: + $ref: '#/components/schemas/ServiceNowTicketResourceType' + required: + - type + - attributes + type: object + ServiceNowTicketCreateRequest: + description: ServiceNow ticket creation request + properties: + data: + $ref: '#/components/schemas/ServiceNowTicketCreateData' + required: + - data + type: object + ServiceNowTicketResourceType: + description: ServiceNow ticket resource type + enum: + - tickets + example: tickets + type: string + x-enum-varnames: + - TICKETS ServiceNowTicketResult: description: ServiceNow ticket information properties: @@ -70074,6 +70249,382 @@ paths: summary: Update case priority tags: - Case Management + /api/v2/cases/{case_id}/relationships/incidents: + post: + description: Link an incident to a case + operationId: LinkIncident + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipToIncidentRequest' + description: Incident link request + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/CaseResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Link incident to case + tags: + - Case Management + 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/cases/{case_id}/relationships/jira_issues: + delete: + description: Remove the link between a Jira issue and a case + operationId: UnlinkJiraIssue + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Remove Jira issue link from case + tags: + - Case Management + 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: Link an existing Jira issue to a case + operationId: LinkJiraIssueToCase + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/JiraIssueLinkRequest' + description: Jira issue link request + required: true + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Link existing Jira issue to case + tags: + - Case Management + 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 Jira issue and link it to a case + operationId: CreateCaseJiraIssue + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/JiraIssueCreateRequest' + description: Jira issue creation request + required: true + responses: + '202': + description: Accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Create Jira issue for case + tags: + - Case Management + 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/cases/{case_id}/relationships/notebook: + post: + description: Create a new investigation notebook and link it to a case + operationId: CreateCaseNotebook + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NotebookCreateRequest' + description: Notebook creation request + required: true + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Create investigation notebook for case + tags: + - Case Management + 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/cases/{case_id}/relationships/project: + patch: + description: Update the project associated with a case + operationId: MoveCaseToProject + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectRelationship' + description: Project update request + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CaseResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Update case project + tags: + - Case Management + 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/cases/{case_id}/relationships/servicenow_tickets: + post: + description: Create a new ServiceNow incident ticket and link it to a case + operationId: CreateCaseServiceNowTicket + parameters: + - $ref: '#/components/parameters/CaseIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceNowTicketCreateRequest' + description: ServiceNow ticket creation request + required: true + responses: + '202': + description: Accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Create ServiceNow ticket for case + tags: + - Case Management + 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/cases/{case_id}/status: post: description: Update case status diff --git a/examples/v2/case-management/CreateCaseJiraIssue.rb b/examples/v2/case-management/CreateCaseJiraIssue.rb new file mode 100644 index 000000000000..3b4306bd32c4 --- /dev/null +++ b/examples/v2/case-management/CreateCaseJiraIssue.rb @@ -0,0 +1,20 @@ +# Create Jira issue for case returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_case_jira_issue".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new + +body = DatadogAPIClient::V2::JiraIssueCreateRequest.new({ + data: DatadogAPIClient::V2::JiraIssueCreateData.new({ + attributes: DatadogAPIClient::V2::JiraIssueCreateAttributes.new({ + fields: {}, + issue_type_id: "10001", + jira_account_id: "1234", + project_id: "5678", + }), + type: DatadogAPIClient::V2::JiraIssueResourceType::ISSUES, + }), +}) +p api_instance.create_case_jira_issue("case_id", body) diff --git a/examples/v2/case-management/CreateCaseNotebook.rb b/examples/v2/case-management/CreateCaseNotebook.rb new file mode 100644 index 000000000000..a67377a3cdd7 --- /dev/null +++ b/examples/v2/case-management/CreateCaseNotebook.rb @@ -0,0 +1,14 @@ +# Create investigation notebook for case returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_case_notebook".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new + +body = DatadogAPIClient::V2::NotebookCreateRequest.new({ + data: DatadogAPIClient::V2::NotebookCreateData.new({ + type: DatadogAPIClient::V2::NotebookResourceType::NOTEBOOK, + }), +}) +api_instance.create_case_notebook("case_id", body) diff --git a/examples/v2/case-management/CreateCaseServiceNowTicket.rb b/examples/v2/case-management/CreateCaseServiceNowTicket.rb new file mode 100644 index 000000000000..fa81c88259e1 --- /dev/null +++ b/examples/v2/case-management/CreateCaseServiceNowTicket.rb @@ -0,0 +1,18 @@ +# Create ServiceNow ticket for case returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_case_service_now_ticket".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new + +body = DatadogAPIClient::V2::ServiceNowTicketCreateRequest.new({ + data: DatadogAPIClient::V2::ServiceNowTicketCreateData.new({ + attributes: DatadogAPIClient::V2::ServiceNowTicketCreateAttributes.new({ + assignment_group: "IT Support", + instance_name: "my-instance", + }), + type: DatadogAPIClient::V2::ServiceNowTicketResourceType::TICKETS, + }), +}) +p api_instance.create_case_service_now_ticket("case_id", body) diff --git a/examples/v2/case-management/LinkIncident.rb b/examples/v2/case-management/LinkIncident.rb new file mode 100644 index 000000000000..2a913c1c4c7d --- /dev/null +++ b/examples/v2/case-management/LinkIncident.rb @@ -0,0 +1,15 @@ +# Link incident to case returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.link_incident".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new + +body = DatadogAPIClient::V2::RelationshipToIncidentRequest.new({ + data: DatadogAPIClient::V2::IncidentRelationshipData.new({ + id: "00000000-0000-0000-0000-000000000000", + type: DatadogAPIClient::V2::IncidentResourceType::INCIDENTS, + }), +}) +p api_instance.link_incident("case_id", body) diff --git a/examples/v2/case-management/LinkJiraIssueToCase.rb b/examples/v2/case-management/LinkJiraIssueToCase.rb new file mode 100644 index 000000000000..ca4a9bc66810 --- /dev/null +++ b/examples/v2/case-management/LinkJiraIssueToCase.rb @@ -0,0 +1,17 @@ +# Link existing Jira issue to case returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.link_jira_issue_to_case".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new + +body = DatadogAPIClient::V2::JiraIssueLinkRequest.new({ + data: DatadogAPIClient::V2::JiraIssueLinkData.new({ + attributes: DatadogAPIClient::V2::JiraIssueLinkAttributes.new({ + jira_issue_url: "https://jira.example.com/browse/PROJ-123", + }), + type: DatadogAPIClient::V2::JiraIssueResourceType::ISSUES, + }), +}) +api_instance.link_jira_issue_to_case("case_id", body) diff --git a/examples/v2/case-management/MoveCaseToProject.rb b/examples/v2/case-management/MoveCaseToProject.rb new file mode 100644 index 000000000000..49aac1beb82b --- /dev/null +++ b/examples/v2/case-management/MoveCaseToProject.rb @@ -0,0 +1,15 @@ +# Update case project returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.move_case_to_project".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new + +body = DatadogAPIClient::V2::ProjectRelationship.new({ + data: DatadogAPIClient::V2::ProjectRelationshipData.new({ + id: "e555e290-ed65-49bd-ae18-8acbfcf18db7", + type: DatadogAPIClient::V2::ProjectResourceType::PROJECT, + }), +}) +p api_instance.move_case_to_project("case_id", body) diff --git a/examples/v2/case-management/UnlinkJiraIssue.rb b/examples/v2/case-management/UnlinkJiraIssue.rb new file mode 100644 index 000000000000..617479693723 --- /dev/null +++ b/examples/v2/case-management/UnlinkJiraIssue.rb @@ -0,0 +1,8 @@ +# Remove Jira issue link from case returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.unlink_jira_issue".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CaseManagementAPI.new +api_instance.unlink_jira_issue("case_id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 6674c3b1a047..d9020dd9fab6 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1234,6 +1234,33 @@ "case_id" => "String", "body" => "CaseUpdatePriorityRequest", }, + "v2.LinkIncident" => { + "case_id" => "String", + "body" => "RelationshipToIncidentRequest", + }, + "v2.UnlinkJiraIssue" => { + "case_id" => "String", + }, + "v2.LinkJiraIssueToCase" => { + "case_id" => "String", + "body" => "JiraIssueLinkRequest", + }, + "v2.CreateCaseJiraIssue" => { + "case_id" => "String", + "body" => "JiraIssueCreateRequest", + }, + "v2.CreateCaseNotebook" => { + "case_id" => "String", + "body" => "NotebookCreateRequest", + }, + "v2.MoveCaseToProject" => { + "case_id" => "String", + "body" => "ProjectRelationship", + }, + "v2.CreateCaseServiceNowTicket" => { + "case_id" => "String", + "body" => "ServiceNowTicketCreateRequest", + }, "v2.UpdateStatus" => { "case_id" => "String", "body" => "CaseUpdateStatusRequest", diff --git a/features/v2/case_management.feature b/features/v2/case_management.feature index 2f239155671f..6dd08c4110e0 100644 --- a/features/v2/case_management.feature +++ b/features/v2/case_management.feature @@ -90,6 +90,60 @@ Feature: Case Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/case-management + Scenario: Create Jira issue for case returns "Accepted" response + Given operation "CreateCaseJiraIssue" enabled + And new "CreateCaseJiraIssue" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"fields": {}, "issue_type_id": "10001", "jira_account_id": "1234", "project_id": "5678"}, "type": "issues"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/case-management + Scenario: Create Jira issue for case returns "Bad Request" response + Given operation "CreateCaseJiraIssue" enabled + And new "CreateCaseJiraIssue" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"fields": {}, "issue_type_id": "10001", "jira_account_id": "1234", "project_id": "5678"}, "type": "issues"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Create Jira issue for case returns "Not Found" response + Given operation "CreateCaseJiraIssue" enabled + And new "CreateCaseJiraIssue" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"fields": {}, "issue_type_id": "10001", "jira_account_id": "1234", "project_id": "5678"}, "type": "issues"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Create ServiceNow ticket for case returns "Accepted" response + Given operation "CreateCaseServiceNowTicket" enabled + And new "CreateCaseServiceNowTicket" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assignment_group": "IT Support", "instance_name": "my-instance"}, "type": "tickets"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/case-management + Scenario: Create ServiceNow ticket for case returns "Bad Request" response + Given operation "CreateCaseServiceNowTicket" enabled + And new "CreateCaseServiceNowTicket" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assignment_group": "IT Support", "instance_name": "my-instance"}, "type": "tickets"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Create ServiceNow ticket for case returns "Not Found" response + Given operation "CreateCaseServiceNowTicket" enabled + And new "CreateCaseServiceNowTicket" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"assignment_group": "IT Support", "instance_name": "my-instance"}, "type": "tickets"}} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/case-management Scenario: Create a case returns "Bad Request" response Given new "CreateCase" request @@ -137,6 +191,33 @@ Feature: Case Management When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/case-management + Scenario: Create investigation notebook for case returns "Bad Request" response + Given operation "CreateCaseNotebook" enabled + And new "CreateCaseNotebook" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"type": "notebook"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Create investigation notebook for case returns "No Content" response + Given operation "CreateCaseNotebook" enabled + And new "CreateCaseNotebook" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"type": "notebook"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/case-management + Scenario: Create investigation notebook for case returns "Not Found" response + Given operation "CreateCaseNotebook" enabled + And new "CreateCaseNotebook" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"type": "notebook"}} + When the request is sent + Then the response status is 404 Not Found + @skip @team:DataDog/case-management Scenario: Delete case comment returns "Bad Request" response Given new "DeleteCaseComment" request @@ -247,6 +328,93 @@ Feature: Case Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/case-management + Scenario: Link existing Jira issue to case returns "Bad Request" response + Given operation "LinkJiraIssueToCase" enabled + And new "LinkJiraIssueToCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"jira_issue_url": "https://jira.example.com/browse/PROJ-123"}, "type": "issues"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Link existing Jira issue to case returns "Conflict" response + Given operation "LinkJiraIssueToCase" enabled + And new "LinkJiraIssueToCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"jira_issue_url": "https://jira.example.com/browse/PROJ-123"}, "type": "issues"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/case-management + Scenario: Link existing Jira issue to case returns "No Content" response + Given operation "LinkJiraIssueToCase" enabled + And new "LinkJiraIssueToCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"jira_issue_url": "https://jira.example.com/browse/PROJ-123"}, "type": "issues"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/case-management + Scenario: Link existing Jira issue to case returns "Not Found" response + Given operation "LinkJiraIssueToCase" enabled + And new "LinkJiraIssueToCase" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"jira_issue_url": "https://jira.example.com/browse/PROJ-123"}, "type": "issues"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Link incident to case returns "Bad Request" response + Given operation "LinkIncident" enabled + And new "LinkIncident" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incidents"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Link incident to case returns "Created" response + Given operation "LinkIncident" enabled + And new "LinkIncident" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incidents"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/case-management + Scenario: Link incident to case returns "Not Found" response + Given operation "LinkIncident" enabled + And new "LinkIncident" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incidents"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Remove Jira issue link from case returns "Bad Request" response + Given operation "UnlinkJiraIssue" enabled + And new "UnlinkJiraIssue" request + And request contains "case_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Remove Jira issue link from case returns "No Content" response + Given operation "UnlinkJiraIssue" enabled + And new "UnlinkJiraIssue" request + And request contains "case_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/case-management + Scenario: Remove Jira issue link from case returns "Not Found" response + Given operation "UnlinkJiraIssue" enabled + And new "UnlinkJiraIssue" request + And request contains "case_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/case-management Scenario: Remove a project returns "API error response" response Given new "DeleteProject" request @@ -450,6 +618,33 @@ Feature: Case Management Then the response status is 200 OK And the response "data.attributes.priority" is equal to "P3" + @generated @skip @team:DataDog/case-management + Scenario: Update case project returns "Bad Request" response + Given operation "MoveCaseToProject" enabled + And new "MoveCaseToProject" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "e555e290-ed65-49bd-ae18-8acbfcf18db7", "type": "project"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Update case project returns "Not Found" response + Given operation "MoveCaseToProject" enabled + And new "MoveCaseToProject" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "e555e290-ed65-49bd-ae18-8acbfcf18db7", "type": "project"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Update case project returns "OK" response + Given operation "MoveCaseToProject" enabled + And new "MoveCaseToProject" request + And request contains "case_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "e555e290-ed65-49bd-ae18-8acbfcf18db7", "type": "project"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/case-management Scenario: Update case status returns "Bad Request" response Given new "UpdateStatus" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 5a347bddf111..e379db675620 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -795,6 +795,56 @@ "type": "idempotent" } }, + "LinkIncident": { + "tag": "Case Management", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "UnlinkJiraIssue": { + "tag": "Case Management", + "undo": { + "type": "idempotent" + } + }, + "LinkJiraIssueToCase": { + "tag": "Case Management", + "undo": { + "type": "idempotent" + } + }, + "CreateCaseJiraIssue": { + "tag": "Case Management", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "CreateCaseNotebook": { + "tag": "Case Management", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "MoveCaseToProject": { + "tag": "Case Management", + "undo": { + "type": "idempotent" + } + }, + "CreateCaseServiceNowTicket": { + "tag": "Case Management", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, "UpdateStatus": { "tag": "Case Management", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 7085b0efde5e..2c8a19bc7c16 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -208,6 +208,13 @@ def initialize "v2.get_open_api": false, "v2.list_apis": false, "v2.update_open_api": false, + "v2.create_case_jira_issue": false, + "v2.create_case_notebook": false, + "v2.create_case_service_now_ticket": false, + "v2.link_incident": false, + "v2.link_jira_issue_to_case": false, + "v2.move_case_to_project": false, + "v2.unlink_jira_issue": false, "v2.cancel_threat_hunting_job": false, "v2.convert_job_result_to_signal": false, "v2.delete_threat_hunting_job": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1b7a7bac0e8b..bd79fa89f93a 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2719,6 +2719,8 @@ def overrides "v2.incident_notification_template_update_data" => "IncidentNotificationTemplateUpdateData", "v2.incident_postmortem_type" => "IncidentPostmortemType", "v2.incident_related_object" => "IncidentRelatedObject", + "v2.incident_relationship_data" => "IncidentRelationshipData", + "v2.incident_resource_type" => "IncidentResourceType", "v2.incident_responders_type" => "IncidentRespondersType", "v2.incident_response" => "IncidentResponse", "v2.incident_response_attributes" => "IncidentResponseAttributes", @@ -2890,6 +2892,13 @@ def overrides "v2.jira_integration_metadata" => "JiraIntegrationMetadata", "v2.jira_integration_metadata_issues_item" => "JiraIntegrationMetadataIssuesItem", "v2.jira_issue" => "JiraIssue", + "v2.jira_issue_create_attributes" => "JiraIssueCreateAttributes", + "v2.jira_issue_create_data" => "JiraIssueCreateData", + "v2.jira_issue_create_request" => "JiraIssueCreateRequest", + "v2.jira_issue_link_attributes" => "JiraIssueLinkAttributes", + "v2.jira_issue_link_data" => "JiraIssueLinkData", + "v2.jira_issue_link_request" => "JiraIssueLinkRequest", + "v2.jira_issue_resource_type" => "JiraIssueResourceType", "v2.jira_issue_result" => "JiraIssueResult", "v2.jira_issues_data_type" => "JiraIssuesDataType", "v2.jira_issue_template_create_request" => "JiraIssueTemplateCreateRequest", @@ -3263,6 +3272,9 @@ def overrides "v2.monthly_cost_attribution_response" => "MonthlyCostAttributionResponse", "v2.ms_teams_integration_metadata" => "MSTeamsIntegrationMetadata", "v2.ms_teams_integration_metadata_teams_item" => "MSTeamsIntegrationMetadataTeamsItem", + "v2.notebook_create_data" => "NotebookCreateData", + "v2.notebook_create_request" => "NotebookCreateRequest", + "v2.notebook_resource_type" => "NotebookResourceType", "v2.notebook_trigger_wrapper" => "NotebookTriggerWrapper", "v2.notification_channel" => "NotificationChannel", "v2.notification_channel_attributes" => "NotificationChannelAttributes", @@ -3814,6 +3826,7 @@ def overrides "v2.relationship_to_incident_notification_template_data" => "RelationshipToIncidentNotificationTemplateData", "v2.relationship_to_incident_postmortem" => "RelationshipToIncidentPostmortem", "v2.relationship_to_incident_postmortem_data" => "RelationshipToIncidentPostmortemData", + "v2.relationship_to_incident_request" => "RelationshipToIncidentRequest", "v2.relationship_to_incident_responder_data" => "RelationshipToIncidentResponderData", "v2.relationship_to_incident_responders" => "RelationshipToIncidentResponders", "v2.relationship_to_incident_type" => "RelationshipToIncidentType", @@ -4489,6 +4502,10 @@ def overrides "v2.service_now_template_update_request_attributes" => "ServiceNowTemplateUpdateRequestAttributes", "v2.service_now_template_update_request_data" => "ServiceNowTemplateUpdateRequestData", "v2.service_now_ticket" => "ServiceNowTicket", + "v2.service_now_ticket_create_attributes" => "ServiceNowTicketCreateAttributes", + "v2.service_now_ticket_create_data" => "ServiceNowTicketCreateData", + "v2.service_now_ticket_create_request" => "ServiceNowTicketCreateRequest", + "v2.service_now_ticket_resource_type" => "ServiceNowTicketResourceType", "v2.service_now_ticket_result" => "ServiceNowTicketResult", "v2.service_now_user_attributes" => "ServiceNowUserAttributes", "v2.service_now_user_data" => "ServiceNowUserData", diff --git a/lib/datadog_api_client/v2/api/case_management_api.rb b/lib/datadog_api_client/v2/api/case_management_api.rb index 06055c264dd4..17c91e6e8269 100644 --- a/lib/datadog_api_client/v2/api/case_management_api.rb +++ b/lib/datadog_api_client/v2/api/case_management_api.rb @@ -306,6 +306,240 @@ def create_case_with_http_info(body, opts = {}) return data, status_code, headers end + # Create Jira issue for case. + # + # @see #create_case_jira_issue_with_http_info + def create_case_jira_issue(case_id, body, opts = {}) + create_case_jira_issue_with_http_info(case_id, body, opts) + nil + end + + # Create Jira issue for case. + # + # Create a new Jira issue and link it to a case + # + # @param case_id [String] Case's UUID or key + # @param body [JiraIssueCreateRequest] Jira issue creation request + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def create_case_jira_issue_with_http_info(case_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_case_jira_issue".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_case_jira_issue") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_case_jira_issue")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.create_case_jira_issue ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.create_case_jira_issue" + 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 CaseManagementAPI.create_case_jira_issue" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/relationships/jira_issues'.sub('{case_id}', CGI.escape(case_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_case_jira_issue, + :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: CaseManagementAPI#create_case_jira_issue\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create investigation notebook for case. + # + # @see #create_case_notebook_with_http_info + def create_case_notebook(case_id, body, opts = {}) + create_case_notebook_with_http_info(case_id, body, opts) + nil + end + + # Create investigation notebook for case. + # + # Create a new investigation notebook and link it to a case + # + # @param case_id [String] Case's UUID or key + # @param body [NotebookCreateRequest] Notebook creation request + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def create_case_notebook_with_http_info(case_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_case_notebook".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_case_notebook") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_case_notebook")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.create_case_notebook ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.create_case_notebook" + 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 CaseManagementAPI.create_case_notebook" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/relationships/notebook'.sub('{case_id}', CGI.escape(case_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_case_notebook, + :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: CaseManagementAPI#create_case_notebook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create ServiceNow ticket for case. + # + # @see #create_case_service_now_ticket_with_http_info + def create_case_service_now_ticket(case_id, body, opts = {}) + create_case_service_now_ticket_with_http_info(case_id, body, opts) + nil + end + + # Create ServiceNow ticket for case. + # + # Create a new ServiceNow incident ticket and link it to a case + # + # @param case_id [String] Case's UUID or key + # @param body [ServiceNowTicketCreateRequest] ServiceNow ticket creation request + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def create_case_service_now_ticket_with_http_info(case_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_case_service_now_ticket".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_case_service_now_ticket") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_case_service_now_ticket")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.create_case_service_now_ticket ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.create_case_service_now_ticket" + 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 CaseManagementAPI.create_case_service_now_ticket" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/relationships/servicenow_tickets'.sub('{case_id}', CGI.escape(case_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_case_service_now_ticket, + :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: CaseManagementAPI#create_case_service_now_ticket\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create a project. # # @see #create_project_with_http_info @@ -768,6 +1002,240 @@ def get_projects_with_http_info(opts = {}) return data, status_code, headers end + # Link incident to case. + # + # @see #link_incident_with_http_info + def link_incident(case_id, body, opts = {}) + data, _status_code, _headers = link_incident_with_http_info(case_id, body, opts) + data + end + + # Link incident to case. + # + # Link an incident to a case + # + # @param case_id [String] Case's UUID or key + # @param body [RelationshipToIncidentRequest] Incident link request + # @param opts [Hash] the optional parameters + # @return [Array<(CaseResponse, Integer, Hash)>] CaseResponse data, response status code and response headers + def link_incident_with_http_info(case_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.link_incident".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.link_incident") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.link_incident")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.link_incident ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.link_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 CaseManagementAPI.link_incident" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/relationships/incidents'.sub('{case_id}', CGI.escape(case_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] || 'CaseResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :link_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: CaseManagementAPI#link_incident\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Link existing Jira issue to case. + # + # @see #link_jira_issue_to_case_with_http_info + def link_jira_issue_to_case(case_id, body, opts = {}) + link_jira_issue_to_case_with_http_info(case_id, body, opts) + nil + end + + # Link existing Jira issue to case. + # + # Link an existing Jira issue to a case + # + # @param case_id [String] Case's UUID or key + # @param body [JiraIssueLinkRequest] Jira issue link request + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def link_jira_issue_to_case_with_http_info(case_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.link_jira_issue_to_case".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.link_jira_issue_to_case") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.link_jira_issue_to_case")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.link_jira_issue_to_case ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.link_jira_issue_to_case" + 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 CaseManagementAPI.link_jira_issue_to_case" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/relationships/jira_issues'.sub('{case_id}', CGI.escape(case_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :link_jira_issue_to_case, + :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: CaseManagementAPI#link_jira_issue_to_case\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update case project. + # + # @see #move_case_to_project_with_http_info + def move_case_to_project(case_id, body, opts = {}) + data, _status_code, _headers = move_case_to_project_with_http_info(case_id, body, opts) + data + end + + # Update case project. + # + # Update the project associated with a case + # + # @param case_id [String] Case's UUID or key + # @param body [ProjectRelationship] Project update request + # @param opts [Hash] the optional parameters + # @return [Array<(CaseResponse, Integer, Hash)>] CaseResponse data, response status code and response headers + def move_case_to_project_with_http_info(case_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.move_case_to_project".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.move_case_to_project") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.move_case_to_project")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.move_case_to_project ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.move_case_to_project" + 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 CaseManagementAPI.move_case_to_project" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/relationships/project'.sub('{case_id}', CGI.escape(case_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] || 'CaseResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :move_case_to_project, + :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: CaseManagementAPI#move_case_to_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Search cases. # # @see #search_cases_with_http_info @@ -1008,6 +1476,77 @@ def unassign_case_with_http_info(case_id, body, opts = {}) return data, status_code, headers end + # Remove Jira issue link from case. + # + # @see #unlink_jira_issue_with_http_info + def unlink_jira_issue(case_id, opts = {}) + unlink_jira_issue_with_http_info(case_id, opts) + nil + end + + # Remove Jira issue link from case. + # + # Remove the link between a Jira issue and a case + # + # @param case_id [String] Case's UUID or key + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def unlink_jira_issue_with_http_info(case_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.unlink_jira_issue".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.unlink_jira_issue") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.unlink_jira_issue")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CaseManagementAPI.unlink_jira_issue ...' + end + # verify the required parameter 'case_id' is set + if @api_client.config.client_side_validation && case_id.nil? + fail ArgumentError, "Missing the required parameter 'case_id' when calling CaseManagementAPI.unlink_jira_issue" + end + # resource path + local_var_path = '/api/v2/cases/{case_id}/relationships/jira_issues'.sub('{case_id}', CGI.escape(case_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, :AuthZ] + + new_options = opts.merge( + :operation => :unlink_jira_issue, + :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: CaseManagementAPI#unlink_jira_issue\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update case attributes. # # @see #update_attributes_with_http_info diff --git a/lib/datadog_api_client/v2/models/incident_relationship_data.rb b/lib/datadog_api_client/v2/models/incident_relationship_data.rb new file mode 100644 index 000000000000..ece343189efd --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_relationship_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 + # Incident relationship data + class IncidentRelationshipData + include BaseGenericModel + + # Incident identifier + attr_reader :id + + # Incident 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 + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'IncidentResourceType' + } + 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::IncidentRelationshipData` 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_resource_type.rb b/lib/datadog_api_client/v2/models/incident_resource_type.rb new file mode 100644 index 000000000000..9c85cbbc5bfc --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_resource_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 resource type + class IncidentResourceType + include BaseEnumModel + + INCIDENTS = "incidents".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/jira_issue_create_attributes.rb b/lib/datadog_api_client/v2/models/jira_issue_create_attributes.rb new file mode 100644 index 000000000000..b06aed5caf2d --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_issue_create_attributes.rb @@ -0,0 +1,175 @@ +=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 + # Jira issue creation attributes + class JiraIssueCreateAttributes + include BaseGenericModel + + # Additional Jira fields + attr_accessor :fields + + # Jira issue type ID + attr_reader :issue_type_id + + # Jira account ID + attr_reader :jira_account_id + + # Jira project ID + attr_reader :project_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'fields' => :'fields', + :'issue_type_id' => :'issue_type_id', + :'jira_account_id' => :'jira_account_id', + :'project_id' => :'project_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'fields' => :'Hash', + :'issue_type_id' => :'String', + :'jira_account_id' => :'String', + :'project_id' => :'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::JiraIssueCreateAttributes` 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?(:'fields') + self.fields = attributes[:'fields'] + end + + if attributes.key?(:'issue_type_id') + self.issue_type_id = attributes[:'issue_type_id'] + end + + if attributes.key?(:'jira_account_id') + self.jira_account_id = attributes[:'jira_account_id'] + end + + if attributes.key?(:'project_id') + self.project_id = attributes[:'project_id'] + 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 @issue_type_id.nil? + return false if @jira_account_id.nil? + return false if @project_id.nil? + true + end + + # Custom attribute writer method with validation + # @param issue_type_id [Object] Object to be assigned + # @!visibility private + def issue_type_id=(issue_type_id) + if issue_type_id.nil? + fail ArgumentError, 'invalid value for "issue_type_id", issue_type_id cannot be nil.' + end + @issue_type_id = issue_type_id + end + + # Custom attribute writer method with validation + # @param jira_account_id [Object] Object to be assigned + # @!visibility private + def jira_account_id=(jira_account_id) + if jira_account_id.nil? + fail ArgumentError, 'invalid value for "jira_account_id", jira_account_id cannot be nil.' + end + @jira_account_id = jira_account_id + end + + # Custom attribute writer method with validation + # @param project_id [Object] Object to be assigned + # @!visibility private + def project_id=(project_id) + if project_id.nil? + fail ArgumentError, 'invalid value for "project_id", project_id cannot be nil.' + end + @project_id = project_id + 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 && + fields == o.fields && + issue_type_id == o.issue_type_id && + jira_account_id == o.jira_account_id && + project_id == o.project_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [fields, issue_type_id, jira_account_id, project_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/jira_issue_create_data.rb b/lib/datadog_api_client/v2/models/jira_issue_create_data.rb new file mode 100644 index 000000000000..a73f0f50a068 --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_issue_create_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 + # Jira issue creation data + class JiraIssueCreateData + include BaseGenericModel + + # Jira issue creation attributes + attr_reader :attributes + + # Jira issue 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' => :'JiraIssueCreateAttributes', + :'type' => :'JiraIssueResourceType' + } + 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::JiraIssueCreateData` 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/jira_issue_create_request.rb b/lib/datadog_api_client/v2/models/jira_issue_create_request.rb new file mode 100644 index 000000000000..16b8c6b51385 --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_issue_create_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 + # Jira issue creation request + class JiraIssueCreateRequest + include BaseGenericModel + + # Jira issue creation data + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'JiraIssueCreateData' + } + 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::JiraIssueCreateRequest` 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/jira_issue_link_attributes.rb b/lib/datadog_api_client/v2/models/jira_issue_link_attributes.rb new file mode 100644 index 000000000000..0582927dec5e --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_issue_link_attributes.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 + # Jira issue link attributes + class JiraIssueLinkAttributes + include BaseGenericModel + + # URL of the Jira issue + attr_reader :jira_issue_url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'jira_issue_url' => :'jira_issue_url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'jira_issue_url' => :'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::JiraIssueLinkAttributes` 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?(:'jira_issue_url') + self.jira_issue_url = attributes[:'jira_issue_url'] + 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 @jira_issue_url.nil? + true + end + + # Custom attribute writer method with validation + # @param jira_issue_url [Object] Object to be assigned + # @!visibility private + def jira_issue_url=(jira_issue_url) + if jira_issue_url.nil? + fail ArgumentError, 'invalid value for "jira_issue_url", jira_issue_url cannot be nil.' + end + @jira_issue_url = jira_issue_url + 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 && + jira_issue_url == o.jira_issue_url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [jira_issue_url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/jira_issue_link_data.rb b/lib/datadog_api_client/v2/models/jira_issue_link_data.rb new file mode 100644 index 000000000000..b3f42a4f790d --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_issue_link_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 + # Jira issue link data + class JiraIssueLinkData + include BaseGenericModel + + # Jira issue link attributes + attr_reader :attributes + + # Jira issue 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' => :'JiraIssueLinkAttributes', + :'type' => :'JiraIssueResourceType' + } + 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::JiraIssueLinkData` 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/jira_issue_link_request.rb b/lib/datadog_api_client/v2/models/jira_issue_link_request.rb new file mode 100644 index 000000000000..7c811d30d5d6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_issue_link_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 + # Jira issue link request + class JiraIssueLinkRequest + include BaseGenericModel + + # Jira issue link data + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'JiraIssueLinkData' + } + 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::JiraIssueLinkRequest` 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/jira_issue_resource_type.rb b/lib/datadog_api_client/v2/models/jira_issue_resource_type.rb new file mode 100644 index 000000000000..394148d4d4b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_issue_resource_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 + # Jira issue resource type + class JiraIssueResourceType + include BaseEnumModel + + ISSUES = "issues".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/notebook_create_data.rb b/lib/datadog_api_client/v2/models/notebook_create_data.rb new file mode 100644 index 000000000000..649b274d915a --- /dev/null +++ b/lib/datadog_api_client/v2/models/notebook_create_data.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 + # Notebook creation data + class NotebookCreateData + include BaseGenericModel + + # Notebook 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 + { + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'type' => :'NotebookResourceType' + } + 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::NotebookCreateData` 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?(:'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 @type.nil? + true + 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 && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notebook_create_request.rb b/lib/datadog_api_client/v2/models/notebook_create_request.rb new file mode 100644 index 000000000000..67e112423046 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notebook_create_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 + # Notebook creation request + class NotebookCreateRequest + include BaseGenericModel + + # Notebook creation data + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'NotebookCreateData' + } + 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::NotebookCreateRequest` 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/notebook_resource_type.rb b/lib/datadog_api_client/v2/models/notebook_resource_type.rb new file mode 100644 index 000000000000..ead6aa746452 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notebook_resource_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 + # Notebook resource type + class NotebookResourceType + include BaseEnumModel + + NOTEBOOK = "notebook".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/relationship_to_incident_request.rb b/lib/datadog_api_client/v2/models/relationship_to_incident_request.rb new file mode 100644 index 000000000000..158bbc80af4f --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_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 + # Relationship to incident request + class RelationshipToIncidentRequest + include BaseGenericModel + + # Incident relationship data + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentRelationshipData' + } + 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::RelationshipToIncidentRequest` 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/service_now_ticket_create_attributes.rb b/lib/datadog_api_client/v2/models/service_now_ticket_create_attributes.rb new file mode 100644 index 000000000000..190f0ffc43ed --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_now_ticket_create_attributes.rb @@ -0,0 +1,133 @@ +=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 + # ServiceNow ticket creation attributes + class ServiceNowTicketCreateAttributes + include BaseGenericModel + + # ServiceNow assignment group + attr_accessor :assignment_group + + # ServiceNow instance name + attr_reader :instance_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assignment_group' => :'assignment_group', + :'instance_name' => :'instance_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assignment_group' => :'String', + :'instance_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::ServiceNowTicketCreateAttributes` 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?(:'assignment_group') + self.assignment_group = attributes[:'assignment_group'] + end + + if attributes.key?(:'instance_name') + self.instance_name = attributes[:'instance_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 @instance_name.nil? + true + end + + # Custom attribute writer method with validation + # @param instance_name [Object] Object to be assigned + # @!visibility private + def instance_name=(instance_name) + if instance_name.nil? + fail ArgumentError, 'invalid value for "instance_name", instance_name cannot be nil.' + end + @instance_name = instance_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 && + assignment_group == o.assignment_group && + instance_name == o.instance_name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assignment_group, instance_name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_now_ticket_create_data.rb b/lib/datadog_api_client/v2/models/service_now_ticket_create_data.rb new file mode 100644 index 000000000000..ab3eeabcdaa3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_now_ticket_create_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 + # ServiceNow ticket creation data + class ServiceNowTicketCreateData + include BaseGenericModel + + # ServiceNow ticket creation attributes + attr_reader :attributes + + # ServiceNow ticket 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' => :'ServiceNowTicketCreateAttributes', + :'type' => :'ServiceNowTicketResourceType' + } + 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::ServiceNowTicketCreateData` 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/service_now_ticket_create_request.rb b/lib/datadog_api_client/v2/models/service_now_ticket_create_request.rb new file mode 100644 index 000000000000..6e6aef52bd0d --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_now_ticket_create_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 + # ServiceNow ticket creation request + class ServiceNowTicketCreateRequest + include BaseGenericModel + + # ServiceNow ticket creation data + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ServiceNowTicketCreateData' + } + 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::ServiceNowTicketCreateRequest` 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/service_now_ticket_resource_type.rb b/lib/datadog_api_client/v2/models/service_now_ticket_resource_type.rb new file mode 100644 index 000000000000..d06cbd640c4f --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_now_ticket_resource_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 + # ServiceNow ticket resource type + class ServiceNowTicketResourceType + include BaseEnumModel + + TICKETS = "tickets".freeze + end +end