diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index cfbcb7286ac..5fbf15ba4f6 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. @@ -12894,6 +13001,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: @@ -25665,126 +25811,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. @@ -25794,142 +25820,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: @@ -27200,7 +27090,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: @@ -40203,6 +40093,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: @@ -56984,6 +56909,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: @@ -57434,6 +57370,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: @@ -68712,8 +68657,7 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - incident_notification_settings_read + - AuthZ: [] summary: List incident notification rules tags: - Incidents @@ -68912,8 +68856,7 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - incident_settings_read + - AuthZ: [] summary: List incident notification templates tags: - Incidents @@ -69028,7 +68971,8 @@ paths: - apiKeyAuth: [] appKeyAuth: [] - AuthZ: - - incident_settings_read + - incident_read + - incident_write summary: Get incident notification template tags: - Incidents @@ -69118,6 +69062,7 @@ paths: x-permission: operator: OR permissions: + - incident_settings_read - incident_read x-unstable: '**Note**: This endpoint is in public beta. @@ -69159,7 +69104,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. @@ -69449,80 +69394,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/cassettes/features/v2/incidents/Create-an-incident-attachment-returns-OK-response.frozen b/cassettes/features/v2/incidents/Create-an-incident-attachment-returns-OK-response.frozen deleted file mode 100644 index a19a831fa75..00000000000 --- a/cassettes/features/v2/incidents/Create-an-incident-attachment-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-11-04T19:02:17.223Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Create-an-incident-attachment-returns-OK-response.yml b/cassettes/features/v2/incidents/Create-an-incident-attachment-returns-OK-response.yml deleted file mode 100644 index 09d1e036142..00000000000 --- a/cassettes/features/v2/incidents/Create-an-incident-attachment-returns-OK-response.yml +++ /dev/null @@ -1,68 +0,0 @@ -http_interactions: -- recorded_at: Mon, 04 Nov 2024 19:02:17 GMT - request: - body: - encoding: UTF-8 - string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Create_an_incident_attachment_returns_OK_response-1730746937"},"type":"incidents"}}' - headers: - Accept: - - application/json - Content-Type: - - application/json - method: POST - uri: https://api.datadoghq.com/api/v2/incidents - response: - body: - encoding: UTF-8 - string: '{"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":[]}}}} - - ' - headers: - Content-Type: - - application/json - status: - code: 201 - message: Created -- recorded_at: Mon, 04 Nov 2024 19:02:17 GMT - request: - body: - encoding: UTF-8 - string: '{"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: - Accept: - - application/json - Content-Type: - - application/json - method: PATCH - uri: https://api.datadoghq.com/api/v2/incidents/de4affc2-0412-5ed3-9d20-7f71b21ad305/attachments - response: - body: - encoding: UTF-8 - string: '{"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"}}}}]} - - ' - headers: - Content-Type: - - application/json - status: - code: 200 - message: OK -- recorded_at: Mon, 04 Nov 2024 19:02:17 GMT - request: - body: null - headers: - Accept: - - '*/*' - method: DELETE - uri: https://api.datadoghq.com/api/v2/incidents/de4affc2-0412-5ed3-9d20-7f71b21ad305 - response: - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - text/html; charset=utf-8 - status: - code: 204 - message: No Content -recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Get-incident-attachments-returns-OK-response.frozen b/cassettes/features/v2/incidents/Get-incident-attachments-returns-OK-response.frozen deleted file mode 100644 index 65913c025d9..00000000000 --- a/cassettes/features/v2/incidents/Get-incident-attachments-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2024-11-04T19:02:25.584Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Get-incident-attachments-returns-OK-response.yml b/cassettes/features/v2/incidents/Get-incident-attachments-returns-OK-response.yml deleted file mode 100644 index d3b9976aa06..00000000000 --- a/cassettes/features/v2/incidents/Get-incident-attachments-returns-OK-response.yml +++ /dev/null @@ -1,91 +0,0 @@ -http_interactions: -- recorded_at: Mon, 04 Nov 2024 19:02:25 GMT - request: - body: - encoding: UTF-8 - string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Get_incident_attachments_returns_OK_response-1730746945"},"type":"incidents"}}' - headers: - Accept: - - application/json - Content-Type: - - application/json - method: POST - uri: https://api.datadoghq.com/api/v2/incidents - response: - body: - encoding: UTF-8 - string: '{"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":[]}}}} - - ' - headers: - Content-Type: - - application/json - status: - code: 201 - message: Created -- recorded_at: Mon, 04 Nov 2024 19:02:25 GMT - request: - body: - encoding: UTF-8 - string: '{"data":[{"attributes":{"attachment":{"documentUrl":"https://www.example.com/doc","title":"Important - Doc"},"attachment_type":"link"},"type":"incident_attachments"}]}' - headers: - Accept: - - application/json - Content-Type: - - application/json - method: PATCH - uri: https://api.datadoghq.com/api/v2/incidents/1512832c-c4e5-569d-a970-d4797f22745a/attachments - response: - body: - encoding: UTF-8 - string: '{"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"}}}}]} - - ' - headers: - Content-Type: - - application/json - status: - code: 200 - message: OK -- recorded_at: Mon, 04 Nov 2024 19:02:25 GMT - request: - body: null - headers: - Accept: - - application/json - method: GET - uri: https://api.datadoghq.com/api/v2/incidents/1512832c-c4e5-569d-a970-d4797f22745a/attachments - response: - body: - encoding: UTF-8 - string: '{"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"}}}}]} - - ' - headers: - Content-Type: - - application/json - status: - code: 200 - message: OK -- recorded_at: Mon, 04 Nov 2024 19:02:25 GMT - request: - body: null - headers: - Accept: - - '*/*' - method: DELETE - uri: https://api.datadoghq.com/api/v2/incidents/1512832c-c4e5-569d-a970-d4797f22745a - response: - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - text/html; charset=utf-8 - status: - code: 204 - message: No Content -recorded_with: VCR 6.0.0 diff --git a/examples/v2/incidents/CreateIncidentAttachment.rb b/examples/v2/incidents/CreateIncidentAttachment.rb new file mode 100644 index 00000000000..12d5b71c310 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentAttachment.rb @@ -0,0 +1,22 @@ +# Create incident attachment returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_incident_attachment".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::CreateAttachmentRequest.new({ + data: DatadogAPIClient::V2::CreateAttachmentRequestData.new({ + attributes: DatadogAPIClient::V2::CreateAttachmentRequestDataAttributes.new({ + attachment: DatadogAPIClient::V2::CreateAttachmentRequestDataAttributesAttachment.new({ + document_url: "https://app.datadoghq.com/notebook/123/Postmortem-IR-123", + title: "Postmortem-IR-123", + }), + attachment_type: DatadogAPIClient::V2::AttachmentDataAttributesAttachmentType::POSTMORTEM, + }), + id: "00000000-0000-0000-0000-000000000000", + type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS, + }), +}) +p api_instance.create_incident_attachment("incident_id", body) diff --git a/examples/v2/incidents/DeleteIncidentAttachment.rb b/examples/v2/incidents/DeleteIncidentAttachment.rb new file mode 100644 index 00000000000..26840fbf594 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentAttachment.rb @@ -0,0 +1,8 @@ +# Delete incident attachment returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_incident_attachment".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +api_instance.delete_incident_attachment("incident_id", "00000000-0000-0000-0000-000000000002") diff --git a/examples/v2/incidents/ListIncidentAttachments.rb b/examples/v2/incidents/ListIncidentAttachments.rb index abeee4a5fbf..b0b3a6015b7 100644 --- a/examples/v2/incidents/ListIncidentAttachments.rb +++ b/examples/v2/incidents/ListIncidentAttachments.rb @@ -1,4 +1,4 @@ -# Get a list of attachments returns "OK" response +# List incident attachments returns "OK" response require "datadog_api_client" DatadogAPIClient.configure do |config| diff --git a/examples/v2/incidents/ListIncidentAttachments_2457735435.rb b/examples/v2/incidents/ListIncidentAttachments_2457735435.rb deleted file mode 100644 index 8d22a1aa8fd..00000000000 --- a/examples/v2/incidents/ListIncidentAttachments_2457735435.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Get incident attachments returns "OK" response - -require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.list_incident_attachments".to_sym] = true -end -api_instance = DatadogAPIClient::V2::IncidentsAPI.new - -# there is a valid "incident" in the system -INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] -p api_instance.list_incident_attachments(INCIDENT_DATA_ID) diff --git a/examples/v2/incidents/UpdateIncidentAttachment.rb b/examples/v2/incidents/UpdateIncidentAttachment.rb new file mode 100644 index 00000000000..78da75ee445 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentAttachment.rb @@ -0,0 +1,20 @@ +# Update incident attachment returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_incident_attachment".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::PatchAttachmentRequest.new({ + data: DatadogAPIClient::V2::PatchAttachmentRequestData.new({ + attributes: DatadogAPIClient::V2::PatchAttachmentRequestDataAttributes.new({ + attachment: DatadogAPIClient::V2::PatchAttachmentRequestDataAttributesAttachment.new({ + document_url: "https://app.datadoghq.com/notebook/124/Postmortem-IR-124", + title: "Postmortem-IR-124", + }), + }), + type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS, + }), +}) +p api_instance.update_incident_attachment("incident_id", "00000000-0000-0000-0000-000000000002", body) diff --git a/examples/v2/incidents/UpdateIncidentAttachments.rb b/examples/v2/incidents/UpdateIncidentAttachments.rb deleted file mode 100644 index e5fa7b0b9e7..00000000000 --- a/examples/v2/incidents/UpdateIncidentAttachments.rb +++ /dev/null @@ -1,38 +0,0 @@ -# Create, update, and delete incident attachments returns "OK" response - -require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.update_incident_attachments".to_sym] = true -end -api_instance = DatadogAPIClient::V2::IncidentsAPI.new - -body = DatadogAPIClient::V2::IncidentAttachmentUpdateRequest.new({ - data: [ - DatadogAPIClient::V2::IncidentAttachmentUpdateData.new({ - attributes: DatadogAPIClient::V2::IncidentAttachmentPostmortemAttributes.new({ - attachment: DatadogAPIClient::V2::IncidentAttachmentsPostmortemAttributesAttachmentObject.new({ - document_url: "https://app.datadoghq.com/notebook/123", - title: "Postmortem IR-123", - }), - attachment_type: DatadogAPIClient::V2::IncidentAttachmentPostmortemAttachmentType::POSTMORTEM, - }), - id: "00000000-abcd-0002-0000-000000000000", - type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS, - }), - DatadogAPIClient::V2::IncidentAttachmentUpdateData.new({ - attributes: DatadogAPIClient::V2::IncidentAttachmentLinkAttributes.new({ - attachment: DatadogAPIClient::V2::IncidentAttachmentLinkAttributesAttachmentObject.new({ - document_url: "https://www.example.com/webstore-failure-runbook", - title: "Runbook for webstore service failures", - }), - attachment_type: DatadogAPIClient::V2::IncidentAttachmentLinkAttachmentType::LINK, - }), - type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS, - }), - DatadogAPIClient::V2::IncidentAttachmentUpdateData.new({ - id: "00000000-abcd-0003-0000-000000000000", - type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS, - }), - ], -}) -p api_instance.update_incident_attachments("incident_id", body) diff --git a/examples/v2/incidents/UpdateIncidentAttachments_3881702075.rb b/examples/v2/incidents/UpdateIncidentAttachments_3881702075.rb deleted file mode 100644 index f1e0fda6cb5..00000000000 --- a/examples/v2/incidents/UpdateIncidentAttachments_3881702075.rb +++ /dev/null @@ -1,26 +0,0 @@ -# Create an incident attachment returns "OK" response - -require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.update_incident_attachments".to_sym] = true -end -api_instance = DatadogAPIClient::V2::IncidentsAPI.new - -# there is a valid "incident" in the system -INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] - -body = DatadogAPIClient::V2::IncidentAttachmentUpdateRequest.new({ - data: [ - DatadogAPIClient::V2::IncidentAttachmentUpdateData.new({ - type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS, - attributes: DatadogAPIClient::V2::IncidentAttachmentLinkAttributes.new({ - attachment_type: DatadogAPIClient::V2::IncidentAttachmentLinkAttachmentType::LINK, - attachment: DatadogAPIClient::V2::IncidentAttachmentLinkAttributesAttachmentObject.new({ - document_url: "https://www.example.com/doc", - title: "Example-Incident", - }), - }), - }), - ], -}) -p api_instance.update_incident_attachments(INCIDENT_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 3a27e10133c..23ce05813e0 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2103,13 +2103,23 @@ }, "v2.ListIncidentAttachments" => { "incident_id" => "String", - "include" => "Array", - "filter_attachment_type" => "Array", + "filter_attachment_type" => "String", + "include" => "String", + }, + "v2.CreateIncidentAttachment" => { + "incident_id" => "String", + "include" => "String", + "body" => "CreateAttachmentRequest", }, - "v2.UpdateIncidentAttachments" => { + "v2.DeleteIncidentAttachment" => { "incident_id" => "String", - "include" => "Array", - "body" => "IncidentAttachmentUpdateRequest", + "attachment_id" => "Object", + }, + "v2.UpdateIncidentAttachment" => { + "incident_id" => "String", + "attachment_id" => "Object", + "include" => "String", + "body" => "PatchAttachmentRequest", }, "v2.ListIncidentImpacts" => { "incident_id" => "String", diff --git a/features/v2/given.json b/features/v2/given.json index 5e9aa4d3b5f..1d3d16d80df 100644 --- a/features/v2/given.json +++ b/features/v2/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/features/v2/incidents.feature b/features/v2/incidents.feature index 12ab3e2f5ba..a101f5f4af4 100644 --- a/features/v2/incidents.feature +++ b/features/v2/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 @@ -827,6 +793,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 @@ -1073,6 +1055,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/features/v2/undo.json b/features/v2/undo.json index e0f0b98d0c9..f59f66d6e82 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1717,7 +1717,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" diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 5afe995637c..95ddf1221cd 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -249,12 +249,14 @@ def initialize "v2.update_deployment_gate": false, "v2.update_deployment_rule": false, "v2.create_incident": false, + "v2.create_incident_attachment": false, "v2.create_incident_integration": false, "v2.create_incident_notification_rule": false, "v2.create_incident_notification_template": false, "v2.create_incident_todo": false, "v2.create_incident_type": false, "v2.delete_incident": false, + "v2.delete_incident_attachment": false, "v2.delete_incident_integration": false, "v2.delete_incident_notification_rule": false, "v2.delete_incident_notification_template": false, @@ -275,7 +277,7 @@ def initialize "v2.list_incident_types": false, "v2.search_incidents": false, "v2.update_incident": false, - "v2.update_incident_attachments": false, + "v2.update_incident_attachment": false, "v2.update_incident_integration": false, "v2.update_incident_notification_rule": false, "v2.update_incident_notification_template": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 3e6e421122a..9064dd94508 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1140,6 +1140,16 @@ def overrides "v2.attach_jira_issue_request_data" => "AttachJiraIssueRequestData", "v2.attach_jira_issue_request_data_attributes" => "AttachJiraIssueRequestDataAttributes", "v2.attach_jira_issue_request_data_relationships" => "AttachJiraIssueRequestDataRelationships", + "v2.attachment" => "Attachment", + "v2.attachment_array" => "AttachmentArray", + "v2.attachment_data" => "AttachmentData", + "v2.attachment_data_attributes" => "AttachmentDataAttributes", + "v2.attachment_data_attributes_attachment" => "AttachmentDataAttributesAttachment", + "v2.attachment_data_attributes_attachment_type" => "AttachmentDataAttributesAttachmentType", + "v2.attachment_data_relationships" => "AttachmentDataRelationships", + "v2.attachment_data_relationships_last_modified_by_user" => "AttachmentDataRelationshipsLastModifiedByUser", + "v2.attachment_data_relationships_last_modified_by_user_data" => "AttachmentDataRelationshipsLastModifiedByUserData", + "v2.attachment_included" => "AttachmentIncluded", "v2.audit_logs_event" => "AuditLogsEvent", "v2.audit_logs_event_attributes" => "AuditLogsEventAttributes", "v2.audit_logs_events_response" => "AuditLogsEventsResponse", @@ -1687,6 +1697,10 @@ def overrides "v2.create_apps_datastore_request_data_attributes_org_access" => "CreateAppsDatastoreRequestDataAttributesOrgAccess", "v2.create_apps_datastore_response" => "CreateAppsDatastoreResponse", "v2.create_apps_datastore_response_data" => "CreateAppsDatastoreResponseData", + "v2.create_attachment_request" => "CreateAttachmentRequest", + "v2.create_attachment_request_data" => "CreateAttachmentRequestData", + "v2.create_attachment_request_data_attributes" => "CreateAttachmentRequestDataAttributes", + "v2.create_attachment_request_data_attributes_attachment" => "CreateAttachmentRequestDataAttributesAttachment", "v2.create_case_request_array" => "CreateCaseRequestArray", "v2.create_case_request_data" => "CreateCaseRequestData", "v2.create_case_request_data_attributes" => "CreateCaseRequestDataAttributes", @@ -2499,24 +2513,7 @@ def overrides "v2.http_token_auth_update" => "HTTPTokenAuthUpdate", "v2.http_token_update" => "HTTPTokenUpdate", "v2.idp_metadata_form_data" => "IdPMetadataFormData", - "v2.incident_attachment_attachment_type" => "IncidentAttachmentAttachmentType", - "v2.incident_attachment_attributes" => "IncidentAttachmentAttributes", - "v2.incident_attachment_data" => "IncidentAttachmentData", - "v2.incident_attachment_link_attachment_type" => "IncidentAttachmentLinkAttachmentType", - "v2.incident_attachment_link_attributes" => "IncidentAttachmentLinkAttributes", - "v2.incident_attachment_link_attributes_attachment_object" => "IncidentAttachmentLinkAttributesAttachmentObject", - "v2.incident_attachment_postmortem_attachment_type" => "IncidentAttachmentPostmortemAttachmentType", - "v2.incident_attachment_postmortem_attributes" => "IncidentAttachmentPostmortemAttributes", - "v2.incident_attachment_related_object" => "IncidentAttachmentRelatedObject", - "v2.incident_attachment_relationships" => "IncidentAttachmentRelationships", - "v2.incident_attachments_postmortem_attributes_attachment_object" => "IncidentAttachmentsPostmortemAttributesAttachmentObject", - "v2.incident_attachments_response" => "IncidentAttachmentsResponse", - "v2.incident_attachments_response_included_item" => "IncidentAttachmentsResponseIncludedItem", "v2.incident_attachment_type" => "IncidentAttachmentType", - "v2.incident_attachment_update_attributes" => "IncidentAttachmentUpdateAttributes", - "v2.incident_attachment_update_data" => "IncidentAttachmentUpdateData", - "v2.incident_attachment_update_request" => "IncidentAttachmentUpdateRequest", - "v2.incident_attachment_update_response" => "IncidentAttachmentUpdateResponse", "v2.incident_create_attributes" => "IncidentCreateAttributes", "v2.incident_create_data" => "IncidentCreateData", "v2.incident_create_relationships" => "IncidentCreateRelationships", @@ -3459,6 +3456,10 @@ def overrides "v2.partial_application_key" => "PartialApplicationKey", "v2.partial_application_key_attributes" => "PartialApplicationKeyAttributes", "v2.partial_application_key_response" => "PartialApplicationKeyResponse", + "v2.patch_attachment_request" => "PatchAttachmentRequest", + "v2.patch_attachment_request_data" => "PatchAttachmentRequestData", + "v2.patch_attachment_request_data_attributes" => "PatchAttachmentRequestDataAttributes", + "v2.patch_attachment_request_data_attributes_attachment" => "PatchAttachmentRequestDataAttributesAttachment", "v2.patch_incident_notification_template_request" => "PatchIncidentNotificationTemplateRequest", "v2.patch_notification_rule_parameters" => "PatchNotificationRuleParameters", "v2.patch_notification_rule_parameters_data" => "PatchNotificationRuleParametersData", @@ -4540,6 +4541,7 @@ def overrides "v2.usage_time_series_object" => "UsageTimeSeriesObject", "v2.usage_time_series_type" => "UsageTimeSeriesType", "v2.user" => "User", + "v2.user140420082644000" => "User140420082644000", "v2.user_attributes" => "UserAttributes", "v2.user_attributes_status" => "UserAttributesStatus", "v2.user_create_attributes" => "UserCreateAttributes", @@ -4581,6 +4583,7 @@ def overrides "v2.user_team_update" => "UserTeamUpdate", "v2.user_team_update_request" => "UserTeamUpdateRequest", "v2.user_team_user_type" => "UserTeamUserType", + "v2.user_type" => "UserType", "v2.user_update_attributes" => "UserUpdateAttributes", "v2.user_update_data" => "UserUpdateData", "v2.user_update_request" => "UserUpdateRequest", diff --git a/lib/datadog_api_client/v2/api/incidents_api.rb b/lib/datadog_api_client/v2/api/incidents_api.rb index a1f004c3f4b..ca8a628c1db 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -96,6 +96,86 @@ def create_incident_with_http_info(body, opts = {}) return data, status_code, headers end + # Create incident attachment. + # + # @see #create_incident_attachment_with_http_info + def create_incident_attachment(incident_id, body, opts = {}) + data, _status_code, _headers = create_incident_attachment_with_http_info(incident_id, body, opts) + data + end + + # Create incident attachment. + # + # Create an incident attachment. + # + # @param incident_id [String] The UUID of the incident. + # @param body [CreateAttachmentRequest] + # @param opts [Hash] the optional parameters + # @option opts [String] :include Resource to include in the response. Supported value: `last_modified_by_user`. + # @return [Array<(Attachment, Integer, Hash)>] Attachment data, response status code and response headers + def create_incident_attachment_with_http_info(incident_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_attachment".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_attachment") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_attachment")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_attachment ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.create_incident_attachment" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.create_incident_attachment" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/attachments'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'Attachment' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_incident_attachment, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#create_incident_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create an incident impact. # # @see #create_incident_impact_with_http_info @@ -616,6 +696,79 @@ def delete_incident_with_http_info(incident_id, opts = {}) return data, status_code, headers end + # Delete incident attachment. + # + # @see #delete_incident_attachment_with_http_info + def delete_incident_attachment(incident_id, attachment_id, opts = {}) + delete_incident_attachment_with_http_info(incident_id, attachment_id, opts) + nil + end + + # Delete incident attachment. + # @param incident_id [String] The UUID of the incident. + # @param attachment_id [Object] The ID of the attachment. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_incident_attachment_with_http_info(incident_id, attachment_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_incident_attachment".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_incident_attachment") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_incident_attachment")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.delete_incident_attachment ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.delete_incident_attachment" + end + # verify the required parameter 'attachment_id' is set + if @api_client.config.client_side_validation && attachment_id.nil? + fail ArgumentError, "Missing the required parameter 'attachment_id' when calling IncidentsAPI.delete_incident_attachment" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/attachments/{attachment_id}'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')).sub('{attachment_id}', CGI.escape(attachment_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_incident_attachment, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#delete_incident_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete an incident impact. # # @see #delete_incident_impact_with_http_info @@ -1497,7 +1650,7 @@ def get_incident_type_with_http_info(incident_type_id, opts = {}) return data, status_code, headers end - # Get a list of attachments. + # List incident attachments. # # @see #list_incident_attachments_with_http_info def list_incident_attachments(incident_id, opts = {}) @@ -1505,15 +1658,15 @@ def list_incident_attachments(incident_id, opts = {}) data end - # Get a list of attachments. + # List incident attachments. # - # Get all attachments for a given incident. + # List incident attachments. # # @param incident_id [String] The UUID of the incident. # @param opts [Hash] the optional parameters - # @option opts [Array] :include Specifies which types of related objects are included in the response. - # @option opts [Array] :filter_attachment_type Specifies which types of attachments are included in the response. - # @return [Array<(IncidentAttachmentsResponse, Integer, Hash)>] IncidentAttachmentsResponse data, response status code and response headers + # @option opts [String] :filter_attachment_type Filter attachments by type. Supported values are `1` (`postmortem`) and `2` (`link`). + # @option opts [String] :include Resource to include in the response. Supported value: `last_modified_by_user`. + # @return [Array<(AttachmentArray, Integer, Hash)>] AttachmentArray data, response status code and response headers def list_incident_attachments_with_http_info(incident_id, opts = {}) unstable_enabled = @api_client.config.unstable_operations["v2.list_incident_attachments".to_sym] if unstable_enabled @@ -1534,8 +1687,8 @@ def list_incident_attachments_with_http_info(incident_id, opts = {}) # query parameters query_params = opts[:query_params] || {} - query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil? - query_params[:'filter[attachment_type]'] = @api_client.build_collection_param(opts[:'filter_attachment_type'], :csv) if !opts[:'filter_attachment_type'].nil? + query_params[:'filter[attachment_type]'] = opts[:'filter_attachment_type'] if !opts[:'filter_attachment_type'].nil? + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? # header parameters header_params = opts[:header_params] || {} @@ -1549,7 +1702,7 @@ def list_incident_attachments_with_http_info(incident_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'IncidentAttachmentsResponse' + return_type = opts[:debug_return_type] || 'AttachmentArray' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] @@ -2269,51 +2422,50 @@ def update_incident_with_http_info(incident_id, body, opts = {}) return data, status_code, headers end - # Create, update, and delete incident attachments. + # Update incident attachment. # - # @see #update_incident_attachments_with_http_info - def update_incident_attachments(incident_id, body, opts = {}) - data, _status_code, _headers = update_incident_attachments_with_http_info(incident_id, body, opts) + # @see #update_incident_attachment_with_http_info + def update_incident_attachment(incident_id, attachment_id, body, opts = {}) + data, _status_code, _headers = update_incident_attachment_with_http_info(incident_id, attachment_id, body, opts) data end - # Create, update, and delete incident attachments. - # - # The bulk update endpoint for creating, updating, and deleting attachments for a given incident. - # - # @deprecated This API is deprecated. - # + # Update incident attachment. # @param incident_id [String] The UUID of the incident. - # @param body [IncidentAttachmentUpdateRequest] Incident Attachment Payload. + # @param attachment_id [Object] The ID of the attachment. + # @param body [PatchAttachmentRequest] # @param opts [Hash] the optional parameters - # @option opts [Array] :include Specifies which types of related objects are included in the response. - # @return [Array<(IncidentAttachmentUpdateResponse, Integer, Hash)>] IncidentAttachmentUpdateResponse data, response status code and response headers - def update_incident_attachments_with_http_info(incident_id, body, opts = {}) - warn "[DEPRECATION] `UpdateIncidentAttachments` is deprecated." - unstable_enabled = @api_client.config.unstable_operations["v2.update_incident_attachments".to_sym] + # @option opts [String] :include Resource to include in the response. Supported value: `last_modified_by_user`. + # @return [Array<(Attachment, Integer, Hash)>] Attachment data, response status code and response headers + def update_incident_attachment_with_http_info(incident_id, attachment_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_incident_attachment".to_sym] if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_incident_attachments") + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_incident_attachment") else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_incident_attachments")) + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_incident_attachment")) end if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: IncidentsAPI.update_incident_attachments ...' + @api_client.config.logger.debug 'Calling API: IncidentsAPI.update_incident_attachment ...' end # verify the required parameter 'incident_id' is set if @api_client.config.client_side_validation && incident_id.nil? - fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.update_incident_attachments" + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.update_incident_attachment" + end + # verify the required parameter 'attachment_id' is set + if @api_client.config.client_side_validation && attachment_id.nil? + fail ArgumentError, "Missing the required parameter 'attachment_id' when calling IncidentsAPI.update_incident_attachment" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.update_incident_attachments" + fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.update_incident_attachment" end # resource path - local_var_path = '/api/v2/incidents/{incident_id}/attachments'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')) + local_var_path = '/api/v2/incidents/{incident_id}/attachments/{attachment_id}'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')).sub('{attachment_id}', CGI.escape(attachment_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} - query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil? + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? # header parameters header_params = opts[:header_params] || {} @@ -2329,13 +2481,13 @@ def update_incident_attachments_with_http_info(incident_id, body, opts = {}) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type - return_type = opts[:debug_return_type] || 'IncidentAttachmentUpdateResponse' + return_type = opts[:debug_return_type] || 'Attachment' # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( - :operation => :update_incident_attachments, + :operation => :update_incident_attachment, :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -2347,7 +2499,7 @@ def update_incident_attachments_with_http_info(incident_id, body, opts = {}) data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: IncidentsAPI#update_incident_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: IncidentsAPI#update_incident_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_update_response.rb b/lib/datadog_api_client/v2/models/attachment.rb similarity index 72% rename from lib/datadog_api_client/v2/models/incident_attachment_update_response.rb rename to lib/datadog_api_client/v2/models/attachment.rb index f7c5ea8d2be..b5d701b22d7 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_update_response.rb +++ b/lib/datadog_api_client/v2/models/attachment.rb @@ -17,15 +17,14 @@ require 'time' module DatadogAPIClient::V2 - # The response object containing the created or updated incident attachments. - class IncidentAttachmentUpdateResponse + # + class Attachment include BaseGenericModel - # An array of incident attachments. Only the attachments that were created or updated by the request are - # returned. - attr_reader :data + # + attr_accessor :data - # Included related resources that the user requested. + # attr_accessor :included attr_accessor :additional_properties @@ -43,8 +42,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'data' => :'Array', - :'included' => :'Array' + :'data' => :'AttachmentData', + :'included' => :'Array' } end @@ -53,7 +52,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentUpdateResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Attachment` initialize method" end self.additional_properties = {} @@ -67,9 +66,7 @@ def initialize(attributes = {}) } if attributes.key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end + self.data = attributes[:'data'] end if attributes.key?(:'included') @@ -79,24 +76,6 @@ def initialize(attributes = {}) end end - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @data.nil? - true - end - - # Custom attribute writer method with validation - # @param data [Object] Object to be assigned - # @!visibility private - def data=(data) - if data.nil? - fail ArgumentError, 'invalid value for "data", data cannot be nil.' - end - @data = data - end - # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private diff --git a/lib/datadog_api_client/v2/models/incident_attachments_response.rb b/lib/datadog_api_client/v2/models/attachment_array.rb similarity index 89% rename from lib/datadog_api_client/v2/models/incident_attachments_response.rb rename to lib/datadog_api_client/v2/models/attachment_array.rb index 7d7f30babd0..5f05d1e4b22 100644 --- a/lib/datadog_api_client/v2/models/incident_attachments_response.rb +++ b/lib/datadog_api_client/v2/models/attachment_array.rb @@ -17,14 +17,14 @@ require 'time' module DatadogAPIClient::V2 - # The response object containing an incident's attachments. - class IncidentAttachmentsResponse + # + class AttachmentArray include BaseGenericModel - # An array of incident attachments. + # attr_reader :data - # Included related resources that the user requested. + # attr_accessor :included attr_accessor :additional_properties @@ -42,8 +42,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'data' => :'Array', - :'included' => :'Array' + :'data' => :'Array', + :'included' => :'Array' } end @@ -52,7 +52,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentsResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AttachmentArray` initialize method" end self.additional_properties = {} diff --git a/lib/datadog_api_client/v2/models/incident_attachment_data.rb b/lib/datadog_api_client/v2/models/attachment_data.rb similarity index 92% rename from lib/datadog_api_client/v2/models/incident_attachment_data.rb rename to lib/datadog_api_client/v2/models/attachment_data.rb index 9daf2ed5747..24a516aade1 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_data.rb +++ b/lib/datadog_api_client/v2/models/attachment_data.rb @@ -17,17 +17,17 @@ require 'time' module DatadogAPIClient::V2 - # A single incident attachment. - class IncidentAttachmentData + # + class AttachmentData include BaseGenericModel - # The attributes object for an attachment. + # attr_reader :attributes - # A unique identifier that represents the incident attachment. + # attr_reader :id - # The incident attachment's relationships. + # attr_reader :relationships # The incident attachment resource type. @@ -50,9 +50,9 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'attributes' => :'IncidentAttachmentAttributes', + :'attributes' => :'AttachmentDataAttributes', :'id' => :'String', - :'relationships' => :'IncidentAttachmentRelationships', + :'relationships' => :'AttachmentDataRelationships', :'type' => :'IncidentAttachmentType' } end @@ -62,7 +62,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentData` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AttachmentData` initialize method" end self.additional_properties = {} diff --git a/lib/datadog_api_client/v2/models/incident_attachment_link_attributes.rb b/lib/datadog_api_client/v2/models/attachment_data_attributes.rb similarity index 68% rename from lib/datadog_api_client/v2/models/incident_attachment_link_attributes.rb rename to lib/datadog_api_client/v2/models/attachment_data_attributes.rb index 6600c413a8a..7b3a352cb67 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_link_attributes.rb +++ b/lib/datadog_api_client/v2/models/attachment_data_attributes.rb @@ -17,17 +17,17 @@ require 'time' module DatadogAPIClient::V2 - # The attributes object for a link attachment. - class IncidentAttachmentLinkAttributes + # + class AttachmentDataAttributes include BaseGenericModel - # The link attachment. - attr_reader :attachment + # + attr_accessor :attachment - # The type of link attachment attributes. - attr_reader :attachment_type + # + attr_accessor :attachment_type - # Timestamp when the incident attachment link was last modified. + # attr_accessor :modified attr_accessor :additional_properties @@ -46,8 +46,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'attachment' => :'IncidentAttachmentLinkAttributesAttachmentObject', - :'attachment_type' => :'IncidentAttachmentLinkAttachmentType', + :'attachment' => :'AttachmentDataAttributesAttachment', + :'attachment_type' => :'AttachmentDataAttributesAttachmentType', :'modified' => :'Time' } end @@ -57,7 +57,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentLinkAttributes` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AttachmentDataAttributes` initialize method" end self.additional_properties = {} @@ -83,35 +83,6 @@ def initialize(attributes = {}) end end - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @attachment.nil? - return false if @attachment_type.nil? - true - end - - # Custom attribute writer method with validation - # @param attachment [Object] Object to be assigned - # @!visibility private - def attachment=(attachment) - if attachment.nil? - fail ArgumentError, 'invalid value for "attachment", attachment cannot be nil.' - end - @attachment = attachment - end - - # Custom attribute writer method with validation - # @param attachment_type [Object] Object to be assigned - # @!visibility private - def attachment_type=(attachment_type) - if attachment_type.nil? - fail ArgumentError, 'invalid value for "attachment_type", attachment_type cannot be nil.' - end - @attachment_type = attachment_type - end - # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private diff --git a/lib/datadog_api_client/v2/models/incident_attachment_link_attributes_attachment_object.rb b/lib/datadog_api_client/v2/models/attachment_data_attributes_attachment.rb similarity index 71% rename from lib/datadog_api_client/v2/models/incident_attachment_link_attributes_attachment_object.rb rename to lib/datadog_api_client/v2/models/attachment_data_attributes_attachment.rb index 6af3c3035a9..fbdf2e85025 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_link_attributes_attachment_object.rb +++ b/lib/datadog_api_client/v2/models/attachment_data_attributes_attachment.rb @@ -17,15 +17,15 @@ require 'time' module DatadogAPIClient::V2 - # The link attachment. - class IncidentAttachmentLinkAttributesAttachmentObject + # + class AttachmentDataAttributesAttachment include BaseGenericModel - # The URL of this link attachment. - attr_reader :document_url + # + attr_accessor :document_url - # The title of this link attachment. - attr_reader :title + # + attr_accessor :title attr_accessor :additional_properties @@ -52,7 +52,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentLinkAttributesAttachmentObject` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AttachmentDataAttributesAttachment` initialize method" end self.additional_properties = {} @@ -74,35 +74,6 @@ def initialize(attributes = {}) end end - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @document_url.nil? - return false if @title.nil? - true - end - - # Custom attribute writer method with validation - # @param document_url [Object] Object to be assigned - # @!visibility private - def document_url=(document_url) - if document_url.nil? - fail ArgumentError, 'invalid value for "document_url", document_url cannot be nil.' - end - @document_url = document_url - end - - # Custom attribute writer method with validation - # @param title [Object] Object to be assigned - # @!visibility private - def title=(title) - if title.nil? - fail ArgumentError, 'invalid value for "title", title cannot be nil.' - end - @title = title - end - # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private diff --git a/lib/datadog_api_client/v2/models/incident_attachment_attachment_type.rb b/lib/datadog_api_client/v2/models/attachment_data_attributes_attachment_type.rb similarity index 87% rename from lib/datadog_api_client/v2/models/incident_attachment_attachment_type.rb rename to lib/datadog_api_client/v2/models/attachment_data_attributes_attachment_type.rb index 3ca77a60142..028da90d22f 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_attachment_type.rb +++ b/lib/datadog_api_client/v2/models/attachment_data_attributes_attachment_type.rb @@ -17,11 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # The type of the incident attachment attributes. - class IncidentAttachmentAttachmentType + # + class AttachmentDataAttributesAttachmentType include BaseEnumModel - LINK = "link".freeze POSTMORTEM = "postmortem".freeze + LINK = "link".freeze end end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_relationships.rb b/lib/datadog_api_client/v2/models/attachment_data_relationships.rb similarity index 91% rename from lib/datadog_api_client/v2/models/incident_attachment_relationships.rb rename to lib/datadog_api_client/v2/models/attachment_data_relationships.rb index d4b480f3f1b..2d862858297 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_relationships.rb +++ b/lib/datadog_api_client/v2/models/attachment_data_relationships.rb @@ -17,11 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # The incident attachment's relationships. - class IncidentAttachmentRelationships + # + class AttachmentDataRelationships include BaseGenericModel - # Relationship to user. + # attr_accessor :last_modified_by_user attr_accessor :additional_properties @@ -38,7 +38,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'last_modified_by_user' => :'RelationshipToUser' + :'last_modified_by_user' => :'AttachmentDataRelationshipsLastModifiedByUser' } end @@ -47,7 +47,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentRelationships` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AttachmentDataRelationships` initialize method" end self.additional_properties = {} diff --git a/lib/datadog_api_client/v2/models/incident_attachment_update_request.rb b/lib/datadog_api_client/v2/models/attachment_data_relationships_last_modified_by_user.rb similarity index 81% rename from lib/datadog_api_client/v2/models/incident_attachment_update_request.rb rename to lib/datadog_api_client/v2/models/attachment_data_relationships_last_modified_by_user.rb index a71325e1886..852b0d462aa 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_update_request.rb +++ b/lib/datadog_api_client/v2/models/attachment_data_relationships_last_modified_by_user.rb @@ -17,14 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # The update request for an incident's attachments. - class IncidentAttachmentUpdateRequest + # + class AttachmentDataRelationshipsLastModifiedByUser include BaseGenericModel - # 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. + # attr_reader :data attr_accessor :additional_properties @@ -41,7 +38,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'data' => :'Array' + :'data' => :'AttachmentDataRelationshipsLastModifiedByUserData' } end @@ -50,7 +47,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentUpdateRequest` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AttachmentDataRelationshipsLastModifiedByUser` initialize method" end self.additional_properties = {} @@ -64,9 +61,7 @@ def initialize(attributes = {}) } if attributes.key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end + self.data = attributes[:'data'] end end diff --git a/lib/datadog_api_client/v2/models/attachment_data_relationships_last_modified_by_user_data.rb b/lib/datadog_api_client/v2/models/attachment_data_relationships_last_modified_by_user_data.rb new file mode 100644 index 00000000000..67ffb83eb7f --- /dev/null +++ b/lib/datadog_api_client/v2/models/attachment_data_relationships_last_modified_by_user_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # + class AttachmentDataRelationshipsLastModifiedByUserData + include BaseGenericModel + + # + attr_reader :id + + # Users resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'UserType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AttachmentDataRelationshipsLastModifiedByUserData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_attachments_response_included_item.rb b/lib/datadog_api_client/v2/models/attachment_included.rb similarity index 93% rename from lib/datadog_api_client/v2/models/incident_attachments_response_included_item.rb rename to lib/datadog_api_client/v2/models/attachment_included.rb index f8673ab750e..704e65fa3cf 100644 --- a/lib/datadog_api_client/v2/models/incident_attachments_response_included_item.rb +++ b/lib/datadog_api_client/v2/models/attachment_included.rb @@ -17,8 +17,8 @@ require 'time' module DatadogAPIClient::V2 - # An object related to an attachment that is included in the response. - module IncidentAttachmentsResponseIncludedItem + # + module AttachmentIncluded class << self include BaseOneOfModel include BaseOneOfModelNoDiscriminator @@ -26,7 +26,7 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ - :'User' + :'User140420082644000' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/create_attachment_request.rb b/lib/datadog_api_client/v2/models/create_attachment_request.rb new file mode 100644 index 00000000000..98d20b4f90c --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_attachment_request.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # + class CreateAttachmentRequest + include BaseGenericModel + + # + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CreateAttachmentRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateAttachmentRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_update_data.rb b/lib/datadog_api_client/v2/models/create_attachment_request_data.rb similarity index 91% rename from lib/datadog_api_client/v2/models/incident_attachment_update_data.rb rename to lib/datadog_api_client/v2/models/create_attachment_request_data.rb index e56290e8146..859d3176509 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_update_data.rb +++ b/lib/datadog_api_client/v2/models/create_attachment_request_data.rb @@ -17,14 +17,14 @@ require 'time' module DatadogAPIClient::V2 - # A single incident attachment. - class IncidentAttachmentUpdateData + # + class CreateAttachmentRequestData include BaseGenericModel - # Incident attachment attributes. + # attr_accessor :attributes - # A unique identifier that represents the incident attachment. + # attr_accessor :id # The incident attachment resource type. @@ -46,7 +46,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'attributes' => :'IncidentAttachmentUpdateAttributes', + :'attributes' => :'CreateAttachmentRequestDataAttributes', :'id' => :'String', :'type' => :'IncidentAttachmentType' } @@ -57,7 +57,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentUpdateData` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateAttachmentRequestData` initialize method" end self.additional_properties = {} diff --git a/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attributes.rb b/lib/datadog_api_client/v2/models/create_attachment_request_data_attributes.rb similarity index 67% rename from lib/datadog_api_client/v2/models/incident_attachment_postmortem_attributes.rb rename to lib/datadog_api_client/v2/models/create_attachment_request_data_attributes.rb index b71dd7df0ab..a5a20a60b80 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attributes.rb +++ b/lib/datadog_api_client/v2/models/create_attachment_request_data_attributes.rb @@ -17,15 +17,15 @@ require 'time' module DatadogAPIClient::V2 - # The attributes object for a postmortem attachment. - class IncidentAttachmentPostmortemAttributes + # + class CreateAttachmentRequestDataAttributes include BaseGenericModel - # The postmortem attachment. - attr_reader :attachment + # + attr_accessor :attachment - # The type of postmortem attachment attributes. - attr_reader :attachment_type + # + attr_accessor :attachment_type attr_accessor :additional_properties @@ -42,8 +42,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'attachment' => :'IncidentAttachmentsPostmortemAttributesAttachmentObject', - :'attachment_type' => :'IncidentAttachmentPostmortemAttachmentType' + :'attachment' => :'CreateAttachmentRequestDataAttributesAttachment', + :'attachment_type' => :'AttachmentDataAttributesAttachmentType' } end @@ -52,7 +52,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentPostmortemAttributes` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateAttachmentRequestDataAttributes` initialize method" end self.additional_properties = {} @@ -74,35 +74,6 @@ def initialize(attributes = {}) end end - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @attachment.nil? - return false if @attachment_type.nil? - true - end - - # Custom attribute writer method with validation - # @param attachment [Object] Object to be assigned - # @!visibility private - def attachment=(attachment) - if attachment.nil? - fail ArgumentError, 'invalid value for "attachment", attachment cannot be nil.' - end - @attachment = attachment - end - - # Custom attribute writer method with validation - # @param attachment_type [Object] Object to be assigned - # @!visibility private - def attachment_type=(attachment_type) - if attachment_type.nil? - fail ArgumentError, 'invalid value for "attachment_type", attachment_type cannot be nil.' - end - @attachment_type = attachment_type - end - # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private diff --git a/lib/datadog_api_client/v2/models/incident_attachments_postmortem_attributes_attachment_object.rb b/lib/datadog_api_client/v2/models/create_attachment_request_data_attributes_attachment.rb similarity index 71% rename from lib/datadog_api_client/v2/models/incident_attachments_postmortem_attributes_attachment_object.rb rename to lib/datadog_api_client/v2/models/create_attachment_request_data_attributes_attachment.rb index cd89b09d192..88962d8b8c7 100644 --- a/lib/datadog_api_client/v2/models/incident_attachments_postmortem_attributes_attachment_object.rb +++ b/lib/datadog_api_client/v2/models/create_attachment_request_data_attributes_attachment.rb @@ -17,15 +17,15 @@ require 'time' module DatadogAPIClient::V2 - # The postmortem attachment. - class IncidentAttachmentsPostmortemAttributesAttachmentObject + # + class CreateAttachmentRequestDataAttributesAttachment include BaseGenericModel - # The URL of this notebook attachment. - attr_reader :document_url + # + attr_accessor :document_url - # The title of this postmortem attachment. - attr_reader :title + # + attr_accessor :title attr_accessor :additional_properties @@ -52,7 +52,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentAttachmentsPostmortemAttributesAttachmentObject` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateAttachmentRequestDataAttributesAttachment` initialize method" end self.additional_properties = {} @@ -74,35 +74,6 @@ def initialize(attributes = {}) end end - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @document_url.nil? - return false if @title.nil? - true - end - - # Custom attribute writer method with validation - # @param document_url [Object] Object to be assigned - # @!visibility private - def document_url=(document_url) - if document_url.nil? - fail ArgumentError, 'invalid value for "document_url", document_url cannot be nil.' - end - @document_url = document_url - end - - # Custom attribute writer method with validation - # @param title [Object] Object to be assigned - # @!visibility private - def title=(title) - if title.nil? - fail ArgumentError, 'invalid value for "title", title cannot be nil.' - end - @title = title - end - # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private diff --git a/lib/datadog_api_client/v2/models/incident_attachment_attributes.rb b/lib/datadog_api_client/v2/models/incident_attachment_attributes.rb deleted file mode 100644 index 5d8373f491c..00000000000 --- a/lib/datadog_api_client/v2/models/incident_attachment_attributes.rb +++ /dev/null @@ -1,63 +0,0 @@ -=begin -#Datadog API V2 Collection - -#Collection of all Datadog Public endpoints. - -The version of the OpenAPI document: 1.0 -Contact: support@datadoghq.com -Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator - - Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - This product includes software developed at Datadog (https://www.datadoghq.com/). - Copyright 2020-Present Datadog, Inc. - -=end - -require 'date' -require 'time' - -module DatadogAPIClient::V2 - # The attributes object for an attachment. - module IncidentAttachmentAttributes - class << self - include BaseOneOfModel - include BaseOneOfModelNoDiscriminator - - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'IncidentAttachmentPostmortemAttributes', - :'IncidentAttachmentLinkAttributes' - ] - end - # Builds the object - # @param data [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - if openapi_one_of.include?(:AnyType) - data - else - self._unparsed = true - DatadogAPIClient::UnparsedObject.new(data) - end - end - end - end -end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_link_attachment_type.rb b/lib/datadog_api_client/v2/models/incident_attachment_link_attachment_type.rb deleted file mode 100644 index 19fcf5991c1..00000000000 --- a/lib/datadog_api_client/v2/models/incident_attachment_link_attachment_type.rb +++ /dev/null @@ -1,26 +0,0 @@ -=begin -#Datadog API V2 Collection - -#Collection of all Datadog Public endpoints. - -The version of the OpenAPI document: 1.0 -Contact: support@datadoghq.com -Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator - - Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - This product includes software developed at Datadog (https://www.datadoghq.com/). - Copyright 2020-Present Datadog, Inc. - -=end - -require 'date' -require 'time' - -module DatadogAPIClient::V2 - # The type of link attachment attributes. - class IncidentAttachmentLinkAttachmentType - include BaseEnumModel - - LINK = "link".freeze - end -end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attachment_type.rb b/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attachment_type.rb deleted file mode 100644 index eac29de0add..00000000000 --- a/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attachment_type.rb +++ /dev/null @@ -1,26 +0,0 @@ -=begin -#Datadog API V2 Collection - -#Collection of all Datadog Public endpoints. - -The version of the OpenAPI document: 1.0 -Contact: support@datadoghq.com -Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator - - Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - This product includes software developed at Datadog (https://www.datadoghq.com/). - Copyright 2020-Present Datadog, Inc. - -=end - -require 'date' -require 'time' - -module DatadogAPIClient::V2 - # The type of postmortem attachment attributes. - class IncidentAttachmentPostmortemAttachmentType - include BaseEnumModel - - POSTMORTEM = "postmortem".freeze - end -end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_update_attributes.rb b/lib/datadog_api_client/v2/models/incident_attachment_update_attributes.rb deleted file mode 100644 index e8532f4a078..00000000000 --- a/lib/datadog_api_client/v2/models/incident_attachment_update_attributes.rb +++ /dev/null @@ -1,63 +0,0 @@ -=begin -#Datadog API V2 Collection - -#Collection of all Datadog Public endpoints. - -The version of the OpenAPI document: 1.0 -Contact: support@datadoghq.com -Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator - - Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - This product includes software developed at Datadog (https://www.datadoghq.com/). - Copyright 2020-Present Datadog, Inc. - -=end - -require 'date' -require 'time' - -module DatadogAPIClient::V2 - # Incident attachment attributes. - module IncidentAttachmentUpdateAttributes - class << self - include BaseOneOfModel - include BaseOneOfModelNoDiscriminator - - # List of class defined in oneOf (OpenAPI v3) - def openapi_one_of - [ - :'IncidentAttachmentPostmortemAttributes', - :'IncidentAttachmentLinkAttributes' - ] - end - # Builds the object - # @param data [Mixed] Data to be matched against the list of oneOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of oneOf items and attempt to identify the appropriate one. - # Note: - # - We do not attempt to check whether exactly one item matches. - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_one_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - if openapi_one_of.include?(:AnyType) - data - else - self._unparsed = true - DatadogAPIClient::UnparsedObject.new(data) - end - end - end - end -end diff --git a/lib/datadog_api_client/v2/models/incident_response_included_item.rb b/lib/datadog_api_client/v2/models/incident_response_included_item.rb index a508273ef13..d194f7afe55 100644 --- a/lib/datadog_api_client/v2/models/incident_response_included_item.rb +++ b/lib/datadog_api_client/v2/models/incident_response_included_item.rb @@ -27,7 +27,7 @@ class << self def openapi_one_of [ :'IncidentUserData', - :'IncidentAttachmentData' + :'AttachmentData' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/patch_attachment_request.rb b/lib/datadog_api_client/v2/models/patch_attachment_request.rb new file mode 100644 index 00000000000..2fad435206b --- /dev/null +++ b/lib/datadog_api_client/v2/models/patch_attachment_request.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # + class PatchAttachmentRequest + include BaseGenericModel + + # + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'PatchAttachmentRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PatchAttachmentRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/patch_attachment_request_data.rb b/lib/datadog_api_client/v2/models/patch_attachment_request_data.rb new file mode 100644 index 00000000000..7310bb1ba63 --- /dev/null +++ b/lib/datadog_api_client/v2/models/patch_attachment_request_data.rb @@ -0,0 +1,143 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # + class PatchAttachmentRequestData + include BaseGenericModel + + # + attr_accessor :attributes + + # + attr_accessor :id + + # The incident attachment resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PatchAttachmentRequestDataAttributes', + :'id' => :'String', + :'type' => :'IncidentAttachmentType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PatchAttachmentRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/patch_attachment_request_data_attributes.rb b/lib/datadog_api_client/v2/models/patch_attachment_request_data_attributes.rb new file mode 100644 index 00000000000..9281ed7bb6f --- /dev/null +++ b/lib/datadog_api_client/v2/models/patch_attachment_request_data_attributes.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # + class PatchAttachmentRequestDataAttributes + include BaseGenericModel + + # + attr_accessor :attachment + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attachment' => :'attachment' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attachment' => :'PatchAttachmentRequestDataAttributesAttachment' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PatchAttachmentRequestDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attachment') + self.attachment = attributes[:'attachment'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attachment == o.attachment && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attachment, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/patch_attachment_request_data_attributes_attachment.rb b/lib/datadog_api_client/v2/models/patch_attachment_request_data_attributes_attachment.rb new file mode 100644 index 00000000000..39a06e7d72d --- /dev/null +++ b/lib/datadog_api_client/v2/models/patch_attachment_request_data_attributes_attachment.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # + class PatchAttachmentRequestDataAttributesAttachment + include BaseGenericModel + + # + attr_accessor :document_url + + # + attr_accessor :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'document_url' => :'documentUrl', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'document_url' => :'String', + :'title' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PatchAttachmentRequestDataAttributesAttachment` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'document_url') + self.document_url = attributes[:'document_url'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document_url == o.document_url && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [document_url, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/user140420082644000.rb b/lib/datadog_api_client/v2/models/user140420082644000.rb new file mode 100644 index 00000000000..27fbb7f5ea0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/user140420082644000.rb @@ -0,0 +1,143 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # + class User140420082644000 + include BaseGenericModel + + # Attributes of user object returned by the API. + attr_accessor :attributes + + # + attr_accessor :id + + # Users resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UserAttributes', + :'id' => :'String', + :'type' => :'UserType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::User140420082644000` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_related_object.rb b/lib/datadog_api_client/v2/models/user_type.rb similarity index 86% rename from lib/datadog_api_client/v2/models/incident_attachment_related_object.rb rename to lib/datadog_api_client/v2/models/user_type.rb index fe0201af523..0cc43068a50 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_related_object.rb +++ b/lib/datadog_api_client/v2/models/user_type.rb @@ -17,8 +17,8 @@ require 'time' module DatadogAPIClient::V2 - # The object related to an incident attachment. - class IncidentAttachmentRelatedObject + # Users resource type. + class UserType include BaseEnumModel USERS = "users".freeze