From 6c79daed58bc80d401f2198771ff3f5c57e01eae Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 18 Dec 2025 19:38:48 +0000 Subject: [PATCH] Regenerate client from commit 91df58e of spec repo --- .generator/schemas/v2/openapi.yaml | 495 ++++++++++ .../frozen.json | 1 + .../recording.har | 210 +++++ .../frozen.json | 1 + .../recording.har | 247 +++++ .../frozen.json | 1 + .../recording.har | 258 +++++ .../frozen.json | 1 + .../recording.har | 258 +++++ .../frozen.json | 1 + .../recording.har | 268 ++++++ features/v2/given.json | 16 + features/v2/on-call.feature | 143 +++ features/v2/undo.json | 30 + .../src/support/scenarios_model_mapping.ts | 67 ++ services/on_call/src/v2/OnCallApi.ts | 880 +++++++++++++++++- services/on_call/src/v2/index.ts | 24 + .../CreateOnCallNotificationRuleRequest.ts | 47 + ...CreateOnCallNotificationRuleRequestData.ts | 65 ++ .../ListOnCallNotificationRulesResponse.ts | 49 + .../src/v2/models/OnCallNotificationRule.ts | 53 ++ .../OnCallNotificationRuleAttributes.ts | 64 ++ .../models/OnCallNotificationRuleCategory.ts | 11 + ...CallNotificationRuleChannelRelationship.ts | 47 + ...NotificationRuleChannelRelationshipData.ts | 54 ++ .../OnCallNotificationRuleChannelSettings.ts | 10 + .../v2/models/OnCallNotificationRuleData.ts | 73 ++ .../OnCallNotificationRuleRelationships.ts | 46 + ...OnCallNotificationRuleRequestAttributes.ts | 64 ++ .../v2/models/OnCallNotificationRuleType.ts | 9 + .../models/OnCallNotificationRulesIncluded.ts | 10 + .../OnCallPhoneNotificationRuleMethod.ts | 11 + .../OnCallPhoneNotificationRuleSettings.ts | 57 ++ services/on_call/src/v2/models/TypingInfo.ts | 41 + .../UpdateOnCallNotificationRuleRequest.ts | 47 + ...OnCallNotificationRuleRequestAttributes.ts | 64 ++ ...UpdateOnCallNotificationRuleRequestData.ts | 73 ++ 37 files changed, 3762 insertions(+), 34 deletions(-) create mode 100644 cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response_1478259628/frozen.json create mode 100644 cassettes/v2/On-Call_446749911/Create-an-On-Call-notification-rule-for-a-user-returns-Created-response_1478259628/recording.har create mode 100644 cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response_198789539/frozen.json create mode 100644 cassettes/v2/On-Call_446749911/Delete-an-On-Call-notification-rule-for-a-user-returns-No-Content-response_198789539/recording.har create mode 100644 cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response_2648752890/frozen.json create mode 100644 cassettes/v2/On-Call_446749911/Get-an-On-Call-notification-rule-for-a-user-returns-OK-response_2648752890/recording.har create mode 100644 cassettes/v2/On-Call_446749911/List-On-Call-notification-rules-for-a-user-returns-OK-response_312236816/frozen.json create mode 100644 cassettes/v2/On-Call_446749911/List-On-Call-notification-rules-for-a-user-returns-OK-response_312236816/recording.har create mode 100644 cassettes/v2/On-Call_446749911/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response_2003371705/frozen.json create mode 100644 cassettes/v2/On-Call_446749911/Update-an-On-Call-notification-rule-for-a-user-returns-OK-response_2003371705/recording.har create mode 100644 services/on_call/src/v2/models/CreateOnCallNotificationRuleRequest.ts create mode 100644 services/on_call/src/v2/models/CreateOnCallNotificationRuleRequestData.ts create mode 100644 services/on_call/src/v2/models/ListOnCallNotificationRulesResponse.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRule.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleAttributes.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleCategory.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleChannelRelationship.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleChannelRelationshipData.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleChannelSettings.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleData.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleRelationships.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleRequestAttributes.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRuleType.ts create mode 100644 services/on_call/src/v2/models/OnCallNotificationRulesIncluded.ts create mode 100644 services/on_call/src/v2/models/OnCallPhoneNotificationRuleMethod.ts create mode 100644 services/on_call/src/v2/models/OnCallPhoneNotificationRuleSettings.ts create mode 100644 services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequest.ts create mode 100644 services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequestAttributes.ts create mode 100644 services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequestData.ts 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/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/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index b16e19bf9cca..4405d9ad5ca1 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -7592,6 +7592,73 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "{}", }, + "OnCallApi.V2.ListUserNotificationRules": { + include: { + type: "string", + format: "", + }, + userId: { + type: "string", + format: "", + }, + operationResponseType: "ListOnCallNotificationRulesResponse", + }, + "OnCallApi.V2.CreateUserNotificationRule": { + userId: { + type: "string", + format: "", + }, + body: { + type: "CreateOnCallNotificationRuleRequest", + format: "", + }, + operationResponseType: "OnCallNotificationRule", + }, + "OnCallApi.V2.GetUserNotificationRule": { + userId: { + type: "string", + format: "", + }, + ruleId: { + type: "string", + format: "", + }, + include: { + type: "string", + format: "", + }, + operationResponseType: "OnCallNotificationRule", + }, + "OnCallApi.V2.UpdateUserNotificationRule": { + userId: { + type: "string", + format: "", + }, + ruleId: { + type: "string", + format: "", + }, + include: { + type: "string", + format: "", + }, + body: { + type: "UpdateOnCallNotificationRuleRequest", + format: "", + }, + operationResponseType: "OnCallNotificationRule", + }, + "OnCallApi.V2.DeleteUserNotificationRule": { + userId: { + type: "string", + format: "", + }, + ruleId: { + type: "string", + format: "", + }, + operationResponseType: "{}", + }, "OnCallPagingApi.V2.CreateOnCallPage": { body: { type: "CreatePageRequest", diff --git a/services/on_call/src/v2/OnCallApi.ts b/services/on_call/src/v2/OnCallApi.ts index f63e302b693e..27010dff12c9 100644 --- a/services/on_call/src/v2/OnCallApi.ts +++ b/services/on_call/src/v2/OnCallApi.ts @@ -23,12 +23,15 @@ import { import { TypingInfo } from "./models/TypingInfo"; 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"; @@ -36,6 +39,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"; import { version } from "../version"; export class OnCallApiRequestFactory extends BaseAPIRequestFactory { @@ -230,6 +234,67 @@ 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 { server, overrides } = _config.getServerAndOverrides( + "OnCallApi.v2.createUserNotificationRule", + OnCallApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "CreateOnCallNotificationRuleRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async deleteOnCallEscalationPolicy( policyId: string, _options?: Configuration, @@ -372,6 +437,57 @@ 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 { server, overrides } = _config.getServerAndOverrides( + "OnCallApi.v2.deleteUserNotificationRule", + OnCallApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async getOnCallEscalationPolicy( policyId: string, include?: string, @@ -709,6 +825,67 @@ 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 { server, overrides } = _config.getServerAndOverrides( + "OnCallApi.v2.getUserNotificationRule", + OnCallApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async listUserNotificationChannels( userId: string, _options?: Configuration, @@ -755,6 +932,62 @@ 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 { server, overrides } = _config.getServerAndOverrides( + "OnCallApi.v2.listUserNotificationRules", + OnCallApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async setOnCallTeamRoutingRules( teamId: string, body: TeamRoutingRulesRequest, @@ -966,6 +1199,82 @@ 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 { server, overrides } = _config.getServerAndOverrides( + "OnCallApi.v2.updateUserNotificationRule", + OnCallApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PUT, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "UpdateOnCallNotificationRuleRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } } export class OnCallApiResponseProcessor { @@ -1153,6 +1462,68 @@ 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 = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: OnCallNotificationRule = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OnCallNotificationRule", + ) as OnCallNotificationRule; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "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 = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "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 @@ -1302,6 +1673,57 @@ 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 = 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 = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "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 @@ -1488,14 +1910,138 @@ export class OnCallApiResponseProcessor { */ public async getScheduleOnCallUser( response: ResponseContext, - ): Promise { + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: Shift = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "Shift", + ) as Shift; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "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: Shift = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "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 = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: TeamOnCallResponders = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "TeamOnCallResponders", + ) as TeamOnCallResponders; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "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 = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "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 = normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 200) { - const body: Shift = deserialize( + const body: NotificationChannel = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "Shift", - ) as Shift; + "NotificationChannel", + ) as NotificationChannel; return body; } if ( @@ -1525,12 +2071,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: Shift = deserialize( + const body: NotificationChannel = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "Shift", + "NotificationChannel", "", - ) as Shift; + ) as NotificationChannel; return body; } @@ -1545,19 +2091,19 @@ 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 = normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 200) { - const body: TeamOnCallResponders = deserialize( + const body: OnCallNotificationRule = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "TeamOnCallResponders", - ) as TeamOnCallResponders; + "OnCallNotificationRule", + ) as OnCallNotificationRule; return body; } if ( @@ -1587,12 +2133,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: TeamOnCallResponders = deserialize( + const body: OnCallNotificationRule = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "TeamOnCallResponders", + "OnCallNotificationRule", "", - ) as TeamOnCallResponders; + ) as OnCallNotificationRule; return body; } @@ -1607,19 +2153,19 @@ 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 = normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 200) { - const body: NotificationChannel = deserialize( + const body: ListNotificationChannelsResponse = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "NotificationChannel", - ) as NotificationChannel; + "ListNotificationChannelsResponse", + ) as ListNotificationChannelsResponse; return body; } if ( @@ -1649,12 +2195,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 = deserialize( + const body: ListNotificationChannelsResponse = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "NotificationChannel", + "ListNotificationChannelsResponse", "", - ) as NotificationChannel; + ) as ListNotificationChannelsResponse; return body; } @@ -1669,19 +2215,19 @@ 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 = normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 200) { - const body: ListNotificationChannelsResponse = deserialize( + const body: ListOnCallNotificationRulesResponse = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "ListNotificationChannelsResponse", - ) as ListNotificationChannelsResponse; + "ListOnCallNotificationRulesResponse", + ) as ListOnCallNotificationRulesResponse; return body; } if ( @@ -1711,12 +2257,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 = deserialize( + const body: ListOnCallNotificationRulesResponse = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "ListNotificationChannelsResponse", + "ListOnCallNotificationRulesResponse", "", - ) as ListNotificationChannelsResponse; + ) as ListOnCallNotificationRulesResponse; return body; } @@ -1906,6 +2452,68 @@ 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 = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: OnCallNotificationRule = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OnCallNotificationRule", + ) as OnCallNotificationRule; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "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 = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "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 { @@ -1944,6 +2552,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 @@ -1973,6 +2593,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 @@ -2056,6 +2689,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 @@ -2064,6 +2715,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 @@ -2115,6 +2779,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; @@ -2206,6 +2892,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 @@ -2273,6 +2984,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 @@ -2413,6 +3149,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 @@ -2434,6 +3195,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 @@ -2507,4 +3292,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/services/on_call/src/v2/index.ts b/services/on_call/src/v2/index.ts index 3e0a4d67e9ec..e59b191fd9dc 100644 --- a/services/on_call/src/v2/index.ts +++ b/services/on_call/src/v2/index.ts @@ -2,19 +2,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 "./OnCallApi"; @@ -29,6 +34,8 @@ export { CreateEmailNotificationChannelConfig } from "./models/CreateEmailNotifi export { CreateNotificationChannelAttributes } from "./models/CreateNotificationChannelAttributes"; export { CreateNotificationChannelConfig } from "./models/CreateNotificationChannelConfig"; export { CreateNotificationChannelData } from "./models/CreateNotificationChannelData"; +export { CreateOnCallNotificationRuleRequest } from "./models/CreateOnCallNotificationRuleRequest"; +export { CreateOnCallNotificationRuleRequestData } from "./models/CreateOnCallNotificationRuleRequestData"; export { CreatePhoneNotificationChannelConfig } from "./models/CreatePhoneNotificationChannelConfig"; export { CreateUserNotificationChannelRequest } from "./models/CreateUserNotificationChannelRequest"; export { DataRelationshipsTeams } from "./models/DataRelationshipsTeams"; @@ -84,6 +91,7 @@ export { LayerRelationshipsMembersDataItems } from "./models/LayerRelationshipsM export { LayerRelationshipsMembersDataItemsType } from "./models/LayerRelationshipsMembersDataItemsType"; export { LayerType } from "./models/LayerType"; export { ListNotificationChannelsResponse } from "./models/ListNotificationChannelsResponse"; +export { ListOnCallNotificationRulesResponse } from "./models/ListOnCallNotificationRulesResponse"; export { NotificationChannel } from "./models/NotificationChannel"; export { NotificationChannelAttributes } from "./models/NotificationChannelAttributes"; export { NotificationChannelConfig } from "./models/NotificationChannelConfig"; @@ -96,6 +104,19 @@ export { NotificationChannelPhoneConfigType } from "./models/NotificationChannel export { NotificationChannelPushConfig } from "./models/NotificationChannelPushConfig"; export { NotificationChannelPushConfigType } from "./models/NotificationChannelPushConfigType"; export { NotificationChannelType } from "./models/NotificationChannelType"; +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 { OnCallPhoneNotificationRuleMethod } from "./models/OnCallPhoneNotificationRuleMethod"; +export { OnCallPhoneNotificationRuleSettings } from "./models/OnCallPhoneNotificationRuleSettings"; export { OrganizationsType } from "./models/OrganizationsType"; export { RelationshipToOrganization } from "./models/RelationshipToOrganization"; export { RelationshipToOrganizationData } from "./models/RelationshipToOrganizationData"; @@ -192,6 +213,9 @@ export { TeamTarget } from "./models/TeamTarget"; export { TeamTargetType } from "./models/TeamTargetType"; export { TimeRestriction } from "./models/TimeRestriction"; export { TimeRestrictions } from "./models/TimeRestrictions"; +export { UpdateOnCallNotificationRuleRequest } from "./models/UpdateOnCallNotificationRuleRequest"; +export { UpdateOnCallNotificationRuleRequestAttributes } from "./models/UpdateOnCallNotificationRuleRequestAttributes"; +export { UpdateOnCallNotificationRuleRequestData } from "./models/UpdateOnCallNotificationRuleRequestData"; export { Urgency } from "./models/Urgency"; export { User } from "./models/User"; export { UserAttributes } from "./models/UserAttributes"; diff --git a/services/on_call/src/v2/models/CreateOnCallNotificationRuleRequest.ts b/services/on_call/src/v2/models/CreateOnCallNotificationRuleRequest.ts new file mode 100644 index 000000000000..06bd488f1471 --- /dev/null +++ b/services/on_call/src/v2/models/CreateOnCallNotificationRuleRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CreateOnCallNotificationRuleRequestData } from "./CreateOnCallNotificationRuleRequestData"; + +/** + * 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/services/on_call/src/v2/models/CreateOnCallNotificationRuleRequestData.ts b/services/on_call/src/v2/models/CreateOnCallNotificationRuleRequestData.ts new file mode 100644 index 000000000000..c0a6c1b91f6c --- /dev/null +++ b/services/on_call/src/v2/models/CreateOnCallNotificationRuleRequestData.ts @@ -0,0 +1,65 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleRelationships } from "./OnCallNotificationRuleRelationships"; +import { OnCallNotificationRuleRequestAttributes } from "./OnCallNotificationRuleRequestAttributes"; +import { OnCallNotificationRuleType } from "./OnCallNotificationRuleType"; + +/** + * 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/services/on_call/src/v2/models/ListOnCallNotificationRulesResponse.ts b/services/on_call/src/v2/models/ListOnCallNotificationRulesResponse.ts new file mode 100644 index 000000000000..3ab70b7ee35e --- /dev/null +++ b/services/on_call/src/v2/models/ListOnCallNotificationRulesResponse.ts @@ -0,0 +1,49 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleData } from "./OnCallNotificationRuleData"; +import { OnCallNotificationRulesIncluded } from "./OnCallNotificationRulesIncluded"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRule.ts b/services/on_call/src/v2/models/OnCallNotificationRule.ts new file mode 100644 index 000000000000..ff909fad6ee5 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRule.ts @@ -0,0 +1,53 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleData } from "./OnCallNotificationRuleData"; +import { OnCallNotificationRulesIncluded } from "./OnCallNotificationRulesIncluded"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRuleAttributes.ts b/services/on_call/src/v2/models/OnCallNotificationRuleAttributes.ts new file mode 100644 index 000000000000..62928f6db80c --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleAttributes.ts @@ -0,0 +1,64 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleCategory } from "./OnCallNotificationRuleCategory"; +import { OnCallNotificationRuleChannelSettings } from "./OnCallNotificationRuleChannelSettings"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRuleCategory.ts b/services/on_call/src/v2/models/OnCallNotificationRuleCategory.ts new file mode 100644 index 000000000000..95fbe141aa99 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleCategory.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRuleChannelRelationship.ts b/services/on_call/src/v2/models/OnCallNotificationRuleChannelRelationship.ts new file mode 100644 index 000000000000..b2bd8363545a --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleChannelRelationship.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleChannelRelationshipData } from "./OnCallNotificationRuleChannelRelationshipData"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRuleChannelRelationshipData.ts b/services/on_call/src/v2/models/OnCallNotificationRuleChannelRelationshipData.ts new file mode 100644 index 000000000000..4bb57d823c2a --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleChannelRelationshipData.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { NotificationChannelType } from "./NotificationChannelType"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRuleChannelSettings.ts b/services/on_call/src/v2/models/OnCallNotificationRuleChannelSettings.ts new file mode 100644 index 000000000000..15a13c7b1bb6 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleChannelSettings.ts @@ -0,0 +1,10 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +import { OnCallPhoneNotificationRuleSettings } from "./OnCallPhoneNotificationRuleSettings"; + +/** + * Defines the configuration for a channel associated with a notification rule + */ +export type OnCallNotificationRuleChannelSettings = + | OnCallPhoneNotificationRuleSettings + | UnparsedObject; diff --git a/services/on_call/src/v2/models/OnCallNotificationRuleData.ts b/services/on_call/src/v2/models/OnCallNotificationRuleData.ts new file mode 100644 index 000000000000..de192ef15887 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleData.ts @@ -0,0 +1,73 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleAttributes } from "./OnCallNotificationRuleAttributes"; +import { OnCallNotificationRuleRelationships } from "./OnCallNotificationRuleRelationships"; +import { OnCallNotificationRuleType } from "./OnCallNotificationRuleType"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRuleRelationships.ts b/services/on_call/src/v2/models/OnCallNotificationRuleRelationships.ts new file mode 100644 index 000000000000..f8691ed6ccef --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleRelationships.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleChannelRelationship } from "./OnCallNotificationRuleChannelRelationship"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRuleRequestAttributes.ts b/services/on_call/src/v2/models/OnCallNotificationRuleRequestAttributes.ts new file mode 100644 index 000000000000..28dc016fffb5 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleRequestAttributes.ts @@ -0,0 +1,64 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleCategory } from "./OnCallNotificationRuleCategory"; +import { OnCallNotificationRuleChannelSettings } from "./OnCallNotificationRuleChannelSettings"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRuleType.ts b/services/on_call/src/v2/models/OnCallNotificationRuleType.ts new file mode 100644 index 000000000000..7e6dc99107f9 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRuleType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * 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/services/on_call/src/v2/models/OnCallNotificationRulesIncluded.ts b/services/on_call/src/v2/models/OnCallNotificationRulesIncluded.ts new file mode 100644 index 000000000000..1c93a5205880 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallNotificationRulesIncluded.ts @@ -0,0 +1,10 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +import { NotificationChannelData } from "./NotificationChannelData"; + +/** + * Represents additional included resources for a on-call notification rules + */ +export type OnCallNotificationRulesIncluded = + | NotificationChannelData + | UnparsedObject; diff --git a/services/on_call/src/v2/models/OnCallPhoneNotificationRuleMethod.ts b/services/on_call/src/v2/models/OnCallPhoneNotificationRuleMethod.ts new file mode 100644 index 000000000000..020a8a41ff13 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallPhoneNotificationRuleMethod.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * 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/services/on_call/src/v2/models/OnCallPhoneNotificationRuleSettings.ts b/services/on_call/src/v2/models/OnCallPhoneNotificationRuleSettings.ts new file mode 100644 index 000000000000..43c5baeb64d0 --- /dev/null +++ b/services/on_call/src/v2/models/OnCallPhoneNotificationRuleSettings.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { NotificationChannelPhoneConfigType } from "./NotificationChannelPhoneConfigType"; +import { OnCallPhoneNotificationRuleMethod } from "./OnCallPhoneNotificationRuleMethod"; + +/** + * 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/services/on_call/src/v2/models/TypingInfo.ts b/services/on_call/src/v2/models/TypingInfo.ts index a2e052bbc27e..422a1fb6b436 100644 --- a/services/on_call/src/v2/models/TypingInfo.ts +++ b/services/on_call/src/v2/models/TypingInfo.ts @@ -9,6 +9,8 @@ import { ConfiguredScheduleTargetRelationshipsSchedule } from "./ConfiguredSched import { CreateEmailNotificationChannelConfig } from "./CreateEmailNotificationChannelConfig"; import { CreateNotificationChannelAttributes } from "./CreateNotificationChannelAttributes"; import { CreateNotificationChannelData } from "./CreateNotificationChannelData"; +import { CreateOnCallNotificationRuleRequest } from "./CreateOnCallNotificationRuleRequest"; +import { CreateOnCallNotificationRuleRequestData } from "./CreateOnCallNotificationRuleRequestData"; import { CreatePhoneNotificationChannelConfig } from "./CreatePhoneNotificationChannelConfig"; import { CreateUserNotificationChannelRequest } from "./CreateUserNotificationChannelRequest"; import { DataRelationshipsTeams } from "./DataRelationshipsTeams"; @@ -49,12 +51,21 @@ import { LayerRelationships } from "./LayerRelationships"; import { LayerRelationshipsMembers } from "./LayerRelationshipsMembers"; import { LayerRelationshipsMembersDataItems } from "./LayerRelationshipsMembersDataItems"; import { ListNotificationChannelsResponse } from "./ListNotificationChannelsResponse"; +import { ListOnCallNotificationRulesResponse } from "./ListOnCallNotificationRulesResponse"; import { NotificationChannel } from "./NotificationChannel"; import { NotificationChannelAttributes } from "./NotificationChannelAttributes"; import { NotificationChannelData } from "./NotificationChannelData"; import { NotificationChannelEmailConfig } from "./NotificationChannelEmailConfig"; import { NotificationChannelPhoneConfig } from "./NotificationChannelPhoneConfig"; import { NotificationChannelPushConfig } from "./NotificationChannelPushConfig"; +import { 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 { RelationshipToOrganization } from "./RelationshipToOrganization"; import { RelationshipToOrganizationData } from "./RelationshipToOrganizationData"; import { RelationshipToOrganizations } from "./RelationshipToOrganizations"; @@ -121,6 +132,9 @@ import { TeamRoutingRulesRequestRule } from "./TeamRoutingRulesRequestRule"; import { TeamTarget } from "./TeamTarget"; import { TimeRestriction } from "./TimeRestriction"; import { TimeRestrictions } from "./TimeRestrictions"; +import { UpdateOnCallNotificationRuleRequest } from "./UpdateOnCallNotificationRuleRequest"; +import { UpdateOnCallNotificationRuleRequestAttributes } from "./UpdateOnCallNotificationRuleRequestAttributes"; +import { UpdateOnCallNotificationRuleRequestData } from "./UpdateOnCallNotificationRuleRequestData"; import { User } from "./User"; import { UserAttributes } from "./UserAttributes"; import { UserResponseRelationships } from "./UserResponseRelationships"; @@ -147,6 +161,9 @@ export const TypingInfo: ModelTypingInfo = { NotificationChannelPhoneConfigType: ["phone"], NotificationChannelPushConfigType: ["push"], NotificationChannelType: ["notification_channels"], + OnCallNotificationRuleCategory: ["high_urgency", "low_urgency"], + OnCallNotificationRuleType: ["notification_rules"], + OnCallPhoneNotificationRuleMethod: ["sms", "voice"], OrganizationsType: ["orgs"], RolesType: ["roles"], RoutingRuleRelationshipsPolicyDataType: ["policies"], @@ -211,6 +228,10 @@ export const TypingInfo: ModelTypingInfo = { "NotificationChannelEmailConfig", "NotificationChannelPushConfig", ], + OnCallNotificationRuleChannelSettings: [ + "OnCallPhoneNotificationRuleSettings", + ], + OnCallNotificationRulesIncluded: ["NotificationChannelData"], RoutingRuleAction: ["SendSlackMessageAction", "SendTeamsMessageAction"], ScheduleDataIncludedItem: [ "TeamReference", @@ -234,6 +255,9 @@ export const TypingInfo: ModelTypingInfo = { CreateEmailNotificationChannelConfig: CreateEmailNotificationChannelConfig, CreateNotificationChannelAttributes: CreateNotificationChannelAttributes, CreateNotificationChannelData: CreateNotificationChannelData, + CreateOnCallNotificationRuleRequest: CreateOnCallNotificationRuleRequest, + CreateOnCallNotificationRuleRequestData: + CreateOnCallNotificationRuleRequestData, CreatePhoneNotificationChannelConfig: CreatePhoneNotificationChannelConfig, CreateUserNotificationChannelRequest: CreateUserNotificationChannelRequest, DataRelationshipsTeams: DataRelationshipsTeams, @@ -284,12 +308,24 @@ export const TypingInfo: ModelTypingInfo = { LayerRelationshipsMembers: LayerRelationshipsMembers, LayerRelationshipsMembersDataItems: LayerRelationshipsMembersDataItems, ListNotificationChannelsResponse: ListNotificationChannelsResponse, + ListOnCallNotificationRulesResponse: ListOnCallNotificationRulesResponse, NotificationChannel: NotificationChannel, NotificationChannelAttributes: NotificationChannelAttributes, NotificationChannelData: NotificationChannelData, NotificationChannelEmailConfig: NotificationChannelEmailConfig, NotificationChannelPhoneConfig: NotificationChannelPhoneConfig, NotificationChannelPushConfig: NotificationChannelPushConfig, + OnCallNotificationRule: OnCallNotificationRule, + OnCallNotificationRuleAttributes: OnCallNotificationRuleAttributes, + OnCallNotificationRuleChannelRelationship: + OnCallNotificationRuleChannelRelationship, + OnCallNotificationRuleChannelRelationshipData: + OnCallNotificationRuleChannelRelationshipData, + OnCallNotificationRuleData: OnCallNotificationRuleData, + OnCallNotificationRuleRelationships: OnCallNotificationRuleRelationships, + OnCallNotificationRuleRequestAttributes: + OnCallNotificationRuleRequestAttributes, + OnCallPhoneNotificationRuleSettings: OnCallPhoneNotificationRuleSettings, RelationshipToOrganization: RelationshipToOrganization, RelationshipToOrganizationData: RelationshipToOrganizationData, RelationshipToOrganizations: RelationshipToOrganizations, @@ -371,6 +407,11 @@ export const TypingInfo: ModelTypingInfo = { TeamTarget: TeamTarget, TimeRestriction: TimeRestriction, TimeRestrictions: TimeRestrictions, + UpdateOnCallNotificationRuleRequest: UpdateOnCallNotificationRuleRequest, + UpdateOnCallNotificationRuleRequestAttributes: + UpdateOnCallNotificationRuleRequestAttributes, + UpdateOnCallNotificationRuleRequestData: + UpdateOnCallNotificationRuleRequestData, User: User, UserAttributes: UserAttributes, UserResponseRelationships: UserResponseRelationships, diff --git a/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequest.ts b/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequest.ts new file mode 100644 index 000000000000..bc9998567783 --- /dev/null +++ b/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpdateOnCallNotificationRuleRequestData } from "./UpdateOnCallNotificationRuleRequestData"; + +/** + * 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/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequestAttributes.ts b/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequestAttributes.ts new file mode 100644 index 000000000000..bdba2e23bf74 --- /dev/null +++ b/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequestAttributes.ts @@ -0,0 +1,64 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleCategory } from "./OnCallNotificationRuleCategory"; +import { OnCallNotificationRuleChannelSettings } from "./OnCallNotificationRuleChannelSettings"; + +/** + * 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/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequestData.ts b/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequestData.ts new file mode 100644 index 000000000000..e4a2195a1086 --- /dev/null +++ b/services/on_call/src/v2/models/UpdateOnCallNotificationRuleRequestData.ts @@ -0,0 +1,73 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OnCallNotificationRuleRelationships } from "./OnCallNotificationRuleRelationships"; +import { OnCallNotificationRuleType } from "./OnCallNotificationRuleType"; +import { UpdateOnCallNotificationRuleRequestAttributes } from "./UpdateOnCallNotificationRuleRequestAttributes"; + +/** + * 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() {} +}