From da295a1a811708433e6f94bac314a27d956ceb2c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 10 Nov 2025 16:06:06 +0000 Subject: [PATCH] Regenerate client from commit 6580ee6 of spec repo --- .generator/schemas/v2/openapi.yaml | 269 ++++++++++++++++ ...a-user-returns-Bad-Request-response.frozen | 1 + ...or-a-user-returns-Bad-Request-response.yml | 67 ++++ .../CreateUserEmailNotificationChannel.rb | 19 ++ .../DeleteUserEmailNotificationChannel.rb | 5 + .../GetUserEmailNotificationChannel.rb | 5 + .../UpdateUserEmailNotificationChannel.rb | 19 ++ features/scenarios_model_mapping.rb | 17 ++ features/v2/on-call.feature | 100 ++++++ features/v2/undo.json | 35 +++ lib/datadog_api_client/inflector.rb | 6 + lib/datadog_api_client/v2/api/on_call_api.rb | 289 ++++++++++++++++++ lib/datadog_api_client/v2/models/email.rb | 105 +++++++ .../v2/models/email_attributes.rb | 137 +++++++++ .../v2/models/email_create_request.rb | 105 +++++++ .../v2/models/email_data.rb | 143 +++++++++ .../v2/models/email_type.rb | 26 ++ .../v2/models/email_update_request.rb | 105 +++++++ 18 files changed, 1453 insertions(+) create mode 100644 cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/on-call/Create-an-On-Call-email-for-a-user-returns-Bad-Request-response.yml create mode 100644 examples/v2/on-call/CreateUserEmailNotificationChannel.rb create mode 100644 examples/v2/on-call/DeleteUserEmailNotificationChannel.rb create mode 100644 examples/v2/on-call/GetUserEmailNotificationChannel.rb create mode 100644 examples/v2/on-call/UpdateUserEmailNotificationChannel.rb create mode 100644 lib/datadog_api_client/v2/models/email.rb create mode 100644 lib/datadog_api_client/v2/models/email_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/email_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/email_data.rb create mode 100644 lib/datadog_api_client/v2/models/email_type.rb create mode 100644 lib/datadog_api_client/v2/models/email_update_request.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6ed4b42368ed..f73a90c16a67 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17289,6 +17289,92 @@ 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: + type: string + 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 + 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 @@ -71866,6 +71952,189 @@ 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': + 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..a7a8dd4fd0c0 --- /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-10T15:47:53.231Z \ 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..86e1843544ba --- /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: Mon, 10 Nov 2025 15:47:53 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Create_an_On_Call_email_for_a_user_returns_Bad_Request_response-1762789673@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":"9e779c75-be4c-11f0-b079-fe26ba093275","attributes":{"name":null,"handle":"test-create_an_on_call_email_for_a_user_returns_bad_request_response-1762789673@datadoghq.com","created_at":"2025-11-10T15:47:53.391689+00:00","modified_at":"2025-11-10T15:47:53.391689+00:00","email":"test-create_an_on_call_email_for_a_user_returns_bad_request_response-1762789673@datadoghq.com","icon":"https://secure.gravatar.com/avatar/6dc07c375270992258c53c74e29f7515?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: Mon, 10 Nov 2025 15:47:53 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"active":true,"address":"","alias":"","formats":["html"]},"type":"emails"}}' + headers: + Accept: + - '*/*' + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/users/9e779c75-be4c-11f0-b079-fe26ba093275/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: Mon, 10 Nov 2025 15:47:53 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/9e779c75-be4c-11f0-b079-fe26ba093275 + 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..4dec4097db02 --- /dev/null +++ b/examples/v2/on-call/CreateUserEmailNotificationChannel.rb @@ -0,0 +1,19 @@ +# Create an On-Call email for a user returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +body = DatadogAPIClient::V2::EmailCreateRequest.new({ + data: DatadogAPIClient::V2::EmailData.new({ + attributes: DatadogAPIClient::V2::EmailAttributes.new({ + active: true, + address: "john.doe@datadoghq.com", + _alias: "", + formats: [ + "html", + ], + }), + type: DatadogAPIClient::V2::EmailType::EMAILS, + }), +}) +p api_instance.create_user_email_notification_channel("00000000-0000-0000-0000-000000000000", body) diff --git a/examples/v2/on-call/DeleteUserEmailNotificationChannel.rb b/examples/v2/on-call/DeleteUserEmailNotificationChannel.rb new file mode 100644 index 000000000000..f986142a6552 --- /dev/null +++ b/examples/v2/on-call/DeleteUserEmailNotificationChannel.rb @@ -0,0 +1,5 @@ +# Delete an On-Call email for a user returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new +api_instance.delete_user_email_notification_channel("00000000-0000-0000-0000-000000000000", "45bb8fe5-dd96-42ad-83de-2241ea9f6ffc") diff --git a/examples/v2/on-call/GetUserEmailNotificationChannel.rb b/examples/v2/on-call/GetUserEmailNotificationChannel.rb new file mode 100644 index 000000000000..56e6a0f4b114 --- /dev/null +++ b/examples/v2/on-call/GetUserEmailNotificationChannel.rb @@ -0,0 +1,5 @@ +# Get an On-Call email for a user returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new +p api_instance.get_user_email_notification_channel("00000000-0000-0000-0000-000000000000", "45bb8fe5-dd96-42ad-83de-2241ea9f6ffc") diff --git a/examples/v2/on-call/UpdateUserEmailNotificationChannel.rb b/examples/v2/on-call/UpdateUserEmailNotificationChannel.rb new file mode 100644 index 000000000000..63bedc9a17fe --- /dev/null +++ b/examples/v2/on-call/UpdateUserEmailNotificationChannel.rb @@ -0,0 +1,19 @@ +# Update an On-Call email for a user returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +body = DatadogAPIClient::V2::EmailUpdateRequest.new({ + data: DatadogAPIClient::V2::EmailData.new({ + attributes: DatadogAPIClient::V2::EmailAttributes.new({ + active: true, + address: "john.doe@datadoghq.com", + _alias: "", + formats: [ + "html", + ], + }), + type: DatadogAPIClient::V2::EmailType::EMAILS, + }), +}) +p api_instance.update_user_email_notification_channel("00000000-0000-0000-0000-000000000000", "45bb8fe5-dd96-42ad-83de-2241ea9f6ffc", 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/on-call.feature b/features/v2/on-call.feature index 39640938e4a1..91ab44ed8b09 100644 --- a/features/v2/on-call.feature +++ b/features/v2/on-call.feature @@ -43,6 +43,31 @@ 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 + + @generated @skip @team:DataDog/on-call + Scenario: Create an On-Call email for a user returns "Created" response + Given new "CreateUserEmailNotificationChannel" request + And request contains "user_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 201 Created + + @generated @skip @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 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 + @team:DataDog/on-call Scenario: Delete On-Call escalation policy returns "No Content" response Given new "DeleteOnCallEscalationPolicy" request @@ -77,6 +102,30 @@ 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 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 + + @generated @skip @team:DataDog/on-call + Scenario: Delete an On-Call email for a user returns "No Content" 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 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 +175,30 @@ 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 + + @generated @skip @team:DataDog/on-call + Scenario: Get an On-Call email for a user returns "OK" 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 200 OK + @generated @skip @team:DataDog/on-call Scenario: Get team on-call users returns "Bad Request" response Given new "GetTeamOnCallUsers" request @@ -243,3 +316,30 @@ 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 + + @generated @skip @team:DataDog/on-call + Scenario: Update an On-Call email for a user returns "OK" 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 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index cd8c18bf0780..13194f0dd16d 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2766,6 +2766,41 @@ "type": "idempotent" } }, + "CreateUserEmailNotificationChannel": { + "tag": "On-Call", + "undo": { + "operationId": "DeleteUserEmailNotificationChannel", + "parameters": [ + { + "name": "user_id", + "source": "" + }, + { + "name": "email_id", + "source": "" + } + ], + "type": "unsafe" + } + }, + "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..d4dea4d9c2f2 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1954,6 +1954,12 @@ 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_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/on_call_api.rb b/lib/datadog_api_client/v2/api/on_call_api.rb index 87628c506a0a..03334b8e0d09 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 = {}) + create_user_email_notification_channel_with_http_info(user_id, body, opts) + nil + 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<(nil, Integer, Hash)>] nil, 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(['*/*']) + # 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] + + # 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..c68e474becc1 --- /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_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