From 0818c9d5f16d4343f9cbd5fc09c620996c497e1b Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 2 Jun 2026 16:22:38 +0000 Subject: [PATCH] Regenerate client from commit eec3803 of spec repo --- .generator/schemas/v2/openapi.yaml | 484 ++++++++++++++++++ .../AttachServiceNowTicket.rb | 33 ++ .../CreateServiceNowTickets.rb | 38 ++ .../UpdateFindingsAssignee.rb | 28 + features/scenarios_model_mapping.rb | 9 + features/v2/security_monitoring.feature | 72 +++ features/v2/undo.json | 25 + lib/datadog_api_client/configuration.rb | 3 + lib/datadog_api_client/inflector.rb | 21 + .../v2/api/security_monitoring_api.rb | 222 ++++++++ .../v2/models/assignee_data_type.rb | 26 + .../v2/models/assignee_request.rb | 123 +++++ .../v2/models/assignee_request_data.rb | 164 ++++++ .../assignee_request_data_attributes.rb | 105 ++++ .../assignee_request_data_relationships.rb | 123 +++++ .../v2/models/assignee_response.rb | 133 +++++ .../v2/models/assignee_response_data.rb | 165 ++++++ .../assignee_response_data_attributes.rb | 105 ++++ .../v2/models/assignee_response_meta.rb | 119 +++++ .../v2/models/assignment_result.rb | 186 +++++++ .../attach_service_now_ticket_request.rb | 123 +++++ .../attach_service_now_ticket_request_data.rb | 165 ++++++ ...vice_now_ticket_request_data_attributes.rb | 123 +++++ ...e_now_ticket_request_data_relationships.rb | 144 ++++++ ...create_service_now_ticket_request_array.rb | 125 +++++ .../create_service_now_ticket_request_data.rb | 154 ++++++ ...vice_now_ticket_request_data_attributes.rb | 135 +++++ ...e_now_ticket_request_data_relationships.rb | 144 ++++++ .../finding_case_response_data_attributes.rb | 12 +- .../v2/models/finding_service_now_ticket.rb | 115 +++++ .../finding_service_now_ticket_result.rb | 155 ++++++ .../models/service_now_tickets_data_type.rb | 26 + 32 files changed, 3604 insertions(+), 1 deletion(-) create mode 100644 examples/v2/security-monitoring/AttachServiceNowTicket.rb create mode 100644 examples/v2/security-monitoring/CreateServiceNowTickets.rb create mode 100644 examples/v2/security-monitoring/UpdateFindingsAssignee.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_request.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_request_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_request_data_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_response.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_response_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/assignee_response_meta.rb create mode 100644 lib/datadog_api_client/v2/models/assignment_result.rb create mode 100644 lib/datadog_api_client/v2/models/attach_service_now_ticket_request.rb create mode 100644 lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/create_service_now_ticket_request_array.rb create mode 100644 lib/datadog_api_client/v2/models/create_service_now_ticket_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/create_service_now_ticket_request_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/create_service_now_ticket_request_data_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/finding_service_now_ticket.rb create mode 100644 lib/datadog_api_client/v2/models/finding_service_now_ticket_result.rb create mode 100644 lib/datadog_api_client/v2/models/service_now_tickets_data_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index a02697caa79d..c31c23eb026c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9976,6 +9976,131 @@ components: description: The product code for which the seats were assigned. type: string type: object + AssigneeDataType: + default: assignee + description: Assignee resource type. + enum: + - assignee + example: assignee + type: string + x-enum-varnames: + - ASSIGNEE + AssigneeRequest: + description: Request to assign or unassign security findings. + properties: + data: + $ref: "#/components/schemas/AssigneeRequestData" + required: + - data + type: object + AssigneeRequestData: + description: Data of the assignee request. + properties: + attributes: + $ref: "#/components/schemas/AssigneeRequestDataAttributes" + id: + description: Unique identifier of the assignee request. + example: "00000000-0000-0000-0000-000000000001" + type: string + relationships: + $ref: "#/components/schemas/AssigneeRequestDataRelationships" + type: + $ref: "#/components/schemas/AssigneeDataType" + required: + - relationships + - type + type: object + AssigneeRequestDataAttributes: + description: Attributes of the assignee request. + properties: + assignee_id: + description: Unique identifier of the Datadog user to assign the security findings to. If this field is not provided, the security findings are unassigned. + example: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0" + type: string + type: object + AssigneeRequestDataRelationships: + description: Relationships of the assignee request. + properties: + findings: + $ref: "#/components/schemas/Findings" + description: Security findings to assign or unassign. + required: + - findings + type: object + AssigneeResponse: + description: Response for the assign or unassign request. + properties: + data: + $ref: "#/components/schemas/AssigneeResponseData" + meta: + $ref: "#/components/schemas/AssigneeResponseMeta" + required: + - data + type: object + AssigneeResponseData: + description: Data of the assignee response. + properties: + attributes: + $ref: "#/components/schemas/AssigneeResponseDataAttributes" + id: + description: Unique identifier of the assignee request. + example: "00000000-0000-0000-0000-000000000001" + type: string + type: + $ref: "#/components/schemas/AssigneeDataType" + required: + - id + - type + - attributes + type: object + AssigneeResponseDataAttributes: + description: Attributes of the assignee response. + properties: + assignee_id: + description: Unique identifier of the Datadog user assigned to the security findings. Omitted when the findings were unassigned. + example: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0" + type: string + type: object + AssigneeResponseMeta: + description: Per-finding warnings and failures produced while processing the bulk assignee request. + properties: + failures: + description: Findings that could not be assigned or unassigned. + items: + $ref: "#/components/schemas/AssignmentResult" + type: array + warnings: + description: Findings for which the assignment succeeded but a non-critical error occurred during processing. + items: + $ref: "#/components/schemas/AssignmentResult" + type: array + type: object + AssignmentResult: + description: Per-finding outcome of an assign or unassign operation. + properties: + detail: + description: Human-readable explanation of the outcome. + example: "failed to update finding assignee" + type: string + finding_id: + description: Unique identifier of the security finding. + example: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==" + type: string + status: + description: HTTP-like status code describing the outcome for this finding. + example: 500 + format: int32 + type: integer + title: + description: Short label describing the outcome for this finding. + example: "Internal Server Error" + type: string + required: + - finding_id + - status + - title + - detail + type: object AttachCaseRequest: description: Request for attaching security findings to a case. properties: @@ -10047,6 +10172,51 @@ components: - findings - project type: object + AttachServiceNowTicketRequest: + description: Request for attaching security findings to a ServiceNow ticket. + properties: + data: + $ref: "#/components/schemas/AttachServiceNowTicketRequestData" + required: + - data + type: object + AttachServiceNowTicketRequestData: + description: Data of the ServiceNow ticket to attach security findings to. + properties: + attributes: + $ref: "#/components/schemas/AttachServiceNowTicketRequestDataAttributes" + relationships: + $ref: "#/components/schemas/AttachServiceNowTicketRequestDataRelationships" + type: + $ref: "#/components/schemas/ServiceNowTicketsDataType" + required: + - attributes + - relationships + - type + type: object + AttachServiceNowTicketRequestDataAttributes: + description: Attributes of the ServiceNow ticket to attach security findings to. + properties: + servicenow_ticket_url: + description: URL of the ServiceNow incident to attach security findings to. Must be a service-now.com URL pointing to an incident record. + example: "https://example.service-now.com/now/nav/ui/classic/params/target/incident.do?sys_id=abcdef0123456789abcdef0123456789" + type: string + required: + - servicenow_ticket_url + type: object + AttachServiceNowTicketRequestDataRelationships: + description: Relationships of the ServiceNow ticket to attach security findings to. + properties: + findings: + $ref: "#/components/schemas/Findings" + description: Security findings to attach to the ServiceNow ticket. + project: + $ref: "#/components/schemas/CaseManagementProject" + description: Case management project with the ServiceNow integration configured. It is used to attach security findings to the ServiceNow ticket. + required: + - findings + - project + type: object Attachment: description: An attachment response containing the attachment data and related objects. properties: @@ -23548,6 +23718,63 @@ components: type: string x-enum-varnames: - CREATE_RULESET + CreateServiceNowTicketRequestArray: + description: List of requests to create ServiceNow tickets for security findings. + properties: + data: + description: Array of ServiceNow ticket creation request data objects. + items: + $ref: "#/components/schemas/CreateServiceNowTicketRequestData" + type: array + required: + - data + type: object + CreateServiceNowTicketRequestData: + description: Data of the ServiceNow ticket to create. + properties: + attributes: + $ref: "#/components/schemas/CreateServiceNowTicketRequestDataAttributes" + relationships: + $ref: "#/components/schemas/CreateServiceNowTicketRequestDataRelationships" + type: + $ref: "#/components/schemas/ServiceNowTicketsDataType" + required: + - relationships + - type + type: object + CreateServiceNowTicketRequestDataAttributes: + description: Attributes of the ServiceNow ticket to create. + properties: + assignee_id: + description: Unique identifier of the Datadog user assigned to the case backing the ServiceNow ticket. + example: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0" + type: string + description: + description: Description of the ServiceNow ticket. If not provided, the description will be automatically generated. + example: "A description of the ServiceNow ticket." + type: string + priority: + $ref: "#/components/schemas/CasePriority" + description: Datadog case priority mapped to the ServiceNow ticket priority. If not provided, the priority will be automatically set to "NOT_DEFINED". + example: "P4" + title: + description: Title of the ServiceNow ticket. If not provided, the title will be automatically generated. + example: "A title for the ServiceNow ticket." + type: string + type: object + CreateServiceNowTicketRequestDataRelationships: + description: Relationships of the ServiceNow ticket to create. + properties: + findings: + $ref: "#/components/schemas/Findings" + description: Security findings to create a ServiceNow ticket for. + project: + $ref: "#/components/schemas/CaseManagementProject" + description: Case management project configured with the ServiceNow integration. It is used to create the ServiceNow ticket. + required: + - findings + - project + type: object CreateStatusPageRequest: description: Request object for creating a status page. example: @@ -33981,6 +34208,9 @@ components: description: Priority of the case. example: "P4" type: string + servicenow_ticket: + $ref: "#/components/schemas/FindingServiceNowTicket" + description: ServiceNow ticket associated with the case. status: description: Status of the case. example: "OPEN" @@ -34170,6 +34400,44 @@ components: example: Soft delete is enabled for Azure Storage type: string type: object + FindingServiceNowTicket: + description: ServiceNow ticket associated with the case. + properties: + result: + $ref: "#/components/schemas/FindingServiceNowTicketResult" + status: + description: Status of the ServiceNow ticket operation. Can be "COMPLETED" if successful, or "FAILED" if the operation failed. + example: "COMPLETED" + type: string + type: object + FindingServiceNowTicketResult: + description: Result of the ServiceNow ticket creation or attachment. + properties: + instance_name: + description: ServiceNow instance name extracted from the ticket URL. + example: "example" + type: string + sys_id: + description: Unique identifier of the ServiceNow incident record. + example: "abcdef0123456789abcdef0123456789" + type: string + sys_target_link: + description: Direct link to the ServiceNow incident record. + example: "https://example.service-now.com/incident.do?sys_id=abcdef0123456789abcdef0123456789" + type: string + sys_target_sys_id: + description: Unique identifier of the target ServiceNow record. + example: "abcdef0123456789abcdef0123456789" + type: string + table_name: + description: ServiceNow table containing the incident record. + example: "incident" + type: string + url: + description: URL of the ServiceNow incident record. + example: "https://example.service-now.com/now/nav/ui/classic/params/target/incident.do?sys_id=abcdef0123456789abcdef0123456789" + type: string + type: object FindingStatus: description: The status of the finding. enum: @@ -83298,6 +83566,15 @@ components: description: Link to the Incident created on ServiceNow type: string type: object + ServiceNowTicketsDataType: + default: servicenow_tickets + description: ServiceNow tickets resource type. + enum: + - servicenow_tickets + example: servicenow_tickets + type: string + x-enum-varnames: + - SERVICENOW_TICKETS ServiceNowUserAttributes: description: Attributes of a ServiceNow user properties: @@ -153408,6 +153685,69 @@ paths: permissions: - security_monitoring_findings_read - appsec_vm_read + /api/v2/security/findings/assignee: + patch: + description: >- + Assign or unassign security findings. + + You can assign up to 100 security findings per request. Set `assignee_id` to the unique identifier of the Datadog user you want to assign the findings to. Omit `assignee_id` (or set it to `null`) to unassign the findings. Per-finding warnings and failures are returned in the response `meta` object. + operationId: UpdateFindingsAssignee + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + assignee_id: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0" + id: "00000000-0000-0000-0000-000000000001" + relationships: + findings: + data: + - id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==" + type: "findings" + type: "assignee" + schema: + $ref: "#/components/schemas/AssigneeRequest" + required: true + responses: + "202": + content: + application/json: + examples: + default: + value: + data: + attributes: + assignee_id: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0" + id: "00000000-0000-0000-0000-000000000001" + type: "assignee" + schema: + $ref: "#/components/schemas/AssigneeResponse" + description: Accepted + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Assign or unassign security findings + tags: + - "Security Monitoring" + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + 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/security/findings/cases: delete: description: >- @@ -153875,6 +154215,150 @@ paths: permissions: - security_monitoring_findings_read - appsec_vm_read + /api/v2/security/findings/servicenow_tickets: + patch: + description: >- + Attach security findings to a ServiceNow ticket by providing the ServiceNow ticket URL. + + You can attach up to 50 security findings per ServiceNow ticket. If the ServiceNow ticket is not linked to any case, this operation will create a case for the security findings and link the ServiceNow ticket to the newly created case. Security findings that are already attached to another ServiceNow ticket will be detached from their previous ServiceNow ticket and attached to the specified ServiceNow ticket. + operationId: AttachServiceNowTicket + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + servicenow_ticket_url: https://example.service-now.com/now/nav/ui/classic/params/target/incident.do?sys_id=abcdef0123456789abcdef0123456789 + relationships: + findings: + data: + - id: ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw== + type: findings + project: + data: + id: aeadc05e-98a8-11ec-ac2c-da7ad0900001 + type: projects + type: servicenow_tickets + schema: + $ref: "#/components/schemas/AttachServiceNowTicketRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + description: A description of the ServiceNow ticket. + modified_at: "2024-01-01T00:00:00+00:00" + priority: P4 + status: OPEN + title: A title for the ServiceNow ticket. + id: 00000000-0000-0000-0000-000000000006 + type: cases + schema: + $ref: "#/components/schemas/FindingCaseResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Attach security findings to a ServiceNow ticket + tags: + - "Security Monitoring" + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + 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 ServiceNow tickets for security findings. + + This operation creates a case in Datadog and a ServiceNow ticket linked to that case for bidirectional sync between Datadog and ServiceNow. You can create up to 50 ServiceNow tickets per request and associate up to 50 security findings per ServiceNow ticket. Security findings that are already attached to another ServiceNow ticket will be detached from their previous ServiceNow ticket and attached to the newly created ServiceNow ticket. + operationId: CreateServiceNowTickets + requestBody: + content: + application/json: + examples: + default: + value: + data: + - attributes: + assignee_id: f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0 + description: A description of the ServiceNow ticket. + priority: NOT_DEFINED + title: A title for the ServiceNow ticket. + relationships: + findings: + data: + - id: ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw== + type: findings + project: + data: + id: aeadc05e-98a8-11ec-ac2c-da7ad0900001 + type: projects + type: servicenow_tickets + schema: + $ref: "#/components/schemas/CreateServiceNowTicketRequestArray" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2024-01-01T00:00:00+00:00" + description: A description of the ServiceNow ticket. + modified_at: "2024-01-01T00:00:00+00:00" + priority: P4 + status: OPEN + title: A title for the ServiceNow ticket. + id: 00000000-0000-0000-0000-000000000005 + type: cases + schema: + $ref: "#/components/schemas/FindingCaseResponseArray" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create ServiceNow tickets for security findings + tags: + - "Security Monitoring" + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + 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/security/sboms: get: description: |- diff --git a/examples/v2/security-monitoring/AttachServiceNowTicket.rb b/examples/v2/security-monitoring/AttachServiceNowTicket.rb new file mode 100644 index 000000000000..fa0191d7b75f --- /dev/null +++ b/examples/v2/security-monitoring/AttachServiceNowTicket.rb @@ -0,0 +1,33 @@ +# Attach security findings to a ServiceNow ticket returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.attach_service_now_ticket".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::AttachServiceNowTicketRequest.new({ + data: DatadogAPIClient::V2::AttachServiceNowTicketRequestData.new({ + attributes: DatadogAPIClient::V2::AttachServiceNowTicketRequestDataAttributes.new({ + servicenow_ticket_url: "https://example.service-now.com/now/nav/ui/classic/params/target/incident.do?sys_id=abcdef0123456789abcdef0123456789", + }), + relationships: DatadogAPIClient::V2::AttachServiceNowTicketRequestDataRelationships.new({ + findings: DatadogAPIClient::V2::Findings.new({ + data: [ + DatadogAPIClient::V2::FindingData.new({ + id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + type: DatadogAPIClient::V2::FindingDataType::FINDINGS, + }), + ], + }), + project: DatadogAPIClient::V2::CaseManagementProject.new({ + data: DatadogAPIClient::V2::CaseManagementProjectData.new({ + id: "aeadc05e-98a8-11ec-ac2c-da7ad0900001", + type: DatadogAPIClient::V2::CaseManagementProjectDataType::PROJECTS, + }), + }), + }), + type: DatadogAPIClient::V2::ServiceNowTicketsDataType::SERVICENOW_TICKETS, + }), +}) +p api_instance.attach_service_now_ticket(body) diff --git a/examples/v2/security-monitoring/CreateServiceNowTickets.rb b/examples/v2/security-monitoring/CreateServiceNowTickets.rb new file mode 100644 index 000000000000..e87c00b1bbc6 --- /dev/null +++ b/examples/v2/security-monitoring/CreateServiceNowTickets.rb @@ -0,0 +1,38 @@ +# Create ServiceNow tickets for security findings returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_service_now_tickets".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::CreateServiceNowTicketRequestArray.new({ + data: [ + DatadogAPIClient::V2::CreateServiceNowTicketRequestData.new({ + attributes: DatadogAPIClient::V2::CreateServiceNowTicketRequestDataAttributes.new({ + assignee_id: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0", + description: "A description of the ServiceNow ticket.", + priority: DatadogAPIClient::V2::CasePriority::NOT_DEFINED, + title: "A title for the ServiceNow ticket.", + }), + relationships: DatadogAPIClient::V2::CreateServiceNowTicketRequestDataRelationships.new({ + findings: DatadogAPIClient::V2::Findings.new({ + data: [ + DatadogAPIClient::V2::FindingData.new({ + id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + type: DatadogAPIClient::V2::FindingDataType::FINDINGS, + }), + ], + }), + project: DatadogAPIClient::V2::CaseManagementProject.new({ + data: DatadogAPIClient::V2::CaseManagementProjectData.new({ + id: "aeadc05e-98a8-11ec-ac2c-da7ad0900001", + type: DatadogAPIClient::V2::CaseManagementProjectDataType::PROJECTS, + }), + }), + }), + type: DatadogAPIClient::V2::ServiceNowTicketsDataType::SERVICENOW_TICKETS, + }), + ], +}) +p api_instance.create_service_now_tickets(body) diff --git a/examples/v2/security-monitoring/UpdateFindingsAssignee.rb b/examples/v2/security-monitoring/UpdateFindingsAssignee.rb new file mode 100644 index 000000000000..497cc0046178 --- /dev/null +++ b/examples/v2/security-monitoring/UpdateFindingsAssignee.rb @@ -0,0 +1,28 @@ +# Assign or unassign security findings returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_findings_assignee".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::AssigneeRequest.new({ + data: DatadogAPIClient::V2::AssigneeRequestData.new({ + attributes: DatadogAPIClient::V2::AssigneeRequestDataAttributes.new({ + assignee_id: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0", + }), + id: "00000000-0000-0000-0000-000000000001", + relationships: DatadogAPIClient::V2::AssigneeRequestDataRelationships.new({ + findings: DatadogAPIClient::V2::Findings.new({ + data: [ + DatadogAPIClient::V2::FindingData.new({ + id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + type: DatadogAPIClient::V2::FindingDataType::FINDINGS, + }), + ], + }), + }), + type: DatadogAPIClient::V2::AssigneeDataType::ASSIGNEE, + }), +}) +p api_instance.update_findings_assignee(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 04b92a1c7f38..c3e7e7142da3 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2008,6 +2008,9 @@ "page_limit" => "Integer", "sort" => "SecurityFindingsSort", }, + "v2.UpdateFindingsAssignee" => { + "body" => "AssigneeRequest", + }, "v2.DetachCase" => { "body" => "DetachCaseRequest", }, @@ -2030,6 +2033,12 @@ "v2.SearchSecurityFindings" => { "body" => "SecurityFindingsSearchRequest", }, + "v2.AttachServiceNowTicket" => { + "body" => "AttachServiceNowTicketRequest", + }, + "v2.CreateServiceNowTickets" => { + "body" => "CreateServiceNowTicketRequestArray", + }, "v2.ListAssetsSBOMs" => { "page_token" => "String", "page_number" => "Integer", diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index d23634826e6a..bae8918780ee 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -41,6 +41,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-investigation + Scenario: Assign or unassign security findings returns "Accepted" response + Given operation "UpdateFindingsAssignee" enabled + And new "UpdateFindingsAssignee" request + And body with value {"data": {"attributes": {"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "assignee"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/k9-investigation + Scenario: Assign or unassign security findings returns "Bad Request" response + Given operation "UpdateFindingsAssignee" enabled + And new "UpdateFindingsAssignee" request + And body with value {"data": {"attributes": {"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "assignee"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-investigation + Scenario: Assign or unassign security findings returns "Not Found" response + Given operation "UpdateFindingsAssignee" enabled + And new "UpdateFindingsAssignee" request + And body with value {"data": {"attributes": {"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "assignee"}} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/k9-investigation Scenario: Attach security finding to a Jira issue returns "OK" response Given new "AttachJiraIssue" request @@ -87,6 +111,30 @@ Feature: Security Monitoring And the response "data.attributes.insights" has item with field "resource_id" with value "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=" And the response "data.attributes.jira_issue.result.issue_url" is equal to "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476" + @generated @skip @team:DataDog/k9-investigation + Scenario: Attach security findings to a ServiceNow ticket returns "Bad Request" response + Given operation "AttachServiceNowTicket" enabled + And new "AttachServiceNowTicket" request + And body with value {"data": {"attributes": {"servicenow_ticket_url": "https://example.service-now.com/now/nav/ui/classic/params/target/incident.do?sys_id=abcdef0123456789abcdef0123456789"}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}, "project": {"data": {"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001", "type": "projects"}}}, "type": "servicenow_tickets"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-investigation + Scenario: Attach security findings to a ServiceNow ticket returns "Not Found" response + Given operation "AttachServiceNowTicket" enabled + And new "AttachServiceNowTicket" request + And body with value {"data": {"attributes": {"servicenow_ticket_url": "https://example.service-now.com/now/nav/ui/classic/params/target/incident.do?sys_id=abcdef0123456789abcdef0123456789"}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}, "project": {"data": {"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001", "type": "projects"}}}, "type": "servicenow_tickets"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-investigation + Scenario: Attach security findings to a ServiceNow ticket returns "OK" response + Given operation "AttachServiceNowTicket" enabled + And new "AttachServiceNowTicket" request + And body with value {"data": {"attributes": {"servicenow_ticket_url": "https://example.service-now.com/now/nav/ui/classic/params/target/incident.do?sys_id=abcdef0123456789abcdef0123456789"}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}, "project": {"data": {"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001", "type": "projects"}}}, "type": "servicenow_tickets"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/k9-investigation Scenario: Attach security findings to a case returns "Bad Request" response Given new "AttachCase" request @@ -482,6 +530,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/k9-investigation + Scenario: Create ServiceNow tickets for security findings returns "Bad Request" response + Given operation "CreateServiceNowTickets" enabled + And new "CreateServiceNowTickets" request + And body with value {"data": [{"attributes": {"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0", "description": "A description of the ServiceNow ticket.", "priority": "NOT_DEFINED", "title": "A title for the ServiceNow ticket."}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}, "project": {"data": {"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001", "type": "projects"}}}, "type": "servicenow_tickets"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-investigation + Scenario: Create ServiceNow tickets for security findings returns "Created" response + Given operation "CreateServiceNowTickets" enabled + And new "CreateServiceNowTickets" request + And body with value {"data": [{"attributes": {"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0", "description": "A description of the ServiceNow ticket.", "priority": "NOT_DEFINED", "title": "A title for the ServiceNow ticket."}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}, "project": {"data": {"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001", "type": "projects"}}}, "type": "servicenow_tickets"}]} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/k9-investigation + Scenario: Create ServiceNow tickets for security findings returns "Not Found" response + Given operation "CreateServiceNowTickets" enabled + And new "CreateServiceNowTickets" request + And body with value {"data": [{"attributes": {"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0", "description": "A description of the ServiceNow ticket.", "priority": "NOT_DEFINED", "title": "A title for the ServiceNow ticket."}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}, "project": {"data": {"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001", "type": "projects"}}}, "type": "servicenow_tickets"}]} + When the request is sent + Then the response status is 404 Not Found + @skip-validation @team:DataDog/k9-cloud-siem Scenario: Create a cloud_configuration rule returns "OK" response Given new "CreateSecurityMonitoringRule" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 07db45886a9f..f60cf1a2f731 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6414,6 +6414,12 @@ "type": "safe" } }, + "UpdateFindingsAssignee": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "DetachCase": { "tag": "Security Monitoring", "undo": { @@ -6470,6 +6476,25 @@ "type": "safe" } }, + "AttachServiceNowTicket": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "CreateServiceNowTickets": { + "tag": "Security Monitoring", + "undo": { + "operationId": "DetachCase", + "parameters": [ + { + "name": "body", + "template": "{\n \"data\": {\n \"type\": \"cases\",\n \"relationships\": {\n \"findings\": {\n \"data\": [\n {\n \"type\": \"findings\",\n \"id\": \"{{data[0].attributes.insights[0].resource_id}}\"\n }\n ]\n }\n }\n }\n}" + } + ], + "type": "unsafe" + } + }, "ListAssetsSBOMs": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 42fbfd24dcc9..108c82400aa9 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -325,6 +325,7 @@ def initialize "v2.get_aws_cloud_auth_persona_mapping": false, "v2.list_aws_cloud_auth_persona_mappings": false, "v2.activate_content_pack": false, + "v2.attach_service_now_ticket": false, "v2.batch_get_security_monitoring_dataset_dependencies": false, "v2.bulk_create_sample_log_generation_subscriptions": false, "v2.bulk_export_security_monitoring_terraform_resources": false, @@ -334,6 +335,7 @@ def initialize "v2.create_sample_log_generation_subscription": false, "v2.create_security_monitoring_dataset": false, "v2.create_security_monitoring_integration_config": false, + "v2.create_service_now_tickets": false, "v2.create_static_analysis_ast": false, "v2.create_static_analysis_server_analysis": false, "v2.deactivate_content_pack": false, @@ -375,6 +377,7 @@ def initialize "v2.mute_findings": false, "v2.run_historical_job": false, "v2.search_security_monitoring_histsignals": false, + "v2.update_findings_assignee": false, "v2.update_security_monitoring_dataset": false, "v2.update_security_monitoring_integration_config": false, "v2.validate_security_monitoring_integration_config": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 798974113cbd..838c1450b433 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1474,6 +1474,16 @@ def overrides "v2.asset_risks" => "AssetRisks", "v2.asset_type" => "AssetType", "v2.asset_version" => "AssetVersion", + "v2.assignee_data_type" => "AssigneeDataType", + "v2.assignee_request" => "AssigneeRequest", + "v2.assignee_request_data" => "AssigneeRequestData", + "v2.assignee_request_data_attributes" => "AssigneeRequestDataAttributes", + "v2.assignee_request_data_relationships" => "AssigneeRequestDataRelationships", + "v2.assignee_response" => "AssigneeResponse", + "v2.assignee_response_data" => "AssigneeResponseData", + "v2.assignee_response_data_attributes" => "AssigneeResponseDataAttributes", + "v2.assignee_response_meta" => "AssigneeResponseMeta", + "v2.assignment_result" => "AssignmentResult", "v2.assign_seats_user_request" => "AssignSeatsUserRequest", "v2.assign_seats_user_request_data" => "AssignSeatsUserRequestData", "v2.assign_seats_user_request_data_attributes" => "AssignSeatsUserRequestDataAttributes", @@ -1495,6 +1505,10 @@ def overrides "v2.attachment_data_attributes_attachment_type" => "AttachmentDataAttributesAttachmentType", "v2.attachment_data_relationships" => "AttachmentDataRelationships", "v2.attachment_included" => "AttachmentIncluded", + "v2.attach_service_now_ticket_request" => "AttachServiceNowTicketRequest", + "v2.attach_service_now_ticket_request_data" => "AttachServiceNowTicketRequestData", + "v2.attach_service_now_ticket_request_data_attributes" => "AttachServiceNowTicketRequestDataAttributes", + "v2.attach_service_now_ticket_request_data_relationships" => "AttachServiceNowTicketRequestDataRelationships", "v2.audit_logs_event" => "AuditLogsEvent", "v2.audit_logs_event_attributes" => "AuditLogsEventAttributes", "v2.audit_logs_events_response" => "AuditLogsEventsResponse", @@ -2433,6 +2447,10 @@ def overrides "v2.create_ruleset_request_data_attributes_rules_items_reference_table" => "CreateRulesetRequestDataAttributesRulesItemsReferenceTable", "v2.create_ruleset_request_data_attributes_rules_items_reference_table_field_pairs_items" => "CreateRulesetRequestDataAttributesRulesItemsReferenceTableFieldPairsItems", "v2.create_ruleset_request_data_type" => "CreateRulesetRequestDataType", + "v2.create_service_now_ticket_request_array" => "CreateServiceNowTicketRequestArray", + "v2.create_service_now_ticket_request_data" => "CreateServiceNowTicketRequestData", + "v2.create_service_now_ticket_request_data_attributes" => "CreateServiceNowTicketRequestDataAttributes", + "v2.create_service_now_ticket_request_data_relationships" => "CreateServiceNowTicketRequestDataRelationships", "v2.create_status_page_request" => "CreateStatusPageRequest", "v2.create_status_page_request_data" => "CreateStatusPageRequestData", "v2.create_status_page_request_data_attributes" => "CreateStatusPageRequestDataAttributes", @@ -3090,6 +3108,8 @@ def overrides "v2.finding_mute_reason" => "FindingMuteReason", "v2.finding_rule" => "FindingRule", "v2.findings" => "Findings", + "v2.finding_service_now_ticket" => "FindingServiceNowTicket", + "v2.finding_service_now_ticket_result" => "FindingServiceNowTicketResult", "v2.finding_status" => "FindingStatus", "v2.finding_type" => "FindingType", "v2.finding_vulnerability_type" => "FindingVulnerabilityType", @@ -6241,6 +6261,7 @@ def overrides "v2.service_now_ticket_create_request" => "ServiceNowTicketCreateRequest", "v2.service_now_ticket_resource_type" => "ServiceNowTicketResourceType", "v2.service_now_ticket_result" => "ServiceNowTicketResult", + "v2.service_now_tickets_data_type" => "ServiceNowTicketsDataType", "v2.service_now_user_attributes" => "ServiceNowUserAttributes", "v2.service_now_user_data" => "ServiceNowUserData", "v2.service_now_users_response" => "ServiceNowUsersResponse", diff --git a/lib/datadog_api_client/v2/api/security_monitoring_api.rb b/lib/datadog_api_client/v2/api/security_monitoring_api.rb index 14499c50ad99..f89fba934f5b 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -237,6 +237,80 @@ def attach_jira_issue_with_http_info(body, opts = {}) return data, status_code, headers end + # Attach security findings to a ServiceNow ticket. + # + # @see #attach_service_now_ticket_with_http_info + def attach_service_now_ticket(body, opts = {}) + data, _status_code, _headers = attach_service_now_ticket_with_http_info(body, opts) + data + end + + # Attach security findings to a ServiceNow ticket. + # + # Attach security findings to a ServiceNow ticket by providing the ServiceNow ticket URL. + # You can attach up to 50 security findings per ServiceNow ticket. If the ServiceNow ticket is not linked to any case, this operation will create a case for the security findings and link the ServiceNow ticket to the newly created case. Security findings that are already attached to another ServiceNow ticket will be detached from their previous ServiceNow ticket and attached to the specified ServiceNow ticket. + # + # @param body [AttachServiceNowTicketRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(FindingCaseResponse, Integer, Hash)>] FindingCaseResponse data, response status code and response headers + def attach_service_now_ticket_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.attach_service_now_ticket".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.attach_service_now_ticket") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.attach_service_now_ticket")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.attach_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 SecurityMonitoringAPI.attach_service_now_ticket" + end + # resource path + local_var_path = '/api/v2/security/findings/servicenow_tickets' + + # 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] || 'FindingCaseResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :attach_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::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#attach_service_now_ticket\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get dataset dependencies. # # @see #batch_get_security_monitoring_dataset_dependencies_with_http_info @@ -1963,6 +2037,80 @@ def create_security_monitoring_suppression_with_http_info(body, opts = {}) return data, status_code, headers end + # Create ServiceNow tickets for security findings. + # + # @see #create_service_now_tickets_with_http_info + def create_service_now_tickets(body, opts = {}) + data, _status_code, _headers = create_service_now_tickets_with_http_info(body, opts) + data + end + + # Create ServiceNow tickets for security findings. + # + # Create ServiceNow tickets for security findings. + # This operation creates a case in Datadog and a ServiceNow ticket linked to that case for bidirectional sync between Datadog and ServiceNow. You can create up to 50 ServiceNow tickets per request and associate up to 50 security findings per ServiceNow ticket. Security findings that are already attached to another ServiceNow ticket will be detached from their previous ServiceNow ticket and attached to the newly created ServiceNow ticket. + # + # @param body [CreateServiceNowTicketRequestArray] + # @param opts [Hash] the optional parameters + # @return [Array<(FindingCaseResponseArray, Integer, Hash)>] FindingCaseResponseArray data, response status code and response headers + def create_service_now_tickets_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_service_now_tickets".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_service_now_tickets") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_service_now_tickets")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.create_service_now_tickets ...' + 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 SecurityMonitoringAPI.create_service_now_tickets" + end + # resource path + local_var_path = '/api/v2/security/findings/servicenow_tickets' + + # 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] || 'FindingCaseResponseArray' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_service_now_tickets, + :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: SecurityMonitoringAPI#create_service_now_tickets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create a new signal-based notification rule. # # @see #create_signal_notification_rule_with_http_info @@ -8814,6 +8962,80 @@ def update_custom_framework_with_http_info(handle, version, body, opts = {}) return data, status_code, headers end + # Assign or unassign security findings. + # + # @see #update_findings_assignee_with_http_info + def update_findings_assignee(body, opts = {}) + data, _status_code, _headers = update_findings_assignee_with_http_info(body, opts) + data + end + + # Assign or unassign security findings. + # + # Assign or unassign security findings. + # You can assign up to 100 security findings per request. Set `assignee_id` to the unique identifier of the Datadog user you want to assign the findings to. Omit `assignee_id` (or set it to `null`) to unassign the findings. Per-finding warnings and failures are returned in the response `meta` object. + # + # @param body [AssigneeRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(AssigneeResponse, Integer, Hash)>] AssigneeResponse data, response status code and response headers + def update_findings_assignee_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_findings_assignee".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_findings_assignee") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_findings_assignee")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.update_findings_assignee ...' + 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 SecurityMonitoringAPI.update_findings_assignee" + end + # resource path + local_var_path = '/api/v2/security/findings/assignee' + + # 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] || 'AssigneeResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_findings_assignee, + :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: SecurityMonitoringAPI#update_findings_assignee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update resource filters. # # @see #update_resource_evaluation_filters_with_http_info diff --git a/lib/datadog_api_client/v2/models/assignee_data_type.rb b/lib/datadog_api_client/v2/models/assignee_data_type.rb new file mode 100644 index 000000000000..8170e72a0567 --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_data_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 + # Assignee resource type. + class AssigneeDataType + include BaseEnumModel + + ASSIGNEE = "assignee".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/assignee_request.rb b/lib/datadog_api_client/v2/models/assignee_request.rb new file mode 100644 index 000000000000..a5e841138f62 --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to assign or unassign security findings. + class AssigneeRequest + include BaseGenericModel + + # Data of the assignee request. + 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' => :'AssigneeRequestData' + } + 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::AssigneeRequest` 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/assignee_request_data.rb b/lib/datadog_api_client/v2/models/assignee_request_data.rb new file mode 100644 index 000000000000..87a40de6635b --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_request_data.rb @@ -0,0 +1,164 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data of the assignee request. + class AssigneeRequestData + include BaseGenericModel + + # Attributes of the assignee request. + attr_accessor :attributes + + # Unique identifier of the assignee request. + attr_accessor :id + + # Relationships of the assignee request. + attr_reader :relationships + + # Assignee resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AssigneeRequestDataAttributes', + :'id' => :'String', + :'relationships' => :'AssigneeRequestDataRelationships', + :'type' => :'AssigneeDataType' + } + 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::AssigneeRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + 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 @relationships.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/assignee_request_data_attributes.rb b/lib/datadog_api_client/v2/models/assignee_request_data_attributes.rb new file mode 100644 index 000000000000..75bf2baaaa1f --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_request_data_attributes.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the assignee request. + class AssigneeRequestDataAttributes + include BaseGenericModel + + # Unique identifier of the Datadog user to assign the security findings to. If this field is not provided, the security findings are unassigned. + attr_accessor :assignee_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assignee_id' => :'assignee_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assignee_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::AssigneeRequestDataAttributes` 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?(:'assignee_id') + self.assignee_id = attributes[:'assignee_id'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assignee_id == o.assignee_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assignee_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/assignee_request_data_relationships.rb b/lib/datadog_api_client/v2/models/assignee_request_data_relationships.rb new file mode 100644 index 000000000000..20a0eff979d5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_request_data_relationships.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 + # Relationships of the assignee request. + class AssigneeRequestDataRelationships + include BaseGenericModel + + # A list of security findings. + attr_reader :findings + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'findings' => :'findings' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'findings' => :'Findings' + } + 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::AssigneeRequestDataRelationships` 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?(:'findings') + self.findings = attributes[:'findings'] + 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 @findings.nil? + true + end + + # Custom attribute writer method with validation + # @param findings [Object] Object to be assigned + # @!visibility private + def findings=(findings) + if findings.nil? + fail ArgumentError, 'invalid value for "findings", findings cannot be nil.' + end + @findings = findings + 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 && + findings == o.findings && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [findings, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/assignee_response.rb b/lib/datadog_api_client/v2/models/assignee_response.rb new file mode 100644 index 000000000000..bd0719c8c7a9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_response.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 + # Response for the assign or unassign request. + class AssigneeResponse + include BaseGenericModel + + # Data of the assignee response. + attr_reader :data + + # Per-finding warnings and failures produced while processing the bulk assignee request. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AssigneeResponseData', + :'meta' => :'AssigneeResponseMeta' + } + 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::AssigneeResponse` 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 + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + 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 && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/assignee_response_data.rb b/lib/datadog_api_client/v2/models/assignee_response_data.rb new file mode 100644 index 000000000000..64627235ef63 --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data of the assignee response. + class AssigneeResponseData + include BaseGenericModel + + # Attributes of the assignee response. + attr_reader :attributes + + # Unique identifier of the assignee request. + attr_reader :id + + # Assignee resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AssigneeResponseDataAttributes', + :'id' => :'String', + :'type' => :'AssigneeDataType' + } + 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::AssigneeResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/assignee_response_data_attributes.rb b/lib/datadog_api_client/v2/models/assignee_response_data_attributes.rb new file mode 100644 index 000000000000..be3e6afd13d5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_response_data_attributes.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the assignee response. + class AssigneeResponseDataAttributes + include BaseGenericModel + + # Unique identifier of the Datadog user assigned to the security findings. Omitted when the findings were unassigned. + attr_accessor :assignee_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assignee_id' => :'assignee_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assignee_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::AssigneeResponseDataAttributes` 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?(:'assignee_id') + self.assignee_id = attributes[:'assignee_id'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assignee_id == o.assignee_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assignee_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/assignee_response_meta.rb b/lib/datadog_api_client/v2/models/assignee_response_meta.rb new file mode 100644 index 000000000000..cbdfae6e6f50 --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignee_response_meta.rb @@ -0,0 +1,119 @@ +=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 + # Per-finding warnings and failures produced while processing the bulk assignee request. + class AssigneeResponseMeta + include BaseGenericModel + + # Findings that could not be assigned or unassigned. + attr_accessor :failures + + # Findings for which the assignment succeeded but a non-critical error occurred during processing. + attr_accessor :warnings + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'failures' => :'failures', + :'warnings' => :'warnings' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'failures' => :'Array', + :'warnings' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AssigneeResponseMeta` 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?(:'failures') + if (value = attributes[:'failures']).is_a?(Array) + self.failures = value + end + end + + if attributes.key?(:'warnings') + if (value = attributes[:'warnings']).is_a?(Array) + self.warnings = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + failures == o.failures && + warnings == o.warnings && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [failures, warnings, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/assignment_result.rb b/lib/datadog_api_client/v2/models/assignment_result.rb new file mode 100644 index 000000000000..28bb73afe628 --- /dev/null +++ b/lib/datadog_api_client/v2/models/assignment_result.rb @@ -0,0 +1,186 @@ +=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 + # Per-finding outcome of an assign or unassign operation. + class AssignmentResult + include BaseGenericModel + + # Human-readable explanation of the outcome. + attr_reader :detail + + # Unique identifier of the security finding. + attr_reader :finding_id + + # HTTP-like status code describing the outcome for this finding. + attr_reader :status + + # Short label describing the outcome for this finding. + attr_reader :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'detail' => :'detail', + :'finding_id' => :'finding_id', + :'status' => :'status', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'detail' => :'String', + :'finding_id' => :'String', + :'status' => :'Integer', + :'title' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AssignmentResult` 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?(:'detail') + self.detail = attributes[:'detail'] + end + + if attributes.key?(:'finding_id') + self.finding_id = attributes[:'finding_id'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @detail.nil? + return false if @finding_id.nil? + return false if @status.nil? + return false if @title.nil? + true + end + + # Custom attribute writer method with validation + # @param detail [Object] Object to be assigned + # @!visibility private + def detail=(detail) + if detail.nil? + fail ArgumentError, 'invalid value for "detail", detail cannot be nil.' + end + @detail = detail + end + + # Custom attribute writer method with validation + # @param finding_id [Object] Object to be assigned + # @!visibility private + def finding_id=(finding_id) + if finding_id.nil? + fail ArgumentError, 'invalid value for "finding_id", finding_id cannot be nil.' + end + @finding_id = finding_id + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + @title = title + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + detail == o.detail && + finding_id == o.finding_id && + status == o.status && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [detail, finding_id, status, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/attach_service_now_ticket_request.rb b/lib/datadog_api_client/v2/models/attach_service_now_ticket_request.rb new file mode 100644 index 000000000000..7eb5a5e44db2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/attach_service_now_ticket_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request for attaching security findings to a ServiceNow ticket. + class AttachServiceNowTicketRequest + include BaseGenericModel + + # Data of the ServiceNow ticket to attach security findings to. + 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' => :'AttachServiceNowTicketRequestData' + } + 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::AttachServiceNowTicketRequest` 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/attach_service_now_ticket_request_data.rb b/lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data.rb new file mode 100644 index 000000000000..b80b7e33e64e --- /dev/null +++ b/lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data of the ServiceNow ticket to attach security findings to. + class AttachServiceNowTicketRequestData + include BaseGenericModel + + # Attributes of the ServiceNow ticket to attach security findings to. + attr_reader :attributes + + # Relationships of the ServiceNow ticket to attach security findings to. + attr_reader :relationships + + # ServiceNow tickets 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', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AttachServiceNowTicketRequestDataAttributes', + :'relationships' => :'AttachServiceNowTicketRequestDataRelationships', + :'type' => :'ServiceNowTicketsDataType' + } + 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::AttachServiceNowTicketRequestData` 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?(:'relationships') + self.relationships = attributes[:'relationships'] + 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 @relationships.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 relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + 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 && + relationships == o.relationships && + 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, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data_attributes.rb b/lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data_attributes.rb new file mode 100644 index 000000000000..36f36e18fbb8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data_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 + # Attributes of the ServiceNow ticket to attach security findings to. + class AttachServiceNowTicketRequestDataAttributes + include BaseGenericModel + + # URL of the ServiceNow incident to attach security findings to. Must be a service-now.com URL pointing to an incident record. + attr_reader :servicenow_ticket_url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'servicenow_ticket_url' => :'servicenow_ticket_url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'servicenow_ticket_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::AttachServiceNowTicketRequestDataAttributes` 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?(:'servicenow_ticket_url') + self.servicenow_ticket_url = attributes[:'servicenow_ticket_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 @servicenow_ticket_url.nil? + true + end + + # Custom attribute writer method with validation + # @param servicenow_ticket_url [Object] Object to be assigned + # @!visibility private + def servicenow_ticket_url=(servicenow_ticket_url) + if servicenow_ticket_url.nil? + fail ArgumentError, 'invalid value for "servicenow_ticket_url", servicenow_ticket_url cannot be nil.' + end + @servicenow_ticket_url = servicenow_ticket_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 && + servicenow_ticket_url == o.servicenow_ticket_url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [servicenow_ticket_url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data_relationships.rb b/lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data_relationships.rb new file mode 100644 index 000000000000..53422f675490 --- /dev/null +++ b/lib/datadog_api_client/v2/models/attach_service_now_ticket_request_data_relationships.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 + # Relationships of the ServiceNow ticket to attach security findings to. + class AttachServiceNowTicketRequestDataRelationships + include BaseGenericModel + + # A list of security findings. + attr_reader :findings + + # Case management project. + attr_reader :project + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'findings' => :'findings', + :'project' => :'project' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'findings' => :'Findings', + :'project' => :'CaseManagementProject' + } + 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::AttachServiceNowTicketRequestDataRelationships` 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?(:'findings') + self.findings = attributes[:'findings'] + end + + if attributes.key?(:'project') + self.project = attributes[:'project'] + 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 @findings.nil? + return false if @project.nil? + true + end + + # Custom attribute writer method with validation + # @param findings [Object] Object to be assigned + # @!visibility private + def findings=(findings) + if findings.nil? + fail ArgumentError, 'invalid value for "findings", findings cannot be nil.' + end + @findings = findings + end + + # Custom attribute writer method with validation + # @param project [Object] Object to be assigned + # @!visibility private + def project=(project) + if project.nil? + fail ArgumentError, 'invalid value for "project", project cannot be nil.' + end + @project = project + 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 && + findings == o.findings && + project == o.project && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [findings, project, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_service_now_ticket_request_array.rb b/lib/datadog_api_client/v2/models/create_service_now_ticket_request_array.rb new file mode 100644 index 000000000000..d313b1725667 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_service_now_ticket_request_array.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # List of requests to create ServiceNow tickets for security findings. + class CreateServiceNowTicketRequestArray + include BaseGenericModel + + # Array of ServiceNow ticket creation request data objects. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateServiceNowTicketRequestArray` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data.rb b/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data.rb new file mode 100644 index 000000000000..b9b4184c5598 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data of the ServiceNow ticket to create. + class CreateServiceNowTicketRequestData + include BaseGenericModel + + # Attributes of the ServiceNow ticket to create. + attr_accessor :attributes + + # Relationships of the ServiceNow ticket to create. + attr_reader :relationships + + # ServiceNow tickets 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', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CreateServiceNowTicketRequestDataAttributes', + :'relationships' => :'CreateServiceNowTicketRequestDataRelationships', + :'type' => :'ServiceNowTicketsDataType' + } + 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::CreateServiceNowTicketRequestData` 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?(:'relationships') + self.relationships = attributes[:'relationships'] + 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 @relationships.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + 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 && + relationships == o.relationships && + 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, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data_attributes.rb b/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data_attributes.rb new file mode 100644 index 000000000000..73dd3240bcd8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data_attributes.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the ServiceNow ticket to create. + class CreateServiceNowTicketRequestDataAttributes + include BaseGenericModel + + # Unique identifier of the Datadog user assigned to the case backing the ServiceNow ticket. + attr_accessor :assignee_id + + # Description of the ServiceNow ticket. If not provided, the description will be automatically generated. + attr_accessor :description + + # Case priority + attr_accessor :priority + + # Title of the ServiceNow ticket. If not provided, the title will be automatically generated. + attr_accessor :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assignee_id' => :'assignee_id', + :'description' => :'description', + :'priority' => :'priority', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assignee_id' => :'String', + :'description' => :'String', + :'priority' => :'CasePriority', + :'title' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateServiceNowTicketRequestDataAttributes` 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?(:'assignee_id') + self.assignee_id = attributes[:'assignee_id'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assignee_id == o.assignee_id && + description == o.description && + priority == o.priority && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assignee_id, description, priority, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data_relationships.rb b/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data_relationships.rb new file mode 100644 index 000000000000..d2b70c68e4df --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_service_now_ticket_request_data_relationships.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 + # Relationships of the ServiceNow ticket to create. + class CreateServiceNowTicketRequestDataRelationships + include BaseGenericModel + + # A list of security findings. + attr_reader :findings + + # Case management project. + attr_reader :project + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'findings' => :'findings', + :'project' => :'project' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'findings' => :'Findings', + :'project' => :'CaseManagementProject' + } + 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::CreateServiceNowTicketRequestDataRelationships` 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?(:'findings') + self.findings = attributes[:'findings'] + end + + if attributes.key?(:'project') + self.project = attributes[:'project'] + 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 @findings.nil? + return false if @project.nil? + true + end + + # Custom attribute writer method with validation + # @param findings [Object] Object to be assigned + # @!visibility private + def findings=(findings) + if findings.nil? + fail ArgumentError, 'invalid value for "findings", findings cannot be nil.' + end + @findings = findings + end + + # Custom attribute writer method with validation + # @param project [Object] Object to be assigned + # @!visibility private + def project=(project) + if project.nil? + fail ArgumentError, 'invalid value for "project", project cannot be nil.' + end + @project = project + 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 && + findings == o.findings && + project == o.project && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [findings, project, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/finding_case_response_data_attributes.rb b/lib/datadog_api_client/v2/models/finding_case_response_data_attributes.rb index d9d789754502..6fcda4848d0b 100644 --- a/lib/datadog_api_client/v2/models/finding_case_response_data_attributes.rb +++ b/lib/datadog_api_client/v2/models/finding_case_response_data_attributes.rb @@ -60,6 +60,9 @@ class FindingCaseResponseDataAttributes # Priority of the case. attr_accessor :priority + # ServiceNow ticket associated with the case. + attr_accessor :servicenow_ticket + # Status of the case. attr_accessor :status @@ -94,6 +97,7 @@ def self.attribute_map :'key' => :'key', :'modified_at' => :'modified_at', :'priority' => :'priority', + :'servicenow_ticket' => :'servicenow_ticket', :'status' => :'status', :'status_group' => :'status_group', :'status_name' => :'status_name', @@ -119,6 +123,7 @@ def self.openapi_types :'key' => :'String', :'modified_at' => :'Time', :'priority' => :'String', + :'servicenow_ticket' => :'FindingServiceNowTicket', :'status' => :'String', :'status_group' => :'String', :'status_name' => :'String', @@ -199,6 +204,10 @@ def initialize(attributes = {}) self.priority = attributes[:'priority'] end + if attributes.key?(:'servicenow_ticket') + self.servicenow_ticket = attributes[:'servicenow_ticket'] + end + if attributes.key?(:'status') self.status = attributes[:'status'] end @@ -259,6 +268,7 @@ def ==(o) key == o.key && modified_at == o.modified_at && priority == o.priority && + servicenow_ticket == o.servicenow_ticket && status == o.status && status_group == o.status_group && status_name == o.status_name && @@ -271,7 +281,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [archived_at, assigned_to, attributes, closed_at, created_at, creation_source, description, due_date, insights, jira_issue, key, modified_at, priority, status, status_group, status_name, title, type, additional_properties].hash + [archived_at, assigned_to, attributes, closed_at, created_at, creation_source, description, due_date, insights, jira_issue, key, modified_at, priority, servicenow_ticket, status, status_group, status_name, title, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/finding_service_now_ticket.rb b/lib/datadog_api_client/v2/models/finding_service_now_ticket.rb new file mode 100644 index 000000000000..ecd0638fdfb4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/finding_service_now_ticket.rb @@ -0,0 +1,115 @@ +=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 associated with the case. + class FindingServiceNowTicket + include BaseGenericModel + + # Result of the ServiceNow ticket creation or attachment. + attr_accessor :result + + # Status of the ServiceNow ticket operation. Can be "COMPLETED" if successful, or "FAILED" if the operation failed. + attr_accessor :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'result' => :'result', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'result' => :'FindingServiceNowTicketResult', + :'status' => :'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::FindingServiceNowTicket` 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?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [result, status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/finding_service_now_ticket_result.rb b/lib/datadog_api_client/v2/models/finding_service_now_ticket_result.rb new file mode 100644 index 000000000000..8c406f2b32f7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/finding_service_now_ticket_result.rb @@ -0,0 +1,155 @@ +=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 + # Result of the ServiceNow ticket creation or attachment. + class FindingServiceNowTicketResult + include BaseGenericModel + + # ServiceNow instance name extracted from the ticket URL. + attr_accessor :instance_name + + # Unique identifier of the ServiceNow incident record. + attr_accessor :sys_id + + # Direct link to the ServiceNow incident record. + attr_accessor :sys_target_link + + # Unique identifier of the target ServiceNow record. + attr_accessor :sys_target_sys_id + + # ServiceNow table containing the incident record. + attr_accessor :table_name + + # URL of the ServiceNow incident record. + attr_accessor :url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'instance_name' => :'instance_name', + :'sys_id' => :'sys_id', + :'sys_target_link' => :'sys_target_link', + :'sys_target_sys_id' => :'sys_target_sys_id', + :'table_name' => :'table_name', + :'url' => :'url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'instance_name' => :'String', + :'sys_id' => :'String', + :'sys_target_link' => :'String', + :'sys_target_sys_id' => :'String', + :'table_name' => :'String', + :'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::FindingServiceNowTicketResult` 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?(:'instance_name') + self.instance_name = attributes[:'instance_name'] + end + + if attributes.key?(:'sys_id') + self.sys_id = attributes[:'sys_id'] + end + + if attributes.key?(:'sys_target_link') + self.sys_target_link = attributes[:'sys_target_link'] + end + + if attributes.key?(:'sys_target_sys_id') + self.sys_target_sys_id = attributes[:'sys_target_sys_id'] + end + + if attributes.key?(:'table_name') + self.table_name = attributes[:'table_name'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + instance_name == o.instance_name && + sys_id == o.sys_id && + sys_target_link == o.sys_target_link && + sys_target_sys_id == o.sys_target_sys_id && + table_name == o.table_name && + url == o.url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [instance_name, sys_id, sys_target_link, sys_target_sys_id, table_name, url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/service_now_tickets_data_type.rb b/lib/datadog_api_client/v2/models/service_now_tickets_data_type.rb new file mode 100644 index 000000000000..098a314753a3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/service_now_tickets_data_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 tickets resource type. + class ServiceNowTicketsDataType + include BaseEnumModel + + SERVICENOW_TICKETS = "servicenow_tickets".freeze + end +end