diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7d574afcf4b..9fb443da00e 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/examples/v2/on-call/CreateUserEmailNotificationChannel.java b/examples/v2/on-call/CreateUserEmailNotificationChannel.java new file mode 100644 index 00000000000..933a67ccd76 --- /dev/null +++ b/examples/v2/on-call/CreateUserEmailNotificationChannel.java @@ -0,0 +1,45 @@ +// Create an On-Call email for a user returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallApi; +import com.datadog.api.client.v2.model.Email; +import com.datadog.api.client.v2.model.EmailAttributes; +import com.datadog.api.client.v2.model.EmailCreateRequest; +import com.datadog.api.client.v2.model.EmailData; +import com.datadog.api.client.v2.model.EmailFormatType; +import com.datadog.api.client.v2.model.EmailType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallApi apiInstance = new OnCallApi(defaultClient); + + // there is a valid "user" in the system + String USER_DATA_ID = System.getenv("USER_DATA_ID"); + + EmailCreateRequest body = + new EmailCreateRequest() + .data( + new EmailData() + .attributes( + new EmailAttributes() + .active(true) + .address("john.doe@datadoghq.com") + .alias("") + .formats(Collections.singletonList(EmailFormatType.HTML))) + .type(EmailType.EMAILS)); + + try { + Email result = apiInstance.createUserEmailNotificationChannel(USER_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallApi#createUserEmailNotificationChannel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/on-call/DeleteUserEmailNotificationChannel.java b/examples/v2/on-call/DeleteUserEmailNotificationChannel.java new file mode 100644 index 00000000000..6cc08ca7aa4 --- /dev/null +++ b/examples/v2/on-call/DeleteUserEmailNotificationChannel.java @@ -0,0 +1,28 @@ +// Delete an On-Call email for a user returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallApi apiInstance = new OnCallApi(defaultClient); + + // there is a valid "user" in the system + String USER_DATA_ID = System.getenv("USER_DATA_ID"); + + // there is a valid "oncall_email" in the system + String ONCALL_EMAIL_DATA_ID = System.getenv("ONCALL_EMAIL_DATA_ID"); + + try { + apiInstance.deleteUserEmailNotificationChannel(USER_DATA_ID, ONCALL_EMAIL_DATA_ID); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallApi#deleteUserEmailNotificationChannel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/on-call/GetUserEmailNotificationChannel.java b/examples/v2/on-call/GetUserEmailNotificationChannel.java new file mode 100644 index 00000000000..68f63d0e906 --- /dev/null +++ b/examples/v2/on-call/GetUserEmailNotificationChannel.java @@ -0,0 +1,31 @@ +// Get an On-Call email for a user returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallApi; +import com.datadog.api.client.v2.model.Email; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallApi apiInstance = new OnCallApi(defaultClient); + + // there is a valid "user" in the system + String USER_DATA_ID = System.getenv("USER_DATA_ID"); + + // there is a valid "oncall_email" in the system + String ONCALL_EMAIL_DATA_ID = System.getenv("ONCALL_EMAIL_DATA_ID"); + + try { + Email result = + apiInstance.getUserEmailNotificationChannel(USER_DATA_ID, ONCALL_EMAIL_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallApi#getUserEmailNotificationChannel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/on-call/UpdateUserEmailNotificationChannel.java b/examples/v2/on-call/UpdateUserEmailNotificationChannel.java new file mode 100644 index 00000000000..859ee4a1c69 --- /dev/null +++ b/examples/v2/on-call/UpdateUserEmailNotificationChannel.java @@ -0,0 +1,52 @@ +// Update an On-Call email for a user returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallApi; +import com.datadog.api.client.v2.model.Email; +import com.datadog.api.client.v2.model.EmailAttributes; +import com.datadog.api.client.v2.model.EmailData; +import com.datadog.api.client.v2.model.EmailFormatType; +import com.datadog.api.client.v2.model.EmailType; +import com.datadog.api.client.v2.model.EmailUpdateRequest; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallApi apiInstance = new OnCallApi(defaultClient); + + // there is a valid "user" in the system + String USER_DATA_ID = System.getenv("USER_DATA_ID"); + + // there is a valid "oncall_email" in the system + String ONCALL_EMAIL_DATA_ATTRIBUTES_ADDRESS = + System.getenv("ONCALL_EMAIL_DATA_ATTRIBUTES_ADDRESS"); + String ONCALL_EMAIL_DATA_ID = System.getenv("ONCALL_EMAIL_DATA_ID"); + + EmailUpdateRequest body = + new EmailUpdateRequest() + .data( + new EmailData() + .id(ONCALL_EMAIL_DATA_ID) + .attributes( + new EmailAttributes() + .active(true) + .address(ONCALL_EMAIL_DATA_ATTRIBUTES_ADDRESS) + .alias("Example-On-Call-alias") + .formats(Collections.singletonList(EmailFormatType.HTML))) + .type(EmailType.EMAILS)); + + try { + Email result = + apiInstance.updateUserEmailNotificationChannel(USER_DATA_ID, ONCALL_EMAIL_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallApi#updateUserEmailNotificationChannel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/ErrorTrackingApi.java b/src/main/java/com/datadog/api/client/v2/api/ErrorTrackingApi.java index 98140adde60..272d1b1b684 100644 --- a/src/main/java/com/datadog/api/client/v2/api/ErrorTrackingApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/ErrorTrackingApi.java @@ -192,8 +192,7 @@ public static class GetIssueOptionalParameters { * Set include. * * @param include Comma-separated list of relationship objects that should be included in the - * response. Possible values are assignee, case, and - * team_owners. (optional) + * response. (optional) * @return GetIssueOptionalParameters */ public GetIssueOptionalParameters include(List include) { @@ -389,8 +388,7 @@ public static class SearchIssuesOptionalParameters { * Set include. * * @param 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. (optional) + * response. (optional) * @return SearchIssuesOptionalParameters */ public SearchIssuesOptionalParameters include( diff --git a/src/main/java/com/datadog/api/client/v2/api/OnCallApi.java b/src/main/java/com/datadog/api/client/v2/api/OnCallApi.java index 40fd0e1e51d..4dfbfefc2aa 100644 --- a/src/main/java/com/datadog/api/client/v2/api/OnCallApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/OnCallApi.java @@ -4,6 +4,9 @@ import com.datadog.api.client.ApiException; import com.datadog.api.client.ApiResponse; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.Email; +import com.datadog.api.client.v2.model.EmailCreateRequest; +import com.datadog.api.client.v2.model.EmailUpdateRequest; import com.datadog.api.client.v2.model.EscalationPolicy; import com.datadog.api.client.v2.model.EscalationPolicyCreateRequest; import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequest; @@ -452,6 +455,171 @@ public CompletableFuture> createOnCallScheduleWithHttpInfo new GenericType() {}); } + /** + * Create an On-Call email for a user. + * + *

