diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f3ca46bc048..d2192b74841 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -54408,6 +54408,143 @@ components: $ref: '#/components/schemas/TeamLink' type: array type: object + TeamNotificationRule: + description: Team notification rule + properties: + attributes: + $ref: '#/components/schemas/TeamNotificationRuleAttributes' + id: + description: The identifier of the team notification rule + example: b8626d7e-cedd-11eb-abf5-da7ad0900001 + type: string + type: + $ref: '#/components/schemas/TeamNotificationRuleType' + required: + - attributes + - type + type: object + TeamNotificationRuleAttributes: + description: Team notification rule attributes + properties: + email: + $ref: '#/components/schemas/TeamNotificationRuleAttributesEmail' + ms_teams: + $ref: '#/components/schemas/TeamNotificationRuleAttributesMsTeams' + pagerduty: + $ref: '#/components/schemas/TeamNotificationRuleAttributesPagerduty' + slack: + $ref: '#/components/schemas/TeamNotificationRuleAttributesSlack' + type: object + TeamNotificationRuleAttributesEmail: + description: Email notification settings for the team + properties: + enabled: + description: Flag indicating email notification + type: boolean + type: object + TeamNotificationRuleAttributesMsTeams: + description: MS Teams notification settings for the team + properties: + connector_name: + description: Handle for MS Teams + type: string + type: object + TeamNotificationRuleAttributesPagerduty: + description: PagerDuty notification settings for the team + properties: + service_name: + description: Service name for PagerDuty + type: string + type: object + TeamNotificationRuleAttributesSlack: + description: Slack notification settings for the team + properties: + channel: + description: Channel for Slack notification + type: string + workspace: + description: Workspace for Slack notification + type: string + type: object + TeamNotificationRuleRequest: + description: Request to create or update a team notification rule + properties: + data: + $ref: '#/components/schemas/TeamNotificationRule' + required: + - data + type: object + TeamNotificationRuleResponse: + description: Team notification rule response + properties: + data: + $ref: '#/components/schemas/TeamNotificationRule' + type: object + TeamNotificationRuleType: + default: team_notification_rules + description: Team notification rule type + enum: + - team_notification_rules + example: team_notification_rules + type: string + x-enum-varnames: + - TEAM_NOTIFICATION_RULES + TeamNotificationRulesResponse: + description: Team notification rules response + properties: + data: + description: Team notification rules response data + items: + $ref: '#/components/schemas/TeamNotificationRule' + type: array + meta: + $ref: '#/components/schemas/TeamNotificationRulesResponseMeta' + type: object + TeamNotificationRulesResponseMeta: + description: Metadata that is included in the response when querying the team + notification rules + properties: + page: + $ref: '#/components/schemas/TeamNotificationRulesResponseMetaPage' + type: object + TeamNotificationRulesResponseMetaPage: + description: Metadata related to paging information that is included in the + response when querying the team notification rules + properties: + first_offset: + description: The first offset. + format: int64 + type: integer + last_offset: + description: The last offset. + format: int64 + type: integer + limit: + description: Pagination limit. + format: int64 + type: integer + next_offset: + description: The next offset. + format: int64 + nullable: true + type: integer + offset: + description: The offset. + format: int64 + type: integer + prev_offset: + description: The previous offset. + format: int64 + nullable: true + type: integer + total: + description: Total results. + format: int64 + type: integer + type: + description: Offset type. + type: string + type: object TeamOnCallResponders: description: Root object representing a team's on-call responder configuration. example: @@ -87408,6 +87545,230 @@ paths: operator: OR permissions: - teams_read + /api/v2/team/{team_id}/notification-rules: + get: + operationId: GetTeamNotificationRules + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRulesResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get team notification rules + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + post: + operationId: CreateTeamNotificationRule + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Create team notification rule + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + /api/v2/team/{team_id}/notification-rules/{rule_id}: + delete: + operationId: DeleteTeamNotificationRule + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + - description: None + in: path + name: rule_id + required: true + schema: + type: string + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Delete team notification rule + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + get: + operationId: GetTeamNotificationRule + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + - description: None + in: path + name: rule_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get team notification rule + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + put: + operationId: UpdateTeamNotificationRule + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + - description: None + in: path + name: rule_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Update team notification rule + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read /api/v2/team/{team_id}/permission-settings: get: description: Get all permission settings for a given team. diff --git a/examples/v2/teams/CreateTeamNotificationRule.java b/examples/v2/teams/CreateTeamNotificationRule.java new file mode 100644 index 00000000000..496578b6ab8 --- /dev/null +++ b/examples/v2/teams/CreateTeamNotificationRule.java @@ -0,0 +1,47 @@ +// Create team notification rule returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.model.TeamNotificationRule; +import com.datadog.api.client.v2.model.TeamNotificationRuleAttributes; +import com.datadog.api.client.v2.model.TeamNotificationRuleAttributesEmail; +import com.datadog.api.client.v2.model.TeamNotificationRuleAttributesSlack; +import com.datadog.api.client.v2.model.TeamNotificationRuleRequest; +import com.datadog.api.client.v2.model.TeamNotificationRuleResponse; +import com.datadog.api.client.v2.model.TeamNotificationRuleType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + TeamNotificationRuleRequest body = + new TeamNotificationRuleRequest() + .data( + new TeamNotificationRule() + .type(TeamNotificationRuleType.TEAM_NOTIFICATION_RULES) + .attributes( + new TeamNotificationRuleAttributes() + .email(new TeamNotificationRuleAttributesEmail().enabled(true)) + .slack( + new TeamNotificationRuleAttributesSlack() + .workspace("Datadog") + .channel("aaa-omg-ops")))); + + try { + TeamNotificationRuleResponse result = + apiInstance.createTeamNotificationRule(DD_TEAM_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#createTeamNotificationRule"); + 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/teams/DeleteTeamNotificationRule.java b/examples/v2/teams/DeleteTeamNotificationRule.java new file mode 100644 index 00000000000..6db962c802e --- /dev/null +++ b/examples/v2/teams/DeleteTeamNotificationRule.java @@ -0,0 +1,28 @@ +// Delete team notification rule returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + // there is a valid "team_notification_rule" in the system + String TEAM_NOTIFICATION_RULE_DATA_ID = System.getenv("TEAM_NOTIFICATION_RULE_DATA_ID"); + + try { + apiInstance.deleteTeamNotificationRule(DD_TEAM_DATA_ID, TEAM_NOTIFICATION_RULE_DATA_ID); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#deleteTeamNotificationRule"); + 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/teams/GetTeamNotificationRule.java b/examples/v2/teams/GetTeamNotificationRule.java new file mode 100644 index 00000000000..e4bf03bd813 --- /dev/null +++ b/examples/v2/teams/GetTeamNotificationRule.java @@ -0,0 +1,31 @@ +// Get team notification rule returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.model.TeamNotificationRuleResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + // there is a valid "team_notification_rule" in the system + String TEAM_NOTIFICATION_RULE_DATA_ID = System.getenv("TEAM_NOTIFICATION_RULE_DATA_ID"); + + try { + TeamNotificationRuleResponse result = + apiInstance.getTeamNotificationRule(DD_TEAM_DATA_ID, TEAM_NOTIFICATION_RULE_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamNotificationRule"); + 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/teams/GetTeamNotificationRules.java b/examples/v2/teams/GetTeamNotificationRules.java new file mode 100644 index 00000000000..b59cb5a9a39 --- /dev/null +++ b/examples/v2/teams/GetTeamNotificationRules.java @@ -0,0 +1,27 @@ +// Get team notification rules returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.model.TeamNotificationRulesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamNotificationRulesResponse result = apiInstance.getTeamNotificationRules(DD_TEAM_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamNotificationRules"); + 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/teams/UpdateTeamNotificationRule.java b/examples/v2/teams/UpdateTeamNotificationRule.java new file mode 100644 index 00000000000..7e5085db49e --- /dev/null +++ b/examples/v2/teams/UpdateTeamNotificationRule.java @@ -0,0 +1,54 @@ +// Update team notification rule returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.model.TeamNotificationRule; +import com.datadog.api.client.v2.model.TeamNotificationRuleAttributes; +import com.datadog.api.client.v2.model.TeamNotificationRuleAttributesPagerduty; +import com.datadog.api.client.v2.model.TeamNotificationRuleAttributesSlack; +import com.datadog.api.client.v2.model.TeamNotificationRuleRequest; +import com.datadog.api.client.v2.model.TeamNotificationRuleResponse; +import com.datadog.api.client.v2.model.TeamNotificationRuleType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + // there is a valid "team_notification_rule" in the system + String TEAM_NOTIFICATION_RULE_DATA_ID = System.getenv("TEAM_NOTIFICATION_RULE_DATA_ID"); + + TeamNotificationRuleRequest body = + new TeamNotificationRuleRequest() + .data( + new TeamNotificationRule() + .type(TeamNotificationRuleType.TEAM_NOTIFICATION_RULES) + .id(TEAM_NOTIFICATION_RULE_DATA_ID) + .attributes( + new TeamNotificationRuleAttributes() + .pagerduty( + new TeamNotificationRuleAttributesPagerduty() + .serviceName("Datadog-prod")) + .slack( + new TeamNotificationRuleAttributesSlack() + .workspace("Datadog") + .channel("aaa-governance-ops")))); + + try { + TeamNotificationRuleResponse result = + apiInstance.updateTeamNotificationRule( + DD_TEAM_DATA_ID, TEAM_NOTIFICATION_RULE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#updateTeamNotificationRule"); + 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/TeamsApi.java b/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java index 5c13c64019c..0cd8e0b3f05 100644 --- a/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java @@ -22,6 +22,9 @@ import com.datadog.api.client.v2.model.TeamLinkCreateRequest; import com.datadog.api.client.v2.model.TeamLinkResponse; import com.datadog.api.client.v2.model.TeamLinksResponse; +import com.datadog.api.client.v2.model.TeamNotificationRuleRequest; +import com.datadog.api.client.v2.model.TeamNotificationRuleResponse; +import com.datadog.api.client.v2.model.TeamNotificationRulesResponse; import com.datadog.api.client.v2.model.TeamPermissionSettingResponse; import com.datadog.api.client.v2.model.TeamPermissionSettingUpdateRequest; import com.datadog.api.client.v2.model.TeamPermissionSettingsResponse; @@ -979,6 +982,166 @@ public CompletableFuture> createTeamMembershipWith new GenericType() {}); } + /** + * Create team notification rule. + * + *

See {@link #createTeamNotificationRuleWithHttpInfo}. + * + * @param teamId None (required) + * @param body (required) + * @return TeamNotificationRuleResponse + * @throws ApiException if fails to make API call + */ + public TeamNotificationRuleResponse createTeamNotificationRule( + String teamId, TeamNotificationRuleRequest body) throws ApiException { + return createTeamNotificationRuleWithHttpInfo(teamId, body).getData(); + } + + /** + * Create team notification rule. + * + *

See {@link #createTeamNotificationRuleWithHttpInfoAsync}. + * + * @param teamId None (required) + * @param body (required) + * @return CompletableFuture<TeamNotificationRuleResponse> + */ + public CompletableFuture createTeamNotificationRuleAsync( + String teamId, TeamNotificationRuleRequest body) { + return createTeamNotificationRuleWithHttpInfoAsync(teamId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @param teamId None (required) + * @param body (required) + * @return ApiResponse<TeamNotificationRuleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 OK -
403 Forbidden -
404 API error response. -
409 API error response. -
429 Too many requests -
+ */ + public ApiResponse createTeamNotificationRuleWithHttpInfo( + String teamId, TeamNotificationRuleRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'teamId' when calling createTeamNotificationRule"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createTeamNotificationRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/notification-rules" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.createTeamNotificationRule", + 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 team notification rule. + * + *

See {@link #createTeamNotificationRuleWithHttpInfo}. + * + * @param teamId None (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<TeamNotificationRuleResponse>> + */ + public CompletableFuture> + createTeamNotificationRuleWithHttpInfoAsync(String teamId, TeamNotificationRuleRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'teamId' when calling createTeamNotificationRule")); + 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 createTeamNotificationRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/notification-rules" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.createTeamNotificationRule", + 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() {}); + } + /** * Remove a team. * @@ -1557,6 +1720,161 @@ public CompletableFuture> deleteTeamMembershipWithHttpInfoAsyn null); } + /** + * Delete team notification rule. + * + *

See {@link #deleteTeamNotificationRuleWithHttpInfo}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @throws ApiException if fails to make API call + */ + public void deleteTeamNotificationRule(String teamId, String ruleId) throws ApiException { + deleteTeamNotificationRuleWithHttpInfo(teamId, ruleId); + } + + /** + * Delete team notification rule. + * + *

See {@link #deleteTeamNotificationRuleWithHttpInfoAsync}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @return CompletableFuture + */ + public CompletableFuture deleteTeamNotificationRuleAsync(String teamId, String ruleId) { + return deleteTeamNotificationRuleWithHttpInfoAsync(teamId, ruleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @param teamId None (required) + * @param ruleId None (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 -
403 Forbidden -
404 API error response. -
429 Too many requests -
+ */ + public ApiResponse deleteTeamNotificationRuleWithHttpInfo(String teamId, String ruleId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'teamId' when calling deleteTeamNotificationRule"); + } + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleId' when calling deleteTeamNotificationRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/notification-rules/{rule_id}" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())) + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.deleteTeamNotificationRule", + 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 team notification rule. + * + *

See {@link #deleteTeamNotificationRuleWithHttpInfo}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteTeamNotificationRuleWithHttpInfoAsync( + String teamId, String ruleId) { + Object localVarPostBody = null; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'teamId' when calling deleteTeamNotificationRule")); + return result; + } + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ruleId' when calling deleteTeamNotificationRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/notification-rules/{rule_id}" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())) + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.deleteTeamNotificationRule", + 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); + } + /** * Get a team. * @@ -2231,109 +2549,413 @@ public CompletableFuture getTeamMembershipsAsync( } /** - * Get team memberships. + * Get team memberships. + * + *

See {@link #getTeamMembershipsWithHttpInfo}. + * + * @param teamId None (required) + * @return PaginationIterable<UserTeam> + */ + public PaginationIterable getTeamMembershipsWithPagination(String teamId) { + GetTeamMembershipsOptionalParameters parameters = new GetTeamMembershipsOptionalParameters(); + return getTeamMembershipsWithPagination(teamId, parameters); + } + + /** + * Get team memberships. + * + *

See {@link #getTeamMembershipsWithHttpInfo}. + * + * @param teamId None (required) + * @return UserTeamsResponse + */ + public PaginationIterable getTeamMembershipsWithPagination( + String teamId, GetTeamMembershipsOptionalParameters parameters) { + String resultsPath = "getData"; + String valueGetterPath = ""; + String valueSetterPath = "pageNumber"; + Boolean valueSetterParamOptional = true; + parameters.pageNumber(0l); + Long limit; + + if (parameters.pageSize == null) { + limit = 10l; + parameters.pageSize(limit); + } else { + limit = parameters.pageSize; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("teamId", teamId); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "getTeamMemberships", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + false, + limit, + args); + + return iterator; + } + + /** + * Get a paginated list of members for a team + * + * @param teamId None (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<UserTeamsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Represents a user's association to a team -
403 Forbidden -
404 API error response. -
429 Too many requests -
+ */ + public ApiResponse getTeamMembershipsWithHttpInfo( + String teamId, GetTeamMembershipsOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'teamId' when calling getTeamMemberships"); + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + GetTeamMembershipsSort sort = parameters.sort; + String filterKeyword = parameters.filterKeyword; + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/memberships" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[keyword]", filterKeyword)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.getTeamMemberships", + localVarPath, + localVarQueryParams, + 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 team memberships. + * + *

See {@link #getTeamMembershipsWithHttpInfo}. + * + * @param teamId None (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<UserTeamsResponse>> + */ + public CompletableFuture> getTeamMembershipsWithHttpInfoAsync( + String teamId, GetTeamMembershipsOptionalParameters parameters) { + Object localVarPostBody = null; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'teamId' when calling getTeamMemberships")); + return result; + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + GetTeamMembershipsSort sort = parameters.sort; + String filterKeyword = parameters.filterKeyword; + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/memberships" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[keyword]", filterKeyword)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.getTeamMemberships", + localVarPath, + localVarQueryParams, + 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() {}); + } + + /** + * Get team notification rule. + * + *

See {@link #getTeamNotificationRuleWithHttpInfo}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @return TeamNotificationRuleResponse + * @throws ApiException if fails to make API call + */ + public TeamNotificationRuleResponse getTeamNotificationRule(String teamId, String ruleId) + throws ApiException { + return getTeamNotificationRuleWithHttpInfo(teamId, ruleId).getData(); + } + + /** + * Get team notification rule. + * + *

See {@link #getTeamNotificationRuleWithHttpInfoAsync}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @return CompletableFuture<TeamNotificationRuleResponse> + */ + public CompletableFuture getTeamNotificationRuleAsync( + String teamId, String ruleId) { + return getTeamNotificationRuleWithHttpInfoAsync(teamId, ruleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @param teamId None (required) + * @param ruleId None (required) + * @return ApiResponse<TeamNotificationRuleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 API error response. -
429 Too many requests -
+ */ + public ApiResponse getTeamNotificationRuleWithHttpInfo( + String teamId, String ruleId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'teamId' when calling getTeamNotificationRule"); + } + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleId' when calling getTeamNotificationRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/notification-rules/{rule_id}" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())) + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.getTeamNotificationRule", + 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 team notification rule. + * + *

See {@link #getTeamNotificationRuleWithHttpInfo}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @return CompletableFuture<ApiResponse<TeamNotificationRuleResponse>> + */ + public CompletableFuture> + getTeamNotificationRuleWithHttpInfoAsync(String teamId, String ruleId) { + Object localVarPostBody = null; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'teamId' when calling getTeamNotificationRule")); + return result; + } + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'ruleId' when calling getTeamNotificationRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/notification-rules/{rule_id}" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())) + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.getTeamNotificationRule", + 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() {}); + } + + /** + * Get team notification rules. * - *

See {@link #getTeamMembershipsWithHttpInfo}. + *

See {@link #getTeamNotificationRulesWithHttpInfo}. * * @param teamId None (required) - * @return PaginationIterable<UserTeam> + * @return TeamNotificationRulesResponse + * @throws ApiException if fails to make API call */ - public PaginationIterable getTeamMembershipsWithPagination(String teamId) { - GetTeamMembershipsOptionalParameters parameters = new GetTeamMembershipsOptionalParameters(); - return getTeamMembershipsWithPagination(teamId, parameters); + public TeamNotificationRulesResponse getTeamNotificationRules(String teamId) throws ApiException { + return getTeamNotificationRulesWithHttpInfo(teamId).getData(); } /** - * Get team memberships. + * Get team notification rules. * - *

See {@link #getTeamMembershipsWithHttpInfo}. + *

See {@link #getTeamNotificationRulesWithHttpInfoAsync}. * * @param teamId None (required) - * @return UserTeamsResponse + * @return CompletableFuture<TeamNotificationRulesResponse> */ - public PaginationIterable getTeamMembershipsWithPagination( - String teamId, GetTeamMembershipsOptionalParameters parameters) { - String resultsPath = "getData"; - String valueGetterPath = ""; - String valueSetterPath = "pageNumber"; - Boolean valueSetterParamOptional = true; - parameters.pageNumber(0l); - Long limit; - - if (parameters.pageSize == null) { - limit = 10l; - parameters.pageSize(limit); - } else { - limit = parameters.pageSize; - } - - LinkedHashMap args = new LinkedHashMap(); - args.put("teamId", teamId); - args.put("optionalParams", parameters); - - PaginationIterable iterator = - new PaginationIterable( - this, - "getTeamMemberships", - resultsPath, - valueGetterPath, - valueSetterPath, - valueSetterParamOptional, - false, - limit, - args); - - return iterator; + public CompletableFuture getTeamNotificationRulesAsync( + String teamId) { + return getTeamNotificationRulesWithHttpInfoAsync(teamId) + .thenApply( + response -> { + return response.getData(); + }); } /** - * Get a paginated list of members for a team - * * @param teamId None (required) - * @param parameters Optional parameters for the request. - * @return ApiResponse<UserTeamsResponse> + * @return ApiResponse<TeamNotificationRulesResponse> * @throws ApiException if fails to make API call * @http.response.details * * * - * + * * * * *
Response details
Status Code Description Response Headers
200 Represents a user's association to a team -
200 OK -
403 Forbidden -
404 API error response. -
429 Too many requests -
*/ - public ApiResponse getTeamMembershipsWithHttpInfo( - String teamId, GetTeamMembershipsOptionalParameters parameters) throws ApiException { + public ApiResponse getTeamNotificationRulesWithHttpInfo( + String teamId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'teamId' is set if (teamId == null) { throw new ApiException( - 400, "Missing the required parameter 'teamId' when calling getTeamMemberships"); + 400, "Missing the required parameter 'teamId' when calling getTeamNotificationRules"); } - Long pageSize = parameters.pageSize; - Long pageNumber = parameters.pageNumber; - GetTeamMembershipsSort sort = parameters.sort; - String filterKeyword = parameters.filterKeyword; // create path and map variables String localVarPath = - "/api/v2/team/{team_id}/memberships" + "/api/v2/team/{team_id}/notification-rules" .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); - List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[keyword]", filterKeyword)); - Invocation.Builder builder = apiClient.createBuilder( - "v2.TeamsApi.getTeamMemberships", + "v2.TeamsApi.getTeamNotificationRules", localVarPath, - localVarQueryParams, + new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -2346,60 +2968,52 @@ public ApiResponse getTeamMembershipsWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get team memberships. + * Get team notification rules. * - *

See {@link #getTeamMembershipsWithHttpInfo}. + *

See {@link #getTeamNotificationRulesWithHttpInfo}. * * @param teamId None (required) - * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<UserTeamsResponse>> + * @return CompletableFuture<ApiResponse<TeamNotificationRulesResponse>> */ - public CompletableFuture> getTeamMembershipsWithHttpInfoAsync( - String teamId, GetTeamMembershipsOptionalParameters parameters) { + public CompletableFuture> + getTeamNotificationRulesWithHttpInfoAsync(String teamId) { Object localVarPostBody = null; // verify the required parameter 'teamId' is set if (teamId == null) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, "Missing the required parameter 'teamId' when calling getTeamMemberships")); + 400, + "Missing the required parameter 'teamId' when calling getTeamNotificationRules")); return result; } - Long pageSize = parameters.pageSize; - Long pageNumber = parameters.pageNumber; - GetTeamMembershipsSort sort = parameters.sort; - String filterKeyword = parameters.filterKeyword; // create path and map variables String localVarPath = - "/api/v2/team/{team_id}/memberships" + "/api/v2/team/{team_id}/notification-rules" .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); - List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[keyword]", filterKeyword)); - Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.TeamsApi.getTeamMemberships", + "v2.TeamsApi.getTeamNotificationRules", localVarPath, - localVarQueryParams, + new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -2411,7 +3025,7 @@ public CompletableFuture> getTeamMembershipsWithH localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -5029,6 +5643,189 @@ public CompletableFuture> updateTeamMembershipWith new GenericType() {}); } + /** + * Update team notification rule. + * + *

See {@link #updateTeamNotificationRuleWithHttpInfo}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @param body (required) + * @return TeamNotificationRuleResponse + * @throws ApiException if fails to make API call + */ + public TeamNotificationRuleResponse updateTeamNotificationRule( + String teamId, String ruleId, TeamNotificationRuleRequest body) throws ApiException { + return updateTeamNotificationRuleWithHttpInfo(teamId, ruleId, body).getData(); + } + + /** + * Update team notification rule. + * + *

See {@link #updateTeamNotificationRuleWithHttpInfoAsync}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @param body (required) + * @return CompletableFuture<TeamNotificationRuleResponse> + */ + public CompletableFuture updateTeamNotificationRuleAsync( + String teamId, String ruleId, TeamNotificationRuleRequest body) { + return updateTeamNotificationRuleWithHttpInfoAsync(teamId, ruleId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * @param teamId None (required) + * @param ruleId None (required) + * @param body (required) + * @return ApiResponse<TeamNotificationRuleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 API error response. -
429 Too many requests -
+ */ + public ApiResponse updateTeamNotificationRuleWithHttpInfo( + String teamId, String ruleId, TeamNotificationRuleRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'teamId' when calling updateTeamNotificationRule"); + } + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleId' when calling updateTeamNotificationRule"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateTeamNotificationRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/notification-rules/{rule_id}" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())) + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.updateTeamNotificationRule", + 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 team notification rule. + * + *

See {@link #updateTeamNotificationRuleWithHttpInfo}. + * + * @param teamId None (required) + * @param ruleId None (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<TeamNotificationRuleResponse>> + */ + public CompletableFuture> + updateTeamNotificationRuleWithHttpInfoAsync( + String teamId, String ruleId, TeamNotificationRuleRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'teamId' is set + if (teamId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'teamId' when calling updateTeamNotificationRule")); + return result; + } + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ruleId' when calling updateTeamNotificationRule")); + 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 updateTeamNotificationRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/notification-rules/{rule_id}" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())) + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.updateTeamNotificationRule", + 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() {}); + } + /** * Update permission setting for team. * diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRule.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRule.java new file mode 100644 index 00000000000..671716bffbb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRule.java @@ -0,0 +1,208 @@ +/* + * 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; + +/** Team notification rule */ +@JsonPropertyOrder({ + TeamNotificationRule.JSON_PROPERTY_ATTRIBUTES, + TeamNotificationRule.JSON_PROPERTY_ID, + TeamNotificationRule.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TeamNotificationRuleAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamNotificationRuleType type = TeamNotificationRuleType.TEAM_NOTIFICATION_RULES; + + public TeamNotificationRule() {} + + @JsonCreator + public TeamNotificationRule( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TeamNotificationRuleAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamNotificationRuleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamNotificationRule attributes(TeamNotificationRuleAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Team notification rule attributes + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamNotificationRuleAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TeamNotificationRuleAttributes attributes) { + this.attributes = attributes; + } + + public TeamNotificationRule id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the team notification rule + * + * @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 TeamNotificationRule type(TeamNotificationRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Team notification rule type + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamNotificationRuleType getType() { + return type; + } + + public void setType(TeamNotificationRuleType 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 TeamNotificationRule + */ + @JsonAnySetter + public TeamNotificationRule 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 TeamNotificationRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRule teamNotificationRule = (TeamNotificationRule) o; + return Objects.equals(this.attributes, teamNotificationRule.attributes) + && Objects.equals(this.id, teamNotificationRule.id) + && Objects.equals(this.type, teamNotificationRule.type) + && Objects.equals(this.additionalProperties, teamNotificationRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRule {\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/TeamNotificationRuleAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributes.java new file mode 100644 index 00000000000..ca69a707b4c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributes.java @@ -0,0 +1,225 @@ +/* + * 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; + +/** Team notification rule attributes */ +@JsonPropertyOrder({ + TeamNotificationRuleAttributes.JSON_PROPERTY_EMAIL, + TeamNotificationRuleAttributes.JSON_PROPERTY_MS_TEAMS, + TeamNotificationRuleAttributes.JSON_PROPERTY_PAGERDUTY, + TeamNotificationRuleAttributes.JSON_PROPERTY_SLACK +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRuleAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EMAIL = "email"; + private TeamNotificationRuleAttributesEmail email; + + public static final String JSON_PROPERTY_MS_TEAMS = "ms_teams"; + private TeamNotificationRuleAttributesMsTeams msTeams; + + public static final String JSON_PROPERTY_PAGERDUTY = "pagerduty"; + private TeamNotificationRuleAttributesPagerduty pagerduty; + + public static final String JSON_PROPERTY_SLACK = "slack"; + private TeamNotificationRuleAttributesSlack slack; + + public TeamNotificationRuleAttributes email(TeamNotificationRuleAttributesEmail email) { + this.email = email; + this.unparsed |= email.unparsed; + return this; + } + + /** + * Email notification settings for the team + * + * @return email + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamNotificationRuleAttributesEmail getEmail() { + return email; + } + + public void setEmail(TeamNotificationRuleAttributesEmail email) { + this.email = email; + } + + public TeamNotificationRuleAttributes msTeams(TeamNotificationRuleAttributesMsTeams msTeams) { + this.msTeams = msTeams; + this.unparsed |= msTeams.unparsed; + return this; + } + + /** + * MS Teams notification settings for the team + * + * @return msTeams + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MS_TEAMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamNotificationRuleAttributesMsTeams getMsTeams() { + return msTeams; + } + + public void setMsTeams(TeamNotificationRuleAttributesMsTeams msTeams) { + this.msTeams = msTeams; + } + + public TeamNotificationRuleAttributes pagerduty( + TeamNotificationRuleAttributesPagerduty pagerduty) { + this.pagerduty = pagerduty; + this.unparsed |= pagerduty.unparsed; + return this; + } + + /** + * PagerDuty notification settings for the team + * + * @return pagerduty + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGERDUTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamNotificationRuleAttributesPagerduty getPagerduty() { + return pagerduty; + } + + public void setPagerduty(TeamNotificationRuleAttributesPagerduty pagerduty) { + this.pagerduty = pagerduty; + } + + public TeamNotificationRuleAttributes slack(TeamNotificationRuleAttributesSlack slack) { + this.slack = slack; + this.unparsed |= slack.unparsed; + return this; + } + + /** + * Slack notification settings for the team + * + * @return slack + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SLACK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamNotificationRuleAttributesSlack getSlack() { + return slack; + } + + public void setSlack(TeamNotificationRuleAttributesSlack slack) { + this.slack = slack; + } + + /** + * 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 TeamNotificationRuleAttributes + */ + @JsonAnySetter + public TeamNotificationRuleAttributes 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 TeamNotificationRuleAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRuleAttributes teamNotificationRuleAttributes = + (TeamNotificationRuleAttributes) o; + return Objects.equals(this.email, teamNotificationRuleAttributes.email) + && Objects.equals(this.msTeams, teamNotificationRuleAttributes.msTeams) + && Objects.equals(this.pagerduty, teamNotificationRuleAttributes.pagerduty) + && Objects.equals(this.slack, teamNotificationRuleAttributes.slack) + && Objects.equals( + this.additionalProperties, teamNotificationRuleAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(email, msTeams, pagerduty, slack, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRuleAttributes {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" msTeams: ").append(toIndentedString(msTeams)).append("\n"); + sb.append(" pagerduty: ").append(toIndentedString(pagerduty)).append("\n"); + sb.append(" slack: ").append(toIndentedString(slack)).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/TeamNotificationRuleAttributesEmail.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributesEmail.java new file mode 100644 index 00000000000..85490e47749 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributesEmail.java @@ -0,0 +1,137 @@ +/* + * 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; + +/** Email notification settings for the team */ +@JsonPropertyOrder({TeamNotificationRuleAttributesEmail.JSON_PROPERTY_ENABLED}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRuleAttributesEmail { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public TeamNotificationRuleAttributesEmail enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Flag indicating email notification + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /** + * 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 TeamNotificationRuleAttributesEmail + */ + @JsonAnySetter + public TeamNotificationRuleAttributesEmail 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 TeamNotificationRuleAttributesEmail object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRuleAttributesEmail teamNotificationRuleAttributesEmail = + (TeamNotificationRuleAttributesEmail) o; + return Objects.equals(this.enabled, teamNotificationRuleAttributesEmail.enabled) + && Objects.equals( + this.additionalProperties, teamNotificationRuleAttributesEmail.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRuleAttributesEmail {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).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/TeamNotificationRuleAttributesMsTeams.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributesMsTeams.java new file mode 100644 index 00000000000..cec86feff49 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributesMsTeams.java @@ -0,0 +1,137 @@ +/* + * 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; + +/** MS Teams notification settings for the team */ +@JsonPropertyOrder({TeamNotificationRuleAttributesMsTeams.JSON_PROPERTY_CONNECTOR_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRuleAttributesMsTeams { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONNECTOR_NAME = "connector_name"; + private String connectorName; + + public TeamNotificationRuleAttributesMsTeams connectorName(String connectorName) { + this.connectorName = connectorName; + return this; + } + + /** + * Handle for MS Teams + * + * @return connectorName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONNECTOR_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getConnectorName() { + return connectorName; + } + + public void setConnectorName(String connectorName) { + this.connectorName = connectorName; + } + + /** + * 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 TeamNotificationRuleAttributesMsTeams + */ + @JsonAnySetter + public TeamNotificationRuleAttributesMsTeams 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 TeamNotificationRuleAttributesMsTeams object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRuleAttributesMsTeams teamNotificationRuleAttributesMsTeams = + (TeamNotificationRuleAttributesMsTeams) o; + return Objects.equals(this.connectorName, teamNotificationRuleAttributesMsTeams.connectorName) + && Objects.equals( + this.additionalProperties, teamNotificationRuleAttributesMsTeams.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(connectorName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRuleAttributesMsTeams {\n"); + sb.append(" connectorName: ").append(toIndentedString(connectorName)).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/TeamNotificationRuleAttributesPagerduty.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributesPagerduty.java new file mode 100644 index 00000000000..dffc98d32d1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributesPagerduty.java @@ -0,0 +1,138 @@ +/* + * 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; + +/** PagerDuty notification settings for the team */ +@JsonPropertyOrder({TeamNotificationRuleAttributesPagerduty.JSON_PROPERTY_SERVICE_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRuleAttributesPagerduty { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_SERVICE_NAME = "service_name"; + private String serviceName; + + public TeamNotificationRuleAttributesPagerduty serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Service name for PagerDuty + * + * @return serviceName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVICE_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + /** + * 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 TeamNotificationRuleAttributesPagerduty + */ + @JsonAnySetter + public TeamNotificationRuleAttributesPagerduty 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 TeamNotificationRuleAttributesPagerduty object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRuleAttributesPagerduty teamNotificationRuleAttributesPagerduty = + (TeamNotificationRuleAttributesPagerduty) o; + return Objects.equals(this.serviceName, teamNotificationRuleAttributesPagerduty.serviceName) + && Objects.equals( + this.additionalProperties, + teamNotificationRuleAttributesPagerduty.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(serviceName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRuleAttributesPagerduty {\n"); + sb.append(" serviceName: ").append(toIndentedString(serviceName)).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/TeamNotificationRuleAttributesSlack.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributesSlack.java new file mode 100644 index 00000000000..4b9670baa0c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleAttributesSlack.java @@ -0,0 +1,166 @@ +/* + * 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; + +/** Slack notification settings for the team */ +@JsonPropertyOrder({ + TeamNotificationRuleAttributesSlack.JSON_PROPERTY_CHANNEL, + TeamNotificationRuleAttributesSlack.JSON_PROPERTY_WORKSPACE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRuleAttributesSlack { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHANNEL = "channel"; + private String channel; + + public static final String JSON_PROPERTY_WORKSPACE = "workspace"; + private String workspace; + + public TeamNotificationRuleAttributesSlack channel(String channel) { + this.channel = channel; + return this; + } + + /** + * Channel for Slack notification + * + * @return channel + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHANNEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getChannel() { + return channel; + } + + public void setChannel(String channel) { + this.channel = channel; + } + + public TeamNotificationRuleAttributesSlack workspace(String workspace) { + this.workspace = workspace; + return this; + } + + /** + * Workspace for Slack notification + * + * @return workspace + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_WORKSPACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getWorkspace() { + return workspace; + } + + public void setWorkspace(String workspace) { + this.workspace = workspace; + } + + /** + * 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 TeamNotificationRuleAttributesSlack + */ + @JsonAnySetter + public TeamNotificationRuleAttributesSlack 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 TeamNotificationRuleAttributesSlack object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRuleAttributesSlack teamNotificationRuleAttributesSlack = + (TeamNotificationRuleAttributesSlack) o; + return Objects.equals(this.channel, teamNotificationRuleAttributesSlack.channel) + && Objects.equals(this.workspace, teamNotificationRuleAttributesSlack.workspace) + && Objects.equals( + this.additionalProperties, teamNotificationRuleAttributesSlack.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(channel, workspace, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRuleAttributesSlack {\n"); + sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" workspace: ").append(toIndentedString(workspace)).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/TeamNotificationRuleRequest.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleRequest.java new file mode 100644 index 00000000000..cc11e07bc56 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleRequest.java @@ -0,0 +1,146 @@ +/* + * 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; + +/** Request to create or update a team notification rule */ +@JsonPropertyOrder({TeamNotificationRuleRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRuleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TeamNotificationRule data; + + public TeamNotificationRuleRequest() {} + + @JsonCreator + public TeamNotificationRuleRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TeamNotificationRule data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TeamNotificationRuleRequest data(TeamNotificationRule data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Team notification rule + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamNotificationRule getData() { + return data; + } + + public void setData(TeamNotificationRule 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 TeamNotificationRuleRequest + */ + @JsonAnySetter + public TeamNotificationRuleRequest 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 TeamNotificationRuleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRuleRequest teamNotificationRuleRequest = (TeamNotificationRuleRequest) o; + return Objects.equals(this.data, teamNotificationRuleRequest.data) + && Objects.equals( + this.additionalProperties, teamNotificationRuleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRuleRequest {\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/TeamNotificationRuleResponse.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleResponse.java new file mode 100644 index 00000000000..97114f0a4dc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleResponse.java @@ -0,0 +1,137 @@ +/* + * 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; + +/** Team notification rule response */ +@JsonPropertyOrder({TeamNotificationRuleResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRuleResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TeamNotificationRule data; + + public TeamNotificationRuleResponse data(TeamNotificationRule data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Team notification rule + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamNotificationRule getData() { + return data; + } + + public void setData(TeamNotificationRule 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 TeamNotificationRuleResponse + */ + @JsonAnySetter + public TeamNotificationRuleResponse 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 TeamNotificationRuleResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRuleResponse teamNotificationRuleResponse = (TeamNotificationRuleResponse) o; + return Objects.equals(this.data, teamNotificationRuleResponse.data) + && Objects.equals( + this.additionalProperties, teamNotificationRuleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRuleResponse {\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/TeamNotificationRuleType.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleType.java new file mode 100644 index 00000000000..1585a6e74ab --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRuleType.java @@ -0,0 +1,57 @@ +/* + * 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; + +/** Team notification rule type */ +@JsonSerialize(using = TeamNotificationRuleType.TeamNotificationRuleTypeSerializer.class) +public class TeamNotificationRuleType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("team_notification_rules")); + + public static final TeamNotificationRuleType TEAM_NOTIFICATION_RULES = + new TeamNotificationRuleType("team_notification_rules"); + + TeamNotificationRuleType(String value) { + super(value, allowedValues); + } + + public static class TeamNotificationRuleTypeSerializer + extends StdSerializer { + public TeamNotificationRuleTypeSerializer(Class t) { + super(t); + } + + public TeamNotificationRuleTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TeamNotificationRuleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamNotificationRuleType fromValue(String value) { + return new TeamNotificationRuleType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRulesResponse.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRulesResponse.java new file mode 100644 index 00000000000..34a88e12e43 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRulesResponse.java @@ -0,0 +1,180 @@ +/* + * 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; + +/** Team notification rules response */ +@JsonPropertyOrder({ + TeamNotificationRulesResponse.JSON_PROPERTY_DATA, + TeamNotificationRulesResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRulesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_META = "meta"; + private TeamNotificationRulesResponseMeta meta; + + public TeamNotificationRulesResponse data(List data) { + this.data = data; + for (TeamNotificationRule item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamNotificationRulesResponse addDataItem(TeamNotificationRule dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Team notification rules response data + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public TeamNotificationRulesResponse meta(TeamNotificationRulesResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Metadata that is included in the response when querying the team notification rules + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamNotificationRulesResponseMeta getMeta() { + return meta; + } + + public void setMeta(TeamNotificationRulesResponseMeta meta) { + this.meta = meta; + } + + /** + * 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 TeamNotificationRulesResponse + */ + @JsonAnySetter + public TeamNotificationRulesResponse 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 TeamNotificationRulesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRulesResponse teamNotificationRulesResponse = (TeamNotificationRulesResponse) o; + return Objects.equals(this.data, teamNotificationRulesResponse.data) + && Objects.equals(this.meta, teamNotificationRulesResponse.meta) + && Objects.equals( + this.additionalProperties, teamNotificationRulesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRulesResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/TeamNotificationRulesResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRulesResponseMeta.java new file mode 100644 index 00000000000..c296c9d0cc2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRulesResponseMeta.java @@ -0,0 +1,139 @@ +/* + * 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; + +/** Metadata that is included in the response when querying the team notification rules */ +@JsonPropertyOrder({TeamNotificationRulesResponseMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRulesResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private TeamNotificationRulesResponseMetaPage page; + + public TeamNotificationRulesResponseMeta page(TeamNotificationRulesResponseMetaPage page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Metadata related to paging information that is included in the response when querying the team + * notification rules + * + * @return page + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamNotificationRulesResponseMetaPage getPage() { + return page; + } + + public void setPage(TeamNotificationRulesResponseMetaPage page) { + this.page = page; + } + + /** + * 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 TeamNotificationRulesResponseMeta + */ + @JsonAnySetter + public TeamNotificationRulesResponseMeta 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 TeamNotificationRulesResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRulesResponseMeta teamNotificationRulesResponseMeta = + (TeamNotificationRulesResponseMeta) o; + return Objects.equals(this.page, teamNotificationRulesResponseMeta.page) + && Objects.equals( + this.additionalProperties, teamNotificationRulesResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRulesResponseMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).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/TeamNotificationRulesResponseMetaPage.java b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRulesResponseMetaPage.java new file mode 100644 index 00000000000..a92242090c2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamNotificationRulesResponseMetaPage.java @@ -0,0 +1,361 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Metadata related to paging information that is included in the response when querying the team + * notification rules + */ +@JsonPropertyOrder({ + TeamNotificationRulesResponseMetaPage.JSON_PROPERTY_FIRST_OFFSET, + TeamNotificationRulesResponseMetaPage.JSON_PROPERTY_LAST_OFFSET, + TeamNotificationRulesResponseMetaPage.JSON_PROPERTY_LIMIT, + TeamNotificationRulesResponseMetaPage.JSON_PROPERTY_NEXT_OFFSET, + TeamNotificationRulesResponseMetaPage.JSON_PROPERTY_OFFSET, + TeamNotificationRulesResponseMetaPage.JSON_PROPERTY_PREV_OFFSET, + TeamNotificationRulesResponseMetaPage.JSON_PROPERTY_TOTAL, + TeamNotificationRulesResponseMetaPage.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamNotificationRulesResponseMetaPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FIRST_OFFSET = "first_offset"; + private Long firstOffset; + + public static final String JSON_PROPERTY_LAST_OFFSET = "last_offset"; + private Long lastOffset; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_NEXT_OFFSET = "next_offset"; + private JsonNullable nextOffset = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_OFFSET = "offset"; + private Long offset; + + public static final String JSON_PROPERTY_PREV_OFFSET = "prev_offset"; + private JsonNullable prevOffset = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public TeamNotificationRulesResponseMetaPage firstOffset(Long firstOffset) { + this.firstOffset = firstOffset; + return this; + } + + /** + * The first offset. + * + * @return firstOffset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIRST_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getFirstOffset() { + return firstOffset; + } + + public void setFirstOffset(Long firstOffset) { + this.firstOffset = firstOffset; + } + + public TeamNotificationRulesResponseMetaPage lastOffset(Long lastOffset) { + this.lastOffset = lastOffset; + return this; + } + + /** + * The last offset. + * + * @return lastOffset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLastOffset() { + return lastOffset; + } + + public void setLastOffset(Long lastOffset) { + this.lastOffset = lastOffset; + } + + public TeamNotificationRulesResponseMetaPage limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Pagination limit. + * + * @return limit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public TeamNotificationRulesResponseMetaPage nextOffset(Long nextOffset) { + this.nextOffset = JsonNullable.of(nextOffset); + return this; + } + + /** + * The next offset. + * + * @return nextOffset + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getNextOffset() { + return nextOffset.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NEXT_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getNextOffset_JsonNullable() { + return nextOffset; + } + + @JsonProperty(JSON_PROPERTY_NEXT_OFFSET) + public void setNextOffset_JsonNullable(JsonNullable nextOffset) { + this.nextOffset = nextOffset; + } + + public void setNextOffset(Long nextOffset) { + this.nextOffset = JsonNullable.of(nextOffset); + } + + public TeamNotificationRulesResponseMetaPage offset(Long offset) { + this.offset = offset; + return this; + } + + /** + * The offset. + * + * @return offset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getOffset() { + return offset; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public TeamNotificationRulesResponseMetaPage prevOffset(Long prevOffset) { + this.prevOffset = JsonNullable.of(prevOffset); + return this; + } + + /** + * The previous offset. + * + * @return prevOffset + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getPrevOffset() { + return prevOffset.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PREV_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPrevOffset_JsonNullable() { + return prevOffset; + } + + @JsonProperty(JSON_PROPERTY_PREV_OFFSET) + public void setPrevOffset_JsonNullable(JsonNullable prevOffset) { + this.prevOffset = prevOffset; + } + + public void setPrevOffset(Long prevOffset) { + this.prevOffset = JsonNullable.of(prevOffset); + } + + public TeamNotificationRulesResponseMetaPage total(Long total) { + this.total = total; + return this; + } + + /** + * Total results. + * + * @return total + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + public TeamNotificationRulesResponseMetaPage type(String type) { + this.type = type; + return this; + } + + /** + * Offset type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + 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 TeamNotificationRulesResponseMetaPage + */ + @JsonAnySetter + public TeamNotificationRulesResponseMetaPage 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 TeamNotificationRulesResponseMetaPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamNotificationRulesResponseMetaPage teamNotificationRulesResponseMetaPage = + (TeamNotificationRulesResponseMetaPage) o; + return Objects.equals(this.firstOffset, teamNotificationRulesResponseMetaPage.firstOffset) + && Objects.equals(this.lastOffset, teamNotificationRulesResponseMetaPage.lastOffset) + && Objects.equals(this.limit, teamNotificationRulesResponseMetaPage.limit) + && Objects.equals(this.nextOffset, teamNotificationRulesResponseMetaPage.nextOffset) + && Objects.equals(this.offset, teamNotificationRulesResponseMetaPage.offset) + && Objects.equals(this.prevOffset, teamNotificationRulesResponseMetaPage.prevOffset) + && Objects.equals(this.total, teamNotificationRulesResponseMetaPage.total) + && Objects.equals(this.type, teamNotificationRulesResponseMetaPage.type) + && Objects.equals( + this.additionalProperties, teamNotificationRulesResponseMetaPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + firstOffset, + lastOffset, + limit, + nextOffset, + offset, + prevOffset, + total, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamNotificationRulesResponseMetaPage {\n"); + sb.append(" firstOffset: ").append(toIndentedString(firstOffset)).append("\n"); + sb.append(" lastOffset: ").append(toIndentedString(lastOffset)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" nextOffset: ").append(toIndentedString(nextOffset)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" prevOffset: ").append(toIndentedString(prevOffset)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_API_error_response_response.freeze b/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_API_error_response_response.freeze new file mode 100644 index 00000000000..f2b43c76655 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_API_error_response_response.freeze @@ -0,0 +1 @@ +2025-12-23T15:27:22.080Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_API_error_response_response.json b/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_API_error_response_response.json new file mode 100644 index 00000000000..4327a717897 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_API_error_response_response.json @@ -0,0 +1,113 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-416b8af9ae1d2bbe\",\"name\":\"test-name-416b8af9ae1d2bbe\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":5,\"created_at\":\"2025-12-23T15:27:22.204713+00:00\",\"description\":null,\"handle\":\"test-handle-416b8af9ae1d2bbe\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T15:27:22.204713+00:00\",\"name\":\"test-name-416b8af9ae1d2bbe\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "957231ee-5592-abf2-a9c2-d46033727528" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"56627a0f-4c41-491d-b789-14d660c391ee\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "67ad3c0d-476d-53f4-da85-34fb3614d427" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"409\",\"title\":\"Conflict\",\"detail\":\"notification rule already exists for this team\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 409, + "reasonPhrase": "Conflict" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "67ad3c0d-476d-53f4-da85-34fb3614d428" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "58868855-513e-c90b-8bb9-731595ed2d70" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_OK_response.freeze new file mode 100644 index 00000000000..64017239608 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-12-23T15:28:02.140Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_OK_response.json new file mode 100644 index 00000000000..f7e8960450f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_team_notification_rule_returns_OK_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-72b192d95e937252\",\"name\":\"test-name-72b192d95e937252\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"04eae0c8-e225-4f2c-97ec-39dab13dfc38\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":13,\"created_at\":\"2025-12-23T15:28:02.268616+00:00\",\"description\":null,\"handle\":\"test-handle-72b192d95e937252\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T15:28:02.268616+00:00\",\"name\":\"test-name-72b192d95e937252\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/04eae0c8-e225-4f2c-97ec-39dab13dfc38/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/04eae0c8-e225-4f2c-97ec-39dab13dfc38/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "49fa564a-b740-4edb-1ff8-3f0204912ce6" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/04eae0c8-e225-4f2c-97ec-39dab13dfc38/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"bba76d10-a5c6-4cb5-ba1a-5a9145f2b364\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5e63d167-61fd-7d4f-85ae-51905ed85209" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/04eae0c8-e225-4f2c-97ec-39dab13dfc38", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "edec3fb0-315b-c20a-31ca-2a14dc1629ee" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_API_error_response_response.freeze b/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_API_error_response_response.freeze new file mode 100644 index 00000000000..1cedb251b03 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_API_error_response_response.freeze @@ -0,0 +1 @@ +2025-12-23T16:10:38.852Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_API_error_response_response.json b/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_API_error_response_response.json new file mode 100644 index 00000000000..eefacf0f583 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_API_error_response_response.json @@ -0,0 +1,109 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-7ecc01265306da71\",\"name\":\"test-name-7ecc01265306da71\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"9bd7798e-a955-48e0-9a36-13820e1ff74b\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":2,\"created_at\":\"2025-12-23T16:10:38.996803+00:00\",\"description\":null,\"handle\":\"test-handle-7ecc01265306da71\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T16:10:38.996803+00:00\",\"name\":\"test-name-7ecc01265306da71\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d962cfdf-ecc2-21bd-324c-60bf32a2adfd" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"87b5e6e4-000d-4d9d-bb1c-bc62728a8ab8\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "da198411-002a-c6fe-25af-cf6c191bf211" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b/notification-rules/3d031bb2-e1da-4d34-a670-1b5557b032c9", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"detail\":\"rule ID 3d031bb2-e1da-4d34-a670-1b5557b032c9 was not found in team ID 9bd7798e-a955-48e0-9a36-13820e1ff74b\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "439cbd05-a23d-72b0-510a-e71041192cdf" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d9c889d0-8322-5281-a604-8c2d182041ee" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_No_Content_response.freeze b/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_No_Content_response.freeze new file mode 100644 index 00000000000..6552fdc24f6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-12-23T15:28:45.586Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_No_Content_response.json b/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_No_Content_response.json new file mode 100644 index 00000000000..764b6d0f42d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_team_notification_rule_returns_No_Content_response.json @@ -0,0 +1,104 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-4f30392b8132329e\",\"name\":\"test-name-4f30392b8132329e\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"204d172a-83e4-420c-a840-d914be2cd5ed\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":4,\"created_at\":\"2025-12-23T15:28:45.710450+00:00\",\"description\":null,\"handle\":\"test-handle-4f30392b8132329e\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T15:28:45.710450+00:00\",\"name\":\"test-name-4f30392b8132329e\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "036efca9-00c3-14f6-f68e-a4bbb4aff15d" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"d4abbaab-11b3-41ea-a6e3-ed366522a39e\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c4a25794-8a05-c3d7-2b70-b3cc12899148" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed/notification-rules/d4abbaab-11b3-41ea-a6e3-ed366522a39e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "9cdb6c40-cb6f-ec60-411f-23ebd416c6bd" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5d35a5c7-e110-2177-130d-5b099697cb60" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_API_error_response_response.freeze b/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_API_error_response_response.freeze new file mode 100644 index 00000000000..6113189ccb1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_API_error_response_response.freeze @@ -0,0 +1 @@ +2025-12-23T15:29:05.686Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_API_error_response_response.json b/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_API_error_response_response.json new file mode 100644 index 00000000000..502396f4d4a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_API_error_response_response.json @@ -0,0 +1,109 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-903f29be232384f8\",\"name\":\"test-name-903f29be232384f8\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"54fb1795-4bee-4e8f-9ccd-1aca53d24f8e\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":14,\"created_at\":\"2025-12-23T15:29:05.802966+00:00\",\"description\":null,\"handle\":\"test-handle-903f29be232384f8\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T15:29:05.802966+00:00\",\"name\":\"test-name-903f29be232384f8\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "25d19fe0-37f6-bfd5-2fe9-947bb1861190" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"51f01e40-e075-4c25-8878-9fd3f7800770\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f4861bf3-db17-1612-05c9-9a82c042e80c" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e/notification-rules/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"rule not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "cc32ef8a-eb7e-1638-aff8-14566f5ba630" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4565490e-de43-141e-efb7-f70721653c5a" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_OK_response.freeze new file mode 100644 index 00000000000..9ed298dca56 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-12-23T15:29:22.965Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_OK_response.json new file mode 100644 index 00000000000..87ae5766aef --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_team_notification_rule_returns_OK_response.json @@ -0,0 +1,109 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-ee0eead53fe855d3\",\"name\":\"test-name-ee0eead53fe855d3\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"a7145aa7-d043-4f4d-bd45-fd02669b47d7\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":14,\"created_at\":\"2025-12-23T15:29:23.130502+00:00\",\"description\":null,\"handle\":\"test-handle-ee0eead53fe855d3\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T15:29:23.130502+00:00\",\"name\":\"test-name-ee0eead53fe855d3\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "106e2224-b4ac-7764-016f-1f19546d230c" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"68717b60-b443-49ac-b7ca-75664cb53c29\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f0b93b65-0bbd-09d5-922d-a3f4c8dad274" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7/notification-rules/68717b60-b443-49ac-b7ca-75664cb53c29", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"68717b60-b443-49ac-b7ca-75664cb53c29\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e3b6f955-0448-ac09-39f4-715fcb657499" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "154a3020-2eb2-5ae2-f45a-c2ec4361c6e3" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_team_notification_rules_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_team_notification_rules_returns_OK_response.freeze new file mode 100644 index 00000000000..754f3a36dbc --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_team_notification_rules_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-12-23T15:29:44.007Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_team_notification_rules_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_team_notification_rules_returns_OK_response.json new file mode 100644 index 00000000000..770def6e897 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_team_notification_rules_returns_OK_response.json @@ -0,0 +1,109 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-470a68e726826798\",\"name\":\"test-name-470a68e726826798\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"a3101ed3-6329-48f6-86fa-17f3680205a3\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":14,\"created_at\":\"2025-12-23T15:29:44.163043+00:00\",\"description\":null,\"handle\":\"test-handle-470a68e726826798\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T15:29:44.163043+00:00\",\"name\":\"test-name-470a68e726826798\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6dae989e-b107-3985-1401-b171f5289bbe" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"136542b0-6555-4240-bcc9-5d040c17cd54\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c0ebd94d-fd0a-6649-de90-db599c47f1a6" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"136542b0-6555-4240-bcc9-5d040c17cd54\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}],\"meta\":{\"page\":{\"type\":\"offset_limit\",\"offset\":0,\"limit\":100,\"total\":1,\"first_offset\":0,\"prev_offset\":null,\"next_offset\":null,\"last_offset\":0}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "298ac80c-bada-27e1-84b9-23f4f69b20eb" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "431b748a-1c7e-a159-1d60-de65d3fd50c5" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_API_error_response_response.freeze b/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_API_error_response_response.freeze new file mode 100644 index 00000000000..fa21b8c82ef --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_API_error_response_response.freeze @@ -0,0 +1 @@ +2025-12-23T16:10:18.143Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_API_error_response_response.json b/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_API_error_response_response.json new file mode 100644 index 00000000000..c18f59d1280 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_API_error_response_response.json @@ -0,0 +1,113 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-191ec67f8f79c1b1\",\"name\":\"test-name-191ec67f8f79c1b1\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"30484b70-7506-41b9-b1c6-4fcf6c13e5e4\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":2,\"created_at\":\"2025-12-23T16:10:18.284603+00:00\",\"description\":null,\"handle\":\"test-handle-191ec67f8f79c1b1\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T16:10:18.284603+00:00\",\"name\":\"test-name-191ec67f8f79c1b1\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f795ee8c-db5d-0b43-6ed1-9580055cf965" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"5b80babd-fa31-4ab5-b180-5e36af751704\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "427827ee-8058-3d6d-71b6-b8306d5849cc" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"pagerduty\":{\"service_name\":\"Datadog-prod\"},\"slack\":{\"channel\":\"aaa-governance-ops\",\"workspace\":\"Datadog\"}},\"id\":\"30484b70-7506-41b9-b1c6-4fcf6c13e5e4\",\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4/notification-rules/3d031bb2-e1da-4d34-a670-1b5557b032c9", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"409\",\"title\":\"Conflict\",\"detail\":\"rule id does not match with team's rule id\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 409, + "reasonPhrase": "Conflict" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4936bde4-7876-27e6-1e80-05b056235ee9" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "12840b00-ffc2-d618-9df5-7de6da7189e0" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_OK_response.freeze new file mode 100644 index 00000000000..edbc02f6ecf --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-12-23T15:30:20.002Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_OK_response.json new file mode 100644 index 00000000000..3aa8ab5a46a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_team_notification_rule_returns_OK_response.json @@ -0,0 +1,113 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-129c4638a0cbf5ab\",\"name\":\"test-name-129c4638a0cbf5ab\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"b103bc00-af0b-48ee-ad0a-2cae69341320\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":8,\"created_at\":\"2025-12-23T15:30:20.131472+00:00\",\"description\":null,\"handle\":\"test-handle-129c4638a0cbf5ab\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2025-12-23T15:30:20.131472+00:00\",\"name\":\"test-name-129c4638a0cbf5ab\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "964350f3-8d99-4584-77d3-5274e745e637" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"channel\":\"aaa-omg-ops\",\"workspace\":\"Datadog\"}},\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"5bff55f5-6777-4494-a2bd-23e0a6a3d751\",\"type\":\"team_notification_rules\",\"attributes\":{\"email\":{\"enabled\":true},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-omg-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3fbd873d-9326-19f2-6fd1-4a107979b977" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"pagerduty\":{\"service_name\":\"Datadog-prod\"},\"slack\":{\"channel\":\"aaa-governance-ops\",\"workspace\":\"Datadog\"}},\"id\":\"5bff55f5-6777-4494-a2bd-23e0a6a3d751\",\"type\":\"team_notification_rules\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320/notification-rules/5bff55f5-6777-4494-a2bd-23e0a6a3d751", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"5bff55f5-6777-4494-a2bd-23e0a6a3d751\",\"type\":\"team_notification_rules\",\"attributes\":{\"pagerduty\":{\"service_name\":\"Datadog-prod\"},\"slack\":{\"workspace\":\"Datadog\",\"channel\":\"aaa-governance-ops\"}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6c654530-7a5a-cd30-1dc1-4dad50674662" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d4c662f3-e04c-9071-6251-8f233c82d061" + } +] \ 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 7b4bb83964b..aa08181879c 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 @@ -1256,6 +1256,22 @@ "tag": "Teams", "operationId": "CreateTeamMembership" }, + { + "parameters": [ + { + "name": "team_id", + "source": "dd_team.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"team_notification_rules\",\n \"attributes\": {\n \"email\": {\n \"enabled\": true\n },\n \"slack\": {\n \"workspace\": \"Datadog\",\n \"channel\": \"aaa-omg-ops\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"team_notification_rule\" in the system", + "key": "team_notification_rule", + "tag": "Teams", + "operationId": "CreateTeamNotificationRule" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v2/api/teams.feature b/src/test/resources/com/datadog/api/client/v2/api/teams.feature index 41b57b14746..722cc22c405 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/teams.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/teams.feature @@ -147,6 +147,25 @@ Feature: Teams And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name" And the response "data.data[0].type" is equal to "team_connection" + @team:DataDog/aaa-omg + Scenario: Create team notification rule returns "API error response." response + Given new "CreateTeamNotificationRule" request + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And there is a valid "team_notification_rule" in the system + And body with value {"data": {"type": "team_notification_rules", "attributes": {"email": {"enabled": true}, "slack": {"workspace": "Datadog", "channel": "aaa-omg-ops"}}}} + When the request is sent + Then the response status is 409 API error response. + + @team:DataDog/aaa-omg + Scenario: Create team notification rule returns "OK" response + Given new "CreateTeamNotificationRule" request + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And body with value {"data": {"type": "team_notification_rules", "attributes": {"email": {"enabled": true}, "slack": {"workspace": "Datadog", "channel": "aaa-omg-ops"}}}} + When the request is sent + Then the response status is 201 Created + @skip @team:DataDog/aaa-omg Scenario: Delete team connections returns "Bad Request" response Given operation "DeleteTeamConnections" enabled @@ -169,6 +188,26 @@ Feature: Teams When the request is sent Then the response status is 404 Not Found + @team:DataDog/aaa-omg + Scenario: Delete team notification rule returns "API error response." response + Given new "DeleteTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter with value "3d031bb2-e1da-4d34-a670-1b5557b032c9" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Delete team notification rule returns "No Content" response + Given new "DeleteTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter from "team_notification_rule.data.id" + When the request is sent + Then the response status is 204 No Content + @team:DataDog/aaa-omg Scenario: Get a team hierarchy link returns "API error response." response Given new "GetTeamHierarchyLink" request @@ -355,6 +394,43 @@ Feature: Teams Then the response status is 200 OK And the response has 3 items + @team:DataDog/aaa-omg + Scenario: Get team notification rule returns "API error response." response + Given new "GetTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter from "dd_team.data.id" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Get team notification rule returns "OK" response + Given new "GetTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter from "team_notification_rule.data.id" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get team notification rules returns "API error response." response + Given new "GetTeamNotificationRules" request + And request contains "team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Get team notification rules returns "OK" response + Given new "GetTeamNotificationRules" request + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And there is a valid "team_notification_rule" in the system + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + @generated @skip @team:DataDog/aaa-omg Scenario: Get team sync configurations returns "OK" response Given new "GetTeamSync" request @@ -609,3 +685,27 @@ Feature: Teams And body with value {"data": {"attributes": {"value": "admins"}, "type": "team_permission_settings"}} When the request is sent Then the response status is 200 OK + + @team:DataDog/aaa-omg + Scenario: Update team notification rule returns "API error response." response + Given new "UpdateTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter with value "3d031bb2-e1da-4d34-a670-1b5557b032c9" + And body with value {"data": {"type": "team_notification_rules", "id": "{{dd_team.data.id}}", "attributes": {"pagerduty": {"service_name": "Datadog-prod"}, "slack": {"workspace": "Datadog", "channel": "aaa-governance-ops"}}}} + When the request is sent + Then the response status is 409 API error response. + + @team:DataDog/aaa-omg + Scenario: Update team notification rule returns "OK" response + Given new "UpdateTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter from "team_notification_rule.data.id" + And body with value {"data": {"type": "team_notification_rules", "id": "{{team_notification_rule.data.id}}", "attributes": {"pagerduty": {"service_name": "Datadog-prod"}, "slack": {"workspace": "Datadog", "channel": "aaa-governance-ops"}}}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.slack.channel" is equal to "aaa-governance-ops" + And the response "data.attributes.pagerduty.service_name" is equal to "Datadog-prod" 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 2116e11f2ae..eb43f26dbec 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 @@ -4758,6 +4758,36 @@ "type": "idempotent" } }, + "GetTeamNotificationRules": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "CreateTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "DeleteTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, + "GetTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "UpdateTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, "GetTeamPermissionSettings": { "tag": "Teams", "undo": {