diff --git a/.apigentools-info b/.apigentools-info index cda145f920a..c101efcadd7 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-02 04:31:10.898749", - "spec_repo_commit": "272cce39" + "regenerated": "2025-05-02 09:33:55.421652", + "spec_repo_commit": "77cf469a" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-02 04:31:10.915000", - "spec_repo_commit": "272cce39" + "regenerated": "2025-05-02 09:33:55.439532", + "spec_repo_commit": "77cf469a" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 14c6d2062fa..37a8f69d15c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13314,7 +13314,7 @@ components: request. Contains assignment strategy, escalation timeout, and a list of targets. properties: assignment: - $ref: '#/components/schemas/EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment' + $ref: '#/components/schemas/EscalationPolicyStepAttributesAssignment' escalate_after_seconds: description: Defines how many seconds to wait before escalating to the next step. @@ -13323,47 +13323,14 @@ components: type: integer targets: description: Specifies the collection of escalation targets for this step. + example: + - users items: - $ref: '#/components/schemas/EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems' + $ref: '#/components/schemas/EscalationPolicyStepTarget' type: array required: - targets type: object - EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment: - description: Specifies how this escalation step will assign targets (example - `default` or `round-robin`). - enum: - - default - - round-robin - example: default - type: string - x-enum-varnames: - - DEFAULT - - ROUND_ROBIN - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems: - description: Defines a single escalation target within a step for an escalation - policy creation request. Contains `id` and `type`. - properties: - id: - description: Specifies the unique identifier for this target. - example: 00000000-aba1-0000-0000-000000000000 - type: string - type: - $ref: '#/components/schemas/EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType' - type: object - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType: - description: Specifies the type of escalation target (example `users`, `schedules`, - or `teams`). - enum: - - users - - schedules - - teams - example: users - type: string - x-enum-varnames: - - USERS - - SCHEDULES - - TEAMS EscalationPolicyCreateRequestDataRelationships: description: Represents relationships in an escalation policy creation request, including references to teams. @@ -13594,6 +13561,30 @@ components: targets: $ref: '#/components/schemas/EscalationTarget' type: object + EscalationPolicyStepTarget: + description: Defines a single escalation target within a step for an escalation + policy creation request. Contains `id` and `type`. + properties: + id: + description: Specifies the unique identifier for this target. + example: 00000000-aba1-0000-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/EscalationPolicyStepTargetType' + type: object + EscalationPolicyStepTargetType: + description: Specifies the type of escalation target (example `users`, `schedules`, + or `teams`). + enum: + - users + - schedules + - teams + example: users + type: string + x-enum-varnames: + - USERS + - SCHEDULES + - TEAMS EscalationPolicyStepType: default: steps description: Indicates that the resource is of type `steps`. @@ -13691,7 +13682,7 @@ components: ID, and a list of targets. properties: assignment: - $ref: '#/components/schemas/EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment' + $ref: '#/components/schemas/EscalationPolicyStepAttributesAssignment' escalate_after_seconds: description: Defines how many seconds to wait before escalating to the next step. @@ -13705,46 +13696,11 @@ components: targets: description: Specifies the collection of escalation targets for this step. items: - $ref: '#/components/schemas/EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems' + $ref: '#/components/schemas/EscalationPolicyStepTarget' type: array required: - targets type: object - EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment: - description: Specifies how this escalation step will assign targets (example - `default` or `round-robin`). - enum: - - default - - round-robin - example: default - type: string - x-enum-varnames: - - DEFAULT - - ROUND_ROBIN - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems: - description: Defines a single escalation target within a step for an escalation - policy update request. Contains `id` and `type`. - properties: - id: - description: Specifies the unique identifier for this target. - example: 00000000-aba1-0000-0000-000000000000 - type: string - type: - $ref: '#/components/schemas/EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType' - type: object - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType: - description: Specifies the type of escalation target (example `users`, `schedules`, - or `teams`). - enum: - - users - - schedules - - teams - example: users - type: string - x-enum-varnames: - - USERS - - SCHEDULES - - TEAMS EscalationPolicyUpdateRequestDataRelationships: description: Represents relationships in an escalation policy update request, including references to teams. @@ -29798,6 +29754,93 @@ components: type: string x-enum-varnames: - ROLES + RoutingRule: + description: Represents a routing rule, including its attributes, relationships, + and unique identifier. + properties: + attributes: + $ref: '#/components/schemas/RoutingRuleAttributes' + id: + description: Specifies the unique identifier of this routing rule. + type: string + relationships: + $ref: '#/components/schemas/RoutingRuleRelationships' + type: + $ref: '#/components/schemas/RoutingRuleType' + required: + - type + type: object + RoutingRuleAction: + description: Defines an action that is executed when a routing rule matches + certain criteria. + oneOf: + - $ref: '#/components/schemas/SlackAction' + - $ref: '#/components/schemas/TeamsAction' + RoutingRuleAttributes: + description: Defines the configurable attributes of a routing rule, such as + actions, query, time restriction, and urgency. + properties: + actions: + description: Specifies the list of actions to perform when the routing rule + matches. + items: + $ref: '#/components/schemas/RoutingRuleAction' + type: array + query: + description: Defines the query or condition that triggers this routing rule. + type: string + time_restriction: + $ref: '#/components/schemas/TimeRestrictions' + urgency: + $ref: '#/components/schemas/Urgency' + type: object + RoutingRuleRelationships: + description: Specifies relationships for a routing rule, linking to associated + policy resources. + properties: + policy: + $ref: '#/components/schemas/RoutingRuleRelationshipsPolicy' + type: object + RoutingRuleRelationshipsPolicy: + description: Defines the relationship that links a routing rule to a policy. + properties: + data: + $ref: '#/components/schemas/RoutingRuleRelationshipsPolicyData' + required: + - data + type: object + RoutingRuleRelationshipsPolicyData: + description: Represents the policy data reference, containing the policy's ID + and resource type. + properties: + id: + description: Specifies the unique identifier of the policy. + example: '' + type: string + type: + $ref: '#/components/schemas/RoutingRuleRelationshipsPolicyDataType' + required: + - type + - id + type: object + RoutingRuleRelationshipsPolicyDataType: + default: policies + description: Indicates that the resource is of type 'policies'. + enum: + - policies + example: policies + type: string + x-enum-varnames: + - POLICIES + RoutingRuleType: + default: team_routing_rules + description: Team routing rules resource type. + enum: + - team_routing_rules + example: team_routing_rules + type: string + x-enum-varnames: + - TEAM_ROUTING_RULES RuleAttributes: description: Details of a rule. properties: @@ -35922,6 +35965,26 @@ components: type: string x-enum-varnames: - AGGREGATED_CONNECTION + SlackAction: + description: Sends a message to a Slack channel. + properties: + channel: + description: The channel ID. + example: CHANNEL + type: string + type: + description: Must be set to "send_slack_message". + example: send_slack_message + type: string + workspace: + description: The workspace ID. + example: WORKSPACE + type: string + required: + - type + - channel + - workspace + type: object SlackIntegrationMetadata: description: Incident integration metadata for the Slack integration. properties: @@ -37570,6 +37633,212 @@ components: data: $ref: '#/components/schemas/Team' type: object + TeamRoutingRules: + description: Represents a complete set of team routing rules, including data + and optionally included related resources. + example: + data: + id: 27590dae-47be-4a7d-9abf-8f4e45124020 + relationships: + rules: + data: + - id: 03aff2d6-6cbf-496c-997f-a857bbe9a94a + type: team_routing_rules + - id: 03aff2d6-6cbf-496c-997f-a857bbe9a94a + type: team_routing_rules + type: team_routing_rules + included: + - attributes: + actions: null + query: tags.service:test + time_restriction: + restrictions: + - end_day: monday + end_time: '17:00:00' + start_day: monday + start_time: 09:00:00 + - end_day: tuesday + end_time: '17:00:00' + start_day: tuesday + start_time: 09:00:00 + time_zone: '' + urgency: high + id: 03aff2d6-6cbf-496c-997f-a857bbe9a94a + relationships: + policy: + data: null + type: team_routing_rules + properties: + data: + $ref: '#/components/schemas/TeamRoutingRulesData' + included: + description: Provides related routing rules or other included resources. + items: + $ref: '#/components/schemas/TeamRoutingRulesIncluded' + type: array + type: object + TeamRoutingRulesData: + description: Represents the top-level data object for team routing rules, containing + the ID, relationships, and resource type. + properties: + id: + description: Specifies the unique identifier of this team routing rules + record. + type: string + relationships: + $ref: '#/components/schemas/TeamRoutingRulesDataRelationships' + type: + $ref: '#/components/schemas/TeamRoutingRulesDataType' + required: + - type + type: object + TeamRoutingRulesDataRelationships: + description: Specifies relationships for team routing rules, including rule + references. + properties: + rules: + $ref: '#/components/schemas/TeamRoutingRulesDataRelationshipsRules' + type: object + TeamRoutingRulesDataRelationshipsRules: + description: Holds references to a set of routing rules in a relationship. + properties: + data: + description: An array of references to the routing rules associated with + this team. + items: + $ref: '#/components/schemas/TeamRoutingRulesDataRelationshipsRulesDataItems' + type: array + type: object + TeamRoutingRulesDataRelationshipsRulesDataItems: + description: Defines a relationship item to link a routing rule by its ID and + type. + properties: + id: + description: Specifies the unique identifier for the related routing rule. + example: '' + type: string + type: + $ref: '#/components/schemas/TeamRoutingRulesDataRelationshipsRulesDataItemsType' + required: + - type + - id + type: object + TeamRoutingRulesDataRelationshipsRulesDataItemsType: + default: team_routing_rules + description: Indicates that the resource is of type 'team_routing_rules'. + enum: + - team_routing_rules + example: team_routing_rules + type: string + x-enum-varnames: + - TEAM_ROUTING_RULES + TeamRoutingRulesDataType: + default: team_routing_rules + description: Team routing rules resource type. + enum: + - team_routing_rules + example: team_routing_rules + type: string + x-enum-varnames: + - TEAM_ROUTING_RULES + TeamRoutingRulesIncluded: + description: Represents additional included resources for team routing rules, + such as associated routing rules. + oneOf: + - $ref: '#/components/schemas/RoutingRule' + TeamRoutingRulesRequest: + description: Represents a request to create or update team routing rules, including + the data payload. + example: + data: + attributes: + rules: + - actions: null + policy_id: '' + query: tags.service:test + time_restriction: + restrictions: + - end_day: monday + end_time: '17:00:00' + start_day: monday + start_time: 09:00:00 + - end_day: tuesday + end_time: '17:00:00' + start_day: tuesday + start_time: 09:00:00 + time_zone: '' + urgency: high + - actions: + - channel: channel + type: send_slack_message + workspace: workspace + policy_id: fad4eee1-13f5-40d8-886b-4e56d8d5d1c6 + query: '' + time_restriction: null + urgency: low + id: 27590dae-47be-4a7d-9abf-8f4e45124020 + type: team_routing_rules + properties: + data: + $ref: '#/components/schemas/TeamRoutingRulesRequestData' + type: object + TeamRoutingRulesRequestData: + description: Holds the data necessary to create or update team routing rules, + including attributes, ID, and resource type. + properties: + attributes: + $ref: '#/components/schemas/TeamRoutingRulesRequestDataAttributes' + id: + description: Specifies the unique identifier for this set of team routing + rules. + type: string + type: + $ref: '#/components/schemas/TeamRoutingRulesRequestDataType' + required: + - type + type: object + TeamRoutingRulesRequestDataAttributes: + description: Represents the attributes of a request to update or create team + routing rules. + properties: + rules: + description: A list of routing rule items that define how incoming pages + should be handled. + items: + $ref: '#/components/schemas/TeamRoutingRulesRequestRule' + type: array + type: object + TeamRoutingRulesRequestDataType: + default: team_routing_rules + description: Team routing rules resource type. + enum: + - team_routing_rules + example: team_routing_rules + type: string + x-enum-varnames: + - TEAM_ROUTING_RULES + TeamRoutingRulesRequestRule: + description: Defines an individual routing rule item that contains the rule + data for the request. + properties: + actions: + description: Specifies the list of actions to perform when the routing rule + is matched. + items: + $ref: '#/components/schemas/RoutingRuleAction' + type: array + policy_id: + description: Identifies the policy to be applied when this routing rule + matches. + type: string + query: + description: Defines the query or condition that triggers this routing rule. + type: string + time_restriction: + $ref: '#/components/schemas/TimeRestrictions' + urgency: + $ref: '#/components/schemas/Urgency' + type: object TeamTarget: description: Represents a team target for an escalation policy step, including the team's ID and resource type. @@ -37672,6 +37941,31 @@ components: required: - data type: object + TeamsAction: + description: Sends a message to a Microsoft Teams channel. + properties: + channel: + description: The channel ID. + example: CHANNEL + type: string + team: + description: The team ID. + example: TEAM + type: string + tenant: + description: The tenant ID. + example: TENANT + type: string + type: + description: Must be set to "send_teams_message". + example: send_teams_message + type: string + required: + - type + - channel + - tenant + - team + type: object TeamsField: description: Supported teams field. enum: @@ -37803,6 +38097,38 @@ components: example: 86400 format: int64 type: integer + TimeRestriction: + description: Defines a single time restriction rule with start and end times + and the applicable weekdays. + properties: + end_day: + $ref: '#/components/schemas/Weekday' + end_time: + description: Specifies the ending time for this restriction. + type: string + start_day: + $ref: '#/components/schemas/Weekday' + start_time: + description: Specifies the starting time for this restriction. + type: string + type: object + TimeRestrictions: + description: Holds time zone information and a list of time restrictions for + a routing rule. + properties: + restrictions: + description: Defines the list of time-based restrictions. + items: + $ref: '#/components/schemas/TimeRestriction' + type: array + time_zone: + description: Specifies the time zone applicable to the restrictions. + example: '' + type: string + required: + - time_zone + - restrictions + type: object TimeseriesFormulaQueryRequest: description: A request wrapper around a single timeseries query to be executed. properties: @@ -38430,6 +38756,18 @@ components: description: Upsert entity response included item. oneOf: - $ref: '#/components/schemas/EntityResponseIncludedSchema' + Urgency: + description: Specifies the level of urgency for a routing rule (low, high, or + dynamic). + enum: + - low + - high + - dynamic + type: string + x-enum-varnames: + - LOW + - HIGH + - DYNAMIC UrlParam: description: The definition of `UrlParam` object. properties: @@ -39504,6 +39842,25 @@ components: - X_CONTENT_TYPE_HEADER_MISSING - X_PATH_INJECTION - XSS + Weekday: + description: A day of the week. + enum: + - monday + - tuesday + - wednesday + - thursday + - friday + - saturday + - sunday + type: string + x-enum-varnames: + - MONDAY + - TUESDAY + - WEDNESDAY + - THURSDAY + - FRIDAY + - SATURDAY + - SUNDAY WidgetLiveSpan: description: The available timeframes depend on the widget you are using. enum: @@ -51107,6 +51464,79 @@ paths: summary: Update on-call schedule tags: - On-Call + /api/v2/on-call/teams/{team_id}/routing-rules: + get: + description: Get a team's on-call routing rules + operationId: GetOnCallTeamRoutingRules + parameters: + - description: The team ID + in: path + name: team_id + required: true + schema: + example: 27590dae-47be-4a7d-9abf-8f4e45124020 + type: string + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `rules`, `rules.policy`.' + in: query + name: include + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamRoutingRules' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get on-call team routing rules + tags: + - On-Call + put: + description: Set a team's on-call routing rules + operationId: SetOnCallTeamRoutingRules + parameters: + - description: The team ID + in: path + name: team_id + required: true + schema: + example: 27590dae-47be-4a7d-9abf-8f4e45124020 + type: string + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `rules`, `rules.policy`.' + in: query + name: include + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamRoutingRulesRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamRoutingRules' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Set on-call team routing rules + tags: + - On-Call /api/v2/org_configs: get: description: Returns all Org Configs (name, description, and value). diff --git a/examples/v2/on-call/CreateOnCallEscalationPolicy.java b/examples/v2/on-call/CreateOnCallEscalationPolicy.java index 47b8a145198..1f5a2e948a4 100644 --- a/examples/v2/on-call/CreateOnCallEscalationPolicy.java +++ b/examples/v2/on-call/CreateOnCallEscalationPolicy.java @@ -8,14 +8,14 @@ import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestData; import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataAttributes; import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataAttributesStepsItems; -import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment; -import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems; -import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType; import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataRelationships; import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataRelationshipsTeams; import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataRelationshipsTeamsDataItems; import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataRelationshipsTeamsDataItemsType; import com.datadog.api.client.v2.model.EscalationPolicyCreateRequestDataType; +import com.datadog.api.client.v2.model.EscalationPolicyStepAttributesAssignment; +import com.datadog.api.client.v2.model.EscalationPolicyStepTarget; +import com.datadog.api.client.v2.model.EscalationPolicyStepTargetType; import java.util.Arrays; import java.util.Collections; @@ -47,38 +47,28 @@ public static void main(String[] args) { Arrays.asList( new EscalationPolicyCreateRequestDataAttributesStepsItems() .assignment( - EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment - .DEFAULT) + EscalationPolicyStepAttributesAssignment.DEFAULT) .escalateAfterSeconds(3600L) .targets( Arrays.asList( - new EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems() + new EscalationPolicyStepTarget() .id(USER_DATA_ID) - .type( - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType - .USERS), - new EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems() + .type(EscalationPolicyStepTargetType.USERS), + new EscalationPolicyStepTarget() .id(SCHEDULE_DATA_ID) - .type( - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType - .SCHEDULES), - new EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems() + .type(EscalationPolicyStepTargetType.SCHEDULES), + new EscalationPolicyStepTarget() .id(DD_TEAM_DATA_ID) - .type( - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType - .TEAMS))), + .type(EscalationPolicyStepTargetType.TEAMS))), new EscalationPolicyCreateRequestDataAttributesStepsItems() .assignment( - EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment - .ROUND_ROBIN) + EscalationPolicyStepAttributesAssignment.ROUND_ROBIN) .escalateAfterSeconds(3600L) .targets( Collections.singletonList( - new EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems() + new EscalationPolicyStepTarget() .id(DD_TEAM_DATA_ID) - .type( - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType - .TEAMS)))))) + .type(EscalationPolicyStepTargetType.TEAMS)))))) .relationships( new EscalationPolicyCreateRequestDataRelationships() .teams( diff --git a/examples/v2/on-call/GetOnCallTeamRoutingRules.java b/examples/v2/on-call/GetOnCallTeamRoutingRules.java new file mode 100644 index 00000000000..ee1dab92377 --- /dev/null +++ b/examples/v2/on-call/GetOnCallTeamRoutingRules.java @@ -0,0 +1,25 @@ +// Get on-call team routing rules returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallApi; +import com.datadog.api.client.v2.model.TeamRoutingRules; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallApi apiInstance = new OnCallApi(defaultClient); + + try { + TeamRoutingRules result = + apiInstance.getOnCallTeamRoutingRules("27590dae-47be-4a7d-9abf-8f4e45124020"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallApi#getOnCallTeamRoutingRules"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/on-call/SetOnCallTeamRoutingRules.java b/examples/v2/on-call/SetOnCallTeamRoutingRules.java new file mode 100644 index 00000000000..3d59f0fab6b --- /dev/null +++ b/examples/v2/on-call/SetOnCallTeamRoutingRules.java @@ -0,0 +1,83 @@ +// Set on-call team routing rules returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallApi; +import com.datadog.api.client.v2.model.RoutingRuleAction; +import com.datadog.api.client.v2.model.SlackAction; +import com.datadog.api.client.v2.model.TeamRoutingRules; +import com.datadog.api.client.v2.model.TeamRoutingRulesRequest; +import com.datadog.api.client.v2.model.TeamRoutingRulesRequestData; +import com.datadog.api.client.v2.model.TeamRoutingRulesRequestDataAttributes; +import com.datadog.api.client.v2.model.TeamRoutingRulesRequestDataType; +import com.datadog.api.client.v2.model.TeamRoutingRulesRequestRule; +import com.datadog.api.client.v2.model.TimeRestriction; +import com.datadog.api.client.v2.model.TimeRestrictions; +import com.datadog.api.client.v2.model.Urgency; +import com.datadog.api.client.v2.model.Weekday; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallApi apiInstance = new OnCallApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + // there is a valid "escalation_policy" in the system + String ESCALATION_POLICY_DATA_ID = System.getenv("ESCALATION_POLICY_DATA_ID"); + + TeamRoutingRulesRequest body = + new TeamRoutingRulesRequest() + .data( + new TeamRoutingRulesRequestData() + .attributes( + new TeamRoutingRulesRequestDataAttributes() + .rules( + Arrays.asList( + new TeamRoutingRulesRequestRule() + .actions( + Collections.singletonList( + new RoutingRuleAction( + new SlackAction() + .channel("channel") + .type("send_slack_message") + .workspace("workspace")))) + .query("tags.service:test") + .timeRestriction( + new TimeRestrictions() + .timeZone("Europe/Paris") + .restrictions( + Arrays.asList( + new TimeRestriction() + .endDay(Weekday.MONDAY) + .endTime("17:00:00") + .startDay(Weekday.MONDAY) + .startTime("09:00:00"), + new TimeRestriction() + .endDay(Weekday.TUESDAY) + .endTime("17:00:00") + .startDay(Weekday.TUESDAY) + .startTime("09:00:00")))) + .urgency(Urgency.HIGH), + new TeamRoutingRulesRequestRule() + .policyId(ESCALATION_POLICY_DATA_ID) + .query("") + .urgency(Urgency.LOW)))) + .id(DD_TEAM_DATA_ID) + .type(TeamRoutingRulesRequestDataType.TEAM_ROUTING_RULES)); + + try { + TeamRoutingRules result = apiInstance.setOnCallTeamRoutingRules(DD_TEAM_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallApi#setOnCallTeamRoutingRules"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/on-call/UpdateOnCallEscalationPolicy.java b/examples/v2/on-call/UpdateOnCallEscalationPolicy.java index efc4a7f84d6..5f0fb4d1085 100644 --- a/examples/v2/on-call/UpdateOnCallEscalationPolicy.java +++ b/examples/v2/on-call/UpdateOnCallEscalationPolicy.java @@ -4,13 +4,13 @@ import com.datadog.api.client.ApiException; import com.datadog.api.client.v2.api.OnCallApi; import com.datadog.api.client.v2.model.EscalationPolicy; +import com.datadog.api.client.v2.model.EscalationPolicyStepAttributesAssignment; +import com.datadog.api.client.v2.model.EscalationPolicyStepTarget; +import com.datadog.api.client.v2.model.EscalationPolicyStepTargetType; import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequest; import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestData; import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataAttributes; import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataAttributesStepsItems; -import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment; -import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems; -import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType; import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataRelationships; import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataRelationshipsTeams; import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataRelationshipsTeamsDataItems; @@ -48,17 +48,14 @@ public static void main(String[] args) { Collections.singletonList( new EscalationPolicyUpdateRequestDataAttributesStepsItems() .assignment( - EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment - .DEFAULT) + EscalationPolicyStepAttributesAssignment.DEFAULT) .escalateAfterSeconds(3600L) .id(ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID) .targets( Collections.singletonList( - new EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems() + new EscalationPolicyStepTarget() .id(USER_DATA_ID) - .type( - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType - .USERS)))))) + .type(EscalationPolicyStepTargetType.USERS)))))) .id(ESCALATION_POLICY_DATA_ID) .relationships( new EscalationPolicyUpdateRequestDataRelationships() diff --git a/src/main/java/com/datadog/api/client/v2/api/OnCallApi.java b/src/main/java/com/datadog/api/client/v2/api/OnCallApi.java index 0ccda08d234..6c97443bbd4 100644 --- a/src/main/java/com/datadog/api/client/v2/api/OnCallApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/OnCallApi.java @@ -10,6 +10,8 @@ import com.datadog.api.client.v2.model.Schedule; import com.datadog.api.client.v2.model.ScheduleCreateRequest; import com.datadog.api.client.v2.model.ScheduleUpdateRequest; +import com.datadog.api.client.v2.model.TeamRoutingRules; +import com.datadog.api.client.v2.model.TeamRoutingRulesRequest; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -1125,6 +1127,435 @@ public CompletableFuture> getOnCallScheduleWithHttpInfoAsy new GenericType() {}); } + /** Manage optional parameters to getOnCallTeamRoutingRules. */ + public static class GetOnCallTeamRoutingRulesOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of included relationships to be returned. Allowed values: + * rules, rules.policy. (optional) + * @return GetOnCallTeamRoutingRulesOptionalParameters + */ + public GetOnCallTeamRoutingRulesOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Get on-call team routing rules. + * + *