See {@link #createUserEmailNotificationChannelWithHttpInfo}. + * + * @param userId The user ID (required) + * @param body (required) + * @return Email + * @throws ApiException if fails to make API call + */ + public Email createUserEmailNotificationChannel(String userId, EmailCreateRequest body) + throws ApiException { + return createUserEmailNotificationChannelWithHttpInfo(userId, body).getData(); + } + + /** + * Create an On-Call email for a user. + * + *

See {@link #createUserEmailNotificationChannelWithHttpInfoAsync}. + * + * @param userId The user ID (required) + * @param body (required) + * @return CompletableFuture<Email> + */ + public CompletableFuture createUserEmailNotificationChannelAsync( + String userId, EmailCreateRequest body) { + return createUserEmailNotificationChannelWithHttpInfoAsync(userId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new email notification channel for an on-call user + * + * @param userId The user ID (required) + * @param body (required) + * @return ApiResponse<Email> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse createUserEmailNotificationChannelWithHttpInfo( + String userId, EmailCreateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'userId' when calling" + + " createUserEmailNotificationChannel"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling createUserEmailNotificationChannel"); + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/emails" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallApi.createUserEmailNotificationChannel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create an On-Call email for a user. + * + *

See {@link #createUserEmailNotificationChannelWithHttpInfo}. + * + * @param userId The user ID (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Email>> + */ + public CompletableFuture> createUserEmailNotificationChannelWithHttpInfoAsync( + String userId, EmailCreateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'userId' is set + if (userId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'userId' when calling" + + " createUserEmailNotificationChannel")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " createUserEmailNotificationChannel")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/emails" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallApi.createUserEmailNotificationChannel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Delete On-Call escalation policy. * @@ -727,6 +895,173 @@ public CompletableFuture> deleteOnCallScheduleWithHttpInfoAsyn null); } + /** + * Delete an On-Call email for a user. + * + *

See {@link #deleteUserEmailNotificationChannelWithHttpInfo}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @throws ApiException if fails to make API call + */ + public void deleteUserEmailNotificationChannel(String userId, String emailId) + throws ApiException { + deleteUserEmailNotificationChannelWithHttpInfo(userId, emailId); + } + + /** + * Delete an On-Call email for a user. + * + *

See {@link #deleteUserEmailNotificationChannelWithHttpInfoAsync}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @return CompletableFuture + */ + public CompletableFuture deleteUserEmailNotificationChannelAsync( + String userId, String emailId) { + return deleteUserEmailNotificationChannelWithHttpInfoAsync(userId, emailId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an email notification channel for an on-call user + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteUserEmailNotificationChannelWithHttpInfo( + String userId, String emailId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'userId' when calling" + + " deleteUserEmailNotificationChannel"); + } + + // verify the required parameter 'emailId' is set + if (emailId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'emailId' when calling" + + " deleteUserEmailNotificationChannel"); + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())) + .replaceAll("\\{" + "email_id" + "\\}", apiClient.escapeString(emailId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallApi.deleteUserEmailNotificationChannel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an On-Call email for a user. + * + *

See {@link #deleteUserEmailNotificationChannelWithHttpInfo}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteUserEmailNotificationChannelWithHttpInfoAsync( + String userId, String emailId) { + Object localVarPostBody = null; + + // verify the required parameter 'userId' is set + if (userId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'userId' when calling" + + " deleteUserEmailNotificationChannel")); + return result; + } + + // verify the required parameter 'emailId' is set + if (emailId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'emailId' when calling" + + " deleteUserEmailNotificationChannel")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())) + .replaceAll("\\{" + "email_id" + "\\}", apiClient.escapeString(emailId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallApi.deleteUserEmailNotificationChannel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** Manage optional parameters to getOnCallEscalationPolicy. */ public static class GetOnCallEscalationPolicyOptionalParameters { private String include; @@ -1746,6 +2081,171 @@ public CompletableFuture> getTeamOnCallUsersWi new GenericType() {}); } + /** + * Get an On-Call email for a user. + * + *

See {@link #getUserEmailNotificationChannelWithHttpInfo}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @return Email + * @throws ApiException if fails to make API call + */ + public Email getUserEmailNotificationChannel(String userId, String emailId) throws ApiException { + return getUserEmailNotificationChannelWithHttpInfo(userId, emailId).getData(); + } + + /** + * Get an On-Call email for a user. + * + *

See {@link #getUserEmailNotificationChannelWithHttpInfoAsync}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @return CompletableFuture<Email> + */ + public CompletableFuture getUserEmailNotificationChannelAsync( + String userId, String emailId) { + return getUserEmailNotificationChannelWithHttpInfoAsync(userId, emailId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an email notification channel for an on-call user + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @return ApiResponse<Email> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getUserEmailNotificationChannelWithHttpInfo( + String userId, String emailId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'userId' when calling getUserEmailNotificationChannel"); + } + + // verify the required parameter 'emailId' is set + if (emailId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'emailId' when calling getUserEmailNotificationChannel"); + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())) + .replaceAll("\\{" + "email_id" + "\\}", apiClient.escapeString(emailId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallApi.getUserEmailNotificationChannel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an On-Call email for a user. + * + *

See {@link #getUserEmailNotificationChannelWithHttpInfo}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @return CompletableFuture<ApiResponse<Email>> + */ + public CompletableFuture> getUserEmailNotificationChannelWithHttpInfoAsync( + String userId, String emailId) { + Object localVarPostBody = null; + + // verify the required parameter 'userId' is set + if (userId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'userId' when calling" + + " getUserEmailNotificationChannel")); + return result; + } + + // verify the required parameter 'emailId' is set + if (emailId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'emailId' when calling" + + " getUserEmailNotificationChannel")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())) + .replaceAll("\\{" + "email_id" + "\\}", apiClient.escapeString(emailId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallApi.getUserEmailNotificationChannel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to setOnCallTeamRoutingRules. */ public static class SetOnCallTeamRoutingRulesOptionalParameters { private String include; @@ -2451,4 +2951,194 @@ public CompletableFuture> updateOnCallScheduleWithHttpInfo false, new GenericType() {}); } + + /** + * Update an On-Call email for a user. + * + *

See {@link #updateUserEmailNotificationChannelWithHttpInfo}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @param body (required) + * @return Email + * @throws ApiException if fails to make API call + */ + public Email updateUserEmailNotificationChannel( + String userId, String emailId, EmailUpdateRequest body) throws ApiException { + return updateUserEmailNotificationChannelWithHttpInfo(userId, emailId, body).getData(); + } + + /** + * Update an On-Call email for a user. + * + *

See {@link #updateUserEmailNotificationChannelWithHttpInfoAsync}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @param body (required) + * @return CompletableFuture<Email> + */ + public CompletableFuture updateUserEmailNotificationChannelAsync( + String userId, String emailId, EmailUpdateRequest body) { + return updateUserEmailNotificationChannelWithHttpInfoAsync(userId, emailId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an email notification channel for an on-call user + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @param body (required) + * @return ApiResponse<Email> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateUserEmailNotificationChannelWithHttpInfo( + String userId, String emailId, EmailUpdateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'userId' when calling" + + " updateUserEmailNotificationChannel"); + } + + // verify the required parameter 'emailId' is set + if (emailId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'emailId' when calling" + + " updateUserEmailNotificationChannel"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling updateUserEmailNotificationChannel"); + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())) + .replaceAll("\\{" + "email_id" + "\\}", apiClient.escapeString(emailId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallApi.updateUserEmailNotificationChannel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update an On-Call email for a user. + * + *

See {@link #updateUserEmailNotificationChannelWithHttpInfo}. + * + * @param userId The user ID (required) + * @param emailId The email ID (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Email>> + */ + public CompletableFuture> updateUserEmailNotificationChannelWithHttpInfoAsync( + String userId, String emailId, EmailUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'userId' is set + if (userId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'userId' when calling" + + " updateUserEmailNotificationChannel")); + return result; + } + + // verify the required parameter 'emailId' is set + if (emailId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'emailId' when calling" + + " updateUserEmailNotificationChannel")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " updateUserEmailNotificationChannel")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/users/{user_id}/notification-channels/emails/{email_id}" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())) + .replaceAll("\\{" + "email_id" + "\\}", apiClient.escapeString(emailId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallApi.updateUserEmailNotificationChannel", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/Email.java b/src/main/java/com/datadog/api/client/v2/model/Email.java new file mode 100644 index 00000000000..8bb6d99e3b9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Email.java @@ -0,0 +1,136 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** On-Call User Email. */ +@JsonPropertyOrder({Email.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class Email { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private EmailData data; + + public Email data(EmailData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for an on-call email resource. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EmailData getData() { + return data; + } + + public void setData(EmailData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return Email + */ + @JsonAnySetter + public Email putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this Email object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Email email = (Email) o; + return Objects.equals(this.data, email.data) + && Objects.equals(this.additionalProperties, email.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Email {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EmailAttributes.java b/src/main/java/com/datadog/api/client/v2/model/EmailAttributes.java new file mode 100644 index 00000000000..ad8c439b466 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EmailAttributes.java @@ -0,0 +1,229 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for an on-call email. */ +@JsonPropertyOrder({ + EmailAttributes.JSON_PROPERTY_ACTIVE, + EmailAttributes.JSON_PROPERTY_ADDRESS, + EmailAttributes.JSON_PROPERTY_ALIAS, + EmailAttributes.JSON_PROPERTY_FORMATS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EmailAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTIVE = "active"; + private Boolean active; + + public static final String JSON_PROPERTY_ADDRESS = "address"; + private String address; + + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_FORMATS = "formats"; + private List formats = null; + + public EmailAttributes active(Boolean active) { + this.active = active; + return this; + } + + /** + * Whether the email is currently active. + * + * @return active + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACTIVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public EmailAttributes address(String address) { + this.address = address; + return this; + } + + /** + * Email address. + * + * @return address + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public EmailAttributes alias(String alias) { + this.alias = alias; + return this; + } + + /** + * Optional display alias for the email. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public EmailAttributes formats(List formats) { + this.formats = formats; + return this; + } + + public EmailAttributes addFormatsItem(EmailFormatType formatsItem) { + if (this.formats == null) { + this.formats = new ArrayList<>(); + } + this.formats.add(formatsItem); + this.unparsed |= !formatsItem.isValid(); + return this; + } + + /** + * Preferred content formats for notifications. + * + * @return formats + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FORMATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFormats() { + return formats; + } + + public void setFormats(List formats) { + this.formats = formats; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return EmailAttributes + */ + @JsonAnySetter + public EmailAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this EmailAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailAttributes emailAttributes = (EmailAttributes) o; + return Objects.equals(this.active, emailAttributes.active) + && Objects.equals(this.address, emailAttributes.address) + && Objects.equals(this.alias, emailAttributes.alias) + && Objects.equals(this.formats, emailAttributes.formats) + && Objects.equals(this.additionalProperties, emailAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(active, address, alias, formats, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailAttributes {\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" formats: ").append(toIndentedString(formats)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EmailCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/EmailCreateRequest.java new file mode 100644 index 00000000000..1c3ed6d35d2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EmailCreateRequest.java @@ -0,0 +1,136 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request body for creating an On-Call email notification channel. */ +@JsonPropertyOrder({EmailCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EmailCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private EmailData data; + + public EmailCreateRequest data(EmailData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for an on-call email resource. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EmailData getData() { + return data; + } + + public void setData(EmailData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return EmailCreateRequest + */ + @JsonAnySetter + public EmailCreateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this EmailCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailCreateRequest emailCreateRequest = (EmailCreateRequest) o; + return Objects.equals(this.data, emailCreateRequest.data) + && Objects.equals(this.additionalProperties, emailCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailCreateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EmailData.java b/src/main/java/com/datadog/api/client/v2/model/EmailData.java new file mode 100644 index 00000000000..7871f2b3313 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EmailData.java @@ -0,0 +1,204 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for an on-call email resource. */ +@JsonPropertyOrder({ + EmailData.JSON_PROPERTY_ATTRIBUTES, + EmailData.JSON_PROPERTY_ID, + EmailData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EmailData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private EmailAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private EmailType type = EmailType.EMAILS; + + public EmailData() {} + + @JsonCreator + public EmailData(@JsonProperty(required = true, value = JSON_PROPERTY_TYPE) EmailType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public EmailData attributes(EmailAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for an on-call email. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EmailAttributes getAttributes() { + return attributes; + } + + public void setAttributes(EmailAttributes attributes) { + this.attributes = attributes; + } + + public EmailData id(String id) { + this.id = id; + return this; + } + + /** + * The email's unique identifier. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public EmailData type(EmailType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Indicates that the resource is of type 'emails'. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public EmailType getType() { + return type; + } + + public void setType(EmailType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return EmailData + */ + @JsonAnySetter + public EmailData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this EmailData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailData emailData = (EmailData) o; + return Objects.equals(this.attributes, emailData.attributes) + && Objects.equals(this.id, emailData.id) + && Objects.equals(this.type, emailData.type) + && Objects.equals(this.additionalProperties, emailData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EmailFormatType.java b/src/main/java/com/datadog/api/client/v2/model/EmailFormatType.java new file mode 100644 index 00000000000..ed4870ff431 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EmailFormatType.java @@ -0,0 +1,55 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Specifies the format of the e-mail that is sent for On-Call notifications */ +@JsonSerialize(using = EmailFormatType.EmailFormatTypeSerializer.class) +public class EmailFormatType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("html", "text")); + + public static final EmailFormatType HTML = new EmailFormatType("html"); + public static final EmailFormatType TEXT = new EmailFormatType("text"); + + EmailFormatType(String value) { + super(value, allowedValues); + } + + public static class EmailFormatTypeSerializer extends StdSerializer { + public EmailFormatTypeSerializer(Class t) { + super(t); + } + + public EmailFormatTypeSerializer() { + this(null); + } + + @Override + public void serialize(EmailFormatType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EmailFormatType fromValue(String value) { + return new EmailFormatType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EmailType.java b/src/main/java/com/datadog/api/client/v2/model/EmailType.java new file mode 100644 index 00000000000..e69fd1304b8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EmailType.java @@ -0,0 +1,53 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Indicates that the resource is of type 'emails'. */ +@JsonSerialize(using = EmailType.EmailTypeSerializer.class) +public class EmailType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("emails")); + + public static final EmailType EMAILS = new EmailType("emails"); + + EmailType(String value) { + super(value, allowedValues); + } + + public static class EmailTypeSerializer extends StdSerializer { + public EmailTypeSerializer(Class t) { + super(t); + } + + public EmailTypeSerializer() { + this(null); + } + + @Override + public void serialize(EmailType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EmailType fromValue(String value) { + return new EmailType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EmailUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/EmailUpdateRequest.java new file mode 100644 index 00000000000..92da1cd5ee8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EmailUpdateRequest.java @@ -0,0 +1,136 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request body for updating an On-Call email notification channel. */ +@JsonPropertyOrder({EmailUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EmailUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private EmailData data; + + public EmailUpdateRequest data(EmailData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for an on-call email resource. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EmailData getData() { + return data; + } + + public void setData(EmailData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return EmailUpdateRequest + */ + @JsonAnySetter + public EmailUpdateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this EmailUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailUpdateRequest emailUpdateRequest = (EmailUpdateRequest) o; + return Objects.equals(this.data, emailUpdateRequest.data) + && Objects.equals(this.additionalProperties, emailUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..a1160ff1846 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-12T14:36:01.432Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Bad_Request_response.json new file mode 100644 index 00000000000..292965e3446 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Bad_Request_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8c568369-eb6d-e912-3c0e-526a72812774" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"active\":true,\"address\":\"\",\"alias\":\"\",\"formats\":[\"html\"]},\"type\":\"emails\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/on-call/users/e94824bc-bfd4-11f0-adaa-1e9e4b86ba5b/notification-channels/emails", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"attribute \\\"address\\\" is required\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "abda9366-a1de-f08d-2295-c1d9c6fda1ea" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/e94824bc-bfd4-11f0-adaa-1e9e4b86ba5b", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7bfae60b-f24c-3034-92a5-0b0860f726df" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Created_response.freeze b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Created_response.freeze new file mode 100644 index 00000000000..f5631a00fcd --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Created_response.freeze @@ -0,0 +1 @@ +2025-11-12T14:50:04.706Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Created_response.json b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Created_response.json new file mode 100644 index 00000000000..c75750a52f2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Created_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Create_an_On_Call_email_for_a_user_returns_Created_response-1762959004@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2fffc841-e75c-f2c7-7366-fcfc1ad7daaa" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"active\":true,\"address\":\"john.doe@datadoghq.com\",\"alias\":\"\",\"formats\":[\"html\"]},\"type\":\"emails\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/on-call/users/dfeeb6f4-bfd6-11f0-8d44-3ae83a1823f8/notification-channels/emails", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4ecdb8e0-74d4-1196-8f98-d77d78e58a14" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/dfeeb6f4-bfd6-11f0-8d44-3ae83a1823f8", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "48b9047d-7779-3682-93bc-b80e3f0fd569" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..3844a6a285f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-12T14:52:55.277Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Not_Found_response.json new file mode 100644 index 00000000000..e36a5e11030 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_On_Call_email_for_a_user_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"active\":true,\"address\":\"john.doe@datadoghq.com\",\"alias\":\"\",\"formats\":[\"html\"]},\"type\":\"emails\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/on-call/users/00000000-0000-0000-0000-000000000000/notification-channels/emails", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"user[00000000-0000-0000-0000-000000000000] not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f6f6c71a-3454-cd0f-94fe-78f09fc07672" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_email_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_email_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..018fe803ed6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_email_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-12T15:37:07.209Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_email_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_email_returns_Not_Found_response.json new file mode 100644 index 00000000000..a2882d8995f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_email_returns_Not_Found_response.json @@ -0,0 +1,79 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "649013f1-2585-ad76-470a-2e65014b723b" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/on-call/users/72452250-bfdd-11f0-bb7a-1a91fccbd64f/notification-channels/emails/00000000-0000-0000-0000-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"Email not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5759f8ed-39e8-c8ef-4547-858a4267497e" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/72452250-bfdd-11f0-bb7a-1a91fccbd64f", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c3e66d6d-7f74-e054-14c7-e0a26e63caa2" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_user_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_user_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..75b80e5a8a1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_user_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-12T15:08:49.844Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_user_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_user_returns_Not_Found_response.json new file mode 100644 index 00000000000..12a083f8273 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_missing_user_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/on-call/users/00000000-0000-0000-0000-000000000000/notification-channels/emails/00000000-0000-0000-0000-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"user[00000000-0000-0000-0000-000000000000] not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "58bad44f-a839-6807-1f37-b2d08db05ab3" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_user_returns_No_Content_response.freeze b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_user_returns_No_Content_response.freeze new file mode 100644 index 00000000000..6eedcc6c6ee --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_user_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-11-11T21:34:54.765Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_user_returns_No_Content_response.json b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_user_returns_No_Content_response.json new file mode 100644 index 00000000000..e3791f45bc3 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_On_Call_email_for_a_user_returns_No_Content_response.json @@ -0,0 +1,104 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "bf3f1119-c260-d109-e155-d8a1c11ad6c0" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/on-call/users/43acb848-bf46-11f0-ab62-92ea5df1f825/notification-channels/emails", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c9968f2a-c989-4411-b58e-a9950a5417bf" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/on-call/users/43acb848-bf46-11f0-ab62-92ea5df1f825/notification-channels/emails/b9099fbc-43b3-4c74-9942-15ca0bcf519c", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "73534b24-46a9-7d94-5d1c-ad3d599233cc" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/43acb848-bf46-11f0-ab62-92ea5df1f825", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d240f2f5-d1b7-dd10-e905-9695bf6ff297" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_On_Call_email_for_a_user_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_an_On_Call_email_for_a_user_returns_OK_response.freeze new file mode 100644 index 00000000000..8d386f462f7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_On_Call_email_for_a_user_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-12T15:45:28.077Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_On_Call_email_for_a_user_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_an_On_Call_email_for_a_user_returns_OK_response.json new file mode 100644 index 00000000000..16fdbbe04c8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_On_Call_email_for_a_user_returns_OK_response.json @@ -0,0 +1,109 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Get_an_On_Call_email_for_a_user_returns_OK_response-1762962328@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d04e56f7-f307-10cc-68c8-a83914c21f7f" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/on-call/users/9cd4f6e1-bfde-11f0-a1ee-1630341c9b2e/notification-channels/emails", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "aea272f4-c9a3-6a4a-e3d2-cbf9aedb2d4e" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/on-call/users/9cd4f6e1-bfde-11f0-a1ee-1630341c9b2e/notification-channels/emails/0b0453b5-2f4c-49c3-94d9-c3db2d5ed69c", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5bdf5288-e5bd-c2cb-7ea4-6918d810358f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/9cd4f6e1-bfde-11f0-a1ee-1630341c9b2e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "aba7a386-48fe-1bb7-cdae-edcbfadc4bd1" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_On_Call_email_for_a_user_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_an_On_Call_email_for_a_user_returns_OK_response.freeze new file mode 100644 index 00000000000..8a0c69d011f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_On_Call_email_for_a_user_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-12T16:13:45.397Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_On_Call_email_for_a_user_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_an_On_Call_email_for_a_user_returns_OK_response.json new file mode 100644 index 00000000000..fccb1381f51 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_On_Call_email_for_a_user_returns_OK_response.json @@ -0,0 +1,113 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Update_an_On_Call_email_for_a_user_returns_OK_response-1762964025@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "713f4fb3-b44d-af29-c9ff-9825fe47f0b6" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/on-call/users/9079b462-bfe2-11f0-a49d-e64699b8fdba/notification-channels/emails", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c3f85277-0d90-90d8-dc5e-6fe34a4bddc7" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "PUT", + "path": "/api/v2/on-call/users/9079b462-bfe2-11f0-a49d-e64699b8fdba/notification-channels/emails/9a61f64e-3092-4654-ac91-5f0ffdaf96cb", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7f01f7fe-9c5c-f6cc-2ab1-6aae281294ab" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/9079b462-bfe2-11f0-a49d-e64699b8fdba", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6c79faf1-0e1a-ddef-ff28-274e9f7e8bea" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 4ee7b3a6f95..508e0bee160 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/on-call.feature b/src/test/resources/com/datadog/api/client/v2/api/on-call.feature index 39640938e4a..ea48ab4dc6e 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/on-call.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index cd8c18bf078..93dc5840b65 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {