diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7d574afcf4b5..9fb443da00e6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -449,7 +449,7 @@ components: type: string GetIssueIncludeQueryParameter: description: Comma-separated list of relationship objects that should be included - in the response. Possible values are `assignee`, `case`, and `team_owners`. + in the response. explode: false in: query name: include @@ -996,8 +996,7 @@ components: $ref: '#/components/schemas/ServiceDefinitionSchemaVersions' SearchIssuesIncludeQueryParameter: description: Comma-separated list of relationship objects that should be included - in the response. Possible values are `issue`, `issue.assignee`, `issue.case`, - and `issue.team_owners`. + in the response. explode: false in: query name: include @@ -17296,6 +17295,102 @@ components: - score - severity type: object + Email: + description: On-Call User Email. + example: + data: + attributes: + active: true + address: john.doe@datadoghq.com + alias: '' + formats: + - html + id: 45cd9fe5-dd96-42ad-83de-2242ea9f6efd + type: emails + properties: + data: + $ref: '#/components/schemas/EmailData' + type: object + EmailAttributes: + description: Attributes for an on-call email. + properties: + active: + description: Whether the email is currently active. + type: boolean + address: + description: Email address. + type: string + alias: + description: Optional display alias for the email. + type: string + formats: + description: Preferred content formats for notifications. + items: + $ref: '#/components/schemas/EmailFormatType' + type: array + type: object + EmailCreateRequest: + description: Request body for creating an On-Call email notification channel. + example: + data: + attributes: + active: true + address: john.doe@datadoghq.com + alias: '' + formats: + - html + type: emails + properties: + data: + $ref: '#/components/schemas/EmailData' + type: object + EmailData: + description: Data for an on-call email resource. + properties: + attributes: + $ref: '#/components/schemas/EmailAttributes' + id: + description: The email's unique identifier. + type: string + type: + $ref: '#/components/schemas/EmailType' + required: + - type + type: object + EmailFormatType: + description: Specifies the format of the e-mail that is sent for On-Call notifications + enum: + - html + - text + example: html + type: string + x-enum-varnames: + - HTML + - TEXT + EmailType: + default: emails + description: Indicates that the resource is of type 'emails'. + enum: + - emails + example: emails + type: string + x-enum-varnames: + - EMAILS + EmailUpdateRequest: + description: Request body for updating an On-Call email notification channel. + example: + data: + attributes: + active: true + address: john.doe@datadoghq.com + alias: '' + formats: + - html + type: emails + properties: + data: + $ref: '#/components/schemas/EmailData' + type: object Enabled: description: Field used to enable or disable the rule. example: true @@ -71931,6 +72026,193 @@ paths: operator: AND permissions: - on_call_write + /api/v2/on-call/users/{user_id}/notification-channels/emails: + post: + description: Create a new email notification channel for an on-call user + operationId: CreateUserEmailNotificationChannel + 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/EmailCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/Email' + 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 email for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_admin + /api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}: + delete: + description: Delete an email notification channel for an on-call user + operationId: DeleteUserEmailNotificationChannel + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The email ID + in: path + name: email_id + required: true + schema: + example: 45bb8fe5-dd96-42ad-83de-2241ea9f6ffc + 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 email for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_admin + get: + description: Get an email notification channel for an on-call user + operationId: GetUserEmailNotificationChannel + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The email ID + in: path + name: email_id + required: true + schema: + example: 45bb8fe5-dd96-42ad-83de-2241ea9f6ffc + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Email' + 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 email for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_admin + put: + description: Update an email notification channel for an on-call user + operationId: UpdateUserEmailNotificationChannel + parameters: + - description: The user ID + in: path + name: user_id + required: true + schema: + example: 00000000-0000-0000-0000-000000000000 + type: string + - description: The email ID + in: path + name: email_id + required: true + schema: + example: 45bb8fe5-dd96-42ad-83de-2241ea9f6ffc + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EmailUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Email' + 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 email for a user + tags: + - On-Call + x-permission: + operator: AND + permissions: + - on_call_admin /api/v2/org_configs: get: description: Returns all Org Configs (name, description, and value). diff --git a/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Bad-Request-response.frozen b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..a1160ff18469 --- /dev/null +++ b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-11-12T14:36:01.432Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Bad-Request-response.yml b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..019a758ed34f --- /dev/null +++ b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Bad-Request-response.yml @@ -0,0 +1,67 @@ +http_interactions: +- recorded_at: Wed, 12 Nov 2025 14:36:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Create_an_On_Call_email_for_a_user_returns_Bad_Request_response-1762958161@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"e94824bc-bfd4-11f0-adaa-1e9e4b86ba5b","attributes":{"name":null,"handle":"test-create_an_on_call_email_for_a_user_returns_bad_request_response-1762958161@datadoghq.com","created_at":"2025-11-12T14:36:01.627725+00:00","modified_at":"2025-11-12T14:36:01.627725+00:00","email":"test-create_an_on_call_email_for_a_user_returns_bad_request_response-1762958161@datadoghq.com","icon":"https://secure.gravatar.com/avatar/0c60562056ba523711aac984491c4445?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 12 Nov 2025 14:36:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"active":true,"address":"","alias":"","formats":["html"]},"type":"emails"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/e94824bc-bfd4-11f0-adaa-1e9e4b86ba5b/notification-channels/emails + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"address\" is required"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +- recorded_at: Wed, 12 Nov 2025 14:36:01 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/e94824bc-bfd4-11f0-adaa-1e9e4b86ba5b + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Created-response.frozen b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Created-response.frozen new file mode 100644 index 000000000000..f5631a00fcd6 --- /dev/null +++ b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Created-response.frozen @@ -0,0 +1 @@ +2025-11-12T14:50:04.706Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Created-response.yml b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Created-response.yml new file mode 100644 index 000000000000..c02a6257fa88 --- /dev/null +++ b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Created-response.yml @@ -0,0 +1,66 @@ +http_interactions: +- recorded_at: Wed, 12 Nov 2025 14:50:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Create_an_On_Call_email_for_a_user_returns_Created_response-1762959004@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"dfeeb6f4-bfd6-11f0-8d44-3ae83a1823f8","attributes":{"name":null,"handle":"test-create_an_on_call_email_for_a_user_returns_created_response-1762959004@datadoghq.com","created_at":"2025-11-12T14:50:04.935610+00:00","modified_at":"2025-11-12T14:50:04.935610+00:00","email":"test-create_an_on_call_email_for_a_user_returns_created_response-1762959004@datadoghq.com","icon":"https://secure.gravatar.com/avatar/fec58aca7d399645eb368db42c5a3cc8?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 12 Nov 2025 14:50:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"active":true,"address":"john.doe@datadoghq.com","alias":"","formats":["html"]},"type":"emails"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/dfeeb6f4-bfd6-11f0-8d44-3ae83a1823f8/notification-channels/emails + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"13d8e241-945e-42e4-9759-f4979a3f821f","type":"emails","attributes":{"active":true,"address":"john.doe@datadoghq.com","alias":"","blocked":false,"created_at":"2025-11-12T14:50:05.405372Z","formats":["html"],"modified_at":"2025-11-12T14:50:05.405372Z"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Wed, 12 Nov 2025 14:50:04 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/dfeeb6f4-bfd6-11f0-8d44-3ae83a1823f8 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Not-Found-response.frozen b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..3844a6a285f1 --- /dev/null +++ b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-11-12T14:52:55.277Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Not-Found-response.yml b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Not-Found-response.yml new file mode 100644 index 000000000000..afd1add994a0 --- /dev/null +++ b/cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Wed, 12 Nov 2025 14:52:55 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"active":true,"address":"john.doe@datadoghq.com","alias":"","formats":["html"]},"type":"emails"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/00000000-0000-0000-0000-000000000000/notification-channels/emails + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"user[00000000-0000-0000-0000-000000000000] + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-email-returns-Not-Found-response.frozen b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-email-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..018fe803ed6b --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-email-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-11-12T15:37:07.209Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-email-returns-Not-Found-response.yml b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-email-returns-Not-Found-response.yml new file mode 100644 index 000000000000..391ab9f9fa7d --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-email-returns-Not-Found-response.yml @@ -0,0 +1,63 @@ +http_interactions: +- recorded_at: Wed, 12 Nov 2025 15:37:07 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Delete_an_On_Call_email_for_a_missing_email_returns_Not_Found_response-1762961827@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"72452250-bfdd-11f0-bb7a-1a91fccbd64f","attributes":{"name":null,"handle":"test-delete_an_on_call_email_for_a_missing_email_returns_not_found_response-1762961827@datadoghq.com","created_at":"2025-11-12T15:37:07.429696+00:00","modified_at":"2025-11-12T15:37:07.429696+00:00","email":"test-delete_an_on_call_email_for_a_missing_email_returns_not_found_response-1762961827@datadoghq.com","icon":"https://secure.gravatar.com/avatar/baf7b7d23e8f0bb01a4291b4a70d9fc8?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 12 Nov 2025 15:37:07 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/users/72452250-bfdd-11f0-bb7a-1a91fccbd64f/notification-channels/emails/00000000-0000-0000-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"Email not + found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +- recorded_at: Wed, 12 Nov 2025 15:37:07 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/72452250-bfdd-11f0-bb7a-1a91fccbd64f + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-user-returns-Not-Found-response.frozen b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-user-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..75b80e5a8a11 --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-user-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-11-12T15:08:49.844Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-user-returns-Not-Found-response.yml b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-user-returns-Not-Found-response.yml new file mode 100644 index 000000000000..801925adf55c --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-missing-user-returns-Not-Found-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Wed, 12 Nov 2025 15:08:49 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/users/00000000-0000-0000-0000-000000000000/notification-channels/emails/00000000-0000-0000-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"user[00000000-0000-0000-0000-000000000000] + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-user-returns-No-Content-response.frozen b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-user-returns-No-Content-response.frozen new file mode 100644 index 000000000000..6eedcc6c6eed --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-user-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2025-11-11T21:34:54.765Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-user-returns-No-Content-response.yml b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-user-returns-No-Content-response.yml new file mode 100644 index 000000000000..6a7e9c628f18 --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-an-On-Call-email-for-a-user-returns-No-Content-response.yml @@ -0,0 +1,82 @@ +http_interactions: +- recorded_at: Tue, 11 Nov 2025 21:34:54 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Delete_an_On_Call_email_for_a_user_returns_No_Content_response-1762896894@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"43acb848-bf46-11f0-ab62-92ea5df1f825","attributes":{"name":null,"handle":"test-delete_an_on_call_email_for_a_user_returns_no_content_response-1762896894@datadoghq.com","created_at":"2025-11-11T21:34:55.249474+00:00","modified_at":"2025-11-11T21:34:55.249474+00:00","email":"test-delete_an_on_call_email_for_a_user_returns_no_content_response-1762896894@datadoghq.com","icon":"https://secure.gravatar.com/avatar/59021cfaece7e71bf1d358fffc29d134?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 11 Nov 2025 21:34:54 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"active":true,"address":"test-delete_an_on_call_email_for_a_user_returns_no_content_response-1762896894@datadoghq.com","alias":"","formats":["html"]},"type":"emails"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/43acb848-bf46-11f0-ab62-92ea5df1f825/notification-channels/emails + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"b9099fbc-43b3-4c74-9942-15ca0bcf519c","type":"emails","attributes":{"active":true,"address":"test-delete_an_on_call_email_for_a_user_returns_no_content_response-1762896894@datadoghq.com","alias":"","blocked":false,"created_at":"2025-11-11T21:34:55.795766Z","formats":["html"],"modified_at":"2025-11-11T21:34:55.795766Z"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 11 Nov 2025 21:34:54 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/users/43acb848-bf46-11f0-ab62-92ea5df1f825/notification-channels/emails/b9099fbc-43b3-4c74-9942-15ca0bcf519c + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 11 Nov 2025 21:34:54 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/43acb848-bf46-11f0-ab62-92ea5df1f825 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Get-an-On-Call-email-for-a-user-returns-OK-response.frozen b/cassettes/features/v2/on-call/Get-an-On-Call-email-for-a-user-returns-OK-response.frozen new file mode 100644 index 000000000000..8d386f462f70 --- /dev/null +++ b/cassettes/features/v2/on-call/Get-an-On-Call-email-for-a-user-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-12T15:45:28.077Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Get-an-On-Call-email-for-a-user-returns-OK-response.yml b/cassettes/features/v2/on-call/Get-an-On-Call-email-for-a-user-returns-OK-response.yml new file mode 100644 index 000000000000..e2b8760e7cee --- /dev/null +++ b/cassettes/features/v2/on-call/Get-an-On-Call-email-for-a-user-returns-OK-response.yml @@ -0,0 +1,84 @@ +http_interactions: +- recorded_at: Wed, 12 Nov 2025 15:45:28 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Get_an_On_Call_email_for_a_user_returns_OK_response-1762962328@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"9cd4f6e1-bfde-11f0-a1ee-1630341c9b2e","attributes":{"name":null,"handle":"test-get_an_on_call_email_for_a_user_returns_ok_response-1762962328@datadoghq.com","created_at":"2025-11-12T15:45:28.333343+00:00","modified_at":"2025-11-12T15:45:28.333343+00:00","email":"test-get_an_on_call_email_for_a_user_returns_ok_response-1762962328@datadoghq.com","icon":"https://secure.gravatar.com/avatar/9b6db90223b9ab60eead905163035fb3?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 12 Nov 2025 15:45:28 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"active":true,"address":"test-get_an_on_call_email_for_a_user_returns_ok_response-1762962328@datadoghq.com","alias":"","formats":["html"]},"type":"emails"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/9cd4f6e1-bfde-11f0-a1ee-1630341c9b2e/notification-channels/emails + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"0b0453b5-2f4c-49c3-94d9-c3db2d5ed69c","type":"emails","attributes":{"active":true,"address":"test-get_an_on_call_email_for_a_user_returns_ok_response-1762962328@datadoghq.com","alias":"","blocked":false,"created_at":"2025-11-12T15:45:28.530651Z","formats":["html"],"modified_at":"2025-11-12T15:45:28.530651Z"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Wed, 12 Nov 2025 15:45:28 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/users/9cd4f6e1-bfde-11f0-a1ee-1630341c9b2e/notification-channels/emails/0b0453b5-2f4c-49c3-94d9-c3db2d5ed69c + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"0b0453b5-2f4c-49c3-94d9-c3db2d5ed69c","type":"emails","attributes":{"active":true,"address":"test-get_an_on_call_email_for_a_user_returns_ok_response-1762962328@datadoghq.com","alias":"","blocked":false,"created_at":"2025-11-12T15:45:28.530651Z","formats":["html"],"modified_at":"2025-11-12T15:45:28.530651Z"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 12 Nov 2025 15:45:28 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/9cd4f6e1-bfde-11f0-a1ee-1630341c9b2e + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Update-an-On-Call-email-for-a-user-returns-OK-response.frozen b/cassettes/features/v2/on-call/Update-an-On-Call-email-for-a-user-returns-OK-response.frozen new file mode 100644 index 000000000000..8a0c69d011f0 --- /dev/null +++ b/cassettes/features/v2/on-call/Update-an-On-Call-email-for-a-user-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-12T16:13:45.397Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Update-an-On-Call-email-for-a-user-returns-OK-response.yml b/cassettes/features/v2/on-call/Update-an-On-Call-email-for-a-user-returns-OK-response.yml new file mode 100644 index 000000000000..c92d6eaac1b9 --- /dev/null +++ b/cassettes/features/v2/on-call/Update-an-On-Call-email-for-a-user-returns-OK-response.yml @@ -0,0 +1,88 @@ +http_interactions: +- recorded_at: Wed, 12 Nov 2025 16:13:45 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Update_an_On_Call_email_for_a_user_returns_OK_response-1762964025@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"9079b462-bfe2-11f0-a49d-e64699b8fdba","attributes":{"name":null,"handle":"test-update_an_on_call_email_for_a_user_returns_ok_response-1762964025@datadoghq.com","created_at":"2025-11-12T16:13:45.589524+00:00","modified_at":"2025-11-12T16:13:45.589524+00:00","email":"test-update_an_on_call_email_for_a_user_returns_ok_response-1762964025@datadoghq.com","icon":"https://secure.gravatar.com/avatar/4b60f346cb0c28a61ac9db60531c8446?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 12 Nov 2025 16:13:45 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"active":true,"address":"test-update_an_on_call_email_for_a_user_returns_ok_response-1762964025@datadoghq.com","alias":"","formats":["html"]},"type":"emails"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/9079b462-bfe2-11f0-a49d-e64699b8fdba/notification-channels/emails + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"9a61f64e-3092-4654-ac91-5f0ffdaf96cb","type":"emails","attributes":{"active":true,"address":"test-update_an_on_call_email_for_a_user_returns_ok_response-1762964025@datadoghq.com","alias":"","blocked":false,"created_at":"2025-11-12T16:13:45.834889Z","formats":["html"],"modified_at":"2025-11-12T16:13:45.834889Z"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Wed, 12 Nov 2025 16:13:45 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"active":true,"address":"test-update_an_on_call_email_for_a_user_returns_ok_response-1762964025@datadoghq.com","alias":"Test-Update_an_On_Call_email_for_a_user_returns_OK_response-1762964025-alias","formats":["html"]},"id":"9a61f64e-3092-4654-ac91-5f0ffdaf96cb","type":"emails"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/on-call/users/9079b462-bfe2-11f0-a49d-e64699b8fdba/notification-channels/emails/9a61f64e-3092-4654-ac91-5f0ffdaf96cb + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"9a61f64e-3092-4654-ac91-5f0ffdaf96cb","type":"emails","attributes":{"active":true,"address":"test-update_an_on_call_email_for_a_user_returns_ok_response-1762964025@datadoghq.com","alias":"Test-Update_an_On_Call_email_for_a_user_returns_OK_response-1762964025-alias","blocked":false,"created_at":"2025-11-12T16:13:45.834889Z","formats":["html"],"modified_at":"2025-11-12T16:13:45.925234Z"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 12 Nov 2025 16:13:45 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/9079b462-bfe2-11f0-a49d-e64699b8fdba + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/on-call/CreateUserEmailNotificationChannel.rb b/examples/v2/on-call/CreateUserEmailNotificationChannel.rb new file mode 100644 index 000000000000..2d5c2739b2b0 --- /dev/null +++ b/examples/v2/on-call/CreateUserEmailNotificationChannel.rb @@ -0,0 +1,22 @@ +# Create an On-Call email for a user returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +body = DatadogAPIClient::V2::EmailCreateRequest.new({ + data: DatadogAPIClient::V2::EmailData.new({ + attributes: DatadogAPIClient::V2::EmailAttributes.new({ + active: true, + address: "john.doe@datadoghq.com", + _alias: "", + formats: [ + DatadogAPIClient::V2::EmailFormatType::HTML, + ], + }), + type: DatadogAPIClient::V2::EmailType::EMAILS, + }), +}) +p api_instance.create_user_email_notification_channel(USER_DATA_ID, body) diff --git a/examples/v2/on-call/DeleteUserEmailNotificationChannel.rb b/examples/v2/on-call/DeleteUserEmailNotificationChannel.rb new file mode 100644 index 000000000000..c786bb0a5779 --- /dev/null +++ b/examples/v2/on-call/DeleteUserEmailNotificationChannel.rb @@ -0,0 +1,11 @@ +# Delete an On-Call email for a user returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "oncall_email" in the system +ONCALL_EMAIL_DATA_ID = ENV["ONCALL_EMAIL_DATA_ID"] +api_instance.delete_user_email_notification_channel(USER_DATA_ID, ONCALL_EMAIL_DATA_ID) diff --git a/examples/v2/on-call/GetUserEmailNotificationChannel.rb b/examples/v2/on-call/GetUserEmailNotificationChannel.rb new file mode 100644 index 000000000000..b5f972d5ad2e --- /dev/null +++ b/examples/v2/on-call/GetUserEmailNotificationChannel.rb @@ -0,0 +1,11 @@ +# Get an On-Call email for a user returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "oncall_email" in the system +ONCALL_EMAIL_DATA_ID = ENV["ONCALL_EMAIL_DATA_ID"] +p api_instance.get_user_email_notification_channel(USER_DATA_ID, ONCALL_EMAIL_DATA_ID) diff --git a/examples/v2/on-call/UpdateUserEmailNotificationChannel.rb b/examples/v2/on-call/UpdateUserEmailNotificationChannel.rb new file mode 100644 index 000000000000..1b316ff00d9b --- /dev/null +++ b/examples/v2/on-call/UpdateUserEmailNotificationChannel.rb @@ -0,0 +1,27 @@ +# Update an On-Call email for a user returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "oncall_email" in the system +ONCALL_EMAIL_DATA_ATTRIBUTES_ADDRESS = ENV["ONCALL_EMAIL_DATA_ATTRIBUTES_ADDRESS"] +ONCALL_EMAIL_DATA_ID = ENV["ONCALL_EMAIL_DATA_ID"] + +body = DatadogAPIClient::V2::EmailUpdateRequest.new({ + data: DatadogAPIClient::V2::EmailData.new({ + id: ONCALL_EMAIL_DATA_ID, + attributes: DatadogAPIClient::V2::EmailAttributes.new({ + active: true, + address: ONCALL_EMAIL_DATA_ATTRIBUTES_ADDRESS, + _alias: "Example-On-Call-alias", + formats: [ + DatadogAPIClient::V2::EmailFormatType::HTML, + ], + }), + type: DatadogAPIClient::V2::EmailType::EMAILS, + }), +}) +p api_instance.update_user_email_notification_channel(USER_DATA_ID, ONCALL_EMAIL_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 3d5a33062ea4..52277e195f18 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2555,6 +2555,23 @@ "include" => "String", "body" => "TeamRoutingRulesRequest", }, + "v2.CreateUserEmailNotificationChannel" => { + "user_id" => "String", + "body" => "EmailCreateRequest", + }, + "v2.DeleteUserEmailNotificationChannel" => { + "user_id" => "String", + "email_id" => "String", + }, + "v2.GetUserEmailNotificationChannel" => { + "user_id" => "String", + "email_id" => "String", + }, + "v2.UpdateUserEmailNotificationChannel" => { + "user_id" => "String", + "email_id" => "String", + "body" => "EmailUpdateRequest", + }, "v2.CreateOnCallPage" => { "body" => "CreatePageRequest", }, diff --git a/features/v2/given.json b/features/v2/given.json index 4ee7b3a6f955..508e0bee160e 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -743,6 +743,22 @@ "tag": "On-Call", "operationId": "SetOnCallTeamRoutingRules" }, + { + "parameters": [ + { + "name": "user_id", + "source": "user.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"active\": true,\n \"address\": \"{{ user.data.attributes.email }}\",\n \"alias\": \"\",\n \"formats\": [\n \"html\"\n ]\n },\n \"type\": \"emails\"\n }\n}" + } + ], + "step": "there is a valid \"oncall_email\" in the system", + "key": "oncall_email", + "tag": "On-Call", + "operationId": "CreateUserEmailNotificationChannel" + }, { "parameters": [ { diff --git a/features/v2/on-call.feature b/features/v2/on-call.feature index 39640938e4a1..ea48ab4dc6e9 100644 --- a/features/v2/on-call.feature +++ b/features/v2/on-call.feature @@ -43,6 +43,32 @@ Feature: On-Call When the request is sent Then the response status is 201 Created + @team:DataDog/on-call + Scenario: Create an On-Call email for a user returns "Bad Request" response + Given new "CreateUserEmailNotificationChannel" request + And there is a valid "user" in the system + And request contains "user_id" parameter from "user.data.id" + And body with value {"data": {"attributes": {"active": true, "address": "", "alias": "", "formats": ["html"]}, "type": "emails"}} + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/on-call + Scenario: Create an On-Call email for a user returns "Created" response + Given new "CreateUserEmailNotificationChannel" request + And there is a valid "user" in the system + And request contains "user_id" parameter from "user.data.id" + And body with value {"data": {"attributes": {"active": true, "address": "john.doe@datadoghq.com", "alias": "", "formats": ["html"]}, "type": "emails"}} + When the request is sent + Then the response status is 201 Created + + @team:DataDog/on-call + Scenario: Create an On-Call email for a user returns "Not Found" response + Given new "CreateUserEmailNotificationChannel" request + And request contains "user_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"attributes": {"active": true, "address": "john.doe@datadoghq.com", "alias": "", "formats": ["html"]}, "type": "emails"}} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/on-call Scenario: Delete On-Call escalation policy returns "No Content" response Given new "DeleteOnCallEscalationPolicy" request @@ -77,6 +103,49 @@ Feature: On-Call When the request is sent Then the response status is 404 Not Found + @team:DataDog/on-call + Scenario: Delete an On-Call email for a missing email returns "Not Found" response + Given new "DeleteUserEmailNotificationChannel" request + And there is a valid "user" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "email_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/on-call + Scenario: Delete an On-Call email for a missing user returns "Not Found" response + Given new "DeleteUserEmailNotificationChannel" request + And request contains "user_id" parameter with value "00000000-0000-0000-0000-000000000000" + And request contains "email_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/on-call + Scenario: Delete an On-Call email for a user returns "Bad Request" response + Given new "DeleteUserEmailNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "email_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 email for a user returns "No Content" response + Given new "DeleteUserEmailNotificationChannel" request + And there is a valid "user" in the system + And there is a valid "oncall_email" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "email_id" parameter from "oncall_email.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 email for a user returns "Not Found" response + Given new "DeleteUserEmailNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "email_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/on-call Scenario: Get On-Call escalation policy returns "Bad Request" response Given new "GetOnCallEscalationPolicy" request @@ -126,6 +195,32 @@ Feature: On-Call When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/on-call + Scenario: Get an On-Call email for a user returns "Bad Request" response + Given new "GetUserEmailNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "email_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 email for a user returns "Not Found" response + Given new "GetUserEmailNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "email_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 email for a user returns "OK" response + Given new "GetUserEmailNotificationChannel" request + And there is a valid "user" in the system + And there is a valid "oncall_email" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "email_id" parameter from "oncall_email.data.id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/on-call Scenario: Get team on-call users returns "Bad Request" response Given new "GetTeamOnCallUsers" request @@ -243,3 +338,32 @@ 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 email for a user returns "Bad Request" response + Given new "UpdateUserEmailNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "email_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"active": true, "address": "john.doe@datadoghq.com", "alias": "", "formats": ["html"]}, "type": "emails"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/on-call + Scenario: Update an On-Call email for a user returns "Not Found" response + Given new "UpdateUserEmailNotificationChannel" request + And request contains "user_id" parameter from "REPLACE.ME" + And request contains "email_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"active": true, "address": "john.doe@datadoghq.com", "alias": "", "formats": ["html"]}, "type": "emails"}} + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/on-call + Scenario: Update an On-Call email for a user returns "OK" response + Given new "UpdateUserEmailNotificationChannel" request + And there is a valid "user" in the system + And there is a valid "oncall_email" in the system + And request contains "user_id" parameter from "user.data.id" + And request contains "email_id" parameter from "oncall_email.data.id" + And body with value {"data": {"id": "{{oncall_email.data.id}}", "attributes": {"active": true, "address": "{{oncall_email.data.attributes.address}}", "alias": "{{ unique }}-alias", "formats": ["html"]}, "type": "emails"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index cd8c18bf0780..93dc5840b656 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2766,6 +2766,30 @@ "type": "idempotent" } }, + "CreateUserEmailNotificationChannel": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "DeleteUserEmailNotificationChannel": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "GetUserEmailNotificationChannel": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "UpdateUserEmailNotificationChannel": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 32cc933e8442..8fcaf3d4af32 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1954,6 +1954,13 @@ def overrides "v2.downtime_update_request" => "DowntimeUpdateRequest", "v2.downtime_update_request_attributes" => "DowntimeUpdateRequestAttributes", "v2.downtime_update_request_data" => "DowntimeUpdateRequestData", + "v2.email" => "Email", + "v2.email_attributes" => "EmailAttributes", + "v2.email_create_request" => "EmailCreateRequest", + "v2.email_data" => "EmailData", + "v2.email_format_type" => "EmailFormatType", + "v2.email_type" => "EmailType", + "v2.email_update_request" => "EmailUpdateRequest", "v2.entity_attributes" => "EntityAttributes", "v2.entity_data" => "EntityData", "v2.entity_meta" => "EntityMeta", diff --git a/lib/datadog_api_client/v2/api/error_tracking_api.rb b/lib/datadog_api_client/v2/api/error_tracking_api.rb index cb41881eea18..53340cbc56b6 100644 --- a/lib/datadog_api_client/v2/api/error_tracking_api.rb +++ b/lib/datadog_api_client/v2/api/error_tracking_api.rb @@ -102,7 +102,7 @@ def get_issue(issue_id, opts = {}) # # @param issue_id [String] The identifier of the issue. # @param opts [Hash] the optional parameters - # @option opts [Array] :include Comma-separated list of relationship objects that should be included in the response. Possible values are `assignee`, `case`, and `team_owners`. + # @option opts [Array] :include Comma-separated list of relationship objects that should be included in the response. # @return [Array<(IssueResponse, Integer, Hash)>] IssueResponse data, response status code and response headers def get_issue_with_http_info(issue_id, opts = {}) @@ -169,7 +169,7 @@ def search_issues(body, opts = {}) # # @param body [IssuesSearchRequest] Search issues request payload. # @param opts [Hash] the optional parameters - # @option opts [Array] :include Comma-separated list of relationship objects that should be included in the response. Possible values are `issue`, `issue.assignee`, `issue.case`, and `issue.team_owners`. + # @option opts [Array] :include Comma-separated list of relationship objects that should be included in the response. # @return [Array<(IssuesSearchResponse, Integer, Hash)>] IssuesSearchResponse data, response status code and response headers def search_issues_with_http_info(body, opts = {}) diff --git a/lib/datadog_api_client/v2/api/on_call_api.rb b/lib/datadog_api_client/v2/api/on_call_api.rb index 87628c506a0a..f121a075536a 100644 --- a/lib/datadog_api_client/v2/api/on_call_api.rb +++ b/lib/datadog_api_client/v2/api/on_call_api.rb @@ -161,6 +161,78 @@ def create_on_call_schedule_with_http_info(body, opts = {}) return data, status_code, headers end + # Create an On-Call email for a user. + # + # @see #create_user_email_notification_channel_with_http_info + def create_user_email_notification_channel(user_id, body, opts = {}) + data, _status_code, _headers = create_user_email_notification_channel_with_http_info(user_id, body, opts) + data + end + + # Create an On-Call email for a user. + # + # Create a new email notification channel for an on-call user + # + # @param user_id [String] The user ID + # @param body [EmailCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers + def create_user_email_notification_channel_with_http_info(user_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.create_user_email_notification_channel ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.create_user_email_notification_channel" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling OnCallAPI.create_user_email_notification_channel" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-channels/emails'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'Email' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_user_email_notification_channel, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#create_user_email_notification_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete On-Call escalation policy. # # @see #delete_on_call_escalation_policy_with_http_info @@ -291,6 +363,76 @@ def delete_on_call_schedule_with_http_info(schedule_id, opts = {}) return data, status_code, headers end + # Delete an On-Call email for a user. + # + # @see #delete_user_email_notification_channel_with_http_info + def delete_user_email_notification_channel(user_id, email_id, opts = {}) + delete_user_email_notification_channel_with_http_info(user_id, email_id, opts) + nil + end + + # Delete an On-Call email for a user. + # + # Delete an email notification channel for an on-call user + # + # @param user_id [String] The user ID + # @param email_id [String] The email ID + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_user_email_notification_channel_with_http_info(user_id, email_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.delete_user_email_notification_channel ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.delete_user_email_notification_channel" + end + # verify the required parameter 'email_id' is set + if @api_client.config.client_side_validation && email_id.nil? + fail ArgumentError, "Missing the required parameter 'email_id' when calling OnCallAPI.delete_user_email_notification_channel" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')).sub('{email_id}', CGI.escape(email_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_user_email_notification_channel, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#delete_user_email_notification_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get On-Call escalation policy. # # @see #get_on_call_escalation_policy_with_http_info @@ -628,6 +770,76 @@ def get_team_on_call_users_with_http_info(team_id, opts = {}) return data, status_code, headers end + # Get an On-Call email for a user. + # + # @see #get_user_email_notification_channel_with_http_info + def get_user_email_notification_channel(user_id, email_id, opts = {}) + data, _status_code, _headers = get_user_email_notification_channel_with_http_info(user_id, email_id, opts) + data + end + + # Get an On-Call email for a user. + # + # Get an email notification channel for an on-call user + # + # @param user_id [String] The user ID + # @param email_id [String] The email ID + # @param opts [Hash] the optional parameters + # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers + def get_user_email_notification_channel_with_http_info(user_id, email_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.get_user_email_notification_channel ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.get_user_email_notification_channel" + end + # verify the required parameter 'email_id' is set + if @api_client.config.client_side_validation && email_id.nil? + fail ArgumentError, "Missing the required parameter 'email_id' when calling OnCallAPI.get_user_email_notification_channel" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')).sub('{email_id}', CGI.escape(email_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Email' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_user_email_notification_channel, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#get_user_email_notification_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Set On-Call team routing rules. # # @see #set_on_call_team_routing_rules_with_http_info @@ -849,5 +1061,82 @@ def update_on_call_schedule_with_http_info(schedule_id, body, opts = {}) end return data, status_code, headers end + + # Update an On-Call email for a user. + # + # @see #update_user_email_notification_channel_with_http_info + def update_user_email_notification_channel(user_id, email_id, body, opts = {}) + data, _status_code, _headers = update_user_email_notification_channel_with_http_info(user_id, email_id, body, opts) + data + end + + # Update an On-Call email for a user. + # + # Update an email notification channel for an on-call user + # + # @param user_id [String] The user ID + # @param email_id [String] The email ID + # @param body [EmailUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers + def update_user_email_notification_channel_with_http_info(user_id, email_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.update_user_email_notification_channel ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.update_user_email_notification_channel" + end + # verify the required parameter 'email_id' is set + if @api_client.config.client_side_validation && email_id.nil? + fail ArgumentError, "Missing the required parameter 'email_id' when calling OnCallAPI.update_user_email_notification_channel" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling OnCallAPI.update_user_email_notification_channel" + end + # resource path + local_var_path = '/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')).sub('{email_id}', CGI.escape(email_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'Email' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_user_email_notification_channel, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#update_user_email_notification_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/email.rb b/lib/datadog_api_client/v2/models/email.rb new file mode 100644 index 000000000000..e47db95256eb --- /dev/null +++ b/lib/datadog_api_client/v2/models/email.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # On-Call User Email. + class Email + include BaseGenericModel + + # Data for an on-call email resource. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'EmailData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Email` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/email_attributes.rb b/lib/datadog_api_client/v2/models/email_attributes.rb new file mode 100644 index 000000000000..13005d08e222 --- /dev/null +++ b/lib/datadog_api_client/v2/models/email_attributes.rb @@ -0,0 +1,137 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for an on-call email. + class EmailAttributes + include BaseGenericModel + + # Whether the email is currently active. + attr_accessor :active + + # Email address. + attr_accessor :address + + # Optional display alias for the email. + attr_accessor :_alias + + # Preferred content formats for notifications. + attr_accessor :formats + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'active' => :'active', + :'address' => :'address', + :'_alias' => :'alias', + :'formats' => :'formats' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'active' => :'Boolean', + :'address' => :'String', + :'_alias' => :'String', + :'formats' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EmailAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'_alias') + self._alias = attributes[:'_alias'] + end + + if attributes.key?(:'formats') + if (value = attributes[:'formats']).is_a?(Array) + self.formats = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active && + address == o.address && + _alias == o._alias && + formats == o.formats && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [active, address, _alias, formats, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/email_create_request.rb b/lib/datadog_api_client/v2/models/email_create_request.rb new file mode 100644 index 000000000000..33e11ba061c6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/email_create_request.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for creating an On-Call email notification channel. + class EmailCreateRequest + include BaseGenericModel + + # Data for an on-call email resource. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'EmailData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EmailCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/email_data.rb b/lib/datadog_api_client/v2/models/email_data.rb new file mode 100644 index 000000000000..c8c299e545a2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/email_data.rb @@ -0,0 +1,143 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for an on-call email resource. + class EmailData + include BaseGenericModel + + # Attributes for an on-call email. + attr_accessor :attributes + + # The email's unique identifier. + attr_accessor :id + + # Indicates that the resource is of type 'emails'. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'EmailAttributes', + :'id' => :'String', + :'type' => :'EmailType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EmailData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/email_format_type.rb b/lib/datadog_api_client/v2/models/email_format_type.rb new file mode 100644 index 000000000000..040dfb633c97 --- /dev/null +++ b/lib/datadog_api_client/v2/models/email_format_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Specifies the format of the e-mail that is sent for On-Call notifications + class EmailFormatType + include BaseEnumModel + + HTML = "html".freeze + TEXT = "text".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/email_type.rb b/lib/datadog_api_client/v2/models/email_type.rb new file mode 100644 index 000000000000..49baed8c954d --- /dev/null +++ b/lib/datadog_api_client/v2/models/email_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Indicates that the resource is of type 'emails'. + class EmailType + include BaseEnumModel + + EMAILS = "emails".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/email_update_request.rb b/lib/datadog_api_client/v2/models/email_update_request.rb new file mode 100644 index 000000000000..152b217f18de --- /dev/null +++ b/lib/datadog_api_client/v2/models/email_update_request.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for updating an On-Call email notification channel. + class EmailUpdateRequest + include BaseGenericModel + + # Data for an on-call email resource. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'EmailData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EmailUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end