See {@link #getOnCallTeamRoutingRulesWithHttpInfo}. + * + * @param teamId The team ID (required) + * @return TeamRoutingRules + * @throws ApiException if fails to make API call + */ + public TeamRoutingRules getOnCallTeamRoutingRules(String teamId) throws ApiException { + return getOnCallTeamRoutingRulesWithHttpInfo( + teamId, new GetOnCallTeamRoutingRulesOptionalParameters()) + .getData(); + } + + /** + * Get on-call team routing rules. + * + *

See {@link #getOnCallTeamRoutingRulesWithHttpInfoAsync}. + * + * @param teamId The team ID (required) + * @return CompletableFuture<TeamRoutingRules> + */ + public CompletableFuture getOnCallTeamRoutingRulesAsync(String teamId) { + return getOnCallTeamRoutingRulesWithHttpInfoAsync( + teamId, new GetOnCallTeamRoutingRulesOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get on-call team routing rules. + * + *

See {@link #getOnCallTeamRoutingRulesWithHttpInfo}. + * + * @param teamId The team ID (required) + * @param parameters Optional parameters for the request. + * @return TeamRoutingRules + * @throws ApiException if fails to make API call + */ + public TeamRoutingRules getOnCallTeamRoutingRules( + String teamId, GetOnCallTeamRoutingRulesOptionalParameters parameters) throws ApiException { + return getOnCallTeamRoutingRulesWithHttpInfo(teamId, parameters).getData(); + } + + /** + * Get on-call team routing rules. + * + *

See {@link #getOnCallTeamRoutingRulesWithHttpInfoAsync}. + * + * @param teamId The team ID (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TeamRoutingRules> + */ + public CompletableFuture getOnCallTeamRoutingRulesAsync( + String teamId, GetOnCallTeamRoutingRulesOptionalParameters parameters) { + return getOnCallTeamRoutingRulesWithHttpInfoAsync(teamId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a team's on-call routing rules + * + * @param teamId The team ID (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<TeamRoutingRules> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse getOnCallTeamRoutingRulesWithHttpInfo( + String teamId, GetOnCallTeamRoutingRulesOptionalParameters 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 getOnCallTeamRoutingRules"); + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/on-call/teams/{team_id}/routing-rules" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallApi.getOnCallTeamRoutingRules", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get on-call team routing rules. + * + *

See {@link #getOnCallTeamRoutingRulesWithHttpInfo}. + * + * @param teamId The team ID (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TeamRoutingRules>> + */ + public CompletableFuture> + getOnCallTeamRoutingRulesWithHttpInfoAsync( + String teamId, GetOnCallTeamRoutingRulesOptionalParameters 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 getOnCallTeamRoutingRules")); + return result; + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/on-call/teams/{team_id}/routing-rules" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallApi.getOnCallTeamRoutingRules", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to setOnCallTeamRoutingRules. */ + public static class SetOnCallTeamRoutingRulesOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of included relationships to be returned. Allowed values: + * rules, rules.policy. (optional) + * @return SetOnCallTeamRoutingRulesOptionalParameters + */ + public SetOnCallTeamRoutingRulesOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Set on-call team routing rules. + * + *

See {@link #setOnCallTeamRoutingRulesWithHttpInfo}. + * + * @param teamId The team ID (required) + * @param body (required) + * @return TeamRoutingRules + * @throws ApiException if fails to make API call + */ + public TeamRoutingRules setOnCallTeamRoutingRules(String teamId, TeamRoutingRulesRequest body) + throws ApiException { + return setOnCallTeamRoutingRulesWithHttpInfo( + teamId, body, new SetOnCallTeamRoutingRulesOptionalParameters()) + .getData(); + } + + /** + * Set on-call team routing rules. + * + *

See {@link #setOnCallTeamRoutingRulesWithHttpInfoAsync}. + * + * @param teamId The team ID (required) + * @param body (required) + * @return CompletableFuture<TeamRoutingRules> + */ + public CompletableFuture setOnCallTeamRoutingRulesAsync( + String teamId, TeamRoutingRulesRequest body) { + return setOnCallTeamRoutingRulesWithHttpInfoAsync( + teamId, body, new SetOnCallTeamRoutingRulesOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Set on-call team routing rules. + * + *

See {@link #setOnCallTeamRoutingRulesWithHttpInfo}. + * + * @param teamId The team ID (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return TeamRoutingRules + * @throws ApiException if fails to make API call + */ + public TeamRoutingRules setOnCallTeamRoutingRules( + String teamId, + TeamRoutingRulesRequest body, + SetOnCallTeamRoutingRulesOptionalParameters parameters) + throws ApiException { + return setOnCallTeamRoutingRulesWithHttpInfo(teamId, body, parameters).getData(); + } + + /** + * Set on-call team routing rules. + * + *

See {@link #setOnCallTeamRoutingRulesWithHttpInfoAsync}. + * + * @param teamId The team ID (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TeamRoutingRules> + */ + public CompletableFuture setOnCallTeamRoutingRulesAsync( + String teamId, + TeamRoutingRulesRequest body, + SetOnCallTeamRoutingRulesOptionalParameters parameters) { + return setOnCallTeamRoutingRulesWithHttpInfoAsync(teamId, body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Set a team's on-call routing rules + * + * @param teamId The team ID (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<TeamRoutingRules> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse setOnCallTeamRoutingRulesWithHttpInfo( + String teamId, + TeamRoutingRulesRequest body, + SetOnCallTeamRoutingRulesOptionalParameters parameters) + 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 setOnCallTeamRoutingRules"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling setOnCallTeamRoutingRules"); + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/on-call/teams/{team_id}/routing-rules" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallApi.setOnCallTeamRoutingRules", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Set on-call team routing rules. + * + *

See {@link #setOnCallTeamRoutingRulesWithHttpInfo}. + * + * @param teamId The team ID (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TeamRoutingRules>> + */ + public CompletableFuture> + setOnCallTeamRoutingRulesWithHttpInfoAsync( + String teamId, + TeamRoutingRulesRequest body, + SetOnCallTeamRoutingRulesOptionalParameters parameters) { + 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 setOnCallTeamRoutingRules")); + 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 setOnCallTeamRoutingRules")); + return result; + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/on-call/teams/{team_id}/routing-rules" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallApi.setOnCallTeamRoutingRules", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + /** Manage optional parameters to updateOnCallEscalationPolicy. */ public static class UpdateOnCallEscalationPolicyOptionalParameters { private String include; diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItems.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItems.java index 87d86dd73d0..b3db146c123 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItems.java +++ b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItems.java @@ -33,26 +33,25 @@ public class EscalationPolicyCreateRequestDataAttributesStepsItems { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ASSIGNMENT = "assignment"; - private EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment assignment; + private EscalationPolicyStepAttributesAssignment assignment; public static final String JSON_PROPERTY_ESCALATE_AFTER_SECONDS = "escalate_after_seconds"; private Long escalateAfterSeconds; public static final String JSON_PROPERTY_TARGETS = "targets"; - private List targets = - new ArrayList<>(); + private List targets = new ArrayList<>(); public EscalationPolicyCreateRequestDataAttributesStepsItems() {} @JsonCreator public EscalationPolicyCreateRequestDataAttributesStepsItems( @JsonProperty(required = true, value = JSON_PROPERTY_TARGETS) - List targets) { + List targets) { this.targets = targets; } public EscalationPolicyCreateRequestDataAttributesStepsItems assignment( - EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment assignment) { + EscalationPolicyStepAttributesAssignment assignment) { this.assignment = assignment; this.unparsed |= !assignment.isValid(); return this; @@ -67,12 +66,11 @@ public EscalationPolicyCreateRequestDataAttributesStepsItems assignment( @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ASSIGNMENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment getAssignment() { + public EscalationPolicyStepAttributesAssignment getAssignment() { return assignment; } - public void setAssignment( - EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment assignment) { + public void setAssignment(EscalationPolicyStepAttributesAssignment assignment) { if (!assignment.isValid()) { this.unparsed = true; } @@ -102,16 +100,16 @@ public void setEscalateAfterSeconds(Long escalateAfterSeconds) { } public EscalationPolicyCreateRequestDataAttributesStepsItems targets( - List targets) { + List targets) { this.targets = targets; - for (EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems item : targets) { + for (EscalationPolicyStepTarget item : targets) { this.unparsed |= item.unparsed; } return this; } public EscalationPolicyCreateRequestDataAttributesStepsItems addTargetsItem( - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems targetsItem) { + EscalationPolicyStepTarget targetsItem) { this.targets.add(targetsItem); this.unparsed |= targetsItem.unparsed; return this; @@ -124,12 +122,11 @@ public EscalationPolicyCreateRequestDataAttributesStepsItems addTargetsItem( */ @JsonProperty(JSON_PROPERTY_TARGETS) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getTargets() { + public List getTargets() { return targets; } - public void setTargets( - List targets) { + public void setTargets(List targets) { this.targets = targets; } diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment.java deleted file mode 100644 index f81085d3361..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.ModelEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * Specifies how this escalation step will assign targets (example default or - * round-robin). - */ -@JsonSerialize( - using = - EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment - .EscalationPolicyCreateRequestDataAttributesStepsItemsAssignmentSerializer.class) -public class EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment - extends ModelEnum { - - private static final Set allowedValues = - new HashSet(Arrays.asList("default", "round-robin")); - - public static final EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment DEFAULT = - new EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment("default"); - public static final EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment ROUND_ROBIN = - new EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment("round-robin"); - - EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment(String value) { - super(value, allowedValues); - } - - public static class EscalationPolicyCreateRequestDataAttributesStepsItemsAssignmentSerializer - extends StdSerializer { - public EscalationPolicyCreateRequestDataAttributesStepsItemsAssignmentSerializer( - Class t) { - super(t); - } - - public EscalationPolicyCreateRequestDataAttributesStepsItemsAssignmentSerializer() { - this(null); - } - - @Override - public void serialize( - EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment value, - JsonGenerator jgen, - SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.value); - } - } - - @JsonCreator - public static EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment fromValue( - String value) { - return new EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment(value); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType.java deleted file mode 100644 index 72768c94297..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.ModelEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * Specifies the type of escalation target (example users, schedules, or - * teams). - */ -@JsonSerialize( - using = - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType - .EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsTypeSerializer.class) -public class EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType - extends ModelEnum { - - private static final Set allowedValues = - new HashSet(Arrays.asList("users", "schedules", "teams")); - - public static final EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType USERS = - new EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType("users"); - public static final EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType - SCHEDULES = - new EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType("schedules"); - public static final EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType TEAMS = - new EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType("teams"); - - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType(String value) { - super(value, allowedValues); - } - - public static - class EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsTypeSerializer - extends StdSerializer { - public EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsTypeSerializer( - Class t) { - super(t); - } - - public EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsTypeSerializer() { - this(null); - } - - @Override - public void serialize( - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType value, - JsonGenerator jgen, - SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.value); - } - } - - @JsonCreator - public static EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType fromValue( - String value) { - return new EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType(value); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyStepTarget.java similarity index 69% rename from src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.java rename to src/main/java/com/datadog/api/client/v2/model/EscalationPolicyStepTarget.java index 45f825811e9..6b75fc4cbd0 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.java +++ b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyStepTarget.java @@ -21,20 +21,20 @@ * Contains id and type. */ @JsonPropertyOrder({ - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.JSON_PROPERTY_ID, - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.JSON_PROPERTY_TYPE + EscalationPolicyStepTarget.JSON_PROPERTY_ID, + EscalationPolicyStepTarget.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems { +public class EscalationPolicyStepTarget { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ID = "id"; private String id; public static final String JSON_PROPERTY_TYPE = "type"; - private EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType type; + private EscalationPolicyStepTargetType type; - public EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems id(String id) { + public EscalationPolicyStepTarget id(String id) { this.id = id; return this; } @@ -55,8 +55,7 @@ public void setId(String id) { this.id = id; } - public EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems type( - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType type) { + public EscalationPolicyStepTarget type(EscalationPolicyStepTargetType type) { this.type = type; this.unparsed |= !type.isValid(); return this; @@ -71,11 +70,11 @@ public EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems type( @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType getType() { + public EscalationPolicyStepTargetType getType() { return type; } - public void setType(EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType type) { + public void setType(EscalationPolicyStepTargetType type) { if (!type.isValid()) { this.unparsed = true; } @@ -94,11 +93,10 @@ public void setType(EscalationPolicyCreateRequestDataAttributesStepsItemsTargets * * @param key The arbitrary key to set * @param value The associated value - * @return EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems + * @return EscalationPolicyStepTarget */ @JsonAnySetter - public EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems putAdditionalProperty( - String key, Object value) { + public EscalationPolicyStepTarget putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -129,10 +127,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** - * Return true if this EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems object is - * equal to o. - */ + /** Return true if this EscalationPolicyStepTarget object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -141,16 +136,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems - escalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems = - (EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems) o; - return Objects.equals( - this.id, escalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.id) - && Objects.equals( - this.type, escalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.type) + EscalationPolicyStepTarget escalationPolicyStepTarget = (EscalationPolicyStepTarget) o; + return Objects.equals(this.id, escalationPolicyStepTarget.id) + && Objects.equals(this.type, escalationPolicyStepTarget.type) && Objects.equals( - this.additionalProperties, - escalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.additionalProperties); + this.additionalProperties, escalationPolicyStepTarget.additionalProperties); } @Override @@ -161,7 +151,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems {\n"); + sb.append("class EscalationPolicyStepTarget {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyStepTargetType.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyStepTargetType.java new file mode 100644 index 00000000000..9c564754376 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyStepTargetType.java @@ -0,0 +1,65 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Specifies the type of escalation target (example users, schedules, or + * teams). + */ +@JsonSerialize( + using = EscalationPolicyStepTargetType.EscalationPolicyStepTargetTypeSerializer.class) +public class EscalationPolicyStepTargetType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("users", "schedules", "teams")); + + public static final EscalationPolicyStepTargetType USERS = + new EscalationPolicyStepTargetType("users"); + public static final EscalationPolicyStepTargetType SCHEDULES = + new EscalationPolicyStepTargetType("schedules"); + public static final EscalationPolicyStepTargetType TEAMS = + new EscalationPolicyStepTargetType("teams"); + + EscalationPolicyStepTargetType(String value) { + super(value, allowedValues); + } + + public static class EscalationPolicyStepTargetTypeSerializer + extends StdSerializer { + public EscalationPolicyStepTargetTypeSerializer(Class t) { + super(t); + } + + public EscalationPolicyStepTargetTypeSerializer() { + this(null); + } + + @Override + public void serialize( + EscalationPolicyStepTargetType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EscalationPolicyStepTargetType fromValue(String value) { + return new EscalationPolicyStepTargetType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItems.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItems.java index 7789741dd6e..9caf3b0c93d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItems.java +++ b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItems.java @@ -34,7 +34,7 @@ public class EscalationPolicyUpdateRequestDataAttributesStepsItems { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ASSIGNMENT = "assignment"; - private EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment assignment; + private EscalationPolicyStepAttributesAssignment assignment; public static final String JSON_PROPERTY_ESCALATE_AFTER_SECONDS = "escalate_after_seconds"; private Long escalateAfterSeconds; @@ -43,20 +43,19 @@ public class EscalationPolicyUpdateRequestDataAttributesStepsItems { private String id; public static final String JSON_PROPERTY_TARGETS = "targets"; - private List targets = - new ArrayList<>(); + private List targets = new ArrayList<>(); public EscalationPolicyUpdateRequestDataAttributesStepsItems() {} @JsonCreator public EscalationPolicyUpdateRequestDataAttributesStepsItems( @JsonProperty(required = true, value = JSON_PROPERTY_TARGETS) - List targets) { + List targets) { this.targets = targets; } public EscalationPolicyUpdateRequestDataAttributesStepsItems assignment( - EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment assignment) { + EscalationPolicyStepAttributesAssignment assignment) { this.assignment = assignment; this.unparsed |= !assignment.isValid(); return this; @@ -71,12 +70,11 @@ public EscalationPolicyUpdateRequestDataAttributesStepsItems assignment( @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ASSIGNMENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment getAssignment() { + public EscalationPolicyStepAttributesAssignment getAssignment() { return assignment; } - public void setAssignment( - EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment assignment) { + public void setAssignment(EscalationPolicyStepAttributesAssignment assignment) { if (!assignment.isValid()) { this.unparsed = true; } @@ -127,16 +125,16 @@ public void setId(String id) { } public EscalationPolicyUpdateRequestDataAttributesStepsItems targets( - List targets) { + List targets) { this.targets = targets; - for (EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems item : targets) { + for (EscalationPolicyStepTarget item : targets) { this.unparsed |= item.unparsed; } return this; } public EscalationPolicyUpdateRequestDataAttributesStepsItems addTargetsItem( - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems targetsItem) { + EscalationPolicyStepTarget targetsItem) { this.targets.add(targetsItem); this.unparsed |= targetsItem.unparsed; return this; @@ -149,12 +147,11 @@ public EscalationPolicyUpdateRequestDataAttributesStepsItems addTargetsItem( */ @JsonProperty(JSON_PROPERTY_TARGETS) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getTargets() { + public List getTargets() { return targets; } - public void setTargets( - List targets) { + public void setTargets(List targets) { this.targets = targets; } diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment.java deleted file mode 100644 index 72293814862..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.ModelEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * Specifies how this escalation step will assign targets (example default or - * round-robin). - */ -@JsonSerialize( - using = - EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment - .EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignmentSerializer.class) -public class EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment - extends ModelEnum { - - private static final Set allowedValues = - new HashSet(Arrays.asList("default", "round-robin")); - - public static final EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment DEFAULT = - new EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment("default"); - public static final EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment ROUND_ROBIN = - new EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment("round-robin"); - - EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment(String value) { - super(value, allowedValues); - } - - public static class EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignmentSerializer - extends StdSerializer { - public EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignmentSerializer( - Class t) { - super(t); - } - - public EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignmentSerializer() { - this(null); - } - - @Override - public void serialize( - EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment value, - JsonGenerator jgen, - SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.value); - } - } - - @JsonCreator - public static EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment fromValue( - String value) { - return new EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment(value); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType.java deleted file mode 100644 index 99d24a8840e..00000000000 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. - * This product includes software developed at Datadog (https://www.datadoghq.com/). - * Copyright 2019-Present Datadog, Inc. - */ - -package com.datadog.api.client.v2.model; - -import com.datadog.api.client.ModelEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * Specifies the type of escalation target (example users, schedules, or - * teams). - */ -@JsonSerialize( - using = - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType - .EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsTypeSerializer.class) -public class EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType - extends ModelEnum { - - private static final Set allowedValues = - new HashSet(Arrays.asList("users", "schedules", "teams")); - - public static final EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType USERS = - new EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType("users"); - public static final EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType - SCHEDULES = - new EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType("schedules"); - public static final EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType TEAMS = - new EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType("teams"); - - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType(String value) { - super(value, allowedValues); - } - - public static - class EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsTypeSerializer - extends StdSerializer { - public EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsTypeSerializer( - Class t) { - super(t); - } - - public EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsTypeSerializer() { - this(null); - } - - @Override - public void serialize( - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType value, - JsonGenerator jgen, - SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.value); - } - } - - @JsonCreator - public static EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType fromValue( - String value) { - return new EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType(value); - } -} diff --git a/src/main/java/com/datadog/api/client/v2/model/RoutingRule.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRule.java new file mode 100644 index 00000000000..2c156d60233 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRule.java @@ -0,0 +1,234 @@ +/* + * 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; + +/** Represents a routing rule, including its attributes, relationships, and unique identifier. */ +@JsonPropertyOrder({ + RoutingRule.JSON_PROPERTY_ATTRIBUTES, + RoutingRule.JSON_PROPERTY_ID, + RoutingRule.JSON_PROPERTY_RELATIONSHIPS, + RoutingRule.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RoutingRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RoutingRuleAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private RoutingRuleRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private RoutingRuleType type = RoutingRuleType.TEAM_ROUTING_RULES; + + public RoutingRule() {} + + @JsonCreator + public RoutingRule( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) RoutingRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RoutingRule attributes(RoutingRuleAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Defines the configurable attributes of a routing rule, such as actions, query, time + * restriction, and urgency. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RoutingRuleAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RoutingRuleAttributes attributes) { + this.attributes = attributes; + } + + public RoutingRule id(String id) { + this.id = id; + return this; + } + + /** + * Specifies the unique identifier of this routing 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 RoutingRule relationships(RoutingRuleRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Specifies relationships for a routing rule, linking to associated policy resources. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RoutingRuleRelationships getRelationships() { + return relationships; + } + + public void setRelationships(RoutingRuleRelationships relationships) { + this.relationships = relationships; + } + + public RoutingRule type(RoutingRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Team routing rules resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RoutingRuleType getType() { + return type; + } + + public void setType(RoutingRuleType 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 RoutingRule + */ + @JsonAnySetter + public RoutingRule 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 RoutingRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RoutingRule routingRule = (RoutingRule) o; + return Objects.equals(this.attributes, routingRule.attributes) + && Objects.equals(this.id, routingRule.id) + && Objects.equals(this.relationships, routingRule.relationships) + && Objects.equals(this.type, routingRule.type) + && Objects.equals(this.additionalProperties, routingRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingRule {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/RoutingRuleAction.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAction.java new file mode 100644 index 00000000000..7e441d67465 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAction.java @@ -0,0 +1,269 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = RoutingRuleAction.RoutingRuleActionDeserializer.class) +@JsonSerialize(using = RoutingRuleAction.RoutingRuleActionSerializer.class) +public class RoutingRuleAction extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(RoutingRuleAction.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class RoutingRuleActionSerializer extends StdSerializer { + public RoutingRuleActionSerializer(Class t) { + super(t); + } + + public RoutingRuleActionSerializer() { + this(null); + } + + @Override + public void serialize(RoutingRuleAction value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class RoutingRuleActionDeserializer extends StdDeserializer { + public RoutingRuleActionDeserializer() { + this(RoutingRuleAction.class); + } + + public RoutingRuleActionDeserializer(Class vc) { + super(vc); + } + + @Override + public RoutingRuleAction deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize SlackAction + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SlackAction.class.equals(Integer.class) + || SlackAction.class.equals(Long.class) + || SlackAction.class.equals(Float.class) + || SlackAction.class.equals(Double.class) + || SlackAction.class.equals(Boolean.class) + || SlackAction.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SlackAction.class.equals(Integer.class) || SlackAction.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SlackAction.class.equals(Float.class) || SlackAction.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SlackAction.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SlackAction.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SlackAction.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SlackAction) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SlackAction'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SlackAction'", e); + } + + // deserialize TeamsAction + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TeamsAction.class.equals(Integer.class) + || TeamsAction.class.equals(Long.class) + || TeamsAction.class.equals(Float.class) + || TeamsAction.class.equals(Double.class) + || TeamsAction.class.equals(Boolean.class) + || TeamsAction.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TeamsAction.class.equals(Integer.class) || TeamsAction.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TeamsAction.class.equals(Float.class) || TeamsAction.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TeamsAction.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TeamsAction.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TeamsAction.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((TeamsAction) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TeamsAction'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'TeamsAction'", e); + } + + RoutingRuleAction ret = new RoutingRuleAction(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public RoutingRuleAction getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "RoutingRuleAction cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public RoutingRuleAction() { + super("oneOf", Boolean.FALSE); + } + + public RoutingRuleAction(SlackAction o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public RoutingRuleAction(TeamsAction o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SlackAction", new GenericType() {}); + schemas.put("TeamsAction", new GenericType() {}); + JSON.registerDescendants(RoutingRuleAction.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return RoutingRuleAction.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: SlackAction, TeamsAction + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(SlackAction.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(TeamsAction.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be SlackAction, TeamsAction"); + } + + /** + * Get the actual instance, which can be the following: SlackAction, TeamsAction + * + * @return The actual instance (SlackAction, TeamsAction) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SlackAction`. If the actual instance is not `SlackAction`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `SlackAction` + * @throws ClassCastException if the instance is not `SlackAction` + */ + public SlackAction getSlackAction() throws ClassCastException { + return (SlackAction) super.getActualInstance(); + } + + /** + * Get the actual instance of `TeamsAction`. If the actual instance is not `TeamsAction`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `TeamsAction` + * @throws ClassCastException if the instance is not `TeamsAction` + */ + public TeamsAction getTeamsAction() throws ClassCastException { + return (TeamsAction) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAttributes.java new file mode 100644 index 00000000000..15547b4228a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAttributes.java @@ -0,0 +1,240 @@ +/* + * 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; + +/** + * Defines the configurable attributes of a routing rule, such as actions, query, time restriction, + * and urgency. + */ +@JsonPropertyOrder({ + RoutingRuleAttributes.JSON_PROPERTY_ACTIONS, + RoutingRuleAttributes.JSON_PROPERTY_QUERY, + RoutingRuleAttributes.JSON_PROPERTY_TIME_RESTRICTION, + RoutingRuleAttributes.JSON_PROPERTY_URGENCY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RoutingRuleAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTIONS = "actions"; + private List actions = null; + + public static final String JSON_PROPERTY_QUERY = "query"; + private String query; + + public static final String JSON_PROPERTY_TIME_RESTRICTION = "time_restriction"; + private TimeRestrictions timeRestriction; + + public static final String JSON_PROPERTY_URGENCY = "urgency"; + private Urgency urgency; + + public RoutingRuleAttributes actions(List actions) { + this.actions = actions; + for (RoutingRuleAction item : actions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public RoutingRuleAttributes addActionsItem(RoutingRuleAction actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } + this.actions.add(actionsItem); + this.unparsed |= actionsItem.unparsed; + return this; + } + + /** + * Specifies the list of actions to perform when the routing rule matches. + * + * @return actions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getActions() { + return actions; + } + + public void setActions(List actions) { + this.actions = actions; + } + + public RoutingRuleAttributes query(String query) { + this.query = query; + return this; + } + + /** + * Defines the query or condition that triggers this routing rule. + * + * @return query + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public RoutingRuleAttributes timeRestriction(TimeRestrictions timeRestriction) { + this.timeRestriction = timeRestriction; + this.unparsed |= timeRestriction.unparsed; + return this; + } + + /** + * Holds time zone information and a list of time restrictions for a routing rule. + * + * @return timeRestriction + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIME_RESTRICTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TimeRestrictions getTimeRestriction() { + return timeRestriction; + } + + public void setTimeRestriction(TimeRestrictions timeRestriction) { + this.timeRestriction = timeRestriction; + } + + public RoutingRuleAttributes urgency(Urgency urgency) { + this.urgency = urgency; + this.unparsed |= !urgency.isValid(); + return this; + } + + /** + * Specifies the level of urgency for a routing rule (low, high, or dynamic). + * + * @return urgency + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URGENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Urgency getUrgency() { + return urgency; + } + + public void setUrgency(Urgency urgency) { + if (!urgency.isValid()) { + this.unparsed = true; + } + this.urgency = urgency; + } + + /** + * 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 RoutingRuleAttributes + */ + @JsonAnySetter + public RoutingRuleAttributes 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 RoutingRuleAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RoutingRuleAttributes routingRuleAttributes = (RoutingRuleAttributes) o; + return Objects.equals(this.actions, routingRuleAttributes.actions) + && Objects.equals(this.query, routingRuleAttributes.query) + && Objects.equals(this.timeRestriction, routingRuleAttributes.timeRestriction) + && Objects.equals(this.urgency, routingRuleAttributes.urgency) + && Objects.equals(this.additionalProperties, routingRuleAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(actions, query, timeRestriction, urgency, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingRuleAttributes {\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" timeRestriction: ").append(toIndentedString(timeRestriction)).append("\n"); + sb.append(" urgency: ").append(toIndentedString(urgency)).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/RoutingRuleRelationships.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationships.java new file mode 100644 index 00000000000..e1a5bf0677f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationships.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Specifies relationships for a routing rule, linking to associated policy resources. */ +@JsonPropertyOrder({RoutingRuleRelationships.JSON_PROPERTY_POLICY}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RoutingRuleRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_POLICY = "policy"; + private RoutingRuleRelationshipsPolicy policy; + + public RoutingRuleRelationships policy(RoutingRuleRelationshipsPolicy policy) { + this.policy = policy; + this.unparsed |= policy.unparsed; + return this; + } + + /** + * Defines the relationship that links a routing rule to a policy. + * + * @return policy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POLICY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RoutingRuleRelationshipsPolicy getPolicy() { + return policy; + } + + public void setPolicy(RoutingRuleRelationshipsPolicy policy) { + this.policy = policy; + } + + /** + * 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 RoutingRuleRelationships + */ + @JsonAnySetter + public RoutingRuleRelationships 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 RoutingRuleRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RoutingRuleRelationships routingRuleRelationships = (RoutingRuleRelationships) o; + return Objects.equals(this.policy, routingRuleRelationships.policy) + && Objects.equals(this.additionalProperties, routingRuleRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(policy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingRuleRelationships {\n"); + sb.append(" policy: ").append(toIndentedString(policy)).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/RoutingRuleRelationshipsPolicy.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicy.java new file mode 100644 index 00000000000..1e31339393f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicy.java @@ -0,0 +1,148 @@ +/* + * 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; + +/** Defines the relationship that links a routing rule to a policy. */ +@JsonPropertyOrder({RoutingRuleRelationshipsPolicy.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RoutingRuleRelationshipsPolicy { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RoutingRuleRelationshipsPolicyData data; + + public RoutingRuleRelationshipsPolicy() {} + + @JsonCreator + public RoutingRuleRelationshipsPolicy( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + RoutingRuleRelationshipsPolicyData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public RoutingRuleRelationshipsPolicy data(RoutingRuleRelationshipsPolicyData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Represents the policy data reference, containing the policy's ID and resource type. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RoutingRuleRelationshipsPolicyData getData() { + return data; + } + + public void setData(RoutingRuleRelationshipsPolicyData 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 RoutingRuleRelationshipsPolicy + */ + @JsonAnySetter + public RoutingRuleRelationshipsPolicy 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 RoutingRuleRelationshipsPolicy object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RoutingRuleRelationshipsPolicy routingRuleRelationshipsPolicy = + (RoutingRuleRelationshipsPolicy) o; + return Objects.equals(this.data, routingRuleRelationshipsPolicy.data) + && Objects.equals( + this.additionalProperties, routingRuleRelationshipsPolicy.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingRuleRelationshipsPolicy {\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/RoutingRuleRelationshipsPolicyData.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicyData.java new file mode 100644 index 00000000000..657ff3199f1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicyData.java @@ -0,0 +1,182 @@ +/* + * 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; + +/** Represents the policy data reference, containing the policy's ID and resource type. */ +@JsonPropertyOrder({ + RoutingRuleRelationshipsPolicyData.JSON_PROPERTY_ID, + RoutingRuleRelationshipsPolicyData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RoutingRuleRelationshipsPolicyData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private RoutingRuleRelationshipsPolicyDataType type = + RoutingRuleRelationshipsPolicyDataType.POLICIES; + + public RoutingRuleRelationshipsPolicyData() {} + + @JsonCreator + public RoutingRuleRelationshipsPolicyData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + RoutingRuleRelationshipsPolicyDataType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RoutingRuleRelationshipsPolicyData id(String id) { + this.id = id; + return this; + } + + /** + * Specifies the unique identifier of the policy. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public RoutingRuleRelationshipsPolicyData type(RoutingRuleRelationshipsPolicyDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Indicates that the resource is of type 'policies'. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RoutingRuleRelationshipsPolicyDataType getType() { + return type; + } + + public void setType(RoutingRuleRelationshipsPolicyDataType 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 RoutingRuleRelationshipsPolicyData + */ + @JsonAnySetter + public RoutingRuleRelationshipsPolicyData 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 RoutingRuleRelationshipsPolicyData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RoutingRuleRelationshipsPolicyData routingRuleRelationshipsPolicyData = + (RoutingRuleRelationshipsPolicyData) o; + return Objects.equals(this.id, routingRuleRelationshipsPolicyData.id) + && Objects.equals(this.type, routingRuleRelationshipsPolicyData.type) + && Objects.equals( + this.additionalProperties, routingRuleRelationshipsPolicyData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingRuleRelationshipsPolicyData {\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/RoutingRuleRelationshipsPolicyDataType.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicyDataType.java new file mode 100644 index 00000000000..f52c7a1d3f3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicyDataType.java @@ -0,0 +1,62 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Indicates that the resource is of type 'policies'. */ +@JsonSerialize( + using = + RoutingRuleRelationshipsPolicyDataType.RoutingRuleRelationshipsPolicyDataTypeSerializer + .class) +public class RoutingRuleRelationshipsPolicyDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("policies")); + + public static final RoutingRuleRelationshipsPolicyDataType POLICIES = + new RoutingRuleRelationshipsPolicyDataType("policies"); + + RoutingRuleRelationshipsPolicyDataType(String value) { + super(value, allowedValues); + } + + public static class RoutingRuleRelationshipsPolicyDataTypeSerializer + extends StdSerializer { + public RoutingRuleRelationshipsPolicyDataTypeSerializer( + Class t) { + super(t); + } + + public RoutingRuleRelationshipsPolicyDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + RoutingRuleRelationshipsPolicyDataType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RoutingRuleRelationshipsPolicyDataType fromValue(String value) { + return new RoutingRuleRelationshipsPolicyDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RoutingRuleType.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleType.java new file mode 100644 index 00000000000..bcd359e653b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Team routing rules resource type. */ +@JsonSerialize(using = RoutingRuleType.RoutingRuleTypeSerializer.class) +public class RoutingRuleType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("team_routing_rules")); + + public static final RoutingRuleType TEAM_ROUTING_RULES = + new RoutingRuleType("team_routing_rules"); + + RoutingRuleType(String value) { + super(value, allowedValues); + } + + public static class RoutingRuleTypeSerializer extends StdSerializer { + public RoutingRuleTypeSerializer(Class t) { + super(t); + } + + public RoutingRuleTypeSerializer() { + this(null); + } + + @Override + public void serialize(RoutingRuleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RoutingRuleType fromValue(String value) { + return new RoutingRuleType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SlackAction.java b/src/main/java/com/datadog/api/client/v2/model/SlackAction.java new file mode 100644 index 00000000000..1875c3d75ad --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SlackAction.java @@ -0,0 +1,201 @@ +/* + * 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; + +/** Sends a message to a Slack channel. */ +@JsonPropertyOrder({ + SlackAction.JSON_PROPERTY_CHANNEL, + SlackAction.JSON_PROPERTY_TYPE, + SlackAction.JSON_PROPERTY_WORKSPACE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SlackAction { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHANNEL = "channel"; + private String channel; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_WORKSPACE = "workspace"; + private String workspace; + + public SlackAction() {} + + @JsonCreator + public SlackAction( + @JsonProperty(required = true, value = JSON_PROPERTY_CHANNEL) String channel, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type, + @JsonProperty(required = true, value = JSON_PROPERTY_WORKSPACE) String workspace) { + this.channel = channel; + this.type = type; + this.workspace = workspace; + } + + public SlackAction channel(String channel) { + this.channel = channel; + return this; + } + + /** + * The channel ID. + * + * @return channel + */ + @JsonProperty(JSON_PROPERTY_CHANNEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChannel() { + return channel; + } + + public void setChannel(String channel) { + this.channel = channel; + } + + public SlackAction type(String type) { + this.type = type; + return this; + } + + /** + * Must be set to "send_slack_message". + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public SlackAction workspace(String workspace) { + this.workspace = workspace; + return this; + } + + /** + * The workspace ID. + * + * @return workspace + */ + @JsonProperty(JSON_PROPERTY_WORKSPACE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 SlackAction + */ + @JsonAnySetter + public SlackAction 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 SlackAction object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SlackAction slackAction = (SlackAction) o; + return Objects.equals(this.channel, slackAction.channel) + && Objects.equals(this.type, slackAction.type) + && Objects.equals(this.workspace, slackAction.workspace) + && Objects.equals(this.additionalProperties, slackAction.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(channel, type, workspace, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SlackAction {\n"); + sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/TeamRoutingRules.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRules.java new file mode 100644 index 00000000000..58e35fce3d9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRules.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; + +/** + * Represents a complete set of team routing rules, including data and optionally included related + * resources. + */ +@JsonPropertyOrder({TeamRoutingRules.JSON_PROPERTY_DATA, TeamRoutingRules.JSON_PROPERTY_INCLUDED}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRoutingRules { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TeamRoutingRulesData data; + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public TeamRoutingRules data(TeamRoutingRulesData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Represents the top-level data object for team routing rules, containing the ID, relationships, + * and resource type. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamRoutingRulesData getData() { + return data; + } + + public void setData(TeamRoutingRulesData data) { + this.data = data; + } + + public TeamRoutingRules included(List included) { + this.included = included; + for (TeamRoutingRulesIncluded item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamRoutingRules addIncludedItem(TeamRoutingRulesIncluded includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Provides related routing rules or other included resources. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + /** + * 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 TeamRoutingRules + */ + @JsonAnySetter + public TeamRoutingRules 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 TeamRoutingRules object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRoutingRules teamRoutingRules = (TeamRoutingRules) o; + return Objects.equals(this.data, teamRoutingRules.data) + && Objects.equals(this.included, teamRoutingRules.included) + && Objects.equals(this.additionalProperties, teamRoutingRules.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRoutingRules {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).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/TeamRoutingRulesData.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesData.java new file mode 100644 index 00000000000..b795e73f64b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesData.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; + +/** + * Represents the top-level data object for team routing rules, containing the ID, relationships, + * and resource type. + */ +@JsonPropertyOrder({ + TeamRoutingRulesData.JSON_PROPERTY_ID, + TeamRoutingRulesData.JSON_PROPERTY_RELATIONSHIPS, + TeamRoutingRulesData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRoutingRulesData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private TeamRoutingRulesDataRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamRoutingRulesDataType type = TeamRoutingRulesDataType.TEAM_ROUTING_RULES; + + public TeamRoutingRulesData() {} + + @JsonCreator + public TeamRoutingRulesData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamRoutingRulesDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamRoutingRulesData id(String id) { + this.id = id; + return this; + } + + /** + * Specifies the unique identifier of this team routing rules record. + * + * @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 TeamRoutingRulesData relationships(TeamRoutingRulesDataRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Specifies relationships for team routing rules, including rule references. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamRoutingRulesDataRelationships getRelationships() { + return relationships; + } + + public void setRelationships(TeamRoutingRulesDataRelationships relationships) { + this.relationships = relationships; + } + + public TeamRoutingRulesData type(TeamRoutingRulesDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Team routing rules resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamRoutingRulesDataType getType() { + return type; + } + + public void setType(TeamRoutingRulesDataType 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 TeamRoutingRulesData + */ + @JsonAnySetter + public TeamRoutingRulesData 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 TeamRoutingRulesData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRoutingRulesData teamRoutingRulesData = (TeamRoutingRulesData) o; + return Objects.equals(this.id, teamRoutingRulesData.id) + && Objects.equals(this.relationships, teamRoutingRulesData.relationships) + && Objects.equals(this.type, teamRoutingRulesData.type) + && Objects.equals(this.additionalProperties, teamRoutingRulesData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRoutingRulesData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/TeamRoutingRulesDataRelationships.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationships.java new file mode 100644 index 00000000000..88e75f7119c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationships.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; + +/** Specifies relationships for team routing rules, including rule references. */ +@JsonPropertyOrder({TeamRoutingRulesDataRelationships.JSON_PROPERTY_RULES}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRoutingRulesDataRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_RULES = "rules"; + private TeamRoutingRulesDataRelationshipsRules rules; + + public TeamRoutingRulesDataRelationships rules(TeamRoutingRulesDataRelationshipsRules rules) { + this.rules = rules; + this.unparsed |= rules.unparsed; + return this; + } + + /** + * Holds references to a set of routing rules in a relationship. + * + * @return rules + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamRoutingRulesDataRelationshipsRules getRules() { + return rules; + } + + public void setRules(TeamRoutingRulesDataRelationshipsRules rules) { + this.rules = rules; + } + + /** + * 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 TeamRoutingRulesDataRelationships + */ + @JsonAnySetter + public TeamRoutingRulesDataRelationships 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 TeamRoutingRulesDataRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRoutingRulesDataRelationships teamRoutingRulesDataRelationships = + (TeamRoutingRulesDataRelationships) o; + return Objects.equals(this.rules, teamRoutingRulesDataRelationships.rules) + && Objects.equals( + this.additionalProperties, teamRoutingRulesDataRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(rules, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRoutingRulesDataRelationships {\n"); + sb.append(" rules: ").append(toIndentedString(rules)).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/TeamRoutingRulesDataRelationshipsRules.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationshipsRules.java new file mode 100644 index 00000000000..9befaa83eee --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationshipsRules.java @@ -0,0 +1,153 @@ +/* + * 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; + +/** Holds references to a set of routing rules in a relationship. */ +@JsonPropertyOrder({TeamRoutingRulesDataRelationshipsRules.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRoutingRulesDataRelationshipsRules { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public TeamRoutingRulesDataRelationshipsRules data( + List data) { + this.data = data; + for (TeamRoutingRulesDataRelationshipsRulesDataItems item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamRoutingRulesDataRelationshipsRules addDataItem( + TeamRoutingRulesDataRelationshipsRulesDataItems dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * An array of references to the routing rules associated with this team. + * + * @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; + } + + /** + * 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 TeamRoutingRulesDataRelationshipsRules + */ + @JsonAnySetter + public TeamRoutingRulesDataRelationshipsRules 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 TeamRoutingRulesDataRelationshipsRules object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRoutingRulesDataRelationshipsRules teamRoutingRulesDataRelationshipsRules = + (TeamRoutingRulesDataRelationshipsRules) o; + return Objects.equals(this.data, teamRoutingRulesDataRelationshipsRules.data) + && Objects.equals( + this.additionalProperties, teamRoutingRulesDataRelationshipsRules.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRoutingRulesDataRelationshipsRules {\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/EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationshipsRulesDataItems.java similarity index 62% rename from src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.java rename to src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationshipsRulesDataItems.java index b78f70905b8..0e02c7f239d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.java +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationshipsRulesDataItems.java @@ -8,6 +8,7 @@ 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; @@ -16,37 +17,46 @@ import java.util.Map; import java.util.Objects; -/** - * Defines a single escalation target within a step for an escalation policy update request. - * Contains id and type. - */ +/** Defines a relationship item to link a routing rule by its ID and type. */ @JsonPropertyOrder({ - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.JSON_PROPERTY_ID, - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.JSON_PROPERTY_TYPE + TeamRoutingRulesDataRelationshipsRulesDataItems.JSON_PROPERTY_ID, + TeamRoutingRulesDataRelationshipsRulesDataItems.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems { +public class TeamRoutingRulesDataRelationshipsRulesDataItems { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ID = "id"; private String id; public static final String JSON_PROPERTY_TYPE = "type"; - private EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType type; + private TeamRoutingRulesDataRelationshipsRulesDataItemsType type = + TeamRoutingRulesDataRelationshipsRulesDataItemsType.TEAM_ROUTING_RULES; + + public TeamRoutingRulesDataRelationshipsRulesDataItems() {} + + @JsonCreator + public TeamRoutingRulesDataRelationshipsRulesDataItems( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + TeamRoutingRulesDataRelationshipsRulesDataItemsType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } - public EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems id(String id) { + public TeamRoutingRulesDataRelationshipsRulesDataItems id(String id) { this.id = id; return this; } /** - * Specifies the unique identifier for this target. + * Specifies the unique identifier for the related routing rule. * * @return id */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getId() { return id; } @@ -55,27 +65,25 @@ public void setId(String id) { this.id = id; } - public EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems type( - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType type) { + public TeamRoutingRulesDataRelationshipsRulesDataItems type( + TeamRoutingRulesDataRelationshipsRulesDataItemsType type) { this.type = type; this.unparsed |= !type.isValid(); return this; } /** - * Specifies the type of escalation target (example users, schedules, or - * teams). + * Indicates that the resource is of type 'team_routing_rules'. * * @return type */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType getType() { + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamRoutingRulesDataRelationshipsRulesDataItemsType getType() { return type; } - public void setType(EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType type) { + public void setType(TeamRoutingRulesDataRelationshipsRulesDataItemsType type) { if (!type.isValid()) { this.unparsed = true; } @@ -94,10 +102,10 @@ public void setType(EscalationPolicyUpdateRequestDataAttributesStepsItemsTargets * * @param key The arbitrary key to set * @param value The associated value - * @return EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems + * @return TeamRoutingRulesDataRelationshipsRulesDataItems */ @JsonAnySetter - public EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems putAdditionalProperty( + public TeamRoutingRulesDataRelationshipsRulesDataItems putAdditionalProperty( String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); @@ -129,10 +137,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** - * Return true if this EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems object is - * equal to o. - */ + /** Return true if this TeamRoutingRulesDataRelationshipsRulesDataItems object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -141,16 +146,14 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems - escalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems = - (EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems) o; - return Objects.equals( - this.id, escalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.id) - && Objects.equals( - this.type, escalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.type) + TeamRoutingRulesDataRelationshipsRulesDataItems + teamRoutingRulesDataRelationshipsRulesDataItems = + (TeamRoutingRulesDataRelationshipsRulesDataItems) o; + return Objects.equals(this.id, teamRoutingRulesDataRelationshipsRulesDataItems.id) + && Objects.equals(this.type, teamRoutingRulesDataRelationshipsRulesDataItems.type) && Objects.equals( this.additionalProperties, - escalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.additionalProperties); + teamRoutingRulesDataRelationshipsRulesDataItems.additionalProperties); } @Override @@ -161,7 +164,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems {\n"); + sb.append("class TeamRoutingRulesDataRelationshipsRulesDataItems {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationshipsRulesDataItemsType.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationshipsRulesDataItemsType.java new file mode 100644 index 00000000000..cc3f74a8efc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataRelationshipsRulesDataItemsType.java @@ -0,0 +1,63 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Indicates that the resource is of type 'team_routing_rules'. */ +@JsonSerialize( + using = + TeamRoutingRulesDataRelationshipsRulesDataItemsType + .TeamRoutingRulesDataRelationshipsRulesDataItemsTypeSerializer.class) +public class TeamRoutingRulesDataRelationshipsRulesDataItemsType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("team_routing_rules")); + + public static final TeamRoutingRulesDataRelationshipsRulesDataItemsType TEAM_ROUTING_RULES = + new TeamRoutingRulesDataRelationshipsRulesDataItemsType("team_routing_rules"); + + TeamRoutingRulesDataRelationshipsRulesDataItemsType(String value) { + super(value, allowedValues); + } + + public static class TeamRoutingRulesDataRelationshipsRulesDataItemsTypeSerializer + extends StdSerializer { + public TeamRoutingRulesDataRelationshipsRulesDataItemsTypeSerializer( + Class t) { + super(t); + } + + public TeamRoutingRulesDataRelationshipsRulesDataItemsTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TeamRoutingRulesDataRelationshipsRulesDataItemsType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamRoutingRulesDataRelationshipsRulesDataItemsType fromValue(String value) { + return new TeamRoutingRulesDataRelationshipsRulesDataItemsType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataType.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataType.java new file mode 100644 index 00000000000..4af46081f34 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesDataType.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 routing rules resource type. */ +@JsonSerialize(using = TeamRoutingRulesDataType.TeamRoutingRulesDataTypeSerializer.class) +public class TeamRoutingRulesDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("team_routing_rules")); + + public static final TeamRoutingRulesDataType TEAM_ROUTING_RULES = + new TeamRoutingRulesDataType("team_routing_rules"); + + TeamRoutingRulesDataType(String value) { + super(value, allowedValues); + } + + public static class TeamRoutingRulesDataTypeSerializer + extends StdSerializer { + public TeamRoutingRulesDataTypeSerializer(Class t) { + super(t); + } + + public TeamRoutingRulesDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TeamRoutingRulesDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamRoutingRulesDataType fromValue(String value) { + return new TeamRoutingRulesDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesIncluded.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesIncluded.java new file mode 100644 index 00000000000..04d411b2536 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesIncluded.java @@ -0,0 +1,210 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = TeamRoutingRulesIncluded.TeamRoutingRulesIncludedDeserializer.class) +@JsonSerialize(using = TeamRoutingRulesIncluded.TeamRoutingRulesIncludedSerializer.class) +public class TeamRoutingRulesIncluded extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(TeamRoutingRulesIncluded.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class TeamRoutingRulesIncludedSerializer + extends StdSerializer { + public TeamRoutingRulesIncludedSerializer(Class t) { + super(t); + } + + public TeamRoutingRulesIncludedSerializer() { + this(null); + } + + @Override + public void serialize( + TeamRoutingRulesIncluded value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TeamRoutingRulesIncludedDeserializer + extends StdDeserializer { + public TeamRoutingRulesIncludedDeserializer() { + this(TeamRoutingRulesIncluded.class); + } + + public TeamRoutingRulesIncludedDeserializer(Class vc) { + super(vc); + } + + @Override + public TeamRoutingRulesIncluded deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize RoutingRule + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (RoutingRule.class.equals(Integer.class) + || RoutingRule.class.equals(Long.class) + || RoutingRule.class.equals(Float.class) + || RoutingRule.class.equals(Double.class) + || RoutingRule.class.equals(Boolean.class) + || RoutingRule.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((RoutingRule.class.equals(Integer.class) || RoutingRule.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((RoutingRule.class.equals(Float.class) || RoutingRule.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (RoutingRule.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (RoutingRule.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(RoutingRule.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((RoutingRule) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'RoutingRule'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'RoutingRule'", e); + } + + TeamRoutingRulesIncluded ret = new TeamRoutingRulesIncluded(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public TeamRoutingRulesIncluded getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "TeamRoutingRulesIncluded cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public TeamRoutingRulesIncluded() { + super("oneOf", Boolean.FALSE); + } + + public TeamRoutingRulesIncluded(RoutingRule o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("RoutingRule", new GenericType() {}); + JSON.registerDescendants(TeamRoutingRulesIncluded.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return TeamRoutingRulesIncluded.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: RoutingRule + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(RoutingRule.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be RoutingRule"); + } + + /** + * Get the actual instance, which can be the following: RoutingRule + * + * @return The actual instance (RoutingRule) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `RoutingRule`. If the actual instance is not `RoutingRule`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `RoutingRule` + * @throws ClassCastException if the instance is not `RoutingRule` + */ + public RoutingRule getRoutingRule() throws ClassCastException { + return (RoutingRule) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequest.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequest.java new file mode 100644 index 00000000000..324cf979e57 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequest.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; + +/** Represents a request to create or update team routing rules, including the data payload. */ +@JsonPropertyOrder({TeamRoutingRulesRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRoutingRulesRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TeamRoutingRulesRequestData data; + + public TeamRoutingRulesRequest data(TeamRoutingRulesRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Holds the data necessary to create or update team routing rules, including attributes, ID, and + * resource type. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamRoutingRulesRequestData getData() { + return data; + } + + public void setData(TeamRoutingRulesRequestData 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 TeamRoutingRulesRequest + */ + @JsonAnySetter + public TeamRoutingRulesRequest 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 TeamRoutingRulesRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRoutingRulesRequest teamRoutingRulesRequest = (TeamRoutingRulesRequest) o; + return Objects.equals(this.data, teamRoutingRulesRequest.data) + && Objects.equals(this.additionalProperties, teamRoutingRulesRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRoutingRulesRequest {\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/TeamRoutingRulesRequestData.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestData.java new file mode 100644 index 00000000000..8278ca73e5a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestData.java @@ -0,0 +1,210 @@ +/* + * 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; + +/** + * Holds the data necessary to create or update team routing rules, including attributes, ID, and + * resource type. + */ +@JsonPropertyOrder({ + TeamRoutingRulesRequestData.JSON_PROPERTY_ATTRIBUTES, + TeamRoutingRulesRequestData.JSON_PROPERTY_ID, + TeamRoutingRulesRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRoutingRulesRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TeamRoutingRulesRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamRoutingRulesRequestDataType type = TeamRoutingRulesRequestDataType.TEAM_ROUTING_RULES; + + public TeamRoutingRulesRequestData() {} + + @JsonCreator + public TeamRoutingRulesRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + TeamRoutingRulesRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamRoutingRulesRequestData attributes(TeamRoutingRulesRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Represents the attributes of a request to update or create team routing rules. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamRoutingRulesRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TeamRoutingRulesRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public TeamRoutingRulesRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Specifies the unique identifier for this set of team routing rules. + * + * @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 TeamRoutingRulesRequestData type(TeamRoutingRulesRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Team routing rules resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamRoutingRulesRequestDataType getType() { + return type; + } + + public void setType(TeamRoutingRulesRequestDataType 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 TeamRoutingRulesRequestData + */ + @JsonAnySetter + public TeamRoutingRulesRequestData 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 TeamRoutingRulesRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRoutingRulesRequestData teamRoutingRulesRequestData = (TeamRoutingRulesRequestData) o; + return Objects.equals(this.attributes, teamRoutingRulesRequestData.attributes) + && Objects.equals(this.id, teamRoutingRulesRequestData.id) + && Objects.equals(this.type, teamRoutingRulesRequestData.type) + && Objects.equals( + this.additionalProperties, teamRoutingRulesRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRoutingRulesRequestData {\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/TeamRoutingRulesRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestDataAttributes.java new file mode 100644 index 00000000000..cbeb8da2aae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestDataAttributes.java @@ -0,0 +1,151 @@ +/* + * 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; + +/** Represents the attributes of a request to update or create team routing rules. */ +@JsonPropertyOrder({TeamRoutingRulesRequestDataAttributes.JSON_PROPERTY_RULES}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRoutingRulesRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_RULES = "rules"; + private List rules = null; + + public TeamRoutingRulesRequestDataAttributes rules(List rules) { + this.rules = rules; + for (TeamRoutingRulesRequestRule item : rules) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamRoutingRulesRequestDataAttributes addRulesItem(TeamRoutingRulesRequestRule rulesItem) { + if (this.rules == null) { + this.rules = new ArrayList<>(); + } + this.rules.add(rulesItem); + this.unparsed |= rulesItem.unparsed; + return this; + } + + /** + * A list of routing rule items that define how incoming pages should be handled. + * + * @return rules + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getRules() { + return rules; + } + + public void setRules(List rules) { + this.rules = rules; + } + + /** + * 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 TeamRoutingRulesRequestDataAttributes + */ + @JsonAnySetter + public TeamRoutingRulesRequestDataAttributes 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 TeamRoutingRulesRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRoutingRulesRequestDataAttributes teamRoutingRulesRequestDataAttributes = + (TeamRoutingRulesRequestDataAttributes) o; + return Objects.equals(this.rules, teamRoutingRulesRequestDataAttributes.rules) + && Objects.equals( + this.additionalProperties, teamRoutingRulesRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(rules, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRoutingRulesRequestDataAttributes {\n"); + sb.append(" rules: ").append(toIndentedString(rules)).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/TeamRoutingRulesRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestDataType.java new file mode 100644 index 00000000000..2e51aef7349 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestDataType.java @@ -0,0 +1,58 @@ +/* + * 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 routing rules resource type. */ +@JsonSerialize( + using = TeamRoutingRulesRequestDataType.TeamRoutingRulesRequestDataTypeSerializer.class) +public class TeamRoutingRulesRequestDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("team_routing_rules")); + + public static final TeamRoutingRulesRequestDataType TEAM_ROUTING_RULES = + new TeamRoutingRulesRequestDataType("team_routing_rules"); + + TeamRoutingRulesRequestDataType(String value) { + super(value, allowedValues); + } + + public static class TeamRoutingRulesRequestDataTypeSerializer + extends StdSerializer { + public TeamRoutingRulesRequestDataTypeSerializer(Class t) { + super(t); + } + + public TeamRoutingRulesRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TeamRoutingRulesRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamRoutingRulesRequestDataType fromValue(String value) { + return new TeamRoutingRulesRequestDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestRule.java b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestRule.java new file mode 100644 index 00000000000..5768dd59608 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamRoutingRulesRequestRule.java @@ -0,0 +1,265 @@ +/* + * 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; + +/** Defines an individual routing rule item that contains the rule data for the request. */ +@JsonPropertyOrder({ + TeamRoutingRulesRequestRule.JSON_PROPERTY_ACTIONS, + TeamRoutingRulesRequestRule.JSON_PROPERTY_POLICY_ID, + TeamRoutingRulesRequestRule.JSON_PROPERTY_QUERY, + TeamRoutingRulesRequestRule.JSON_PROPERTY_TIME_RESTRICTION, + TeamRoutingRulesRequestRule.JSON_PROPERTY_URGENCY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamRoutingRulesRequestRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTIONS = "actions"; + private List actions = null; + + public static final String JSON_PROPERTY_POLICY_ID = "policy_id"; + private String policyId; + + public static final String JSON_PROPERTY_QUERY = "query"; + private String query; + + public static final String JSON_PROPERTY_TIME_RESTRICTION = "time_restriction"; + private TimeRestrictions timeRestriction; + + public static final String JSON_PROPERTY_URGENCY = "urgency"; + private Urgency urgency; + + public TeamRoutingRulesRequestRule actions(List actions) { + this.actions = actions; + for (RoutingRuleAction item : actions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamRoutingRulesRequestRule addActionsItem(RoutingRuleAction actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } + this.actions.add(actionsItem); + this.unparsed |= actionsItem.unparsed; + return this; + } + + /** + * Specifies the list of actions to perform when the routing rule is matched. + * + * @return actions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getActions() { + return actions; + } + + public void setActions(List actions) { + this.actions = actions; + } + + public TeamRoutingRulesRequestRule policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Identifies the policy to be applied when this routing rule matches. + * + * @return policyId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POLICY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPolicyId() { + return policyId; + } + + public void setPolicyId(String policyId) { + this.policyId = policyId; + } + + public TeamRoutingRulesRequestRule query(String query) { + this.query = query; + return this; + } + + /** + * Defines the query or condition that triggers this routing rule. + * + * @return query + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public TeamRoutingRulesRequestRule timeRestriction(TimeRestrictions timeRestriction) { + this.timeRestriction = timeRestriction; + this.unparsed |= timeRestriction.unparsed; + return this; + } + + /** + * Holds time zone information and a list of time restrictions for a routing rule. + * + * @return timeRestriction + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIME_RESTRICTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TimeRestrictions getTimeRestriction() { + return timeRestriction; + } + + public void setTimeRestriction(TimeRestrictions timeRestriction) { + this.timeRestriction = timeRestriction; + } + + public TeamRoutingRulesRequestRule urgency(Urgency urgency) { + this.urgency = urgency; + this.unparsed |= !urgency.isValid(); + return this; + } + + /** + * Specifies the level of urgency for a routing rule (low, high, or dynamic). + * + * @return urgency + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URGENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Urgency getUrgency() { + return urgency; + } + + public void setUrgency(Urgency urgency) { + if (!urgency.isValid()) { + this.unparsed = true; + } + this.urgency = urgency; + } + + /** + * 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 TeamRoutingRulesRequestRule + */ + @JsonAnySetter + public TeamRoutingRulesRequestRule 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 TeamRoutingRulesRequestRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamRoutingRulesRequestRule teamRoutingRulesRequestRule = (TeamRoutingRulesRequestRule) o; + return Objects.equals(this.actions, teamRoutingRulesRequestRule.actions) + && Objects.equals(this.policyId, teamRoutingRulesRequestRule.policyId) + && Objects.equals(this.query, teamRoutingRulesRequestRule.query) + && Objects.equals(this.timeRestriction, teamRoutingRulesRequestRule.timeRestriction) + && Objects.equals(this.urgency, teamRoutingRulesRequestRule.urgency) + && Objects.equals( + this.additionalProperties, teamRoutingRulesRequestRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(actions, policyId, query, timeRestriction, urgency, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamRoutingRulesRequestRule {\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" policyId: ").append(toIndentedString(policyId)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" timeRestriction: ").append(toIndentedString(timeRestriction)).append("\n"); + sb.append(" urgency: ").append(toIndentedString(urgency)).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/TeamsAction.java b/src/main/java/com/datadog/api/client/v2/model/TeamsAction.java new file mode 100644 index 00000000000..231ed7170a4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamsAction.java @@ -0,0 +1,229 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.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; + +/** Sends a message to a Microsoft Teams channel. */ +@JsonPropertyOrder({ + TeamsAction.JSON_PROPERTY_CHANNEL, + TeamsAction.JSON_PROPERTY_TEAM, + TeamsAction.JSON_PROPERTY_TENANT, + TeamsAction.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamsAction { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHANNEL = "channel"; + private String channel; + + public static final String JSON_PROPERTY_TEAM = "team"; + private String team; + + public static final String JSON_PROPERTY_TENANT = "tenant"; + private String tenant; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public TeamsAction() {} + + @JsonCreator + public TeamsAction( + @JsonProperty(required = true, value = JSON_PROPERTY_CHANNEL) String channel, + @JsonProperty(required = true, value = JSON_PROPERTY_TEAM) String team, + @JsonProperty(required = true, value = JSON_PROPERTY_TENANT) String tenant, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.channel = channel; + this.team = team; + this.tenant = tenant; + this.type = type; + } + + public TeamsAction channel(String channel) { + this.channel = channel; + return this; + } + + /** + * The channel ID. + * + * @return channel + */ + @JsonProperty(JSON_PROPERTY_CHANNEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getChannel() { + return channel; + } + + public void setChannel(String channel) { + this.channel = channel; + } + + public TeamsAction team(String team) { + this.team = team; + return this; + } + + /** + * The team ID. + * + * @return team + */ + @JsonProperty(JSON_PROPERTY_TEAM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTeam() { + return team; + } + + public void setTeam(String team) { + this.team = team; + } + + public TeamsAction tenant(String tenant) { + this.tenant = tenant; + return this; + } + + /** + * The tenant ID. + * + * @return tenant + */ + @JsonProperty(JSON_PROPERTY_TENANT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + public TeamsAction type(String type) { + this.type = type; + return this; + } + + /** + * Must be set to "send_teams_message". + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 TeamsAction + */ + @JsonAnySetter + public TeamsAction 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 TeamsAction object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamsAction teamsAction = (TeamsAction) o; + return Objects.equals(this.channel, teamsAction.channel) + && Objects.equals(this.team, teamsAction.team) + && Objects.equals(this.tenant, teamsAction.tenant) + && Objects.equals(this.type, teamsAction.type) + && Objects.equals(this.additionalProperties, teamsAction.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(channel, team, tenant, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamsAction {\n"); + sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" team: ").append(toIndentedString(team)).append("\n"); + sb.append(" tenant: ").append(toIndentedString(tenant)).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/TimeRestriction.java b/src/main/java/com/datadog/api/client/v2/model/TimeRestriction.java new file mode 100644 index 00000000000..7c1af779ae2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TimeRestriction.java @@ -0,0 +1,226 @@ +/* + * 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; + +/** Defines a single time restriction rule with start and end times and the applicable weekdays. */ +@JsonPropertyOrder({ + TimeRestriction.JSON_PROPERTY_END_DAY, + TimeRestriction.JSON_PROPERTY_END_TIME, + TimeRestriction.JSON_PROPERTY_START_DAY, + TimeRestriction.JSON_PROPERTY_START_TIME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TimeRestriction { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_END_DAY = "end_day"; + private Weekday endDay; + + public static final String JSON_PROPERTY_END_TIME = "end_time"; + private String endTime; + + public static final String JSON_PROPERTY_START_DAY = "start_day"; + private Weekday startDay; + + public static final String JSON_PROPERTY_START_TIME = "start_time"; + private String startTime; + + public TimeRestriction endDay(Weekday endDay) { + this.endDay = endDay; + this.unparsed |= !endDay.isValid(); + return this; + } + + /** + * A day of the week. + * + * @return endDay + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_END_DAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Weekday getEndDay() { + return endDay; + } + + public void setEndDay(Weekday endDay) { + if (!endDay.isValid()) { + this.unparsed = true; + } + this.endDay = endDay; + } + + public TimeRestriction endTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Specifies the ending time for this restriction. + * + * @return endTime + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_END_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public TimeRestriction startDay(Weekday startDay) { + this.startDay = startDay; + this.unparsed |= !startDay.isValid(); + return this; + } + + /** + * A day of the week. + * + * @return startDay + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_START_DAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Weekday getStartDay() { + return startDay; + } + + public void setStartDay(Weekday startDay) { + if (!startDay.isValid()) { + this.unparsed = true; + } + this.startDay = startDay; + } + + public TimeRestriction startTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Specifies the starting time for this restriction. + * + * @return startTime + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_START_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + /** + * 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 TimeRestriction + */ + @JsonAnySetter + public TimeRestriction 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 TimeRestriction object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TimeRestriction timeRestriction = (TimeRestriction) o; + return Objects.equals(this.endDay, timeRestriction.endDay) + && Objects.equals(this.endTime, timeRestriction.endTime) + && Objects.equals(this.startDay, timeRestriction.startDay) + && Objects.equals(this.startTime, timeRestriction.startTime) + && Objects.equals(this.additionalProperties, timeRestriction.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(endDay, endTime, startDay, startTime, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TimeRestriction {\n"); + sb.append(" endDay: ").append(toIndentedString(endDay)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" startDay: ").append(toIndentedString(startDay)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).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/TimeRestrictions.java b/src/main/java/com/datadog/api/client/v2/model/TimeRestrictions.java new file mode 100644 index 00000000000..8b246fc5d40 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TimeRestrictions.java @@ -0,0 +1,185 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Holds time zone information and a list of time restrictions for a routing rule. */ +@JsonPropertyOrder({ + TimeRestrictions.JSON_PROPERTY_RESTRICTIONS, + TimeRestrictions.JSON_PROPERTY_TIME_ZONE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TimeRestrictions { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_RESTRICTIONS = "restrictions"; + private List restrictions = new ArrayList<>(); + + public static final String JSON_PROPERTY_TIME_ZONE = "time_zone"; + private String timeZone; + + public TimeRestrictions() {} + + @JsonCreator + public TimeRestrictions( + @JsonProperty(required = true, value = JSON_PROPERTY_RESTRICTIONS) + List restrictions, + @JsonProperty(required = true, value = JSON_PROPERTY_TIME_ZONE) String timeZone) { + this.restrictions = restrictions; + this.timeZone = timeZone; + } + + public TimeRestrictions restrictions(List restrictions) { + this.restrictions = restrictions; + for (TimeRestriction item : restrictions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TimeRestrictions addRestrictionsItem(TimeRestriction restrictionsItem) { + this.restrictions.add(restrictionsItem); + this.unparsed |= restrictionsItem.unparsed; + return this; + } + + /** + * Defines the list of time-based restrictions. + * + * @return restrictions + */ + @JsonProperty(JSON_PROPERTY_RESTRICTIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRestrictions() { + return restrictions; + } + + public void setRestrictions(List restrictions) { + this.restrictions = restrictions; + } + + public TimeRestrictions timeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Specifies the time zone applicable to the restrictions. + * + * @return timeZone + */ + @JsonProperty(JSON_PROPERTY_TIME_ZONE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTimeZone() { + return timeZone; + } + + public void setTimeZone(String timeZone) { + this.timeZone = timeZone; + } + + /** + * 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 TimeRestrictions + */ + @JsonAnySetter + public TimeRestrictions 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 TimeRestrictions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TimeRestrictions timeRestrictions = (TimeRestrictions) o; + return Objects.equals(this.restrictions, timeRestrictions.restrictions) + && Objects.equals(this.timeZone, timeRestrictions.timeZone) + && Objects.equals(this.additionalProperties, timeRestrictions.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(restrictions, timeZone, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TimeRestrictions {\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append(" timeZone: ").append(toIndentedString(timeZone)).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/Urgency.java b/src/main/java/com/datadog/api/client/v2/model/Urgency.java new file mode 100644 index 00000000000..c98f41b6f3c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Urgency.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Specifies the level of urgency for a routing rule (low, high, or dynamic). */ +@JsonSerialize(using = Urgency.UrgencySerializer.class) +public class Urgency extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("low", "high", "dynamic")); + + public static final Urgency LOW = new Urgency("low"); + public static final Urgency HIGH = new Urgency("high"); + public static final Urgency DYNAMIC = new Urgency("dynamic"); + + Urgency(String value) { + super(value, allowedValues); + } + + public static class UrgencySerializer extends StdSerializer { + public UrgencySerializer(Class t) { + super(t); + } + + public UrgencySerializer() { + this(null); + } + + @Override + public void serialize(Urgency value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static Urgency fromValue(String value) { + return new Urgency(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/Weekday.java b/src/main/java/com/datadog/api/client/v2/model/Weekday.java new file mode 100644 index 00000000000..eba4ec1d69f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Weekday.java @@ -0,0 +1,62 @@ +/* + * 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; + +/** A day of the week. */ +@JsonSerialize(using = Weekday.WeekdaySerializer.class) +public class Weekday extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday")); + + public static final Weekday MONDAY = new Weekday("monday"); + public static final Weekday TUESDAY = new Weekday("tuesday"); + public static final Weekday WEDNESDAY = new Weekday("wednesday"); + public static final Weekday THURSDAY = new Weekday("thursday"); + public static final Weekday FRIDAY = new Weekday("friday"); + public static final Weekday SATURDAY = new Weekday("saturday"); + public static final Weekday SUNDAY = new Weekday("sunday"); + + Weekday(String value) { + super(value, allowedValues); + } + + public static class WeekdaySerializer extends StdSerializer { + public WeekdaySerializer(Class t) { + super(t); + } + + public WeekdaySerializer() { + this(null); + } + + @Override + public void serialize(Weekday value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static Weekday fromValue(String value) { + return new Weekday(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Set_on_call_team_routing_rules_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Set_on_call_team_routing_rules_returns_OK_response.freeze new file mode 100644 index 00000000000..aa8d3dd92e8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Set_on_call_team_routing_rules_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-05-02T07:28:35.869Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Set_on_call_team_routing_rules_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Set_on_call_team_routing_rules_returns_OK_response.json new file mode 100644 index 00000000000..fc69847f56f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Set_on_call_team_routing_rules_returns_OK_response.json @@ -0,0 +1,246 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Set_on_call_team_routing_rules_returns_OK_response-1746170915@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"users\",\"id\":\"0f6790f5-2727-11f0-a9cb-b6ff84ad8646\",\"attributes\":{\"name\":null,\"handle\":\"test-set_on_call_team_routing_rules_returns_ok_response-1746170915@datadoghq.com\",\"created_at\":\"2025-05-02T07:28:36.413905+00:00\",\"modified_at\":\"2025-05-02T07:28:36.413905+00:00\",\"email\":\"test-set_on_call_team_routing_rules_returns_ok_response-1746170915@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/b9e2f38a22d0273582e08252ffbae94a?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\"},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d3d2bbd9-f411-6534-0ae6-30111f65af92" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-f6cbca2a9dc51017\",\"name\":\"test-name-f6cbca2a9dc51017\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"team\",\"id\":\"0db9884c-62de-4b52-ae74-1d256d8ecb75\",\"attributes\":{\"name\":\"test-name-f6cbca2a9dc51017\",\"handle\":\"test-handle-f6cbca2a9dc51017\",\"summary\":null,\"description\":null,\"avatar\":null,\"banner\":9,\"visible_modules\":[],\"hidden_modules\":[],\"created_at\":\"2025-05-02T07:28:36.528008+00:00\",\"modified_at\":\"2025-05-02T07:28:36.528018+00:00\",\"user_count\":0,\"link_count\":0},\"relationships\":{\"team_links\":{\"links\":{\"related\":\"/api/v2/team/0db9884c-62de-4b52-ae74-1d256d8ecb75/links\"}},\"user_team_permissions\":{\"links\":{\"related\":\"/api/v2/team/0db9884c-62de-4b52-ae74-1d256d8ecb75/permission-settings\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "acf0ae84-792b-d4a0-ba6f-166ba70844c5" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"layers\":[{\"effective_date\":\"2025-04-22T07:28:35.869Z\",\"end_date\":\"2025-05-12T07:28:35.869Z\",\"interval\":{\"days\":1},\"members\":[{\"user\":{\"id\":\"890f29d4-0b7a-11f0-aeb2-760fcae4f596\"}}],\"name\":\"Layer 1\",\"restrictions\":[{\"end_day\":\"friday\",\"end_time\":\"17:00:00\",\"start_day\":\"monday\",\"start_time\":\"09:00:00\"}],\"rotation_start\":\"2025-04-27T07:28:35.869Z\"}],\"name\":\"Test-Set_on_call_team_routing_rules_returns_OK_response-1746170915\",\"tags\":[\"tag1\",\"tag2\"],\"time_zone\":\"America/New_York\"},\"relationships\":{\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}},\"type\":\"schedules\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/on-call/schedules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"f4ae5b94-3985-490a-bdc0-e7f64890968c\",\"type\":\"schedules\",\"attributes\":{\"name\":\"Test-Set_on_call_team_routing_rules_returns_OK_response-1746170915\",\"tags\":[\"tag1\",\"tag2\"],\"time_zone\":\"America/New_York\"},\"relationships\":{\"layers\":{\"data\":[{\"id\":\"498723e5-43d7-407c-b7cb-171e9c08f402\",\"type\":\"layers\"}]},\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8a6c5a36-02e0-26b7-38fb-8d85fe465eec" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Test-Set_on_call_team_routing_rules_returns_OK_response-1746170915\",\"name\":\"Test-Set_on_call_team_routing_rules_returns_OK_response-1746170915\",\"resolve_page_on_policy_end\":true,\"retries\":2,\"steps\":[{\"assignment\":\"default\",\"escalate_after_seconds\":3600,\"targets\":[{\"id\":\"0db9884c-62de-4b52-ae74-1d256d8ecb75\",\"type\":\"teams\"},{\"id\":\"f4ae5b94-3985-490a-bdc0-e7f64890968c\",\"type\":\"schedules\"},{\"id\":\"0f6790f5-2727-11f0-a9cb-b6ff84ad8646\",\"type\":\"users\"}]},{\"assignment\":\"round-robin\",\"escalate_after_seconds\":3600,\"targets\":[{\"id\":\"0db9884c-62de-4b52-ae74-1d256d8ecb75\",\"type\":\"teams\"}]}]},\"relationships\":{\"teams\":{\"data\":[{\"id\":\"0db9884c-62de-4b52-ae74-1d256d8ecb75\",\"type\":\"teams\"}]}},\"type\":\"policies\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/on-call/escalation-policies", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"b79d430d-1e03-4840-a933-a1ee9baae339\",\"type\":\"policies\",\"attributes\":{\"description\":\"Test-Set_on_call_team_routing_rules_returns_OK_response-1746170915\",\"name\":\"Test-Set_on_call_team_routing_rules_returns_OK_response-1746170915\",\"resolve_page_on_policy_end\":true,\"retries\":2},\"relationships\":{\"steps\":{\"data\":[{\"id\":\"46b170a7-ad4a-4cc3-b933-386af8fbee11\",\"type\":\"steps\"},{\"id\":\"11c45a97-a232-4f34-a086-77005522ea7a\",\"type\":\"steps\"}]},\"teams\":{\"data\":[{\"id\":\"0db9884c-62de-4b52-ae74-1d256d8ecb75\",\"type\":\"teams\"}]}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "79a0b5af-3ebe-bea7-d3bc-1884b0ba7126" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"rules\":[{\"actions\":[{\"channel\":\"channel\",\"type\":\"send_slack_message\",\"workspace\":\"workspace\"}],\"query\":\"tags.service:test\",\"time_restriction\":{\"restrictions\":[{\"end_day\":\"monday\",\"end_time\":\"17:00:00\",\"start_day\":\"monday\",\"start_time\":\"09:00:00\"},{\"end_day\":\"tuesday\",\"end_time\":\"17:00:00\",\"start_day\":\"tuesday\",\"start_time\":\"09:00:00\"}],\"time_zone\":\"Europe/Paris\"},\"urgency\":\"high\"},{\"policy_id\":\"b79d430d-1e03-4840-a933-a1ee9baae339\",\"query\":\"\",\"urgency\":\"low\"}]},\"id\":\"0db9884c-62de-4b52-ae74-1d256d8ecb75\",\"type\":\"team_routing_rules\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/on-call/teams/0db9884c-62de-4b52-ae74-1d256d8ecb75/routing-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"0db9884c-62de-4b52-ae74-1d256d8ecb75\",\"type\":\"team_routing_rules\",\"relationships\":{\"rules\":{\"data\":[{\"id\":\"virtual-0db9884c-62de-4b52-ae74-1d256d8ecb75-rule-0\",\"type\":\"team_routing_rules\"},{\"id\":\"virtual-0db9884c-62de-4b52-ae74-1d256d8ecb75-rule-1\",\"type\":\"team_routing_rules\"}]}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0f7f8494-a27f-fe61-5178-490a1b8f2cc2" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/on-call/escalation-policies/b79d430d-1e03-4840-a933-a1ee9baae339", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"policy[b79d430d-1e03-4840-a933-a1ee9baae339] is in use\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 409, + "reasonPhrase": "Conflict" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "cea83d75-20a0-0dfa-19c9-a9dfba210040" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/on-call/schedules/f4ae5b94-3985-490a-bdc0-e7f64890968c", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"schedule[f4ae5b94-3985-490a-bdc0-e7f64890968c] is in use\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 409, + "reasonPhrase": "Conflict" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "40c32609-22be-d1e4-aba8-b566c206bde9" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/0db9884c-62de-4b52-ae74-1d256d8ecb75", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "05baf522-3cba-8c8a-7bff-782ad9a935da" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/0f6790f5-2727-11f0-a9cb-b6ff84ad8646", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5bad801e-3790-88a0-a64e-b65eccbec716" + } +] \ 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 950b601c71f..7b12664d37c 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 @@ -496,6 +496,18 @@ "tag": "On-Call", "operationId": "CreateOnCallSchedule" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"rules\": [\n {\n \"query\": \"\",\n \"policy_id\": \"{{ escalation_policy.data.id }}\",\n \"urgency\": \"low\",\n \"time_restriction\": null,\n \"actions\": []\n }\n ]\n }\n }\n}" + } + ], + "step": "there are valid \"routing_rules\" in the system", + "key": "routing_rules", + "tag": "On-Call", + "operationId": "SetOnCallTeamRoutingRules" + }, { "source": "data[4]", "step": "there is a valid \"permission\" in the system", diff --git a/src/test/resources/com/datadog/api/client/v2/api/on-call.feature b/src/test/resources/com/datadog/api/client/v2/api/on-call.feature index bacb4828a5e..0597e0b99f2 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/on-call.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/on-call.feature @@ -115,6 +115,25 @@ Feature: On-Call When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/bugle + Scenario: Get on-call team routing rules returns "OK" response + Given new "GetOnCallTeamRoutingRules" request + And request contains "team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @skip-python @team:DataDog/bugle + Scenario: Set on-call team routing rules returns "OK" response + Given new "SetOnCallTeamRoutingRules" request + And there is a valid "user" in the system + And there is a valid "dd_team" in the system + And there is a valid "schedule" in the system + And there is a valid "escalation_policy" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And body with value {"data": {"attributes": {"rules": [{"actions": [{"channel": "channel", "type": "send_slack_message", "workspace": "workspace"}], "query": "tags.service:test", "time_restriction": {"time_zone": "Europe/Paris", "restrictions": [{"end_day": "monday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}, {"end_day": "tuesday", "end_time": "17:00:00", "start_day": "tuesday", "start_time": "09:00:00"}]}, "urgency": "high"}, {"policy_id": "{{ escalation_policy.data.id }}", "query": "", "urgency": "low"}]}, "id": "{{ dd_team.data.id }}", "type": "team_routing_rules"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/bugle Scenario: Update on-call escalation policy returns "Bad Request" response Given new "UpdateOnCallEscalationPolicy" request 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 c1daab38525..6e56bb44319 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 @@ -1915,6 +1915,18 @@ "type": "idempotent" } }, + "GetOnCallTeamRoutingRules": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "SetOnCallTeamRoutingRules": { + "tag": "On-Call", + "undo": { + "type": "idempotent" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": {