diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 196165112daa..f2a1dc5e0820 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13374,6 +13374,40 @@ components: - name - targets type: object + CreateOnCallNotificationRuleRequest: + description: A top-level wrapper for creating a notification rule for a user + example: + data: + attributes: + category: high_urgency + channel_settings: + method: sms + type: phone + delay_minutes: 1 + relationships: + channel: + data: + id: 1562fab3-a8c2-49e2-8f3a-28dcda2405e2 + type: notification_channels + type: notification_rules + properties: + data: + $ref: '#/components/schemas/CreateOnCallNotificationRuleRequestData' + required: + - data + type: object + CreateOnCallNotificationRuleRequestData: + description: Data for creating an on-call notification rule + properties: + attributes: + $ref: '#/components/schemas/OnCallNotificationRuleRequestAttributes' + relationships: + $ref: '#/components/schemas/OnCallNotificationRuleRelationships' + type: + $ref: '#/components/schemas/OnCallNotificationRuleType' + required: + - type + type: object CreateOpenAPIResponse: description: Response for `CreateOpenAPI` operation. properties: @@ -30599,6 +30633,18 @@ components: $ref: '#/components/schemas/NotificationChannelData' type: array type: object + ListOnCallNotificationRulesResponse: + description: Response type for listing notification rules for a user + properties: + data: + items: + $ref: '#/components/schemas/OnCallNotificationRuleData' + type: array + included: + items: + $ref: '#/components/schemas/OnCallNotificationRulesIncluded' + type: array + type: object ListPipelinesResponse: description: Represents the response payload containing a list of pipelines and associated metadata. @@ -39053,6 +39099,130 @@ components: required: - type type: object + OnCallNotificationRule: + description: A top-level wrapper for a notification rule + example: + data: + attributes: + category: high_urgency + channel_settings: + method: sms + type: phone + delay_minutes: 1 + id: 27590dae-47be-4a7d-9abf-8f4e45124020 + relationships: + channel: + data: + id: 1562fab3-a8c2-49e2-8f3a-28dcda2405e2 + type: notification_channels + type: notification_rules + properties: + data: + $ref: '#/components/schemas/OnCallNotificationRuleData' + included: + items: + $ref: '#/components/schemas/OnCallNotificationRulesIncluded' + type: array + required: + - data + type: object + OnCallNotificationRuleAttributes: + description: Attributes for an on-call notification rule. + properties: + category: + $ref: '#/components/schemas/OnCallNotificationRuleCategory' + channel_settings: + $ref: '#/components/schemas/OnCallNotificationRuleChannelSettings' + description: Configuration for the associated channel, if necessary + nullable: true + delay_minutes: + description: The number of minutes that will elapse before this rule is + evaluated. 0 indicates immediate evaluation + format: int64 + type: integer + type: object + OnCallNotificationRuleCategory: + default: high_urgency + description: Specifies the category a notification rule will apply to + enum: + - high_urgency + - low_urgency + type: string + x-enum-varnames: + - HIGH_URGENCY + - LOW_URGENCY + OnCallNotificationRuleChannelRelationship: + description: Relationship object for creating a notification rule + properties: + data: + $ref: '#/components/schemas/OnCallNotificationRuleChannelRelationshipData' + required: + - data + type: object + OnCallNotificationRuleChannelRelationshipData: + description: Channel relationship data for creating a notification rule + properties: + id: + description: ID of the notification channel + type: string + type: + $ref: '#/components/schemas/NotificationChannelType' + type: object + OnCallNotificationRuleChannelSettings: + description: Defines the configuration for a channel associated with a notification + rule + oneOf: + - $ref: '#/components/schemas/OnCallPhoneNotificationRuleSettings' + OnCallNotificationRuleData: + description: Data for an on-call notification rule + properties: + attributes: + $ref: '#/components/schemas/OnCallNotificationRuleAttributes' + id: + description: Unique identifier for the rule + type: string + relationships: + $ref: '#/components/schemas/OnCallNotificationRuleRelationships' + type: + $ref: '#/components/schemas/OnCallNotificationRuleType' + required: + - type + type: object + OnCallNotificationRuleRelationships: + description: Relationship object for creating a notification rule + properties: + channel: + $ref: '#/components/schemas/OnCallNotificationRuleChannelRelationship' + type: object + OnCallNotificationRuleRequestAttributes: + description: Attributes for creating or modifying an on-call notification rule. + properties: + category: + $ref: '#/components/schemas/OnCallNotificationRuleCategory' + channel_settings: + $ref: '#/components/schemas/OnCallNotificationRuleChannelSettings' + description: Configuration for the associated channel, if necessary + nullable: true + delay_minutes: + description: The number of minutes that will elapse before this rule is + evaluated. 0 indicates immediate evaluation + format: int64 + type: integer + type: object + OnCallNotificationRuleType: + default: notification_rules + description: Indicates that the resource is of type 'notification_rules'. + enum: + - notification_rules + example: notification_rules + type: string + x-enum-varnames: + - NOTIFICATION_RULES + OnCallNotificationRulesIncluded: + description: Represents additional included resources for a on-call notification + rules + oneOf: + - $ref: '#/components/schemas/NotificationChannelData' OnCallPageTargetType: description: The kind of target, `team_id` | `team_handle` | `user_id`. enum: @@ -39065,6 +39235,29 @@ components: - TEAM_ID - TEAM_HANDLE - USER_ID + OnCallPhoneNotificationRuleMethod: + description: Specifies the method in which a phone is used in a notification + rule + enum: + - sms + - voice + example: sms + type: string + x-enum-varnames: + - SMS + - VOICE + OnCallPhoneNotificationRuleSettings: + description: Configuration for using a phone notification channel in a notification + rule + properties: + method: + $ref: '#/components/schemas/OnCallPhoneNotificationRuleMethod' + type: + $ref: '#/components/schemas/NotificationChannelPhoneConfigType' + required: + - type + - method + type: object OnDemandConcurrencyCap: description: On-demand concurrency cap. properties: @@ -56304,6 +56497,59 @@ components: - name - options type: object + UpdateOnCallNotificationRuleRequest: + description: A top-level wrapper for updating a notification rule for a user + example: + data: + attributes: + category: high_urgency + channel_settings: + method: sms + type: phone + delay_minutes: 1 + id: 2462ace1-49e2-aab1-xc4f-29cc4ae1105n7 + relationships: + channel: + data: + id: 1562fab3-a8c2-49e2-8f3a-28dcda2405e2 + type: notification_channels + type: notification_rules + properties: + data: + $ref: '#/components/schemas/UpdateOnCallNotificationRuleRequestData' + required: + - data + type: object + UpdateOnCallNotificationRuleRequestAttributes: + description: Attributes for creating or modifying an on-call notification rule. + properties: + category: + $ref: '#/components/schemas/OnCallNotificationRuleCategory' + channel_settings: + $ref: '#/components/schemas/OnCallNotificationRuleChannelSettings' + description: Configuration for the associated channel, if necessary + nullable: true + delay_minutes: + description: The number of minutes that will elapse before this rule is + evaluated. 0 indicates immediate evaluation + format: int64 + type: integer + type: object + UpdateOnCallNotificationRuleRequestData: + description: Data for updating an on-call notification rule + properties: + attributes: + $ref: '#/components/schemas/UpdateOnCallNotificationRuleRequestAttributes' + id: + description: Unique identifier for the rule + type: string + relationships: + $ref: '#/components/schemas/OnCallNotificationRuleRelationships' + type: + $ref: '#/components/schemas/OnCallNotificationRuleType' + required: + - type + type: object UpdateOpenAPIResponse: description: Response for `UpdateOpenAPI`. properties: @@ -76343,6 +76589,255 @@ paths: operator: AND permissions: - on_call_read + /api/v2/on-call/users/{user_id}/notification-rules: + get: + description: List the notification rules for a user. The authenticated user + must be the target user or have the `on_call_admin` permission + operationId: ListUserNotificationRules + parameters: + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `channel`.' + in: query + name: include + schema: + type: string + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListOnCallNotificationRulesResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List On-Call notification rules for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_read + post: + description: Create a new notification rule for a user. The authenticated user + must be the target user or have the `on_call_admin` permission + operationId: CreateUserNotificationRule + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateOnCallNotificationRuleRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/OnCallNotificationRule' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create an On-Call notification rule for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_respond + /api/v2/on-call/users/{user_id}/notification-rules/{rule_id}: + delete: + description: Delete a notification rule for a user. The authenticated user must + be the target user or have the `on_call_admin` permission + operationId: DeleteUserNotificationRule + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The rule ID + in: path + name: rule_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Delete an On-Call notification rule for a user + tags: + - On-Call + x-permission: + operator: OR + permissions: + - on_call_respond + get: + description: Get a notification rule for a user. The authenticated user must + be the target user or have the `on_call_admin` permission + operationId: GetUserNotificationRule + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The rule ID + in: path + name: rule_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `channel`.' + in: query + name: include + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OnCallNotificationRule' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get an On-Call notification rule for a user + tags: + - On-Call + x-permission: + operator: OR + permissions: + - on_call_read + put: + description: Update a notification rule for a user. The authenticated user must + be the target user or have the `on_call_admin` permission + operationId: UpdateUserNotificationRule + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The rule ID + in: path + name: rule_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `channel`.' + in: query + name: include + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOnCallNotificationRuleRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OnCallNotificationRule' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update an On-Call notification rule for a user + tags: + - On-Call + x-permission: + operator: OR + permissions: + - on_call_read /api/v2/org_configs: get: description: Returns all Org Configs (name, description, and value). diff --git a/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response_1478259628/frozen.json b/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response_1478259628/frozen.json new file mode 100644 index 000000000000..79392004a5f9 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response_1478259628/frozen.json @@ -0,0 +1 @@ +"2025-12-16T19:30:04.834Z" diff --git a/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response_1478259628/recording.har b/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response_1478259628/recording.har new file mode 100644 index 000000000000..497c7ea2909d --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response_1478259628/recording.har @@ -0,0 +1,210 @@ +{ + "log": { + "_recordingName": "On-Call/Create an On-Call notification rule for a user returns \"Created\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "603e6dc372cf57456bdf4520e65beb45", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 173, + "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_rule_for_a_user_returns_Created_response-1765913404@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users" + }, + "response": { + "bodySize": 770, + "content": { + "mimeType": "application/json", + "size": 770, + "text": "{\"data\":{\"type\":\"users\",\"id\":\"2ab53f07-289f-4060-b21a-3d704096aadf\",\"attributes\":{\"name\":null,\"handle\":\"test-create_an_on_call_notification_rule_for_a_user_returns_created_response-1765913404@datadoghq.com\",\"created_at\":\"2025-12-16T19:30:05.014723+00:00\",\"modified_at\":\"2025-12-16T19:30:05.014723+00:00\",\"email\":\"test-create_an_on_call_notification_rule_for_a_user_returns_created_response-1765913404@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/c5ddb15c50d998db06711e0a31591216?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T19:30:04.838Z", + "time": 181 + }, + { + "_id": "8f6e4e6917a3eef4cc1a432c5d2b54f0", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 215, + "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-create_an_on_call_notification_rule_for_a_user_returns_created_response-1765913404@datadoghq.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/2ab53f07-289f-4060-b21a-3d704096aadf/notification-channels" + }, + "response": { + "bodySize": 273, + "content": { + "mimeType": "application/vnd.api+json", + "size": 273, + "text": "{\"data\":{\"id\":\"ca8520ce-27e0-4bba-997f-004047cda45d\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-create_an_on_call_notification_rule_for_a_user_returns_created_response-1765913404@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T19:30:05.027Z", + "time": 123 + }, + { + "_id": "28420a444c30927d0b4c5932c10915a5", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 211, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 630, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"ca8520ce-27e0-4bba-997f-004047cda45d\",\"type\":\"notification_channels\"}}},\"type\":\"notification_rules\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/2ab53f07-289f-4060-b21a-3d704096aadf/notification-rules" + }, + "response": { + "bodySize": 255, + "content": { + "mimeType": "application/vnd.api+json", + "size": 255, + "text": "{\"data\":{\"id\":\"4e551e4f-d1aa-4fce-8cc7-c6bf98925efe\",\"type\":\"notification_rules\",\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"ca8520ce-27e0-4bba-997f-004047cda45d\",\"type\":\"notification_channels\"}}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T19:30:05.165Z", + "time": 171 + }, + { + "_id": "99fd0d5ded681e056858a46a02bec632", + "_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/2ab53f07-289f-4060-b21a-3d704096aadf" + }, + "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-16T19:30:05.348Z", + "time": 224 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response_198789539/frozen.json b/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response_198789539/frozen.json new file mode 100644 index 000000000000..b664598a2e85 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response_198789539/frozen.json @@ -0,0 +1 @@ +"2025-12-16T19:29:36.256Z" diff --git a/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response_198789539/recording.har b/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response_198789539/recording.har new file mode 100644 index 000000000000..efcadab1ce38 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response_198789539/recording.har @@ -0,0 +1,247 @@ +{ + "log": { + "_recordingName": "On-Call/Delete an On-Call notification rule for a user returns \"No Content\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "577bc725f06b57646a8cbb1c73518c33", + "_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-Delete_an_On_Call_notification_rule_for_a_user_returns_No_Content_response-1765913376@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\":\"5ebbe76d-c072-4909-ba24-ffa71f4597a0\",\"attributes\":{\"name\":null,\"handle\":\"test-delete_an_on_call_notification_rule_for_a_user_returns_no_content_response-1765913376@datadoghq.com\",\"created_at\":\"2025-12-16T19:29:36.461504+00:00\",\"modified_at\":\"2025-12-16T19:29:36.461504+00:00\",\"email\":\"test-delete_an_on_call_notification_rule_for_a_user_returns_no_content_response-1765913376@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/dad7a8a5508730e67ad8dea90bcc189c?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T19:29:36.260Z", + "time": 207 + }, + { + "_id": "c26997eb44916addd02a186b50160d47", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 218, + "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_rule_for_a_user_returns_no_content_response-1765913376@datadoghq.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/5ebbe76d-c072-4909-ba24-ffa71f4597a0/notification-channels" + }, + "response": { + "bodySize": 276, + "content": { + "mimeType": "application/vnd.api+json", + "size": 276, + "text": "{\"data\":{\"id\":\"a557eb68-8b0a-48cf-ac65-73aede790994\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-delete_an_on_call_notification_rule_for_a_user_returns_no_content_response-1765913376@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T19:29:36.471Z", + "time": 109 + }, + { + "_id": "6075f27c379fbe76580076b17974661e", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 211, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 630, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"a557eb68-8b0a-48cf-ac65-73aede790994\",\"type\":\"notification_channels\"}}},\"type\":\"notification_rules\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/5ebbe76d-c072-4909-ba24-ffa71f4597a0/notification-rules" + }, + "response": { + "bodySize": 255, + "content": { + "mimeType": "application/vnd.api+json", + "size": 255, + "text": "{\"data\":{\"id\":\"71e9f009-5a69-4946-992e-d76b05d1ae61\",\"type\":\"notification_rules\",\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"a557eb68-8b0a-48cf-ac65-73aede790994\",\"type\":\"notification_channels\"}}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T19:29:36.584Z", + "time": 157 + }, + { + "_id": "63e2e886da6936d6ebeab1e7e3b197ac", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 603, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/5ebbe76d-c072-4909-ba24-ffa71f4597a0/notification-rules/71e9f009-5a69-4946-992e-d76b05d1ae61" + }, + "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-16T19:29:36.755Z", + "time": 132 + }, + { + "_id": "8072a58ee13a1646be58271789562c00", + "_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/5ebbe76d-c072-4909-ba24-ffa71f4597a0" + }, + "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-16T19:29:36.902Z", + "time": 186 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response_2648752890/frozen.json b/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response_2648752890/frozen.json new file mode 100644 index 000000000000..cf519c3038a8 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response_2648752890/frozen.json @@ -0,0 +1 @@ +"2025-12-16T21:16:24.271Z" diff --git a/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response_2648752890/recording.har b/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response_2648752890/recording.har new file mode 100644 index 000000000000..f0b1a002cb2c --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response_2648752890/recording.har @@ -0,0 +1,258 @@ +{ + "log": { + "_recordingName": "On-Call/Get an On-Call notification rule for a user returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "4346a21731dac8fbbc3ad876d2fcc30d", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 165, + "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_rule_for_a_user_returns_OK_response-1765919784@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users" + }, + "response": { + "bodySize": 754, + "content": { + "mimeType": "application/json", + "size": 754, + "text": "{\"data\":{\"type\":\"users\",\"id\":\"b2a555c9-ac2d-430d-b321-10e4c0201ce3\",\"attributes\":{\"name\":null,\"handle\":\"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com\",\"created_at\":\"2025-12-16T21:16:24.480454+00:00\",\"modified_at\":\"2025-12-16T21:16:24.480454+00:00\",\"email\":\"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/8e38ab440c2cdd2808a61dfa83f734d7?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T21:16:24.275Z", + "time": 228 + }, + { + "_id": "e08007250191c1c09b5920496037a823", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 207, + "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_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/b2a555c9-ac2d-430d-b321-10e4c0201ce3/notification-channels" + }, + "response": { + "bodySize": 265, + "content": { + "mimeType": "application/vnd.api+json", + "size": 265, + "text": "{\"data\":{\"id\":\"767234b0-0c79-4092-9b44-a8963021795b\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T21:16:24.512Z", + "time": 150 + }, + { + "_id": "046888e30b7be794c343e9844d2a970e", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 211, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 630, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"767234b0-0c79-4092-9b44-a8963021795b\",\"type\":\"notification_channels\"}}},\"type\":\"notification_rules\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/b2a555c9-ac2d-430d-b321-10e4c0201ce3/notification-rules" + }, + "response": { + "bodySize": 255, + "content": { + "mimeType": "application/vnd.api+json", + "size": 255, + "text": "{\"data\":{\"id\":\"d07cc90b-4fc5-455f-8f57-45d48a658bc6\",\"type\":\"notification_rules\",\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"767234b0-0c79-4092-9b44-a8963021795b\",\"type\":\"notification_channels\"}}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T21:16:24.671Z", + "time": 223 + }, + { + "_id": "d635a2ab0aada438ec09d8d3e05f4cc7", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 626, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [ + { + "name": "include", + "value": "channel" + } + ], + "url": "https://api.datadoghq.com/api/v2/on-call/users/b2a555c9-ac2d-430d-b321-10e4c0201ce3/notification-rules/d07cc90b-4fc5-455f-8f57-45d48a658bc6?include=channel" + }, + "response": { + "bodySize": 525, + "content": { + "mimeType": "application/vnd.api+json", + "size": 525, + "text": "{\"data\":{\"id\":\"d07cc90b-4fc5-455f-8f57-45d48a658bc6\",\"type\":\"notification_rules\",\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"767234b0-0c79-4092-9b44-a8963021795b\",\"type\":\"notification_channels\"}}}},\"included\":[{\"id\":\"767234b0-0c79-4092-9b44-a8963021795b\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-get_an_on_call_notification_rule_for_a_user_returns_ok_response-1765919784@datadoghq.com\",\"formats\":[\"html\"]}}}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-12-16T21:16:24.907Z", + "time": 74 + }, + { + "_id": "c81374ce2fef2177b5b19799878d2ce0", + "_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/b2a555c9-ac2d-430d-b321-10e4c0201ce3" + }, + "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-16T21:16:24.990Z", + "time": 450 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/On-Call_446749911/List-On-Call-notification-rules-for-a-user-returns-OK-response_312236816/frozen.json b/cassettes/v2/On-Call_446749911/List-On-Call-notification-rules-for-a-user-returns-OK-response_312236816/frozen.json new file mode 100644 index 000000000000..b2584dc6421b --- /dev/null +++ b/cassettes/v2/On-Call_446749911/List-On-Call-notification-rules-for-a-user-returns-OK-response_312236816/frozen.json @@ -0,0 +1 @@ +"2025-12-16T21:16:48.356Z" diff --git a/cassettes/v2/On-Call_446749911/List-On-Call-notification-rules-for-a-user-returns-OK-response_312236816/recording.har b/cassettes/v2/On-Call_446749911/List-On-Call-notification-rules-for-a-user-returns-OK-response_312236816/recording.har new file mode 100644 index 000000000000..90d24fdf34df --- /dev/null +++ b/cassettes/v2/On-Call_446749911/List-On-Call-notification-rules-for-a-user-returns-OK-response_312236816/recording.har @@ -0,0 +1,258 @@ +{ + "log": { + "_recordingName": "On-Call/List On-Call notification rules for a user returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "0c2ec0ddd6054d164fd6c4cf9fa9e5cf", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 164, + "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_rules_for_a_user_returns_OK_response-1765919808@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/users" + }, + "response": { + "bodySize": 752, + "content": { + "mimeType": "application/json", + "size": 752, + "text": "{\"data\":{\"type\":\"users\",\"id\":\"0730802a-ee45-404b-a21d-5908d4c6b3c4\",\"attributes\":{\"name\":null,\"handle\":\"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com\",\"created_at\":\"2025-12-16T21:16:48.579239+00:00\",\"modified_at\":\"2025-12-16T21:16:48.579239+00:00\",\"email\":\"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/c2f584fb6a42fbc0f0aad204ea40c0fc?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T21:16:48.359Z", + "time": 232 + }, + { + "_id": "ee7d2be6ce94aeb1db86c2e88e581bae", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 206, + "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_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/0730802a-ee45-404b-a21d-5908d4c6b3c4/notification-channels" + }, + "response": { + "bodySize": 264, + "content": { + "mimeType": "application/vnd.api+json", + "size": 264, + "text": "{\"data\":{\"id\":\"3073e724-15e8-4aec-897a-478e31cca3a8\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T21:16:48.601Z", + "time": 100 + }, + { + "_id": "a4499984d63ad38e2aebcd19de807981", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 211, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 630, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"3073e724-15e8-4aec-897a-478e31cca3a8\",\"type\":\"notification_channels\"}}},\"type\":\"notification_rules\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/0730802a-ee45-404b-a21d-5908d4c6b3c4/notification-rules" + }, + "response": { + "bodySize": 255, + "content": { + "mimeType": "application/vnd.api+json", + "size": 255, + "text": "{\"data\":{\"id\":\"d93215d1-85c1-4528-a92f-1b604c1f4b2a\",\"type\":\"notification_rules\",\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"3073e724-15e8-4aec-897a-478e31cca3a8\",\"type\":\"notification_channels\"}}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-16T21:16:48.710Z", + "time": 149 + }, + { + "_id": "cac80a28daf75e1a5ed65a3bff53d071", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 591, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [ + { + "name": "include", + "value": "channel" + } + ], + "url": "https://api.datadoghq.com/api/v2/on-call/users/0730802a-ee45-404b-a21d-5908d4c6b3c4/notification-rules?include=channel" + }, + "response": { + "bodySize": 526, + "content": { + "mimeType": "application/vnd.api+json", + "size": 526, + "text": "{\"data\":[{\"id\":\"d93215d1-85c1-4528-a92f-1b604c1f4b2a\",\"type\":\"notification_rules\",\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"3073e724-15e8-4aec-897a-478e31cca3a8\",\"type\":\"notification_channels\"}}}}],\"included\":[{\"id\":\"3073e724-15e8-4aec-897a-478e31cca3a8\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-list_on_call_notification_rules_for_a_user_returns_ok_response-1765919808@datadoghq.com\",\"formats\":[\"html\"]}}}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-12-16T21:16:48.871Z", + "time": 139 + }, + { + "_id": "244cbce89afc5a6d93b049d800516759", + "_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/0730802a-ee45-404b-a21d-5908d4c6b3c4" + }, + "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-16T21:16:49.019Z", + "time": 577 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/On-Call_446749911/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response_2003371705/frozen.json b/cassettes/v2/On-Call_446749911/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response_2003371705/frozen.json new file mode 100644 index 000000000000..63ef47141fc6 --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response_2003371705/frozen.json @@ -0,0 +1 @@ +"2025-12-17T01:04:35.713Z" diff --git a/cassettes/v2/On-Call_446749911/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response_2003371705/recording.har b/cassettes/v2/On-Call_446749911/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response_2003371705/recording.har new file mode 100644 index 000000000000..2ec37f16a86d --- /dev/null +++ b/cassettes/v2/On-Call_446749911/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response_2003371705/recording.har @@ -0,0 +1,268 @@ +{ + "log": { + "_recordingName": "On-Call/Update an On-Call notification rule for a user returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "f737638123833870c6412c05e5ac094b", + "_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-Update_an_On_Call_notification_rule_for_a_user_returns_OK_response-1765933475@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\":\"4ef9cf45-30a8-4117-9b56-adba96671dff\",\"attributes\":{\"name\":null,\"handle\":\"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com\",\"created_at\":\"2025-12-17T01:04:36.246950+00:00\",\"modified_at\":\"2025-12-17T01:04:36.246950+00:00\",\"email\":\"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/53cbcba1803f4569f759fcc6b3f90bb6?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 681, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-17T01:04:35.717Z", + "time": 535 + }, + { + "_id": "afa680349fd4f139c1ff88e12d7e0e5b", + "_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-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com\",\"formats\":[\"html\"],\"type\":\"email\"}},\"type\":\"notification_channels\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/4ef9cf45-30a8-4117-9b56-adba96671dff/notification-channels" + }, + "response": { + "bodySize": 268, + "content": { + "mimeType": "application/vnd.api+json", + "size": 268, + "text": "{\"data\":{\"id\":\"7fc326c9-f3dc-4858-80c2-d88c24dcf54b\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com\",\"formats\":[\"html\"]}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-17T01:04:36.263Z", + "time": 119 + }, + { + "_id": "cd0c567b9cb26bc2256b0a061c7bedc9", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 211, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 630, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"7fc326c9-f3dc-4858-80c2-d88c24dcf54b\",\"type\":\"notification_channels\"}}},\"type\":\"notification_rules\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/on-call/users/4ef9cf45-30a8-4117-9b56-adba96671dff/notification-rules" + }, + "response": { + "bodySize": 255, + "content": { + "mimeType": "application/vnd.api+json", + "size": 255, + "text": "{\"data\":{\"id\":\"c7b724f1-eb73-43d4-889f-d8f3e6fbe664\",\"type\":\"notification_rules\",\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":0},\"relationships\":{\"channel\":{\"data\":{\"id\":\"7fc326c9-f3dc-4858-80c2-d88c24dcf54b\",\"type\":\"notification_channels\"}}}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2025-12-17T01:04:36.390Z", + "time": 116 + }, + { + "_id": "ac937398ca32e37adb6638bb890841a5", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 255, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 682, + "httpVersion": "HTTP/1.1", + "method": "PUT", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":1},\"id\":\"c7b724f1-eb73-43d4-889f-d8f3e6fbe664\",\"relationships\":{\"channel\":{\"data\":{\"id\":\"7fc326c9-f3dc-4858-80c2-d88c24dcf54b\",\"type\":\"notification_channels\"}}},\"type\":\"notification_rules\"}}" + }, + "queryString": [ + { + "name": "include", + "value": "channel" + } + ], + "url": "https://api.datadoghq.com/api/v2/on-call/users/4ef9cf45-30a8-4117-9b56-adba96671dff/notification-rules/c7b724f1-eb73-43d4-889f-d8f3e6fbe664?include=channel" + }, + "response": { + "bodySize": 528, + "content": { + "mimeType": "application/vnd.api+json", + "size": 528, + "text": "{\"data\":{\"id\":\"c7b724f1-eb73-43d4-889f-d8f3e6fbe664\",\"type\":\"notification_rules\",\"attributes\":{\"category\":\"high_urgency\",\"delay_minutes\":1},\"relationships\":{\"channel\":{\"data\":{\"id\":\"7fc326c9-f3dc-4858-80c2-d88c24dcf54b\",\"type\":\"notification_channels\"}}}},\"included\":[{\"id\":\"7fc326c9-f3dc-4858-80c2-d88c24dcf54b\",\"type\":\"notification_channels\",\"attributes\":{\"active\":true,\"config\":{\"type\":\"email\",\"address\":\"test-update_an_on_call_notification_rule_for_a_user_returns_ok_response-1765933475@datadoghq.com\",\"formats\":[\"html\"]}}}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-12-17T01:04:36.514Z", + "time": 462 + }, + { + "_id": "1ce870f5417be12f9b41751869eea48f", + "_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/4ef9cf45-30a8-4117-9b56-adba96671dff" + }, + "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-17T01:04:36.987Z", + "time": 298 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/examples/v2/on-call/CreateUserNotificationRule.ts b/examples/v2/on-call/CreateUserNotificationRule.ts new file mode 100644 index 000000000000..a1ee273f39eb --- /dev/null +++ b/examples/v2/on-call/CreateUserNotificationRule.ts @@ -0,0 +1,45 @@ +/** + * Create an On-Call notification rule 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; + +// 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.OnCallApiCreateUserNotificationRuleRequest = { + body: { + data: { + attributes: { + category: "high_urgency", + delayMinutes: 0, + }, + relationships: { + channel: { + data: { + id: ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID, + type: "notification_channels", + }, + }, + }, + type: "notification_rules", + }, + }, + userId: USER_DATA_ID, +}; + +apiInstance + .createUserNotificationRule(params) + .then((data: v2.OnCallNotificationRule) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call/DeleteUserNotificationRule.ts b/examples/v2/on-call/DeleteUserNotificationRule.ts new file mode 100644 index 000000000000..947af4e2efb9 --- /dev/null +++ b/examples/v2/on-call/DeleteUserNotificationRule.ts @@ -0,0 +1,29 @@ +/** + * Delete an On-Call notification rule 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_rule" in the system +const ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID = process.env + .ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID as string; + +const params: v2.OnCallApiDeleteUserNotificationRuleRequest = { + userId: USER_DATA_ID, + ruleId: ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID, +}; + +apiInstance + .deleteUserNotificationRule(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/GetUserNotificationRule.ts b/examples/v2/on-call/GetUserNotificationRule.ts new file mode 100644 index 000000000000..dc880d06f0fb --- /dev/null +++ b/examples/v2/on-call/GetUserNotificationRule.ts @@ -0,0 +1,30 @@ +/** + * Get an On-Call notification rule 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_rule" in the system +const ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID = process.env + .ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID as string; + +const params: v2.OnCallApiGetUserNotificationRuleRequest = { + userId: USER_DATA_ID, + ruleId: ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID, + include: "channel", +}; + +apiInstance + .getUserNotificationRule(params) + .then((data: v2.OnCallNotificationRule) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call/ListUserNotificationRules.ts b/examples/v2/on-call/ListUserNotificationRules.ts new file mode 100644 index 000000000000..382fccea7812 --- /dev/null +++ b/examples/v2/on-call/ListUserNotificationRules.ts @@ -0,0 +1,25 @@ +/** + * List On-Call notification rules 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.OnCallApiListUserNotificationRulesRequest = { + include: "channel", + userId: USER_DATA_ID, +}; + +apiInstance + .listUserNotificationRules(params) + .then((data: v2.ListOnCallNotificationRulesResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call/UpdateUserNotificationRule.ts b/examples/v2/on-call/UpdateUserNotificationRule.ts new file mode 100644 index 000000000000..0d9f9de198c9 --- /dev/null +++ b/examples/v2/on-call/UpdateUserNotificationRule.ts @@ -0,0 +1,52 @@ +/** + * Update an On-Call notification rule 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_rule" in the system +const ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID = process.env + .ONCALL_EMAIL_NOTIFICATION_RULE_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.OnCallApiUpdateUserNotificationRuleRequest = { + body: { + data: { + attributes: { + category: "high_urgency", + delayMinutes: 1, + }, + id: ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID, + relationships: { + channel: { + data: { + id: ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID, + type: "notification_channels", + }, + }, + }, + type: "notification_rules", + }, + }, + userId: USER_DATA_ID, + ruleId: ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID, + include: "channel", +}; + +apiInstance + .updateUserNotificationRule(params) + .then((data: v2.OnCallNotificationRule) => { + 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 58bddf5a680b..d5c1f12fbfa0 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -7582,6 +7582,73 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "{}", }, + "v2.ListUserNotificationRules": { + "include": { + "type": "string", + "format": "", + }, + "userId": { + "type": "string", + "format": "", + }, + "operationResponseType": "ListOnCallNotificationRulesResponse", + }, + "v2.CreateUserNotificationRule": { + "userId": { + "type": "string", + "format": "", + }, + "body": { + "type": "CreateOnCallNotificationRuleRequest", + "format": "", + }, + "operationResponseType": "OnCallNotificationRule", + }, + "v2.GetUserNotificationRule": { + "userId": { + "type": "string", + "format": "", + }, + "ruleId": { + "type": "string", + "format": "", + }, + "include": { + "type": "string", + "format": "", + }, + "operationResponseType": "OnCallNotificationRule", + }, + "v2.UpdateUserNotificationRule": { + "userId": { + "type": "string", + "format": "", + }, + "ruleId": { + "type": "string", + "format": "", + }, + "include": { + "type": "string", + "format": "", + }, + "body": { + "type": "UpdateOnCallNotificationRuleRequest", + "format": "", + }, + "operationResponseType": "OnCallNotificationRule", + }, + "v2.DeleteUserNotificationRule": { + "userId": { + "type": "string", + "format": "", + }, + "ruleId": { + "type": "string", + "format": "", + }, + "operationResponseType": "{}", + }, "v2.CreateOnCallPage": { "body": { "type": "CreatePageRequest", diff --git a/features/v2/given.json b/features/v2/given.json index 8cf1925f45e8..4651a346eb17 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -799,6 +799,22 @@ "tag": "On-Call", "operationId": "CreateUserNotificationChannel" }, + { + "parameters": [ + { + "name": "user_id", + "source": "user.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"notification_rules\",\n \"attributes\": {\n \"delay_minutes\": 0,\n \"category\": \"high_urgency\"\n },\n \"relationships\": {\n \"channel\": {\n \"data\": {\n \"id\": \"{{ oncall_email_notification_channel.data.id }}\",\n \"type\": \"notification_channels\"\n }\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"oncall_email_notification_rule\" in the system", + "key": "oncall_email_notification_rule", + "tag": "On-Call", + "operationId": "CreateUserNotificationRule" + }, { "parameters": [ { diff --git a/features/v2/on-call.feature b/features/v2/on-call.feature index 9f4750eef79a..0f4b2a0e3402 100644 --- a/features/v2/on-call.feature +++ b/features/v2/on-call.feature @@ -70,6 +70,32 @@ Feature: On-Call When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/on-call + Scenario: Create an On-Call notification rule for a user returns "Bad Request" response + Given new "CreateUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "high_urgency", "channel_settings": {"method": "sms", "type": "phone"}, "delay_minutes": 1}, "relationships": {"channel": {"data": {"id": "1562fab3-a8c2-49e2-8f3a-28dcda2405e2", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/on-call + Scenario: Create an On-Call notification rule for a user returns "Created" response + Given new "CreateUserNotificationRule" request + And there is a valid "user" in the system + And request contains "user_id" parameter from "user.data.id" + And there is a valid "oncall_email_notification_channel" in the system + And body with value {"data": {"attributes": {"category": "high_urgency", "delay_minutes": 0}, "relationships": {"channel": {"data": {"id": "{{ oncall_email_notification_channel.data.id }}", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/on-call + Scenario: Create an On-Call notification rule for a user returns "Not Found" response + Given new "CreateUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "high_urgency", "channel_settings": {"method": "sms", "type": "phone"}, "delay_minutes": 1}, "relationships": {"channel": {"data": {"id": "1562fab3-a8c2-49e2-8f3a-28dcda2405e2", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/on-call Scenario: Delete On-Call escalation policy returns "No Content" response Given new "DeleteOnCallEscalationPolicy" request @@ -130,6 +156,33 @@ Feature: On-Call When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/on-call + Scenario: Delete an On-Call notification rule for a user returns "Bad Request" response + Given new "DeleteUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/on-call + Scenario: Delete an On-Call notification rule for a user returns "No Content" response + Given new "DeleteUserNotificationRule" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And there is a valid "oncall_email_notification_rule" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "rule_id" parameter from "oncall_email_notification_rule.data.id" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/on-call + Scenario: Delete an On-Call notification rule for a user returns "Not Found" response + Given new "DeleteUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/on-call Scenario: Get On-Call escalation policy returns "Bad Request" response Given new "GetOnCallEscalationPolicy" request @@ -207,6 +260,36 @@ Feature: On-Call And the response "data.attributes.config.type" is equal to "email" And the response "data.attributes.config.address" is equal to "{{ user.data.attributes.email }}" + @generated @skip @team:DataDog/on-call + Scenario: Get an On-Call notification rule for a user returns "Bad Request" response + Given new "GetUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/on-call + Scenario: Get an On-Call notification rule for a user returns "Not Found" response + Given new "GetUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/on-call + Scenario: Get an On-Call notification rule for a user returns "OK" response + Given new "GetUserNotificationRule" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And there is a valid "oncall_email_notification_rule" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "rule_id" parameter from "oncall_email_notification_rule.data.id" + And request contains "include" parameter with value "channel" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.category" is equal to "high_urgency" + And the response "included" has length 1 + @generated @skip @team:DataDog/on-call Scenario: Get scheduled on-call user returns "Bad Request" response Given new "GetScheduleOnCallUser" request @@ -283,6 +366,33 @@ Feature: On-Call And the response "data[0].attributes.config.type" is equal to "email" And the response "data[0].attributes.config.address" is equal to "{{ user.data.attributes.email }}" + @generated @skip @team:DataDog/on-call + Scenario: List On-Call notification rules for a user returns "Bad Request" response + Given new "ListUserNotificationRules" request + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/on-call + Scenario: List On-Call notification rules for a user returns "Not Found" response + Given new "ListUserNotificationRules" request + And request contains "user_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/on-call + Scenario: List On-Call notification rules for a user returns "OK" response + Given new "ListUserNotificationRules" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And there is a valid "oncall_email_notification_rule" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "include" parameter with value "channel" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "included" has length 1 + @skip-python @team:DataDog/on-call Scenario: Set On-Call team routing rules returns "OK" response Given new "SetOnCallTeamRoutingRules" request @@ -350,3 +460,36 @@ Feature: On-Call And body with value {"data": { "id": "{{ schedule.data.id }}", "attributes": {"layers": [{"id": "{{ schedule.data.relationships.layers.data[0].id }}" , "effective_date": "{{ timeISO('now - 10d') }}", "end_date": "{{ timeISO('now + 10d') }}", "interval": {"seconds": 3600}, "members": [{"user": {"id": "{{user.data.id}}"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "{{ timeISO('now - 5d') }}"}], "name": "{{ unique }}", "time_zone": "America/New_York"}, "relationships": {"teams": {"data": [{"id": "{{dd_team.data.id}}", "type": "teams"}]}}, "type": "schedules"}} When the request is sent Then the response status is 200 OK + + @generated @skip @team:DataDog/on-call + Scenario: Update an On-Call notification rule for a user returns "Bad Request" response + Given new "UpdateUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "high_urgency", "channel_settings": {"method": "sms", "type": "phone"}, "delay_minutes": 1}, "id": "2462ace1-49e2-aab1-xc4f-29cc4ae1105n7", "relationships": {"channel": {"data": {"id": "1562fab3-a8c2-49e2-8f3a-28dcda2405e2", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/on-call + Scenario: Update an On-Call notification rule for a user returns "Not Found" response + Given new "UpdateUserNotificationRule" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "high_urgency", "channel_settings": {"method": "sms", "type": "phone"}, "delay_minutes": 1}, "id": "2462ace1-49e2-aab1-xc4f-29cc4ae1105n7", "relationships": {"channel": {"data": {"id": "1562fab3-a8c2-49e2-8f3a-28dcda2405e2", "type": "notification_channels"}}}, "type": "notification_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/on-call + Scenario: Update an On-Call notification rule for a user returns "OK" response + Given new "UpdateUserNotificationRule" request + And there is a valid "user" in the system + And there is a valid "oncall_email_notification_channel" in the system + And there is a valid "oncall_email_notification_rule" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "rule_id" parameter from "oncall_email_notification_rule.data.id" + And body with value {"data": {"attributes": {"category": "high_urgency", "delay_minutes": 1}, "id": "{{ oncall_email_notification_rule.data.id }}", "relationships": {"channel": {"data": {"id": "{{ oncall_email_notification_channel.data.id }}", "type": "notification_channels"}}}, "type": "notification_rules"}} + And request contains "include" parameter with value "channel" + When the request is sent + Then the response status is 200 OK + And the response "included" has length 1 + And the response "data.attributes.delay_minutes" is equal to 1 diff --git a/features/v2/undo.json b/features/v2/undo.json index e0f0b98d0c96..d398c05fc134 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2964,6 +2964,36 @@ "type": "safe" } }, + "ListUserNotificationRules": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "CreateUserNotificationRule": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "DeleteUserNotificationRule": { + "tag": "On-Call", + "undo": { + "type": "idempotent" + } + }, + "GetUserNotificationRule": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "UpdateUserNotificationRule": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": { diff --git a/packages/datadog-api-client-v2/apis/OnCallApi.ts b/packages/datadog-api-client-v2/apis/OnCallApi.ts index 25fbb53b6fcd..3da1a9679161 100644 --- a/packages/datadog-api-client-v2/apis/OnCallApi.ts +++ b/packages/datadog-api-client-v2/apis/OnCallApi.ts @@ -17,12 +17,15 @@ import { ObjectSerializer } from "../models/ObjectSerializer"; import { ApiException } from "../../datadog-api-client-common/exception"; import { APIErrorResponse } from "../models/APIErrorResponse"; +import { CreateOnCallNotificationRuleRequest } from "../models/CreateOnCallNotificationRuleRequest"; 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 { ListOnCallNotificationRulesResponse } from "../models/ListOnCallNotificationRulesResponse"; import { NotificationChannel } from "../models/NotificationChannel"; +import { OnCallNotificationRule } from "../models/OnCallNotificationRule"; import { Schedule } from "../models/Schedule"; import { ScheduleCreateRequest } from "../models/ScheduleCreateRequest"; import { ScheduleUpdateRequest } from "../models/ScheduleUpdateRequest"; @@ -30,6 +33,7 @@ import { Shift } from "../models/Shift"; import { TeamOnCallResponders } from "../models/TeamOnCallResponders"; import { TeamRoutingRules } from "../models/TeamRoutingRules"; import { TeamRoutingRulesRequest } from "../models/TeamRoutingRulesRequest"; +import { UpdateOnCallNotificationRuleRequest } from "../models/UpdateOnCallNotificationRuleRequest"; export class OnCallApiRequestFactory extends BaseAPIRequestFactory { public async createOnCallEscalationPolicy( @@ -192,6 +196,62 @@ export class OnCallApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async createUserNotificationRule( + userId: string, + body: CreateOnCallNotificationRuleRequest, + _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", "createUserNotificationRule"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createUserNotificationRule"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-rules".replace( + "{user_id}", + encodeURIComponent(String(userId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.createUserNotificationRule") + .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, + "CreateOnCallNotificationRuleRequest", + "" + ), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async deleteOnCallEscalationPolicy( policyId: string, _options?: Configuration @@ -301,6 +361,46 @@ export class OnCallApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async deleteUserNotificationRule( + userId: string, + ruleId: 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", "deleteUserNotificationRule"); + } + + // verify required parameter 'ruleId' is not null or undefined + if (ruleId === null || ruleId === undefined) { + throw new RequiredError("ruleId", "deleteUserNotificationRule"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-rules/{rule_id}" + .replace("{user_id}", encodeURIComponent(String(userId))) + .replace("{rule_id}", encodeURIComponent(String(ruleId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.deleteUserNotificationRule") + .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, @@ -572,6 +672,56 @@ export class OnCallApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async getUserNotificationRule( + userId: string, + ruleId: string, + include?: 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", "getUserNotificationRule"); + } + + // verify required parameter 'ruleId' is not null or undefined + if (ruleId === null || ruleId === undefined) { + throw new RequiredError("ruleId", "getUserNotificationRule"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-rules/{rule_id}" + .replace("{user_id}", encodeURIComponent(String(userId))) + .replace("{rule_id}", encodeURIComponent(String(ruleId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.getUserNotificationRule") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + ObjectSerializer.serialize(include, "string", ""), + "" + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async listUserNotificationChannels( userId: string, _options?: Configuration @@ -607,6 +757,51 @@ export class OnCallApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async listUserNotificationRules( + userId: string, + include?: 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", "listUserNotificationRules"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-rules".replace( + "{user_id}", + encodeURIComponent(String(userId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.listUserNotificationRules") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + ObjectSerializer.serialize(include, "string", ""), + "" + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async setOnCallTeamRoutingRules( teamId: string, body: TeamRoutingRulesRequest, @@ -791,6 +986,77 @@ export class OnCallApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + + public async updateUserNotificationRule( + userId: string, + ruleId: string, + body: UpdateOnCallNotificationRuleRequest, + include?: 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", "updateUserNotificationRule"); + } + + // verify required parameter 'ruleId' is not null or undefined + if (ruleId === null || ruleId === undefined) { + throw new RequiredError("ruleId", "updateUserNotificationRule"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateUserNotificationRule"); + } + + // Path Params + const localVarPath = + "/api/v2/on-call/users/{user_id}/notification-rules/{rule_id}" + .replace("{user_id}", encodeURIComponent(String(userId))) + .replace("{rule_id}", encodeURIComponent(String(ruleId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallApi.updateUserNotificationRule") + .makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + ObjectSerializer.serialize(include, "string", ""), + "" + ); + } + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize( + body, + "UpdateOnCallNotificationRuleRequest", + "" + ), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } } export class OnCallApiResponseProcessor { @@ -984,6 +1250,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 createUserNotificationRule + * @throws ApiException if the response code was not in [200, 299] + */ + public async createUserNotificationRule( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 201) { + const body: OnCallNotificationRule = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OnCallNotificationRule" + ) as OnCallNotificationRule; + 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: OnCallNotificationRule = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OnCallNotificationRule", + "" + ) as OnCallNotificationRule; + 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 @@ -1145,6 +1475,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 deleteUserNotificationRule + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteUserNotificationRule( + 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 @@ -1379,9 +1764,137 @@ export class OnCallApiResponseProcessor { if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: Shift = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "Shift", + "Shift", + "" + ) as Shift; + 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 getTeamOnCallUsers + * @throws ApiException if the response code was not in [200, 299] + */ + public async getTeamOnCallUsers( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: TeamOnCallResponders = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "TeamOnCallResponders" + ) as TeamOnCallResponders; + 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: TeamOnCallResponders = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "TeamOnCallResponders", + "" + ) as TeamOnCallResponders; + 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 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 Shift; + ) as NotificationChannel; return body; } @@ -1396,20 +1909,20 @@ 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 getTeamOnCallUsers + * @params response Response returned by the server for a request to getUserNotificationRule * @throws ApiException if the response code was not in [200, 299] */ - public async getTeamOnCallUsers( + public async getUserNotificationRule( response: ResponseContext - ): Promise { + ): Promise { const contentType = ObjectSerializer.normalizeMediaType( response.headers["content-type"] ); if (response.httpStatusCode === 200) { - const body: TeamOnCallResponders = ObjectSerializer.deserialize( + const body: OnCallNotificationRule = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "TeamOnCallResponders" - ) as TeamOnCallResponders; + "OnCallNotificationRule" + ) as OnCallNotificationRule; return body; } if ( @@ -1441,11 +1954,11 @@ export class OnCallApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: TeamOnCallResponders = ObjectSerializer.deserialize( + const body: OnCallNotificationRule = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "TeamOnCallResponders", + "OnCallNotificationRule", "" - ) as TeamOnCallResponders; + ) as OnCallNotificationRule; return body; } @@ -1460,20 +1973,21 @@ 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 + * @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 getUserNotificationChannel( + public async listUserNotificationChannels( response: ResponseContext - ): Promise { + ): 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; + const body: ListNotificationChannelsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListNotificationChannelsResponse" + ) as ListNotificationChannelsResponse; return body; } if ( @@ -1505,11 +2019,12 @@ export class OnCallApiResponseProcessor { // 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; + const body: ListNotificationChannelsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListNotificationChannelsResponse", + "" + ) as ListNotificationChannelsResponse; return body; } @@ -1524,21 +2039,21 @@ 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 listUserNotificationChannels + * @params response Response returned by the server for a request to listUserNotificationRules * @throws ApiException if the response code was not in [200, 299] */ - public async listUserNotificationChannels( + public async listUserNotificationRules( response: ResponseContext - ): Promise { + ): Promise { const contentType = ObjectSerializer.normalizeMediaType( response.headers["content-type"] ); if (response.httpStatusCode === 200) { - const body: ListNotificationChannelsResponse = + const body: ListOnCallNotificationRulesResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "ListNotificationChannelsResponse" - ) as ListNotificationChannelsResponse; + "ListOnCallNotificationRulesResponse" + ) as ListOnCallNotificationRulesResponse; return body; } if ( @@ -1570,12 +2085,12 @@ export class OnCallApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: ListNotificationChannelsResponse = + const body: ListOnCallNotificationRulesResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "ListNotificationChannelsResponse", + "ListOnCallNotificationRulesResponse", "" - ) as ListNotificationChannelsResponse; + ) as ListOnCallNotificationRulesResponse; return body; } @@ -1771,6 +2286,70 @@ export class OnCallApiResponseProcessor { '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 updateUserNotificationRule + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateUserNotificationRule( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: OnCallNotificationRule = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OnCallNotificationRule" + ) as OnCallNotificationRule; + 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: OnCallNotificationRule = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OnCallNotificationRule", + "" + ) as OnCallNotificationRule; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } } export interface OnCallApiCreateOnCallEscalationPolicyRequest { @@ -1809,6 +2388,18 @@ export interface OnCallApiCreateUserNotificationChannelRequest { body: CreateUserNotificationChannelRequest; } +export interface OnCallApiCreateUserNotificationRuleRequest { + /** + * The user ID + * @type string + */ + userId: string; + /** + * @type CreateOnCallNotificationRuleRequest + */ + body: CreateOnCallNotificationRuleRequest; +} + export interface OnCallApiDeleteOnCallEscalationPolicyRequest { /** * The ID of the escalation policy @@ -1838,6 +2429,19 @@ export interface OnCallApiDeleteUserNotificationChannelRequest { channelId: string; } +export interface OnCallApiDeleteUserNotificationRuleRequest { + /** + * The user ID + * @type string + */ + userId: string; + /** + * The rule ID + * @type string + */ + ruleId: string; +} + export interface OnCallApiGetOnCallEscalationPolicyRequest { /** * The ID of the escalation policy @@ -1921,6 +2525,24 @@ export interface OnCallApiGetUserNotificationChannelRequest { channelId: string; } +export interface OnCallApiGetUserNotificationRuleRequest { + /** + * The user ID + * @type string + */ + userId: string; + /** + * The rule ID + * @type string + */ + ruleId: string; + /** + * Comma-separated list of included relationships to be returned. Allowed values: `channel`. + * @type string + */ + include?: string; +} + export interface OnCallApiListUserNotificationChannelsRequest { /** * The user ID @@ -1929,6 +2551,19 @@ export interface OnCallApiListUserNotificationChannelsRequest { userId: string; } +export interface OnCallApiListUserNotificationRulesRequest { + /** + * The user ID + * @type string + */ + userId: string; + /** + * Comma-separated list of included relationships to be returned. Allowed values: `channel`. + * @type string + */ + include?: string; +} + export interface OnCallApiSetOnCallTeamRoutingRulesRequest { /** * The team ID @@ -1980,6 +2615,28 @@ export interface OnCallApiUpdateOnCallScheduleRequest { include?: string; } +export interface OnCallApiUpdateUserNotificationRuleRequest { + /** + * The user ID + * @type string + */ + userId: string; + /** + * The rule ID + * @type string + */ + ruleId: string; + /** + * @type UpdateOnCallNotificationRuleRequest + */ + body: UpdateOnCallNotificationRuleRequest; + /** + * Comma-separated list of included relationships to be returned. Allowed values: `channel`. + * @type string + */ + include?: string; +} + export class OnCallApi { private requestFactory: OnCallApiRequestFactory; private responseProcessor: OnCallApiResponseProcessor; @@ -2069,6 +2726,31 @@ export class OnCallApi { }); } + /** + * Create a new notification rule for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public createUserNotificationRule( + param: OnCallApiCreateUserNotificationRuleRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.createUserNotificationRule( + param.userId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createUserNotificationRule( + responseContext + ); + }); + }); + } + /** * Delete an On-Call escalation policy * @param param The request object @@ -2136,6 +2818,31 @@ export class OnCallApi { }); } + /** + * Delete a notification rule for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public deleteUserNotificationRule( + param: OnCallApiDeleteUserNotificationRuleRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.deleteUserNotificationRule( + param.userId, + param.ruleId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteUserNotificationRule( + responseContext + ); + }); + }); + } + /** * Get an On-Call escalation policy * @param param The request object @@ -2276,6 +2983,31 @@ export class OnCallApi { }); } + /** + * Get a notification rule for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public getUserNotificationRule( + param: OnCallApiGetUserNotificationRuleRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.getUserNotificationRule( + param.userId, + param.ruleId, + param.include, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getUserNotificationRule( + 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 @@ -2297,6 +3029,30 @@ export class OnCallApi { }); } + /** + * List the notification rules for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public listUserNotificationRules( + param: OnCallApiListUserNotificationRulesRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.listUserNotificationRules( + param.userId, + param.include, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listUserNotificationRules( + responseContext + ); + }); + }); + } + /** * Set a team's On-Call routing rules * @param param The request object @@ -2370,4 +3126,31 @@ export class OnCallApi { }); }); } + + /** + * Update a notification rule for a user. The authenticated user must be the target user or have the `on_call_admin` permission + * @param param The request object + */ + public updateUserNotificationRule( + param: OnCallApiUpdateUserNotificationRuleRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.updateUserNotificationRule( + param.userId, + param.ruleId, + param.body, + param.include, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateUserNotificationRule( + responseContext + ); + }); + }); + } } diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 3242bff3dd33..35348822baad 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -595,19 +595,24 @@ export { OnCallApiCreateOnCallEscalationPolicyRequest, OnCallApiCreateOnCallScheduleRequest, OnCallApiCreateUserNotificationChannelRequest, + OnCallApiCreateUserNotificationRuleRequest, OnCallApiDeleteOnCallEscalationPolicyRequest, OnCallApiDeleteOnCallScheduleRequest, OnCallApiDeleteUserNotificationChannelRequest, + OnCallApiDeleteUserNotificationRuleRequest, OnCallApiGetOnCallEscalationPolicyRequest, OnCallApiGetOnCallScheduleRequest, OnCallApiGetOnCallTeamRoutingRulesRequest, OnCallApiGetScheduleOnCallUserRequest, OnCallApiGetTeamOnCallUsersRequest, OnCallApiGetUserNotificationChannelRequest, + OnCallApiGetUserNotificationRuleRequest, OnCallApiListUserNotificationChannelsRequest, + OnCallApiListUserNotificationRulesRequest, OnCallApiSetOnCallTeamRoutingRulesRequest, OnCallApiUpdateOnCallEscalationPolicyRequest, OnCallApiUpdateOnCallScheduleRequest, + OnCallApiUpdateUserNotificationRuleRequest, OnCallApi, } from "./apis/OnCallApi"; @@ -1731,6 +1736,8 @@ export { CreateNotificationChannelData } from "./models/CreateNotificationChanne export { CreateNotificationRuleParameters } from "./models/CreateNotificationRuleParameters"; export { CreateNotificationRuleParametersData } from "./models/CreateNotificationRuleParametersData"; export { CreateNotificationRuleParametersDataAttributes } from "./models/CreateNotificationRuleParametersDataAttributes"; +export { CreateOnCallNotificationRuleRequest } from "./models/CreateOnCallNotificationRuleRequest"; +export { CreateOnCallNotificationRuleRequestData } from "./models/CreateOnCallNotificationRuleRequestData"; export { CreateOpenAPIResponse } from "./models/CreateOpenAPIResponse"; export { CreateOpenAPIResponseAttributes } from "./models/CreateOpenAPIResponseAttributes"; export { CreateOpenAPIResponseData } from "./models/CreateOpenAPIResponseData"; @@ -2830,6 +2837,7 @@ export { ListFindingsPage } from "./models/ListFindingsPage"; export { ListFindingsResponse } from "./models/ListFindingsResponse"; export { ListKindCatalogResponse } from "./models/ListKindCatalogResponse"; export { ListNotificationChannelsResponse } from "./models/ListNotificationChannelsResponse"; +export { ListOnCallNotificationRulesResponse } from "./models/ListOnCallNotificationRulesResponse"; export { ListPipelinesResponse } from "./models/ListPipelinesResponse"; export { ListPipelinesResponseMeta } from "./models/ListPipelinesResponseMeta"; export { ListPowerpacksResponse } from "./models/ListPowerpacksResponse"; @@ -3383,7 +3391,20 @@ export { OktaCredentialsUpdate } from "./models/OktaCredentialsUpdate"; export { OktaIntegration } from "./models/OktaIntegration"; export { OktaIntegrationType } from "./models/OktaIntegrationType"; export { OktaIntegrationUpdate } from "./models/OktaIntegrationUpdate"; +export { OnCallNotificationRule } from "./models/OnCallNotificationRule"; +export { OnCallNotificationRuleAttributes } from "./models/OnCallNotificationRuleAttributes"; +export { OnCallNotificationRuleCategory } from "./models/OnCallNotificationRuleCategory"; +export { OnCallNotificationRuleChannelRelationship } from "./models/OnCallNotificationRuleChannelRelationship"; +export { OnCallNotificationRuleChannelRelationshipData } from "./models/OnCallNotificationRuleChannelRelationshipData"; +export { OnCallNotificationRuleChannelSettings } from "./models/OnCallNotificationRuleChannelSettings"; +export { OnCallNotificationRuleData } from "./models/OnCallNotificationRuleData"; +export { OnCallNotificationRuleRelationships } from "./models/OnCallNotificationRuleRelationships"; +export { OnCallNotificationRuleRequestAttributes } from "./models/OnCallNotificationRuleRequestAttributes"; +export { OnCallNotificationRulesIncluded } from "./models/OnCallNotificationRulesIncluded"; +export { OnCallNotificationRuleType } from "./models/OnCallNotificationRuleType"; export { OnCallPageTargetType } from "./models/OnCallPageTargetType"; +export { OnCallPhoneNotificationRuleMethod } from "./models/OnCallPhoneNotificationRuleMethod"; +export { OnCallPhoneNotificationRuleSettings } from "./models/OnCallPhoneNotificationRuleSettings"; export { OnDemandConcurrencyCap } from "./models/OnDemandConcurrencyCap"; export { OnDemandConcurrencyCapAttributes } from "./models/OnDemandConcurrencyCapAttributes"; export { OnDemandConcurrencyCapResponse } from "./models/OnDemandConcurrencyCapResponse"; @@ -4506,6 +4527,9 @@ export { UpdateDeploymentGateParamsDataAttributes } from "./models/UpdateDeploym export { UpdateDeploymentRuleParams } from "./models/UpdateDeploymentRuleParams"; export { UpdateDeploymentRuleParamsData } from "./models/UpdateDeploymentRuleParamsData"; export { UpdateDeploymentRuleParamsDataAttributes } from "./models/UpdateDeploymentRuleParamsDataAttributes"; +export { UpdateOnCallNotificationRuleRequest } from "./models/UpdateOnCallNotificationRuleRequest"; +export { UpdateOnCallNotificationRuleRequestAttributes } from "./models/UpdateOnCallNotificationRuleRequestAttributes"; +export { UpdateOnCallNotificationRuleRequestData } from "./models/UpdateOnCallNotificationRuleRequestData"; export { UpdateOpenAPIResponse } from "./models/UpdateOpenAPIResponse"; export { UpdateOpenAPIResponseAttributes } from "./models/UpdateOpenAPIResponseAttributes"; export { UpdateOpenAPIResponseData } from "./models/UpdateOpenAPIResponseData"; diff --git a/packages/datadog-api-client-v2/models/CreateOnCallNotificationRuleRequest.ts b/packages/datadog-api-client-v2/models/CreateOnCallNotificationRuleRequest.ts new file mode 100644 index 000000000000..65824eedfbe0 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateOnCallNotificationRuleRequest.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 { CreateOnCallNotificationRuleRequestData } from "./CreateOnCallNotificationRuleRequestData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A top-level wrapper for creating a notification rule for a user + */ +export class CreateOnCallNotificationRuleRequest { + /** + * Data for creating an on-call notification rule + */ + "data": CreateOnCallNotificationRuleRequestData; + + /** + * 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: "CreateOnCallNotificationRuleRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateOnCallNotificationRuleRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreateOnCallNotificationRuleRequestData.ts b/packages/datadog-api-client-v2/models/CreateOnCallNotificationRuleRequestData.ts new file mode 100644 index 000000000000..da614e846aa0 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateOnCallNotificationRuleRequestData.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 { OnCallNotificationRuleRelationships } from "./OnCallNotificationRuleRelationships"; +import { OnCallNotificationRuleRequestAttributes } from "./OnCallNotificationRuleRequestAttributes"; +import { OnCallNotificationRuleType } from "./OnCallNotificationRuleType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data for creating an on-call notification rule + */ +export class CreateOnCallNotificationRuleRequestData { + /** + * Attributes for creating or modifying an on-call notification rule. + */ + "attributes"?: OnCallNotificationRuleRequestAttributes; + /** + * Relationship object for creating a notification rule + */ + "relationships"?: OnCallNotificationRuleRelationships; + /** + * Indicates that the resource is of type 'notification_rules'. + */ + "type": OnCallNotificationRuleType; + + /** + * 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: "OnCallNotificationRuleRequestAttributes", + }, + relationships: { + baseName: "relationships", + type: "OnCallNotificationRuleRelationships", + }, + type: { + baseName: "type", + type: "OnCallNotificationRuleType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateOnCallNotificationRuleRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ListOnCallNotificationRulesResponse.ts b/packages/datadog-api-client-v2/models/ListOnCallNotificationRulesResponse.ts new file mode 100644 index 000000000000..bc11fcee1e2d --- /dev/null +++ b/packages/datadog-api-client-v2/models/ListOnCallNotificationRulesResponse.ts @@ -0,0 +1,56 @@ +/** + * 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 { OnCallNotificationRuleData } from "./OnCallNotificationRuleData"; +import { OnCallNotificationRulesIncluded } from "./OnCallNotificationRulesIncluded"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response type for listing notification rules for a user + */ +export class ListOnCallNotificationRulesResponse { + "data"?: Array; + "included"?: 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", + }, + included: { + baseName: "included", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ListOnCallNotificationRulesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index a516b43547ef..8b2386c71bc5 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -575,6 +575,8 @@ import { CreateNotificationChannelData } from "./CreateNotificationChannelData"; import { CreateNotificationRuleParameters } from "./CreateNotificationRuleParameters"; import { CreateNotificationRuleParametersData } from "./CreateNotificationRuleParametersData"; import { CreateNotificationRuleParametersDataAttributes } from "./CreateNotificationRuleParametersDataAttributes"; +import { CreateOnCallNotificationRuleRequest } from "./CreateOnCallNotificationRuleRequest"; +import { CreateOnCallNotificationRuleRequestData } from "./CreateOnCallNotificationRuleRequestData"; import { CreateOpenAPIResponse } from "./CreateOpenAPIResponse"; import { CreateOpenAPIResponseAttributes } from "./CreateOpenAPIResponseAttributes"; import { CreateOpenAPIResponseData } from "./CreateOpenAPIResponseData"; @@ -1422,6 +1424,7 @@ import { ListFindingsPage } from "./ListFindingsPage"; import { ListFindingsResponse } from "./ListFindingsResponse"; import { ListKindCatalogResponse } from "./ListKindCatalogResponse"; import { ListNotificationChannelsResponse } from "./ListNotificationChannelsResponse"; +import { ListOnCallNotificationRulesResponse } from "./ListOnCallNotificationRulesResponse"; import { ListPipelinesResponse } from "./ListPipelinesResponse"; import { ListPipelinesResponseMeta } from "./ListPipelinesResponseMeta"; import { ListPowerpacksResponse } from "./ListPowerpacksResponse"; @@ -1782,6 +1785,14 @@ import { OktaAccountUpdateRequestData } from "./OktaAccountUpdateRequestData"; import { OktaAccountsResponse } from "./OktaAccountsResponse"; import { OktaIntegration } from "./OktaIntegration"; import { OktaIntegrationUpdate } from "./OktaIntegrationUpdate"; +import { OnCallNotificationRule } from "./OnCallNotificationRule"; +import { OnCallNotificationRuleAttributes } from "./OnCallNotificationRuleAttributes"; +import { OnCallNotificationRuleChannelRelationship } from "./OnCallNotificationRuleChannelRelationship"; +import { OnCallNotificationRuleChannelRelationshipData } from "./OnCallNotificationRuleChannelRelationshipData"; +import { OnCallNotificationRuleData } from "./OnCallNotificationRuleData"; +import { OnCallNotificationRuleRelationships } from "./OnCallNotificationRuleRelationships"; +import { OnCallNotificationRuleRequestAttributes } from "./OnCallNotificationRuleRequestAttributes"; +import { OnCallPhoneNotificationRuleSettings } from "./OnCallPhoneNotificationRuleSettings"; import { OnDemandConcurrencyCap } from "./OnDemandConcurrencyCap"; import { OnDemandConcurrencyCapAttributes } from "./OnDemandConcurrencyCapAttributes"; import { OnDemandConcurrencyCapResponse } from "./OnDemandConcurrencyCapResponse"; @@ -2648,6 +2659,9 @@ import { UpdateDeploymentGateParamsDataAttributes } from "./UpdateDeploymentGate import { UpdateDeploymentRuleParams } from "./UpdateDeploymentRuleParams"; import { UpdateDeploymentRuleParamsData } from "./UpdateDeploymentRuleParamsData"; import { UpdateDeploymentRuleParamsDataAttributes } from "./UpdateDeploymentRuleParamsDataAttributes"; +import { UpdateOnCallNotificationRuleRequest } from "./UpdateOnCallNotificationRuleRequest"; +import { UpdateOnCallNotificationRuleRequestAttributes } from "./UpdateOnCallNotificationRuleRequestAttributes"; +import { UpdateOnCallNotificationRuleRequestData } from "./UpdateOnCallNotificationRuleRequestData"; import { UpdateOpenAPIResponse } from "./UpdateOpenAPIResponse"; import { UpdateOpenAPIResponseAttributes } from "./UpdateOpenAPIResponseAttributes"; import { UpdateOpenAPIResponseData } from "./UpdateOpenAPIResponseData"; @@ -3816,7 +3830,10 @@ const enumsMap: { [key: string]: any[] } = { OktaAPITokenType: ["OktaAPIToken"], OktaAccountType: ["okta-accounts"], OktaIntegrationType: ["Okta"], + OnCallNotificationRuleCategory: ["high_urgency", "low_urgency"], + OnCallNotificationRuleType: ["notification_rules"], OnCallPageTargetType: ["team_id", "team_handle", "user_id"], + OnCallPhoneNotificationRuleMethod: ["sms", "voice"], OnDemandConcurrencyCapType: ["on_demand_concurrency_cap"], OpenAIAPIKeyType: ["OpenAIAPIKey"], OpenAIIntegrationType: ["OpenAI"], @@ -5125,6 +5142,9 @@ const typeMap: { [index: string]: any } = { CreateNotificationRuleParametersData: CreateNotificationRuleParametersData, CreateNotificationRuleParametersDataAttributes: CreateNotificationRuleParametersDataAttributes, + CreateOnCallNotificationRuleRequest: CreateOnCallNotificationRuleRequest, + CreateOnCallNotificationRuleRequestData: + CreateOnCallNotificationRuleRequestData, CreateOpenAPIResponse: CreateOpenAPIResponse, CreateOpenAPIResponseAttributes: CreateOpenAPIResponseAttributes, CreateOpenAPIResponseData: CreateOpenAPIResponseData, @@ -6097,6 +6117,7 @@ const typeMap: { [index: string]: any } = { ListFindingsResponse: ListFindingsResponse, ListKindCatalogResponse: ListKindCatalogResponse, ListNotificationChannelsResponse: ListNotificationChannelsResponse, + ListOnCallNotificationRulesResponse: ListOnCallNotificationRulesResponse, ListPipelinesResponse: ListPipelinesResponse, ListPipelinesResponseMeta: ListPipelinesResponseMeta, ListPowerpacksResponse: ListPowerpacksResponse, @@ -6575,6 +6596,17 @@ const typeMap: { [index: string]: any } = { OktaAccountsResponse: OktaAccountsResponse, OktaIntegration: OktaIntegration, OktaIntegrationUpdate: OktaIntegrationUpdate, + OnCallNotificationRule: OnCallNotificationRule, + OnCallNotificationRuleAttributes: OnCallNotificationRuleAttributes, + OnCallNotificationRuleChannelRelationship: + OnCallNotificationRuleChannelRelationship, + OnCallNotificationRuleChannelRelationshipData: + OnCallNotificationRuleChannelRelationshipData, + OnCallNotificationRuleData: OnCallNotificationRuleData, + OnCallNotificationRuleRelationships: OnCallNotificationRuleRelationships, + OnCallNotificationRuleRequestAttributes: + OnCallNotificationRuleRequestAttributes, + OnCallPhoneNotificationRuleSettings: OnCallPhoneNotificationRuleSettings, OnDemandConcurrencyCap: OnDemandConcurrencyCap, OnDemandConcurrencyCapAttributes: OnDemandConcurrencyCapAttributes, OnDemandConcurrencyCapResponse: OnDemandConcurrencyCapResponse, @@ -7579,6 +7611,11 @@ const typeMap: { [index: string]: any } = { UpdateDeploymentRuleParamsData: UpdateDeploymentRuleParamsData, UpdateDeploymentRuleParamsDataAttributes: UpdateDeploymentRuleParamsDataAttributes, + UpdateOnCallNotificationRuleRequest: UpdateOnCallNotificationRuleRequest, + UpdateOnCallNotificationRuleRequestAttributes: + UpdateOnCallNotificationRuleRequestAttributes, + UpdateOnCallNotificationRuleRequestData: + UpdateOnCallNotificationRuleRequestData, UpdateOpenAPIResponse: UpdateOpenAPIResponse, UpdateOpenAPIResponseAttributes: UpdateOpenAPIResponseAttributes, UpdateOpenAPIResponseData: UpdateOpenAPIResponseData, @@ -8110,6 +8147,10 @@ const oneOfMap: { [index: string]: string[] } = { ], OktaCredentials: ["OktaAPIToken"], OktaCredentialsUpdate: ["OktaAPITokenUpdate"], + OnCallNotificationRuleChannelSettings: [ + "OnCallPhoneNotificationRuleSettings", + ], + OnCallNotificationRulesIncluded: ["NotificationChannelData"], OpenAICredentials: ["OpenAIAPIKey"], OpenAICredentialsUpdate: ["OpenAIAPIKeyUpdate"], PatchTableRequestDataAttributesFileMetadata: [ diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRule.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRule.ts new file mode 100644 index 000000000000..833854a47f51 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRule.ts @@ -0,0 +1,60 @@ +/** + * 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 { OnCallNotificationRuleData } from "./OnCallNotificationRuleData"; +import { OnCallNotificationRulesIncluded } from "./OnCallNotificationRulesIncluded"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A top-level wrapper for a notification rule + */ +export class OnCallNotificationRule { + /** + * Data for an on-call notification rule + */ + "data": OnCallNotificationRuleData; + "included"?: 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: "OnCallNotificationRuleData", + required: true, + }, + included: { + baseName: "included", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OnCallNotificationRule.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleAttributes.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleAttributes.ts new file mode 100644 index 000000000000..4bfcec2ca0c2 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleAttributes.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 { OnCallNotificationRuleCategory } from "./OnCallNotificationRuleCategory"; +import { OnCallNotificationRuleChannelSettings } from "./OnCallNotificationRuleChannelSettings"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes for an on-call notification rule. + */ +export class OnCallNotificationRuleAttributes { + /** + * Specifies the category a notification rule will apply to + */ + "category"?: OnCallNotificationRuleCategory; + /** + * Defines the configuration for a channel associated with a notification rule + */ + "channelSettings"?: OnCallNotificationRuleChannelSettings; + /** + * The number of minutes that will elapse before this rule is evaluated. 0 indicates immediate evaluation + */ + "delayMinutes"?: number; + + /** + * 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 = { + category: { + baseName: "category", + type: "OnCallNotificationRuleCategory", + }, + channelSettings: { + baseName: "channel_settings", + type: "OnCallNotificationRuleChannelSettings", + }, + delayMinutes: { + baseName: "delay_minutes", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OnCallNotificationRuleAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleCategory.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleCategory.ts new file mode 100644 index 000000000000..62fe210d2410 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleCategory.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 category a notification rule will apply to + */ + +export type OnCallNotificationRuleCategory = + | typeof HIGH_URGENCY + | typeof LOW_URGENCY + | UnparsedObject; +export const HIGH_URGENCY = "high_urgency"; +export const LOW_URGENCY = "low_urgency"; diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelRelationship.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelRelationship.ts new file mode 100644 index 000000000000..4e600a380795 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelRelationship.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 { OnCallNotificationRuleChannelRelationshipData } from "./OnCallNotificationRuleChannelRelationshipData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Relationship object for creating a notification rule + */ +export class OnCallNotificationRuleChannelRelationship { + /** + * Channel relationship data for creating a notification rule + */ + "data": OnCallNotificationRuleChannelRelationshipData; + + /** + * 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: "OnCallNotificationRuleChannelRelationshipData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OnCallNotificationRuleChannelRelationship.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelRelationshipData.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelRelationshipData.ts new file mode 100644 index 000000000000..b3c09ee67d3b --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelRelationshipData.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 { NotificationChannelType } from "./NotificationChannelType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Channel relationship data for creating a notification rule + */ +export class OnCallNotificationRuleChannelRelationshipData { + /** + * ID of the notification 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 = { + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "NotificationChannelType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OnCallNotificationRuleChannelRelationshipData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelSettings.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelSettings.ts new file mode 100644 index 000000000000..97328612cacd --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleChannelSettings.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 { OnCallPhoneNotificationRuleSettings } from "./OnCallPhoneNotificationRuleSettings"; + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Defines the configuration for a channel associated with a notification rule + */ + +export type OnCallNotificationRuleChannelSettings = + | OnCallPhoneNotificationRuleSettings + | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleData.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleData.ts new file mode 100644 index 000000000000..b2ce900167c1 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleData.ts @@ -0,0 +1,80 @@ +/** + * 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 { OnCallNotificationRuleAttributes } from "./OnCallNotificationRuleAttributes"; +import { OnCallNotificationRuleRelationships } from "./OnCallNotificationRuleRelationships"; +import { OnCallNotificationRuleType } from "./OnCallNotificationRuleType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data for an on-call notification rule + */ +export class OnCallNotificationRuleData { + /** + * Attributes for an on-call notification rule. + */ + "attributes"?: OnCallNotificationRuleAttributes; + /** + * Unique identifier for the rule + */ + "id"?: string; + /** + * Relationship object for creating a notification rule + */ + "relationships"?: OnCallNotificationRuleRelationships; + /** + * Indicates that the resource is of type 'notification_rules'. + */ + "type": OnCallNotificationRuleType; + + /** + * 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: "OnCallNotificationRuleAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + relationships: { + baseName: "relationships", + type: "OnCallNotificationRuleRelationships", + }, + type: { + baseName: "type", + type: "OnCallNotificationRuleType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OnCallNotificationRuleData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleRelationships.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleRelationships.ts new file mode 100644 index 000000000000..a68b6b366049 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleRelationships.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 { OnCallNotificationRuleChannelRelationship } from "./OnCallNotificationRuleChannelRelationship"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Relationship object for creating a notification rule + */ +export class OnCallNotificationRuleRelationships { + /** + * Relationship object for creating a notification rule + */ + "channel"?: OnCallNotificationRuleChannelRelationship; + + /** + * 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 = { + channel: { + baseName: "channel", + type: "OnCallNotificationRuleChannelRelationship", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OnCallNotificationRuleRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleRequestAttributes.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleRequestAttributes.ts new file mode 100644 index 000000000000..b8772e507fa0 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleRequestAttributes.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 { OnCallNotificationRuleCategory } from "./OnCallNotificationRuleCategory"; +import { OnCallNotificationRuleChannelSettings } from "./OnCallNotificationRuleChannelSettings"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes for creating or modifying an on-call notification rule. + */ +export class OnCallNotificationRuleRequestAttributes { + /** + * Specifies the category a notification rule will apply to + */ + "category"?: OnCallNotificationRuleCategory; + /** + * Defines the configuration for a channel associated with a notification rule + */ + "channelSettings"?: OnCallNotificationRuleChannelSettings; + /** + * The number of minutes that will elapse before this rule is evaluated. 0 indicates immediate evaluation + */ + "delayMinutes"?: number; + + /** + * 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 = { + category: { + baseName: "category", + type: "OnCallNotificationRuleCategory", + }, + channelSettings: { + baseName: "channel_settings", + type: "OnCallNotificationRuleChannelSettings", + }, + delayMinutes: { + baseName: "delay_minutes", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OnCallNotificationRuleRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRuleType.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRuleType.ts new file mode 100644 index 000000000000..0abbd10eb18f --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRuleType.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_rules'. + */ + +export type OnCallNotificationRuleType = + | typeof NOTIFICATION_RULES + | UnparsedObject; +export const NOTIFICATION_RULES = "notification_rules"; diff --git a/packages/datadog-api-client-v2/models/OnCallNotificationRulesIncluded.ts b/packages/datadog-api-client-v2/models/OnCallNotificationRulesIncluded.ts new file mode 100644 index 000000000000..6238e710bd76 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallNotificationRulesIncluded.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 { NotificationChannelData } from "./NotificationChannelData"; + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Represents additional included resources for a on-call notification rules + */ + +export type OnCallNotificationRulesIncluded = + | NotificationChannelData + | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/OnCallPhoneNotificationRuleMethod.ts b/packages/datadog-api-client-v2/models/OnCallPhoneNotificationRuleMethod.ts new file mode 100644 index 000000000000..2726bc1ae06e --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallPhoneNotificationRuleMethod.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 method in which a phone is used in a notification rule + */ + +export type OnCallPhoneNotificationRuleMethod = + | typeof SMS + | typeof VOICE + | UnparsedObject; +export const SMS = "sms"; +export const VOICE = "voice"; diff --git a/packages/datadog-api-client-v2/models/OnCallPhoneNotificationRuleSettings.ts b/packages/datadog-api-client-v2/models/OnCallPhoneNotificationRuleSettings.ts new file mode 100644 index 000000000000..ac17c495fcc5 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OnCallPhoneNotificationRuleSettings.ts @@ -0,0 +1,64 @@ +/** + * 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 { OnCallPhoneNotificationRuleMethod } from "./OnCallPhoneNotificationRuleMethod"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Configuration for using a phone notification channel in a notification rule + */ +export class OnCallPhoneNotificationRuleSettings { + /** + * Specifies the method in which a phone is used in a notification rule + */ + "method": OnCallPhoneNotificationRuleMethod; + /** + * 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 = { + method: { + baseName: "method", + type: "OnCallPhoneNotificationRuleMethod", + required: true, + }, + type: { + baseName: "type", + type: "NotificationChannelPhoneConfigType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OnCallPhoneNotificationRuleSettings.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequest.ts b/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequest.ts new file mode 100644 index 000000000000..417851889ba5 --- /dev/null +++ b/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequest.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 { UpdateOnCallNotificationRuleRequestData } from "./UpdateOnCallNotificationRuleRequestData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A top-level wrapper for updating a notification rule for a user + */ +export class UpdateOnCallNotificationRuleRequest { + /** + * Data for updating an on-call notification rule + */ + "data": UpdateOnCallNotificationRuleRequestData; + + /** + * 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: "UpdateOnCallNotificationRuleRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateOnCallNotificationRuleRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequestAttributes.ts b/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequestAttributes.ts new file mode 100644 index 000000000000..ecd644f8775e --- /dev/null +++ b/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequestAttributes.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 { OnCallNotificationRuleCategory } from "./OnCallNotificationRuleCategory"; +import { OnCallNotificationRuleChannelSettings } from "./OnCallNotificationRuleChannelSettings"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes for creating or modifying an on-call notification rule. + */ +export class UpdateOnCallNotificationRuleRequestAttributes { + /** + * Specifies the category a notification rule will apply to + */ + "category"?: OnCallNotificationRuleCategory; + /** + * Defines the configuration for a channel associated with a notification rule + */ + "channelSettings"?: OnCallNotificationRuleChannelSettings; + /** + * The number of minutes that will elapse before this rule is evaluated. 0 indicates immediate evaluation + */ + "delayMinutes"?: number; + + /** + * 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 = { + category: { + baseName: "category", + type: "OnCallNotificationRuleCategory", + }, + channelSettings: { + baseName: "channel_settings", + type: "OnCallNotificationRuleChannelSettings", + }, + delayMinutes: { + baseName: "delay_minutes", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateOnCallNotificationRuleRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequestData.ts b/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequestData.ts new file mode 100644 index 000000000000..6dbb1a26523a --- /dev/null +++ b/packages/datadog-api-client-v2/models/UpdateOnCallNotificationRuleRequestData.ts @@ -0,0 +1,80 @@ +/** + * 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 { OnCallNotificationRuleRelationships } from "./OnCallNotificationRuleRelationships"; +import { OnCallNotificationRuleType } from "./OnCallNotificationRuleType"; +import { UpdateOnCallNotificationRuleRequestAttributes } from "./UpdateOnCallNotificationRuleRequestAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data for updating an on-call notification rule + */ +export class UpdateOnCallNotificationRuleRequestData { + /** + * Attributes for creating or modifying an on-call notification rule. + */ + "attributes"?: UpdateOnCallNotificationRuleRequestAttributes; + /** + * Unique identifier for the rule + */ + "id"?: string; + /** + * Relationship object for creating a notification rule + */ + "relationships"?: OnCallNotificationRuleRelationships; + /** + * Indicates that the resource is of type 'notification_rules'. + */ + "type": OnCallNotificationRuleType; + + /** + * 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: "UpdateOnCallNotificationRuleRequestAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + relationships: { + baseName: "relationships", + type: "OnCallNotificationRuleRelationships", + }, + type: { + baseName: "type", + type: "OnCallNotificationRuleType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateOnCallNotificationRuleRequestData.attributeTypeMap; + } + + public constructor() {} +}