From ba5535623199658580f8a8a24f0908fc4009c598 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 15 Dec 2025 18:16:05 +0000 Subject: [PATCH] Regenerate client from commit 82f8476 of spec repo --- .generator/schemas/v2/openapi.yaml | 646 ++++++++------- .../incidents/CreateIncidentAttachment.java | 46 ++ ...435.java => DeleteIncidentAttachment.java} | 13 +- .../v2/incidents/ListIncidentAttachments.java | 6 +- .../incidents/UpdateIncidentAttachment.java | 45 ++ .../incidents/UpdateIncidentAttachments.java | 68 -- .../UpdateIncidentAttachments_3881702075.java | 52 -- .../com/datadog/api/client/ApiClient.java | 5 +- .../api/client/v2/api/IncidentsApi.java | 749 ++++++++++++++---- ...entUpdateResponse.java => Attachment.java} | 77 +- ...entsResponse.java => AttachmentArray.java} | 63 +- ...ttachmentData.java => AttachmentData.java} | 66 +- ...tes.java => AttachmentDataAttributes.java} | 86 +- .../AttachmentDataAttributesAttachment.java | 166 ++++ ...ttachmentDataAttributesAttachmentType.java | 65 ++ ....java => AttachmentDataRelationships.java} | 34 +- ...tDataRelationshipsLastModifiedByUser.java} | 57 +- ...taRelationshipsLastModifiedByUserData.java | 183 +++++ ...ludedItem.java => AttachmentIncluded.java} | 114 ++- .../v2/model/CreateAttachmentRequest.java | 136 ++++ ....java => CreateAttachmentRequestData.java} | 48 +- ...reateAttachmentRequestDataAttributes.java} | 73 +- ...hmentRequestDataAttributesAttachment.java} | 53 +- .../IncidentAttachmentAttachmentType.java | 60 -- .../model/IncidentAttachmentAttributes.java | 301 ------- .../IncidentAttachmentLinkAttachmentType.java | 59 -- ...entAttachmentPostmortemAttachmentType.java | 62 -- .../IncidentAttachmentUpdateAttributes.java | 304 ------- .../model/IncidentResponseIncludedItem.java | 62 +- .../v2/model/PatchAttachmentRequest.java | 136 ++++ .../v2/model/PatchAttachmentRequestData.java | 206 +++++ .../PatchAttachmentRequestDataAttributes.java | 139 ++++ ...hmentRequestDataAttributesAttachment.java} | 55 +- .../client/v2/model/User140420082644000.java | 205 +++++ ...chmentRelatedObject.java => UserType.java} | 26 +- ...dent_attachment_returns_OK_response.freeze | 1 - ...cident_attachment_returns_OK_response.json | 87 -- ...ent_attachments_returns_OK_response.freeze | 1 - ...ident_attachments_returns_OK_response.json | 113 --- .../com/datadog/api/client/v2/api/given.json | 16 - .../api/client/v2/api/incidents.feature | 170 ++-- .../com/datadog/api/client/v2/api/undo.json | 25 +- 42 files changed, 2736 insertions(+), 2143 deletions(-) create mode 100644 examples/v2/incidents/CreateIncidentAttachment.java rename examples/v2/incidents/{ListIncidentAttachments_2457735435.java => DeleteIncidentAttachment.java} (52%) create mode 100644 examples/v2/incidents/UpdateIncidentAttachment.java delete mode 100644 examples/v2/incidents/UpdateIncidentAttachments.java delete mode 100644 examples/v2/incidents/UpdateIncidentAttachments_3881702075.java rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentUpdateResponse.java => Attachment.java} (60%) rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentsResponse.java => AttachmentArray.java} (68%) rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentData.java => AttachmentData.java} (73%) rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentLinkAttributes.java => AttachmentDataAttributes.java} (62%) create mode 100644 src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributesAttachment.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributesAttachmentType.java rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentRelationships.java => AttachmentDataRelationships.java} (76%) rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentUpdateRequest.java => AttachmentDataRelationshipsLastModifiedByUser.java} (64%) create mode 100644 src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationshipsLastModifiedByUserData.java rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentsResponseIncludedItem.java => AttachmentIncluded.java} (58%) create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequest.java rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentUpdateData.java => CreateAttachmentRequestData.java} (76%) rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentPostmortemAttributes.java => CreateAttachmentRequestDataAttributes.java} (59%) rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentLinkAttributesAttachmentObject.java => CreateAttachmentRequestDataAttributesAttachment.java} (69%) delete mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentAttachmentType.java delete mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentAttributes.java delete mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttachmentType.java delete mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentPostmortemAttachmentType.java delete mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestDataAttributes.java rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentsPostmortemAttributesAttachmentObject.java => PatchAttachmentRequestDataAttributesAttachment.java} (67%) create mode 100644 src/main/java/com/datadog/api/client/v2/model/User140420082644000.java rename src/main/java/com/datadog/api/client/v2/model/{IncidentAttachmentRelatedObject.java => UserType.java} (53%) delete mode 100644 src/test/resources/cassettes/features/v2/Create_an_incident_attachment_returns_OK_response.freeze delete mode 100644 src/test/resources/cassettes/features/v2/Create_an_incident_attachment_returns_OK_response.json delete mode 100644 src/test/resources/cassettes/features/v2/Get_incident_attachments_returns_OK_response.freeze delete mode 100644 src/test/resources/cassettes/features/v2/Get_incident_attachments_returns_OK_response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0bf5e783b1d..91aafdeb9a9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -178,6 +178,15 @@ components: required: true schema: type: string + AttachmentIncludeQueryParameter: + description: 'Resource to include in the response. Supported value: `last_modified_by_user`.' + explode: false + in: query + name: include + required: false + schema: + example: last_modified_by_user + type: string AuthNMappingID: description: The UUID of the AuthN Mapping. in: path @@ -458,26 +467,6 @@ components: items: $ref: '#/components/schemas/GetIssueIncludeQueryParameterItem' type: array - IncidentAttachmentFilterQueryParameter: - description: Specifies which types of attachments are included in the response. - explode: false - in: query - name: filter[attachment_type] - required: false - schema: - items: - $ref: '#/components/schemas/IncidentAttachmentAttachmentType' - type: array - IncidentAttachmentIncludeQueryParameter: - description: Specifies which types of related objects are included in the response. - explode: false - in: query - name: include - required: false - schema: - items: - $ref: '#/components/schemas/IncidentAttachmentRelatedObject' - type: array IncidentIDPathParameter: description: The UUID of the incident. in: path @@ -5358,6 +5347,124 @@ components: - findings - project type: object + Attachment: + properties: + data: + $ref: '#/components/schemas/AttachmentData' + included: + items: + $ref: '#/components/schemas/AttachmentIncluded' + type: array + type: object + AttachmentArray: + properties: + data: + example: + - attributes: + attachment: + documentUrl: https://app.datadoghq.com/notebook/123/Postmortem-IR-123 + title: Postmortem IR-123 + attachment_type: postmortem + modified: '2025-01-01T01:01:01.000000001Z' + id: 00000000-abcd-0002-0000-000000000000 + relationships: + last_modified_by_user: + data: + id: 00000000-0000-0000-cccc-000000000000 + type: users + type: incident_attachments + items: + $ref: '#/components/schemas/AttachmentData' + type: array + included: + items: + $ref: '#/components/schemas/AttachmentIncluded' + type: array + required: + - data + type: object + AttachmentData: + example: + attributes: + attachment: + documentUrl: https://app.datadoghq.com/notebook/123/Postmortem-IR-123 + title: Postmortem IR-123 + attachment_type: postmortem + modified: '2025-01-01T01:01:01.000000001Z' + id: 00000000-abcd-0002-0000-000000000000 + relationships: + last_modified_by_user: + data: + id: 00000000-0000-0000-cccc-000000000000 + type: users + type: incident_attachments + properties: + attributes: + $ref: '#/components/schemas/AttachmentDataAttributes' + id: + example: 00000000-abcd-0002-0000-000000000000 + type: string + relationships: + $ref: '#/components/schemas/AttachmentDataRelationships' + type: + $ref: '#/components/schemas/IncidentAttachmentType' + required: + - type + - attributes + - relationships + - id + type: object + AttachmentDataAttributes: + properties: + attachment: + $ref: '#/components/schemas/AttachmentDataAttributesAttachment' + attachment_type: + $ref: '#/components/schemas/AttachmentDataAttributesAttachmentType' + modified: + format: date-time + type: string + type: object + AttachmentDataAttributesAttachment: + properties: + documentUrl: + type: string + title: + type: string + type: object + AttachmentDataAttributesAttachmentType: + enum: + - postmortem + - link + type: string + x-enum-varnames: + - POSTMORTEM + - LINK + AttachmentDataRelationships: + properties: + last_modified_by_user: + $ref: '#/components/schemas/AttachmentDataRelationshipsLastModifiedByUser' + type: object + AttachmentDataRelationshipsLastModifiedByUser: + properties: + data: + $ref: '#/components/schemas/AttachmentDataRelationshipsLastModifiedByUserData' + required: + - data + type: object + AttachmentDataRelationshipsLastModifiedByUserData: + properties: + id: + example: '' + type: string + type: + $ref: '#/components/schemas/UserType' + required: + - type + - id + type: object + AttachmentIncluded: + oneOf: + - $ref: '#/components/schemas/User140420082644000' AuditLogsEvent: description: Object description of an Audit Logs event after it is processed and stored by Datadog. @@ -12882,6 +12989,45 @@ components: required: - type type: object + CreateAttachmentRequest: + example: + data: + attributes: + attachment: + documentUrl: https://app.datadoghq.com/notebook/123/Postmortem-IR-123 + title: Postmortem-IR-123 + attachment_type: postmortem + id: 00000000-0000-0000-0000-000000000000 + type: incident_attachments + properties: + data: + $ref: '#/components/schemas/CreateAttachmentRequestData' + type: object + CreateAttachmentRequestData: + properties: + attributes: + $ref: '#/components/schemas/CreateAttachmentRequestDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/IncidentAttachmentType' + required: + - type + type: object + CreateAttachmentRequestDataAttributes: + properties: + attachment: + $ref: '#/components/schemas/CreateAttachmentRequestDataAttributesAttachment' + attachment_type: + $ref: '#/components/schemas/AttachmentDataAttributesAttachmentType' + type: object + CreateAttachmentRequestDataAttributesAttachment: + properties: + documentUrl: + type: string + title: + type: string + type: object CreateCaseRequestArray: description: List of requests to create cases for security findings. properties: @@ -25555,126 +25701,6 @@ components: type: string x-mimetype: application/xml type: object - IncidentAttachmentAttachmentType: - description: The type of the incident attachment attributes. - enum: - - link - - postmortem - example: link - type: string - x-enum-varnames: - - LINK - - POSTMORTEM - IncidentAttachmentAttributes: - description: The attributes object for an attachment. - oneOf: - - $ref: '#/components/schemas/IncidentAttachmentPostmortemAttributes' - - $ref: '#/components/schemas/IncidentAttachmentLinkAttributes' - IncidentAttachmentData: - description: A single incident attachment. - example: - attributes: - attachment: - documentUrl: '' - title: Postmortem IR-123 - attachment_type: postmortem - id: 00000000-abcd-0002-0000-000000000000 - relationships: - last_modified_by_user: - data: - id: 00000000-0000-0000-cccc-000000000000 - type: users - type: incident_attachments - properties: - attributes: - $ref: '#/components/schemas/IncidentAttachmentAttributes' - id: - description: A unique identifier that represents the incident attachment. - example: 00000000-abcd-0001-0000-000000000000 - type: string - relationships: - $ref: '#/components/schemas/IncidentAttachmentRelationships' - type: - $ref: '#/components/schemas/IncidentAttachmentType' - required: - - type - - attributes - - id - - relationships - type: object - IncidentAttachmentLinkAttachmentType: - default: link - description: The type of link attachment attributes. - enum: - - link - example: link - type: string - x-enum-varnames: - - LINK - IncidentAttachmentLinkAttributes: - description: The attributes object for a link attachment. - properties: - attachment: - $ref: '#/components/schemas/IncidentAttachmentLinkAttributesAttachmentObject' - attachment_type: - $ref: '#/components/schemas/IncidentAttachmentLinkAttachmentType' - modified: - description: Timestamp when the incident attachment link was last modified. - format: date-time - readOnly: true - type: string - required: - - attachment_type - - attachment - type: object - IncidentAttachmentLinkAttributesAttachmentObject: - description: The link attachment. - properties: - documentUrl: - description: The URL of this link attachment. - example: https://www.example.com/webstore-failure-runbook - type: string - title: - description: The title of this link attachment. - example: Runbook for webstore service failures - type: string - required: - - documentUrl - - title - type: object - IncidentAttachmentPostmortemAttachmentType: - default: postmortem - description: The type of postmortem attachment attributes. - enum: - - postmortem - example: postmortem - type: string - x-enum-varnames: - - POSTMORTEM - IncidentAttachmentPostmortemAttributes: - description: The attributes object for a postmortem attachment. - properties: - attachment: - $ref: '#/components/schemas/IncidentAttachmentsPostmortemAttributesAttachmentObject' - attachment_type: - $ref: '#/components/schemas/IncidentAttachmentPostmortemAttachmentType' - required: - - attachment_type - - attachment - type: object - IncidentAttachmentRelatedObject: - description: The object related to an incident attachment. - enum: - - users - type: string - x-enum-varnames: - - USERS - IncidentAttachmentRelationships: - description: The incident attachment's relationships. - properties: - last_modified_by_user: - $ref: '#/components/schemas/RelationshipToUser' - type: object IncidentAttachmentType: default: incident_attachments description: The incident attachment resource type. @@ -25684,142 +25710,6 @@ components: type: string x-enum-varnames: - INCIDENT_ATTACHMENTS - IncidentAttachmentUpdateAttributes: - description: Incident attachment attributes. - oneOf: - - $ref: '#/components/schemas/IncidentAttachmentPostmortemAttributes' - - $ref: '#/components/schemas/IncidentAttachmentLinkAttributes' - IncidentAttachmentUpdateData: - description: A single incident attachment. - properties: - attributes: - $ref: '#/components/schemas/IncidentAttachmentUpdateAttributes' - id: - description: A unique identifier that represents the incident attachment. - example: 00000000-abcd-0001-0000-000000000000 - type: string - type: - $ref: '#/components/schemas/IncidentAttachmentType' - required: - - type - type: object - IncidentAttachmentUpdateRequest: - description: The update request for an incident's attachments. - properties: - data: - description: 'An array of incident attachments. An attachment object without - an "id" key indicates that you want to - - create that attachment. An attachment object without an "attributes" key - indicates that you want to - - delete that attachment. An attachment object with both the "id" key and - a populated "attributes" object - - indicates that you want to update that attachment.' - example: - - attributes: - attachment: - documentUrl: https://app.datadoghq.com/notebook/123 - title: Postmortem IR-123 - attachment_type: postmortem - id: 00000000-abcd-0002-0000-000000000000 - type: incident_attachments - - attributes: - attachment: - documentUrl: https://www.example.com/webstore-failure-runbook - title: Runbook for webstore service failures - attachment_type: link - type: incident_attachments - - id: 00000000-abcd-0003-0000-000000000000 - type: incident_attachments - items: - $ref: '#/components/schemas/IncidentAttachmentUpdateData' - type: array - required: - - data - type: object - IncidentAttachmentUpdateResponse: - description: The response object containing the created or updated incident - attachments. - properties: - data: - description: 'An array of incident attachments. Only the attachments that - were created or updated by the request are - - returned.' - example: - - attributes: - attachment: - documentUrl: '' - title: Postmortem IR-123 - attachment_type: postmortem - id: 00000000-abcd-0002-0000-000000000000 - relationships: - last_modified_by_user: - data: - id: 00000000-0000-0000-cccc-000000000000 - type: users - type: incident_attachments - items: - $ref: '#/components/schemas/IncidentAttachmentData' - type: array - included: - description: Included related resources that the user requested. - items: - $ref: '#/components/schemas/IncidentAttachmentsResponseIncludedItem' - type: array - required: - - data - type: object - IncidentAttachmentsPostmortemAttributesAttachmentObject: - description: The postmortem attachment. - properties: - documentUrl: - description: The URL of this notebook attachment. - example: https://app.datadoghq.com/notebook/123 - type: string - title: - description: The title of this postmortem attachment. - example: Postmortem IR-123 - type: string - required: - - documentUrl - - title - type: object - IncidentAttachmentsResponse: - description: The response object containing an incident's attachments. - properties: - data: - description: An array of incident attachments. - example: - - attributes: - attachment: - documentUrl: '' - title: Postmortem IR-123 - attachment_type: postmortem - id: 00000000-abcd-0002-0000-000000000000 - relationships: - last_modified_by_user: - data: - id: 00000000-0000-0000-cccc-000000000000 - type: users - type: incident_attachments - items: - $ref: '#/components/schemas/IncidentAttachmentData' - type: array - included: - description: Included related resources that the user requested. - items: - $ref: '#/components/schemas/IncidentAttachmentsResponseIncludedItem' - type: array - required: - - data - type: object - IncidentAttachmentsResponseIncludedItem: - description: An object related to an attachment that is included in the response. - oneOf: - - $ref: '#/components/schemas/User' IncidentCreateAttributes: description: The incident's attributes for a create request. properties: @@ -27090,7 +26980,7 @@ components: description: An object related to an incident that is included in the response. oneOf: - $ref: '#/components/schemas/IncidentUserData' - - $ref: '#/components/schemas/IncidentAttachmentData' + - $ref: '#/components/schemas/AttachmentData' IncidentResponseMeta: description: The metadata object containing pagination metadata. properties: @@ -39868,6 +39758,41 @@ components: $ref: '#/components/schemas/ApplicationKeyResponseIncludedItem' type: array type: object + PatchAttachmentRequest: + example: + data: + attributes: + attachment: + documentUrl: https://app.datadoghq.com/notebook/124/Postmortem-IR-124 + title: Postmortem-IR-124 + type: incident_attachments + properties: + data: + $ref: '#/components/schemas/PatchAttachmentRequestData' + type: object + PatchAttachmentRequestData: + properties: + attributes: + $ref: '#/components/schemas/PatchAttachmentRequestDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/IncidentAttachmentType' + required: + - type + type: object + PatchAttachmentRequestDataAttributes: + properties: + attachment: + $ref: '#/components/schemas/PatchAttachmentRequestDataAttributesAttachment' + type: object + PatchAttachmentRequestDataAttributesAttachment: + properties: + documentUrl: + type: string + title: + type: string + type: object PatchIncidentNotificationTemplateRequest: description: Update request for a notification template. properties: @@ -56512,6 +56437,17 @@ components: type: $ref: '#/components/schemas/UsersType' type: object + User140420082644000: + properties: + attributes: + $ref: '#/components/schemas/UserAttributes' + id: + type: string + type: + $ref: '#/components/schemas/UserType' + required: + - type + type: object UserAttributes: description: Attributes of user object returned by the API. properties: @@ -56962,6 +56898,15 @@ components: meta: $ref: '#/components/schemas/TeamsResponseMeta' type: object + UserType: + default: users + description: Users resource type. + enum: + - users + example: users + type: string + x-enum-varnames: + - USERS UserUpdateAttributes: description: Attributes of the edited user. properties: @@ -67941,6 +67886,7 @@ paths: - us3.datadoghq.com - us5.datadoghq.com - ap1.datadoghq.com + - ap2.datadoghq.com - datadoghq.eu - ddog-gov.com subdomain: @@ -68161,8 +68107,7 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - incident_notification_settings_read + - AuthZ: [] summary: List incident notification rules tags: - Incidents @@ -68361,8 +68306,7 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - incident_settings_read + - AuthZ: [] summary: List incident notification templates tags: - Incidents @@ -68477,7 +68421,8 @@ paths: - apiKeyAuth: [] appKeyAuth: [] - AuthZ: - - incident_settings_read + - incident_read + - incident_write summary: Get incident notification template tags: - Incidents @@ -68567,6 +68512,7 @@ paths: x-permission: operator: OR permissions: + - incident_settings_read - incident_read x-unstable: '**Note**: This endpoint is in public beta. @@ -68608,7 +68554,7 @@ paths: - Incidents x-codegen-request-body-name: body x-permission: - operator: OR + operator: AND permissions: - incident_settings_write x-unstable: '**Note**: This endpoint is in public beta. @@ -68898,80 +68844,166 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/{incident_id}/attachments: get: - description: Get all attachments for a given incident. + description: List incident attachments. operationId: ListIncidentAttachments parameters: - $ref: '#/components/parameters/IncidentIDPathParameter' - - $ref: '#/components/parameters/IncidentAttachmentIncludeQueryParameter' - - $ref: '#/components/parameters/IncidentAttachmentFilterQueryParameter' + - description: Filter attachments by type. Supported values are `1` (`postmortem`) + and `2` (`link`). + in: query + name: filter[attachment_type] + schema: + example: '1' + type: string + - $ref: '#/components/parameters/AttachmentIncludeQueryParameter' responses: '200': content: application/json: schema: - $ref: '#/components/schemas/IncidentAttachmentsResponse' + $ref: '#/components/schemas/AttachmentArray' description: OK '400': $ref: '#/components/responses/BadRequestResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List incident attachments + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_read + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create an incident attachment. + operationId: CreateIncidentAttachment + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/AttachmentIncludeQueryParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAttachmentRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/Attachment' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create incident attachment + tags: + - Incidents + x-permission: + operator: AND + permissions: + - incident_write + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/attachments/{attachment_id}: + delete: + operationId: DeleteIncidentAttachment + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - description: The ID of the attachment. + in: path + name: attachment_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000002 + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' '403': $ref: '#/components/responses/ForbiddenResponse' '404': $ref: '#/components/responses/NotFoundResponse' '429': $ref: '#/components/responses/TooManyRequestsResponse' - summary: Get a list of attachments + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Delete incident attachment tags: - Incidents x-permission: - operator: OR + operator: AND permissions: - - incident_read - x-unstable: '**Note**: This endpoint is in public beta. + - incident_write + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' patch: - deprecated: true - description: The bulk update endpoint for creating, updating, and deleting attachments - for a given incident. - operationId: UpdateIncidentAttachments + operationId: UpdateIncidentAttachment parameters: - $ref: '#/components/parameters/IncidentIDPathParameter' - - $ref: '#/components/parameters/IncidentAttachmentIncludeQueryParameter' + - description: The ID of the attachment. + in: path + name: attachment_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000002 + - $ref: '#/components/parameters/AttachmentIncludeQueryParameter' requestBody: content: application/json: schema: - $ref: '#/components/schemas/IncidentAttachmentUpdateRequest' - description: Incident Attachment Payload. + $ref: '#/components/schemas/PatchAttachmentRequest' required: true responses: '200': content: application/json: schema: - $ref: '#/components/schemas/IncidentAttachmentUpdateResponse' + $ref: '#/components/schemas/Attachment' description: OK '400': $ref: '#/components/responses/BadRequestResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' '404': $ref: '#/components/responses/NotFoundResponse' '429': $ref: '#/components/responses/TooManyRequestsResponse' - summary: Create, update, and delete incident attachments + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Update incident attachment tags: - Incidents - x-codegen-request-body-name: body x-permission: - operator: OR + operator: AND permissions: - incident_write - x-unstable: '**Note**: This endpoint is deprecated.' + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/{incident_id}/impacts: get: description: Get all impacts for an incident. diff --git a/examples/v2/incidents/CreateIncidentAttachment.java b/examples/v2/incidents/CreateIncidentAttachment.java new file mode 100644 index 00000000000..2f28d2605d3 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentAttachment.java @@ -0,0 +1,46 @@ +// Create incident attachment returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.Attachment; +import com.datadog.api.client.v2.model.AttachmentDataAttributesAttachmentType; +import com.datadog.api.client.v2.model.CreateAttachmentRequest; +import com.datadog.api.client.v2.model.CreateAttachmentRequestData; +import com.datadog.api.client.v2.model.CreateAttachmentRequestDataAttributes; +import com.datadog.api.client.v2.model.CreateAttachmentRequestDataAttributesAttachment; +import com.datadog.api.client.v2.model.IncidentAttachmentType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createIncidentAttachment", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + CreateAttachmentRequest body = + new CreateAttachmentRequest() + .data( + new CreateAttachmentRequestData() + .attributes( + new CreateAttachmentRequestDataAttributes() + .attachment( + new CreateAttachmentRequestDataAttributesAttachment() + .documentUrl( + "https://app.datadoghq.com/notebook/123/Postmortem-IR-123") + .title("Postmortem-IR-123")) + .attachmentType(AttachmentDataAttributesAttachmentType.POSTMORTEM)) + .id("00000000-0000-0000-0000-000000000000") + .type(IncidentAttachmentType.INCIDENT_ATTACHMENTS)); + + try { + Attachment result = apiInstance.createIncidentAttachment("incident_id", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#createIncidentAttachment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/ListIncidentAttachments_2457735435.java b/examples/v2/incidents/DeleteIncidentAttachment.java similarity index 52% rename from examples/v2/incidents/ListIncidentAttachments_2457735435.java rename to examples/v2/incidents/DeleteIncidentAttachment.java index 0d1243ff539..948967feb52 100644 --- a/examples/v2/incidents/ListIncidentAttachments_2457735435.java +++ b/examples/v2/incidents/DeleteIncidentAttachment.java @@ -1,24 +1,19 @@ -// Get incident attachments returns "OK" response +// Delete incident attachment returns "No Content" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.v2.api.IncidentsApi; -import com.datadog.api.client.v2.model.IncidentAttachmentsResponse; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.listIncidentAttachments", true); + defaultClient.setUnstableOperationEnabled("v2.deleteIncidentAttachment", true); IncidentsApi apiInstance = new IncidentsApi(defaultClient); - // there is a valid "incident" in the system - String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID"); - try { - IncidentAttachmentsResponse result = apiInstance.listIncidentAttachments(INCIDENT_DATA_ID); - System.out.println(result); + apiInstance.deleteIncidentAttachment("incident_id", "00000000-0000-0000-0000-000000000002"); } catch (ApiException e) { - System.err.println("Exception when calling IncidentsApi#listIncidentAttachments"); + System.err.println("Exception when calling IncidentsApi#deleteIncidentAttachment"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/incidents/ListIncidentAttachments.java b/examples/v2/incidents/ListIncidentAttachments.java index 195a15c3024..becf9d1ede5 100644 --- a/examples/v2/incidents/ListIncidentAttachments.java +++ b/examples/v2/incidents/ListIncidentAttachments.java @@ -1,9 +1,9 @@ -// Get a list of attachments returns "OK" response +// List incident attachments returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.v2.api.IncidentsApi; -import com.datadog.api.client.v2.model.IncidentAttachmentsResponse; +import com.datadog.api.client.v2.model.AttachmentArray; public class Example { public static void main(String[] args) { @@ -12,7 +12,7 @@ public static void main(String[] args) { IncidentsApi apiInstance = new IncidentsApi(defaultClient); try { - IncidentAttachmentsResponse result = apiInstance.listIncidentAttachments("incident_id"); + AttachmentArray result = apiInstance.listIncidentAttachments("incident_id"); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling IncidentsApi#listIncidentAttachments"); diff --git a/examples/v2/incidents/UpdateIncidentAttachment.java b/examples/v2/incidents/UpdateIncidentAttachment.java new file mode 100644 index 00000000000..521a6ac6d37 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentAttachment.java @@ -0,0 +1,45 @@ +// Update incident attachment returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.Attachment; +import com.datadog.api.client.v2.model.IncidentAttachmentType; +import com.datadog.api.client.v2.model.PatchAttachmentRequest; +import com.datadog.api.client.v2.model.PatchAttachmentRequestData; +import com.datadog.api.client.v2.model.PatchAttachmentRequestDataAttributes; +import com.datadog.api.client.v2.model.PatchAttachmentRequestDataAttributesAttachment; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateIncidentAttachment", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + PatchAttachmentRequest body = + new PatchAttachmentRequest() + .data( + new PatchAttachmentRequestData() + .attributes( + new PatchAttachmentRequestDataAttributes() + .attachment( + new PatchAttachmentRequestDataAttributesAttachment() + .documentUrl( + "https://app.datadoghq.com/notebook/124/Postmortem-IR-124") + .title("Postmortem-IR-124"))) + .type(IncidentAttachmentType.INCIDENT_ATTACHMENTS)); + + try { + Attachment result = + apiInstance.updateIncidentAttachment( + "incident_id", "00000000-0000-0000-0000-000000000002", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#updateIncidentAttachment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/UpdateIncidentAttachments.java b/examples/v2/incidents/UpdateIncidentAttachments.java deleted file mode 100644 index 4705ca08f6c..00000000000 --- a/examples/v2/incidents/UpdateIncidentAttachments.java +++ /dev/null @@ -1,68 +0,0 @@ -// Create, update, and delete incident attachments returns "OK" response - -import com.datadog.api.client.ApiClient; -import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.IncidentsApi; -import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttachmentType; -import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttributes; -import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttributesAttachmentObject; -import com.datadog.api.client.v2.model.IncidentAttachmentPostmortemAttachmentType; -import com.datadog.api.client.v2.model.IncidentAttachmentPostmortemAttributes; -import com.datadog.api.client.v2.model.IncidentAttachmentType; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateAttributes; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateData; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateRequest; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateResponse; -import com.datadog.api.client.v2.model.IncidentAttachmentsPostmortemAttributesAttachmentObject; -import java.util.Arrays; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.updateIncidentAttachments", true); - IncidentsApi apiInstance = new IncidentsApi(defaultClient); - - IncidentAttachmentUpdateRequest body = - new IncidentAttachmentUpdateRequest() - .data( - Arrays.asList( - new IncidentAttachmentUpdateData() - .attributes( - new IncidentAttachmentUpdateAttributes( - new IncidentAttachmentPostmortemAttributes() - .attachment( - new IncidentAttachmentsPostmortemAttributesAttachmentObject() - .documentUrl("https://app.datadoghq.com/notebook/123") - .title("Postmortem IR-123")) - .attachmentType( - IncidentAttachmentPostmortemAttachmentType.POSTMORTEM))) - .id("00000000-abcd-0002-0000-000000000000") - .type(IncidentAttachmentType.INCIDENT_ATTACHMENTS), - new IncidentAttachmentUpdateData() - .attributes( - new IncidentAttachmentUpdateAttributes( - new IncidentAttachmentLinkAttributes() - .attachment( - new IncidentAttachmentLinkAttributesAttachmentObject() - .documentUrl( - "https://www.example.com/webstore-failure-runbook") - .title("Runbook for webstore service failures")) - .attachmentType(IncidentAttachmentLinkAttachmentType.LINK))) - .type(IncidentAttachmentType.INCIDENT_ATTACHMENTS), - new IncidentAttachmentUpdateData() - .id("00000000-abcd-0003-0000-000000000000") - .type(IncidentAttachmentType.INCIDENT_ATTACHMENTS))); - - try { - IncidentAttachmentUpdateResponse result = - apiInstance.updateIncidentAttachments("incident_id", body); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling IncidentsApi#updateIncidentAttachments"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} diff --git a/examples/v2/incidents/UpdateIncidentAttachments_3881702075.java b/examples/v2/incidents/UpdateIncidentAttachments_3881702075.java deleted file mode 100644 index 6c4de218879..00000000000 --- a/examples/v2/incidents/UpdateIncidentAttachments_3881702075.java +++ /dev/null @@ -1,52 +0,0 @@ -// Create an incident attachment returns "OK" response - -import com.datadog.api.client.ApiClient; -import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.IncidentsApi; -import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttachmentType; -import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttributes; -import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttributesAttachmentObject; -import com.datadog.api.client.v2.model.IncidentAttachmentType; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateAttributes; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateData; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateRequest; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateResponse; -import java.util.Collections; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.updateIncidentAttachments", true); - IncidentsApi apiInstance = new IncidentsApi(defaultClient); - - // there is a valid "incident" in the system - String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID"); - - IncidentAttachmentUpdateRequest body = - new IncidentAttachmentUpdateRequest() - .data( - Collections.singletonList( - new IncidentAttachmentUpdateData() - .type(IncidentAttachmentType.INCIDENT_ATTACHMENTS) - .attributes( - new IncidentAttachmentUpdateAttributes( - new IncidentAttachmentLinkAttributes() - .attachmentType(IncidentAttachmentLinkAttachmentType.LINK) - .attachment( - new IncidentAttachmentLinkAttributesAttachmentObject() - .documentUrl("https://www.example.com/doc") - .title("Example-Incident")))))); - - try { - IncidentAttachmentUpdateResponse result = - apiInstance.updateIncidentAttachments(INCIDENT_DATA_ID, body); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling IncidentsApi#updateIncidentAttachments"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index bb1f49b26a2..9da26ceb2f1 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -300,6 +300,7 @@ public class ApiClient { "us3.datadoghq.com", "us5.datadoghq.com", "ap1.datadoghq.com", + "ap2.datadoghq.com", "datadoghq.eu", "ddog-gov.com")))); put( @@ -747,6 +748,7 @@ public class ApiClient { put("v2.updateDeploymentGate", false); put("v2.updateDeploymentRule", false); put("v2.createIncident", false); + put("v2.createIncidentAttachment", false); put("v2.createIncidentImpact", false); put("v2.createIncidentIntegration", false); put("v2.createIncidentNotificationRule", false); @@ -754,6 +756,7 @@ public class ApiClient { put("v2.createIncidentTodo", false); put("v2.createIncidentType", false); put("v2.deleteIncident", false); + put("v2.deleteIncidentAttachment", false); put("v2.deleteIncidentImpact", false); put("v2.deleteIncidentIntegration", false); put("v2.deleteIncidentNotificationRule", false); @@ -776,7 +779,7 @@ public class ApiClient { put("v2.listIncidentTypes", false); put("v2.searchIncidents", false); put("v2.updateIncident", false); - put("v2.updateIncidentAttachments", false); + put("v2.updateIncidentAttachment", false); put("v2.updateIncidentIntegration", false); put("v2.updateIncidentNotificationRule", false); put("v2.updateIncidentNotificationTemplate", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java index a36c2a39abf..80626bb92e8 100644 --- a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java @@ -5,13 +5,11 @@ import com.datadog.api.client.ApiResponse; import com.datadog.api.client.PaginationIterable; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.Attachment; +import com.datadog.api.client.v2.model.AttachmentArray; +import com.datadog.api.client.v2.model.CreateAttachmentRequest; import com.datadog.api.client.v2.model.CreateIncidentNotificationRuleRequest; import com.datadog.api.client.v2.model.CreateIncidentNotificationTemplateRequest; -import com.datadog.api.client.v2.model.IncidentAttachmentAttachmentType; -import com.datadog.api.client.v2.model.IncidentAttachmentRelatedObject; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateRequest; -import com.datadog.api.client.v2.model.IncidentAttachmentUpdateResponse; -import com.datadog.api.client.v2.model.IncidentAttachmentsResponse; import com.datadog.api.client.v2.model.IncidentCreateRequest; import com.datadog.api.client.v2.model.IncidentImpactCreateRequest; import com.datadog.api.client.v2.model.IncidentImpactRelatedObject; @@ -41,6 +39,7 @@ import com.datadog.api.client.v2.model.IncidentTypeResponse; import com.datadog.api.client.v2.model.IncidentUpdateRequest; import com.datadog.api.client.v2.model.IncidentsResponse; +import com.datadog.api.client.v2.model.PatchAttachmentRequest; import com.datadog.api.client.v2.model.PatchIncidentNotificationTemplateRequest; import com.datadog.api.client.v2.model.PutIncidentNotificationRuleRequest; import jakarta.ws.rs.client.Invocation; @@ -234,6 +233,257 @@ public CompletableFuture> createIncidentWithHttpIn new GenericType() {}); } + /** Manage optional parameters to createIncidentAttachment. */ + public static class CreateIncidentAttachmentOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Resource to include in the response. Supported value: + * last_modified_by_user. (optional) + * @return CreateIncidentAttachmentOptionalParameters + */ + public CreateIncidentAttachmentOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Create incident attachment. + * + *

