diff --git a/.apigentools-info b/.apigentools-info index c83b2246561..2b7d2248919 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:13.587503", - "spec_repo_commit": "272cce39" + "regenerated": "2025-05-02 09:33:55.410949", + "spec_repo_commit": "77cf469a" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-02 04:31:13.603582", - "spec_repo_commit": "272cce39" + "regenerated": "2025-05-02 09:33:55.426962", + "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/cassettes/features/v2/on-call/Set-on-call-team-routing-rules-returns-OK-response.frozen b/cassettes/features/v2/on-call/Set-on-call-team-routing-rules-returns-OK-response.frozen new file mode 100644 index 00000000000..aa8d3dd92e8 --- /dev/null +++ b/cassettes/features/v2/on-call/Set-on-call-team-routing-rules-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-05-02T07:28:35.869Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Set-on-call-team-routing-rules-returns-OK-response.yml b/cassettes/features/v2/on-call/Set-on-call-team-routing-rules-returns-OK-response.yml new file mode 100644 index 00000000000..f04f5b60f64 --- /dev/null +++ b/cassettes/features/v2/on-call/Set-on-call-team-routing-rules-returns-OK-response.yml @@ -0,0 +1,189 @@ +http_interactions: +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Set_on_call_team_routing_rules_returns_OK_response-1746170915@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"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"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-f6cbca2a9dc51017","name":"test-name-f6cbca2a9dc51017"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"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"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/escalation-policies + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/on-call/teams/0db9884c-62de-4b52-ae74-1d256d8ecb75/routing-rules + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 200 + message: OK +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/escalation-policies/b79d430d-1e03-4840-a933-a1ee9baae339 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"policy[b79d430d-1e03-4840-a933-a1ee9baae339] + is in use"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/f4ae5b94-3985-490a-bdc0-e7f64890968c + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"schedule[f4ae5b94-3985-490a-bdc0-e7f64890968c] + is in use"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/0db9884c-62de-4b52-ae74-1d256d8ecb75 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Fri, 02 May 2025 07:28:35 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/0f6790f5-2727-11f0-a9cb-b6ff84ad8646 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/on-call/CreateOnCallEscalationPolicy.rb b/examples/v2/on-call/CreateOnCallEscalationPolicy.rb index ddbdbcc5a0f..da0b03536a8 100644 --- a/examples/v2/on-call/CreateOnCallEscalationPolicy.rb +++ b/examples/v2/on-call/CreateOnCallEscalationPolicy.rb @@ -21,30 +21,30 @@ retries: 2, steps: [ DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItems.new({ - assignment: DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment::DEFAULT, + assignment: DatadogAPIClient::V2::EscalationPolicyStepAttributesAssignment::DEFAULT, escalate_after_seconds: 3600, targets: [ - DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.new({ + DatadogAPIClient::V2::EscalationPolicyStepTarget.new({ id: USER_DATA_ID, - type: DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType::USERS, + type: DatadogAPIClient::V2::EscalationPolicyStepTargetType::USERS, }), - DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.new({ + DatadogAPIClient::V2::EscalationPolicyStepTarget.new({ id: SCHEDULE_DATA_ID, - type: DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType::SCHEDULES, + type: DatadogAPIClient::V2::EscalationPolicyStepTargetType::SCHEDULES, }), - DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.new({ + DatadogAPIClient::V2::EscalationPolicyStepTarget.new({ id: DD_TEAM_DATA_ID, - type: DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType::TEAMS, + type: DatadogAPIClient::V2::EscalationPolicyStepTargetType::TEAMS, }), ], }), DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItems.new({ - assignment: DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment::ROUND_ROBIN, + assignment: DatadogAPIClient::V2::EscalationPolicyStepAttributesAssignment::ROUND_ROBIN, escalate_after_seconds: 3600, targets: [ - DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems.new({ + DatadogAPIClient::V2::EscalationPolicyStepTarget.new({ id: DD_TEAM_DATA_ID, - type: DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType::TEAMS, + type: DatadogAPIClient::V2::EscalationPolicyStepTargetType::TEAMS, }), ], }), diff --git a/examples/v2/on-call/GetOnCallTeamRoutingRules.rb b/examples/v2/on-call/GetOnCallTeamRoutingRules.rb new file mode 100644 index 00000000000..531a1587063 --- /dev/null +++ b/examples/v2/on-call/GetOnCallTeamRoutingRules.rb @@ -0,0 +1,5 @@ +# Get on-call team routing rules returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallAPI.new +p api_instance.get_on_call_team_routing_rules("27590dae-47be-4a7d-9abf-8f4e45124020") diff --git a/examples/v2/on-call/SetOnCallTeamRoutingRules.rb b/examples/v2/on-call/SetOnCallTeamRoutingRules.rb new file mode 100644 index 00000000000..224c1c9e14d --- /dev/null +++ b/examples/v2/on-call/SetOnCallTeamRoutingRules.rb @@ -0,0 +1,55 @@ +# Set on-call team routing rules returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallAPI.new + +# there is a valid "dd_team" in the system +DD_TEAM_DATA_ID = ENV["DD_TEAM_DATA_ID"] + +# there is a valid "escalation_policy" in the system +ESCALATION_POLICY_DATA_ID = ENV["ESCALATION_POLICY_DATA_ID"] + +body = DatadogAPIClient::V2::TeamRoutingRulesRequest.new({ + data: DatadogAPIClient::V2::TeamRoutingRulesRequestData.new({ + attributes: DatadogAPIClient::V2::TeamRoutingRulesRequestDataAttributes.new({ + rules: [ + DatadogAPIClient::V2::TeamRoutingRulesRequestRule.new({ + actions: [ + DatadogAPIClient::V2::SlackAction.new({ + channel: "channel", + type: "send_slack_message", + workspace: "workspace", + }), + ], + query: "tags.service:test", + time_restriction: DatadogAPIClient::V2::TimeRestrictions.new({ + time_zone: "Europe/Paris", + restrictions: [ + DatadogAPIClient::V2::TimeRestriction.new({ + end_day: DatadogAPIClient::V2::Weekday::MONDAY, + end_time: "17:00:00", + start_day: DatadogAPIClient::V2::Weekday::MONDAY, + start_time: "09:00:00", + }), + DatadogAPIClient::V2::TimeRestriction.new({ + end_day: DatadogAPIClient::V2::Weekday::TUESDAY, + end_time: "17:00:00", + start_day: DatadogAPIClient::V2::Weekday::TUESDAY, + start_time: "09:00:00", + }), + ], + }), + urgency: DatadogAPIClient::V2::Urgency::HIGH, + }), + DatadogAPIClient::V2::TeamRoutingRulesRequestRule.new({ + policy_id: ESCALATION_POLICY_DATA_ID, + query: "", + urgency: DatadogAPIClient::V2::Urgency::LOW, + }), + ], + }), + id: DD_TEAM_DATA_ID, + type: DatadogAPIClient::V2::TeamRoutingRulesRequestDataType::TEAM_ROUTING_RULES, + }), +}) +p api_instance.set_on_call_team_routing_rules(DD_TEAM_DATA_ID, body) diff --git a/examples/v2/on-call/UpdateOnCallEscalationPolicy.rb b/examples/v2/on-call/UpdateOnCallEscalationPolicy.rb index 41cd05bde17..d7bbb8986ff 100644 --- a/examples/v2/on-call/UpdateOnCallEscalationPolicy.rb +++ b/examples/v2/on-call/UpdateOnCallEscalationPolicy.rb @@ -22,13 +22,13 @@ retries: 0, steps: [ DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataAttributesStepsItems.new({ - assignment: DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment::DEFAULT, + assignment: DatadogAPIClient::V2::EscalationPolicyStepAttributesAssignment::DEFAULT, escalate_after_seconds: 3600, id: ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID, targets: [ - DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems.new({ + DatadogAPIClient::V2::EscalationPolicyStepTarget.new({ id: USER_DATA_ID, - type: DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType::USERS, + type: DatadogAPIClient::V2::EscalationPolicyStepTargetType::USERS, }), ], }), diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 8c5371c049e..728b23f0b62 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2071,6 +2071,15 @@ "schedule_id" => "String", "body" => "ScheduleUpdateRequest", }, + "v2.GetOnCallTeamRoutingRules" => { + "team_id" => "String", + "include" => "String", + }, + "v2.SetOnCallTeamRoutingRules" => { + "team_id" => "String", + "include" => "String", + "body" => "TeamRoutingRulesRequest", + }, "v2.GetOrgConfig" => { "org_config_name" => "String", }, diff --git a/features/v2/given.json b/features/v2/given.json index 950b601c71f..7b12664d37c 100644 --- a/features/v2/given.json +++ b/features/v2/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/features/v2/on-call.feature b/features/v2/on-call.feature index bacb4828a5e..0597e0b99f2 100644 --- a/features/v2/on-call.feature +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index c1daab38525..6e56bb44319 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 96f04007c65..b31ae532c47 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1691,9 +1691,6 @@ def overrides "v2.escalation_policy_create_request_data" => "EscalationPolicyCreateRequestData", "v2.escalation_policy_create_request_data_attributes" => "EscalationPolicyCreateRequestDataAttributes", "v2.escalation_policy_create_request_data_attributes_steps_items" => "EscalationPolicyCreateRequestDataAttributesStepsItems", - "v2.escalation_policy_create_request_data_attributes_steps_items_assignment" => "EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment", - "v2.escalation_policy_create_request_data_attributes_steps_items_targets_items" => "EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems", - "v2.escalation_policy_create_request_data_attributes_steps_items_targets_items_type" => "EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType", "v2.escalation_policy_create_request_data_relationships" => "EscalationPolicyCreateRequestDataRelationships", "v2.escalation_policy_create_request_data_relationships_teams" => "EscalationPolicyCreateRequestDataRelationshipsTeams", "v2.escalation_policy_create_request_data_relationships_teams_data_items" => "EscalationPolicyCreateRequestDataRelationshipsTeamsDataItems", @@ -1714,14 +1711,13 @@ def overrides "v2.escalation_policy_step_attributes" => "EscalationPolicyStepAttributes", "v2.escalation_policy_step_attributes_assignment" => "EscalationPolicyStepAttributesAssignment", "v2.escalation_policy_step_relationships" => "EscalationPolicyStepRelationships", + "v2.escalation_policy_step_target" => "EscalationPolicyStepTarget", + "v2.escalation_policy_step_target_type" => "EscalationPolicyStepTargetType", "v2.escalation_policy_step_type" => "EscalationPolicyStepType", "v2.escalation_policy_update_request" => "EscalationPolicyUpdateRequest", "v2.escalation_policy_update_request_data" => "EscalationPolicyUpdateRequestData", "v2.escalation_policy_update_request_data_attributes" => "EscalationPolicyUpdateRequestDataAttributes", "v2.escalation_policy_update_request_data_attributes_steps_items" => "EscalationPolicyUpdateRequestDataAttributesStepsItems", - "v2.escalation_policy_update_request_data_attributes_steps_items_assignment" => "EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment", - "v2.escalation_policy_update_request_data_attributes_steps_items_targets_items" => "EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems", - "v2.escalation_policy_update_request_data_attributes_steps_items_targets_items_type" => "EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType", "v2.escalation_policy_update_request_data_relationships" => "EscalationPolicyUpdateRequestDataRelationships", "v2.escalation_policy_update_request_data_relationships_teams" => "EscalationPolicyUpdateRequestDataRelationshipsTeams", "v2.escalation_policy_update_request_data_relationships_teams_data_items" => "EscalationPolicyUpdateRequestDataRelationshipsTeamsDataItems", @@ -2716,6 +2712,14 @@ def overrides "v2.role_update_request" => "RoleUpdateRequest", "v2.role_update_response" => "RoleUpdateResponse", "v2.role_update_response_data" => "RoleUpdateResponseData", + "v2.routing_rule" => "RoutingRule", + "v2.routing_rule_action" => "RoutingRuleAction", + "v2.routing_rule_attributes" => "RoutingRuleAttributes", + "v2.routing_rule_relationships" => "RoutingRuleRelationships", + "v2.routing_rule_relationships_policy" => "RoutingRuleRelationshipsPolicy", + "v2.routing_rule_relationships_policy_data" => "RoutingRuleRelationshipsPolicyData", + "v2.routing_rule_relationships_policy_data_type" => "RoutingRuleRelationshipsPolicyDataType", + "v2.routing_rule_type" => "RoutingRuleType", "v2.rule_attributes" => "RuleAttributes", "v2.rule_outcome_relationships" => "RuleOutcomeRelationships", "v2.rule_severity" => "RuleSeverity", @@ -3127,6 +3131,7 @@ def overrides "v2.single_aggregated_connection_response_data" => "SingleAggregatedConnectionResponseData", "v2.single_aggregated_connection_response_data_attributes" => "SingleAggregatedConnectionResponseDataAttributes", "v2.single_aggregated_connection_response_data_type" => "SingleAggregatedConnectionResponseDataType", + "v2.slack_action" => "SlackAction", "v2.slack_integration_metadata" => "SlackIntegrationMetadata", "v2.slack_integration_metadata_channel_item" => "SlackIntegrationMetadataChannelItem", "v2.slack_trigger_wrapper" => "SlackTriggerWrapper", @@ -3245,6 +3250,20 @@ def overrides "v2.team_relationships" => "TeamRelationships", "v2.team_relationships_links" => "TeamRelationshipsLinks", "v2.team_response" => "TeamResponse", + "v2.team_routing_rules" => "TeamRoutingRules", + "v2.team_routing_rules_data" => "TeamRoutingRulesData", + "v2.team_routing_rules_data_relationships" => "TeamRoutingRulesDataRelationships", + "v2.team_routing_rules_data_relationships_rules" => "TeamRoutingRulesDataRelationshipsRules", + "v2.team_routing_rules_data_relationships_rules_data_items" => "TeamRoutingRulesDataRelationshipsRulesDataItems", + "v2.team_routing_rules_data_relationships_rules_data_items_type" => "TeamRoutingRulesDataRelationshipsRulesDataItemsType", + "v2.team_routing_rules_data_type" => "TeamRoutingRulesDataType", + "v2.team_routing_rules_included" => "TeamRoutingRulesIncluded", + "v2.team_routing_rules_request" => "TeamRoutingRulesRequest", + "v2.team_routing_rules_request_data" => "TeamRoutingRulesRequestData", + "v2.team_routing_rules_request_data_attributes" => "TeamRoutingRulesRequestDataAttributes", + "v2.team_routing_rules_request_data_type" => "TeamRoutingRulesRequestDataType", + "v2.team_routing_rules_request_rule" => "TeamRoutingRulesRequestRule", + "v2.teams_action" => "TeamsAction", "v2.teams_field" => "TeamsField", "v2.teams_response" => "TeamsResponse", "v2.teams_response_links" => "TeamsResponseLinks", @@ -3257,6 +3276,8 @@ def overrides "v2.team_update_attributes" => "TeamUpdateAttributes", "v2.team_update_relationships" => "TeamUpdateRelationships", "v2.team_update_request" => "TeamUpdateRequest", + "v2.time_restriction" => "TimeRestriction", + "v2.time_restrictions" => "TimeRestrictions", "v2.timeseries_formula_query_request" => "TimeseriesFormulaQueryRequest", "v2.timeseries_formula_query_response" => "TimeseriesFormulaQueryResponse", "v2.timeseries_formula_request" => "TimeseriesFormulaRequest", @@ -3295,6 +3316,7 @@ def overrides "v2.upsert_catalog_entity_request" => "UpsertCatalogEntityRequest", "v2.upsert_catalog_entity_response" => "UpsertCatalogEntityResponse", "v2.upsert_catalog_entity_response_included_item" => "UpsertCatalogEntityResponseIncludedItem", + "v2.urgency" => "Urgency", "v2.url_param" => "UrlParam", "v2.url_param_update" => "UrlParamUpdate", "v2.usage_application_security_monitoring_response" => "UsageApplicationSecurityMonitoringResponse", @@ -3366,6 +3388,7 @@ def overrides "v2.vulnerability_status" => "VulnerabilityStatus", "v2.vulnerability_tool" => "VulnerabilityTool", "v2.vulnerability_type" => "VulnerabilityType", + "v2.weekday" => "Weekday", "v2.widget_live_span" => "WidgetLiveSpan", "v2.workflow_data" => "WorkflowData", "v2.workflow_data_attributes" => "WorkflowDataAttributes", diff --git a/lib/datadog_api_client/v2/api/on_call_api.rb b/lib/datadog_api_client/v2/api/on_call_api.rb index c3983dbc44b..4b10b58e725 100644 --- a/lib/datadog_api_client/v2/api/on_call_api.rb +++ b/lib/datadog_api_client/v2/api/on_call_api.rb @@ -425,6 +425,147 @@ def get_on_call_schedule_with_http_info(schedule_id, opts = {}) return data, status_code, headers end + # Get on-call team routing rules. + # + # @see #get_on_call_team_routing_rules_with_http_info + def get_on_call_team_routing_rules(team_id, opts = {}) + data, _status_code, _headers = get_on_call_team_routing_rules_with_http_info(team_id, opts) + data + end + + # Get on-call team routing rules. + # + # Get a team's on-call routing rules + # + # @param team_id [String] The team ID + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of included relationships to be returned. Allowed values: `rules`, `rules.policy`. + # @return [Array<(TeamRoutingRules, Integer, Hash)>] TeamRoutingRules data, response status code and response headers + def get_on_call_team_routing_rules_with_http_info(team_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.get_on_call_team_routing_rules ...' + end + # verify the required parameter 'team_id' is set + if @api_client.config.client_side_validation && team_id.nil? + fail ArgumentError, "Missing the required parameter 'team_id' when calling OnCallAPI.get_on_call_team_routing_rules" + end + # resource path + local_var_path = '/api/v2/on-call/teams/{team_id}/routing-rules'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TeamRoutingRules' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_on_call_team_routing_rules, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#get_on_call_team_routing_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Set on-call team routing rules. + # + # @see #set_on_call_team_routing_rules_with_http_info + def set_on_call_team_routing_rules(team_id, body, opts = {}) + data, _status_code, _headers = set_on_call_team_routing_rules_with_http_info(team_id, body, opts) + data + end + + # Set on-call team routing rules. + # + # Set a team's on-call routing rules + # + # @param team_id [String] The team ID + # @param body [TeamRoutingRulesRequest] + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of included relationships to be returned. Allowed values: `rules`, `rules.policy`. + # @return [Array<(TeamRoutingRules, Integer, Hash)>] TeamRoutingRules data, response status code and response headers + def set_on_call_team_routing_rules_with_http_info(team_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.set_on_call_team_routing_rules ...' + end + # verify the required parameter 'team_id' is set + if @api_client.config.client_side_validation && team_id.nil? + fail ArgumentError, "Missing the required parameter 'team_id' when calling OnCallAPI.set_on_call_team_routing_rules" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling OnCallAPI.set_on_call_team_routing_rules" + end + # resource path + local_var_path = '/api/v2/on-call/teams/{team_id}/routing-rules'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TeamRoutingRules' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :set_on_call_team_routing_rules, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#set_on_call_team_routing_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update on-call escalation policy. # # @see #update_on_call_escalation_policy_with_http_info diff --git a/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items.rb b/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items.rb index e1e418cc063..858aa5b0ea8 100644 --- a/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items.rb +++ b/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items.rb @@ -46,9 +46,9 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'assignment' => :'EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment', + :'assignment' => :'EscalationPolicyStepAttributesAssignment', :'escalate_after_seconds' => :'Integer', - :'targets' => :'Array' + :'targets' => :'Array' } end diff --git a/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_targets_items.rb b/lib/datadog_api_client/v2/models/escalation_policy_step_target.rb similarity index 91% rename from lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_targets_items.rb rename to lib/datadog_api_client/v2/models/escalation_policy_step_target.rb index 3f782deb82f..bc617a3b047 100644 --- a/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_targets_items.rb +++ b/lib/datadog_api_client/v2/models/escalation_policy_step_target.rb @@ -18,7 +18,7 @@ module DatadogAPIClient::V2 # Defines a single escalation target within a step for an escalation policy creation request. Contains `id` and `type`. - class EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems + class EscalationPolicyStepTarget include BaseGenericModel # Specifies the unique identifier for this target. @@ -43,7 +43,7 @@ def self.attribute_map def self.openapi_types { :'id' => :'String', - :'type' => :'EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType' + :'type' => :'EscalationPolicyStepTargetType' } end @@ -52,7 +52,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItems` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EscalationPolicyStepTarget` initialize method" end self.additional_properties = {} diff --git a/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_targets_items_type.rb b/lib/datadog_api_client/v2/models/escalation_policy_step_target_type.rb similarity index 90% rename from lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_targets_items_type.rb rename to lib/datadog_api_client/v2/models/escalation_policy_step_target_type.rb index e9f059f5a4a..536856aa1ed 100644 --- a/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_targets_items_type.rb +++ b/lib/datadog_api_client/v2/models/escalation_policy_step_target_type.rb @@ -18,7 +18,7 @@ module DatadogAPIClient::V2 # Specifies the type of escalation target (example `users`, `schedules`, or `teams`). - class EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType + class EscalationPolicyStepTargetType include BaseEnumModel USERS = "users".freeze diff --git a/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items.rb b/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items.rb index 511656d2c36..7af367f7b8d 100644 --- a/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items.rb +++ b/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items.rb @@ -50,10 +50,10 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'assignment' => :'EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment', + :'assignment' => :'EscalationPolicyStepAttributesAssignment', :'escalate_after_seconds' => :'Integer', :'id' => :'String', - :'targets' => :'Array' + :'targets' => :'Array' } end diff --git a/lib/datadog_api_client/v2/models/routing_rule.rb b/lib/datadog_api_client/v2/models/routing_rule.rb new file mode 100644 index 00000000000..bf30a219b63 --- /dev/null +++ b/lib/datadog_api_client/v2/models/routing_rule.rb @@ -0,0 +1,153 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents a routing rule, including its attributes, relationships, and unique identifier. + class RoutingRule + include BaseGenericModel + + # Defines the configurable attributes of a routing rule, such as actions, query, time restriction, and urgency. + attr_accessor :attributes + + # Specifies the unique identifier of this routing rule. + attr_accessor :id + + # Specifies relationships for a routing rule, linking to associated policy resources. + attr_accessor :relationships + + # Team routing rules resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RoutingRuleAttributes', + :'id' => :'String', + :'relationships' => :'RoutingRuleRelationships', + :'type' => :'RoutingRuleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RoutingRule` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/routing_rule_action.rb b/lib/datadog_api_client/v2/models/routing_rule_action.rb new file mode 100644 index 00000000000..e89f2e1b0cf --- /dev/null +++ b/lib/datadog_api_client/v2/models/routing_rule_action.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines an action that is executed when a routing rule matches certain criteria. + module RoutingRuleAction + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'SlackAction', + :'TeamsAction' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/routing_rule_attributes.rb b/lib/datadog_api_client/v2/models/routing_rule_attributes.rb new file mode 100644 index 00000000000..b5f95d50bd6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/routing_rule_attributes.rb @@ -0,0 +1,137 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the configurable attributes of a routing rule, such as actions, query, time restriction, and urgency. + class RoutingRuleAttributes + include BaseGenericModel + + # Specifies the list of actions to perform when the routing rule matches. + attr_accessor :actions + + # Defines the query or condition that triggers this routing rule. + attr_accessor :query + + # Holds time zone information and a list of time restrictions for a routing rule. + attr_accessor :time_restriction + + # Specifies the level of urgency for a routing rule (low, high, or dynamic). + attr_accessor :urgency + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'actions' => :'actions', + :'query' => :'query', + :'time_restriction' => :'time_restriction', + :'urgency' => :'urgency' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'actions' => :'Array', + :'query' => :'String', + :'time_restriction' => :'TimeRestrictions', + :'urgency' => :'Urgency' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RoutingRuleAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'time_restriction') + self.time_restriction = attributes[:'time_restriction'] + end + + if attributes.key?(:'urgency') + self.urgency = attributes[:'urgency'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + actions == o.actions && + query == o.query && + time_restriction == o.time_restriction && + urgency == o.urgency && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [actions, query, time_restriction, urgency, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_targets_items.rb b/lib/datadog_api_client/v2/models/routing_rule_relationships.rb similarity index 73% rename from lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_targets_items.rb rename to lib/datadog_api_client/v2/models/routing_rule_relationships.rb index a20a45fc3db..401efdb8c93 100644 --- a/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_targets_items.rb +++ b/lib/datadog_api_client/v2/models/routing_rule_relationships.rb @@ -17,15 +17,12 @@ require 'time' module DatadogAPIClient::V2 - # Defines a single escalation target within a step for an escalation policy update request. Contains `id` and `type`. - class EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems + # Specifies relationships for a routing rule, linking to associated policy resources. + class RoutingRuleRelationships include BaseGenericModel - # Specifies the unique identifier for this target. - attr_accessor :id - - # Specifies the type of escalation target (example `users`, `schedules`, or `teams`). - attr_accessor :type + # Defines the relationship that links a routing rule to a policy. + attr_accessor :policy attr_accessor :additional_properties @@ -33,8 +30,7 @@ class EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems # @!visibility private def self.attribute_map { - :'id' => :'id', - :'type' => :'type' + :'policy' => :'policy' } end @@ -42,8 +38,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'id' => :'String', - :'type' => :'EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItemsType' + :'policy' => :'RoutingRuleRelationshipsPolicy' } end @@ -52,7 +47,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataAttributesStepsItemsTargetsItems` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RoutingRuleRelationships` initialize method" end self.additional_properties = {} @@ -65,12 +60,8 @@ def initialize(attributes = {}) end } - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] + if attributes.key?(:'policy') + self.policy = attributes[:'policy'] end end @@ -100,8 +91,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && - id == o.id && - type == o.type && + policy == o.policy && additional_properties == o.additional_properties end @@ -109,7 +99,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [id, type, additional_properties].hash + [policy, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/routing_rule_relationships_policy.rb b/lib/datadog_api_client/v2/models/routing_rule_relationships_policy.rb new file mode 100644 index 00000000000..75e061ce7bb --- /dev/null +++ b/lib/datadog_api_client/v2/models/routing_rule_relationships_policy.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the relationship that links a routing rule to a policy. + class RoutingRuleRelationshipsPolicy + include BaseGenericModel + + # Represents the policy data reference, containing the policy's ID and resource type. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RoutingRuleRelationshipsPolicyData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RoutingRuleRelationshipsPolicy` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/routing_rule_relationships_policy_data.rb b/lib/datadog_api_client/v2/models/routing_rule_relationships_policy_data.rb new file mode 100644 index 00000000000..4626982cdb2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/routing_rule_relationships_policy_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents the policy data reference, containing the policy's ID and resource type. + class RoutingRuleRelationshipsPolicyData + include BaseGenericModel + + # Specifies the unique identifier of the policy. + attr_reader :id + + # Indicates that the resource is of type 'policies'. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'RoutingRuleRelationshipsPolicyDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RoutingRuleRelationshipsPolicyData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_assignment.rb b/lib/datadog_api_client/v2/models/routing_rule_relationships_policy_data_type.rb similarity index 70% rename from lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_assignment.rb rename to lib/datadog_api_client/v2/models/routing_rule_relationships_policy_data_type.rb index ef50e8d349c..a840e8818c4 100644 --- a/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_assignment.rb +++ b/lib/datadog_api_client/v2/models/routing_rule_relationships_policy_data_type.rb @@ -17,11 +17,10 @@ require 'time' module DatadogAPIClient::V2 - # Specifies how this escalation step will assign targets (example `default` or `round-robin`). - class EscalationPolicyCreateRequestDataAttributesStepsItemsAssignment + # Indicates that the resource is of type 'policies'. + class RoutingRuleRelationshipsPolicyDataType include BaseEnumModel - DEFAULT = "default".freeze - ROUND_ROBIN = "round-robin".freeze + POLICIES = "policies".freeze end end diff --git a/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_assignment.rb b/lib/datadog_api_client/v2/models/routing_rule_type.rb similarity index 70% rename from lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_assignment.rb rename to lib/datadog_api_client/v2/models/routing_rule_type.rb index 629c8775016..1e7c8c3a00f 100644 --- a/lib/datadog_api_client/v2/models/escalation_policy_update_request_data_attributes_steps_items_assignment.rb +++ b/lib/datadog_api_client/v2/models/routing_rule_type.rb @@ -17,11 +17,10 @@ require 'time' module DatadogAPIClient::V2 - # Specifies how this escalation step will assign targets (example `default` or `round-robin`). - class EscalationPolicyUpdateRequestDataAttributesStepsItemsAssignment + # Team routing rules resource type. + class RoutingRuleType include BaseEnumModel - DEFAULT = "default".freeze - ROUND_ROBIN = "round-robin".freeze + TEAM_ROUTING_RULES = "team_routing_rules".freeze end end diff --git a/lib/datadog_api_client/v2/models/slack_action.rb b/lib/datadog_api_client/v2/models/slack_action.rb new file mode 100644 index 00000000000..f58f3b5913e --- /dev/null +++ b/lib/datadog_api_client/v2/models/slack_action.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Sends a message to a Slack channel. + class SlackAction + include BaseGenericModel + + # The channel ID. + attr_reader :channel + + # Must be set to "send_slack_message". + attr_reader :type + + # The workspace ID. + attr_reader :workspace + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'channel' => :'channel', + :'type' => :'type', + :'workspace' => :'workspace' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'channel' => :'String', + :'type' => :'String', + :'workspace' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SlackAction` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'workspace') + self.workspace = attributes[:'workspace'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @channel.nil? + return false if @type.nil? + return false if @workspace.nil? + true + end + + # Custom attribute writer method with validation + # @param channel [Object] Object to be assigned + # @!visibility private + def channel=(channel) + if channel.nil? + fail ArgumentError, 'invalid value for "channel", channel cannot be nil.' + end + @channel = channel + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Custom attribute writer method with validation + # @param workspace [Object] Object to be assigned + # @!visibility private + def workspace=(workspace) + if workspace.nil? + fail ArgumentError, 'invalid value for "workspace", workspace cannot be nil.' + end + @workspace = workspace + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel == o.channel && + type == o.type && + workspace == o.workspace && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [channel, type, workspace, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules.rb b/lib/datadog_api_client/v2/models/team_routing_rules.rb new file mode 100644 index 00000000000..b630ccd7b21 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules.rb @@ -0,0 +1,117 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents a complete set of team routing rules, including data and optionally included related resources. + class TeamRoutingRules + include BaseGenericModel + + # Represents the top-level data object for team routing rules, containing the ID, relationships, and resource type. + attr_accessor :data + + # Provides related routing rules or other included resources. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TeamRoutingRulesData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRules` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_data.rb b/lib/datadog_api_client/v2/models/team_routing_rules_data.rb new file mode 100644 index 00000000000..d0300776bfd --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_data.rb @@ -0,0 +1,143 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents the top-level data object for team routing rules, containing the ID, relationships, and resource type. + class TeamRoutingRulesData + include BaseGenericModel + + # Specifies the unique identifier of this team routing rules record. + attr_accessor :id + + # Specifies relationships for team routing rules, including rule references. + attr_accessor :relationships + + # Team routing rules resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'relationships' => :'TeamRoutingRulesDataRelationships', + :'type' => :'TeamRoutingRulesDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRulesData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships.rb b/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships.rb new file mode 100644 index 00000000000..3154def6830 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Specifies relationships for team routing rules, including rule references. + class TeamRoutingRulesDataRelationships + include BaseGenericModel + + # Holds references to a set of routing rules in a relationship. + attr_accessor :rules + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'rules' => :'rules' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'rules' => :'TeamRoutingRulesDataRelationshipsRules' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRulesDataRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'rules') + self.rules = attributes[:'rules'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rules == o.rules && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [rules, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules.rb b/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules.rb new file mode 100644 index 00000000000..df10ba95449 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Holds references to a set of routing rules in a relationship. + class TeamRoutingRulesDataRelationshipsRules + include BaseGenericModel + + # An array of references to the routing rules associated with this team. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRulesDataRelationshipsRules` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules_data_items.rb b/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules_data_items.rb new file mode 100644 index 00000000000..74fb3a0c579 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules_data_items.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines a relationship item to link a routing rule by its ID and type. + class TeamRoutingRulesDataRelationshipsRulesDataItems + include BaseGenericModel + + # Specifies the unique identifier for the related routing rule. + attr_reader :id + + # Indicates that the resource is of type 'team_routing_rules'. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'TeamRoutingRulesDataRelationshipsRulesDataItemsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRulesDataRelationshipsRulesDataItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_targets_items_type.rb b/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules_data_items_type.rb similarity index 69% rename from lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_targets_items_type.rb rename to lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules_data_items_type.rb index b583aa498a5..f4a3ffd7da5 100644 --- a/lib/datadog_api_client/v2/models/escalation_policy_create_request_data_attributes_steps_items_targets_items_type.rb +++ b/lib/datadog_api_client/v2/models/team_routing_rules_data_relationships_rules_data_items_type.rb @@ -17,12 +17,10 @@ require 'time' module DatadogAPIClient::V2 - # Specifies the type of escalation target (example `users`, `schedules`, or `teams`). - class EscalationPolicyCreateRequestDataAttributesStepsItemsTargetsItemsType + # Indicates that the resource is of type 'team_routing_rules'. + class TeamRoutingRulesDataRelationshipsRulesDataItemsType include BaseEnumModel - USERS = "users".freeze - SCHEDULES = "schedules".freeze - TEAMS = "teams".freeze + TEAM_ROUTING_RULES = "team_routing_rules".freeze end end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_data_type.rb b/lib/datadog_api_client/v2/models/team_routing_rules_data_type.rb new file mode 100644 index 00000000000..b2ed1522351 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Team routing rules resource type. + class TeamRoutingRulesDataType + include BaseEnumModel + + TEAM_ROUTING_RULES = "team_routing_rules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_included.rb b/lib/datadog_api_client/v2/models/team_routing_rules_included.rb new file mode 100644 index 00000000000..0f4708399b4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_included.rb @@ -0,0 +1,62 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents additional included resources for team routing rules, such as associated routing rules. + module TeamRoutingRulesIncluded + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'RoutingRule' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_request.rb b/lib/datadog_api_client/v2/models/team_routing_rules_request.rb new file mode 100644 index 00000000000..453e271837b --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_request.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents a request to create or update team routing rules, including the data payload. + class TeamRoutingRulesRequest + include BaseGenericModel + + # Holds the data necessary to create or update team routing rules, including attributes, ID, and resource type. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TeamRoutingRulesRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRulesRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_request_data.rb b/lib/datadog_api_client/v2/models/team_routing_rules_request_data.rb new file mode 100644 index 00000000000..88bedbc0291 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_request_data.rb @@ -0,0 +1,143 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Holds the data necessary to create or update team routing rules, including attributes, ID, and resource type. + class TeamRoutingRulesRequestData + include BaseGenericModel + + # Represents the attributes of a request to update or create team routing rules. + attr_accessor :attributes + + # Specifies the unique identifier for this set of team routing rules. + attr_accessor :id + + # Team routing rules resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TeamRoutingRulesRequestDataAttributes', + :'id' => :'String', + :'type' => :'TeamRoutingRulesRequestDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRulesRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_request_data_attributes.rb b/lib/datadog_api_client/v2/models/team_routing_rules_request_data_attributes.rb new file mode 100644 index 00000000000..d63b4860c86 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_request_data_attributes.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents the attributes of a request to update or create team routing rules. + class TeamRoutingRulesRequestDataAttributes + include BaseGenericModel + + # A list of routing rule items that define how incoming pages should be handled. + attr_accessor :rules + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'rules' => :'rules' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'rules' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRulesRequestDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'rules') + if (value = attributes[:'rules']).is_a?(Array) + self.rules = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rules == o.rules && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [rules, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_request_data_type.rb b/lib/datadog_api_client/v2/models/team_routing_rules_request_data_type.rb new file mode 100644 index 00000000000..75760be51b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_request_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Team routing rules resource type. + class TeamRoutingRulesRequestDataType + include BaseEnumModel + + TEAM_ROUTING_RULES = "team_routing_rules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/team_routing_rules_request_rule.rb b/lib/datadog_api_client/v2/models/team_routing_rules_request_rule.rb new file mode 100644 index 00000000000..94f57003418 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_routing_rules_request_rule.rb @@ -0,0 +1,147 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines an individual routing rule item that contains the rule data for the request. + class TeamRoutingRulesRequestRule + include BaseGenericModel + + # Specifies the list of actions to perform when the routing rule is matched. + attr_accessor :actions + + # Identifies the policy to be applied when this routing rule matches. + attr_accessor :policy_id + + # Defines the query or condition that triggers this routing rule. + attr_accessor :query + + # Holds time zone information and a list of time restrictions for a routing rule. + attr_accessor :time_restriction + + # Specifies the level of urgency for a routing rule (low, high, or dynamic). + attr_accessor :urgency + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'actions' => :'actions', + :'policy_id' => :'policy_id', + :'query' => :'query', + :'time_restriction' => :'time_restriction', + :'urgency' => :'urgency' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'actions' => :'Array', + :'policy_id' => :'String', + :'query' => :'String', + :'time_restriction' => :'TimeRestrictions', + :'urgency' => :'Urgency' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamRoutingRulesRequestRule` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + + if attributes.key?(:'policy_id') + self.policy_id = attributes[:'policy_id'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'time_restriction') + self.time_restriction = attributes[:'time_restriction'] + end + + if attributes.key?(:'urgency') + self.urgency = attributes[:'urgency'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + actions == o.actions && + policy_id == o.policy_id && + query == o.query && + time_restriction == o.time_restriction && + urgency == o.urgency && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [actions, policy_id, query, time_restriction, urgency, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/teams_action.rb b/lib/datadog_api_client/v2/models/teams_action.rb new file mode 100644 index 00000000000..a96d8b7c988 --- /dev/null +++ b/lib/datadog_api_client/v2/models/teams_action.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Sends a message to a Microsoft Teams channel. + class TeamsAction + include BaseGenericModel + + # The channel ID. + attr_reader :channel + + # The team ID. + attr_reader :team + + # The tenant ID. + attr_reader :tenant + + # Must be set to "send_teams_message". + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'channel' => :'channel', + :'team' => :'team', + :'tenant' => :'tenant', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'channel' => :'String', + :'team' => :'String', + :'tenant' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamsAction` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'team') + self.team = attributes[:'team'] + end + + if attributes.key?(:'tenant') + self.tenant = attributes[:'tenant'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @channel.nil? + return false if @team.nil? + return false if @tenant.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param channel [Object] Object to be assigned + # @!visibility private + def channel=(channel) + if channel.nil? + fail ArgumentError, 'invalid value for "channel", channel cannot be nil.' + end + @channel = channel + end + + # Custom attribute writer method with validation + # @param team [Object] Object to be assigned + # @!visibility private + def team=(team) + if team.nil? + fail ArgumentError, 'invalid value for "team", team cannot be nil.' + end + @team = team + end + + # Custom attribute writer method with validation + # @param tenant [Object] Object to be assigned + # @!visibility private + def tenant=(tenant) + if tenant.nil? + fail ArgumentError, 'invalid value for "tenant", tenant cannot be nil.' + end + @tenant = tenant + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel == o.channel && + team == o.team && + tenant == o.tenant && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [channel, team, tenant, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/time_restriction.rb b/lib/datadog_api_client/v2/models/time_restriction.rb new file mode 100644 index 00000000000..623e9dd3d3e --- /dev/null +++ b/lib/datadog_api_client/v2/models/time_restriction.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines a single time restriction rule with start and end times and the applicable weekdays. + class TimeRestriction + include BaseGenericModel + + # A day of the week. + attr_accessor :end_day + + # Specifies the ending time for this restriction. + attr_accessor :end_time + + # A day of the week. + attr_accessor :start_day + + # Specifies the starting time for this restriction. + attr_accessor :start_time + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'end_day' => :'end_day', + :'end_time' => :'end_time', + :'start_day' => :'start_day', + :'start_time' => :'start_time' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'end_day' => :'Weekday', + :'end_time' => :'String', + :'start_day' => :'Weekday', + :'start_time' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TimeRestriction` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'end_day') + self.end_day = attributes[:'end_day'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'start_day') + self.start_day = attributes[:'start_day'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + end_day == o.end_day && + end_time == o.end_time && + start_day == o.start_day && + start_time == o.start_time && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [end_day, end_time, start_day, start_time, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/time_restrictions.rb b/lib/datadog_api_client/v2/models/time_restrictions.rb new file mode 100644 index 00000000000..6c4e7de5ddc --- /dev/null +++ b/lib/datadog_api_client/v2/models/time_restrictions.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Holds time zone information and a list of time restrictions for a routing rule. + class TimeRestrictions + include BaseGenericModel + + # Defines the list of time-based restrictions. + attr_reader :restrictions + + # Specifies the time zone applicable to the restrictions. + attr_reader :time_zone + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'restrictions' => :'restrictions', + :'time_zone' => :'time_zone' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'restrictions' => :'Array', + :'time_zone' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TimeRestrictions` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'restrictions') + if (value = attributes[:'restrictions']).is_a?(Array) + self.restrictions = value + end + end + + if attributes.key?(:'time_zone') + self.time_zone = attributes[:'time_zone'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @restrictions.nil? + return false if @time_zone.nil? + true + end + + # Custom attribute writer method with validation + # @param restrictions [Object] Object to be assigned + # @!visibility private + def restrictions=(restrictions) + if restrictions.nil? + fail ArgumentError, 'invalid value for "restrictions", restrictions cannot be nil.' + end + @restrictions = restrictions + end + + # Custom attribute writer method with validation + # @param time_zone [Object] Object to be assigned + # @!visibility private + def time_zone=(time_zone) + if time_zone.nil? + fail ArgumentError, 'invalid value for "time_zone", time_zone cannot be nil.' + end + @time_zone = time_zone + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + restrictions == o.restrictions && + time_zone == o.time_zone && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [restrictions, time_zone, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/urgency.rb b/lib/datadog_api_client/v2/models/urgency.rb new file mode 100644 index 00000000000..75acc646d00 --- /dev/null +++ b/lib/datadog_api_client/v2/models/urgency.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Specifies the level of urgency for a routing rule (low, high, or dynamic). + class Urgency + include BaseEnumModel + + LOW = "low".freeze + HIGH = "high".freeze + DYNAMIC = "dynamic".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/weekday.rb b/lib/datadog_api_client/v2/models/weekday.rb new file mode 100644 index 00000000000..7f84408d194 --- /dev/null +++ b/lib/datadog_api_client/v2/models/weekday.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A day of the week. + class Weekday + include BaseEnumModel + + MONDAY = "monday".freeze + TUESDAY = "tuesday".freeze + WEDNESDAY = "wednesday".freeze + THURSDAY = "thursday".freeze + FRIDAY = "friday".freeze + SATURDAY = "saturday".freeze + SUNDAY = "sunday".freeze + end +end