diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 147e01bf6b..dd99f81d89 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/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 41d22bb2b4..7dbce1d2a1 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -12240,6 +12240,20 @@ datadog\_api\_client.v2.model.incident\_related\_object module :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_relationship\_data module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_relationship_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_resource\_type module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_resource_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_responders\_type module --------------------------------------------------------------- @@ -13451,6 +13465,55 @@ datadog\_api\_client.v2.model.jira\_issue module :members: :show-inheritance: +datadog\_api\_client.v2.model.jira\_issue\_create\_attributes module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.jira_issue_create_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.jira\_issue\_create\_data module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.jira_issue_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.jira\_issue\_create\_request module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.jira_issue_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.jira\_issue\_link\_attributes module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.jira_issue_link_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.jira\_issue\_link\_data module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.jira_issue_link_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.jira\_issue\_link\_request module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.jira_issue_link_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.jira\_issue\_resource\_type module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.jira_issue_resource_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.jira\_issue\_result module -------------------------------------------------------- @@ -16097,6 +16160,27 @@ datadog\_api\_client.v2.model.ms\_teams\_integration\_metadata\_teams\_item modu :members: :show-inheritance: +datadog\_api\_client.v2.model.notebook\_create\_data module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.notebook_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.notebook\_create\_request module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.notebook_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.notebook\_resource\_type module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.notebook_resource_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.notebook\_trigger\_wrapper module --------------------------------------------------------------- @@ -19961,6 +20045,13 @@ datadog\_api\_client.v2.model.relationship\_to\_incident\_postmortem\_data modul :members: :show-inheritance: +datadog\_api\_client.v2.model.relationship\_to\_incident\_request module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.relationship_to_incident_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.relationship\_to\_incident\_responder\_data module -------------------------------------------------------------------------------- @@ -24686,6 +24777,34 @@ datadog\_api\_client.v2.model.service\_now\_ticket module :members: :show-inheritance: +datadog\_api\_client.v2.model.service\_now\_ticket\_create\_attributes module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_now_ticket_create_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.service\_now\_ticket\_create\_data module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_now_ticket_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.service\_now\_ticket\_create\_request module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_now_ticket_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.service\_now\_ticket\_resource\_type module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.service_now_ticket_resource_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.service\_now\_ticket\_result module ----------------------------------------------------------------- diff --git a/examples/v2/case-management/CreateCaseJiraIssue.py b/examples/v2/case-management/CreateCaseJiraIssue.py new file mode 100644 index 0000000000..d795fad647 --- /dev/null +++ b/examples/v2/case-management/CreateCaseJiraIssue.py @@ -0,0 +1,28 @@ +""" +Create Jira issue for case returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.case_management_api import CaseManagementApi +from datadog_api_client.v2.model.jira_issue_create_attributes import JiraIssueCreateAttributes +from datadog_api_client.v2.model.jira_issue_create_data import JiraIssueCreateData +from datadog_api_client.v2.model.jira_issue_create_request import JiraIssueCreateRequest +from datadog_api_client.v2.model.jira_issue_resource_type import JiraIssueResourceType + +body = JiraIssueCreateRequest( + data=JiraIssueCreateData( + attributes=JiraIssueCreateAttributes( + fields=dict(), + issue_type_id="10001", + jira_account_id="1234", + project_id="5678", + ), + type=JiraIssueResourceType.ISSUES, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_case_jira_issue"] = True +with ApiClient(configuration) as api_client: + api_instance = CaseManagementApi(api_client) + api_instance.create_case_jira_issue(case_id="case_id", body=body) diff --git a/examples/v2/case-management/CreateCaseNotebook.py b/examples/v2/case-management/CreateCaseNotebook.py new file mode 100644 index 0000000000..d79eb53478 --- /dev/null +++ b/examples/v2/case-management/CreateCaseNotebook.py @@ -0,0 +1,21 @@ +""" +Create investigation notebook for case returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.case_management_api import CaseManagementApi +from datadog_api_client.v2.model.notebook_create_data import NotebookCreateData +from datadog_api_client.v2.model.notebook_create_request import NotebookCreateRequest +from datadog_api_client.v2.model.notebook_resource_type import NotebookResourceType + +body = NotebookCreateRequest( + data=NotebookCreateData( + type=NotebookResourceType.NOTEBOOK, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_case_notebook"] = True +with ApiClient(configuration) as api_client: + api_instance = CaseManagementApi(api_client) + api_instance.create_case_notebook(case_id="case_id", body=body) diff --git a/examples/v2/case-management/CreateCaseServiceNowTicket.py b/examples/v2/case-management/CreateCaseServiceNowTicket.py new file mode 100644 index 0000000000..8cd3e42218 --- /dev/null +++ b/examples/v2/case-management/CreateCaseServiceNowTicket.py @@ -0,0 +1,26 @@ +""" +Create ServiceNow ticket for case returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.case_management_api import CaseManagementApi +from datadog_api_client.v2.model.service_now_ticket_create_attributes import ServiceNowTicketCreateAttributes +from datadog_api_client.v2.model.service_now_ticket_create_data import ServiceNowTicketCreateData +from datadog_api_client.v2.model.service_now_ticket_create_request import ServiceNowTicketCreateRequest +from datadog_api_client.v2.model.service_now_ticket_resource_type import ServiceNowTicketResourceType + +body = ServiceNowTicketCreateRequest( + data=ServiceNowTicketCreateData( + attributes=ServiceNowTicketCreateAttributes( + assignment_group="IT Support", + instance_name="my-instance", + ), + type=ServiceNowTicketResourceType.TICKETS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_case_service_now_ticket"] = True +with ApiClient(configuration) as api_client: + api_instance = CaseManagementApi(api_client) + api_instance.create_case_service_now_ticket(case_id="case_id", body=body) diff --git a/examples/v2/case-management/LinkIncident.py b/examples/v2/case-management/LinkIncident.py new file mode 100644 index 0000000000..327f7ea8b6 --- /dev/null +++ b/examples/v2/case-management/LinkIncident.py @@ -0,0 +1,24 @@ +""" +Link incident to case returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.case_management_api import CaseManagementApi +from datadog_api_client.v2.model.incident_relationship_data import IncidentRelationshipData +from datadog_api_client.v2.model.incident_resource_type import IncidentResourceType +from datadog_api_client.v2.model.relationship_to_incident_request import RelationshipToIncidentRequest + +body = RelationshipToIncidentRequest( + data=IncidentRelationshipData( + id="00000000-0000-0000-0000-000000000000", + type=IncidentResourceType.INCIDENTS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["link_incident"] = True +with ApiClient(configuration) as api_client: + api_instance = CaseManagementApi(api_client) + response = api_instance.link_incident(case_id="case_id", body=body) + + print(response) diff --git a/examples/v2/case-management/LinkJiraIssueToCase.py b/examples/v2/case-management/LinkJiraIssueToCase.py new file mode 100644 index 0000000000..3803edf4ed --- /dev/null +++ b/examples/v2/case-management/LinkJiraIssueToCase.py @@ -0,0 +1,25 @@ +""" +Link existing Jira issue to case returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.case_management_api import CaseManagementApi +from datadog_api_client.v2.model.jira_issue_link_attributes import JiraIssueLinkAttributes +from datadog_api_client.v2.model.jira_issue_link_data import JiraIssueLinkData +from datadog_api_client.v2.model.jira_issue_link_request import JiraIssueLinkRequest +from datadog_api_client.v2.model.jira_issue_resource_type import JiraIssueResourceType + +body = JiraIssueLinkRequest( + data=JiraIssueLinkData( + attributes=JiraIssueLinkAttributes( + jira_issue_url="https://jira.example.com/browse/PROJ-123", + ), + type=JiraIssueResourceType.ISSUES, + ), +) + +configuration = Configuration() +configuration.unstable_operations["link_jira_issue_to_case"] = True +with ApiClient(configuration) as api_client: + api_instance = CaseManagementApi(api_client) + api_instance.link_jira_issue_to_case(case_id="case_id", body=body) diff --git a/examples/v2/case-management/MoveCaseToProject.py b/examples/v2/case-management/MoveCaseToProject.py new file mode 100644 index 0000000000..b1961ca56d --- /dev/null +++ b/examples/v2/case-management/MoveCaseToProject.py @@ -0,0 +1,24 @@ +""" +Update case project returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.case_management_api import CaseManagementApi +from datadog_api_client.v2.model.project_relationship import ProjectRelationship +from datadog_api_client.v2.model.project_relationship_data import ProjectRelationshipData +from datadog_api_client.v2.model.project_resource_type import ProjectResourceType + +body = ProjectRelationship( + data=ProjectRelationshipData( + id="e555e290-ed65-49bd-ae18-8acbfcf18db7", + type=ProjectResourceType.PROJECT, + ), +) + +configuration = Configuration() +configuration.unstable_operations["move_case_to_project"] = True +with ApiClient(configuration) as api_client: + api_instance = CaseManagementApi(api_client) + response = api_instance.move_case_to_project(case_id="case_id", body=body) + + print(response) diff --git a/examples/v2/case-management/UnlinkJiraIssue.py b/examples/v2/case-management/UnlinkJiraIssue.py new file mode 100644 index 0000000000..16751e9f31 --- /dev/null +++ b/examples/v2/case-management/UnlinkJiraIssue.py @@ -0,0 +1,14 @@ +""" +Remove Jira issue link from case returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.case_management_api import CaseManagementApi + +configuration = Configuration() +configuration.unstable_operations["unlink_jira_issue"] = True +with ApiClient(configuration) as api_client: + api_instance = CaseManagementApi(api_client) + api_instance.unlink_jira_issue( + case_id="case_id", + ) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index cf63f54a1c..00e88d44db 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -266,6 +266,13 @@ def __init__( "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/src/datadog_api_client/v2/api/case_management_api.py b/src/datadog_api_client/v2/api/case_management_api.py index bb4974cfe6..97d06f72f8 100644 --- a/src/datadog_api_client/v2/api/case_management_api.py +++ b/src/datadog_api_client/v2/api/case_management_api.py @@ -30,6 +30,12 @@ from datadog_api_client.v2.model.case_update_custom_attribute_request import CaseUpdateCustomAttributeRequest from datadog_api_client.v2.model.case_update_description_request import CaseUpdateDescriptionRequest from datadog_api_client.v2.model.case_update_priority_request import CaseUpdatePriorityRequest +from datadog_api_client.v2.model.relationship_to_incident_request import RelationshipToIncidentRequest +from datadog_api_client.v2.model.jira_issue_link_request import JiraIssueLinkRequest +from datadog_api_client.v2.model.jira_issue_create_request import JiraIssueCreateRequest +from datadog_api_client.v2.model.notebook_create_request import NotebookCreateRequest +from datadog_api_client.v2.model.project_relationship import ProjectRelationship +from datadog_api_client.v2.model.service_now_ticket_create_request import ServiceNowTicketCreateRequest from datadog_api_client.v2.model.case_update_status_request import CaseUpdateStatusRequest from datadog_api_client.v2.model.case_update_title_request import CaseUpdateTitleRequest @@ -142,6 +148,84 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_case_jira_issue_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cases/{case_id}/relationships/jira_issues", + "operation_id": "create_case_jira_issue", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "case_id": { + "required": True, + "openapi_types": (str,), + "attribute": "case_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (JiraIssueCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._create_case_notebook_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cases/{case_id}/relationships/notebook", + "operation_id": "create_case_notebook", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "case_id": { + "required": True, + "openapi_types": (str,), + "attribute": "case_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (NotebookCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._create_case_service_now_ticket_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cases/{case_id}/relationships/servicenow_tickets", + "operation_id": "create_case_service_now_ticket", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "case_id": { + "required": True, + "openapi_types": (str,), + "attribute": "case_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (ServiceNowTicketCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_project_endpoint = _Endpoint( settings={ "response_type": (ProjectResponse,), @@ -305,6 +389,84 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._link_incident_endpoint = _Endpoint( + settings={ + "response_type": (CaseResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cases/{case_id}/relationships/incidents", + "operation_id": "link_incident", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "case_id": { + "required": True, + "openapi_types": (str,), + "attribute": "case_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (RelationshipToIncidentRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._link_jira_issue_to_case_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cases/{case_id}/relationships/jira_issues", + "operation_id": "link_jira_issue_to_case", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "case_id": { + "required": True, + "openapi_types": (str,), + "attribute": "case_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (JiraIssueLinkRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._move_case_to_project_endpoint = _Endpoint( + settings={ + "response_type": (CaseResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cases/{case_id}/relationships/project", + "operation_id": "move_case_to_project", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "case_id": { + "required": True, + "openapi_types": (str,), + "attribute": "case_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (ProjectRelationship,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._search_cases_endpoint = _Endpoint( settings={ "response_type": (CasesResponse,), @@ -399,6 +561,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._unlink_jira_issue_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cases/{case_id}/relationships/jira_issues", + "operation_id": "unlink_jira_issue", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "case_id": { + "required": True, + "openapi_types": (str,), + "attribute": "case_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._update_attributes_endpoint = _Endpoint( settings={ "response_type": (CaseResponse,), @@ -644,6 +829,72 @@ def create_case( return self._create_case_endpoint.call_with_http_info(**kwargs) + def create_case_jira_issue( + self, + case_id: str, + body: JiraIssueCreateRequest, + ) -> None: + """Create Jira issue for case. + + Create a new Jira issue and link it to a case + + :param case_id: Case's UUID or key + :type case_id: str + :param body: Jira issue creation request + :type body: JiraIssueCreateRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["case_id"] = case_id + + kwargs["body"] = body + + return self._create_case_jira_issue_endpoint.call_with_http_info(**kwargs) + + def create_case_notebook( + self, + case_id: str, + body: NotebookCreateRequest, + ) -> None: + """Create investigation notebook for case. + + Create a new investigation notebook and link it to a case + + :param case_id: Case's UUID or key + :type case_id: str + :param body: Notebook creation request + :type body: NotebookCreateRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["case_id"] = case_id + + kwargs["body"] = body + + return self._create_case_notebook_endpoint.call_with_http_info(**kwargs) + + def create_case_service_now_ticket( + self, + case_id: str, + body: ServiceNowTicketCreateRequest, + ) -> None: + """Create ServiceNow ticket for case. + + Create a new ServiceNow incident ticket and link it to a case + + :param case_id: Case's UUID or key + :type case_id: str + :param body: ServiceNow ticket creation request + :type body: ServiceNowTicketCreateRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["case_id"] = case_id + + kwargs["body"] = body + + return self._create_case_service_now_ticket_endpoint.call_with_http_info(**kwargs) + def create_project( self, body: ProjectCreateRequest, @@ -768,6 +1019,72 @@ def get_projects( kwargs: Dict[str, Any] = {} return self._get_projects_endpoint.call_with_http_info(**kwargs) + def link_incident( + self, + case_id: str, + body: RelationshipToIncidentRequest, + ) -> CaseResponse: + """Link incident to case. + + Link an incident to a case + + :param case_id: Case's UUID or key + :type case_id: str + :param body: Incident link request + :type body: RelationshipToIncidentRequest + :rtype: CaseResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["case_id"] = case_id + + kwargs["body"] = body + + return self._link_incident_endpoint.call_with_http_info(**kwargs) + + def link_jira_issue_to_case( + self, + case_id: str, + body: JiraIssueLinkRequest, + ) -> None: + """Link existing Jira issue to case. + + Link an existing Jira issue to a case + + :param case_id: Case's UUID or key + :type case_id: str + :param body: Jira issue link request + :type body: JiraIssueLinkRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["case_id"] = case_id + + kwargs["body"] = body + + return self._link_jira_issue_to_case_endpoint.call_with_http_info(**kwargs) + + def move_case_to_project( + self, + case_id: str, + body: ProjectRelationship, + ) -> CaseResponse: + """Update case project. + + Update the project associated with a case + + :param case_id: Case's UUID or key + :type case_id: str + :param body: Project update request + :type body: ProjectRelationship + :rtype: CaseResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["case_id"] = case_id + + kwargs["body"] = body + + return self._move_case_to_project_endpoint.call_with_http_info(**kwargs) + def search_cases( self, *, @@ -910,6 +1227,23 @@ def unassign_case( return self._unassign_case_endpoint.call_with_http_info(**kwargs) + def unlink_jira_issue( + self, + case_id: str, + ) -> None: + """Remove Jira issue link from case. + + Remove the link between a Jira issue and a case + + :param case_id: Case's UUID or key + :type case_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["case_id"] = case_id + + return self._unlink_jira_issue_endpoint.call_with_http_info(**kwargs) + def update_attributes( self, case_id: str, diff --git a/src/datadog_api_client/v2/model/incident_relationship_data.py b/src/datadog_api_client/v2/model/incident_relationship_data.py new file mode 100644 index 0000000000..d1088c6da5 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_relationship_data.py @@ -0,0 +1,46 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_resource_type import IncidentResourceType + + +class IncidentRelationshipData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_resource_type import IncidentResourceType + + return { + "id": (str,), + "type": (IncidentResourceType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: IncidentResourceType, **kwargs): + """ + Incident relationship data + + :param id: Incident identifier + :type id: str + + :param type: Incident resource type + :type type: IncidentResourceType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_resource_type.py b/src/datadog_api_client/v2/model/incident_resource_type.py new file mode 100644 index 0000000000..1a95489510 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_resource_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class IncidentResourceType(ModelSimple): + """ + Incident resource type + + :param value: If omitted defaults to "incidents". Must be one of ["incidents"]. + :type value: str + """ + + allowed_values = { + "incidents", + } + INCIDENTS: ClassVar["IncidentResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentResourceType.INCIDENTS = IncidentResourceType("incidents") diff --git a/src/datadog_api_client/v2/model/jira_issue_create_attributes.py b/src/datadog_api_client/v2/model/jira_issue_create_attributes.py new file mode 100644 index 0000000000..03323d50a0 --- /dev/null +++ b/src/datadog_api_client/v2/model/jira_issue_create_attributes.py @@ -0,0 +1,81 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class JiraIssueCreateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "fields": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "issue_type_id": (str,), + "jira_account_id": (str,), + "project_id": (str,), + } + + attribute_map = { + "fields": "fields", + "issue_type_id": "issue_type_id", + "jira_account_id": "jira_account_id", + "project_id": "project_id", + } + + def __init__( + self_, + issue_type_id: str, + jira_account_id: str, + project_id: str, + fields: Union[Dict[str, Any], UnsetType] = unset, + **kwargs, + ): + """ + Jira issue creation attributes + + :param fields: Additional Jira fields + :type fields: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param issue_type_id: Jira issue type ID + :type issue_type_id: str + + :param jira_account_id: Jira account ID + :type jira_account_id: str + + :param project_id: Jira project ID + :type project_id: str + """ + if fields is not unset: + kwargs["fields"] = fields + super().__init__(kwargs) + + self_.issue_type_id = issue_type_id + self_.jira_account_id = jira_account_id + self_.project_id = project_id diff --git a/src/datadog_api_client/v2/model/jira_issue_create_data.py b/src/datadog_api_client/v2/model/jira_issue_create_data.py new file mode 100644 index 0000000000..a4591c938b --- /dev/null +++ b/src/datadog_api_client/v2/model/jira_issue_create_data.py @@ -0,0 +1,48 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.jira_issue_create_attributes import JiraIssueCreateAttributes + from datadog_api_client.v2.model.jira_issue_resource_type import JiraIssueResourceType + + +class JiraIssueCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.jira_issue_create_attributes import JiraIssueCreateAttributes + from datadog_api_client.v2.model.jira_issue_resource_type import JiraIssueResourceType + + return { + "attributes": (JiraIssueCreateAttributes,), + "type": (JiraIssueResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: JiraIssueCreateAttributes, type: JiraIssueResourceType, **kwargs): + """ + Jira issue creation data + + :param attributes: Jira issue creation attributes + :type attributes: JiraIssueCreateAttributes + + :param type: Jira issue resource type + :type type: JiraIssueResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/jira_issue_create_request.py b/src/datadog_api_client/v2/model/jira_issue_create_request.py new file mode 100644 index 0000000000..131cb06169 --- /dev/null +++ b/src/datadog_api_client/v2/model/jira_issue_create_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.jira_issue_create_data import JiraIssueCreateData + + +class JiraIssueCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.jira_issue_create_data import JiraIssueCreateData + + return { + "data": (JiraIssueCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: JiraIssueCreateData, **kwargs): + """ + Jira issue creation request + + :param data: Jira issue creation data + :type data: JiraIssueCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/jira_issue_link_attributes.py b/src/datadog_api_client/v2/model/jira_issue_link_attributes.py new file mode 100644 index 0000000000..3e9cf2215c --- /dev/null +++ b/src/datadog_api_client/v2/model/jira_issue_link_attributes.py @@ -0,0 +1,33 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class JiraIssueLinkAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "jira_issue_url": (str,), + } + + attribute_map = { + "jira_issue_url": "jira_issue_url", + } + + def __init__(self_, jira_issue_url: str, **kwargs): + """ + Jira issue link attributes + + :param jira_issue_url: URL of the Jira issue + :type jira_issue_url: str + """ + super().__init__(kwargs) + + self_.jira_issue_url = jira_issue_url diff --git a/src/datadog_api_client/v2/model/jira_issue_link_data.py b/src/datadog_api_client/v2/model/jira_issue_link_data.py new file mode 100644 index 0000000000..bf78f614bb --- /dev/null +++ b/src/datadog_api_client/v2/model/jira_issue_link_data.py @@ -0,0 +1,48 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.jira_issue_link_attributes import JiraIssueLinkAttributes + from datadog_api_client.v2.model.jira_issue_resource_type import JiraIssueResourceType + + +class JiraIssueLinkData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.jira_issue_link_attributes import JiraIssueLinkAttributes + from datadog_api_client.v2.model.jira_issue_resource_type import JiraIssueResourceType + + return { + "attributes": (JiraIssueLinkAttributes,), + "type": (JiraIssueResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: JiraIssueLinkAttributes, type: JiraIssueResourceType, **kwargs): + """ + Jira issue link data + + :param attributes: Jira issue link attributes + :type attributes: JiraIssueLinkAttributes + + :param type: Jira issue resource type + :type type: JiraIssueResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/jira_issue_link_request.py b/src/datadog_api_client/v2/model/jira_issue_link_request.py new file mode 100644 index 0000000000..9f7d8c981e --- /dev/null +++ b/src/datadog_api_client/v2/model/jira_issue_link_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.jira_issue_link_data import JiraIssueLinkData + + +class JiraIssueLinkRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.jira_issue_link_data import JiraIssueLinkData + + return { + "data": (JiraIssueLinkData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: JiraIssueLinkData, **kwargs): + """ + Jira issue link request + + :param data: Jira issue link data + :type data: JiraIssueLinkData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/jira_issue_resource_type.py b/src/datadog_api_client/v2/model/jira_issue_resource_type.py new file mode 100644 index 0000000000..e3f6f44f7d --- /dev/null +++ b/src/datadog_api_client/v2/model/jira_issue_resource_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class JiraIssueResourceType(ModelSimple): + """ + Jira issue resource type + + :param value: If omitted defaults to "issues". Must be one of ["issues"]. + :type value: str + """ + + allowed_values = { + "issues", + } + ISSUES: ClassVar["JiraIssueResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +JiraIssueResourceType.ISSUES = JiraIssueResourceType("issues") diff --git a/src/datadog_api_client/v2/model/notebook_create_data.py b/src/datadog_api_client/v2/model/notebook_create_data.py new file mode 100644 index 0000000000..86c25e05e3 --- /dev/null +++ b/src/datadog_api_client/v2/model/notebook_create_data.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.notebook_resource_type import NotebookResourceType + + +class NotebookCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.notebook_resource_type import NotebookResourceType + + return { + "type": (NotebookResourceType,), + } + + attribute_map = { + "type": "type", + } + + def __init__(self_, type: NotebookResourceType, **kwargs): + """ + Notebook creation data + + :param type: Notebook resource type + :type type: NotebookResourceType + """ + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/notebook_create_request.py b/src/datadog_api_client/v2/model/notebook_create_request.py new file mode 100644 index 0000000000..c549ba48e9 --- /dev/null +++ b/src/datadog_api_client/v2/model/notebook_create_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.notebook_create_data import NotebookCreateData + + +class NotebookCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.notebook_create_data import NotebookCreateData + + return { + "data": (NotebookCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: NotebookCreateData, **kwargs): + """ + Notebook creation request + + :param data: Notebook creation data + :type data: NotebookCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/notebook_resource_type.py b/src/datadog_api_client/v2/model/notebook_resource_type.py new file mode 100644 index 0000000000..e14eb09b1a --- /dev/null +++ b/src/datadog_api_client/v2/model/notebook_resource_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class NotebookResourceType(ModelSimple): + """ + Notebook resource type + + :param value: If omitted defaults to "notebook". Must be one of ["notebook"]. + :type value: str + """ + + allowed_values = { + "notebook", + } + NOTEBOOK: ClassVar["NotebookResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +NotebookResourceType.NOTEBOOK = NotebookResourceType("notebook") diff --git a/src/datadog_api_client/v2/model/relationship_to_incident_request.py b/src/datadog_api_client/v2/model/relationship_to_incident_request.py new file mode 100644 index 0000000000..cf2508253c --- /dev/null +++ b/src/datadog_api_client/v2/model/relationship_to_incident_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_relationship_data import IncidentRelationshipData + + +class RelationshipToIncidentRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_relationship_data import IncidentRelationshipData + + return { + "data": (IncidentRelationshipData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentRelationshipData, **kwargs): + """ + Relationship to incident request + + :param data: Incident relationship data + :type data: IncidentRelationshipData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/service_now_ticket_create_attributes.py b/src/datadog_api_client/v2/model/service_now_ticket_create_attributes.py new file mode 100644 index 0000000000..914abee8c2 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_now_ticket_create_attributes.py @@ -0,0 +1,43 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class ServiceNowTicketCreateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "assignment_group": (str,), + "instance_name": (str,), + } + + attribute_map = { + "assignment_group": "assignment_group", + "instance_name": "instance_name", + } + + def __init__(self_, instance_name: str, assignment_group: Union[str, UnsetType] = unset, **kwargs): + """ + ServiceNow ticket creation attributes + + :param assignment_group: ServiceNow assignment group + :type assignment_group: str, optional + + :param instance_name: ServiceNow instance name + :type instance_name: str + """ + if assignment_group is not unset: + kwargs["assignment_group"] = assignment_group + super().__init__(kwargs) + + self_.instance_name = instance_name diff --git a/src/datadog_api_client/v2/model/service_now_ticket_create_data.py b/src/datadog_api_client/v2/model/service_now_ticket_create_data.py new file mode 100644 index 0000000000..981773a4c5 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_now_ticket_create_data.py @@ -0,0 +1,48 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.service_now_ticket_create_attributes import ServiceNowTicketCreateAttributes + from datadog_api_client.v2.model.service_now_ticket_resource_type import ServiceNowTicketResourceType + + +class ServiceNowTicketCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_now_ticket_create_attributes import ServiceNowTicketCreateAttributes + from datadog_api_client.v2.model.service_now_ticket_resource_type import ServiceNowTicketResourceType + + return { + "attributes": (ServiceNowTicketCreateAttributes,), + "type": (ServiceNowTicketResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: ServiceNowTicketCreateAttributes, type: ServiceNowTicketResourceType, **kwargs): + """ + ServiceNow ticket creation data + + :param attributes: ServiceNow ticket creation attributes + :type attributes: ServiceNowTicketCreateAttributes + + :param type: ServiceNow ticket resource type + :type type: ServiceNowTicketResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/service_now_ticket_create_request.py b/src/datadog_api_client/v2/model/service_now_ticket_create_request.py new file mode 100644 index 0000000000..736b6d1f20 --- /dev/null +++ b/src/datadog_api_client/v2/model/service_now_ticket_create_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.service_now_ticket_create_data import ServiceNowTicketCreateData + + +class ServiceNowTicketCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.service_now_ticket_create_data import ServiceNowTicketCreateData + + return { + "data": (ServiceNowTicketCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ServiceNowTicketCreateData, **kwargs): + """ + ServiceNow ticket creation request + + :param data: ServiceNow ticket creation data + :type data: ServiceNowTicketCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/service_now_ticket_resource_type.py b/src/datadog_api_client/v2/model/service_now_ticket_resource_type.py new file mode 100644 index 0000000000..f0165af8fe --- /dev/null +++ b/src/datadog_api_client/v2/model/service_now_ticket_resource_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ServiceNowTicketResourceType(ModelSimple): + """ + ServiceNow ticket resource type + + :param value: If omitted defaults to "tickets". Must be one of ["tickets"]. + :type value: str + """ + + allowed_values = { + "tickets", + } + TICKETS: ClassVar["ServiceNowTicketResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ServiceNowTicketResourceType.TICKETS = ServiceNowTicketResourceType("tickets") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 010c5fb61c..8410731a2f 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2366,6 +2366,8 @@ ) from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType from datadog_api_client.v2.model.incident_related_object import IncidentRelatedObject +from datadog_api_client.v2.model.incident_relationship_data import IncidentRelationshipData +from datadog_api_client.v2.model.incident_resource_type import IncidentResourceType from datadog_api_client.v2.model.incident_responders_type import IncidentRespondersType from datadog_api_client.v2.model.incident_response import IncidentResponse from datadog_api_client.v2.model.incident_response_attributes import IncidentResponseAttributes @@ -2551,6 +2553,13 @@ from datadog_api_client.v2.model.jira_integration_metadata import JiraIntegrationMetadata from datadog_api_client.v2.model.jira_integration_metadata_issues_item import JiraIntegrationMetadataIssuesItem from datadog_api_client.v2.model.jira_issue import JiraIssue +from datadog_api_client.v2.model.jira_issue_create_attributes import JiraIssueCreateAttributes +from datadog_api_client.v2.model.jira_issue_create_data import JiraIssueCreateData +from datadog_api_client.v2.model.jira_issue_create_request import JiraIssueCreateRequest +from datadog_api_client.v2.model.jira_issue_link_attributes import JiraIssueLinkAttributes +from datadog_api_client.v2.model.jira_issue_link_data import JiraIssueLinkData +from datadog_api_client.v2.model.jira_issue_link_request import JiraIssueLinkRequest +from datadog_api_client.v2.model.jira_issue_resource_type import JiraIssueResourceType from datadog_api_client.v2.model.jira_issue_result import JiraIssueResult from datadog_api_client.v2.model.jira_issue_template_create_request import JiraIssueTemplateCreateRequest from datadog_api_client.v2.model.jira_issue_template_create_request_attributes import ( @@ -3036,6 +3045,9 @@ from datadog_api_client.v2.model.monthly_cost_attribution_meta import MonthlyCostAttributionMeta from datadog_api_client.v2.model.monthly_cost_attribution_pagination import MonthlyCostAttributionPagination from datadog_api_client.v2.model.monthly_cost_attribution_response import MonthlyCostAttributionResponse +from datadog_api_client.v2.model.notebook_create_data import NotebookCreateData +from datadog_api_client.v2.model.notebook_create_request import NotebookCreateRequest +from datadog_api_client.v2.model.notebook_resource_type import NotebookResourceType from datadog_api_client.v2.model.notebook_trigger_wrapper import NotebookTriggerWrapper from datadog_api_client.v2.model.notification_channel import NotificationChannel from datadog_api_client.v2.model.notification_channel_attributes import NotificationChannelAttributes @@ -4129,6 +4141,7 @@ ) from datadog_api_client.v2.model.relationship_to_incident_postmortem import RelationshipToIncidentPostmortem from datadog_api_client.v2.model.relationship_to_incident_postmortem_data import RelationshipToIncidentPostmortemData +from datadog_api_client.v2.model.relationship_to_incident_request import RelationshipToIncidentRequest from datadog_api_client.v2.model.relationship_to_incident_responder_data import RelationshipToIncidentResponderData from datadog_api_client.v2.model.relationship_to_incident_responders import RelationshipToIncidentResponders from datadog_api_client.v2.model.relationship_to_incident_type import RelationshipToIncidentType @@ -5031,6 +5044,10 @@ from datadog_api_client.v2.model.service_now_template_update_request_data import ServiceNowTemplateUpdateRequestData from datadog_api_client.v2.model.service_now_templates_response import ServiceNowTemplatesResponse from datadog_api_client.v2.model.service_now_ticket import ServiceNowTicket +from datadog_api_client.v2.model.service_now_ticket_create_attributes import ServiceNowTicketCreateAttributes +from datadog_api_client.v2.model.service_now_ticket_create_data import ServiceNowTicketCreateData +from datadog_api_client.v2.model.service_now_ticket_create_request import ServiceNowTicketCreateRequest +from datadog_api_client.v2.model.service_now_ticket_resource_type import ServiceNowTicketResourceType from datadog_api_client.v2.model.service_now_ticket_result import ServiceNowTicketResult from datadog_api_client.v2.model.service_now_user_attributes import ServiceNowUserAttributes from datadog_api_client.v2.model.service_now_user_data import ServiceNowUserData @@ -7545,6 +7562,8 @@ "IncidentNotificationTemplateUpdateData", "IncidentPostmortemType", "IncidentRelatedObject", + "IncidentRelationshipData", + "IncidentResourceType", "IncidentRespondersType", "IncidentResponse", "IncidentResponseAttributes", @@ -7712,6 +7731,13 @@ "JiraIntegrationMetadata", "JiraIntegrationMetadataIssuesItem", "JiraIssue", + "JiraIssueCreateAttributes", + "JiraIssueCreateData", + "JiraIssueCreateRequest", + "JiraIssueLinkAttributes", + "JiraIssueLinkData", + "JiraIssueLinkRequest", + "JiraIssueResourceType", "JiraIssueResult", "JiraIssueTemplateCreateRequest", "JiraIssueTemplateCreateRequestAttributes", @@ -8087,6 +8113,9 @@ "MonthlyCostAttributionMeta", "MonthlyCostAttributionPagination", "MonthlyCostAttributionResponse", + "NotebookCreateData", + "NotebookCreateRequest", + "NotebookResourceType", "NotebookTriggerWrapper", "NotificationChannel", "NotificationChannelAttributes", @@ -8692,6 +8721,7 @@ "RelationshipToIncidentNotificationTemplateData", "RelationshipToIncidentPostmortem", "RelationshipToIncidentPostmortemData", + "RelationshipToIncidentRequest", "RelationshipToIncidentResponderData", "RelationshipToIncidentResponders", "RelationshipToIncidentType", @@ -9326,6 +9356,10 @@ "ServiceNowTemplateUpdateRequestData", "ServiceNowTemplatesResponse", "ServiceNowTicket", + "ServiceNowTicketCreateAttributes", + "ServiceNowTicketCreateData", + "ServiceNowTicketCreateRequest", + "ServiceNowTicketResourceType", "ServiceNowTicketResult", "ServiceNowUserAttributes", "ServiceNowUserData", diff --git a/tests/v2/features/case_management.feature b/tests/v2/features/case_management.feature index 2f23915567..6dd08c4110 100644 --- a/tests/v2/features/case_management.feature +++ b/tests/v2/features/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/tests/v2/features/undo.json b/tests/v2/features/undo.json index 5a347bddf1..e379db6756 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/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": {