See {@link #createIncidentAttachmentWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param body (required) + * @return Attachment + * @throws ApiException if fails to make API call + */ + public Attachment createIncidentAttachment(String incidentId, CreateAttachmentRequest body) + throws ApiException { + return createIncidentAttachmentWithHttpInfo( + incidentId, body, new CreateIncidentAttachmentOptionalParameters()) + .getData(); + } + + /** + * Create incident attachment. + * + *

See {@link #createIncidentAttachmentWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param body (required) + * @return CompletableFuture<Attachment> + */ + public CompletableFuture createIncidentAttachmentAsync( + String incidentId, CreateAttachmentRequest body) { + return createIncidentAttachmentWithHttpInfoAsync( + incidentId, body, new CreateIncidentAttachmentOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create incident attachment. + * + *

See {@link #createIncidentAttachmentWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return Attachment + * @throws ApiException if fails to make API call + */ + public Attachment createIncidentAttachment( + String incidentId, + CreateAttachmentRequest body, + CreateIncidentAttachmentOptionalParameters parameters) + throws ApiException { + return createIncidentAttachmentWithHttpInfo(incidentId, body, parameters).getData(); + } + + /** + * Create incident attachment. + * + *

See {@link #createIncidentAttachmentWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<Attachment> + */ + public CompletableFuture createIncidentAttachmentAsync( + String incidentId, + CreateAttachmentRequest body, + CreateIncidentAttachmentOptionalParameters parameters) { + return createIncidentAttachmentWithHttpInfoAsync(incidentId, body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create an incident attachment. + * + * @param incidentId The UUID of the incident. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<Attachment> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createIncidentAttachmentWithHttpInfo( + String incidentId, + CreateAttachmentRequest body, + CreateIncidentAttachmentOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createIncidentAttachment"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'incidentId' when calling createIncidentAttachment"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createIncidentAttachment"); + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/attachments" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentAttachment", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create incident attachment. + * + *

See {@link #createIncidentAttachmentWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<Attachment>> + */ + public CompletableFuture> createIncidentAttachmentWithHttpInfoAsync( + String incidentId, + CreateAttachmentRequest body, + CreateIncidentAttachmentOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "createIncidentAttachment"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'incidentId' when calling createIncidentAttachment")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createIncidentAttachment")); + return result; + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/attachments" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentAttachment", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to createIncidentImpact. */ public static class CreateIncidentImpactOptionalParameters { private List include; @@ -1468,6 +1718,186 @@ public CompletableFuture> deleteIncidentWithHttpInfoAsync(Stri null); } + /** + * Delete incident attachment. + * + *

See {@link #deleteIncidentAttachmentWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param attachmentId The ID of the attachment. (required) + * @throws ApiException if fails to make API call + */ + public void deleteIncidentAttachment(String incidentId, Object attachmentId) throws ApiException { + deleteIncidentAttachmentWithHttpInfo(incidentId, attachmentId); + } + + /** + * Delete incident attachment. + * + *

See {@link #deleteIncidentAttachmentWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param attachmentId The ID of the attachment. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteIncidentAttachmentAsync( + String incidentId, Object attachmentId) { + return deleteIncidentAttachmentWithHttpInfoAsync(incidentId, attachmentId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @param incidentId The UUID of the incident. (required) + * @param attachmentId The ID of the attachment. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteIncidentAttachmentWithHttpInfo( + String incidentId, Object attachmentId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteIncidentAttachment"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'incidentId' when calling deleteIncidentAttachment"); + } + + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'attachmentId' when calling deleteIncidentAttachment"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/attachments/{attachment_id}" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) + .replaceAll( + "\\{" + "attachment_id" + "\\}", apiClient.escapeString(attachmentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentAttachment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete incident attachment. + * + *

See {@link #deleteIncidentAttachmentWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param attachmentId The ID of the attachment. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteIncidentAttachmentWithHttpInfoAsync( + String incidentId, Object attachmentId) { + // Check if unstable operation is enabled + String operationId = "deleteIncidentAttachment"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'incidentId' when calling deleteIncidentAttachment")); + return result; + } + + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'attachmentId' when calling" + + " deleteIncidentAttachment")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/attachments/{attachment_id}" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) + .replaceAll( + "\\{" + "attachment_id" + "\\}", apiClient.escapeString(attachmentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentAttachment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Delete an incident impact. * @@ -3793,62 +4223,59 @@ public CompletableFuture> getIncidentTypeWithH /** Manage optional parameters to listIncidentAttachments. */ public static class ListIncidentAttachmentsOptionalParameters { - private List include; - private List filterAttachmentType; + private String filterAttachmentType; + private String include; /** - * Set include. + * Set filterAttachmentType. * - * @param include Specifies which types of related objects are included in the response. - * (optional) + * @param filterAttachmentType Filter attachments by type. Supported values are 1 ( + * postmortem) and 2 (link). (optional) * @return ListIncidentAttachmentsOptionalParameters */ - public ListIncidentAttachmentsOptionalParameters include( - List include) { - this.include = include; + public ListIncidentAttachmentsOptionalParameters filterAttachmentType( + String filterAttachmentType) { + this.filterAttachmentType = filterAttachmentType; return this; } /** - * Set filterAttachmentType. + * Set include. * - * @param filterAttachmentType Specifies which types of attachments are included in the - * response. (optional) + * @param include Resource to include in the response. Supported value: + * last_modified_by_user. (optional) * @return ListIncidentAttachmentsOptionalParameters */ - public ListIncidentAttachmentsOptionalParameters filterAttachmentType( - List filterAttachmentType) { - this.filterAttachmentType = filterAttachmentType; + public ListIncidentAttachmentsOptionalParameters include(String include) { + this.include = include; return this; } } /** - * Get a list of attachments. + * List incident attachments. * *

See {@link #listIncidentAttachmentsWithHttpInfo}. * * @param incidentId The UUID of the incident. (required) - * @return IncidentAttachmentsResponse + * @return AttachmentArray * @throws ApiException if fails to make API call */ - public IncidentAttachmentsResponse listIncidentAttachments(String incidentId) - throws ApiException { + public AttachmentArray listIncidentAttachments(String incidentId) throws ApiException { return listIncidentAttachmentsWithHttpInfo( incidentId, new ListIncidentAttachmentsOptionalParameters()) .getData(); } /** - * Get a list of attachments. + * List incident attachments. * *

See {@link #listIncidentAttachmentsWithHttpInfoAsync}. * * @param incidentId The UUID of the incident. (required) - * @return CompletableFuture<IncidentAttachmentsResponse> + * @return CompletableFuture<AttachmentArray> */ - public CompletableFuture listIncidentAttachmentsAsync( - String incidentId) { + public CompletableFuture listIncidentAttachmentsAsync(String incidentId) { return listIncidentAttachmentsWithHttpInfoAsync( incidentId, new ListIncidentAttachmentsOptionalParameters()) .thenApply( @@ -3858,30 +4285,30 @@ incidentId, new ListIncidentAttachmentsOptionalParameters()) } /** - * Get a list of attachments. + * List incident attachments. * *

See {@link #listIncidentAttachmentsWithHttpInfo}. * * @param incidentId The UUID of the incident. (required) * @param parameters Optional parameters for the request. - * @return IncidentAttachmentsResponse + * @return AttachmentArray * @throws ApiException if fails to make API call */ - public IncidentAttachmentsResponse listIncidentAttachments( + public AttachmentArray listIncidentAttachments( String incidentId, ListIncidentAttachmentsOptionalParameters parameters) throws ApiException { return listIncidentAttachmentsWithHttpInfo(incidentId, parameters).getData(); } /** - * Get a list of attachments. + * List incident attachments. * *

See {@link #listIncidentAttachmentsWithHttpInfoAsync}. * * @param incidentId The UUID of the incident. (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<IncidentAttachmentsResponse> + * @return CompletableFuture<AttachmentArray> */ - public CompletableFuture listIncidentAttachmentsAsync( + public CompletableFuture listIncidentAttachmentsAsync( String incidentId, ListIncidentAttachmentsOptionalParameters parameters) { return listIncidentAttachmentsWithHttpInfoAsync(incidentId, parameters) .thenApply( @@ -3891,11 +4318,11 @@ public CompletableFuture listIncidentAttachmentsAsy } /** - * Get all attachments for a given incident. + * List incident attachments. * * @param incidentId The UUID of the incident. (required) * @param parameters Optional parameters for the request. - * @return ApiResponse<IncidentAttachmentsResponse> + * @return ApiResponse<AttachmentArray> * @throws ApiException if fails to make API call * @http.response.details * @@ -3903,13 +4330,10 @@ public CompletableFuture listIncidentAttachmentsAsy * * * - * - * - * * *
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
*/ - public ApiResponse listIncidentAttachmentsWithHttpInfo( + public ApiResponse listIncidentAttachmentsWithHttpInfo( String incidentId, ListIncidentAttachmentsOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled String operationId = "listIncidentAttachments"; @@ -3925,8 +4349,8 @@ public ApiResponse listIncidentAttachmentsWithHttpI throw new ApiException( 400, "Missing the required parameter 'incidentId' when calling listIncidentAttachments"); } - List include = parameters.include; - List filterAttachmentType = parameters.filterAttachmentType; + String filterAttachmentType = parameters.filterAttachmentType; + String include = parameters.include; // create path and map variables String localVarPath = "/api/v2/incidents/{incident_id}/attachments" @@ -3936,9 +4360,9 @@ public ApiResponse listIncidentAttachmentsWithHttpI List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "include", include)); localVarQueryParams.addAll( - apiClient.parameterToPairs("csv", "filter[attachment_type]", filterAttachmentType)); + apiClient.parameterToPairs("", "filter[attachment_type]", filterAttachmentType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); Invocation.Builder builder = apiClient.createBuilder( @@ -3957,28 +4381,26 @@ public ApiResponse listIncidentAttachmentsWithHttpI localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get a list of attachments. + * List incident attachments. * *

See {@link #listIncidentAttachmentsWithHttpInfo}. * * @param incidentId The UUID of the incident. (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<IncidentAttachmentsResponse>> + * @return CompletableFuture<ApiResponse<AttachmentArray>> */ - public CompletableFuture> - listIncidentAttachmentsWithHttpInfoAsync( - String incidentId, ListIncidentAttachmentsOptionalParameters parameters) { + public CompletableFuture> listIncidentAttachmentsWithHttpInfoAsync( + String incidentId, ListIncidentAttachmentsOptionalParameters parameters) { // Check if unstable operation is enabled String operationId = "listIncidentAttachments"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; @@ -3987,16 +4409,15 @@ public ApiResponse listIncidentAttachmentsWithHttpI // verify the required parameter 'incidentId' is set if (incidentId == null) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'incidentId' when calling listIncidentAttachments")); return result; } - List include = parameters.include; - List filterAttachmentType = parameters.filterAttachmentType; + String filterAttachmentType = parameters.filterAttachmentType; + String include = parameters.include; // create path and map variables String localVarPath = "/api/v2/incidents/{incident_id}/attachments" @@ -4006,9 +4427,9 @@ public ApiResponse listIncidentAttachmentsWithHttpI List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "include", include)); localVarQueryParams.addAll( - apiClient.parameterToPairs("csv", "filter[attachment_type]", filterAttachmentType)); + apiClient.parameterToPairs("", "filter[attachment_type]", filterAttachmentType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); Invocation.Builder builder; try { @@ -4022,8 +4443,7 @@ public ApiResponse listIncidentAttachmentsWithHttpI new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -4035,7 +4455,7 @@ public ApiResponse listIncidentAttachmentsWithHttpI localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to listIncidentImpacts. */ @@ -6038,58 +6458,55 @@ public CompletableFuture> updateIncidentWithHttpIn new GenericType() {}); } - /** Manage optional parameters to updateIncidentAttachments. */ - public static class UpdateIncidentAttachmentsOptionalParameters { - private List include; + /** Manage optional parameters to updateIncidentAttachment. */ + public static class UpdateIncidentAttachmentOptionalParameters { + private String include; /** * Set include. * - * @param include Specifies which types of related objects are included in the response. - * (optional) - * @return UpdateIncidentAttachmentsOptionalParameters + * @param include Resource to include in the response. Supported value: + * last_modified_by_user. (optional) + * @return UpdateIncidentAttachmentOptionalParameters */ - public UpdateIncidentAttachmentsOptionalParameters include( - List include) { + public UpdateIncidentAttachmentOptionalParameters include(String include) { this.include = include; return this; } } /** - * Create, update, and delete incident attachments. + * Update incident attachment. * - *

See {@link #updateIncidentAttachmentsWithHttpInfo}. + *

See {@link #updateIncidentAttachmentWithHttpInfo}. * * @param incidentId The UUID of the incident. (required) - * @param body Incident Attachment Payload. (required) - * @return IncidentAttachmentUpdateResponse + * @param attachmentId The ID of the attachment. (required) + * @param body (required) + * @return Attachment * @throws ApiException if fails to make API call - * @deprecated */ - @Deprecated - public IncidentAttachmentUpdateResponse updateIncidentAttachments( - String incidentId, IncidentAttachmentUpdateRequest body) throws ApiException { - return updateIncidentAttachmentsWithHttpInfo( - incidentId, body, new UpdateIncidentAttachmentsOptionalParameters()) + public Attachment updateIncidentAttachment( + String incidentId, Object attachmentId, PatchAttachmentRequest body) throws ApiException { + return updateIncidentAttachmentWithHttpInfo( + incidentId, attachmentId, body, new UpdateIncidentAttachmentOptionalParameters()) .getData(); } /** - * Create, update, and delete incident attachments. + * Update incident attachment. * - *

See {@link #updateIncidentAttachmentsWithHttpInfoAsync}. + *

See {@link #updateIncidentAttachmentWithHttpInfoAsync}. * * @param incidentId The UUID of the incident. (required) - * @param body Incident Attachment Payload. (required) - * @return CompletableFuture<IncidentAttachmentUpdateResponse> - * @deprecated - */ - @Deprecated - public CompletableFuture updateIncidentAttachmentsAsync( - String incidentId, IncidentAttachmentUpdateRequest body) { - return updateIncidentAttachmentsWithHttpInfoAsync( - incidentId, body, new UpdateIncidentAttachmentsOptionalParameters()) + * @param attachmentId The ID of the attachment. (required) + * @param body (required) + * @return CompletableFuture<Attachment> + */ + public CompletableFuture updateIncidentAttachmentAsync( + String incidentId, Object attachmentId, PatchAttachmentRequest body) { + return updateIncidentAttachmentWithHttpInfoAsync( + incidentId, attachmentId, body, new UpdateIncidentAttachmentOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -6097,43 +6514,44 @@ incidentId, body, new UpdateIncidentAttachmentsOptionalParameters()) } /** - * Create, update, and delete incident attachments. + * Update incident attachment. * - *

See {@link #updateIncidentAttachmentsWithHttpInfo}. + *

See {@link #updateIncidentAttachmentWithHttpInfo}. * * @param incidentId The UUID of the incident. (required) - * @param body Incident Attachment Payload. (required) + * @param attachmentId The ID of the attachment. (required) + * @param body (required) * @param parameters Optional parameters for the request. - * @return IncidentAttachmentUpdateResponse + * @return Attachment * @throws ApiException if fails to make API call - * @deprecated */ - @Deprecated - public IncidentAttachmentUpdateResponse updateIncidentAttachments( + public Attachment updateIncidentAttachment( String incidentId, - IncidentAttachmentUpdateRequest body, - UpdateIncidentAttachmentsOptionalParameters parameters) + Object attachmentId, + PatchAttachmentRequest body, + UpdateIncidentAttachmentOptionalParameters parameters) throws ApiException { - return updateIncidentAttachmentsWithHttpInfo(incidentId, body, parameters).getData(); + return updateIncidentAttachmentWithHttpInfo(incidentId, attachmentId, body, parameters) + .getData(); } /** - * Create, update, and delete incident attachments. + * Update incident attachment. * - *

See {@link #updateIncidentAttachmentsWithHttpInfoAsync}. + *

See {@link #updateIncidentAttachmentWithHttpInfoAsync}. * * @param incidentId The UUID of the incident. (required) - * @param body Incident Attachment Payload. (required) + * @param attachmentId The ID of the attachment. (required) + * @param body (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<IncidentAttachmentUpdateResponse> - * @deprecated + * @return CompletableFuture<Attachment> */ - @Deprecated - public CompletableFuture updateIncidentAttachmentsAsync( + public CompletableFuture updateIncidentAttachmentAsync( String incidentId, - IncidentAttachmentUpdateRequest body, - UpdateIncidentAttachmentsOptionalParameters parameters) { - return updateIncidentAttachmentsWithHttpInfoAsync(incidentId, body, parameters) + Object attachmentId, + PatchAttachmentRequest body, + UpdateIncidentAttachmentOptionalParameters parameters) { + return updateIncidentAttachmentWithHttpInfoAsync(incidentId, attachmentId, body, parameters) .thenApply( response -> { return response.getData(); @@ -6141,12 +6559,11 @@ public CompletableFuture updateIncidentAttachm } /** - * The bulk update endpoint for creating, updating, and deleting attachments for a given incident. - * * @param incidentId The UUID of the incident. (required) - * @param body Incident Attachment Payload. (required) + * @param attachmentId The ID of the attachment. (required) + * @param body (required) * @param parameters Optional parameters for the request. - * @return ApiResponse<IncidentAttachmentUpdateResponse> + * @return ApiResponse<Attachment> * @throws ApiException if fails to make API call * @http.response.details * @@ -6154,22 +6571,19 @@ public CompletableFuture updateIncidentAttachm * * * - * * * * *
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
- * - * @deprecated */ - @Deprecated - public ApiResponse updateIncidentAttachmentsWithHttpInfo( + public ApiResponse updateIncidentAttachmentWithHttpInfo( String incidentId, - IncidentAttachmentUpdateRequest body, - UpdateIncidentAttachmentsOptionalParameters parameters) + Object attachmentId, + PatchAttachmentRequest body, + UpdateIncidentAttachmentOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled - String operationId = "updateIncidentAttachments"; + String operationId = "updateIncidentAttachment"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -6179,37 +6593,45 @@ public ApiResponse updateIncidentAttachmentsWi // verify the required parameter 'incidentId' is set if (incidentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'incidentId' when calling updateIncidentAttachment"); + } + + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { throw new ApiException( 400, - "Missing the required parameter 'incidentId' when calling updateIncidentAttachments"); + "Missing the required parameter 'attachmentId' when calling updateIncidentAttachment"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( - 400, "Missing the required parameter 'body' when calling updateIncidentAttachments"); + 400, "Missing the required parameter 'body' when calling updateIncidentAttachment"); } - List include = parameters.include; + String include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/{incident_id}/attachments" + "/api/v2/incidents/{incident_id}/attachments/{attachment_id}" .replaceAll( - "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) + .replaceAll( + "\\{" + "attachment_id" + "\\}", apiClient.escapeString(attachmentId.toString())); List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "include", include)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); Invocation.Builder builder = apiClient.createBuilder( - "v2.IncidentsApi.updateIncidentAttachments", + "v2.IncidentsApi.updateIncidentAttachment", localVarPath, localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); return apiClient.invokeAPI( "PATCH", builder, @@ -6218,33 +6640,31 @@ public ApiResponse updateIncidentAttachmentsWi localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Create, update, and delete incident attachments. + * Update incident attachment. * - *

See {@link #updateIncidentAttachmentsWithHttpInfo}. + *

See {@link #updateIncidentAttachmentWithHttpInfo}. * * @param incidentId The UUID of the incident. (required) - * @param body Incident Attachment Payload. (required) + * @param attachmentId The ID of the attachment. (required) + * @param body (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<IncidentAttachmentUpdateResponse>> - * @deprecated + * @return CompletableFuture<ApiResponse<Attachment>> */ - @Deprecated - public CompletableFuture> - updateIncidentAttachmentsWithHttpInfoAsync( - String incidentId, - IncidentAttachmentUpdateRequest body, - UpdateIncidentAttachmentsOptionalParameters parameters) { + public CompletableFuture> updateIncidentAttachmentWithHttpInfoAsync( + String incidentId, + Object attachmentId, + PatchAttachmentRequest body, + UpdateIncidentAttachmentOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "updateIncidentAttachments"; + String operationId = "updateIncidentAttachment"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; @@ -6253,51 +6673,60 @@ public ApiResponse updateIncidentAttachmentsWi // verify the required parameter 'incidentId' is set if (incidentId == null) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'incidentId' when calling" - + " updateIncidentAttachments")); + "Missing the required parameter 'incidentId' when calling updateIncidentAttachment")); + return result; + } + + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'attachmentId' when calling" + + " updateIncidentAttachment")); return result; } // verify the required parameter 'body' is set if (body == null) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, "Missing the required parameter 'body' when calling updateIncidentAttachments")); + 400, "Missing the required parameter 'body' when calling updateIncidentAttachment")); return result; } - List include = parameters.include; + String include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/{incident_id}/attachments" + "/api/v2/incidents/{incident_id}/attachments/{attachment_id}" .replaceAll( - "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) + .replaceAll( + "\\{" + "attachment_id" + "\\}", apiClient.escapeString(attachmentId.toString())); List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "include", include)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.IncidentsApi.updateIncidentAttachments", + "v2.IncidentsApi.updateIncidentAttachment", localVarPath, localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth"}); + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -6309,7 +6738,7 @@ public ApiResponse updateIncidentAttachmentsWi localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateResponse.java b/src/main/java/com/datadog/api/client/v2/model/Attachment.java similarity index 60% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateResponse.java rename to src/main/java/com/datadog/api/client/v2/model/Attachment.java index 400f173f972..876de596c35 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateResponse.java +++ b/src/main/java/com/datadog/api/client/v2/model/Attachment.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -19,71 +18,49 @@ import java.util.Map; import java.util.Objects; -/** The response object containing the created or updated incident attachments. */ -@JsonPropertyOrder({ - IncidentAttachmentUpdateResponse.JSON_PROPERTY_DATA, - IncidentAttachmentUpdateResponse.JSON_PROPERTY_INCLUDED -}) +/** */ +@JsonPropertyOrder({Attachment.JSON_PROPERTY_DATA, Attachment.JSON_PROPERTY_INCLUDED}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentUpdateResponse { +public class Attachment { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private List data = new ArrayList<>(); + private AttachmentData data; public static final String JSON_PROPERTY_INCLUDED = "included"; - private List included = null; + private List included = null; - public IncidentAttachmentUpdateResponse() {} - - @JsonCreator - public IncidentAttachmentUpdateResponse( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) - List data) { - this.data = data; - } - - public IncidentAttachmentUpdateResponse data(List data) { + public Attachment data(AttachmentData data) { this.data = data; - for (IncidentAttachmentData item : data) { - this.unparsed |= item.unparsed; - } - return this; - } - - public IncidentAttachmentUpdateResponse addDataItem(IncidentAttachmentData dataItem) { - this.data.add(dataItem); - this.unparsed |= dataItem.unparsed; + this.unparsed |= data.unparsed; return this; } /** - * An array of incident attachments. Only the attachments that were created or updated by the - * request are returned. + * Getdata * * @return data */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DATA) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getData() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AttachmentData getData() { return data; } - public void setData(List data) { + public void setData(AttachmentData data) { this.data = data; } - public IncidentAttachmentUpdateResponse included( - List included) { + public Attachment included(List included) { this.included = included; - for (IncidentAttachmentsResponseIncludedItem item : included) { + for (AttachmentIncluded item : included) { this.unparsed |= item.unparsed; } return this; } - public IncidentAttachmentUpdateResponse addIncludedItem( - IncidentAttachmentsResponseIncludedItem includedItem) { + public Attachment addIncludedItem(AttachmentIncluded includedItem) { if (this.included == null) { this.included = new ArrayList<>(); } @@ -93,18 +70,18 @@ public IncidentAttachmentUpdateResponse addIncludedItem( } /** - * Included related resources that the user requested. + * Getincluded * * @return included */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_INCLUDED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getIncluded() { + public List getIncluded() { return included; } - public void setIncluded(List included) { + public void setIncluded(List included) { this.included = included; } @@ -120,10 +97,10 @@ public void setIncluded(List included) * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentUpdateResponse + * @return Attachment */ @JsonAnySetter - public IncidentAttachmentUpdateResponse putAdditionalProperty(String key, Object value) { + public Attachment putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -154,7 +131,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentUpdateResponse object is equal to o. */ + /** Return true if this Attachment object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -163,12 +140,10 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentUpdateResponse incidentAttachmentUpdateResponse = - (IncidentAttachmentUpdateResponse) o; - return Objects.equals(this.data, incidentAttachmentUpdateResponse.data) - && Objects.equals(this.included, incidentAttachmentUpdateResponse.included) - && Objects.equals( - this.additionalProperties, incidentAttachmentUpdateResponse.additionalProperties); + Attachment attachment = (Attachment) o; + return Objects.equals(this.data, attachment.data) + && Objects.equals(this.included, attachment.included) + && Objects.equals(this.additionalProperties, attachment.additionalProperties); } @Override @@ -179,7 +154,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentUpdateResponse {\n"); + sb.append("class Attachment {\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" included: ").append(toIndentedString(included)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsResponse.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentArray.java similarity index 68% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsResponse.java rename to src/main/java/com/datadog/api/client/v2/model/AttachmentArray.java index 845135362fa..c774ea73f7c 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsResponse.java +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentArray.java @@ -19,70 +19,64 @@ import java.util.Map; import java.util.Objects; -/** The response object containing an incident's attachments. */ -@JsonPropertyOrder({ - IncidentAttachmentsResponse.JSON_PROPERTY_DATA, - IncidentAttachmentsResponse.JSON_PROPERTY_INCLUDED -}) +/** */ +@JsonPropertyOrder({AttachmentArray.JSON_PROPERTY_DATA, AttachmentArray.JSON_PROPERTY_INCLUDED}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentsResponse { +public class AttachmentArray { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private List data = new ArrayList<>(); + private List data = new ArrayList<>(); public static final String JSON_PROPERTY_INCLUDED = "included"; - private List included = null; + private List included = null; - public IncidentAttachmentsResponse() {} + public AttachmentArray() {} @JsonCreator - public IncidentAttachmentsResponse( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) - List data) { + public AttachmentArray( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { this.data = data; } - public IncidentAttachmentsResponse data(List data) { + public AttachmentArray data(List data) { this.data = data; - for (IncidentAttachmentData item : data) { + for (AttachmentData item : data) { this.unparsed |= item.unparsed; } return this; } - public IncidentAttachmentsResponse addDataItem(IncidentAttachmentData dataItem) { + public AttachmentArray addDataItem(AttachmentData dataItem) { this.data.add(dataItem); this.unparsed |= dataItem.unparsed; return this; } /** - * An array of incident attachments. + * Getdata * * @return data */ @JsonProperty(JSON_PROPERTY_DATA) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } - public IncidentAttachmentsResponse included( - List included) { + public AttachmentArray included(List included) { this.included = included; - for (IncidentAttachmentsResponseIncludedItem item : included) { + for (AttachmentIncluded item : included) { this.unparsed |= item.unparsed; } return this; } - public IncidentAttachmentsResponse addIncludedItem( - IncidentAttachmentsResponseIncludedItem includedItem) { + public AttachmentArray addIncludedItem(AttachmentIncluded includedItem) { if (this.included == null) { this.included = new ArrayList<>(); } @@ -92,18 +86,18 @@ public IncidentAttachmentsResponse addIncludedItem( } /** - * Included related resources that the user requested. + * Getincluded * * @return included */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_INCLUDED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getIncluded() { + public List getIncluded() { return included; } - public void setIncluded(List included) { + public void setIncluded(List included) { this.included = included; } @@ -119,10 +113,10 @@ public void setIncluded(List included) * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentsResponse + * @return AttachmentArray */ @JsonAnySetter - public IncidentAttachmentsResponse putAdditionalProperty(String key, Object value) { + public AttachmentArray putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -153,7 +147,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentsResponse object is equal to o. */ + /** Return true if this AttachmentArray object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -162,11 +156,10 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentsResponse incidentAttachmentsResponse = (IncidentAttachmentsResponse) o; - return Objects.equals(this.data, incidentAttachmentsResponse.data) - && Objects.equals(this.included, incidentAttachmentsResponse.included) - && Objects.equals( - this.additionalProperties, incidentAttachmentsResponse.additionalProperties); + AttachmentArray attachmentArray = (AttachmentArray) o; + return Objects.equals(this.data, attachmentArray.data) + && Objects.equals(this.included, attachmentArray.included) + && Objects.equals(this.additionalProperties, attachmentArray.additionalProperties); } @Override @@ -177,7 +170,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentsResponse {\n"); + sb.append("class AttachmentArray {\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" included: ").append(toIndentedString(included)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentData.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentData.java similarity index 73% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentData.java rename to src/main/java/com/datadog/api/client/v2/model/AttachmentData.java index 6d2eab23f18..60622249b29 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentData.java +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentData.java @@ -17,38 +17,38 @@ import java.util.Map; import java.util.Objects; -/** A single incident attachment. */ +/** */ @JsonPropertyOrder({ - IncidentAttachmentData.JSON_PROPERTY_ATTRIBUTES, - IncidentAttachmentData.JSON_PROPERTY_ID, - IncidentAttachmentData.JSON_PROPERTY_RELATIONSHIPS, - IncidentAttachmentData.JSON_PROPERTY_TYPE + AttachmentData.JSON_PROPERTY_ATTRIBUTES, + AttachmentData.JSON_PROPERTY_ID, + AttachmentData.JSON_PROPERTY_RELATIONSHIPS, + AttachmentData.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentData { +public class AttachmentData { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; - private IncidentAttachmentAttributes attributes; + private AttachmentDataAttributes attributes; public static final String JSON_PROPERTY_ID = "id"; private String id; public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; - private IncidentAttachmentRelationships relationships; + private AttachmentDataRelationships relationships; public static final String JSON_PROPERTY_TYPE = "type"; private IncidentAttachmentType type = IncidentAttachmentType.INCIDENT_ATTACHMENTS; - public IncidentAttachmentData() {} + public AttachmentData() {} @JsonCreator - public IncidentAttachmentData( + public AttachmentData( @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) - IncidentAttachmentAttributes attributes, + AttachmentDataAttributes attributes, @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, @JsonProperty(required = true, value = JSON_PROPERTY_RELATIONSHIPS) - IncidentAttachmentRelationships relationships, + AttachmentDataRelationships relationships, @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentAttachmentType type) { this.attributes = attributes; this.unparsed |= attributes.unparsed; @@ -59,34 +59,34 @@ public IncidentAttachmentData( this.unparsed |= !type.isValid(); } - public IncidentAttachmentData attributes(IncidentAttachmentAttributes attributes) { + public AttachmentData attributes(AttachmentDataAttributes attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; return this; } /** - * The attributes object for an attachment. + * Getattributes * * @return attributes */ @JsonProperty(JSON_PROPERTY_ATTRIBUTES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public IncidentAttachmentAttributes getAttributes() { + public AttachmentDataAttributes getAttributes() { return attributes; } - public void setAttributes(IncidentAttachmentAttributes attributes) { + public void setAttributes(AttachmentDataAttributes attributes) { this.attributes = attributes; } - public IncidentAttachmentData id(String id) { + public AttachmentData id(String id) { this.id = id; return this; } /** - * A unique identifier that represents the incident attachment. + * Getid * * @return id */ @@ -100,28 +100,28 @@ public void setId(String id) { this.id = id; } - public IncidentAttachmentData relationships(IncidentAttachmentRelationships relationships) { + public AttachmentData relationships(AttachmentDataRelationships relationships) { this.relationships = relationships; this.unparsed |= relationships.unparsed; return this; } /** - * The incident attachment's relationships. + * Getrelationships * * @return relationships */ @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public IncidentAttachmentRelationships getRelationships() { + public AttachmentDataRelationships getRelationships() { return relationships; } - public void setRelationships(IncidentAttachmentRelationships relationships) { + public void setRelationships(AttachmentDataRelationships relationships) { this.relationships = relationships; } - public IncidentAttachmentData type(IncidentAttachmentType type) { + public AttachmentData type(IncidentAttachmentType type) { this.type = type; this.unparsed |= !type.isValid(); return this; @@ -157,10 +157,10 @@ public void setType(IncidentAttachmentType type) { * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentData + * @return AttachmentData */ @JsonAnySetter - public IncidentAttachmentData putAdditionalProperty(String key, Object value) { + public AttachmentData putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -191,7 +191,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentData object is equal to o. */ + /** Return true if this AttachmentData object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -200,12 +200,12 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentData incidentAttachmentData = (IncidentAttachmentData) o; - return Objects.equals(this.attributes, incidentAttachmentData.attributes) - && Objects.equals(this.id, incidentAttachmentData.id) - && Objects.equals(this.relationships, incidentAttachmentData.relationships) - && Objects.equals(this.type, incidentAttachmentData.type) - && Objects.equals(this.additionalProperties, incidentAttachmentData.additionalProperties); + AttachmentData attachmentData = (AttachmentData) o; + return Objects.equals(this.attributes, attachmentData.attributes) + && Objects.equals(this.id, attachmentData.id) + && Objects.equals(this.relationships, attachmentData.relationships) + && Objects.equals(this.type, attachmentData.type) + && Objects.equals(this.additionalProperties, attachmentData.additionalProperties); } @Override @@ -216,7 +216,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentData {\n"); + sb.append("class AttachmentData {\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributes.java similarity index 62% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttributes.java rename to src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributes.java index dad66be2891..9db949948b6 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributes.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -18,89 +17,80 @@ import java.util.Map; import java.util.Objects; -/** The attributes object for a link attachment. */ +/** */ @JsonPropertyOrder({ - IncidentAttachmentLinkAttributes.JSON_PROPERTY_ATTACHMENT, - IncidentAttachmentLinkAttributes.JSON_PROPERTY_ATTACHMENT_TYPE, - IncidentAttachmentLinkAttributes.JSON_PROPERTY_MODIFIED + AttachmentDataAttributes.JSON_PROPERTY_ATTACHMENT, + AttachmentDataAttributes.JSON_PROPERTY_ATTACHMENT_TYPE, + AttachmentDataAttributes.JSON_PROPERTY_MODIFIED }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentLinkAttributes { +public class AttachmentDataAttributes { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTACHMENT = "attachment"; - private IncidentAttachmentLinkAttributesAttachmentObject attachment; + private AttachmentDataAttributesAttachment attachment; public static final String JSON_PROPERTY_ATTACHMENT_TYPE = "attachment_type"; - private IncidentAttachmentLinkAttachmentType attachmentType = - IncidentAttachmentLinkAttachmentType.LINK; + private AttachmentDataAttributesAttachmentType attachmentType; public static final String JSON_PROPERTY_MODIFIED = "modified"; private OffsetDateTime modified; - public IncidentAttachmentLinkAttributes() {} - - @JsonCreator - public IncidentAttachmentLinkAttributes( - @JsonProperty(required = true, value = JSON_PROPERTY_ATTACHMENT) - IncidentAttachmentLinkAttributesAttachmentObject attachment, - @JsonProperty(required = true, value = JSON_PROPERTY_ATTACHMENT_TYPE) - IncidentAttachmentLinkAttachmentType attachmentType) { - this.attachment = attachment; - this.unparsed |= attachment.unparsed; - this.attachmentType = attachmentType; - this.unparsed |= !attachmentType.isValid(); - } - - public IncidentAttachmentLinkAttributes attachment( - IncidentAttachmentLinkAttributesAttachmentObject attachment) { + public AttachmentDataAttributes attachment(AttachmentDataAttributesAttachment attachment) { this.attachment = attachment; this.unparsed |= attachment.unparsed; return this; } /** - * The link attachment. + * Getattachment * * @return attachment */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTACHMENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public IncidentAttachmentLinkAttributesAttachmentObject getAttachment() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AttachmentDataAttributesAttachment getAttachment() { return attachment; } - public void setAttachment(IncidentAttachmentLinkAttributesAttachmentObject attachment) { + public void setAttachment(AttachmentDataAttributesAttachment attachment) { this.attachment = attachment; } - public IncidentAttachmentLinkAttributes attachmentType( - IncidentAttachmentLinkAttachmentType attachmentType) { + public AttachmentDataAttributes attachmentType( + AttachmentDataAttributesAttachmentType attachmentType) { this.attachmentType = attachmentType; this.unparsed |= !attachmentType.isValid(); return this; } /** - * The type of link attachment attributes. + * GetattachmentType * * @return attachmentType */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTACHMENT_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public IncidentAttachmentLinkAttachmentType getAttachmentType() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AttachmentDataAttributesAttachmentType getAttachmentType() { return attachmentType; } - public void setAttachmentType(IncidentAttachmentLinkAttachmentType attachmentType) { + public void setAttachmentType(AttachmentDataAttributesAttachmentType attachmentType) { if (!attachmentType.isValid()) { this.unparsed = true; } this.attachmentType = attachmentType; } + public AttachmentDataAttributes modified(OffsetDateTime modified) { + this.modified = modified; + return this; + } + /** - * Timestamp when the incident attachment link was last modified. + * Getmodified * * @return modified */ @@ -111,6 +101,10 @@ public OffsetDateTime getModified() { return modified; } + public void setModified(OffsetDateTime modified) { + this.modified = modified; + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -123,10 +117,10 @@ public OffsetDateTime getModified() { * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentLinkAttributes + * @return AttachmentDataAttributes */ @JsonAnySetter - public IncidentAttachmentLinkAttributes putAdditionalProperty(String key, Object value) { + public AttachmentDataAttributes putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -157,7 +151,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentLinkAttributes object is equal to o. */ + /** Return true if this AttachmentDataAttributes object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -166,13 +160,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentLinkAttributes incidentAttachmentLinkAttributes = - (IncidentAttachmentLinkAttributes) o; - return Objects.equals(this.attachment, incidentAttachmentLinkAttributes.attachment) - && Objects.equals(this.attachmentType, incidentAttachmentLinkAttributes.attachmentType) - && Objects.equals(this.modified, incidentAttachmentLinkAttributes.modified) - && Objects.equals( - this.additionalProperties, incidentAttachmentLinkAttributes.additionalProperties); + AttachmentDataAttributes attachmentDataAttributes = (AttachmentDataAttributes) o; + return Objects.equals(this.attachment, attachmentDataAttributes.attachment) + && Objects.equals(this.attachmentType, attachmentDataAttributes.attachmentType) + && Objects.equals(this.modified, attachmentDataAttributes.modified) + && Objects.equals(this.additionalProperties, attachmentDataAttributes.additionalProperties); } @Override @@ -183,7 +175,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentLinkAttributes {\n"); + sb.append("class AttachmentDataAttributes {\n"); sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); sb.append(" attachmentType: ").append(toIndentedString(attachmentType)).append("\n"); sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributesAttachment.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributesAttachment.java new file mode 100644 index 00000000000..b473f752f9a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributesAttachment.java @@ -0,0 +1,166 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + AttachmentDataAttributesAttachment.JSON_PROPERTY_DOCUMENT_URL, + AttachmentDataAttributesAttachment.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AttachmentDataAttributesAttachment { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DOCUMENT_URL = "documentUrl"; + private String documentUrl; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public AttachmentDataAttributesAttachment documentUrl(String documentUrl) { + this.documentUrl = documentUrl; + return this; + } + + /** + * GetdocumentUrl + * + * @return documentUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOCUMENT_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDocumentUrl() { + return documentUrl; + } + + public void setDocumentUrl(String documentUrl) { + this.documentUrl = documentUrl; + } + + public AttachmentDataAttributesAttachment title(String title) { + this.title = title; + return this; + } + + /** + * Gettitle + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AttachmentDataAttributesAttachment + */ + @JsonAnySetter + public AttachmentDataAttributesAttachment putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AttachmentDataAttributesAttachment object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentDataAttributesAttachment attachmentDataAttributesAttachment = + (AttachmentDataAttributesAttachment) o; + return Objects.equals(this.documentUrl, attachmentDataAttributesAttachment.documentUrl) + && Objects.equals(this.title, attachmentDataAttributesAttachment.title) + && Objects.equals( + this.additionalProperties, attachmentDataAttributesAttachment.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(documentUrl, title, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentDataAttributesAttachment {\n"); + sb.append(" documentUrl: ").append(toIndentedString(documentUrl)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributesAttachmentType.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributesAttachmentType.java new file mode 100644 index 00000000000..05cbe82925b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataAttributesAttachmentType.java @@ -0,0 +1,65 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize( + using = + AttachmentDataAttributesAttachmentType.AttachmentDataAttributesAttachmentTypeSerializer + .class) +public class AttachmentDataAttributesAttachmentType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("postmortem", "link")); + + public static final AttachmentDataAttributesAttachmentType POSTMORTEM = + new AttachmentDataAttributesAttachmentType("postmortem"); + public static final AttachmentDataAttributesAttachmentType LINK = + new AttachmentDataAttributesAttachmentType("link"); + + AttachmentDataAttributesAttachmentType(String value) { + super(value, allowedValues); + } + + public static class AttachmentDataAttributesAttachmentTypeSerializer + extends StdSerializer { + public AttachmentDataAttributesAttachmentTypeSerializer( + Class t) { + super(t); + } + + public AttachmentDataAttributesAttachmentTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AttachmentDataAttributesAttachmentType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AttachmentDataAttributesAttachmentType fromValue(String value) { + return new AttachmentDataAttributesAttachmentType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentRelationships.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationships.java similarity index 76% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentRelationships.java rename to src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationships.java index eafa7f37ac8..c244dfbb4b1 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentRelationships.java +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationships.java @@ -16,34 +16,36 @@ import java.util.Map; import java.util.Objects; -/** The incident attachment's relationships. */ -@JsonPropertyOrder({IncidentAttachmentRelationships.JSON_PROPERTY_LAST_MODIFIED_BY_USER}) +/** */ +@JsonPropertyOrder({AttachmentDataRelationships.JSON_PROPERTY_LAST_MODIFIED_BY_USER}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentRelationships { +public class AttachmentDataRelationships { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_LAST_MODIFIED_BY_USER = "last_modified_by_user"; - private RelationshipToUser lastModifiedByUser; + private AttachmentDataRelationshipsLastModifiedByUser lastModifiedByUser; - public IncidentAttachmentRelationships lastModifiedByUser(RelationshipToUser lastModifiedByUser) { + public AttachmentDataRelationships lastModifiedByUser( + AttachmentDataRelationshipsLastModifiedByUser lastModifiedByUser) { this.lastModifiedByUser = lastModifiedByUser; this.unparsed |= lastModifiedByUser.unparsed; return this; } /** - * Relationship to user. + * GetlastModifiedByUser * * @return lastModifiedByUser */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_LAST_MODIFIED_BY_USER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public RelationshipToUser getLastModifiedByUser() { + public AttachmentDataRelationshipsLastModifiedByUser getLastModifiedByUser() { return lastModifiedByUser; } - public void setLastModifiedByUser(RelationshipToUser lastModifiedByUser) { + public void setLastModifiedByUser( + AttachmentDataRelationshipsLastModifiedByUser lastModifiedByUser) { this.lastModifiedByUser = lastModifiedByUser; } @@ -59,10 +61,10 @@ public void setLastModifiedByUser(RelationshipToUser lastModifiedByUser) { * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentRelationships + * @return AttachmentDataRelationships */ @JsonAnySetter - public IncidentAttachmentRelationships putAdditionalProperty(String key, Object value) { + public AttachmentDataRelationships putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -93,7 +95,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentRelationships object is equal to o. */ + /** Return true if this AttachmentDataRelationships object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -102,12 +104,10 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentRelationships incidentAttachmentRelationships = - (IncidentAttachmentRelationships) o; - return Objects.equals( - this.lastModifiedByUser, incidentAttachmentRelationships.lastModifiedByUser) + AttachmentDataRelationships attachmentDataRelationships = (AttachmentDataRelationships) o; + return Objects.equals(this.lastModifiedByUser, attachmentDataRelationships.lastModifiedByUser) && Objects.equals( - this.additionalProperties, incidentAttachmentRelationships.additionalProperties); + this.additionalProperties, attachmentDataRelationships.additionalProperties); } @Override @@ -118,7 +118,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentRelationships {\n"); + sb.append("class AttachmentDataRelationships {\n"); sb.append(" lastModifiedByUser: ").append(toIndentedString(lastModifiedByUser)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationshipsLastModifiedByUser.java similarity index 64% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateRequest.java rename to src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationshipsLastModifiedByUser.java index ffa1c3f6bd5..77f5e29c5a4 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationshipsLastModifiedByUser.java @@ -13,59 +13,48 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; -/** The update request for an incident's attachments. */ -@JsonPropertyOrder({IncidentAttachmentUpdateRequest.JSON_PROPERTY_DATA}) +/** */ +@JsonPropertyOrder({AttachmentDataRelationshipsLastModifiedByUser.JSON_PROPERTY_DATA}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentUpdateRequest { +public class AttachmentDataRelationshipsLastModifiedByUser { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private List data = new ArrayList<>(); + private AttachmentDataRelationshipsLastModifiedByUserData data; - public IncidentAttachmentUpdateRequest() {} + public AttachmentDataRelationshipsLastModifiedByUser() {} @JsonCreator - public IncidentAttachmentUpdateRequest( + public AttachmentDataRelationshipsLastModifiedByUser( @JsonProperty(required = true, value = JSON_PROPERTY_DATA) - List data) { + AttachmentDataRelationshipsLastModifiedByUserData data) { this.data = data; + this.unparsed |= data.unparsed; } - public IncidentAttachmentUpdateRequest data(List data) { + public AttachmentDataRelationshipsLastModifiedByUser data( + AttachmentDataRelationshipsLastModifiedByUserData data) { this.data = data; - for (IncidentAttachmentUpdateData item : data) { - this.unparsed |= item.unparsed; - } - return this; - } - - public IncidentAttachmentUpdateRequest addDataItem(IncidentAttachmentUpdateData dataItem) { - this.data.add(dataItem); - this.unparsed |= dataItem.unparsed; + this.unparsed |= data.unparsed; return this; } /** - * An array of incident attachments. An attachment object without an "id" key indicates that you - * want to create that attachment. An attachment object without an "attributes" key indicates that - * you want to delete that attachment. An attachment object with both the "id" key and a populated - * "attributes" object indicates that you want to update that attachment. + * Getdata * * @return data */ @JsonProperty(JSON_PROPERTY_DATA) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getData() { + public AttachmentDataRelationshipsLastModifiedByUserData getData() { return data; } - public void setData(List data) { + public void setData(AttachmentDataRelationshipsLastModifiedByUserData data) { this.data = data; } @@ -81,10 +70,11 @@ public void setData(List data) { * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentUpdateRequest + * @return AttachmentDataRelationshipsLastModifiedByUser */ @JsonAnySetter - public IncidentAttachmentUpdateRequest putAdditionalProperty(String key, Object value) { + public AttachmentDataRelationshipsLastModifiedByUser putAdditionalProperty( + String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -115,7 +105,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentUpdateRequest object is equal to o. */ + /** Return true if this AttachmentDataRelationshipsLastModifiedByUser object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -124,11 +114,12 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentUpdateRequest incidentAttachmentUpdateRequest = - (IncidentAttachmentUpdateRequest) o; - return Objects.equals(this.data, incidentAttachmentUpdateRequest.data) + AttachmentDataRelationshipsLastModifiedByUser attachmentDataRelationshipsLastModifiedByUser = + (AttachmentDataRelationshipsLastModifiedByUser) o; + return Objects.equals(this.data, attachmentDataRelationshipsLastModifiedByUser.data) && Objects.equals( - this.additionalProperties, incidentAttachmentUpdateRequest.additionalProperties); + this.additionalProperties, + attachmentDataRelationshipsLastModifiedByUser.additionalProperties); } @Override @@ -139,7 +130,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentUpdateRequest {\n"); + sb.append("class AttachmentDataRelationshipsLastModifiedByUser {\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationshipsLastModifiedByUserData.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationshipsLastModifiedByUserData.java new file mode 100644 index 00000000000..4c1611bcccf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentDataRelationshipsLastModifiedByUserData.java @@ -0,0 +1,183 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + AttachmentDataRelationshipsLastModifiedByUserData.JSON_PROPERTY_ID, + AttachmentDataRelationshipsLastModifiedByUserData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AttachmentDataRelationshipsLastModifiedByUserData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UserType type = UserType.USERS; + + public AttachmentDataRelationshipsLastModifiedByUserData() {} + + @JsonCreator + public AttachmentDataRelationshipsLastModifiedByUserData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UserType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AttachmentDataRelationshipsLastModifiedByUserData id(String id) { + this.id = id; + return this; + } + + /** + * Getid + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AttachmentDataRelationshipsLastModifiedByUserData type(UserType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Users resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UserType getType() { + return type; + } + + public void setType(UserType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AttachmentDataRelationshipsLastModifiedByUserData + */ + @JsonAnySetter + public AttachmentDataRelationshipsLastModifiedByUserData putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AttachmentDataRelationshipsLastModifiedByUserData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentDataRelationshipsLastModifiedByUserData + attachmentDataRelationshipsLastModifiedByUserData = + (AttachmentDataRelationshipsLastModifiedByUserData) o; + return Objects.equals(this.id, attachmentDataRelationshipsLastModifiedByUserData.id) + && Objects.equals(this.type, attachmentDataRelationshipsLastModifiedByUserData.type) + && Objects.equals( + this.additionalProperties, + attachmentDataRelationshipsLastModifiedByUserData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentDataRelationshipsLastModifiedByUserData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsResponseIncludedItem.java b/src/main/java/com/datadog/api/client/v2/model/AttachmentIncluded.java similarity index 58% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsResponseIncludedItem.java rename to src/main/java/com/datadog/api/client/v2/model/AttachmentIncluded.java index 8875fb6f0b3..64d03bdd413 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsResponseIncludedItem.java +++ b/src/main/java/com/datadog/api/client/v2/model/AttachmentIncluded.java @@ -36,102 +36,92 @@ @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -@JsonDeserialize( - using = - IncidentAttachmentsResponseIncludedItem.IncidentAttachmentsResponseIncludedItemDeserializer - .class) -@JsonSerialize( - using = - IncidentAttachmentsResponseIncludedItem.IncidentAttachmentsResponseIncludedItemSerializer - .class) -public class IncidentAttachmentsResponseIncludedItem extends AbstractOpenApiSchema { - private static final Logger log = - Logger.getLogger(IncidentAttachmentsResponseIncludedItem.class.getName()); +@JsonDeserialize(using = AttachmentIncluded.AttachmentIncludedDeserializer.class) +@JsonSerialize(using = AttachmentIncluded.AttachmentIncludedSerializer.class) +public class AttachmentIncluded extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AttachmentIncluded.class.getName()); @JsonIgnore public boolean unparsed = false; - public static class IncidentAttachmentsResponseIncludedItemSerializer - extends StdSerializer { - public IncidentAttachmentsResponseIncludedItemSerializer( - Class t) { + public static class AttachmentIncludedSerializer extends StdSerializer { + public AttachmentIncludedSerializer(Class t) { super(t); } - public IncidentAttachmentsResponseIncludedItemSerializer() { + public AttachmentIncludedSerializer() { this(null); } @Override - public void serialize( - IncidentAttachmentsResponseIncludedItem value, - JsonGenerator jgen, - SerializerProvider provider) + public void serialize(AttachmentIncluded value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeObject(value.getActualInstance()); } } - public static class IncidentAttachmentsResponseIncludedItemDeserializer - extends StdDeserializer { - public IncidentAttachmentsResponseIncludedItemDeserializer() { - this(IncidentAttachmentsResponseIncludedItem.class); + public static class AttachmentIncludedDeserializer extends StdDeserializer { + public AttachmentIncludedDeserializer() { + this(AttachmentIncluded.class); } - public IncidentAttachmentsResponseIncludedItemDeserializer(Class vc) { + public AttachmentIncludedDeserializer(Class vc) { super(vc); } @Override - public IncidentAttachmentsResponseIncludedItem deserialize( - JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + public AttachmentIncluded deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { JsonNode tree = jp.readValueAsTree(); Object deserialized = null; Object tmp = null; boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize User + // deserialize User140420082644000 try { boolean attemptParsing = true; // ensure that we respect type coercion as set on the client ObjectMapper - if (User.class.equals(Integer.class) - || User.class.equals(Long.class) - || User.class.equals(Float.class) - || User.class.equals(Double.class) - || User.class.equals(Boolean.class) - || User.class.equals(String.class)) { + if (User140420082644000.class.equals(Integer.class) + || User140420082644000.class.equals(Long.class) + || User140420082644000.class.equals(Float.class) + || User140420082644000.class.equals(Double.class) + || User140420082644000.class.equals(Boolean.class) + || User140420082644000.class.equals(String.class)) { attemptParsing = typeCoercion; if (!attemptParsing) { attemptParsing |= - ((User.class.equals(Integer.class) || User.class.equals(Long.class)) + ((User140420082644000.class.equals(Integer.class) + || User140420082644000.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= - ((User.class.equals(Float.class) || User.class.equals(Double.class)) + ((User140420082644000.class.equals(Float.class) + || User140420082644000.class.equals(Double.class)) && (token == JsonToken.VALUE_NUMBER_FLOAT || token == JsonToken.VALUE_NUMBER_INT)); attemptParsing |= - (User.class.equals(Boolean.class) + (User140420082644000.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= (User.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= + (User140420082644000.class.equals(String.class) && token == JsonToken.VALUE_STRING); } } if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(User.class); + tmp = tree.traverse(jp.getCodec()).readValueAs(User140420082644000.class); // TODO: there is no validation against JSON schema constraints // (min, max, enum, pattern...), this does not perform a strict JSON // validation, which means the 'match' count may be higher than it should be. - if (!((User) tmp).unparsed) { + if (!((User140420082644000) tmp).unparsed) { deserialized = tmp; match++; } - log.log(Level.FINER, "Input data matches schema 'User'"); + log.log(Level.FINER, "Input data matches schema 'User140420082644000'"); } } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'User'", e); + log.log(Level.FINER, "Input data does not match schema 'User140420082644000'", e); } - IncidentAttachmentsResponseIncludedItem ret = new IncidentAttachmentsResponseIncludedItem(); + AttachmentIncluded ret = new AttachmentIncluded(); if (match == 1) { ret.setActualInstance(deserialized); } else { @@ -147,46 +137,44 @@ public IncidentAttachmentsResponseIncludedItem deserialize( /** Handle deserialization of the 'null' value. */ @Override - public IncidentAttachmentsResponseIncludedItem getNullValue(DeserializationContext ctxt) + public AttachmentIncluded getNullValue(DeserializationContext ctxt) throws JsonMappingException { - throw new JsonMappingException( - ctxt.getParser(), "IncidentAttachmentsResponseIncludedItem cannot be null"); + throw new JsonMappingException(ctxt.getParser(), "AttachmentIncluded cannot be null"); } } // store a list of schema names defined in oneOf public static final Map schemas = new HashMap(); - public IncidentAttachmentsResponseIncludedItem() { + public AttachmentIncluded() { super("oneOf", Boolean.FALSE); } - public IncidentAttachmentsResponseIncludedItem(User o) { + public AttachmentIncluded(User140420082644000 o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { - schemas.put("User", new GenericType() {}); - JSON.registerDescendants( - IncidentAttachmentsResponseIncludedItem.class, Collections.unmodifiableMap(schemas)); + schemas.put("User140420082644000", new GenericType() {}); + JSON.registerDescendants(AttachmentIncluded.class, Collections.unmodifiableMap(schemas)); } @Override public Map getSchemas() { - return IncidentAttachmentsResponseIncludedItem.schemas; + return AttachmentIncluded.schemas; } /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: User + * against the oneOf child schemas: User140420082644000 * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). */ @Override public void setActualInstance(Object instance) { - if (JSON.isInstanceOf(User.class, instance, new HashSet>())) { + if (JSON.isInstanceOf(User140420082644000.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } @@ -195,13 +183,13 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } - throw new RuntimeException("Invalid instance type. Must be User"); + throw new RuntimeException("Invalid instance type. Must be User140420082644000"); } /** - * Get the actual instance, which can be the following: User + * Get the actual instance, which can be the following: User140420082644000 * - * @return The actual instance (User) + * @return The actual instance (User140420082644000) */ @Override public Object getActualInstance() { @@ -209,13 +197,13 @@ public Object getActualInstance() { } /** - * Get the actual instance of `User`. If the actual instance is not `User`, the ClassCastException - * will be thrown. + * Get the actual instance of `User140420082644000`. If the actual instance is not + * `User140420082644000`, the ClassCastException will be thrown. * - * @return The actual instance of `User` - * @throws ClassCastException if the instance is not `User` + * @return The actual instance of `User140420082644000` + * @throws ClassCastException if the instance is not `User140420082644000` */ - public User getUser() throws ClassCastException { - return (User) super.getActualInstance(); + public User140420082644000 getUser140420082644000() throws ClassCastException { + return (User140420082644000) super.getActualInstance(); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequest.java new file mode 100644 index 00000000000..0c7e4b89ea0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequest.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({CreateAttachmentRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateAttachmentRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreateAttachmentRequestData data; + + public CreateAttachmentRequest data(CreateAttachmentRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CreateAttachmentRequestData getData() { + return data; + } + + public void setData(CreateAttachmentRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateAttachmentRequest + */ + @JsonAnySetter + public CreateAttachmentRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateAttachmentRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAttachmentRequest createAttachmentRequest = (CreateAttachmentRequest) o; + return Objects.equals(this.data, createAttachmentRequest.data) + && Objects.equals(this.additionalProperties, createAttachmentRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAttachmentRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestData.java similarity index 76% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateData.java rename to src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestData.java index 97488dea4e6..e6ad583933a 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateData.java +++ b/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestData.java @@ -17,18 +17,18 @@ import java.util.Map; import java.util.Objects; -/** A single incident attachment. */ +/** */ @JsonPropertyOrder({ - IncidentAttachmentUpdateData.JSON_PROPERTY_ATTRIBUTES, - IncidentAttachmentUpdateData.JSON_PROPERTY_ID, - IncidentAttachmentUpdateData.JSON_PROPERTY_TYPE + CreateAttachmentRequestData.JSON_PROPERTY_ATTRIBUTES, + CreateAttachmentRequestData.JSON_PROPERTY_ID, + CreateAttachmentRequestData.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentUpdateData { +public class CreateAttachmentRequestData { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; - private IncidentAttachmentUpdateAttributes attributes; + private CreateAttachmentRequestDataAttributes attributes; public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -36,44 +36,44 @@ public class IncidentAttachmentUpdateData { public static final String JSON_PROPERTY_TYPE = "type"; private IncidentAttachmentType type = IncidentAttachmentType.INCIDENT_ATTACHMENTS; - public IncidentAttachmentUpdateData() {} + public CreateAttachmentRequestData() {} @JsonCreator - public IncidentAttachmentUpdateData( + public CreateAttachmentRequestData( @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentAttachmentType type) { this.type = type; this.unparsed |= !type.isValid(); } - public IncidentAttachmentUpdateData attributes(IncidentAttachmentUpdateAttributes attributes) { + public CreateAttachmentRequestData attributes(CreateAttachmentRequestDataAttributes attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; return this; } /** - * Incident attachment attributes. + * Getattributes * * @return attributes */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTRIBUTES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public IncidentAttachmentUpdateAttributes getAttributes() { + public CreateAttachmentRequestDataAttributes getAttributes() { return attributes; } - public void setAttributes(IncidentAttachmentUpdateAttributes attributes) { + public void setAttributes(CreateAttachmentRequestDataAttributes attributes) { this.attributes = attributes; } - public IncidentAttachmentUpdateData id(String id) { + public CreateAttachmentRequestData id(String id) { this.id = id; return this; } /** - * A unique identifier that represents the incident attachment. + * Getid * * @return id */ @@ -88,7 +88,7 @@ public void setId(String id) { this.id = id; } - public IncidentAttachmentUpdateData type(IncidentAttachmentType type) { + public CreateAttachmentRequestData type(IncidentAttachmentType type) { this.type = type; this.unparsed |= !type.isValid(); return this; @@ -124,10 +124,10 @@ public void setType(IncidentAttachmentType type) { * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentUpdateData + * @return CreateAttachmentRequestData */ @JsonAnySetter - public IncidentAttachmentUpdateData putAdditionalProperty(String key, Object value) { + public CreateAttachmentRequestData putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -158,7 +158,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentUpdateData object is equal to o. */ + /** Return true if this CreateAttachmentRequestData object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -167,12 +167,12 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentUpdateData incidentAttachmentUpdateData = (IncidentAttachmentUpdateData) o; - return Objects.equals(this.attributes, incidentAttachmentUpdateData.attributes) - && Objects.equals(this.id, incidentAttachmentUpdateData.id) - && Objects.equals(this.type, incidentAttachmentUpdateData.type) + CreateAttachmentRequestData createAttachmentRequestData = (CreateAttachmentRequestData) o; + return Objects.equals(this.attributes, createAttachmentRequestData.attributes) + && Objects.equals(this.id, createAttachmentRequestData.id) + && Objects.equals(this.type, createAttachmentRequestData.type) && Objects.equals( - this.additionalProperties, incidentAttachmentUpdateData.additionalProperties); + this.additionalProperties, createAttachmentRequestData.additionalProperties); } @Override @@ -183,7 +183,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentUpdateData {\n"); + sb.append("class CreateAttachmentRequestData {\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentPostmortemAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestDataAttributes.java similarity index 59% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentPostmortemAttributes.java rename to src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestDataAttributes.java index 86fbedf5627..43b492185c4 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentPostmortemAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestDataAttributes.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,77 +16,64 @@ import java.util.Map; import java.util.Objects; -/** The attributes object for a postmortem attachment. */ +/** */ @JsonPropertyOrder({ - IncidentAttachmentPostmortemAttributes.JSON_PROPERTY_ATTACHMENT, - IncidentAttachmentPostmortemAttributes.JSON_PROPERTY_ATTACHMENT_TYPE + CreateAttachmentRequestDataAttributes.JSON_PROPERTY_ATTACHMENT, + CreateAttachmentRequestDataAttributes.JSON_PROPERTY_ATTACHMENT_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentPostmortemAttributes { +public class CreateAttachmentRequestDataAttributes { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTACHMENT = "attachment"; - private IncidentAttachmentsPostmortemAttributesAttachmentObject attachment; + private CreateAttachmentRequestDataAttributesAttachment attachment; public static final String JSON_PROPERTY_ATTACHMENT_TYPE = "attachment_type"; - private IncidentAttachmentPostmortemAttachmentType attachmentType = - IncidentAttachmentPostmortemAttachmentType.POSTMORTEM; + private AttachmentDataAttributesAttachmentType attachmentType; - public IncidentAttachmentPostmortemAttributes() {} - - @JsonCreator - public IncidentAttachmentPostmortemAttributes( - @JsonProperty(required = true, value = JSON_PROPERTY_ATTACHMENT) - IncidentAttachmentsPostmortemAttributesAttachmentObject attachment, - @JsonProperty(required = true, value = JSON_PROPERTY_ATTACHMENT_TYPE) - IncidentAttachmentPostmortemAttachmentType attachmentType) { - this.attachment = attachment; - this.unparsed |= attachment.unparsed; - this.attachmentType = attachmentType; - this.unparsed |= !attachmentType.isValid(); - } - - public IncidentAttachmentPostmortemAttributes attachment( - IncidentAttachmentsPostmortemAttributesAttachmentObject attachment) { + public CreateAttachmentRequestDataAttributes attachment( + CreateAttachmentRequestDataAttributesAttachment attachment) { this.attachment = attachment; this.unparsed |= attachment.unparsed; return this; } /** - * The postmortem attachment. + * Getattachment * * @return attachment */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTACHMENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public IncidentAttachmentsPostmortemAttributesAttachmentObject getAttachment() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CreateAttachmentRequestDataAttributesAttachment getAttachment() { return attachment; } - public void setAttachment(IncidentAttachmentsPostmortemAttributesAttachmentObject attachment) { + public void setAttachment(CreateAttachmentRequestDataAttributesAttachment attachment) { this.attachment = attachment; } - public IncidentAttachmentPostmortemAttributes attachmentType( - IncidentAttachmentPostmortemAttachmentType attachmentType) { + public CreateAttachmentRequestDataAttributes attachmentType( + AttachmentDataAttributesAttachmentType attachmentType) { this.attachmentType = attachmentType; this.unparsed |= !attachmentType.isValid(); return this; } /** - * The type of postmortem attachment attributes. + * GetattachmentType * * @return attachmentType */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTACHMENT_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public IncidentAttachmentPostmortemAttachmentType getAttachmentType() { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AttachmentDataAttributesAttachmentType getAttachmentType() { return attachmentType; } - public void setAttachmentType(IncidentAttachmentPostmortemAttachmentType attachmentType) { + public void setAttachmentType(AttachmentDataAttributesAttachmentType attachmentType) { if (!attachmentType.isValid()) { this.unparsed = true; } @@ -106,10 +92,10 @@ public void setAttachmentType(IncidentAttachmentPostmortemAttachmentType attachm * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentPostmortemAttributes + * @return CreateAttachmentRequestDataAttributes */ @JsonAnySetter - public IncidentAttachmentPostmortemAttributes putAdditionalProperty(String key, Object value) { + public CreateAttachmentRequestDataAttributes putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -140,7 +126,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentPostmortemAttributes object is equal to o. */ + /** Return true if this CreateAttachmentRequestDataAttributes object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -149,13 +135,12 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentPostmortemAttributes incidentAttachmentPostmortemAttributes = - (IncidentAttachmentPostmortemAttributes) o; - return Objects.equals(this.attachment, incidentAttachmentPostmortemAttributes.attachment) - && Objects.equals( - this.attachmentType, incidentAttachmentPostmortemAttributes.attachmentType) + CreateAttachmentRequestDataAttributes createAttachmentRequestDataAttributes = + (CreateAttachmentRequestDataAttributes) o; + return Objects.equals(this.attachment, createAttachmentRequestDataAttributes.attachment) + && Objects.equals(this.attachmentType, createAttachmentRequestDataAttributes.attachmentType) && Objects.equals( - this.additionalProperties, incidentAttachmentPostmortemAttributes.additionalProperties); + this.additionalProperties, createAttachmentRequestDataAttributes.additionalProperties); } @Override @@ -166,7 +151,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentPostmortemAttributes {\n"); + sb.append("class CreateAttachmentRequestDataAttributes {\n"); sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); sb.append(" attachmentType: ").append(toIndentedString(attachmentType)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttributesAttachmentObject.java b/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestDataAttributesAttachment.java similarity index 69% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttributesAttachmentObject.java rename to src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestDataAttributesAttachment.java index 75cfd434970..71c10700d2d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttributesAttachmentObject.java +++ b/src/main/java/com/datadog/api/client/v2/model/CreateAttachmentRequestDataAttributesAttachment.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,14 +16,14 @@ import java.util.Map; import java.util.Objects; -/** The link attachment. */ +/** */ @JsonPropertyOrder({ - IncidentAttachmentLinkAttributesAttachmentObject.JSON_PROPERTY_DOCUMENT_URL, - IncidentAttachmentLinkAttributesAttachmentObject.JSON_PROPERTY_TITLE + CreateAttachmentRequestDataAttributesAttachment.JSON_PROPERTY_DOCUMENT_URL, + CreateAttachmentRequestDataAttributesAttachment.JSON_PROPERTY_TITLE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentLinkAttributesAttachmentObject { +public class CreateAttachmentRequestDataAttributesAttachment { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DOCUMENT_URL = "documentUrl"; private String documentUrl; @@ -32,28 +31,19 @@ public class IncidentAttachmentLinkAttributesAttachmentObject { public static final String JSON_PROPERTY_TITLE = "title"; private String title; - public IncidentAttachmentLinkAttributesAttachmentObject() {} - - @JsonCreator - public IncidentAttachmentLinkAttributesAttachmentObject( - @JsonProperty(required = true, value = JSON_PROPERTY_DOCUMENT_URL) String documentUrl, - @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { - this.documentUrl = documentUrl; - this.title = title; - } - - public IncidentAttachmentLinkAttributesAttachmentObject documentUrl(String documentUrl) { + public CreateAttachmentRequestDataAttributesAttachment documentUrl(String documentUrl) { this.documentUrl = documentUrl; return this; } /** - * The URL of this link attachment. + * GetdocumentUrl * * @return documentUrl */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DOCUMENT_URL) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getDocumentUrl() { return documentUrl; } @@ -62,18 +52,19 @@ public void setDocumentUrl(String documentUrl) { this.documentUrl = documentUrl; } - public IncidentAttachmentLinkAttributesAttachmentObject title(String title) { + public CreateAttachmentRequestDataAttributesAttachment title(String title) { this.title = title; return this; } /** - * The title of this link attachment. + * Gettitle * * @return title */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TITLE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getTitle() { return title; } @@ -94,10 +85,10 @@ public void setTitle(String title) { * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentLinkAttributesAttachmentObject + * @return CreateAttachmentRequestDataAttributesAttachment */ @JsonAnySetter - public IncidentAttachmentLinkAttributesAttachmentObject putAdditionalProperty( + public CreateAttachmentRequestDataAttributesAttachment putAdditionalProperty( String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); @@ -129,7 +120,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this IncidentAttachmentLinkAttributesAttachmentObject object is equal to o. */ + /** Return true if this CreateAttachmentRequestDataAttributesAttachment object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -138,15 +129,15 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentLinkAttributesAttachmentObject - incidentAttachmentLinkAttributesAttachmentObject = - (IncidentAttachmentLinkAttributesAttachmentObject) o; + CreateAttachmentRequestDataAttributesAttachment + createAttachmentRequestDataAttributesAttachment = + (CreateAttachmentRequestDataAttributesAttachment) o; return Objects.equals( - this.documentUrl, incidentAttachmentLinkAttributesAttachmentObject.documentUrl) - && Objects.equals(this.title, incidentAttachmentLinkAttributesAttachmentObject.title) + this.documentUrl, createAttachmentRequestDataAttributesAttachment.documentUrl) + && Objects.equals(this.title, createAttachmentRequestDataAttributesAttachment.title) && Objects.equals( this.additionalProperties, - incidentAttachmentLinkAttributesAttachmentObject.additionalProperties); + createAttachmentRequestDataAttributesAttachment.additionalProperties); } @Override @@ -157,7 +148,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentLinkAttributesAttachmentObject {\n"); + sb.append("class CreateAttachmentRequestDataAttributesAttachment {\n"); sb.append(" documentUrl: ").append(toIndentedString(documentUrl)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentAttachmentType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentAttachmentType.java deleted file mode 100644 index e27ba5ed0fb..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentAttachmentType.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.ModelEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** The type of the incident attachment attributes. */ -@JsonSerialize( - using = IncidentAttachmentAttachmentType.IncidentAttachmentAttachmentTypeSerializer.class) -public class IncidentAttachmentAttachmentType extends ModelEnum { - - private static final Set allowedValues = - new HashSet(Arrays.asList("link", "postmortem")); - - public static final IncidentAttachmentAttachmentType LINK = - new IncidentAttachmentAttachmentType("link"); - public static final IncidentAttachmentAttachmentType POSTMORTEM = - new IncidentAttachmentAttachmentType("postmortem"); - - IncidentAttachmentAttachmentType(String value) { - super(value, allowedValues); - } - - public static class IncidentAttachmentAttachmentTypeSerializer - extends StdSerializer { - public IncidentAttachmentAttachmentTypeSerializer(Class t) { - super(t); - } - - public IncidentAttachmentAttachmentTypeSerializer() { - this(null); - } - - @Override - public void serialize( - IncidentAttachmentAttachmentType value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.value); - } - } - - @JsonCreator - public static IncidentAttachmentAttachmentType fromValue(String value) { - return new IncidentAttachmentAttachmentType(value); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentAttributes.java b/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentAttributes.java deleted file mode 100644 index 0f2f89edfa7..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentAttributes.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.AbstractOpenApiSchema; -import com.datadog.api.client.JSON; -import com.datadog.api.client.UnparsedObject; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import jakarta.ws.rs.core.GenericType; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -@JsonDeserialize( - using = IncidentAttachmentAttributes.IncidentAttachmentAttributesDeserializer.class) -@JsonSerialize(using = IncidentAttachmentAttributes.IncidentAttachmentAttributesSerializer.class) -public class IncidentAttachmentAttributes extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(IncidentAttachmentAttributes.class.getName()); - - @JsonIgnore public boolean unparsed = false; - - public static class IncidentAttachmentAttributesSerializer - extends StdSerializer { - public IncidentAttachmentAttributesSerializer(Class t) { - super(t); - } - - public IncidentAttachmentAttributesSerializer() { - this(null); - } - - @Override - public void serialize( - IncidentAttachmentAttributes value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static class IncidentAttachmentAttributesDeserializer - extends StdDeserializer { - public IncidentAttachmentAttributesDeserializer() { - this(IncidentAttachmentAttributes.class); - } - - public IncidentAttachmentAttributesDeserializer(Class vc) { - super(vc); - } - - @Override - public IncidentAttachmentAttributes deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - Object tmp = null; - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize IncidentAttachmentPostmortemAttributes - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (IncidentAttachmentPostmortemAttributes.class.equals(Integer.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Long.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Float.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Double.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Boolean.class) - || IncidentAttachmentPostmortemAttributes.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((IncidentAttachmentPostmortemAttributes.class.equals(Integer.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((IncidentAttachmentPostmortemAttributes.class.equals(Float.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Double.class)) - && (token == JsonToken.VALUE_NUMBER_FLOAT - || token == JsonToken.VALUE_NUMBER_INT)); - attemptParsing |= - (IncidentAttachmentPostmortemAttributes.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (IncidentAttachmentPostmortemAttributes.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - tmp = - tree.traverse(jp.getCodec()) - .readValueAs(IncidentAttachmentPostmortemAttributes.class); - // TODO: there is no validation against JSON schema constraints - // (min, max, enum, pattern...), this does not perform a strict JSON - // validation, which means the 'match' count may be higher than it should be. - if (!((IncidentAttachmentPostmortemAttributes) tmp).unparsed) { - deserialized = tmp; - match++; - } - log.log( - Level.FINER, "Input data matches schema 'IncidentAttachmentPostmortemAttributes'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log( - Level.FINER, - "Input data does not match schema 'IncidentAttachmentPostmortemAttributes'", - e); - } - - // deserialize IncidentAttachmentLinkAttributes - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (IncidentAttachmentLinkAttributes.class.equals(Integer.class) - || IncidentAttachmentLinkAttributes.class.equals(Long.class) - || IncidentAttachmentLinkAttributes.class.equals(Float.class) - || IncidentAttachmentLinkAttributes.class.equals(Double.class) - || IncidentAttachmentLinkAttributes.class.equals(Boolean.class) - || IncidentAttachmentLinkAttributes.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((IncidentAttachmentLinkAttributes.class.equals(Integer.class) - || IncidentAttachmentLinkAttributes.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((IncidentAttachmentLinkAttributes.class.equals(Float.class) - || IncidentAttachmentLinkAttributes.class.equals(Double.class)) - && (token == JsonToken.VALUE_NUMBER_FLOAT - || token == JsonToken.VALUE_NUMBER_INT)); - attemptParsing |= - (IncidentAttachmentLinkAttributes.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (IncidentAttachmentLinkAttributes.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(IncidentAttachmentLinkAttributes.class); - // TODO: there is no validation against JSON schema constraints - // (min, max, enum, pattern...), this does not perform a strict JSON - // validation, which means the 'match' count may be higher than it should be. - if (!((IncidentAttachmentLinkAttributes) tmp).unparsed) { - deserialized = tmp; - match++; - } - log.log(Level.FINER, "Input data matches schema 'IncidentAttachmentLinkAttributes'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log( - Level.FINER, "Input data does not match schema 'IncidentAttachmentLinkAttributes'", e); - } - - IncidentAttachmentAttributes ret = new IncidentAttachmentAttributes(); - if (match == 1) { - ret.setActualInstance(deserialized); - } else { - Map res = - new ObjectMapper() - .readValue( - tree.traverse(jp.getCodec()).readValueAsTree().toString(), - new TypeReference>() {}); - ret.setActualInstance(new UnparsedObject(res)); - } - return ret; - } - - /** Handle deserialization of the 'null' value. */ - @Override - public IncidentAttachmentAttributes getNullValue(DeserializationContext ctxt) - throws JsonMappingException { - throw new JsonMappingException( - ctxt.getParser(), "IncidentAttachmentAttributes cannot be null"); - } - } - - // store a list of schema names defined in oneOf - public static final Map schemas = new HashMap(); - - public IncidentAttachmentAttributes() { - super("oneOf", Boolean.FALSE); - } - - public IncidentAttachmentAttributes(IncidentAttachmentPostmortemAttributes o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public IncidentAttachmentAttributes(IncidentAttachmentLinkAttributes o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put( - "IncidentAttachmentPostmortemAttributes", - new GenericType() {}); - schemas.put( - "IncidentAttachmentLinkAttributes", new GenericType() {}); - JSON.registerDescendants( - IncidentAttachmentAttributes.class, Collections.unmodifiableMap(schemas)); - } - - @Override - public Map getSchemas() { - return IncidentAttachmentAttributes.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: IncidentAttachmentPostmortemAttributes, - * IncidentAttachmentLinkAttributes - * - *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a - * composed schema (allOf, anyOf, oneOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSON.isInstanceOf( - IncidentAttachmentPostmortemAttributes.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - if (JSON.isInstanceOf( - IncidentAttachmentLinkAttributes.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - throw new RuntimeException( - "Invalid instance type. Must be IncidentAttachmentPostmortemAttributes," - + " IncidentAttachmentLinkAttributes"); - } - - /** - * Get the actual instance, which can be the following: IncidentAttachmentPostmortemAttributes, - * IncidentAttachmentLinkAttributes - * - * @return The actual instance (IncidentAttachmentPostmortemAttributes, - * IncidentAttachmentLinkAttributes) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `IncidentAttachmentPostmortemAttributes`. If the actual instance is - * not `IncidentAttachmentPostmortemAttributes`, the ClassCastException will be thrown. - * - * @return The actual instance of `IncidentAttachmentPostmortemAttributes` - * @throws ClassCastException if the instance is not `IncidentAttachmentPostmortemAttributes` - */ - public IncidentAttachmentPostmortemAttributes getIncidentAttachmentPostmortemAttributes() - throws ClassCastException { - return (IncidentAttachmentPostmortemAttributes) super.getActualInstance(); - } - - /** - * Get the actual instance of `IncidentAttachmentLinkAttributes`. If the actual instance is not - * `IncidentAttachmentLinkAttributes`, the ClassCastException will be thrown. - * - * @return The actual instance of `IncidentAttachmentLinkAttributes` - * @throws ClassCastException if the instance is not `IncidentAttachmentLinkAttributes` - */ - public IncidentAttachmentLinkAttributes getIncidentAttachmentLinkAttributes() - throws ClassCastException { - return (IncidentAttachmentLinkAttributes) super.getActualInstance(); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttachmentType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttachmentType.java deleted file mode 100644 index 640e3a6ffe7..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentLinkAttachmentType.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.ModelEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** The type of link attachment attributes. */ -@JsonSerialize( - using = - IncidentAttachmentLinkAttachmentType.IncidentAttachmentLinkAttachmentTypeSerializer.class) -public class IncidentAttachmentLinkAttachmentType extends ModelEnum { - - private static final Set allowedValues = new HashSet(Arrays.asList("link")); - - public static final IncidentAttachmentLinkAttachmentType LINK = - new IncidentAttachmentLinkAttachmentType("link"); - - IncidentAttachmentLinkAttachmentType(String value) { - super(value, allowedValues); - } - - public static class IncidentAttachmentLinkAttachmentTypeSerializer - extends StdSerializer { - public IncidentAttachmentLinkAttachmentTypeSerializer( - Class t) { - super(t); - } - - public IncidentAttachmentLinkAttachmentTypeSerializer() { - this(null); - } - - @Override - public void serialize( - IncidentAttachmentLinkAttachmentType value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.value); - } - } - - @JsonCreator - public static IncidentAttachmentLinkAttachmentType fromValue(String value) { - return new IncidentAttachmentLinkAttachmentType(value); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentPostmortemAttachmentType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentPostmortemAttachmentType.java deleted file mode 100644 index b20dff959e9..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentPostmortemAttachmentType.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.ModelEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** The type of postmortem attachment attributes. */ -@JsonSerialize( - using = - IncidentAttachmentPostmortemAttachmentType - .IncidentAttachmentPostmortemAttachmentTypeSerializer.class) -public class IncidentAttachmentPostmortemAttachmentType extends ModelEnum { - - private static final Set allowedValues = new HashSet(Arrays.asList("postmortem")); - - public static final IncidentAttachmentPostmortemAttachmentType POSTMORTEM = - new IncidentAttachmentPostmortemAttachmentType("postmortem"); - - IncidentAttachmentPostmortemAttachmentType(String value) { - super(value, allowedValues); - } - - public static class IncidentAttachmentPostmortemAttachmentTypeSerializer - extends StdSerializer { - public IncidentAttachmentPostmortemAttachmentTypeSerializer( - Class t) { - super(t); - } - - public IncidentAttachmentPostmortemAttachmentTypeSerializer() { - this(null); - } - - @Override - public void serialize( - IncidentAttachmentPostmortemAttachmentType value, - JsonGenerator jgen, - SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.value); - } - } - - @JsonCreator - public static IncidentAttachmentPostmortemAttachmentType fromValue(String value) { - return new IncidentAttachmentPostmortemAttachmentType(value); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateAttributes.java deleted file mode 100644 index 7a789d53197..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentUpdateAttributes.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.AbstractOpenApiSchema; -import com.datadog.api.client.JSON; -import com.datadog.api.client.UnparsedObject; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import jakarta.ws.rs.core.GenericType; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -@jakarta.annotation.Generated( - value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -@JsonDeserialize( - using = IncidentAttachmentUpdateAttributes.IncidentAttachmentUpdateAttributesDeserializer.class) -@JsonSerialize( - using = IncidentAttachmentUpdateAttributes.IncidentAttachmentUpdateAttributesSerializer.class) -public class IncidentAttachmentUpdateAttributes extends AbstractOpenApiSchema { - private static final Logger log = - Logger.getLogger(IncidentAttachmentUpdateAttributes.class.getName()); - - @JsonIgnore public boolean unparsed = false; - - public static class IncidentAttachmentUpdateAttributesSerializer - extends StdSerializer { - public IncidentAttachmentUpdateAttributesSerializer( - Class t) { - super(t); - } - - public IncidentAttachmentUpdateAttributesSerializer() { - this(null); - } - - @Override - public void serialize( - IncidentAttachmentUpdateAttributes value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static class IncidentAttachmentUpdateAttributesDeserializer - extends StdDeserializer { - public IncidentAttachmentUpdateAttributesDeserializer() { - this(IncidentAttachmentUpdateAttributes.class); - } - - public IncidentAttachmentUpdateAttributesDeserializer(Class vc) { - super(vc); - } - - @Override - public IncidentAttachmentUpdateAttributes deserialize( - JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - Object tmp = null; - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize IncidentAttachmentPostmortemAttributes - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (IncidentAttachmentPostmortemAttributes.class.equals(Integer.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Long.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Float.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Double.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Boolean.class) - || IncidentAttachmentPostmortemAttributes.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((IncidentAttachmentPostmortemAttributes.class.equals(Integer.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((IncidentAttachmentPostmortemAttributes.class.equals(Float.class) - || IncidentAttachmentPostmortemAttributes.class.equals(Double.class)) - && (token == JsonToken.VALUE_NUMBER_FLOAT - || token == JsonToken.VALUE_NUMBER_INT)); - attemptParsing |= - (IncidentAttachmentPostmortemAttributes.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (IncidentAttachmentPostmortemAttributes.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - tmp = - tree.traverse(jp.getCodec()) - .readValueAs(IncidentAttachmentPostmortemAttributes.class); - // TODO: there is no validation against JSON schema constraints - // (min, max, enum, pattern...), this does not perform a strict JSON - // validation, which means the 'match' count may be higher than it should be. - if (!((IncidentAttachmentPostmortemAttributes) tmp).unparsed) { - deserialized = tmp; - match++; - } - log.log( - Level.FINER, "Input data matches schema 'IncidentAttachmentPostmortemAttributes'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log( - Level.FINER, - "Input data does not match schema 'IncidentAttachmentPostmortemAttributes'", - e); - } - - // deserialize IncidentAttachmentLinkAttributes - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (IncidentAttachmentLinkAttributes.class.equals(Integer.class) - || IncidentAttachmentLinkAttributes.class.equals(Long.class) - || IncidentAttachmentLinkAttributes.class.equals(Float.class) - || IncidentAttachmentLinkAttributes.class.equals(Double.class) - || IncidentAttachmentLinkAttributes.class.equals(Boolean.class) - || IncidentAttachmentLinkAttributes.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((IncidentAttachmentLinkAttributes.class.equals(Integer.class) - || IncidentAttachmentLinkAttributes.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((IncidentAttachmentLinkAttributes.class.equals(Float.class) - || IncidentAttachmentLinkAttributes.class.equals(Double.class)) - && (token == JsonToken.VALUE_NUMBER_FLOAT - || token == JsonToken.VALUE_NUMBER_INT)); - attemptParsing |= - (IncidentAttachmentLinkAttributes.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (IncidentAttachmentLinkAttributes.class.equals(String.class) - && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(IncidentAttachmentLinkAttributes.class); - // TODO: there is no validation against JSON schema constraints - // (min, max, enum, pattern...), this does not perform a strict JSON - // validation, which means the 'match' count may be higher than it should be. - if (!((IncidentAttachmentLinkAttributes) tmp).unparsed) { - deserialized = tmp; - match++; - } - log.log(Level.FINER, "Input data matches schema 'IncidentAttachmentLinkAttributes'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log( - Level.FINER, "Input data does not match schema 'IncidentAttachmentLinkAttributes'", e); - } - - IncidentAttachmentUpdateAttributes ret = new IncidentAttachmentUpdateAttributes(); - if (match == 1) { - ret.setActualInstance(deserialized); - } else { - Map res = - new ObjectMapper() - .readValue( - tree.traverse(jp.getCodec()).readValueAsTree().toString(), - new TypeReference>() {}); - ret.setActualInstance(new UnparsedObject(res)); - } - return ret; - } - - /** Handle deserialization of the 'null' value. */ - @Override - public IncidentAttachmentUpdateAttributes getNullValue(DeserializationContext ctxt) - throws JsonMappingException { - throw new JsonMappingException( - ctxt.getParser(), "IncidentAttachmentUpdateAttributes cannot be null"); - } - } - - // store a list of schema names defined in oneOf - public static final Map schemas = new HashMap(); - - public IncidentAttachmentUpdateAttributes() { - super("oneOf", Boolean.FALSE); - } - - public IncidentAttachmentUpdateAttributes(IncidentAttachmentPostmortemAttributes o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public IncidentAttachmentUpdateAttributes(IncidentAttachmentLinkAttributes o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put( - "IncidentAttachmentPostmortemAttributes", - new GenericType() {}); - schemas.put( - "IncidentAttachmentLinkAttributes", new GenericType() {}); - JSON.registerDescendants( - IncidentAttachmentUpdateAttributes.class, Collections.unmodifiableMap(schemas)); - } - - @Override - public Map getSchemas() { - return IncidentAttachmentUpdateAttributes.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: IncidentAttachmentPostmortemAttributes, - * IncidentAttachmentLinkAttributes - * - *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a - * composed schema (allOf, anyOf, oneOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSON.isInstanceOf( - IncidentAttachmentPostmortemAttributes.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - if (JSON.isInstanceOf( - IncidentAttachmentLinkAttributes.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - throw new RuntimeException( - "Invalid instance type. Must be IncidentAttachmentPostmortemAttributes," - + " IncidentAttachmentLinkAttributes"); - } - - /** - * Get the actual instance, which can be the following: IncidentAttachmentPostmortemAttributes, - * IncidentAttachmentLinkAttributes - * - * @return The actual instance (IncidentAttachmentPostmortemAttributes, - * IncidentAttachmentLinkAttributes) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `IncidentAttachmentPostmortemAttributes`. If the actual instance is - * not `IncidentAttachmentPostmortemAttributes`, the ClassCastException will be thrown. - * - * @return The actual instance of `IncidentAttachmentPostmortemAttributes` - * @throws ClassCastException if the instance is not `IncidentAttachmentPostmortemAttributes` - */ - public IncidentAttachmentPostmortemAttributes getIncidentAttachmentPostmortemAttributes() - throws ClassCastException { - return (IncidentAttachmentPostmortemAttributes) super.getActualInstance(); - } - - /** - * Get the actual instance of `IncidentAttachmentLinkAttributes`. If the actual instance is not - * `IncidentAttachmentLinkAttributes`, the ClassCastException will be thrown. - * - * @return The actual instance of `IncidentAttachmentLinkAttributes` - * @throws ClassCastException if the instance is not `IncidentAttachmentLinkAttributes` - */ - public IncidentAttachmentLinkAttributes getIncidentAttachmentLinkAttributes() - throws ClassCastException { - return (IncidentAttachmentLinkAttributes) super.getActualInstance(); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentResponseIncludedItem.java b/src/main/java/com/datadog/api/client/v2/model/IncidentResponseIncludedItem.java index 9cee4824c2e..f346d59ab78 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentResponseIncludedItem.java +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentResponseIncludedItem.java @@ -125,49 +125,48 @@ public IncidentResponseIncludedItem deserialize(JsonParser jp, DeserializationCo log.log(Level.FINER, "Input data does not match schema 'IncidentUserData'", e); } - // deserialize IncidentAttachmentData + // deserialize AttachmentData try { boolean attemptParsing = true; // ensure that we respect type coercion as set on the client ObjectMapper - if (IncidentAttachmentData.class.equals(Integer.class) - || IncidentAttachmentData.class.equals(Long.class) - || IncidentAttachmentData.class.equals(Float.class) - || IncidentAttachmentData.class.equals(Double.class) - || IncidentAttachmentData.class.equals(Boolean.class) - || IncidentAttachmentData.class.equals(String.class)) { + if (AttachmentData.class.equals(Integer.class) + || AttachmentData.class.equals(Long.class) + || AttachmentData.class.equals(Float.class) + || AttachmentData.class.equals(Double.class) + || AttachmentData.class.equals(Boolean.class) + || AttachmentData.class.equals(String.class)) { attemptParsing = typeCoercion; if (!attemptParsing) { attemptParsing |= - ((IncidentAttachmentData.class.equals(Integer.class) - || IncidentAttachmentData.class.equals(Long.class)) + ((AttachmentData.class.equals(Integer.class) + || AttachmentData.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= - ((IncidentAttachmentData.class.equals(Float.class) - || IncidentAttachmentData.class.equals(Double.class)) + ((AttachmentData.class.equals(Float.class) + || AttachmentData.class.equals(Double.class)) && (token == JsonToken.VALUE_NUMBER_FLOAT || token == JsonToken.VALUE_NUMBER_INT)); attemptParsing |= - (IncidentAttachmentData.class.equals(Boolean.class) + (AttachmentData.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); attemptParsing |= - (IncidentAttachmentData.class.equals(String.class) - && token == JsonToken.VALUE_STRING); + (AttachmentData.class.equals(String.class) && token == JsonToken.VALUE_STRING); } } if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(IncidentAttachmentData.class); + tmp = tree.traverse(jp.getCodec()).readValueAs(AttachmentData.class); // TODO: there is no validation against JSON schema constraints // (min, max, enum, pattern...), this does not perform a strict JSON // validation, which means the 'match' count may be higher than it should be. - if (!((IncidentAttachmentData) tmp).unparsed) { + if (!((AttachmentData) tmp).unparsed) { deserialized = tmp; match++; } - log.log(Level.FINER, "Input data matches schema 'IncidentAttachmentData'"); + log.log(Level.FINER, "Input data matches schema 'AttachmentData'"); } } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'IncidentAttachmentData'", e); + log.log(Level.FINER, "Input data does not match schema 'AttachmentData'", e); } IncidentResponseIncludedItem ret = new IncidentResponseIncludedItem(); @@ -205,14 +204,14 @@ public IncidentResponseIncludedItem(IncidentUserData o) { setActualInstance(o); } - public IncidentResponseIncludedItem(IncidentAttachmentData o) { + public IncidentResponseIncludedItem(AttachmentData o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { schemas.put("IncidentUserData", new GenericType() {}); - schemas.put("IncidentAttachmentData", new GenericType() {}); + schemas.put("AttachmentData", new GenericType() {}); JSON.registerDescendants( IncidentResponseIncludedItem.class, Collections.unmodifiableMap(schemas)); } @@ -224,7 +223,7 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: IncidentUserData, IncidentAttachmentData + * against the oneOf child schemas: IncidentUserData, AttachmentData * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -235,7 +234,7 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } - if (JSON.isInstanceOf(IncidentAttachmentData.class, instance, new HashSet>())) { + if (JSON.isInstanceOf(AttachmentData.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } @@ -244,14 +243,13 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } - throw new RuntimeException( - "Invalid instance type. Must be IncidentUserData, IncidentAttachmentData"); + throw new RuntimeException("Invalid instance type. Must be IncidentUserData, AttachmentData"); } /** - * Get the actual instance, which can be the following: IncidentUserData, IncidentAttachmentData + * Get the actual instance, which can be the following: IncidentUserData, AttachmentData * - * @return The actual instance (IncidentUserData, IncidentAttachmentData) + * @return The actual instance (IncidentUserData, AttachmentData) */ @Override public Object getActualInstance() { @@ -270,13 +268,13 @@ public IncidentUserData getIncidentUserData() throws ClassCastException { } /** - * Get the actual instance of `IncidentAttachmentData`. If the actual instance is not - * `IncidentAttachmentData`, the ClassCastException will be thrown. + * Get the actual instance of `AttachmentData`. If the actual instance is not `AttachmentData`, + * the ClassCastException will be thrown. * - * @return The actual instance of `IncidentAttachmentData` - * @throws ClassCastException if the instance is not `IncidentAttachmentData` + * @return The actual instance of `AttachmentData` + * @throws ClassCastException if the instance is not `AttachmentData` */ - public IncidentAttachmentData getIncidentAttachmentData() throws ClassCastException { - return (IncidentAttachmentData) super.getActualInstance(); + public AttachmentData getAttachmentData() throws ClassCastException { + return (AttachmentData) super.getActualInstance(); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequest.java b/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequest.java new file mode 100644 index 00000000000..f3a2bede1a0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequest.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({PatchAttachmentRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PatchAttachmentRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private PatchAttachmentRequestData data; + + public PatchAttachmentRequest data(PatchAttachmentRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PatchAttachmentRequestData getData() { + return data; + } + + public void setData(PatchAttachmentRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PatchAttachmentRequest + */ + @JsonAnySetter + public PatchAttachmentRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PatchAttachmentRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchAttachmentRequest patchAttachmentRequest = (PatchAttachmentRequest) o; + return Objects.equals(this.data, patchAttachmentRequest.data) + && Objects.equals(this.additionalProperties, patchAttachmentRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchAttachmentRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestData.java b/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestData.java new file mode 100644 index 00000000000..829833421d5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestData.java @@ -0,0 +1,206 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + PatchAttachmentRequestData.JSON_PROPERTY_ATTRIBUTES, + PatchAttachmentRequestData.JSON_PROPERTY_ID, + PatchAttachmentRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PatchAttachmentRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private PatchAttachmentRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentAttachmentType type = IncidentAttachmentType.INCIDENT_ATTACHMENTS; + + public PatchAttachmentRequestData() {} + + @JsonCreator + public PatchAttachmentRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentAttachmentType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public PatchAttachmentRequestData attributes(PatchAttachmentRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PatchAttachmentRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(PatchAttachmentRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public PatchAttachmentRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Getid + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public PatchAttachmentRequestData type(IncidentAttachmentType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The incident attachment resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentAttachmentType getType() { + return type; + } + + public void setType(IncidentAttachmentType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PatchAttachmentRequestData + */ + @JsonAnySetter + public PatchAttachmentRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PatchAttachmentRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchAttachmentRequestData patchAttachmentRequestData = (PatchAttachmentRequestData) o; + return Objects.equals(this.attributes, patchAttachmentRequestData.attributes) + && Objects.equals(this.id, patchAttachmentRequestData.id) + && Objects.equals(this.type, patchAttachmentRequestData.type) + && Objects.equals( + this.additionalProperties, patchAttachmentRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchAttachmentRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestDataAttributes.java new file mode 100644 index 00000000000..06ddb466832 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestDataAttributes.java @@ -0,0 +1,139 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({PatchAttachmentRequestDataAttributes.JSON_PROPERTY_ATTACHMENT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PatchAttachmentRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTACHMENT = "attachment"; + private PatchAttachmentRequestDataAttributesAttachment attachment; + + public PatchAttachmentRequestDataAttributes attachment( + PatchAttachmentRequestDataAttributesAttachment attachment) { + this.attachment = attachment; + this.unparsed |= attachment.unparsed; + return this; + } + + /** + * Getattachment + * + * @return attachment + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTACHMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public PatchAttachmentRequestDataAttributesAttachment getAttachment() { + return attachment; + } + + public void setAttachment(PatchAttachmentRequestDataAttributesAttachment attachment) { + this.attachment = attachment; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PatchAttachmentRequestDataAttributes + */ + @JsonAnySetter + public PatchAttachmentRequestDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PatchAttachmentRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchAttachmentRequestDataAttributes patchAttachmentRequestDataAttributes = + (PatchAttachmentRequestDataAttributes) o; + return Objects.equals(this.attachment, patchAttachmentRequestDataAttributes.attachment) + && Objects.equals( + this.additionalProperties, patchAttachmentRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attachment, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchAttachmentRequestDataAttributes {\n"); + sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsPostmortemAttributesAttachmentObject.java b/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestDataAttributesAttachment.java similarity index 67% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsPostmortemAttributesAttachmentObject.java rename to src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestDataAttributesAttachment.java index 8664a3bf260..4feeb8244be 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentsPostmortemAttributesAttachmentObject.java +++ b/src/main/java/com/datadog/api/client/v2/model/PatchAttachmentRequestDataAttributesAttachment.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,14 +16,14 @@ import java.util.Map; import java.util.Objects; -/** The postmortem attachment. */ +/** */ @JsonPropertyOrder({ - IncidentAttachmentsPostmortemAttributesAttachmentObject.JSON_PROPERTY_DOCUMENT_URL, - IncidentAttachmentsPostmortemAttributesAttachmentObject.JSON_PROPERTY_TITLE + PatchAttachmentRequestDataAttributesAttachment.JSON_PROPERTY_DOCUMENT_URL, + PatchAttachmentRequestDataAttributesAttachment.JSON_PROPERTY_TITLE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class IncidentAttachmentsPostmortemAttributesAttachmentObject { +public class PatchAttachmentRequestDataAttributesAttachment { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DOCUMENT_URL = "documentUrl"; private String documentUrl; @@ -32,28 +31,19 @@ public class IncidentAttachmentsPostmortemAttributesAttachmentObject { public static final String JSON_PROPERTY_TITLE = "title"; private String title; - public IncidentAttachmentsPostmortemAttributesAttachmentObject() {} - - @JsonCreator - public IncidentAttachmentsPostmortemAttributesAttachmentObject( - @JsonProperty(required = true, value = JSON_PROPERTY_DOCUMENT_URL) String documentUrl, - @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { - this.documentUrl = documentUrl; - this.title = title; - } - - public IncidentAttachmentsPostmortemAttributesAttachmentObject documentUrl(String documentUrl) { + public PatchAttachmentRequestDataAttributesAttachment documentUrl(String documentUrl) { this.documentUrl = documentUrl; return this; } /** - * The URL of this notebook attachment. + * GetdocumentUrl * * @return documentUrl */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DOCUMENT_URL) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getDocumentUrl() { return documentUrl; } @@ -62,18 +52,19 @@ public void setDocumentUrl(String documentUrl) { this.documentUrl = documentUrl; } - public IncidentAttachmentsPostmortemAttributesAttachmentObject title(String title) { + public PatchAttachmentRequestDataAttributesAttachment title(String title) { this.title = title; return this; } /** - * The title of this postmortem attachment. + * Gettitle * * @return title */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TITLE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getTitle() { return title; } @@ -94,10 +85,10 @@ public void setTitle(String title) { * * @param key The arbitrary key to set * @param value The associated value - * @return IncidentAttachmentsPostmortemAttributesAttachmentObject + * @return PatchAttachmentRequestDataAttributesAttachment */ @JsonAnySetter - public IncidentAttachmentsPostmortemAttributesAttachmentObject putAdditionalProperty( + public PatchAttachmentRequestDataAttributesAttachment putAdditionalProperty( String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); @@ -129,10 +120,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** - * Return true if this IncidentAttachmentsPostmortemAttributesAttachmentObject object is equal to - * o. - */ + /** Return true if this PatchAttachmentRequestDataAttributesAttachment object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -141,15 +129,14 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IncidentAttachmentsPostmortemAttributesAttachmentObject - incidentAttachmentsPostmortemAttributesAttachmentObject = - (IncidentAttachmentsPostmortemAttributesAttachmentObject) o; + PatchAttachmentRequestDataAttributesAttachment patchAttachmentRequestDataAttributesAttachment = + (PatchAttachmentRequestDataAttributesAttachment) o; return Objects.equals( - this.documentUrl, incidentAttachmentsPostmortemAttributesAttachmentObject.documentUrl) - && Objects.equals(this.title, incidentAttachmentsPostmortemAttributesAttachmentObject.title) + this.documentUrl, patchAttachmentRequestDataAttributesAttachment.documentUrl) + && Objects.equals(this.title, patchAttachmentRequestDataAttributesAttachment.title) && Objects.equals( this.additionalProperties, - incidentAttachmentsPostmortemAttributesAttachmentObject.additionalProperties); + patchAttachmentRequestDataAttributesAttachment.additionalProperties); } @Override @@ -160,7 +147,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IncidentAttachmentsPostmortemAttributesAttachmentObject {\n"); + sb.append("class PatchAttachmentRequestDataAttributesAttachment {\n"); sb.append(" documentUrl: ").append(toIndentedString(documentUrl)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/User140420082644000.java b/src/main/java/com/datadog/api/client/v2/model/User140420082644000.java new file mode 100644 index 00000000000..a596d2640f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/User140420082644000.java @@ -0,0 +1,205 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + User140420082644000.JSON_PROPERTY_ATTRIBUTES, + User140420082644000.JSON_PROPERTY_ID, + User140420082644000.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class User140420082644000 { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UserAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UserType type = UserType.USERS; + + public User140420082644000() {} + + @JsonCreator + public User140420082644000( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UserType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public User140420082644000 attributes(UserAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of user object returned by the API. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UserAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UserAttributes attributes) { + this.attributes = attributes; + } + + public User140420082644000 id(String id) { + this.id = id; + return this; + } + + /** + * Getid + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public User140420082644000 type(UserType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Users resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UserType getType() { + return type; + } + + public void setType(UserType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return User140420082644000 + */ + @JsonAnySetter + public User140420082644000 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this User140420082644000 object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User140420082644000 user140420082644000 = (User140420082644000) o; + return Objects.equals(this.attributes, user140420082644000.attributes) + && Objects.equals(this.id, user140420082644000.id) + && Objects.equals(this.type, user140420082644000.type) + && Objects.equals(this.additionalProperties, user140420082644000.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User140420082644000 {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentRelatedObject.java b/src/main/java/com/datadog/api/client/v2/model/UserType.java similarity index 53% rename from src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentRelatedObject.java rename to src/main/java/com/datadog/api/client/v2/model/UserType.java index 7ffb7720296..63592491c8d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentAttachmentRelatedObject.java +++ b/src/main/java/com/datadog/api/client/v2/model/UserType.java @@ -18,40 +18,36 @@ import java.util.HashSet; import java.util.Set; -/** The object related to an incident attachment. */ -@JsonSerialize( - using = IncidentAttachmentRelatedObject.IncidentAttachmentRelatedObjectSerializer.class) -public class IncidentAttachmentRelatedObject extends ModelEnum { +/** Users resource type. */ +@JsonSerialize(using = UserType.UserTypeSerializer.class) +public class UserType extends ModelEnum { private static final Set allowedValues = new HashSet(Arrays.asList("users")); - public static final IncidentAttachmentRelatedObject USERS = - new IncidentAttachmentRelatedObject("users"); + public static final UserType USERS = new UserType("users"); - IncidentAttachmentRelatedObject(String value) { + UserType(String value) { super(value, allowedValues); } - public static class IncidentAttachmentRelatedObjectSerializer - extends StdSerializer { - public IncidentAttachmentRelatedObjectSerializer(Class t) { + public static class UserTypeSerializer extends StdSerializer { + public UserTypeSerializer(Class t) { super(t); } - public IncidentAttachmentRelatedObjectSerializer() { + public UserTypeSerializer() { this(null); } @Override - public void serialize( - IncidentAttachmentRelatedObject value, JsonGenerator jgen, SerializerProvider provider) + public void serialize(UserType value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeObject(value.value); } } @JsonCreator - public static IncidentAttachmentRelatedObject fromValue(String value) { - return new IncidentAttachmentRelatedObject(value); + public static UserType fromValue(String value) { + return new UserType(value); } } diff --git a/src/test/resources/cassettes/features/v2/Create_an_incident_attachment_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_an_incident_attachment_returns_OK_response.freeze deleted file mode 100644 index a19a831fa75..00000000000 --- a/src/test/resources/cassettes/features/v2/Create_an_incident_attachment_returns_OK_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2024-11-04T19:02:17.223Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_incident_attachment_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_an_incident_attachment_returns_OK_response.json deleted file mode 100644 index b44d90a96ed..00000000000 --- a/src/test/resources/cassettes/features/v2/Create_an_incident_attachment_returns_OK_response.json +++ /dev/null @@ -1,87 +0,0 @@ -[ - { - "httpRequest": { - "body": { - "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"customer_impacted\":false,\"title\":\"Test-Create_an_incident_attachment_returns_OK_response-1730746937\"},\"type\":\"incidents\"}}" - }, - "headers": {}, - "method": "POST", - "path": "/api/v2/incidents", - "keepAlive": false, - "secure": true - }, - "httpResponse": { - "body": "{\"data\":{\"type\":\"incidents\",\"id\":\"de4affc2-0412-5ed3-9d20-7f71b21ad305\",\"attributes\":{\"public_id\":250835,\"incident_type_uuid\":\"41d2e10b-4108-4736-92d7-791d00ea0702\",\"title\":\"Test-Create_an_incident_attachment_returns_OK_response-1730746937\",\"resolved\":null,\"customer_impact_scope\":null,\"customer_impact_start\":null,\"customer_impact_end\":null,\"customer_impacted\":false,\"notification_handles\":null,\"last_modified_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":null,\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"last_modified_by_uuid\":null,\"created\":\"2024-11-04T19:02:17.394588+00:00\",\"modified\":\"2024-11-04T19:02:17.394588+00:00\",\"commander\":null,\"detected\":\"2024-11-04T19:02:17.385480+00:00\",\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":null,\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"created_by_uuid\":null,\"creation_idempotency_key\":null,\"customer_impact_duration\":0,\"time_to_detect\":0,\"time_to_repair\":0,\"time_to_internal_response\":0,\"time_to_resolve\":0,\"archived\":null,\"fields\":{\"severity\":{\"type\":\"dropdown\",\"value\":\"UNKNOWN\"},\"state\":{\"type\":\"dropdown\",\"value\":\"active\"},\"detection_method\":{\"type\":\"dropdown\",\"value\":\"unknown\"},\"root_cause\":{\"type\":\"textbox\",\"value\":null},\"summary\":{\"type\":\"textbox\",\"value\":null},\"services\":{\"type\":\"autocomplete\",\"value\":null},\"teams\":{\"type\":\"autocomplete\",\"value\":null}},\"field_analytics\":null,\"severity\":\"UNKNOWN\",\"state\":\"active\",\"non_datadog_creator\":null,\"visibility\":\"organization\",\"case_id\":null},\"relationships\":{\"created_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"last_modified_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"commander_user\":{\"data\":null},\"user_defined_fields\":{\"data\":[{\"type\":\"user_defined_field\",\"id\":\"33457d2a-570c-5567-b4af-979a2a8f1164\"},{\"type\":\"user_defined_field\",\"id\":\"d003693c-bee9-5420-8d46-859269c20914\"},{\"type\":\"user_defined_field\",\"id\":\"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d\"},{\"type\":\"user_defined_field\",\"id\":\"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf\"},{\"type\":\"user_defined_field\",\"id\":\"95c53547-2ba3-5d8a-9c3b-cf245bc0c629\"},{\"type\":\"user_defined_field\",\"id\":\"39044b03-cee4-555f-b1e0-3eb3aa759a86\"},{\"type\":\"user_defined_field\",\"id\":\"3cbe9e60-d794-532c-acc0-73641f782813\"}]},\"integrations\":{\"data\":[]},\"attachments\":{\"data\":[]},\"responders\":{\"data\":[]},\"impacts\":{\"data\":[]}}}}\n", - "headers": { - "Content-Type": [ - "application/json" - ] - }, - "statusCode": 201, - "reasonPhrase": "Created" - }, - "times": { - "remainingTimes": 1 - }, - "timeToLive": { - "unlimited": true - }, - "id": "dfccd09f-3ff9-e07b-e2af-7fcf55f38a84" - }, - { - "httpRequest": { - "body": { - "type": "JSON", - "json": "{\"data\":[{\"attributes\":{\"attachment\":{\"documentUrl\":\"https://www.example.com/doc\",\"title\":\"Test-Create_an_incident_attachment_returns_OK_response-1730746937\"},\"attachment_type\":\"link\"},\"type\":\"incident_attachments\"}]}" - }, - "headers": {}, - "method": "PATCH", - "path": "/api/v2/incidents/de4affc2-0412-5ed3-9d20-7f71b21ad305/attachments", - "keepAlive": false, - "secure": true - }, - "httpResponse": { - "body": "{\"data\":[{\"type\":\"incident_attachments\",\"id\":\"233c12d5-547a-5638-97e6-6c9d1c456cb7\",\"attributes\":{\"modified\":\"2024-11-04T19:02:17.844501+00:00\",\"attachment_type\":\"link\",\"attachment\":{\"title\":\"Test-Create_an_incident_attachment_returns_OK_response-1730746937\",\"documentUrl\":\"https://www.example.com/doc\"}},\"relationships\":{\"last_modified_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}}]}\n", - "headers": { - "Content-Type": [ - "application/json" - ] - }, - "statusCode": 200, - "reasonPhrase": "OK" - }, - "times": { - "remainingTimes": 1 - }, - "timeToLive": { - "unlimited": true - }, - "id": "aef14cc6-d409-508a-216c-43485fb8c65b" - }, - { - "httpRequest": { - "headers": {}, - "method": "DELETE", - "path": "/api/v2/incidents/de4affc2-0412-5ed3-9d20-7f71b21ad305", - "keepAlive": false, - "secure": true - }, - "httpResponse": { - "headers": { - "Content-Type": [ - "text/html; charset=utf-8" - ] - }, - "statusCode": 204, - "reasonPhrase": "No Content" - }, - "times": { - "remainingTimes": 1 - }, - "timeToLive": { - "unlimited": true - }, - "id": "a8aeb3d2-7606-e74a-5462-ae9545953f54" - } -] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_incident_attachments_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_incident_attachments_returns_OK_response.freeze deleted file mode 100644 index 65913c025d9..00000000000 --- a/src/test/resources/cassettes/features/v2/Get_incident_attachments_returns_OK_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2024-11-04T19:02:25.584Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_incident_attachments_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_incident_attachments_returns_OK_response.json deleted file mode 100644 index 9d4731db75a..00000000000 --- a/src/test/resources/cassettes/features/v2/Get_incident_attachments_returns_OK_response.json +++ /dev/null @@ -1,113 +0,0 @@ -[ - { - "httpRequest": { - "body": { - "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"customer_impacted\":false,\"title\":\"Test-Get_incident_attachments_returns_OK_response-1730746945\"},\"type\":\"incidents\"}}" - }, - "headers": {}, - "method": "POST", - "path": "/api/v2/incidents", - "keepAlive": false, - "secure": true - }, - "httpResponse": { - "body": "{\"data\":{\"type\":\"incidents\",\"id\":\"1512832c-c4e5-569d-a970-d4797f22745a\",\"attributes\":{\"public_id\":250842,\"incident_type_uuid\":\"41d2e10b-4108-4736-92d7-791d00ea0702\",\"title\":\"Test-Get_incident_attachments_returns_OK_response-1730746945\",\"resolved\":null,\"customer_impact_scope\":null,\"customer_impact_start\":null,\"customer_impact_end\":null,\"customer_impacted\":false,\"notification_handles\":null,\"last_modified_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":null,\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"last_modified_by_uuid\":null,\"created\":\"2024-11-04T19:02:25.768523+00:00\",\"modified\":\"2024-11-04T19:02:25.768523+00:00\",\"commander\":null,\"detected\":\"2024-11-04T19:02:25.756116+00:00\",\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":null,\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"created_by_uuid\":null,\"creation_idempotency_key\":null,\"customer_impact_duration\":0,\"time_to_detect\":0,\"time_to_repair\":0,\"time_to_internal_response\":0,\"time_to_resolve\":0,\"archived\":null,\"fields\":{\"severity\":{\"type\":\"dropdown\",\"value\":\"UNKNOWN\"},\"state\":{\"type\":\"dropdown\",\"value\":\"active\"},\"detection_method\":{\"type\":\"dropdown\",\"value\":\"unknown\"},\"root_cause\":{\"type\":\"textbox\",\"value\":null},\"summary\":{\"type\":\"textbox\",\"value\":null},\"services\":{\"type\":\"autocomplete\",\"value\":null},\"teams\":{\"type\":\"autocomplete\",\"value\":null}},\"field_analytics\":null,\"severity\":\"UNKNOWN\",\"state\":\"active\",\"non_datadog_creator\":null,\"visibility\":\"organization\",\"case_id\":null},\"relationships\":{\"created_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"last_modified_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"commander_user\":{\"data\":null},\"user_defined_fields\":{\"data\":[{\"type\":\"user_defined_field\",\"id\":\"33457d2a-570c-5567-b4af-979a2a8f1164\"},{\"type\":\"user_defined_field\",\"id\":\"d003693c-bee9-5420-8d46-859269c20914\"},{\"type\":\"user_defined_field\",\"id\":\"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d\"},{\"type\":\"user_defined_field\",\"id\":\"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf\"},{\"type\":\"user_defined_field\",\"id\":\"95c53547-2ba3-5d8a-9c3b-cf245bc0c629\"},{\"type\":\"user_defined_field\",\"id\":\"39044b03-cee4-555f-b1e0-3eb3aa759a86\"},{\"type\":\"user_defined_field\",\"id\":\"3cbe9e60-d794-532c-acc0-73641f782813\"}]},\"integrations\":{\"data\":[]},\"attachments\":{\"data\":[]},\"responders\":{\"data\":[]},\"impacts\":{\"data\":[]}}}}\n", - "headers": { - "Content-Type": [ - "application/json" - ] - }, - "statusCode": 201, - "reasonPhrase": "Created" - }, - "times": { - "remainingTimes": 1 - }, - "timeToLive": { - "unlimited": true - }, - "id": "be8f6407-3336-0570-f889-c1583e162302" - }, - { - "httpRequest": { - "body": { - "type": "JSON", - "json": "{\"data\":[{\"attributes\":{\"attachment\":{\"documentUrl\":\"https://www.example.com/doc\",\"title\":\"Important Doc\"},\"attachment_type\":\"link\"},\"type\":\"incident_attachments\"}]}" - }, - "headers": {}, - "method": "PATCH", - "path": "/api/v2/incidents/1512832c-c4e5-569d-a970-d4797f22745a/attachments", - "keepAlive": false, - "secure": true - }, - "httpResponse": { - "body": "{\"data\":[{\"type\":\"incident_attachments\",\"id\":\"ad6ccc2d-9653-5824-be41-729d3f49a153\",\"attributes\":{\"modified\":\"2024-11-04T19:02:26.146487+00:00\",\"attachment_type\":\"link\",\"attachment\":{\"title\":\"Important Doc\",\"documentUrl\":\"https://www.example.com/doc\"}},\"relationships\":{\"last_modified_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}}]}\n", - "headers": { - "Content-Type": [ - "application/json" - ] - }, - "statusCode": 200, - "reasonPhrase": "OK" - }, - "times": { - "remainingTimes": 1 - }, - "timeToLive": { - "unlimited": true - }, - "id": "00a0474c-4f07-c4dd-45ab-b0fa8ca2551a" - }, - { - "httpRequest": { - "headers": {}, - "method": "GET", - "path": "/api/v2/incidents/1512832c-c4e5-569d-a970-d4797f22745a/attachments", - "keepAlive": false, - "secure": true - }, - "httpResponse": { - "body": "{\"data\":[{\"type\":\"incident_attachments\",\"id\":\"ad6ccc2d-9653-5824-be41-729d3f49a153\",\"attributes\":{\"modified\":\"2024-11-04T19:02:26.146487+00:00\",\"attachment_type\":\"link\",\"attachment\":{\"title\":\"Important Doc\",\"documentUrl\":\"https://www.example.com/doc\"}},\"relationships\":{\"last_modified_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}}]}\n", - "headers": { - "Content-Type": [ - "application/json" - ] - }, - "statusCode": 200, - "reasonPhrase": "OK" - }, - "times": { - "remainingTimes": 1 - }, - "timeToLive": { - "unlimited": true - }, - "id": "9a2f0a3f-6f7f-8ce7-947c-2bc0264c8ff8" - }, - { - "httpRequest": { - "headers": {}, - "method": "DELETE", - "path": "/api/v2/incidents/1512832c-c4e5-569d-a970-d4797f22745a", - "keepAlive": false, - "secure": true - }, - "httpResponse": { - "headers": { - "Content-Type": [ - "text/html; charset=utf-8" - ] - }, - "statusCode": 204, - "reasonPhrase": "No Content" - }, - "times": { - "remainingTimes": 1 - }, - "timeToLive": { - "unlimited": true - }, - "id": "3e5023a0-1b75-523a-5b17-a8b3fa8855db" - } -] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 7725798de44..fb9342c625f 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -447,22 +447,6 @@ "tag": "Incidents", "operationId": "CreateIncidentType" }, - { - "parameters": [ - { - "name": "incident_id", - "source": "incident.data.id" - }, - { - "name": "body", - "value": "{\n \"data\": [\n {\n \"attributes\": {\n \"attachment_type\": \"link\",\n \"attachment\": {\n \"documentUrl\": \"https://www.example.com/doc\",\n \"title\": \"Important Doc\"\n }\n },\n \"type\": \"incident_attachments\"\n }\n ]\n}" - } - ], - "step": "the \"incident\" has an \"incident_attachment\"", - "key": "incident_attachment", - "tag": "Incidents", - "operationId": "UpdateIncidentAttachments" - }, { "operationId": "CreateIncidentImpact", "parameters": [ diff --git a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature b/src/test/resources/com/datadog/api/client/v2/api/incidents.feature index 74ae965968f..5d6ad987a4e 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/incidents.feature @@ -21,20 +21,6 @@ Feature: Incidents When the request is sent Then the response status is 200 OK - @team:DataDog/incident-app - Scenario: Create an incident attachment returns "OK" response - Given operation "UpdateIncidentAttachments" enabled - And there is a valid "incident" in the system - And new "UpdateIncidentAttachments" request - And request contains "incident_id" parameter from "incident.data.id" - And body with value {"data": [{"type": "incident_attachments", "attributes": {"attachment_type": "link", "attachment": {"documentUrl": "https://www.example.com/doc", "title": "{{unique}}"}}}]} - When the request is sent - Then the response status is 200 OK - And the response "data" has length 1 - And the response "data[0].type" is equal to "incident_attachments" - And the response "data[0].attributes.attachment_type" is equal to "link" - And the response "data[0].attributes.attachment.documentUrl" is equal to "https://www.example.com/doc" - @skip @team:DataDog/incident-app Scenario: Create an incident impact returns "Bad Request" response Given operation "CreateIncidentImpact" enabled @@ -200,6 +186,24 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app + Scenario: Create incident attachment returns "Bad Request" response + Given operation "CreateIncidentAttachment" enabled + And new "CreateIncidentAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"attachment": {"documentUrl": "https://app.datadoghq.com/notebook/123/Postmortem-IR-123", "title": "Postmortem-IR-123"}, "attachment_type": "postmortem"}, "id": "00000000-0000-0000-0000-000000000000", "type": "incident_attachments"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create incident attachment returns "Created" response + Given operation "CreateIncidentAttachment" enabled + And new "CreateIncidentAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"attachment": {"documentUrl": "https://app.datadoghq.com/notebook/123/Postmortem-IR-123", "title": "Postmortem-IR-123"}, "attachment_type": "postmortem"}, "id": "00000000-0000-0000-0000-000000000000", "type": "incident_attachments"}} + When the request is sent + Then the response status is 201 Created + @team:Datadog/incident-app Scenario: Create incident notification rule returns "Bad Request" response Given operation "CreateIncidentNotificationRule" enabled @@ -249,33 +253,6 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/incident-app - Scenario: Create, update, and delete incident attachments returns "Bad Request" response - Given operation "UpdateIncidentAttachments" enabled - And new "UpdateIncidentAttachments" request - And request contains "incident_id" parameter from "REPLACE.ME" - And body with value {"data": [{"attributes": {"attachment": {"documentUrl": "https://app.datadoghq.com/notebook/123", "title": "Postmortem IR-123"}, "attachment_type": "postmortem"}, "id": "00000000-abcd-0002-0000-000000000000", "type": "incident_attachments"}, {"attributes": {"attachment": {"documentUrl": "https://www.example.com/webstore-failure-runbook", "title": "Runbook for webstore service failures"}, "attachment_type": "link"}, "type": "incident_attachments"}, {"id": "00000000-abcd-0003-0000-000000000000", "type": "incident_attachments"}]} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/incident-app - Scenario: Create, update, and delete incident attachments returns "Not Found" response - Given operation "UpdateIncidentAttachments" enabled - And new "UpdateIncidentAttachments" request - And request contains "incident_id" parameter from "REPLACE.ME" - And body with value {"data": [{"attributes": {"attachment": {"documentUrl": "https://app.datadoghq.com/notebook/123", "title": "Postmortem IR-123"}, "attachment_type": "postmortem"}, "id": "00000000-abcd-0002-0000-000000000000", "type": "incident_attachments"}, {"attributes": {"attachment": {"documentUrl": "https://www.example.com/webstore-failure-runbook", "title": "Runbook for webstore service failures"}, "attachment_type": "link"}, "type": "incident_attachments"}, {"id": "00000000-abcd-0003-0000-000000000000", "type": "incident_attachments"}]} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/incident-app - Scenario: Create, update, and delete incident attachments returns "OK" response - Given operation "UpdateIncidentAttachments" enabled - And new "UpdateIncidentAttachments" request - And request contains "incident_id" parameter from "REPLACE.ME" - And body with value {"data": [{"attributes": {"attachment": {"documentUrl": "https://app.datadoghq.com/notebook/123", "title": "Postmortem IR-123"}, "attachment_type": "postmortem"}, "id": "00000000-abcd-0002-0000-000000000000", "type": "incident_attachments"}, {"attributes": {"attachment": {"documentUrl": "https://www.example.com/webstore-failure-runbook", "title": "Runbook for webstore service failures"}, "attachment_type": "link"}, "type": "incident_attachments"}, {"id": "00000000-abcd-0003-0000-000000000000", "type": "incident_attachments"}]} - When the request is sent - Then the response status is 200 OK - @generated @skip @team:Datadog/incident-app Scenario: Delete a notification template returns "Bad Request" response Given operation "DeleteIncidentNotificationTemplate" enabled @@ -452,6 +429,33 @@ Feature: Incidents When the request is sent Then the response status is 204 OK + @generated @skip @team:DataDog/incident-app + Scenario: Delete incident attachment returns "Bad Request" response + Given operation "DeleteIncidentAttachment" enabled + And new "DeleteIncidentAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "attachment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Delete incident attachment returns "No Content" response + Given operation "DeleteIncidentAttachment" enabled + And new "DeleteIncidentAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "attachment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/incident-app + Scenario: Delete incident attachment returns "Not Found" response + Given operation "DeleteIncidentAttachment" enabled + And new "DeleteIncidentAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "attachment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @team:Datadog/incident-app Scenario: Delete incident notification rule returns "No Content" response Given there is a valid "incident_type" in the system @@ -536,30 +540,6 @@ Feature: Incidents And the response "data[0].attributes.assignees" has length 2 And the response "data[0].attributes.content" is equal to "Follow up with customer about the impact they saw." - @generated @skip @team:DataDog/incident-app - Scenario: Get a list of attachments returns "Bad Request" response - Given operation "ListIncidentAttachments" enabled - And new "ListIncidentAttachments" request - And request contains "incident_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/incident-app - Scenario: Get a list of attachments returns "Not Found" response - Given operation "ListIncidentAttachments" enabled - And new "ListIncidentAttachments" request - And request contains "incident_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/incident-app - Scenario: Get a list of attachments returns "OK" response - Given operation "ListIncidentAttachments" enabled - And new "ListIncidentAttachments" request - And request contains "incident_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - @generated @skip @team:Datadog/incident-app Scenario: Get a list of incident types returns "Bad Request" response Given operation "ListIncidentTypes" enabled @@ -630,20 +610,6 @@ Feature: Incidents When the request is sent Then the response status is 200 OK - @team:DataDog/incident-app - Scenario: Get incident attachments returns "OK" response - Given operation "ListIncidentAttachments" enabled - And there is a valid "incident" in the system - And the "incident" has an "incident_attachment" - And new "ListIncidentAttachments" request - And request contains "incident_id" parameter from "incident.data.id" - When the request is sent - Then the response status is 200 OK - And the response "data" has length 1 - And the response "data[0].type" is equal to "incident_attachments" - And the response "data[0].attributes.attachment_type" is equal to "link" - And the response "data[0].attributes.attachment.documentUrl" is equal to "https://www.example.com/doc" - @generated @skip @team:DataDog/incident-app Scenario: Get incident integration metadata details returns "Bad Request" response Given operation "GetIncidentIntegration" enabled @@ -829,6 +795,22 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: List incident attachments returns "Bad Request" response + Given operation "ListIncidentAttachments" enabled + And new "ListIncidentAttachments" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: List incident attachments returns "OK" response + Given operation "ListIncidentAttachments" enabled + And new "ListIncidentAttachments" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/incident-app Scenario: List incident notification rules returns "Bad Request" response Given operation "ListIncidentNotificationRules" enabled @@ -1075,6 +1057,36 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Update incident attachment returns "Bad Request" response + Given operation "UpdateIncidentAttachment" enabled + And new "UpdateIncidentAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "attachment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"attachment": {"documentUrl": "https://app.datadoghq.com/notebook/124/Postmortem-IR-124", "title": "Postmortem-IR-124"}}, "type": "incident_attachments"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update incident attachment returns "Not Found" response + Given operation "UpdateIncidentAttachment" enabled + And new "UpdateIncidentAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "attachment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"attachment": {"documentUrl": "https://app.datadoghq.com/notebook/124/Postmortem-IR-124", "title": "Postmortem-IR-124"}}, "type": "incident_attachments"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Update incident attachment returns "OK" response + Given operation "UpdateIncidentAttachment" enabled + And new "UpdateIncidentAttachment" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "attachment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"attachment": {"documentUrl": "https://app.datadoghq.com/notebook/124/Postmortem-IR-124", "title": "Postmortem-IR-124"}}, "type": "incident_attachments"}} + When the request is sent + Then the response status is 200 OK + @team:Datadog/incident-app Scenario: Update incident notification rule returns "Bad Request" response Given operation "UpdateIncidentNotificationRule" enabled diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 4d590026bd7..45e76d0dc31 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -1711,7 +1711,30 @@ "type": "safe" } }, - "UpdateIncidentAttachments": { + "CreateIncidentAttachment": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentAttachment", + "parameters": [ + { + "name": "incident_id", + "source": "" + }, + { + "name": "attachment_id", + "source": "" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentAttachment": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "UpdateIncidentAttachment": { "tag": "Incidents", "undo": { "type": "idempotent"