diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index cfbcb7286acb..f3ca46bc0485 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: @@ -13374,6 +13520,40 @@ components: - name - targets type: object + CreateOnCallNotificationRuleRequest: + description: A top-level wrapper for creating a notification rule for a user + example: + data: + attributes: + category: high_urgency + channel_settings: + method: sms + type: phone + delay_minutes: 1 + relationships: + channel: + data: + id: 1562fab3-a8c2-49e2-8f3a-28dcda2405e2 + type: notification_channels + type: notification_rules + properties: + data: + $ref: '#/components/schemas/CreateOnCallNotificationRuleRequestData' + required: + - data + type: object + CreateOnCallNotificationRuleRequestData: + description: Data for creating an on-call notification rule + properties: + attributes: + $ref: '#/components/schemas/OnCallNotificationRuleRequestAttributes' + relationships: + $ref: '#/components/schemas/OnCallNotificationRuleRelationships' + type: + $ref: '#/components/schemas/OnCallNotificationRuleType' + required: + - type + type: object CreateOpenAPIResponse: description: Response for `CreateOpenAPI` operation. properties: @@ -25665,126 +25845,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 +25854,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 +27124,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: @@ -30599,6 +30523,18 @@ components: $ref: '#/components/schemas/NotificationChannelData' type: array type: object + ListOnCallNotificationRulesResponse: + description: Response type for listing notification rules for a user + properties: + data: + items: + $ref: '#/components/schemas/OnCallNotificationRuleData' + type: array + included: + items: + $ref: '#/components/schemas/OnCallNotificationRulesIncluded' + type: array + type: object ListPipelinesResponse: description: Represents the response payload containing a list of pipelines and associated metadata. @@ -39095,6 +39031,130 @@ components: required: - type type: object + OnCallNotificationRule: + description: A top-level wrapper for a notification rule + example: + data: + attributes: + category: high_urgency + channel_settings: + method: sms + type: phone + delay_minutes: 1 + id: 27590dae-47be-4a7d-9abf-8f4e45124020 + relationships: + channel: + data: + id: 1562fab3-a8c2-49e2-8f3a-28dcda2405e2 + type: notification_channels + type: notification_rules + properties: + data: + $ref: '#/components/schemas/OnCallNotificationRuleData' + included: + items: + $ref: '#/components/schemas/OnCallNotificationRulesIncluded' + type: array + required: + - data + type: object + OnCallNotificationRuleAttributes: + description: Attributes for an on-call notification rule. + properties: + category: + $ref: '#/components/schemas/OnCallNotificationRuleCategory' + channel_settings: + $ref: '#/components/schemas/OnCallNotificationRuleChannelSettings' + description: Configuration for the associated channel, if necessary + nullable: true + delay_minutes: + description: The number of minutes that will elapse before this rule is + evaluated. 0 indicates immediate evaluation + format: int64 + type: integer + type: object + OnCallNotificationRuleCategory: + default: high_urgency + description: Specifies the category a notification rule will apply to + enum: + - high_urgency + - low_urgency + type: string + x-enum-varnames: + - HIGH_URGENCY + - LOW_URGENCY + OnCallNotificationRuleChannelRelationship: + description: Relationship object for creating a notification rule + properties: + data: + $ref: '#/components/schemas/OnCallNotificationRuleChannelRelationshipData' + required: + - data + type: object + OnCallNotificationRuleChannelRelationshipData: + description: Channel relationship data for creating a notification rule + properties: + id: + description: ID of the notification channel + type: string + type: + $ref: '#/components/schemas/NotificationChannelType' + type: object + OnCallNotificationRuleChannelSettings: + description: Defines the configuration for a channel associated with a notification + rule + oneOf: + - $ref: '#/components/schemas/OnCallPhoneNotificationRuleSettings' + OnCallNotificationRuleData: + description: Data for an on-call notification rule + properties: + attributes: + $ref: '#/components/schemas/OnCallNotificationRuleAttributes' + id: + description: Unique identifier for the rule + type: string + relationships: + $ref: '#/components/schemas/OnCallNotificationRuleRelationships' + type: + $ref: '#/components/schemas/OnCallNotificationRuleType' + required: + - type + type: object + OnCallNotificationRuleRelationships: + description: Relationship object for creating a notification rule + properties: + channel: + $ref: '#/components/schemas/OnCallNotificationRuleChannelRelationship' + type: object + OnCallNotificationRuleRequestAttributes: + description: Attributes for creating or modifying an on-call notification rule. + properties: + category: + $ref: '#/components/schemas/OnCallNotificationRuleCategory' + channel_settings: + $ref: '#/components/schemas/OnCallNotificationRuleChannelSettings' + description: Configuration for the associated channel, if necessary + nullable: true + delay_minutes: + description: The number of minutes that will elapse before this rule is + evaluated. 0 indicates immediate evaluation + format: int64 + type: integer + type: object + OnCallNotificationRuleType: + default: notification_rules + description: Indicates that the resource is of type 'notification_rules'. + enum: + - notification_rules + example: notification_rules + type: string + x-enum-varnames: + - NOTIFICATION_RULES + OnCallNotificationRulesIncluded: + description: Represents additional included resources for a on-call notification + rules + oneOf: + - $ref: '#/components/schemas/NotificationChannelData' OnCallPageTargetType: description: The kind of target, `team_id` | `team_handle` | `user_id`. enum: @@ -39107,6 +39167,29 @@ components: - TEAM_ID - TEAM_HANDLE - USER_ID + OnCallPhoneNotificationRuleMethod: + description: Specifies the method in which a phone is used in a notification + rule + enum: + - sms + - voice + example: sms + type: string + x-enum-varnames: + - SMS + - VOICE + OnCallPhoneNotificationRuleSettings: + description: Configuration for using a phone notification channel in a notification + rule + properties: + method: + $ref: '#/components/schemas/OnCallPhoneNotificationRuleMethod' + type: + $ref: '#/components/schemas/NotificationChannelPhoneConfigType' + required: + - type + - method + type: object OnDemandConcurrencyCap: description: On-demand concurrency cap. properties: @@ -40203,6 +40286,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: @@ -56346,6 +56464,59 @@ components: - name - options type: object + UpdateOnCallNotificationRuleRequest: + description: A top-level wrapper for updating a notification rule for a user + example: + data: + attributes: + category: high_urgency + channel_settings: + method: sms + type: phone + delay_minutes: 1 + id: 2462ace1-49e2-aab1-xc4f-29cc4ae1105n7 + relationships: + channel: + data: + id: 1562fab3-a8c2-49e2-8f3a-28dcda2405e2 + type: notification_channels + type: notification_rules + properties: + data: + $ref: '#/components/schemas/UpdateOnCallNotificationRuleRequestData' + required: + - data + type: object + UpdateOnCallNotificationRuleRequestAttributes: + description: Attributes for creating or modifying an on-call notification rule. + properties: + category: + $ref: '#/components/schemas/OnCallNotificationRuleCategory' + channel_settings: + $ref: '#/components/schemas/OnCallNotificationRuleChannelSettings' + description: Configuration for the associated channel, if necessary + nullable: true + delay_minutes: + description: The number of minutes that will elapse before this rule is + evaluated. 0 indicates immediate evaluation + format: int64 + type: integer + type: object + UpdateOnCallNotificationRuleRequestData: + description: Data for updating an on-call notification rule + properties: + attributes: + $ref: '#/components/schemas/UpdateOnCallNotificationRuleRequestAttributes' + id: + description: Unique identifier for the rule + type: string + relationships: + $ref: '#/components/schemas/OnCallNotificationRuleRelationships' + type: + $ref: '#/components/schemas/OnCallNotificationRuleType' + required: + - type + type: object UpdateOpenAPIResponse: description: Response for `UpdateOpenAPI`. properties: @@ -56984,6 +57155,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 +57616,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 +68903,7 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - incident_notification_settings_read + - AuthZ: [] summary: List incident notification rules tags: - Incidents @@ -68912,8 +69102,7 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - incident_settings_read + - AuthZ: [] summary: List incident notification templates tags: - Incidents @@ -69028,7 +69217,8 @@ paths: - apiKeyAuth: [] appKeyAuth: [] - AuthZ: - - incident_settings_read + - incident_read + - incident_write summary: Get incident notification template tags: - Incidents @@ -69118,6 +69308,7 @@ paths: x-permission: operator: OR permissions: + - incident_settings_read - incident_read x-unstable: '**Note**: This endpoint is in public beta. @@ -69159,7 +69350,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 +69640,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. @@ -76385,6 +76662,255 @@ paths: operator: AND permissions: - on_call_read + /api/v2/on-call/users/{user_id}/notification-rules: + get: + description: List the notification rules for a user. The authenticated user + must be the target user or have the `on_call_admin` permission + operationId: ListUserNotificationRules + parameters: + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `channel`.' + in: query + name: include + schema: + type: string + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListOnCallNotificationRulesResponse' + 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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List On-Call notification rules for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_read + post: + description: Create a new notification rule for a user. The authenticated user + must be the target user or have the `on_call_admin` permission + operationId: CreateUserNotificationRule + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateOnCallNotificationRuleRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/OnCallNotificationRule' + description: Created + '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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create an On-Call notification rule for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_respond + /api/v2/on-call/users/{user_id}/notification-rules/{rule_id}: + delete: + description: Delete a notification rule for a user. The authenticated user must + be the target user or have the `on_call_admin` permission + operationId: DeleteUserNotificationRule + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The rule ID + in: path + name: rule_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + responses: + '204': + description: No Content + '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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Delete an On-Call notification rule for a user + tags: + - On-Call + x-permission: + operator: OR + permissions: + - on_call_respond + get: + description: Get a notification rule for a user. The authenticated user must + be the target user or have the `on_call_admin` permission + operationId: GetUserNotificationRule + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The rule ID + in: path + name: rule_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `channel`.' + in: query + name: include + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OnCallNotificationRule' + 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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get an On-Call notification rule for a user + tags: + - On-Call + x-permission: + operator: OR + permissions: + - on_call_read + put: + description: Update a notification rule for a user. The authenticated user must + be the target user or have the `on_call_admin` permission + operationId: UpdateUserNotificationRule + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The rule ID + in: path + name: rule_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `channel`.' + in: query + name: include + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOnCallNotificationRuleRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OnCallNotificationRule' + 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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update an On-Call notification rule for a user + tags: + - On-Call + x-permission: + operator: OR + permissions: + - on_call_read /api/v2/org_configs: get: description: Returns all Org Configs (name, description, and value). 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 a19a831fa751..000000000000 --- 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 09d1e036142a..000000000000 --- 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 65913c025d92..000000000000 --- 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 d3b9976aa060..000000000000 --- 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/cassettes/features/v2/on-call/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response.frozen b/cassettes/features/v2/on-call/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response.frozen new file mode 100644 index 000000000000..fd26d2eef230 --- /dev/null +++ b/cassettes/features/v2/on-call/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response.frozen @@ -0,0 +1 @@ +2025-12-16T19:30:04.834Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response.yml b/cassettes/features/v2/on-call/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response.yml new file mode 100644 index 000000000000..c2d713b2610c --- /dev/null +++ b/cassettes/features/v2/on-call/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response.yml @@ -0,0 +1,88 @@ +http_interactions: +- recorded_at: Tue, 16 Dec 2025 19:30:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Create_an_On_Call_notification_rule_for_a_user_returns_Created_response-1765913404@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"2ab53f07-289f-4060-b21a-3d704096aadf","attributes":{"name":null,"handle":"test-create_an_on_call_notification_rule_for_a_user_returns_created_response-1765913404@datadoghq.com","created_at":"2025-12-16T19:30:05.014723+00:00","modified_at":"2025-12-16T19:30:05.014723+00:00","email":"test-create_an_on_call_notification_rule_for_a_user_returns_created_response-1765913404@datadoghq.com","icon":"https://secure.gravatar.com/avatar/c5ddb15c50d998db06711e0a31591216?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 19:30:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"config":{"address":"test-create_an_on_call_notification_rule_for_a_user_returns_created_response-1765913404@datadoghq.com","formats":["html"],"type":"email"}},"type":"notification_channels"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/2ab53f07-289f-4060-b21a-3d704096aadf/notification-channels + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"ca8520ce-27e0-4bba-997f-004047cda45d","type":"notification_channels","attributes":{"active":true,"config":{"type":"email","address":"test-create_an_on_call_notification_rule_for_a_user_returns_created_response-1765913404@datadoghq.com","formats":["html"]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 19:30:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"ca8520ce-27e0-4bba-997f-004047cda45d","type":"notification_channels"}}},"type":"notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/2ab53f07-289f-4060-b21a-3d704096aadf/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"4e551e4f-d1aa-4fce-8cc7-c6bf98925efe","type":"notification_rules","attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"ca8520ce-27e0-4bba-997f-004047cda45d","type":"notification_channels"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 19:30:04 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/2ab53f07-289f-4060-b21a-3d704096aadf + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response.frozen b/cassettes/features/v2/on-call/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response.frozen new file mode 100644 index 000000000000..3b1ee11b9e91 --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2025-12-16T19:29:36.256Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response.yml b/cassettes/features/v2/on-call/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response.yml new file mode 100644 index 000000000000..63b35abbbc6f --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response.yml @@ -0,0 +1,104 @@ +http_interactions: +- recorded_at: Tue, 16 Dec 2025 19:29:36 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Delete_an_On_Call_notification_rule_for_a_user_returns_No_Content_response-1765913376@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"5ebbe76d-c072-4909-ba24-ffa71f4597a0","attributes":{"name":null,"handle":"test-delete_an_on_call_notification_rule_for_a_user_returns_no_content_response-1765913376@datadoghq.com","created_at":"2025-12-16T19:29:36.461504+00:00","modified_at":"2025-12-16T19:29:36.461504+00:00","email":"test-delete_an_on_call_notification_rule_for_a_user_returns_no_content_response-1765913376@datadoghq.com","icon":"https://secure.gravatar.com/avatar/dad7a8a5508730e67ad8dea90bcc189c?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 19:29:36 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"config":{"address":"test-delete_an_on_call_notification_rule_for_a_user_returns_no_content_response-1765913376@datadoghq.com","formats":["html"],"type":"email"}},"type":"notification_channels"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/5ebbe76d-c072-4909-ba24-ffa71f4597a0/notification-channels + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"a557eb68-8b0a-48cf-ac65-73aede790994","type":"notification_channels","attributes":{"active":true,"config":{"type":"email","address":"test-delete_an_on_call_notification_rule_for_a_user_returns_no_content_response-1765913376@datadoghq.com","formats":["html"]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 19:29:36 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"a557eb68-8b0a-48cf-ac65-73aede790994","type":"notification_channels"}}},"type":"notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/5ebbe76d-c072-4909-ba24-ffa71f4597a0/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"71e9f009-5a69-4946-992e-d76b05d1ae61","type":"notification_rules","attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"a557eb68-8b0a-48cf-ac65-73aede790994","type":"notification_channels"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 19:29:36 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/users/5ebbe76d-c072-4909-ba24-ffa71f4597a0/notification-rules/71e9f009-5a69-4946-992e-d76b05d1ae61 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 16 Dec 2025 19:29:36 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/5ebbe76d-c072-4909-ba24-ffa71f4597a0 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response.frozen b/cassettes/features/v2/on-call/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response.frozen new file mode 100644 index 000000000000..d938f1a43ed6 --- /dev/null +++ b/cassettes/features/v2/on-call/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-12-16T21:16:24.271Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response.yml b/cassettes/features/v2/on-call/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response.yml new file mode 100644 index 000000000000..0be49b7b22eb --- /dev/null +++ b/cassettes/features/v2/on-call/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response.yml @@ -0,0 +1,106 @@ +http_interactions: +- recorded_at: Tue, 16 Dec 2025 21:16:24 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Get_an_On_Call_notification_rule_for_a_user_returns_OK_response-1765919784@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"b2a555c9-ac2d-430d-b321-10e4c0201ce3","attributes":{"name":null,"handle":"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com","created_at":"2025-12-16T21:16:24.480454+00:00","modified_at":"2025-12-16T21:16:24.480454+00:00","email":"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com","icon":"https://secure.gravatar.com/avatar/8e38ab440c2cdd2808a61dfa83f734d7?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 21:16:24 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"config":{"address":"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com","formats":["html"],"type":"email"}},"type":"notification_channels"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/b2a555c9-ac2d-430d-b321-10e4c0201ce3/notification-channels + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"767234b0-0c79-4092-9b44-a8963021795b","type":"notification_channels","attributes":{"active":true,"config":{"type":"email","address":"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com","formats":["html"]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 21:16:24 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"767234b0-0c79-4092-9b44-a8963021795b","type":"notification_channels"}}},"type":"notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/b2a555c9-ac2d-430d-b321-10e4c0201ce3/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"d07cc90b-4fc5-455f-8f57-45d48a658bc6","type":"notification_rules","attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"767234b0-0c79-4092-9b44-a8963021795b","type":"notification_channels"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 21:16:24 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/users/b2a555c9-ac2d-430d-b321-10e4c0201ce3/notification-rules/d07cc90b-4fc5-455f-8f57-45d48a658bc6?include=channel + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"d07cc90b-4fc5-455f-8f57-45d48a658bc6","type":"notification_rules","attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"767234b0-0c79-4092-9b44-a8963021795b","type":"notification_channels"}}}},"included":[{"id":"767234b0-0c79-4092-9b44-a8963021795b","type":"notification_channels","attributes":{"active":true,"config":{"type":"email","address":"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com","formats":["html"]}}}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 16 Dec 2025 21:16:24 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/b2a555c9-ac2d-430d-b321-10e4c0201ce3 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/List-On-Call-notification-rules-for-a-user-returns-OK-response.frozen b/cassettes/features/v2/on-call/List-On-Call-notification-rules-for-a-user-returns-OK-response.frozen new file mode 100644 index 000000000000..11e9c7c90b21 --- /dev/null +++ b/cassettes/features/v2/on-call/List-On-Call-notification-rules-for-a-user-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-12-16T21:16:48.356Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/List-On-Call-notification-rules-for-a-user-returns-OK-response.yml b/cassettes/features/v2/on-call/List-On-Call-notification-rules-for-a-user-returns-OK-response.yml new file mode 100644 index 000000000000..c843ec8ffd45 --- /dev/null +++ b/cassettes/features/v2/on-call/List-On-Call-notification-rules-for-a-user-returns-OK-response.yml @@ -0,0 +1,106 @@ +http_interactions: +- recorded_at: Tue, 16 Dec 2025 21:16:48 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-List_On_Call_notification_rules_for_a_user_returns_OK_response-1765919808@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"0730802a-ee45-404b-a21d-5908d4c6b3c4","attributes":{"name":null,"handle":"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com","created_at":"2025-12-16T21:16:48.579239+00:00","modified_at":"2025-12-16T21:16:48.579239+00:00","email":"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com","icon":"https://secure.gravatar.com/avatar/c2f584fb6a42fbc0f0aad204ea40c0fc?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 21:16:48 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"config":{"address":"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com","formats":["html"],"type":"email"}},"type":"notification_channels"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/0730802a-ee45-404b-a21d-5908d4c6b3c4/notification-channels + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"3073e724-15e8-4aec-897a-478e31cca3a8","type":"notification_channels","attributes":{"active":true,"config":{"type":"email","address":"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com","formats":["html"]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 21:16:48 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"3073e724-15e8-4aec-897a-478e31cca3a8","type":"notification_channels"}}},"type":"notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/0730802a-ee45-404b-a21d-5908d4c6b3c4/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"d93215d1-85c1-4528-a92f-1b604c1f4b2a","type":"notification_rules","attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"3073e724-15e8-4aec-897a-478e31cca3a8","type":"notification_channels"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Dec 2025 21:16:48 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/users/0730802a-ee45-404b-a21d-5908d4c6b3c4/notification-rules?include=channel + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"d93215d1-85c1-4528-a92f-1b604c1f4b2a","type":"notification_rules","attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"3073e724-15e8-4aec-897a-478e31cca3a8","type":"notification_channels"}}}}],"included":[{"id":"3073e724-15e8-4aec-897a-478e31cca3a8","type":"notification_channels","attributes":{"active":true,"config":{"type":"email","address":"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com","formats":["html"]}}}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 16 Dec 2025 21:16:48 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/0730802a-ee45-404b-a21d-5908d4c6b3c4 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response.frozen b/cassettes/features/v2/on-call/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response.frozen new file mode 100644 index 000000000000..f55a35ff1b8c --- /dev/null +++ b/cassettes/features/v2/on-call/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-12-17T01:04:35.713Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response.yml b/cassettes/features/v2/on-call/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response.yml new file mode 100644 index 000000000000..4b7089ba6238 --- /dev/null +++ b/cassettes/features/v2/on-call/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response.yml @@ -0,0 +1,110 @@ +http_interactions: +- recorded_at: Wed, 17 Dec 2025 01:04:35 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Update_an_On_Call_notification_rule_for_a_user_returns_OK_response-1765933475@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"4ef9cf45-30a8-4117-9b56-adba96671dff","attributes":{"name":null,"handle":"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com","created_at":"2025-12-17T01:04:36.246950+00:00","modified_at":"2025-12-17T01:04:36.246950+00:00","email":"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com","icon":"https://secure.gravatar.com/avatar/53cbcba1803f4569f759fcc6b3f90bb6?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 17 Dec 2025 01:04:35 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"config":{"address":"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com","formats":["html"],"type":"email"}},"type":"notification_channels"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/4ef9cf45-30a8-4117-9b56-adba96671dff/notification-channels + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"7fc326c9-f3dc-4858-80c2-d88c24dcf54b","type":"notification_channels","attributes":{"active":true,"config":{"type":"email","address":"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com","formats":["html"]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Wed, 17 Dec 2025 01:04:35 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"7fc326c9-f3dc-4858-80c2-d88c24dcf54b","type":"notification_channels"}}},"type":"notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/4ef9cf45-30a8-4117-9b56-adba96671dff/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"c7b724f1-eb73-43d4-889f-d8f3e6fbe664","type":"notification_rules","attributes":{"category":"high_urgency","delay_minutes":0},"relationships":{"channel":{"data":{"id":"7fc326c9-f3dc-4858-80c2-d88c24dcf54b","type":"notification_channels"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Wed, 17 Dec 2025 01:04:35 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"category":"high_urgency","delay_minutes":1},"id":"c7b724f1-eb73-43d4-889f-d8f3e6fbe664","relationships":{"channel":{"data":{"id":"7fc326c9-f3dc-4858-80c2-d88c24dcf54b","type":"notification_channels"}}},"type":"notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/on-call/users/4ef9cf45-30a8-4117-9b56-adba96671dff/notification-rules/c7b724f1-eb73-43d4-889f-d8f3e6fbe664?include=channel + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"c7b724f1-eb73-43d4-889f-d8f3e6fbe664","type":"notification_rules","attributes":{"category":"high_urgency","delay_minutes":1},"relationships":{"channel":{"data":{"id":"7fc326c9-f3dc-4858-80c2-d88c24dcf54b","type":"notification_channels"}}}},"included":[{"id":"7fc326c9-f3dc-4858-80c2-d88c24dcf54b","type":"notification_channels","attributes":{"active":true,"config":{"type":"email","address":"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com","formats":["html"]}}}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 17 Dec 2025 01:04:35 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/4ef9cf45-30a8-4117-9b56-adba96671dff + response: + body: + encoding: UTF-8 + string: '' + headers: {} + 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 000000000000..12d5b71c3109 --- /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 000000000000..26840fbf5947 --- /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 abeee4a5fbf3..b0b3a6015b7c 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 8d22a1aa8fd8..000000000000 --- 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 000000000000..78da75ee4451 --- /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 e5fa7b0b9e78..000000000000 --- 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 f1e0fda6cb5f..000000000000 --- 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/examples/v2/on-call/CreateUserNotificationRule.rb b/examples/v2/on-call/CreateUserNotificationRule.rb new file mode 100644 index 000000000000..5e8fc97cc0f9 --- /dev/null +++ b/examples/v2/on-call/CreateUserNotificationRule.rb @@ -0,0 +1,29 @@ +# Create an On-Call notification rule for a user returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "oncall_email_notification_channel" in the system +ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID = ENV["ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID"] + +body = DatadogAPIClient::V2::CreateOnCallNotificationRuleRequest.new({ + data: DatadogAPIClient::V2::CreateOnCallNotificationRuleRequestData.new({ + attributes: DatadogAPIClient::V2::OnCallNotificationRuleRequestAttributes.new({ + category: DatadogAPIClient::V2::OnCallNotificationRuleCategory::HIGH_URGENCY, + delay_minutes: 0, + }), + relationships: DatadogAPIClient::V2::OnCallNotificationRuleRelationships.new({ + channel: DatadogAPIClient::V2::OnCallNotificationRuleChannelRelationship.new({ + data: DatadogAPIClient::V2::OnCallNotificationRuleChannelRelationshipData.new({ + id: ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID, + type: DatadogAPIClient::V2::NotificationChannelType::NOTIFICATION_CHANNELS, + }), + }), + }), + type: DatadogAPIClient::V2::OnCallNotificationRuleType::NOTIFICATION_RULES, + }), +}) +p api_instance.create_user_notification_rule(USER_DATA_ID, body) diff --git a/examples/v2/on-call/DeleteUserNotificationRule.rb b/examples/v2/on-call/DeleteUserNotificationRule.rb new file mode 100644 index 000000000000..744cf7519082 --- /dev/null +++ b/examples/v2/on-call/DeleteUserNotificationRule.rb @@ -0,0 +1,11 @@ +# Delete an On-Call notification rule for a user returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "oncall_email_notification_rule" in the system +ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID = ENV["ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID"] +api_instance.delete_user_notification_rule(USER_DATA_ID, ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID) diff --git a/examples/v2/on-call/GetUserNotificationRule.rb b/examples/v2/on-call/GetUserNotificationRule.rb new file mode 100644 index 000000000000..52f42d5b6ab6 --- /dev/null +++ b/examples/v2/on-call/GetUserNotificationRule.rb @@ -0,0 +1,14 @@ +# Get an On-Call notification rule for a user returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "oncall_email_notification_rule" in the system +ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID = ENV["ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID"] +opts = { + include: "channel", +} +p api_instance.get_user_notification_rule(USER_DATA_ID, ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID, opts) diff --git a/examples/v2/on-call/ListUserNotificationRules.rb b/examples/v2/on-call/ListUserNotificationRules.rb new file mode 100644 index 000000000000..55d291be31b9 --- /dev/null +++ b/examples/v2/on-call/ListUserNotificationRules.rb @@ -0,0 +1,11 @@ +# List On-Call notification rules for a user returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] +opts = { + include: "channel", +} +p api_instance.list_user_notification_rules(USER_DATA_ID, opts) diff --git a/examples/v2/on-call/UpdateUserNotificationRule.rb b/examples/v2/on-call/UpdateUserNotificationRule.rb new file mode 100644 index 000000000000..179d5a528f82 --- /dev/null +++ b/examples/v2/on-call/UpdateUserNotificationRule.rb @@ -0,0 +1,36 @@ +# Update an On-Call notification rule for a user returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "oncall_email_notification_rule" in the system +ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID = ENV["ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID"] + +# there is a valid "oncall_email_notification_channel" in the system +ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID = ENV["ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID"] + +body = DatadogAPIClient::V2::UpdateOnCallNotificationRuleRequest.new({ + data: DatadogAPIClient::V2::UpdateOnCallNotificationRuleRequestData.new({ + attributes: DatadogAPIClient::V2::UpdateOnCallNotificationRuleRequestAttributes.new({ + category: DatadogAPIClient::V2::OnCallNotificationRuleCategory::HIGH_URGENCY, + delay_minutes: 1, + }), + id: ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID, + relationships: DatadogAPIClient::V2::OnCallNotificationRuleRelationships.new({ + channel: DatadogAPIClient::V2::OnCallNotificationRuleChannelRelationship.new({ + data: DatadogAPIClient::V2::OnCallNotificationRuleChannelRelationshipData.new({ + id: ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID, + type: DatadogAPIClient::V2::NotificationChannelType::NOTIFICATION_CHANNELS, + }), + }), + }), + type: DatadogAPIClient::V2::OnCallNotificationRuleType::NOTIFICATION_RULES, + }), +}) +opts = { + include: "channel", +} +p api_instance.update_user_notification_rule(USER_DATA_ID, ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID, body, opts) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 3a27e10133ca..30bfb170383c 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.DeleteIncidentAttachment" => { + "incident_id" => "String", + "attachment_id" => "Object", }, - "v2.UpdateIncidentAttachments" => { + "v2.UpdateIncidentAttachment" => { "incident_id" => "String", - "include" => "Array", - "body" => "IncidentAttachmentUpdateRequest", + "attachment_id" => "Object", + "include" => "String", + "body" => "PatchAttachmentRequest", }, "v2.ListIncidentImpacts" => { "incident_id" => "String", @@ -2679,6 +2689,29 @@ "user_id" => "String", "channel_id" => "String", }, + "v2.ListUserNotificationRules" => { + "include" => "String", + "user_id" => "String", + }, + "v2.CreateUserNotificationRule" => { + "user_id" => "String", + "body" => "CreateOnCallNotificationRuleRequest", + }, + "v2.DeleteUserNotificationRule" => { + "user_id" => "String", + "rule_id" => "String", + }, + "v2.GetUserNotificationRule" => { + "user_id" => "String", + "rule_id" => "String", + "include" => "String", + }, + "v2.UpdateUserNotificationRule" => { + "user_id" => "String", + "rule_id" => "String", + "include" => "String", + "body" => "UpdateOnCallNotificationRuleRequest", + }, "v2.CreateOnCallPage" => { "body" => "CreatePageRequest", }, diff --git a/features/v2/given.json b/features/v2/given.json index 5e9aa4d3b5fe..7b4bb83964b0 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": [ @@ -799,6 +783,22 @@ "tag": "On-Call", "operationId": "CreateUserNotificationChannel" }, + { + "parameters": [ + { + "name": "user_id", + "source": "user.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"notification_rules\",\n \"attributes\": {\n \"delay_minutes\": 0,\n \"category\": \"high_urgency\"\n },\n \"relationships\": {\n \"channel\": {\n \"data\": {\n \"id\": \"{{ oncall_email_notification_channel.data.id }}\",\n \"type\": \"notification_channels\"\n }\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"oncall_email_notification_rule\" in the system", + "key": "oncall_email_notification_rule", + "tag": "On-Call", + "operationId": "CreateUserNotificationRule" + }, { "parameters": [ { diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index 12ab3e2f5ba5..a101f5f4af44 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/on-call.feature b/features/v2/on-call.feature index 9f4750eef79a..0f4b2a0e3402 100644 --- a/features/v2/on-call.feature +++ b/features/v2/on-call.feature @@ -70,6 +70,32 @@ Feature: On-Call When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/on-call + Scenario: Create an On-Call notification rule for a user returns "Bad Request" response + Given new "CreateUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "high_urgency", "channel_settings": {"method": "sms", "type": "phone"}, "delay_minutes": 1}, "relationships": {"channel": {"data": {"id": "1562fab3-a8c2-49e2-8f3a-28dcda2405e2", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/on-call + Scenario: Create an On-Call notification rule for a user returns "Created" response + Given new "CreateUserNotificationRule" request + And there is a valid "user" in the system + And request contains "user_id" parameter from "user.data.id" + And there is a valid "oncall_email_notification_channel" in the system + And body with value {"data": {"attributes": {"category": "high_urgency", "delay_minutes": 0}, "relationships": {"channel": {"data": {"id": "{{ oncall_email_notification_channel.data.id }}", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/on-call + Scenario: Create an On-Call notification rule for a user returns "Not Found" response + Given new "CreateUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "high_urgency", "channel_settings": {"method": "sms", "type": "phone"}, "delay_minutes": 1}, "relationships": {"channel": {"data": {"id": "1562fab3-a8c2-49e2-8f3a-28dcda2405e2", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/on-call Scenario: Delete On-Call escalation policy returns "No Content" response Given new "DeleteOnCallEscalationPolicy" request @@ -130,6 +156,33 @@ Feature: On-Call When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/on-call + Scenario: Delete an On-Call notification rule for a user returns "Bad Request" response + Given new "DeleteUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/on-call + Scenario: Delete an On-Call notification rule for a user returns "No Content" response + Given new "DeleteUserNotificationRule" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And there is a valid "oncall_email_notification_rule" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "rule_id" parameter from "oncall_email_notification_rule.data.id" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/on-call + Scenario: Delete an On-Call notification rule for a user returns "Not Found" response + Given new "DeleteUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/on-call Scenario: Get On-Call escalation policy returns "Bad Request" response Given new "GetOnCallEscalationPolicy" request @@ -207,6 +260,36 @@ Feature: On-Call And the response "data.attributes.config.type" is equal to "email" And the response "data.attributes.config.address" is equal to "{{ user.data.attributes.email }}" + @generated @skip @team:DataDog/on-call + Scenario: Get an On-Call notification rule for a user returns "Bad Request" response + Given new "GetUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/on-call + Scenario: Get an On-Call notification rule for a user returns "Not Found" response + Given new "GetUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/on-call + Scenario: Get an On-Call notification rule for a user returns "OK" response + Given new "GetUserNotificationRule" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And there is a valid "oncall_email_notification_rule" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "rule_id" parameter from "oncall_email_notification_rule.data.id" + And request contains "include" parameter with value "channel" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.category" is equal to "high_urgency" + And the response "included" has length 1 + @generated @skip @team:DataDog/on-call Scenario: Get scheduled on-call user returns "Bad Request" response Given new "GetScheduleOnCallUser" request @@ -283,6 +366,33 @@ Feature: On-Call And the response "data[0].attributes.config.type" is equal to "email" And the response "data[0].attributes.config.address" is equal to "{{ user.data.attributes.email }}" + @generated @skip @team:DataDog/on-call + Scenario: List On-Call notification rules for a user returns "Bad Request" response + Given new "ListUserNotificationRules" request + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/on-call + Scenario: List On-Call notification rules for a user returns "Not Found" response + Given new "ListUserNotificationRules" request + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/on-call + Scenario: List On-Call notification rules for a user returns "OK" response + Given new "ListUserNotificationRules" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And there is a valid "oncall_email_notification_rule" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "include" parameter with value "channel" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "included" has length 1 + @skip-python @team:DataDog/on-call Scenario: Set On-Call team routing rules returns "OK" response Given new "SetOnCallTeamRoutingRules" request @@ -350,3 +460,36 @@ Feature: On-Call And body with value {"data": { "id": "{{ schedule.data.id }}", "attributes": {"layers": [{"id": "{{ schedule.data.relationships.layers.data[0].id }}" , "effective_date": "{{ timeISO('now - 10d') }}", "end_date": "{{ timeISO('now + 10d') }}", "interval": {"seconds": 3600}, "members": [{"user": {"id": "{{user.data.id}}"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "{{ timeISO('now - 5d') }}"}], "name": "{{ unique }}", "time_zone": "America/New_York"}, "relationships": {"teams": {"data": [{"id": "{{dd_team.data.id}}", "type": "teams"}]}}, "type": "schedules"}} When the request is sent Then the response status is 200 OK + + @generated @skip @team:DataDog/on-call + Scenario: Update an On-Call notification rule for a user returns "Bad Request" response + Given new "UpdateUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "high_urgency", "channel_settings": {"method": "sms", "type": "phone"}, "delay_minutes": 1}, "id": "2462ace1-49e2-aab1-xc4f-29cc4ae1105n7", "relationships": {"channel": {"data": {"id": "1562fab3-a8c2-49e2-8f3a-28dcda2405e2", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/on-call + Scenario: Update an On-Call notification rule for a user returns "Not Found" response + Given new "UpdateUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "high_urgency", "channel_settings": {"method": "sms", "type": "phone"}, "delay_minutes": 1}, "id": "2462ace1-49e2-aab1-xc4f-29cc4ae1105n7", "relationships": {"channel": {"data": {"id": "1562fab3-a8c2-49e2-8f3a-28dcda2405e2", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/on-call + Scenario: Update an On-Call notification rule for a user returns "OK" response + Given new "UpdateUserNotificationRule" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And there is a valid "oncall_email_notification_rule" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "rule_id" parameter from "oncall_email_notification_rule.data.id" + And body with value {"data": {"attributes": {"category": "high_urgency", "delay_minutes": 1}, "id": "{{ oncall_email_notification_rule.data.id }}", "relationships": {"channel": {"data": {"id": "{{ oncall_email_notification_channel.data.id }}", "type": "notification_channels"}}}, "type": "notification_rules"}} + And request contains "include" parameter with value "channel" + When the request is sent + Then the response status is 200 OK + And the response "included" has length 1 + And the response "data.attributes.delay_minutes" is equal to 1 diff --git a/features/v2/undo.json b/features/v2/undo.json index e0f0b98d0c96..2116e11f2aef 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" @@ -2964,6 +2987,36 @@ "type": "safe" } }, + "ListUserNotificationRules": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "CreateUserNotificationRule": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "DeleteUserNotificationRule": { + "tag": "On-Call", + "undo": { + "type": "idempotent" + } + }, + "GetUserNotificationRule": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "UpdateUserNotificationRule": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 5afe995637c9..95ddf1221cda 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 3e6e421122a4..136e5b7ed874 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", @@ -1721,6 +1735,8 @@ def overrides "v2.create_notification_rule_parameters" => "CreateNotificationRuleParameters", "v2.create_notification_rule_parameters_data" => "CreateNotificationRuleParametersData", "v2.create_notification_rule_parameters_data_attributes" => "CreateNotificationRuleParametersDataAttributes", + "v2.create_on_call_notification_rule_request" => "CreateOnCallNotificationRuleRequest", + "v2.create_on_call_notification_rule_request_data" => "CreateOnCallNotificationRuleRequestData", "v2.create_open_api_response" => "CreateOpenAPIResponse", "v2.create_open_api_response_attributes" => "CreateOpenAPIResponseAttributes", "v2.create_open_api_response_data" => "CreateOpenAPIResponseData", @@ -2499,24 +2515,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", @@ -2820,6 +2819,7 @@ def overrides "v2.list_findings_response" => "ListFindingsResponse", "v2.list_kind_catalog_response" => "ListKindCatalogResponse", "v2.list_notification_channels_response" => "ListNotificationChannelsResponse", + "v2.list_on_call_notification_rules_response" => "ListOnCallNotificationRulesResponse", "v2.list_pipelines_response" => "ListPipelinesResponse", "v2.list_pipelines_response_meta" => "ListPipelinesResponseMeta", "v2.list_powerpacks_response" => "ListPowerpacksResponse", @@ -3372,7 +3372,20 @@ def overrides "v2.okta_integration" => "OktaIntegration", "v2.okta_integration_type" => "OktaIntegrationType", "v2.okta_integration_update" => "OktaIntegrationUpdate", + "v2.on_call_notification_rule" => "OnCallNotificationRule", + "v2.on_call_notification_rule_attributes" => "OnCallNotificationRuleAttributes", + "v2.on_call_notification_rule_category" => "OnCallNotificationRuleCategory", + "v2.on_call_notification_rule_channel_relationship" => "OnCallNotificationRuleChannelRelationship", + "v2.on_call_notification_rule_channel_relationship_data" => "OnCallNotificationRuleChannelRelationshipData", + "v2.on_call_notification_rule_channel_settings" => "OnCallNotificationRuleChannelSettings", + "v2.on_call_notification_rule_data" => "OnCallNotificationRuleData", + "v2.on_call_notification_rule_relationships" => "OnCallNotificationRuleRelationships", + "v2.on_call_notification_rule_request_attributes" => "OnCallNotificationRuleRequestAttributes", + "v2.on_call_notification_rules_included" => "OnCallNotificationRulesIncluded", + "v2.on_call_notification_rule_type" => "OnCallNotificationRuleType", "v2.on_call_page_target_type" => "OnCallPageTargetType", + "v2.on_call_phone_notification_rule_method" => "OnCallPhoneNotificationRuleMethod", + "v2.on_call_phone_notification_rule_settings" => "OnCallPhoneNotificationRuleSettings", "v2.on_demand_concurrency_cap" => "OnDemandConcurrencyCap", "v2.on_demand_concurrency_cap_attributes" => "OnDemandConcurrencyCapAttributes", "v2.on_demand_concurrency_cap_response" => "OnDemandConcurrencyCapResponse", @@ -3459,6 +3472,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", @@ -4496,6 +4513,9 @@ def overrides "v2.update_deployment_rule_params" => "UpdateDeploymentRuleParams", "v2.update_deployment_rule_params_data" => "UpdateDeploymentRuleParamsData", "v2.update_deployment_rule_params_data_attributes" => "UpdateDeploymentRuleParamsDataAttributes", + "v2.update_on_call_notification_rule_request" => "UpdateOnCallNotificationRuleRequest", + "v2.update_on_call_notification_rule_request_attributes" => "UpdateOnCallNotificationRuleRequestAttributes", + "v2.update_on_call_notification_rule_request_data" => "UpdateOnCallNotificationRuleRequestData", "v2.update_open_api_response" => "UpdateOpenAPIResponse", "v2.update_open_api_response_attributes" => "UpdateOpenAPIResponseAttributes", "v2.update_open_api_response_data" => "UpdateOpenAPIResponseData", @@ -4540,6 +4560,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 +4602,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 a1f004c3f4be..ca8a628c1db8 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/api/on_call_api.rb b/lib/datadog_api_client/v2/api/on_call_api.rb index f3be233f2733..1ad0475daab6 100644 --- a/lib/datadog_api_client/v2/api/on_call_api.rb +++ b/lib/datadog_api_client/v2/api/on_call_api.rb @@ -233,6 +233,78 @@ def create_user_notification_channel_with_http_info(user_id, body, opts = {}) return data, status_code, headers end + # Create an On-Call notification rule for a user. + # + # @see #create_user_notification_rule_with_http_info + def create_user_notification_rule(user_id, body, opts = {}) + data, _status_code, _headers = create_user_notification_rule_with_http_info(user_id, body, opts) + data + end + + # Create an On-Call notification rule for a user. + # + # Create a new notification rule for a user. The authenticated user must be the target user or have the `on_call_admin` permission + # + # @param user_id [String] The user ID + # @param body [CreateOnCallNotificationRuleRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(OnCallNotificationRule, Integer, Hash)>] OnCallNotificationRule data, response status code and response headers + def create_user_notification_rule_with_http_info(user_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.create_user_notification_rule ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.create_user_notification_rule" + 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 OnCallAPI.create_user_notification_rule" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-rules'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'OnCallNotificationRule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_user_notification_rule, + :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: OnCallAPI#create_user_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete On-Call escalation policy. # # @see #delete_on_call_escalation_policy_with_http_info @@ -433,6 +505,76 @@ def delete_user_notification_channel_with_http_info(user_id, channel_id, opts = return data, status_code, headers end + # Delete an On-Call notification rule for a user. + # + # @see #delete_user_notification_rule_with_http_info + def delete_user_notification_rule(user_id, rule_id, opts = {}) + delete_user_notification_rule_with_http_info(user_id, rule_id, opts) + nil + end + + # Delete an On-Call notification rule for a user. + # + # Delete a notification rule for a user. The authenticated user must be the target user or have the `on_call_admin` permission + # + # @param user_id [String] The user ID + # @param rule_id [String] The rule ID + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_user_notification_rule_with_http_info(user_id, rule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.delete_user_notification_rule ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.delete_user_notification_rule" + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling OnCallAPI.delete_user_notification_rule" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-rules/{rule_id}'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')).sub('{rule_id}', CGI.escape(rule_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_user_notification_rule, + :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: OnCallAPI#delete_user_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get On-Call escalation policy. # # @see #get_on_call_escalation_policy_with_http_info @@ -840,6 +982,78 @@ def get_user_notification_channel_with_http_info(user_id, channel_id, opts = {}) return data, status_code, headers end + # Get an On-Call notification rule for a user. + # + # @see #get_user_notification_rule_with_http_info + def get_user_notification_rule(user_id, rule_id, opts = {}) + data, _status_code, _headers = get_user_notification_rule_with_http_info(user_id, rule_id, opts) + data + end + + # Get an On-Call notification rule for a user. + # + # Get a notification rule for a user. The authenticated user must be the target user or have the `on_call_admin` permission + # + # @param user_id [String] The user ID + # @param rule_id [String] The rule ID + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of included relationships to be returned. Allowed values: `channel`. + # @return [Array<(OnCallNotificationRule, Integer, Hash)>] OnCallNotificationRule data, response status code and response headers + def get_user_notification_rule_with_http_info(user_id, rule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.get_user_notification_rule ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.get_user_notification_rule" + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling OnCallAPI.get_user_notification_rule" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-rules/{rule_id}'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')).sub('{rule_id}', CGI.escape(rule_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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OnCallNotificationRule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_user_notification_rule, + :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::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#get_user_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List On-Call notification channels for a user. # # @see #list_user_notification_channels_with_http_info @@ -905,6 +1119,73 @@ def list_user_notification_channels_with_http_info(user_id, opts = {}) return data, status_code, headers end + # List On-Call notification rules for a user. + # + # @see #list_user_notification_rules_with_http_info + def list_user_notification_rules(user_id, opts = {}) + data, _status_code, _headers = list_user_notification_rules_with_http_info(user_id, opts) + data + end + + # List On-Call notification rules for a user. + # + # List the notification rules for a user. The authenticated user must be the target user or have the `on_call_admin` permission + # + # @param user_id [String] The user ID + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of included relationships to be returned. Allowed values: `channel`. + # @return [Array<(ListOnCallNotificationRulesResponse, Integer, Hash)>] ListOnCallNotificationRulesResponse data, response status code and response headers + def list_user_notification_rules_with_http_info(user_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.list_user_notification_rules ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.list_user_notification_rules" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-rules'.sub('{user_id}', CGI.escape(user_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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListOnCallNotificationRulesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_user_notification_rules, + :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::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#list_user_notification_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Set On-Call team routing rules. # # @see #set_on_call_team_routing_rules_with_http_info @@ -1126,5 +1407,84 @@ def update_on_call_schedule_with_http_info(schedule_id, body, opts = {}) end return data, status_code, headers end + + # Update an On-Call notification rule for a user. + # + # @see #update_user_notification_rule_with_http_info + def update_user_notification_rule(user_id, rule_id, body, opts = {}) + data, _status_code, _headers = update_user_notification_rule_with_http_info(user_id, rule_id, body, opts) + data + end + + # Update an On-Call notification rule for a user. + # + # Update a notification rule for a user. The authenticated user must be the target user or have the `on_call_admin` permission + # + # @param user_id [String] The user ID + # @param rule_id [String] The rule ID + # @param body [UpdateOnCallNotificationRuleRequest] + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of included relationships to be returned. Allowed values: `channel`. + # @return [Array<(OnCallNotificationRule, Integer, Hash)>] OnCallNotificationRule data, response status code and response headers + def update_user_notification_rule_with_http_info(user_id, rule_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.update_user_notification_rule ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.update_user_notification_rule" + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling OnCallAPI.update_user_notification_rule" + 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 OnCallAPI.update_user_notification_rule" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-rules/{rule_id}'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')).sub('{rule_id}', CGI.escape(rule_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] || 'OnCallNotificationRule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_user_notification_rule, + :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::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#update_user_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/attachment.rb b/lib/datadog_api_client/v2/models/attachment.rb new file mode 100644 index 000000000000..b5d701b22d71 --- /dev/null +++ b/lib/datadog_api_client/v2/models/attachment.rb @@ -0,0 +1,117 @@ +=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 Attachment + include BaseGenericModel + + # + attr_accessor :data + + # + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AttachmentData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Attachment` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end 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 7d7f30babd03..5f05d1e4b226 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 9daf2ed57475..24a516aade13 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 6600c413a8ae..7b3a352cb67e 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 6af3c3035a9e..fbdf2e850255 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 3ca77a601429..028da90d22fd 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 d4b480f3f1b5..2d8628582978 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 a71325e18860..852b0d462aa4 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 000000000000..67ffb83eb7f0 --- /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 f8673ab750ec..704e65fa3cfc 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 000000000000..98d20b4f90cd --- /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 e56290e81463..859d31765097 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 b71dd7df0ab0..a5a20a60b807 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 cd89b09d192f..88962d8b8c7d 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/create_on_call_notification_rule_request.rb b/lib/datadog_api_client/v2/models/create_on_call_notification_rule_request.rb new file mode 100644 index 000000000000..52cd06213426 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_on_call_notification_rule_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A top-level wrapper for creating a notification rule for a user + class CreateOnCallNotificationRuleRequest + include BaseGenericModel + + # Data for creating an on-call notification rule + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CreateOnCallNotificationRuleRequestData' + } + 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::CreateOnCallNotificationRuleRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_on_call_notification_rule_request_data.rb b/lib/datadog_api_client/v2/models/create_on_call_notification_rule_request_data.rb new file mode 100644 index 000000000000..923861ee4e91 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_on_call_notification_rule_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 + # Data for creating an on-call notification rule + class CreateOnCallNotificationRuleRequestData + include BaseGenericModel + + # Attributes for creating or modifying an on-call notification rule. + attr_accessor :attributes + + # Relationship object for creating a notification rule + attr_accessor :relationships + + # Indicates that the resource is of type 'notification_rules'. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OnCallNotificationRuleRequestAttributes', + :'relationships' => :'OnCallNotificationRuleRelationships', + :'type' => :'OnCallNotificationRuleType' + } + 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::CreateOnCallNotificationRuleRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @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 && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_response_included_item.rb b/lib/datadog_api_client/v2/models/incident_response_included_item.rb index a508273ef13f..d194f7afe558 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/list_on_call_notification_rules_response.rb b/lib/datadog_api_client/v2/models/list_on_call_notification_rules_response.rb new file mode 100644 index 000000000000..b429e8a53c4e --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_on_call_notification_rules_response.rb @@ -0,0 +1,119 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response type for listing notification rules for a user + class ListOnCallNotificationRulesResponse + include BaseGenericModel + + # + attr_accessor :data + + # + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ListOnCallNotificationRulesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_update_response.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule.rb similarity index 84% rename from lib/datadog_api_client/v2/models/incident_attachment_update_response.rb rename to lib/datadog_api_client/v2/models/on_call_notification_rule.rb index f7c5ea8d2bee..29e5a6512e27 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_update_response.rb +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule.rb @@ -17,15 +17,14 @@ require 'time' module DatadogAPIClient::V2 - # The response object containing the created or updated incident attachments. - class IncidentAttachmentUpdateResponse + # A top-level wrapper for a notification rule + class OnCallNotificationRule include BaseGenericModel - # An array of incident attachments. Only the attachments that were created or updated by the request are - # returned. + # Data for an on-call notification rule attr_reader :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' => :'OnCallNotificationRuleData', + :'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::OnCallNotificationRule` 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') diff --git a/lib/datadog_api_client/v2/models/on_call_notification_rule_attributes.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_attributes.rb new file mode 100644 index 000000000000..68de6f6e71d9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for an on-call notification rule. + class OnCallNotificationRuleAttributes + include BaseGenericModel + + # Specifies the category a notification rule will apply to + attr_accessor :category + + # Defines the configuration for a channel associated with a notification rule + attr_accessor :channel_settings + + # The number of minutes that will elapse before this rule is evaluated. 0 indicates immediate evaluation + attr_accessor :delay_minutes + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'category' => :'category', + :'channel_settings' => :'channel_settings', + :'delay_minutes' => :'delay_minutes' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'OnCallNotificationRuleCategory', + :'channel_settings' => :'OnCallNotificationRuleChannelSettings', + :'delay_minutes' => :'Integer' + } + 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::OnCallNotificationRuleAttributes` 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?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'channel_settings') + self.channel_settings = attributes[:'channel_settings'] + end + + if attributes.key?(:'delay_minutes') + self.delay_minutes = attributes[:'delay_minutes'] + 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 && + category == o.category && + channel_settings == o.channel_settings && + delay_minutes == o.delay_minutes && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, channel_settings, delay_minutes, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/on_call_notification_rule_category.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_category.rb new file mode 100644 index 000000000000..79c0bf186f14 --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_category.rb @@ -0,0 +1,27 @@ +=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 + # Specifies the category a notification rule will apply to + class OnCallNotificationRuleCategory + include BaseEnumModel + + HIGH_URGENCY = "high_urgency".freeze + LOW_URGENCY = "low_urgency".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/on_call_notification_rule_channel_relationship.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_channel_relationship.rb new file mode 100644 index 000000000000..ec3a5b1aba97 --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_channel_relationship.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship object for creating a notification rule + class OnCallNotificationRuleChannelRelationship + include BaseGenericModel + + # Channel relationship data for creating a notification rule + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'OnCallNotificationRuleChannelRelationshipData' + } + 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::OnCallNotificationRuleChannelRelationship` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/on_call_notification_rule_channel_relationship_data.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_channel_relationship_data.rb new file mode 100644 index 000000000000..44e3f2dc35bf --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_channel_relationship_data.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 + # Channel relationship data for creating a notification rule + class OnCallNotificationRuleChannelRelationshipData + include BaseGenericModel + + # ID of the notification channel + attr_accessor :id + + # Indicates that the resource is of type 'notification_channels'. + attr_accessor :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' => :'NotificationChannelType' + } + 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::OnCallNotificationRuleChannelRelationshipData` 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 + + # 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_attachment_update_attributes.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_channel_settings.rb similarity index 92% rename from lib/datadog_api_client/v2/models/incident_attachment_update_attributes.rb rename to lib/datadog_api_client/v2/models/on_call_notification_rule_channel_settings.rb index e8532f4a0783..3c8a1662b516 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_update_attributes.rb +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_channel_settings.rb @@ -17,8 +17,8 @@ require 'time' module DatadogAPIClient::V2 - # Incident attachment attributes. - module IncidentAttachmentUpdateAttributes + # Defines the configuration for a channel associated with a notification rule + module OnCallNotificationRuleChannelSettings class << self include BaseOneOfModel include BaseOneOfModelNoDiscriminator @@ -26,8 +26,7 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ - :'IncidentAttachmentPostmortemAttributes', - :'IncidentAttachmentLinkAttributes' + :'OnCallPhoneNotificationRuleSettings' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/on_call_notification_rule_data.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_data.rb new file mode 100644 index 000000000000..43f6a95c691d --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_data.rb @@ -0,0 +1,153 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for an on-call notification rule + class OnCallNotificationRuleData + include BaseGenericModel + + # Attributes for an on-call notification rule. + attr_accessor :attributes + + # Unique identifier for the rule + attr_accessor :id + + # Relationship object for creating a notification rule + attr_accessor :relationships + + # Indicates that the resource is of type 'notification_rules'. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OnCallNotificationRuleAttributes', + :'id' => :'String', + :'relationships' => :'OnCallNotificationRuleRelationships', + :'type' => :'OnCallNotificationRuleType' + } + 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::OnCallNotificationRuleData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @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 && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/on_call_notification_rule_relationships.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_relationships.rb new file mode 100644 index 000000000000..36142c17a1c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_relationships.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 + # Relationship object for creating a notification rule + class OnCallNotificationRuleRelationships + include BaseGenericModel + + # Relationship object for creating a notification rule + attr_accessor :channel + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'channel' => :'channel' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'channel' => :'OnCallNotificationRuleChannelRelationship' + } + 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::OnCallNotificationRuleRelationships` 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?(:'channel') + self.channel = attributes[:'channel'] + 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 && + channel == o.channel && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [channel, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/on_call_notification_rule_request_attributes.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_request_attributes.rb new file mode 100644 index 000000000000..acd674a77d22 --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_request_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating or modifying an on-call notification rule. + class OnCallNotificationRuleRequestAttributes + include BaseGenericModel + + # Specifies the category a notification rule will apply to + attr_accessor :category + + # Defines the configuration for a channel associated with a notification rule + attr_accessor :channel_settings + + # The number of minutes that will elapse before this rule is evaluated. 0 indicates immediate evaluation + attr_accessor :delay_minutes + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'category' => :'category', + :'channel_settings' => :'channel_settings', + :'delay_minutes' => :'delay_minutes' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'OnCallNotificationRuleCategory', + :'channel_settings' => :'OnCallNotificationRuleChannelSettings', + :'delay_minutes' => :'Integer' + } + 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::OnCallNotificationRuleRequestAttributes` 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?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'channel_settings') + self.channel_settings = attributes[:'channel_settings'] + end + + if attributes.key?(:'delay_minutes') + self.delay_minutes = attributes[:'delay_minutes'] + 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 && + category == o.category && + channel_settings == o.channel_settings && + delay_minutes == o.delay_minutes && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, channel_settings, delay_minutes, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attachment_type.rb b/lib/datadog_api_client/v2/models/on_call_notification_rule_type.rb similarity index 78% rename from lib/datadog_api_client/v2/models/incident_attachment_postmortem_attachment_type.rb rename to lib/datadog_api_client/v2/models/on_call_notification_rule_type.rb index eac29de0add9..46c3df313537 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_postmortem_attachment_type.rb +++ b/lib/datadog_api_client/v2/models/on_call_notification_rule_type.rb @@ -17,10 +17,10 @@ require 'time' module DatadogAPIClient::V2 - # The type of postmortem attachment attributes. - class IncidentAttachmentPostmortemAttachmentType + # Indicates that the resource is of type 'notification_rules'. + class OnCallNotificationRuleType include BaseEnumModel - POSTMORTEM = "postmortem".freeze + NOTIFICATION_RULES = "notification_rules".freeze end end diff --git a/lib/datadog_api_client/v2/models/incident_attachment_attributes.rb b/lib/datadog_api_client/v2/models/on_call_notification_rules_included.rb similarity index 91% rename from lib/datadog_api_client/v2/models/incident_attachment_attributes.rb rename to lib/datadog_api_client/v2/models/on_call_notification_rules_included.rb index 5d8373f491c3..5ca676162338 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_attributes.rb +++ b/lib/datadog_api_client/v2/models/on_call_notification_rules_included.rb @@ -17,8 +17,8 @@ require 'time' module DatadogAPIClient::V2 - # The attributes object for an attachment. - module IncidentAttachmentAttributes + # Represents additional included resources for a on-call notification rules + module OnCallNotificationRulesIncluded class << self include BaseOneOfModel include BaseOneOfModelNoDiscriminator @@ -26,8 +26,7 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ - :'IncidentAttachmentPostmortemAttributes', - :'IncidentAttachmentLinkAttributes' + :'NotificationChannelData' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/incident_attachment_link_attachment_type.rb b/lib/datadog_api_client/v2/models/on_call_phone_notification_rule_method.rb similarity index 77% rename from lib/datadog_api_client/v2/models/incident_attachment_link_attachment_type.rb rename to lib/datadog_api_client/v2/models/on_call_phone_notification_rule_method.rb index 19fcf5991c17..5e51ae7c30f4 100644 --- a/lib/datadog_api_client/v2/models/incident_attachment_link_attachment_type.rb +++ b/lib/datadog_api_client/v2/models/on_call_phone_notification_rule_method.rb @@ -17,10 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # The type of link attachment attributes. - class IncidentAttachmentLinkAttachmentType + # Specifies the method in which a phone is used in a notification rule + class OnCallPhoneNotificationRuleMethod include BaseEnumModel - LINK = "link".freeze + SMS = "sms".freeze + VOICE = "voice".freeze end end diff --git a/lib/datadog_api_client/v2/models/on_call_phone_notification_rule_settings.rb b/lib/datadog_api_client/v2/models/on_call_phone_notification_rule_settings.rb new file mode 100644 index 000000000000..401329468286 --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_phone_notification_rule_settings.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 + # Configuration for using a phone notification channel in a notification rule + class OnCallPhoneNotificationRuleSettings + include BaseGenericModel + + # Specifies the method in which a phone is used in a notification rule + attr_reader :method + + # Indicates that the notification channel is a phone + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'method' => :'method', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'method' => :'OnCallPhoneNotificationRuleMethod', + :'type' => :'NotificationChannelPhoneConfigType' + } + 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::OnCallPhoneNotificationRuleSettings` 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?(:'method') + self.method = attributes[:'method'] + 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 @method.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param method [Object] Object to be assigned + # @!visibility private + def method=(method) + if method.nil? + fail ArgumentError, 'invalid value for "method", method cannot be nil.' + end + @method = method + 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 && + method == o.method && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [method, type, additional_properties].hash + end + end +end 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 000000000000..2fad435206b2 --- /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 000000000000..7310bb1ba631 --- /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 000000000000..9281ed7bb6f0 --- /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 000000000000..39a06e7d72d3 --- /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/update_on_call_notification_rule_request.rb b/lib/datadog_api_client/v2/models/update_on_call_notification_rule_request.rb new file mode 100644 index 000000000000..55e84bbf923d --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_on_call_notification_rule_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A top-level wrapper for updating a notification rule for a user + class UpdateOnCallNotificationRuleRequest + include BaseGenericModel + + # Data for updating an on-call notification rule + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'UpdateOnCallNotificationRuleRequestData' + } + 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::UpdateOnCallNotificationRuleRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_on_call_notification_rule_request_attributes.rb b/lib/datadog_api_client/v2/models/update_on_call_notification_rule_request_attributes.rb new file mode 100644 index 000000000000..04e00e09909e --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_on_call_notification_rule_request_attributes.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating or modifying an on-call notification rule. + class UpdateOnCallNotificationRuleRequestAttributes + include BaseGenericModel + + # Specifies the category a notification rule will apply to + attr_accessor :category + + # Defines the configuration for a channel associated with a notification rule + attr_accessor :channel_settings + + # The number of minutes that will elapse before this rule is evaluated. 0 indicates immediate evaluation + attr_accessor :delay_minutes + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'category' => :'category', + :'channel_settings' => :'channel_settings', + :'delay_minutes' => :'delay_minutes' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'OnCallNotificationRuleCategory', + :'channel_settings' => :'OnCallNotificationRuleChannelSettings', + :'delay_minutes' => :'Integer' + } + 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::UpdateOnCallNotificationRuleRequestAttributes` 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?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'channel_settings') + self.channel_settings = attributes[:'channel_settings'] + end + + if attributes.key?(:'delay_minutes') + self.delay_minutes = attributes[:'delay_minutes'] + 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 && + category == o.category && + channel_settings == o.channel_settings && + delay_minutes == o.delay_minutes && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, channel_settings, delay_minutes, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_on_call_notification_rule_request_data.rb b/lib/datadog_api_client/v2/models/update_on_call_notification_rule_request_data.rb new file mode 100644 index 000000000000..6a9faa6c3ba5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_on_call_notification_rule_request_data.rb @@ -0,0 +1,153 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for updating an on-call notification rule + class UpdateOnCallNotificationRuleRequestData + include BaseGenericModel + + # Attributes for creating or modifying an on-call notification rule. + attr_accessor :attributes + + # Unique identifier for the rule + attr_accessor :id + + # Relationship object for creating a notification rule + attr_accessor :relationships + + # Indicates that the resource is of type 'notification_rules'. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpdateOnCallNotificationRuleRequestAttributes', + :'id' => :'String', + :'relationships' => :'OnCallNotificationRuleRelationships', + :'type' => :'OnCallNotificationRuleType' + } + 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::UpdateOnCallNotificationRuleRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @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 && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/user140420082644000.rb b/lib/datadog_api_client/v2/models/user140420082644000.rb new file mode 100644 index 000000000000..27fbb7f5ea06 --- /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 fe0201af5238..0cc43068a50d 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