diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5d738d0d1f0e..42168cb0f307 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13195,6 +13195,27 @@ components: - options - type type: object + CreateEmailNotificationChannelConfig: + description: Configuration to create an e-mail notification channel + properties: + address: + description: The e-mail address to be notified + example: '' + type: string + formats: + description: Preferred content formats for notifications. + example: + - html + items: + $ref: '#/components/schemas/NotificationChannelEmailFormatType' + type: array + type: + $ref: '#/components/schemas/NotificationChannelEmailConfigType' + required: + - type + - address + - formats + type: object CreateIncidentNotificationRuleRequest: description: Create request for a notification rule. properties: @@ -13282,6 +13303,29 @@ components: - findings - project type: object + CreateNotificationChannelAttributes: + description: Attributes for creating an on-call notification channel. + properties: + config: + $ref: '#/components/schemas/CreateNotificationChannelConfig' + description: Notification channel configuration + type: object + CreateNotificationChannelConfig: + description: Defines the configuration for creating an On-Call notification + channel + oneOf: + - $ref: '#/components/schemas/CreatePhoneNotificationChannelConfig' + - $ref: '#/components/schemas/CreateEmailNotificationChannelConfig' + CreateNotificationChannelData: + description: Data for creating an on-call notification channel + properties: + attributes: + $ref: '#/components/schemas/CreateNotificationChannelAttributes' + type: + $ref: '#/components/schemas/NotificationChannelType' + required: + - type + type: object CreateNotificationRuleParameters: description: Body of the notification rule create request. properties: @@ -13442,6 +13486,19 @@ components: type: string x-enum-varnames: - PAGES + CreatePhoneNotificationChannelConfig: + description: Configuration to create a phone notification channel + properties: + number: + description: The E-164 formatted phone number (e.g. +3371234567) + example: '' + type: string + type: + $ref: '#/components/schemas/NotificationChannelPhoneConfigType' + required: + - type + - number + type: object CreateRuleRequest: description: Scorecard create rule request. properties: @@ -14008,6 +14065,23 @@ components: type: string x-enum-varnames: - UPLOAD + CreateUserNotificationChannelRequest: + description: A top-level wrapper for creating a notification channel for a user + example: + data: + attributes: + config: + address: foo@bar.com + formats: + - html + type: email + type: notification_channels + properties: + data: + $ref: '#/components/schemas/CreateNotificationChannelData' + required: + - data + type: object CreateWorkflowRequest: description: A request object for creating a new workflow. example: @@ -30505,6 +30579,14 @@ components: meta: $ref: '#/components/schemas/KindResponseMeta' type: object + ListNotificationChannelsResponse: + description: Response type for listing notification channels for a user + properties: + data: + items: + $ref: '#/components/schemas/NotificationChannelData' + type: array + type: object ListPipelinesResponse: description: Represents the response payload containing a list of pipelines and associated metadata. @@ -34679,6 +34761,174 @@ components: required: - notebookTrigger type: object + NotificationChannel: + description: A top-level wrapper for a user notification channel + example: + data: + attributes: + config: + address: foo@bar.com + formats: + - html + type: email + id: 27590dae-47be-4a7d-9abf-8f4e45124020 + type: notification_channels + properties: + data: + $ref: '#/components/schemas/NotificationChannelData' + type: object + NotificationChannelAttributes: + description: Attributes for an on-call notification channel. + properties: + active: + description: Whether the notification channel is currently active. + type: boolean + config: + $ref: '#/components/schemas/NotificationChannelConfig' + description: Notification channel configuration + type: object + NotificationChannelConfig: + description: Defines the configuration for an On-Call notification channel + oneOf: + - $ref: '#/components/schemas/NotificationChannelPhoneConfig' + - $ref: '#/components/schemas/NotificationChannelEmailConfig' + - $ref: '#/components/schemas/NotificationChannelPushConfig' + NotificationChannelData: + description: Data for an on-call notification channel + properties: + attributes: + $ref: '#/components/schemas/NotificationChannelAttributes' + id: + description: Unique identifier for the channel + type: string + type: + $ref: '#/components/schemas/NotificationChannelType' + required: + - type + type: object + NotificationChannelEmailConfig: + description: Email notification channel configuration + properties: + address: + description: The e-mail address to be notified + example: '' + type: string + formats: + description: Preferred content formats for notifications. + example: + - html + items: + $ref: '#/components/schemas/NotificationChannelEmailFormatType' + type: array + type: + $ref: '#/components/schemas/NotificationChannelEmailConfigType' + required: + - type + - address + - formats + type: object + NotificationChannelEmailConfigType: + default: email + description: Indicates that the notification channel is an e-mail address + enum: + - email + example: email + type: string + x-enum-varnames: + - EMAIL + NotificationChannelEmailFormatType: + default: html + description: Specifies the format of the e-mail that is sent for On-Call notifications + enum: + - html + - text + example: html + type: string + x-enum-varnames: + - HTML + - TEXT + NotificationChannelPhoneConfig: + description: Phone notification channel configuration + properties: + formatted_number: + description: The formatted international version of Number (e.g. +33 7 1 + 23 45 67). + example: '' + type: string + number: + description: The E-164 formatted phone number (e.g. +3371234567) + example: '' + type: string + region: + description: The ISO 3166-1 alpha-2 two-letter country code. + example: '' + type: string + sms_subscribed_at: + description: If present, the date the user subscribed this number to SMS + messages + format: date-time + nullable: true + type: string + type: + $ref: '#/components/schemas/NotificationChannelPhoneConfigType' + verified: + description: Indicates whether this phone has been verified by the user + in Datadog On-Call + example: false + type: boolean + required: + - type + - number + - formatted_number + - region + - verified + type: object + NotificationChannelPhoneConfigType: + default: phone + description: Indicates that the notification channel is a phone + enum: + - phone + example: phone + type: string + x-enum-varnames: + - PHONE + NotificationChannelPushConfig: + description: Push notification channel configuration + properties: + application_name: + description: The name of the application used to receive push notifications + example: '' + type: string + device_name: + description: The name of the mobile device being used + example: '' + type: string + type: + $ref: '#/components/schemas/NotificationChannelPushConfigType' + required: + - type + - device_name + - application_name + type: object + NotificationChannelPushConfigType: + default: push + description: Indicates that the notification channel is a mobile device for + push notifications + enum: + - push + example: push + type: string + x-enum-varnames: + - PUSH + NotificationChannelType: + default: notification_channels + description: Indicates that the resource is of type 'notification_channels'. + enum: + - notification_channels + example: notification_channels + type: string + x-enum-varnames: + - NOTIFICATION_CHANNELS NotificationRule: description: 'Notification rules allow full control over notifications generated by the various Datadog security products. @@ -75741,6 +75991,184 @@ paths: operator: AND permissions: - on_call_write + /api/v2/on-call/users/{user_id}/notification-channels: + get: + description: List the notification channels for a user. The authenticated user + must be the target user or have the `on_call_admin` permission + operationId: ListUserNotificationChannels + parameters: + - 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/ListNotificationChannelsResponse' + 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 channels for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_read + post: + description: Create a new notification channel for a user. The authenticated + user must be the target user or have the `on_call_admin` permission + operationId: CreateUserNotificationChannel + 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/CreateUserNotificationChannelRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/NotificationChannel' + 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 channel for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_respond + /api/v2/on-call/users/{user_id}/notification-channels/{channel_id}: + delete: + description: Delete a notification channel for a user. The authenticated user + must be the target user or have the `on_call_admin` permission + operationId: DeleteUserNotificationChannel + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The channel ID + in: path + name: channel_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 channel for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_respond + get: + description: Get a notification channel for a user. The authenticated user must + be the target user or have the `on_call_admin` permission + operationId: GetUserNotificationChannel + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The channel ID + in: path + name: channel_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/NotificationChannel' + 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 channel for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_read /api/v2/org_configs: get: description: Returns all Org Configs (name, description, and value). diff --git a/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-channel-for-a-user-returns-Created-response_3261448519/frozen.json b/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-channel-for-a-user-returns-Created-response_3261448519/frozen.json new file mode 100644 index 000000000000..e789b02b4892 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-channel-for-a-user-returns-Created-response_3261448519/frozen.json @@ -0,0 +1 @@ +"2025-12-12T14:05:32.425Z" diff --git a/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-channel-for-a-user-returns-Created-response_3261448519/recording.har b/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-channel-for-a-user-returns-Created-response_3261448519/recording.har new file mode 100644 index 000000000000..80b947a9b180 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-channel-for-a-user-returns-Created-response_3261448519/recording.har @@ -0,0 +1,157 @@ +{ + "log": { + "_recordingName": "On-Call/Create an On-Call notification channel for a user returns \"Created\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "e646869a131a5dae20e53caa10c414ba", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 176, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 550, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"email\":\"Test-Create_an_On_Call_notification_channel_for_a_user_returns_Created_response-1765548332@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users" + }, + "response": { + "bodySize": 776, + "content": { + "mimeType": "application/json", + "size": 776, + "text": "{\"data\":{\"type\":\"users\",\"id\":\"5ba8ee87-4d71-458c-883d-a6016738f7ce\",\"attributes\":{\"name\":null,\"handle\":\"test-create_an_on_call_notification_channel_for_a_user_returns_created_response-1765548332@datadoghq.com\",\"created_at\":\"2025-12-12T14:05:32.704821+00:00\",\"modified_at\":\"2025-12-12T14:05:32.704821+00:00\",\"email\":\"test-create_an_on_call_notification_channel_for_a_user_returns_created_response-1765548332@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/01791216e0fc8e5e005271e285ad9760?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\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-12T14:05:32.429Z", + "time": 218 + }, + { + "_id": "cb19fc28181aedaf9a5f1d997dc58d95", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 125, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 636, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"config\":{\"address\":\"foo@bar.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/5ba8ee87-4d71-458c-883d-a6016738f7ce/notification-channels" + }, + "response": { + "bodySize": 183, + "content": { + "mimeType": "application/vnd.api+json", + "size": 183, + "text": "{\"data\":{\"id\":\"f944f63a-2606-43c0-9c0b-10a34b9b214a\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"foo@bar.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-12T14:05:32.657Z", + "time": 128 + }, + { + "_id": "908a4a1723daa3ca996e6930ca7912bf", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 524, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users/5ba8ee87-4d71-458c-883d-a6016738f7ce" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/plain", + "size": 0 + }, + "cookies": [], + "headers": [], + "headersSize": 495, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2025-12-12T14:05:32.795Z", + "time": 370 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-channel-for-a-user-returns-No-Content-response_705281852/frozen.json b/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-channel-for-a-user-returns-No-Content-response_705281852/frozen.json new file mode 100644 index 000000000000..c0d7b8b94ede --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-channel-for-a-user-returns-No-Content-response_705281852/frozen.json @@ -0,0 +1 @@ +"2025-12-11T18:27:50.679Z" diff --git a/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-channel-for-a-user-returns-No-Content-response_705281852/recording.har b/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-channel-for-a-user-returns-No-Content-response_705281852/recording.har new file mode 100644 index 000000000000..783facdd356a --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-channel-for-a-user-returns-No-Content-response_705281852/recording.har @@ -0,0 +1,194 @@ +{ + "log": { + "_recordingName": "On-Call/Delete an On-Call notification channel for a user returns \"No Content\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "80da13475cb7fcb8d246ecb3a2e83eeb", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 179, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 550, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"email\":\"Test-Delete_an_On_Call_notification_channel_for_a_user_returns_No_Content_response-1765477670@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users" + }, + "response": { + "bodySize": 782, + "content": { + "mimeType": "application/json", + "size": 782, + "text": "{\"data\":{\"type\":\"users\",\"id\":\"1df33be3-5397-4aaf-95c0-00dd63819c80\",\"attributes\":{\"name\":null,\"handle\":\"test-delete_an_on_call_notification_channel_for_a_user_returns_no_content_response-1765477670@datadoghq.com\",\"created_at\":\"2025-12-11T18:27:50.837055+00:00\",\"modified_at\":\"2025-12-11T18:27:50.837055+00:00\",\"email\":\"test-delete_an_on_call_notification_channel_for_a_user_returns_no_content_response-1765477670@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/f0ef01f65aae0d49a442ade4a44a5a53?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\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-11T18:27:50.683Z", + "time": 192 + }, + { + "_id": "b54ba694e3ee3096441deff4941b2a2e", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 221, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 636, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"config\":{\"address\":\"test-delete_an_on_call_notification_channel_for_a_user_returns_no_content_response-1765477670@datadoghq.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/1df33be3-5397-4aaf-95c0-00dd63819c80/notification-channels" + }, + "response": { + "bodySize": 279, + "content": { + "mimeType": "application/vnd.api+json", + "size": 279, + "text": "{\"data\":{\"id\":\"dd22cf57-a576-4c7e-92f8-36c2171f5f99\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-delete_an_on_call_notification_channel_for_a_user_returns_no_content_response-1765477670@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-11T18:27:50.884Z", + "time": 124 + }, + { + "_id": "16cde92b365f2969442f556b74d3b28e", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 609, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/1df33be3-5397-4aaf-95c0-00dd63819c80/notification-channels/dd22cf57-a576-4c7e-92f8-36c2171f5f99" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/plain", + "size": 0 + }, + "cookies": [], + "headers": [], + "headersSize": 464, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2025-12-11T18:27:51.019Z", + "time": 135 + }, + { + "_id": "5dcdb2de9d9b03ee65dd240047575a00", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 524, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users/1df33be3-5397-4aaf-95c0-00dd63819c80" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/plain", + "size": 0 + }, + "cookies": [], + "headers": [], + "headersSize": 495, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2025-12-11T18:27:51.165Z", + "time": 264 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-channel-for-a-user-returns-OK-response_1643148287/frozen.json b/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-channel-for-a-user-returns-OK-response_1643148287/frozen.json new file mode 100644 index 000000000000..5805b66b327f --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-channel-for-a-user-returns-OK-response_1643148287/frozen.json @@ -0,0 +1 @@ +"2025-12-12T14:04:17.257Z" diff --git a/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-channel-for-a-user-returns-OK-response_1643148287/recording.har b/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-channel-for-a-user-returns-OK-response_1643148287/recording.har new file mode 100644 index 000000000000..d7129a928be4 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-channel-for-a-user-returns-OK-response_1643148287/recording.har @@ -0,0 +1,200 @@ +{ + "log": { + "_recordingName": "On-Call/Get an On-Call notification channel for a user returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "bb0f1f2bf51d389e200679d0cb16e6a3", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 168, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 550, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"email\":\"Test-Get_an_On_Call_notification_channel_for_a_user_returns_OK_response-1765548257@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users" + }, + "response": { + "bodySize": 760, + "content": { + "mimeType": "application/json", + "size": 760, + "text": "{\"data\":{\"type\":\"users\",\"id\":\"0131b53c-5aec-4c8a-a14f-9ef487448833\",\"attributes\":{\"name\":null,\"handle\":\"test-get_an_on_call_notification_channel_for_a_user_returns_ok_response-1765548257@datadoghq.com\",\"created_at\":\"2025-12-12T14:04:17.531988+00:00\",\"modified_at\":\"2025-12-12T14:04:17.531988+00:00\",\"email\":\"test-get_an_on_call_notification_channel_for_a_user_returns_ok_response-1765548257@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/cedb283c90667a7da02c585159b4eda3?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\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-12T14:04:17.261Z", + "time": 196 + }, + { + "_id": "0f4b23e9dbff162feeb47cb9c12aa159", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 210, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 636, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"config\":{\"address\":\"test-get_an_on_call_notification_channel_for_a_user_returns_ok_response-1765548257@datadoghq.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/0131b53c-5aec-4c8a-a14f-9ef487448833/notification-channels" + }, + "response": { + "bodySize": 268, + "content": { + "mimeType": "application/vnd.api+json", + "size": 268, + "text": "{\"data\":{\"id\":\"d5fc3f5a-a4b9-4972-80bb-cb4db7ec958b\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-get_an_on_call_notification_channel_for_a_user_returns_ok_response-1765548257@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-12T14:04:17.466Z", + "time": 135 + }, + { + "_id": "922710640656d49855486b6bb0cff94a", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 616, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/0131b53c-5aec-4c8a-a14f-9ef487448833/notification-channels/d5fc3f5a-a4b9-4972-80bb-cb4db7ec958b" + }, + "response": { + "bodySize": 268, + "content": { + "mimeType": "application/vnd.api+json", + "size": 268, + "text": "{\"data\":{\"id\":\"d5fc3f5a-a4b9-4972-80bb-cb4db7ec958b\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-get_an_on_call_notification_channel_for_a_user_returns_ok_response-1765548257@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-12-12T14:04:17.611Z", + "time": 58 + }, + { + "_id": "4c95055b31234813a2ea6a9bd8d0292d", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 524, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users/0131b53c-5aec-4c8a-a14f-9ef487448833" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/plain", + "size": 0 + }, + "cookies": [], + "headers": [], + "headersSize": 495, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2025-12-12T14:04:17.679Z", + "time": 317 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/On-Call_446749911/List-On-Call-notification-channels-for-a-user-returns-OK-response_3049609481/frozen.json b/cassettes/v2/On-Call_446749911/List-On-Call-notification-channels-for-a-user-returns-OK-response_3049609481/frozen.json new file mode 100644 index 000000000000..9f22785c09e7 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/List-On-Call-notification-channels-for-a-user-returns-OK-response_3049609481/frozen.json @@ -0,0 +1 @@ +"2025-12-12T14:40:40.219Z" diff --git a/cassettes/v2/On-Call_446749911/List-On-Call-notification-channels-for-a-user-returns-OK-response_3049609481/recording.har b/cassettes/v2/On-Call_446749911/List-On-Call-notification-channels-for-a-user-returns-OK-response_3049609481/recording.har new file mode 100644 index 000000000000..88f61d60832a --- /dev/null +++ b/cassettes/v2/On-Call_446749911/List-On-Call-notification-channels-for-a-user-returns-OK-response_3049609481/recording.har @@ -0,0 +1,200 @@ +{ + "log": { + "_recordingName": "On-Call/List On-Call notification channels for a user returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "6ddfc267b7b87643eb7d58b6864ec71c", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 167, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 550, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"email\":\"Test-List_On_Call_notification_channels_for_a_user_returns_OK_response-1765550440@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users" + }, + "response": { + "bodySize": 758, + "content": { + "mimeType": "application/json", + "size": 758, + "text": "{\"data\":{\"type\":\"users\",\"id\":\"c7fe3658-67dd-4a91-bf86-3709728fd8a5\",\"attributes\":{\"name\":null,\"handle\":\"test-list_on_call_notification_channels_for_a_user_returns_ok_response-1765550440@datadoghq.com\",\"created_at\":\"2025-12-12T14:40:40.467657+00:00\",\"modified_at\":\"2025-12-12T14:40:40.467657+00:00\",\"email\":\"test-list_on_call_notification_channels_for_a_user_returns_ok_response-1765550440@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/c74061cf101e1fea18813bda82103b47?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\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-12T14:40:40.223Z", + "time": 212 + }, + { + "_id": "8b6257b6661c2f650b81b85b3f6c45d4", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 209, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 636, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"config\":{\"address\":\"test-list_on_call_notification_channels_for_a_user_returns_ok_response-1765550440@datadoghq.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/c7fe3658-67dd-4a91-bf86-3709728fd8a5/notification-channels" + }, + "response": { + "bodySize": 267, + "content": { + "mimeType": "application/vnd.api+json", + "size": 267, + "text": "{\"data\":{\"id\":\"8e9a9ded-ff10-4661-8d56-b4b789f54bf1\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-list_on_call_notification_channels_for_a_user_returns_ok_response-1765550440@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-12T14:40:40.441Z", + "time": 137 + }, + { + "_id": "d72734fad87a83550eccb3dbd27dae01", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 581, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/c7fe3658-67dd-4a91-bf86-3709728fd8a5/notification-channels" + }, + "response": { + "bodySize": 269, + "content": { + "mimeType": "application/vnd.api+json", + "size": 269, + "text": "{\"data\":[{\"id\":\"8e9a9ded-ff10-4661-8d56-b4b789f54bf1\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-list_on_call_notification_channels_for_a_user_returns_ok_response-1765550440@datadoghq.com\",\"formats\":[\"html\"]}}}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-12-12T14:40:40.583Z", + "time": 120 + }, + { + "_id": "cb4a15207e118ea23c7cba8ace639482", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 524, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users/c7fe3658-67dd-4a91-bf86-3709728fd8a5" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/plain", + "size": 0 + }, + "cookies": [], + "headers": [], + "headersSize": 495, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2025-12-12T14:40:40.712Z", + "time": 274 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/examples/v2/on-call/CreateUserNotificationChannel.ts b/examples/v2/on-call/CreateUserNotificationChannel.ts new file mode 100644 index 000000000000..fdc24780cbf5 --- /dev/null +++ b/examples/v2/on-call/CreateUserNotificationChannel.ts @@ -0,0 +1,36 @@ +/** + * Create an On-Call notification channel for a user returns "Created" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.OnCallApi(configuration); + +// there is a valid "user" in the system +const USER_DATA_ID = process.env.USER_DATA_ID as string; + +const params: v2.OnCallApiCreateUserNotificationChannelRequest = { + body: { + data: { + attributes: { + config: { + address: "foo@bar.com", + formats: ["html"], + type: "email", + }, + }, + type: "notification_channels", + }, + }, + userId: USER_DATA_ID, +}; + +apiInstance + .createUserNotificationChannel(params) + .then((data: v2.NotificationChannel) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call/DeleteUserNotificationChannel.ts b/examples/v2/on-call/DeleteUserNotificationChannel.ts new file mode 100644 index 000000000000..9f1b6ed9c116 --- /dev/null +++ b/examples/v2/on-call/DeleteUserNotificationChannel.ts @@ -0,0 +1,29 @@ +/** + * Delete an On-Call notification channel for a user returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.OnCallApi(configuration); + +// there is a valid "user" in the system +const USER_DATA_ID = process.env.USER_DATA_ID as string; + +// there is a valid "oncall_email_notification_channel" in the system +const ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID = process.env + .ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID as string; + +const params: v2.OnCallApiDeleteUserNotificationChannelRequest = { + userId: USER_DATA_ID, + channelId: ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID, +}; + +apiInstance + .deleteUserNotificationChannel(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call/GetUserNotificationChannel.ts b/examples/v2/on-call/GetUserNotificationChannel.ts new file mode 100644 index 000000000000..08867af00f47 --- /dev/null +++ b/examples/v2/on-call/GetUserNotificationChannel.ts @@ -0,0 +1,29 @@ +/** + * Get an On-Call notification channel for a user returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.OnCallApi(configuration); + +// there is a valid "user" in the system +const USER_DATA_ID = process.env.USER_DATA_ID as string; + +// there is a valid "oncall_email_notification_channel" in the system +const ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID = process.env + .ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID as string; + +const params: v2.OnCallApiGetUserNotificationChannelRequest = { + userId: USER_DATA_ID, + channelId: ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID, +}; + +apiInstance + .getUserNotificationChannel(params) + .then((data: v2.NotificationChannel) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call/ListUserNotificationChannels.ts b/examples/v2/on-call/ListUserNotificationChannels.ts new file mode 100644 index 000000000000..ecaa032b801d --- /dev/null +++ b/examples/v2/on-call/ListUserNotificationChannels.ts @@ -0,0 +1,24 @@ +/** + * List On-Call notification channels for a user returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.OnCallApi(configuration); + +// there is a valid "user" in the system +const USER_DATA_ID = process.env.USER_DATA_ID as string; + +const params: v2.OnCallApiListUserNotificationChannelsRequest = { + userId: USER_DATA_ID, +}; + +apiInstance + .listUserNotificationChannels(params) + .then((data: v2.ListNotificationChannelsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 4ebca2cd2db3..3c1c4e156b1e 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -7531,6 +7531,46 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "TeamRoutingRules", }, + "v2.ListUserNotificationChannels": { + "userId": { + "type": "string", + "format": "", + }, + "operationResponseType": "ListNotificationChannelsResponse", + }, + "v2.CreateUserNotificationChannel": { + "userId": { + "type": "string", + "format": "", + }, + "body": { + "type": "CreateUserNotificationChannelRequest", + "format": "", + }, + "operationResponseType": "NotificationChannel", + }, + "v2.GetUserNotificationChannel": { + "userId": { + "type": "string", + "format": "", + }, + "channelId": { + "type": "string", + "format": "", + }, + "operationResponseType": "NotificationChannel", + }, + "v2.DeleteUserNotificationChannel": { + "userId": { + "type": "string", + "format": "", + }, + "channelId": { + "type": "string", + "format": "", + }, + "operationResponseType": "{}", + }, "v2.CreateOnCallPage": { "body": { "type": "CreatePageRequest", diff --git a/features/v2/given.json b/features/v2/given.json index 7725798de449..8cf1925f45e8 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -783,6 +783,22 @@ "tag": "On-Call", "operationId": "SetOnCallTeamRoutingRules" }, + { + "parameters": [ + { + "name": "user_id", + "source": "user.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"config\": {\n \"type\": \"email\",\n \"address\": \"{{ user.data.attributes.email }}\",\n \"formats\": [\n \"html\"\n ]\n }\n },\n \"type\": \"notification_channels\"\n }\n}" + } + ], + "step": "there is a valid \"oncall_email_notification_channel\" in the system", + "key": "oncall_email_notification_channel", + "tag": "On-Call", + "operationId": "CreateUserNotificationChannel" + }, { "parameters": [ { diff --git a/features/v2/on-call.feature b/features/v2/on-call.feature index c52e4291fc65..9f4750eef79a 100644 --- a/features/v2/on-call.feature +++ b/features/v2/on-call.feature @@ -43,6 +43,33 @@ Feature: On-Call When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/on-call + Scenario: Create an On-Call notification channel for a user returns "Bad Request" response + Given new "CreateUserNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"config": {"address": "foo@bar.com", "formats": ["html"], "type": "email"}}, "type": "notification_channels"}} + 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 channel for a user returns "Created" response + Given new "CreateUserNotificationChannel" request + And there is a valid "user" in the system + And request contains "user_id" parameter from "user.data.id" + And body with value {"data": {"attributes": {"config": {"address": "foo@bar.com", "formats": ["html"], "type": "email"}}, "type": "notification_channels"}} + When the request is sent + Then the response status is 201 Created + And the response "data.attributes.config.type" is equal to "email" + And the response "data.attributes.config.address" is equal to "foo@bar.com" + + @generated @skip @team:DataDog/on-call + Scenario: Create an On-Call notification channel for a user returns "Not Found" response + Given new "CreateUserNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"config": {"address": "foo@bar.com", "formats": ["html"], "type": "email"}}, "type": "notification_channels"}} + 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 @@ -77,6 +104,32 @@ 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 channel for a user returns "Bad Request" response + Given new "DeleteUserNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "channel_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 channel for a user returns "No Content" response + Given new "DeleteUserNotificationChannel" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "channel_id" parameter from "oncall_email_notification_channel.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 channel for a user returns "Not Found" response + Given new "DeleteUserNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "channel_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 @@ -126,6 +179,34 @@ Feature: On-Call When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/on-call + Scenario: Get an On-Call notification channel for a user returns "Bad Request" response + Given new "GetUserNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "channel_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 channel for a user returns "Not Found" response + Given new "GetUserNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "channel_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 channel for a user returns "OK" response + Given new "GetUserNotificationChannel" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "channel_id" parameter from "oncall_email_notification_channel.data.id" + When the request is sent + Then the response status is 200 OK + 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 scheduled on-call user returns "Bad Request" response Given new "GetScheduleOnCallUser" request @@ -176,6 +257,32 @@ Feature: On-Call When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/on-call + Scenario: List On-Call notification channels for a user returns "Bad Request" response + Given new "ListUserNotificationChannels" 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 channels for a user returns "Not Found" response + Given new "ListUserNotificationChannels" 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 channels for a user returns "OK" response + Given new "ListUserNotificationChannels" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And request contains "user_id" parameter from "user.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].attributes.config.type" is equal to "email" + And the response "data[0].attributes.config.address" is equal to "{{ user.data.attributes.email }}" + @skip-python @team:DataDog/on-call Scenario: Set On-Call team routing rules returns "OK" response Given new "SetOnCallTeamRoutingRules" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 56977a4c301f..8aec373cdd9e 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2934,6 +2934,30 @@ "type": "unsafe" } }, + "ListUserNotificationChannels": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "CreateUserNotificationChannel": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "DeleteUserNotificationChannel": { + "tag": "On-Call", + "undo": { + "type": "idempotent" + } + }, + "GetUserNotificationChannel": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": { diff --git a/packages/datadog-api-client-v2/apis/OnCallApi.ts b/packages/datadog-api-client-v2/apis/OnCallApi.ts index 0a91dc6109b4..25fbb53b6fcd 100644 --- a/packages/datadog-api-client-v2/apis/OnCallApi.ts +++ b/packages/datadog-api-client-v2/apis/OnCallApi.ts @@ -17,9 +17,12 @@ import { ObjectSerializer } from "../models/ObjectSerializer"; import { ApiException } from "../../datadog-api-client-common/exception"; import { APIErrorResponse } from "../models/APIErrorResponse"; +import { CreateUserNotificationChannelRequest } from "../models/CreateUserNotificationChannelRequest"; import { EscalationPolicy } from "../models/EscalationPolicy"; import { EscalationPolicyCreateRequest } from "../models/EscalationPolicyCreateRequest"; import { EscalationPolicyUpdateRequest } from "../models/EscalationPolicyUpdateRequest"; +import { ListNotificationChannelsResponse } from "../models/ListNotificationChannelsResponse"; +import { NotificationChannel } from "../models/NotificationChannel"; import { Schedule } from "../models/Schedule"; import { ScheduleCreateRequest } from "../models/ScheduleCreateRequest"; import { ScheduleUpdateRequest } from "../models/ScheduleUpdateRequest"; @@ -133,6 +136,62 @@ export class OnCallApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async createUserNotificationChannel( + userId: string, + body: CreateUserNotificationChannelRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError("userId", "createUserNotificationChannel"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createUserNotificationChannel"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels".replace( + "{user_id}", + encodeURIComponent(String(userId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.createUserNotificationChannel") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize( + body, + "CreateUserNotificationChannelRequest", + "" + ), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async deleteOnCallEscalationPolicy( policyId: string, _options?: Configuration @@ -202,6 +261,46 @@ export class OnCallApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async deleteUserNotificationChannel( + userId: string, + channelId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError("userId", "deleteUserNotificationChannel"); + } + + // verify required parameter 'channelId' is not null or undefined + if (channelId === null || channelId === undefined) { + throw new RequiredError("channelId", "deleteUserNotificationChannel"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/{channel_id}" + .replace("{user_id}", encodeURIComponent(String(userId))) + .replace("{channel_id}", encodeURIComponent(String(channelId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.deleteUserNotificationChannel") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async getOnCallEscalationPolicy( policyId: string, include?: string, @@ -433,6 +532,81 @@ export class OnCallApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async getUserNotificationChannel( + userId: string, + channelId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError("userId", "getUserNotificationChannel"); + } + + // verify required parameter 'channelId' is not null or undefined + if (channelId === null || channelId === undefined) { + throw new RequiredError("channelId", "getUserNotificationChannel"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/{channel_id}" + .replace("{user_id}", encodeURIComponent(String(userId))) + .replace("{channel_id}", encodeURIComponent(String(channelId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.getUserNotificationChannel") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async listUserNotificationChannels( + userId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError("userId", "listUserNotificationChannels"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels".replace( + "{user_id}", + encodeURIComponent(String(userId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.listUserNotificationChannels") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async setOnCallTeamRoutingRules( teamId: string, body: TeamRoutingRulesRequest, @@ -746,6 +920,70 @@ export class OnCallApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createUserNotificationChannel + * @throws ApiException if the response code was not in [200, 299] + */ + public async createUserNotificationChannel( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 201) { + const body: NotificationChannel = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationChannel" + ) as NotificationChannel; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationChannel = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationChannel", + "" + ) as NotificationChannel; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -852,6 +1090,61 @@ export class OnCallApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteUserNotificationChannel + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteUserNotificationChannel( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1163,6 +1456,136 @@ export class OnCallApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getUserNotificationChannel + * @throws ApiException if the response code was not in [200, 299] + */ + public async getUserNotificationChannel( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: NotificationChannel = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationChannel" + ) as NotificationChannel; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: NotificationChannel = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "NotificationChannel", + "" + ) as NotificationChannel; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listUserNotificationChannels + * @throws ApiException if the response code was not in [200, 299] + */ + public async listUserNotificationChannels( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: ListNotificationChannelsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListNotificationChannelsResponse" + ) as ListNotificationChannelsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListNotificationChannelsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListNotificationChannelsResponse", + "" + ) as ListNotificationChannelsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1374,6 +1797,18 @@ export interface OnCallApiCreateOnCallScheduleRequest { include?: string; } +export interface OnCallApiCreateUserNotificationChannelRequest { + /** + * The user ID + * @type string + */ + userId: string; + /** + * @type CreateUserNotificationChannelRequest + */ + body: CreateUserNotificationChannelRequest; +} + export interface OnCallApiDeleteOnCallEscalationPolicyRequest { /** * The ID of the escalation policy @@ -1390,6 +1825,19 @@ export interface OnCallApiDeleteOnCallScheduleRequest { scheduleId: string; } +export interface OnCallApiDeleteUserNotificationChannelRequest { + /** + * The user ID + * @type string + */ + userId: string; + /** + * The channel ID + * @type string + */ + channelId: string; +} + export interface OnCallApiGetOnCallEscalationPolicyRequest { /** * The ID of the escalation policy @@ -1460,6 +1908,27 @@ export interface OnCallApiGetTeamOnCallUsersRequest { include?: string; } +export interface OnCallApiGetUserNotificationChannelRequest { + /** + * The user ID + * @type string + */ + userId: string; + /** + * The channel ID + * @type string + */ + channelId: string; +} + +export interface OnCallApiListUserNotificationChannelsRequest { + /** + * The user ID + * @type string + */ + userId: string; +} + export interface OnCallApiSetOnCallTeamRoutingRulesRequest { /** * The team ID @@ -1575,6 +2044,31 @@ export class OnCallApi { }); } + /** + * Create a new notification channel for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public createUserNotificationChannel( + param: OnCallApiCreateUserNotificationChannelRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.createUserNotificationChannel( + param.userId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createUserNotificationChannel( + responseContext + ); + }); + }); + } + /** * Delete an On-Call escalation policy * @param param The request object @@ -1617,6 +2111,31 @@ export class OnCallApi { }); } + /** + * Delete a notification channel for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public deleteUserNotificationChannel( + param: OnCallApiDeleteUserNotificationChannelRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.deleteUserNotificationChannel( + param.userId, + param.channelId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteUserNotificationChannel( + responseContext + ); + }); + }); + } + /** * Get an On-Call escalation policy * @param param The request object @@ -1732,6 +2251,52 @@ export class OnCallApi { }); } + /** + * Get a notification channel for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public getUserNotificationChannel( + param: OnCallApiGetUserNotificationChannelRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.getUserNotificationChannel( + param.userId, + param.channelId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getUserNotificationChannel( + responseContext + ); + }); + }); + } + + /** + * List the notification channels for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public listUserNotificationChannels( + param: OnCallApiListUserNotificationChannelsRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.listUserNotificationChannels(param.userId, options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listUserNotificationChannels( + responseContext + ); + }); + }); + } + /** * Set a team's On-Call routing rules * @param param The request object diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 548237020c2e..3e002f15f167 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -592,13 +592,17 @@ export { export { OnCallApiCreateOnCallEscalationPolicyRequest, OnCallApiCreateOnCallScheduleRequest, + OnCallApiCreateUserNotificationChannelRequest, OnCallApiDeleteOnCallEscalationPolicyRequest, OnCallApiDeleteOnCallScheduleRequest, + OnCallApiDeleteUserNotificationChannelRequest, OnCallApiGetOnCallEscalationPolicyRequest, OnCallApiGetOnCallScheduleRequest, OnCallApiGetOnCallTeamRoutingRulesRequest, OnCallApiGetScheduleOnCallUserRequest, OnCallApiGetTeamOnCallUsersRequest, + OnCallApiGetUserNotificationChannelRequest, + OnCallApiListUserNotificationChannelsRequest, OnCallApiSetOnCallTeamRoutingRulesRequest, OnCallApiUpdateOnCallEscalationPolicyRequest, OnCallApiUpdateOnCallScheduleRequest, @@ -1710,12 +1714,16 @@ export { CreateDeploymentGateParamsDataAttributes } from "./models/CreateDeploym export { CreateDeploymentRuleParams } from "./models/CreateDeploymentRuleParams"; export { CreateDeploymentRuleParamsData } from "./models/CreateDeploymentRuleParamsData"; export { CreateDeploymentRuleParamsDataAttributes } from "./models/CreateDeploymentRuleParamsDataAttributes"; +export { CreateEmailNotificationChannelConfig } from "./models/CreateEmailNotificationChannelConfig"; export { CreateIncidentNotificationRuleRequest } from "./models/CreateIncidentNotificationRuleRequest"; export { CreateIncidentNotificationTemplateRequest } from "./models/CreateIncidentNotificationTemplateRequest"; export { CreateJiraIssueRequestArray } from "./models/CreateJiraIssueRequestArray"; export { CreateJiraIssueRequestData } from "./models/CreateJiraIssueRequestData"; export { CreateJiraIssueRequestDataAttributes } from "./models/CreateJiraIssueRequestDataAttributes"; export { CreateJiraIssueRequestDataRelationships } from "./models/CreateJiraIssueRequestDataRelationships"; +export { CreateNotificationChannelAttributes } from "./models/CreateNotificationChannelAttributes"; +export { CreateNotificationChannelConfig } from "./models/CreateNotificationChannelConfig"; +export { CreateNotificationChannelData } from "./models/CreateNotificationChannelData"; export { CreateNotificationRuleParameters } from "./models/CreateNotificationRuleParameters"; export { CreateNotificationRuleParametersData } from "./models/CreateNotificationRuleParametersData"; export { CreateNotificationRuleParametersDataAttributes } from "./models/CreateNotificationRuleParametersDataAttributes"; @@ -1730,6 +1738,7 @@ export { CreatePageRequestDataType } from "./models/CreatePageRequestDataType"; export { CreatePageResponse } from "./models/CreatePageResponse"; export { CreatePageResponseData } from "./models/CreatePageResponseData"; export { CreatePageResponseDataType } from "./models/CreatePageResponseDataType"; +export { CreatePhoneNotificationChannelConfig } from "./models/CreatePhoneNotificationChannelConfig"; export { CreateRuleRequest } from "./models/CreateRuleRequest"; export { CreateRuleRequestData } from "./models/CreateRuleRequestData"; export { CreateRuleResponse } from "./models/CreateRuleResponse"; @@ -1765,6 +1774,7 @@ export { CreateUploadResponse } from "./models/CreateUploadResponse"; export { CreateUploadResponseData } from "./models/CreateUploadResponseData"; export { CreateUploadResponseDataAttributes } from "./models/CreateUploadResponseDataAttributes"; export { CreateUploadResponseDataType } from "./models/CreateUploadResponseDataType"; +export { CreateUserNotificationChannelRequest } from "./models/CreateUserNotificationChannelRequest"; export { CreateWorkflowRequest } from "./models/CreateWorkflowRequest"; export { CreateWorkflowResponse } from "./models/CreateWorkflowResponse"; export { Creator } from "./models/Creator"; @@ -2815,6 +2825,7 @@ export { ListFindingsMeta } from "./models/ListFindingsMeta"; export { ListFindingsPage } from "./models/ListFindingsPage"; export { ListFindingsResponse } from "./models/ListFindingsResponse"; export { ListKindCatalogResponse } from "./models/ListKindCatalogResponse"; +export { ListNotificationChannelsResponse } from "./models/ListNotificationChannelsResponse"; export { ListPipelinesResponse } from "./models/ListPipelinesResponse"; export { ListPipelinesResponseMeta } from "./models/ListPipelinesResponseMeta"; export { ListPowerpacksResponse } from "./models/ListPowerpacksResponse"; @@ -3100,6 +3111,18 @@ export { MonthlyCostAttributionResponse } from "./models/MonthlyCostAttributionR export { MSTeamsIntegrationMetadata } from "./models/MSTeamsIntegrationMetadata"; export { MSTeamsIntegrationMetadataTeamsItem } from "./models/MSTeamsIntegrationMetadataTeamsItem"; export { NotebookTriggerWrapper } from "./models/NotebookTriggerWrapper"; +export { NotificationChannel } from "./models/NotificationChannel"; +export { NotificationChannelAttributes } from "./models/NotificationChannelAttributes"; +export { NotificationChannelConfig } from "./models/NotificationChannelConfig"; +export { NotificationChannelData } from "./models/NotificationChannelData"; +export { NotificationChannelEmailConfig } from "./models/NotificationChannelEmailConfig"; +export { NotificationChannelEmailConfigType } from "./models/NotificationChannelEmailConfigType"; +export { NotificationChannelEmailFormatType } from "./models/NotificationChannelEmailFormatType"; +export { NotificationChannelPhoneConfig } from "./models/NotificationChannelPhoneConfig"; +export { NotificationChannelPhoneConfigType } from "./models/NotificationChannelPhoneConfigType"; +export { NotificationChannelPushConfig } from "./models/NotificationChannelPushConfig"; +export { NotificationChannelPushConfigType } from "./models/NotificationChannelPushConfigType"; +export { NotificationChannelType } from "./models/NotificationChannelType"; export { NotificationRule } from "./models/NotificationRule"; export { NotificationRuleAttributes } from "./models/NotificationRuleAttributes"; export { NotificationRuleResponse } from "./models/NotificationRuleResponse"; diff --git a/packages/datadog-api-client-v2/models/CreateEmailNotificationChannelConfig.ts b/packages/datadog-api-client-v2/models/CreateEmailNotificationChannelConfig.ts new file mode 100644 index 000000000000..2b5c822474cf --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateEmailNotificationChannelConfig.ts @@ -0,0 +1,73 @@ +/** + * 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. + */ +import { NotificationChannelEmailConfigType } from "./NotificationChannelEmailConfigType"; +import { NotificationChannelEmailFormatType } from "./NotificationChannelEmailFormatType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Configuration to create an e-mail notification channel + */ +export class CreateEmailNotificationChannelConfig { + /** + * The e-mail address to be notified + */ + "address": string; + /** + * Preferred content formats for notifications. + */ + "formats": Array; + /** + * Indicates that the notification channel is an e-mail address + */ + "type": NotificationChannelEmailConfigType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + address: { + baseName: "address", + type: "string", + required: true, + }, + formats: { + baseName: "formats", + type: "Array", + required: true, + }, + type: { + baseName: "type", + type: "NotificationChannelEmailConfigType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateEmailNotificationChannelConfig.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreateNotificationChannelAttributes.ts b/packages/datadog-api-client-v2/models/CreateNotificationChannelAttributes.ts new file mode 100644 index 000000000000..7b8388e61f15 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateNotificationChannelAttributes.ts @@ -0,0 +1,53 @@ +/** + * 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. + */ +import { CreateNotificationChannelConfig } from "./CreateNotificationChannelConfig"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes for creating an on-call notification channel. + */ +export class CreateNotificationChannelAttributes { + /** + * Defines the configuration for creating an On-Call notification channel + */ + "config"?: CreateNotificationChannelConfig; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + config: { + baseName: "config", + type: "CreateNotificationChannelConfig", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateNotificationChannelAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreateNotificationChannelConfig.ts b/packages/datadog-api-client-v2/models/CreateNotificationChannelConfig.ts new file mode 100644 index 000000000000..a7f6d8b05819 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateNotificationChannelConfig.ts @@ -0,0 +1,18 @@ +/** + * 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. + */ +import { CreateEmailNotificationChannelConfig } from "./CreateEmailNotificationChannelConfig"; +import { CreatePhoneNotificationChannelConfig } from "./CreatePhoneNotificationChannelConfig"; + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Defines the configuration for creating an On-Call notification channel + */ + +export type CreateNotificationChannelConfig = + | CreatePhoneNotificationChannelConfig + | CreateEmailNotificationChannelConfig + | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/CreateNotificationChannelData.ts b/packages/datadog-api-client-v2/models/CreateNotificationChannelData.ts new file mode 100644 index 000000000000..9eb2d551175e --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateNotificationChannelData.ts @@ -0,0 +1,63 @@ +/** + * 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. + */ +import { CreateNotificationChannelAttributes } from "./CreateNotificationChannelAttributes"; +import { NotificationChannelType } from "./NotificationChannelType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data for creating an on-call notification channel + */ +export class CreateNotificationChannelData { + /** + * Attributes for creating an on-call notification channel. + */ + "attributes"?: CreateNotificationChannelAttributes; + /** + * Indicates that the resource is of type 'notification_channels'. + */ + "type": NotificationChannelType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "CreateNotificationChannelAttributes", + }, + type: { + baseName: "type", + type: "NotificationChannelType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateNotificationChannelData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreatePhoneNotificationChannelConfig.ts b/packages/datadog-api-client-v2/models/CreatePhoneNotificationChannelConfig.ts new file mode 100644 index 000000000000..59be1dea89e4 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePhoneNotificationChannelConfig.ts @@ -0,0 +1,63 @@ +/** + * 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. + */ +import { NotificationChannelPhoneConfigType } from "./NotificationChannelPhoneConfigType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Configuration to create a phone notification channel + */ +export class CreatePhoneNotificationChannelConfig { + /** + * The E-164 formatted phone number (e.g. +3371234567) + */ + "number": string; + /** + * Indicates that the notification channel is a phone + */ + "type": NotificationChannelPhoneConfigType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + number: { + baseName: "number", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "NotificationChannelPhoneConfigType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreatePhoneNotificationChannelConfig.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreateUserNotificationChannelRequest.ts b/packages/datadog-api-client-v2/models/CreateUserNotificationChannelRequest.ts new file mode 100644 index 000000000000..c2b66dc4e3fe --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateUserNotificationChannelRequest.ts @@ -0,0 +1,54 @@ +/** + * 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. + */ +import { CreateNotificationChannelData } from "./CreateNotificationChannelData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A top-level wrapper for creating a notification channel for a user + */ +export class CreateUserNotificationChannelRequest { + /** + * Data for creating an on-call notification channel + */ + "data": CreateNotificationChannelData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "CreateNotificationChannelData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateUserNotificationChannelRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ListNotificationChannelsResponse.ts b/packages/datadog-api-client-v2/models/ListNotificationChannelsResponse.ts new file mode 100644 index 000000000000..8f5f4e0e75c3 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ListNotificationChannelsResponse.ts @@ -0,0 +1,50 @@ +/** + * 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. + */ +import { NotificationChannelData } from "./NotificationChannelData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response type for listing notification channels for a user + */ +export class ListNotificationChannelsResponse { + "data"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ListNotificationChannelsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/NotificationChannel.ts b/packages/datadog-api-client-v2/models/NotificationChannel.ts new file mode 100644 index 000000000000..7f62c749ed5a --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannel.ts @@ -0,0 +1,53 @@ +/** + * 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. + */ +import { NotificationChannelData } from "./NotificationChannelData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A top-level wrapper for a user notification channel + */ +export class NotificationChannel { + /** + * Data for an on-call notification channel + */ + "data"?: NotificationChannelData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "NotificationChannelData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return NotificationChannel.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/NotificationChannelAttributes.ts b/packages/datadog-api-client-v2/models/NotificationChannelAttributes.ts new file mode 100644 index 000000000000..7c3d12815ed0 --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelAttributes.ts @@ -0,0 +1,61 @@ +/** + * 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. + */ +import { NotificationChannelConfig } from "./NotificationChannelConfig"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes for an on-call notification channel. + */ +export class NotificationChannelAttributes { + /** + * Whether the notification channel is currently active. + */ + "active"?: boolean; + /** + * Defines the configuration for an On-Call notification channel + */ + "config"?: NotificationChannelConfig; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + active: { + baseName: "active", + type: "boolean", + }, + config: { + baseName: "config", + type: "NotificationChannelConfig", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return NotificationChannelAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/NotificationChannelConfig.ts b/packages/datadog-api-client-v2/models/NotificationChannelConfig.ts new file mode 100644 index 000000000000..be6873353961 --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelConfig.ts @@ -0,0 +1,20 @@ +/** + * 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. + */ +import { NotificationChannelEmailConfig } from "./NotificationChannelEmailConfig"; +import { NotificationChannelPhoneConfig } from "./NotificationChannelPhoneConfig"; +import { NotificationChannelPushConfig } from "./NotificationChannelPushConfig"; + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Defines the configuration for an On-Call notification channel + */ + +export type NotificationChannelConfig = + | NotificationChannelPhoneConfig + | NotificationChannelEmailConfig + | NotificationChannelPushConfig + | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/NotificationChannelData.ts b/packages/datadog-api-client-v2/models/NotificationChannelData.ts new file mode 100644 index 000000000000..8715070099bf --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelData.ts @@ -0,0 +1,71 @@ +/** + * 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. + */ +import { NotificationChannelAttributes } from "./NotificationChannelAttributes"; +import { NotificationChannelType } from "./NotificationChannelType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data for an on-call notification channel + */ +export class NotificationChannelData { + /** + * Attributes for an on-call notification channel. + */ + "attributes"?: NotificationChannelAttributes; + /** + * Unique identifier for the channel + */ + "id"?: string; + /** + * Indicates that the resource is of type 'notification_channels'. + */ + "type": NotificationChannelType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "NotificationChannelAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "NotificationChannelType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return NotificationChannelData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/NotificationChannelEmailConfig.ts b/packages/datadog-api-client-v2/models/NotificationChannelEmailConfig.ts new file mode 100644 index 000000000000..e62e853eb323 --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelEmailConfig.ts @@ -0,0 +1,73 @@ +/** + * 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. + */ +import { NotificationChannelEmailConfigType } from "./NotificationChannelEmailConfigType"; +import { NotificationChannelEmailFormatType } from "./NotificationChannelEmailFormatType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Email notification channel configuration + */ +export class NotificationChannelEmailConfig { + /** + * The e-mail address to be notified + */ + "address": string; + /** + * Preferred content formats for notifications. + */ + "formats": Array; + /** + * Indicates that the notification channel is an e-mail address + */ + "type": NotificationChannelEmailConfigType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + address: { + baseName: "address", + type: "string", + required: true, + }, + formats: { + baseName: "formats", + type: "Array", + required: true, + }, + type: { + baseName: "type", + type: "NotificationChannelEmailConfigType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return NotificationChannelEmailConfig.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/NotificationChannelEmailConfigType.ts b/packages/datadog-api-client-v2/models/NotificationChannelEmailConfigType.ts new file mode 100644 index 000000000000..b809c6d15821 --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelEmailConfigType.ts @@ -0,0 +1,14 @@ +/** + * 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. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Indicates that the notification channel is an e-mail address + */ + +export type NotificationChannelEmailConfigType = typeof EMAIL | UnparsedObject; +export const EMAIL = "email"; diff --git a/packages/datadog-api-client-v2/models/NotificationChannelEmailFormatType.ts b/packages/datadog-api-client-v2/models/NotificationChannelEmailFormatType.ts new file mode 100644 index 000000000000..224a4f465b7b --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelEmailFormatType.ts @@ -0,0 +1,18 @@ +/** + * 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. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Specifies the format of the e-mail that is sent for On-Call notifications + */ + +export type NotificationChannelEmailFormatType = + | typeof HTML + | typeof TEXT + | UnparsedObject; +export const HTML = "html"; +export const TEXT = "text"; diff --git a/packages/datadog-api-client-v2/models/NotificationChannelPhoneConfig.ts b/packages/datadog-api-client-v2/models/NotificationChannelPhoneConfig.ts new file mode 100644 index 000000000000..5985d4244f5d --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelPhoneConfig.ts @@ -0,0 +1,99 @@ +/** + * 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. + */ +import { NotificationChannelPhoneConfigType } from "./NotificationChannelPhoneConfigType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Phone notification channel configuration + */ +export class NotificationChannelPhoneConfig { + /** + * The formatted international version of Number (e.g. +33 7 1 23 45 67). + */ + "formattedNumber": string; + /** + * The E-164 formatted phone number (e.g. +3371234567) + */ + "number": string; + /** + * The ISO 3166-1 alpha-2 two-letter country code. + */ + "region": string; + /** + * If present, the date the user subscribed this number to SMS messages + */ + "smsSubscribedAt"?: Date; + /** + * Indicates that the notification channel is a phone + */ + "type": NotificationChannelPhoneConfigType; + /** + * Indicates whether this phone has been verified by the user in Datadog On-Call + */ + "verified": boolean; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + formattedNumber: { + baseName: "formatted_number", + type: "string", + required: true, + }, + number: { + baseName: "number", + type: "string", + required: true, + }, + region: { + baseName: "region", + type: "string", + required: true, + }, + smsSubscribedAt: { + baseName: "sms_subscribed_at", + type: "Date", + format: "date-time", + }, + type: { + baseName: "type", + type: "NotificationChannelPhoneConfigType", + required: true, + }, + verified: { + baseName: "verified", + type: "boolean", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return NotificationChannelPhoneConfig.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/NotificationChannelPhoneConfigType.ts b/packages/datadog-api-client-v2/models/NotificationChannelPhoneConfigType.ts new file mode 100644 index 000000000000..617d4b3c7044 --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelPhoneConfigType.ts @@ -0,0 +1,14 @@ +/** + * 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. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Indicates that the notification channel is a phone + */ + +export type NotificationChannelPhoneConfigType = typeof PHONE | UnparsedObject; +export const PHONE = "phone"; diff --git a/packages/datadog-api-client-v2/models/NotificationChannelPushConfig.ts b/packages/datadog-api-client-v2/models/NotificationChannelPushConfig.ts new file mode 100644 index 000000000000..5870cad38b94 --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelPushConfig.ts @@ -0,0 +1,72 @@ +/** + * 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. + */ +import { NotificationChannelPushConfigType } from "./NotificationChannelPushConfigType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Push notification channel configuration + */ +export class NotificationChannelPushConfig { + /** + * The name of the application used to receive push notifications + */ + "applicationName": string; + /** + * The name of the mobile device being used + */ + "deviceName": string; + /** + * Indicates that the notification channel is a mobile device for push notifications + */ + "type": NotificationChannelPushConfigType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + applicationName: { + baseName: "application_name", + type: "string", + required: true, + }, + deviceName: { + baseName: "device_name", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "NotificationChannelPushConfigType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return NotificationChannelPushConfig.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/NotificationChannelPushConfigType.ts b/packages/datadog-api-client-v2/models/NotificationChannelPushConfigType.ts new file mode 100644 index 000000000000..1352af7c7f26 --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelPushConfigType.ts @@ -0,0 +1,14 @@ +/** + * 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. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Indicates that the notification channel is a mobile device for push notifications + */ + +export type NotificationChannelPushConfigType = typeof PUSH | UnparsedObject; +export const PUSH = "push"; diff --git a/packages/datadog-api-client-v2/models/NotificationChannelType.ts b/packages/datadog-api-client-v2/models/NotificationChannelType.ts new file mode 100644 index 000000000000..4af1404fb659 --- /dev/null +++ b/packages/datadog-api-client-v2/models/NotificationChannelType.ts @@ -0,0 +1,16 @@ +/** + * 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. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Indicates that the resource is of type 'notification_channels'. + */ + +export type NotificationChannelType = + | typeof NOTIFICATION_CHANNELS + | UnparsedObject; +export const NOTIFICATION_CHANNELS = "notification_channels"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 40adf981adb1..1f67c4869f6f 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -562,12 +562,15 @@ import { CreateDeploymentGateParamsDataAttributes } from "./CreateDeploymentGate import { CreateDeploymentRuleParams } from "./CreateDeploymentRuleParams"; import { CreateDeploymentRuleParamsData } from "./CreateDeploymentRuleParamsData"; import { CreateDeploymentRuleParamsDataAttributes } from "./CreateDeploymentRuleParamsDataAttributes"; +import { CreateEmailNotificationChannelConfig } from "./CreateEmailNotificationChannelConfig"; import { CreateIncidentNotificationRuleRequest } from "./CreateIncidentNotificationRuleRequest"; import { CreateIncidentNotificationTemplateRequest } from "./CreateIncidentNotificationTemplateRequest"; import { CreateJiraIssueRequestArray } from "./CreateJiraIssueRequestArray"; import { CreateJiraIssueRequestData } from "./CreateJiraIssueRequestData"; import { CreateJiraIssueRequestDataAttributes } from "./CreateJiraIssueRequestDataAttributes"; import { CreateJiraIssueRequestDataRelationships } from "./CreateJiraIssueRequestDataRelationships"; +import { CreateNotificationChannelAttributes } from "./CreateNotificationChannelAttributes"; +import { CreateNotificationChannelData } from "./CreateNotificationChannelData"; import { CreateNotificationRuleParameters } from "./CreateNotificationRuleParameters"; import { CreateNotificationRuleParametersData } from "./CreateNotificationRuleParametersData"; import { CreateNotificationRuleParametersDataAttributes } from "./CreateNotificationRuleParametersDataAttributes"; @@ -580,6 +583,7 @@ import { CreatePageRequestDataAttributes } from "./CreatePageRequestDataAttribut import { CreatePageRequestDataAttributesTarget } from "./CreatePageRequestDataAttributesTarget"; import { CreatePageResponse } from "./CreatePageResponse"; import { CreatePageResponseData } from "./CreatePageResponseData"; +import { CreatePhoneNotificationChannelConfig } from "./CreatePhoneNotificationChannelConfig"; import { CreateRuleRequest } from "./CreateRuleRequest"; import { CreateRuleRequestData } from "./CreateRuleRequestData"; import { CreateRuleResponse } from "./CreateRuleResponse"; @@ -610,6 +614,7 @@ import { CreateUploadRequestDataAttributes } from "./CreateUploadRequestDataAttr import { CreateUploadResponse } from "./CreateUploadResponse"; import { CreateUploadResponseData } from "./CreateUploadResponseData"; import { CreateUploadResponseDataAttributes } from "./CreateUploadResponseDataAttributes"; +import { CreateUserNotificationChannelRequest } from "./CreateUserNotificationChannelRequest"; import { CreateWorkflowRequest } from "./CreateWorkflowRequest"; import { CreateWorkflowResponse } from "./CreateWorkflowResponse"; import { Creator } from "./Creator"; @@ -1415,6 +1420,7 @@ import { ListFindingsMeta } from "./ListFindingsMeta"; import { ListFindingsPage } from "./ListFindingsPage"; import { ListFindingsResponse } from "./ListFindingsResponse"; import { ListKindCatalogResponse } from "./ListKindCatalogResponse"; +import { ListNotificationChannelsResponse } from "./ListNotificationChannelsResponse"; import { ListPipelinesResponse } from "./ListPipelinesResponse"; import { ListPipelinesResponseMeta } from "./ListPipelinesResponseMeta"; import { ListPowerpacksResponse } from "./ListPowerpacksResponse"; @@ -1635,6 +1641,12 @@ import { MonthlyCostAttributionMeta } from "./MonthlyCostAttributionMeta"; import { MonthlyCostAttributionPagination } from "./MonthlyCostAttributionPagination"; import { MonthlyCostAttributionResponse } from "./MonthlyCostAttributionResponse"; import { NotebookTriggerWrapper } from "./NotebookTriggerWrapper"; +import { NotificationChannel } from "./NotificationChannel"; +import { NotificationChannelAttributes } from "./NotificationChannelAttributes"; +import { NotificationChannelData } from "./NotificationChannelData"; +import { NotificationChannelEmailConfig } from "./NotificationChannelEmailConfig"; +import { NotificationChannelPhoneConfig } from "./NotificationChannelPhoneConfig"; +import { NotificationChannelPushConfig } from "./NotificationChannelPushConfig"; import { NotificationRule } from "./NotificationRule"; import { NotificationRuleAttributes } from "./NotificationRuleAttributes"; import { NotificationRuleResponse } from "./NotificationRuleResponse"; @@ -3556,6 +3568,11 @@ const enumsMap: { [key: string]: any[] } = { MonitorDowntimeMatchResourceType: ["downtime_match"], MonitorNotificationRuleResourceType: ["monitor-notification-rule"], MonitorUserTemplateResourceType: ["monitor-user-template"], + NotificationChannelEmailConfigType: ["email"], + NotificationChannelEmailFormatType: ["html", "text"], + NotificationChannelPhoneConfigType: ["phone"], + NotificationChannelPushConfigType: ["push"], + NotificationChannelType: ["notification_channels"], NotificationRulesType: ["notification_rules"], NotionAPIKeyType: ["NotionAPIKey"], NotionIntegrationType: ["Notion"], @@ -5075,6 +5092,7 @@ const typeMap: { [index: string]: any } = { CreateDeploymentRuleParamsData: CreateDeploymentRuleParamsData, CreateDeploymentRuleParamsDataAttributes: CreateDeploymentRuleParamsDataAttributes, + CreateEmailNotificationChannelConfig: CreateEmailNotificationChannelConfig, CreateIncidentNotificationRuleRequest: CreateIncidentNotificationRuleRequest, CreateIncidentNotificationTemplateRequest: CreateIncidentNotificationTemplateRequest, @@ -5083,6 +5101,8 @@ const typeMap: { [index: string]: any } = { CreateJiraIssueRequestDataAttributes: CreateJiraIssueRequestDataAttributes, CreateJiraIssueRequestDataRelationships: CreateJiraIssueRequestDataRelationships, + CreateNotificationChannelAttributes: CreateNotificationChannelAttributes, + CreateNotificationChannelData: CreateNotificationChannelData, CreateNotificationRuleParameters: CreateNotificationRuleParameters, CreateNotificationRuleParametersData: CreateNotificationRuleParametersData, CreateNotificationRuleParametersDataAttributes: @@ -5096,6 +5116,7 @@ const typeMap: { [index: string]: any } = { CreatePageRequestDataAttributesTarget: CreatePageRequestDataAttributesTarget, CreatePageResponse: CreatePageResponse, CreatePageResponseData: CreatePageResponseData, + CreatePhoneNotificationChannelConfig: CreatePhoneNotificationChannelConfig, CreateRuleRequest: CreateRuleRequest, CreateRuleRequestData: CreateRuleRequestData, CreateRuleResponse: CreateRuleResponse, @@ -5140,6 +5161,7 @@ const typeMap: { [index: string]: any } = { CreateUploadResponse: CreateUploadResponse, CreateUploadResponseData: CreateUploadResponseData, CreateUploadResponseDataAttributes: CreateUploadResponseDataAttributes, + CreateUserNotificationChannelRequest: CreateUserNotificationChannelRequest, CreateWorkflowRequest: CreateWorkflowRequest, CreateWorkflowResponse: CreateWorkflowResponse, Creator: Creator, @@ -6056,6 +6078,7 @@ const typeMap: { [index: string]: any } = { ListFindingsPage: ListFindingsPage, ListFindingsResponse: ListFindingsResponse, ListKindCatalogResponse: ListKindCatalogResponse, + ListNotificationChannelsResponse: ListNotificationChannelsResponse, ListPipelinesResponse: ListPipelinesResponse, ListPipelinesResponseMeta: ListPipelinesResponseMeta, ListPowerpacksResponse: ListPowerpacksResponse, @@ -6317,6 +6340,12 @@ const typeMap: { [index: string]: any } = { MonthlyCostAttributionPagination: MonthlyCostAttributionPagination, MonthlyCostAttributionResponse: MonthlyCostAttributionResponse, NotebookTriggerWrapper: NotebookTriggerWrapper, + NotificationChannel: NotificationChannel, + NotificationChannelAttributes: NotificationChannelAttributes, + NotificationChannelData: NotificationChannelData, + NotificationChannelEmailConfig: NotificationChannelEmailConfig, + NotificationChannelPhoneConfig: NotificationChannelPhoneConfig, + NotificationChannelPushConfig: NotificationChannelPushConfig, NotificationRule: NotificationRule, NotificationRuleAttributes: NotificationRuleAttributes, NotificationRuleResponse: NotificationRuleResponse, @@ -7777,6 +7806,10 @@ const oneOfMap: { [index: string]: string[] } = { ConfigCatCredentialsUpdate: ["ConfigCatSDKKeyUpdate"], ContainerImageItem: ["ContainerImage", "ContainerImageGroup"], ContainerItem: ["Container", "ContainerGroup"], + CreateNotificationChannelConfig: [ + "CreatePhoneNotificationChannelConfig", + "CreateEmailNotificationChannelConfig", + ], CreateTableRequestDataAttributesFileMetadata: [ "CreateTableRequestDataAttributesFileMetadataCloudStorage", "CreateTableRequestDataAttributesFileMetadataLocalFile", @@ -7950,6 +7983,11 @@ const oneOfMap: { [index: string]: string[] } = { "MonitorNotificationRuleFilterScope", ], MonitorNotificationRuleResponseIncludedItem: ["User"], + NotificationChannelConfig: [ + "NotificationChannelPhoneConfig", + "NotificationChannelEmailConfig", + "NotificationChannelPushConfig", + ], NotionCredentials: ["NotionAPIKey"], NotionCredentialsUpdate: ["NotionAPIKeyUpdate"], ObservabilityPipelineConfigDestinationItem: [