diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4656cbfda7..fa846d3779 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -40202,6 +40202,68 @@ components: required: - type type: object + EscalationPolicies: + description: "A paginated list of escalation policies, with any related resources requested through `include`." + properties: + data: + description: "A list of escalation policies." + items: + $ref: "#/components/schemas/EscalationPolicyListItem" + type: array + included: + description: "Provides any included related resources, such as teams, steps, or targets, returned with the policies." + items: + $ref: "#/components/schemas/EscalationPolicyIncluded" + type: array + meta: + $ref: "#/components/schemas/EscalationPoliciesResponseMeta" + required: + - data + type: object + EscalationPoliciesResponseMeta: + description: Metadata included in the response when listing escalation policies. + properties: + page: + $ref: "#/components/schemas/EscalationPoliciesResponseMetaPage" + type: object + EscalationPoliciesResponseMetaPage: + description: Pagination metadata included in the response when listing escalation policies. + properties: + first_number: + description: First page number. + format: int64 + type: integer + last_number: + description: Last page number. + format: int64 + type: integer + next_number: + description: Next page number. + format: int64 + nullable: true + type: integer + number: + description: Page number. + format: int64 + type: integer + prev_number: + description: Previous page number. + format: int64 + nullable: true + type: integer + size: + description: Page size. + format: int64 + type: integer + total: + description: Total number of results. + format: int64 + type: integer + type: + description: Pagination type. + example: "number_size" + type: string + type: object EscalationPolicy: description: "Represents a complete escalation policy response, including policy data and optionally included related resources." example: @@ -40420,6 +40482,14 @@ components: maximum: 10 minimum: 0 type: integer + tags: + description: "A list of tags attached to the escalation policy, in `key:value` format." + example: + - "env:prod" + items: + description: "A tag in `key:value` format." + type: string + type: array required: - name type: object @@ -40481,6 +40551,23 @@ components: - $ref: "#/components/schemas/ScheduleData" - $ref: "#/components/schemas/ConfiguredSchedule" - $ref: "#/components/schemas/TeamReference" + EscalationPolicyListItem: + description: "Represents an escalation policy returned in a list, including its attributes, ID, relationships, and resource type." + properties: + attributes: + $ref: "#/components/schemas/EscalationPolicyDataAttributes" + id: + description: "Specifies the unique identifier of the escalation policy." + example: "ab000000-0000-0000-0000-000000000000" + type: string + relationships: + $ref: "#/components/schemas/EscalationPolicyDataRelationships" + type: + $ref: "#/components/schemas/EscalationPolicyDataType" + required: + - id + - type + type: object EscalationPolicyStep: description: "Represents a single step in an escalation policy, including its attributes, relationships, and resource type." properties: @@ -40697,6 +40784,10 @@ components: EscalationPolicyUserAttributes: description: Provides basic user information for an escalation policy, including a name and email address. properties: + color: + description: "The user's on-call color, as a hex code (for example, `#FF0000`). Included only when `user.color` is requested in the `include` parameter." + example: "#FF0000" + type: string email: description: The user's email address. example: "jane.doe@example.com" @@ -204614,6 +204705,129 @@ paths: permissions: - observability_pipelines_deploy /api/v2/on-call/escalation-policies: + get: + description: Retrieve a paginated list of On-Call escalation policies, sorted by name. + operationId: ListOnCallEscalationPolicies + parameters: + - description: Number of escalation policies to return per page. The maximum allowed value is 50. + in: query + name: page[size] + required: false + schema: + default: 20 + example: 20 + format: int64 + maximum: 50 + type: integer + - $ref: "#/components/parameters/PageNumber" + - description: "Search query to filter escalation policies. Supports free-text search on the policy name (case-insensitive) and structured filters on `team.id` and `tags`. When set, `filter[team_id]`, `filter[user_id]`, and `filter[schedule_id]` are ignored. Can't be combined with `filter[tags]` or `filter[tags_any]`." + in: query + name: filter[query] + required: false + schema: + type: string + - description: Comma-separated list of team IDs. Returns escalation policies that belong to any of these teams or have a step targeting any of them. + in: query + name: filter[team_id] + required: false + schema: + example: "00000000-da3a-0000-0000-000000000000" + type: string + - description: Comma-separated list of user IDs. Returns escalation policies with a step targeting any of these users. + in: query + name: filter[user_id] + required: false + schema: + example: "00000000-aba1-0000-0000-000000000000" + type: string + - description: Comma-separated list of schedule IDs. Returns escalation policies with a step targeting any of these schedules. + in: query + name: filter[schedule_id] + required: false + schema: + example: "00000000-aba2-0000-0000-000000000000" + type: string + - description: "Comma-separated list of `key:value` tags. Returns escalation policies that have all of these tags." + in: query + name: filter[tags] + required: false + schema: + example: "env:prod" + type: string + - description: "Comma-separated list of `key:value` tags. Returns escalation policies that have at least one of these tags." + in: query + name: filter[tags_any] + required: false + schema: + example: "env:prod,env:staging" + type: string + - description: "Comma-separated list of included relationships to be returned. Allowed values: `teams`, `steps`, `steps.targets`, `steps.targets.schedule`, `user.color`. `user.color` populates the `color` attribute of users included through `steps.targets`." + in: query + name: include + required: false + schema: + type: string + responses: + "200": + content: + "application/json": + examples: + default: + value: + data: + - attributes: + name: Escalation Policy 1 + resolve_page_on_policy_end: true + retries: 2 + tags: + - env:prod + id: 00000000-aba1-0000-0000-000000000000 + relationships: + steps: + data: + - id: 00000000-aba1-0000-0000-000000000000 + type: steps + teams: + data: + - id: 00000000-da3a-0000-0000-000000000000 + type: teams + type: policies + meta: + page: + first_number: 0 + last_number: 0 + next_number: + number: 0 + prev_number: + size: 20 + total: 1 + type: number_size + schema: + $ref: "#/components/schemas/EscalationPolicies" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List On-Call escalation policies + tags: + - On-Call + x-pagination: + limitParam: page[size] + pageParam: page[number] + resultsPath: data + "x-permission": + operator: AND + permissions: + - on_call_read post: description: Create a new On-Call escalation policy operationId: CreateOnCallEscalationPolicy diff --git a/examples/v2/on-call/ListOnCallEscalationPolicies.py b/examples/v2/on-call/ListOnCallEscalationPolicies.py new file mode 100644 index 0000000000..af4886059d --- /dev/null +++ b/examples/v2/on-call/ListOnCallEscalationPolicies.py @@ -0,0 +1,21 @@ +""" +List On-Call escalation policies returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.on_call_api import OnCallApi + +# there is a valid "schedule" in the system +SCHEDULE_DATA_ID = environ["SCHEDULE_DATA_ID"] + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = OnCallApi(api_client) + response = api_instance.list_on_call_escalation_policies( + filter_schedule_id=SCHEDULE_DATA_ID, + include="steps.targets", + ) + + print(response) diff --git a/examples/v2/on-call/ListOnCallEscalationPolicies_2198542788.py b/examples/v2/on-call/ListOnCallEscalationPolicies_2198542788.py new file mode 100644 index 0000000000..9d6d93d502 --- /dev/null +++ b/examples/v2/on-call/ListOnCallEscalationPolicies_2198542788.py @@ -0,0 +1,15 @@ +""" +List On-Call escalation policies returns "OK" response with pagination +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.on_call_api import OnCallApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = OnCallApi(api_client) + items = api_instance.list_on_call_escalation_policies_with_pagination() + for item in items: + print(item) diff --git a/src/datadog_api_client/v2/api/on_call_api.py b/src/datadog_api_client/v2/api/on_call_api.py index 096b99d30b..eac7798b15 100644 --- a/src/datadog_api_client/v2/api/on_call_api.py +++ b/src/datadog_api_client/v2/api/on_call_api.py @@ -16,6 +16,8 @@ UnsetType, unset, ) +from datadog_api_client.v2.model.escalation_policies import EscalationPolicies +from datadog_api_client.v2.model.escalation_policy_list_item import EscalationPolicyListItem from datadog_api_client.v2.model.escalation_policy import EscalationPolicy from datadog_api_client.v2.model.escalation_policy_create_request import EscalationPolicyCreateRequest from datadog_api_client.v2.model.escalation_policy_update_request import EscalationPolicyUpdateRequest @@ -565,6 +567,71 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_on_call_escalation_policies_endpoint = _Endpoint( + settings={ + "response_type": (EscalationPolicies,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/on-call/escalation-policies", + "operation_id": "list_on_call_escalation_policies", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_size": { + "validation": { + "inclusive_maximum": 50, + }, + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + "filter_query": { + "openapi_types": (str,), + "attribute": "filter[query]", + "location": "query", + }, + "filter_team_id": { + "openapi_types": (str,), + "attribute": "filter[team_id]", + "location": "query", + }, + "filter_user_id": { + "openapi_types": (str,), + "attribute": "filter[user_id]", + "location": "query", + }, + "filter_schedule_id": { + "openapi_types": (str,), + "attribute": "filter[schedule_id]", + "location": "query", + }, + "filter_tags": { + "openapi_types": (str,), + "attribute": "filter[tags]", + "location": "query", + }, + "filter_tags_any": { + "openapi_types": (str,), + "attribute": "filter[tags_any]", + "location": "query", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_on_call_schedules_endpoint = _Endpoint( settings={ "response_type": (Schedules,), @@ -1266,6 +1333,153 @@ def get_user_notification_rule( return self._get_user_notification_rule_endpoint.call_with_http_info(**kwargs) + def list_on_call_escalation_policies( + self, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + filter_query: Union[str, UnsetType] = unset, + filter_team_id: Union[str, UnsetType] = unset, + filter_user_id: Union[str, UnsetType] = unset, + filter_schedule_id: Union[str, UnsetType] = unset, + filter_tags: Union[str, UnsetType] = unset, + filter_tags_any: Union[str, UnsetType] = unset, + include: Union[str, UnsetType] = unset, + ) -> EscalationPolicies: + """List On-Call escalation policies. + + Retrieve a paginated list of On-Call escalation policies, sorted by name. + + :param page_size: Number of escalation policies to return per page. The maximum allowed value is 50. + :type page_size: int, optional + :param page_number: Specific page number to return. + :type page_number: int, optional + :param filter_query: Search query to filter escalation policies. Supports free-text search on the policy name (case-insensitive) and structured filters on ``team.id`` and ``tags``. When set, ``filter[team_id]`` , ``filter[user_id]`` , and ``filter[schedule_id]`` are ignored. Can't be combined with ``filter[tags]`` or ``filter[tags_any]``. + :type filter_query: str, optional + :param filter_team_id: Comma-separated list of team IDs. Returns escalation policies that belong to any of these teams or have a step targeting any of them. + :type filter_team_id: str, optional + :param filter_user_id: Comma-separated list of user IDs. Returns escalation policies with a step targeting any of these users. + :type filter_user_id: str, optional + :param filter_schedule_id: Comma-separated list of schedule IDs. Returns escalation policies with a step targeting any of these schedules. + :type filter_schedule_id: str, optional + :param filter_tags: Comma-separated list of ``key:value`` tags. Returns escalation policies that have all of these tags. + :type filter_tags: str, optional + :param filter_tags_any: Comma-separated list of ``key:value`` tags. Returns escalation policies that have at least one of these tags. + :type filter_tags_any: str, optional + :param include: Comma-separated list of included relationships to be returned. Allowed values: ``teams`` , ``steps`` , ``steps.targets`` , ``steps.targets.schedule`` , ``user.color``. ``user.color`` populates the ``color`` attribute of users included through ``steps.targets``. + :type include: str, optional + :rtype: EscalationPolicies + """ + kwargs: Dict[str, Any] = {} + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + if filter_query is not unset: + kwargs["filter_query"] = filter_query + + if filter_team_id is not unset: + kwargs["filter_team_id"] = filter_team_id + + if filter_user_id is not unset: + kwargs["filter_user_id"] = filter_user_id + + if filter_schedule_id is not unset: + kwargs["filter_schedule_id"] = filter_schedule_id + + if filter_tags is not unset: + kwargs["filter_tags"] = filter_tags + + if filter_tags_any is not unset: + kwargs["filter_tags_any"] = filter_tags_any + + if include is not unset: + kwargs["include"] = include + + return self._list_on_call_escalation_policies_endpoint.call_with_http_info(**kwargs) + + def list_on_call_escalation_policies_with_pagination( + self, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + filter_query: Union[str, UnsetType] = unset, + filter_team_id: Union[str, UnsetType] = unset, + filter_user_id: Union[str, UnsetType] = unset, + filter_schedule_id: Union[str, UnsetType] = unset, + filter_tags: Union[str, UnsetType] = unset, + filter_tags_any: Union[str, UnsetType] = unset, + include: Union[str, UnsetType] = unset, + ) -> collections.abc.Iterable[EscalationPolicyListItem]: + """List On-Call escalation policies. + + Provide a paginated version of :meth:`list_on_call_escalation_policies`, returning all items. + + :param page_size: Number of escalation policies to return per page. The maximum allowed value is 50. + :type page_size: int, optional + :param page_number: Specific page number to return. + :type page_number: int, optional + :param filter_query: Search query to filter escalation policies. Supports free-text search on the policy name (case-insensitive) and structured filters on ``team.id`` and ``tags``. When set, ``filter[team_id]`` , ``filter[user_id]`` , and ``filter[schedule_id]`` are ignored. Can't be combined with ``filter[tags]`` or ``filter[tags_any]``. + :type filter_query: str, optional + :param filter_team_id: Comma-separated list of team IDs. Returns escalation policies that belong to any of these teams or have a step targeting any of them. + :type filter_team_id: str, optional + :param filter_user_id: Comma-separated list of user IDs. Returns escalation policies with a step targeting any of these users. + :type filter_user_id: str, optional + :param filter_schedule_id: Comma-separated list of schedule IDs. Returns escalation policies with a step targeting any of these schedules. + :type filter_schedule_id: str, optional + :param filter_tags: Comma-separated list of ``key:value`` tags. Returns escalation policies that have all of these tags. + :type filter_tags: str, optional + :param filter_tags_any: Comma-separated list of ``key:value`` tags. Returns escalation policies that have at least one of these tags. + :type filter_tags_any: str, optional + :param include: Comma-separated list of included relationships to be returned. Allowed values: ``teams`` , ``steps`` , ``steps.targets`` , ``steps.targets.schedule`` , ``user.color``. ``user.color`` populates the ``color`` attribute of users included through ``steps.targets``. + :type include: str, optional + + :return: A generator of paginated results. + :rtype: collections.abc.Iterable[EscalationPolicyListItem] + """ + kwargs: Dict[str, Any] = {} + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + if filter_query is not unset: + kwargs["filter_query"] = filter_query + + if filter_team_id is not unset: + kwargs["filter_team_id"] = filter_team_id + + if filter_user_id is not unset: + kwargs["filter_user_id"] = filter_user_id + + if filter_schedule_id is not unset: + kwargs["filter_schedule_id"] = filter_schedule_id + + if filter_tags is not unset: + kwargs["filter_tags"] = filter_tags + + if filter_tags_any is not unset: + kwargs["filter_tags_any"] = filter_tags_any + + if include is not unset: + kwargs["include"] = include + + local_page_size = get_attribute_from_path(kwargs, "page_size", 20) + endpoint = self._list_on_call_escalation_policies_endpoint + set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map) + pagination = { + "limit_value": local_page_size, + "results_path": "data", + "page_param": "page_number", + "page_start": 0, + "endpoint": endpoint, + "kwargs": kwargs, + } + return endpoint.call_with_http_info_paginated(pagination) + def list_on_call_schedules( self, *, diff --git a/src/datadog_api_client/v2/model/escalation_policies.py b/src/datadog_api_client/v2/model/escalation_policies.py new file mode 100644 index 0000000000..70e6ddebb2 --- /dev/null +++ b/src/datadog_api_client/v2/model/escalation_policies.py @@ -0,0 +1,83 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.escalation_policy_list_item import EscalationPolicyListItem + from datadog_api_client.v2.model.escalation_policy_included import EscalationPolicyIncluded + from datadog_api_client.v2.model.escalation_policies_response_meta import EscalationPoliciesResponseMeta + from datadog_api_client.v2.model.escalation_policy_step import EscalationPolicyStep + from datadog_api_client.v2.model.escalation_policy_user import EscalationPolicyUser + from datadog_api_client.v2.model.schedule_data import ScheduleData + from datadog_api_client.v2.model.configured_schedule import ConfiguredSchedule + from datadog_api_client.v2.model.team_reference import TeamReference + + +class EscalationPolicies(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.escalation_policy_list_item import EscalationPolicyListItem + from datadog_api_client.v2.model.escalation_policy_included import EscalationPolicyIncluded + from datadog_api_client.v2.model.escalation_policies_response_meta import EscalationPoliciesResponseMeta + + return { + "data": ([EscalationPolicyListItem],), + "included": ([EscalationPolicyIncluded],), + "meta": (EscalationPoliciesResponseMeta,), + } + + attribute_map = { + "data": "data", + "included": "included", + "meta": "meta", + } + + def __init__( + self_, + data: List[EscalationPolicyListItem], + included: Union[ + List[ + Union[ + EscalationPolicyIncluded, + EscalationPolicyStep, + EscalationPolicyUser, + ScheduleData, + ConfiguredSchedule, + TeamReference, + ] + ], + UnsetType, + ] = unset, + meta: Union[EscalationPoliciesResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + A paginated list of escalation policies, with any related resources requested through ``include``. + + :param data: A list of escalation policies. + :type data: [EscalationPolicyListItem] + + :param included: Provides any included related resources, such as teams, steps, or targets, returned with the policies. + :type included: [EscalationPolicyIncluded], optional + + :param meta: Metadata included in the response when listing escalation policies. + :type meta: EscalationPoliciesResponseMeta, optional + """ + if included is not unset: + kwargs["included"] = included + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/escalation_policies_response_meta.py b/src/datadog_api_client/v2/model/escalation_policies_response_meta.py new file mode 100644 index 0000000000..7251fc58bb --- /dev/null +++ b/src/datadog_api_client/v2/model/escalation_policies_response_meta.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.escalation_policies_response_meta_page import EscalationPoliciesResponseMetaPage + + +class EscalationPoliciesResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.escalation_policies_response_meta_page import ( + EscalationPoliciesResponseMetaPage, + ) + + return { + "page": (EscalationPoliciesResponseMetaPage,), + } + + attribute_map = { + "page": "page", + } + + def __init__(self_, page: Union[EscalationPoliciesResponseMetaPage, UnsetType] = unset, **kwargs): + """ + Metadata included in the response when listing escalation policies. + + :param page: Pagination metadata included in the response when listing escalation policies. + :type page: EscalationPoliciesResponseMetaPage, optional + """ + if page is not unset: + kwargs["page"] = page + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/escalation_policies_response_meta_page.py b/src/datadog_api_client/v2/model/escalation_policies_response_meta_page.py new file mode 100644 index 0000000000..4808ebba82 --- /dev/null +++ b/src/datadog_api_client/v2/model/escalation_policies_response_meta_page.py @@ -0,0 +1,97 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +class EscalationPoliciesResponseMetaPage(ModelNormal): + @cached_property + def openapi_types(_): + return { + "first_number": (int,), + "last_number": (int,), + "next_number": (int, none_type), + "number": (int,), + "prev_number": (int, none_type), + "size": (int,), + "total": (int,), + "type": (str,), + } + + attribute_map = { + "first_number": "first_number", + "last_number": "last_number", + "next_number": "next_number", + "number": "number", + "prev_number": "prev_number", + "size": "size", + "total": "total", + "type": "type", + } + + def __init__( + self_, + first_number: Union[int, UnsetType] = unset, + last_number: Union[int, UnsetType] = unset, + next_number: Union[int, none_type, UnsetType] = unset, + number: Union[int, UnsetType] = unset, + prev_number: Union[int, none_type, UnsetType] = unset, + size: Union[int, UnsetType] = unset, + total: Union[int, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Pagination metadata included in the response when listing escalation policies. + + :param first_number: First page number. + :type first_number: int, optional + + :param last_number: Last page number. + :type last_number: int, optional + + :param next_number: Next page number. + :type next_number: int, none_type, optional + + :param number: Page number. + :type number: int, optional + + :param prev_number: Previous page number. + :type prev_number: int, none_type, optional + + :param size: Page size. + :type size: int, optional + + :param total: Total number of results. + :type total: int, optional + + :param type: Pagination type. + :type type: str, optional + """ + if first_number is not unset: + kwargs["first_number"] = first_number + if last_number is not unset: + kwargs["last_number"] = last_number + if next_number is not unset: + kwargs["next_number"] = next_number + if number is not unset: + kwargs["number"] = number + if prev_number is not unset: + kwargs["prev_number"] = prev_number + if size is not unset: + kwargs["size"] = size + if total is not unset: + kwargs["total"] = total + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/escalation_policy_data_attributes.py b/src/datadog_api_client/v2/model/escalation_policy_data_attributes.py index f2d126341a..438e05bc2c 100644 --- a/src/datadog_api_client/v2/model/escalation_policy_data_attributes.py +++ b/src/datadog_api_client/v2/model/escalation_policy_data_attributes.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import List, Union from datadog_api_client.model_utils import ( ModelNormal, @@ -30,12 +30,14 @@ def openapi_types(_): "name": (str,), "resolve_page_on_policy_end": (bool,), "retries": (int,), + "tags": ([str],), } attribute_map = { "name": "name", "resolve_page_on_policy_end": "resolve_page_on_policy_end", "retries": "retries", + "tags": "tags", } def __init__( @@ -43,6 +45,7 @@ def __init__( name: str, resolve_page_on_policy_end: Union[bool, UnsetType] = unset, retries: Union[int, UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, **kwargs, ): """ @@ -56,11 +59,16 @@ def __init__( :param retries: Specifies how many times the escalation sequence is retried if there is no response. :type retries: int, optional + + :param tags: A list of tags attached to the escalation policy, in ``key:value`` format. + :type tags: [str], optional """ if resolve_page_on_policy_end is not unset: kwargs["resolve_page_on_policy_end"] = resolve_page_on_policy_end if retries is not unset: kwargs["retries"] = retries + if tags is not unset: + kwargs["tags"] = tags super().__init__(kwargs) self_.name = name diff --git a/src/datadog_api_client/v2/model/escalation_policy_list_item.py b/src/datadog_api_client/v2/model/escalation_policy_list_item.py new file mode 100644 index 0000000000..5dff96ef89 --- /dev/null +++ b/src/datadog_api_client/v2/model/escalation_policy_list_item.py @@ -0,0 +1,73 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.escalation_policy_data_attributes import EscalationPolicyDataAttributes + from datadog_api_client.v2.model.escalation_policy_data_relationships import EscalationPolicyDataRelationships + from datadog_api_client.v2.model.escalation_policy_data_type import EscalationPolicyDataType + + +class EscalationPolicyListItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.escalation_policy_data_attributes import EscalationPolicyDataAttributes + from datadog_api_client.v2.model.escalation_policy_data_relationships import EscalationPolicyDataRelationships + from datadog_api_client.v2.model.escalation_policy_data_type import EscalationPolicyDataType + + return { + "attributes": (EscalationPolicyDataAttributes,), + "id": (str,), + "relationships": (EscalationPolicyDataRelationships,), + "type": (EscalationPolicyDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + id: str, + type: EscalationPolicyDataType, + attributes: Union[EscalationPolicyDataAttributes, UnsetType] = unset, + relationships: Union[EscalationPolicyDataRelationships, UnsetType] = unset, + **kwargs, + ): + """ + Represents an escalation policy returned in a list, including its attributes, ID, relationships, and resource type. + + :param attributes: Defines the main attributes of an escalation policy, such as its name and behavior on policy end. + :type attributes: EscalationPolicyDataAttributes, optional + + :param id: Specifies the unique identifier of the escalation policy. + :type id: str + + :param relationships: Represents the relationships for an escalation policy, including references to steps and teams. + :type relationships: EscalationPolicyDataRelationships, optional + + :param type: Indicates that the resource is of type ``policies``. + :type type: EscalationPolicyDataType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if relationships is not unset: + kwargs["relationships"] = relationships + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/escalation_policy_user_attributes.py b/src/datadog_api_client/v2/model/escalation_policy_user_attributes.py index 12e78d5875..8038f2a75b 100644 --- a/src/datadog_api_client/v2/model/escalation_policy_user_attributes.py +++ b/src/datadog_api_client/v2/model/escalation_policy_user_attributes.py @@ -23,12 +23,14 @@ def openapi_types(_): from datadog_api_client.v2.model.user_attributes_status import UserAttributesStatus return { + "color": (str,), "email": (str,), "name": (str,), "status": (UserAttributesStatus,), } attribute_map = { + "color": "color", "email": "email", "name": "name", "status": "status", @@ -36,6 +38,7 @@ def openapi_types(_): def __init__( self_, + color: Union[str, UnsetType] = unset, email: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, status: Union[UserAttributesStatus, UnsetType] = unset, @@ -44,6 +47,9 @@ def __init__( """ Provides basic user information for an escalation policy, including a name and email address. + :param color: The user's on-call color, as a hex code (for example, ``#FF0000`` ). Included only when ``user.color`` is requested in the ``include`` parameter. + :type color: str, optional + :param email: The user's email address. :type email: str, optional @@ -53,6 +59,8 @@ def __init__( :param status: The user's status. :type status: UserAttributesStatus, optional """ + if color is not unset: + kwargs["color"] = color if email is not unset: kwargs["email"] = email if name is not unset: diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 543921c8a7..42918f0312 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3184,6 +3184,9 @@ from datadog_api_client.v2.model.environments_pagination_meta_page import EnvironmentsPaginationMetaPage from datadog_api_client.v2.model.error_handler import ErrorHandler from datadog_api_client.v2.model.escalation import Escalation +from datadog_api_client.v2.model.escalation_policies import EscalationPolicies +from datadog_api_client.v2.model.escalation_policies_response_meta import EscalationPoliciesResponseMeta +from datadog_api_client.v2.model.escalation_policies_response_meta_page import EscalationPoliciesResponseMetaPage from datadog_api_client.v2.model.escalation_policy import EscalationPolicy from datadog_api_client.v2.model.escalation_policy_create_request import EscalationPolicyCreateRequest from datadog_api_client.v2.model.escalation_policy_create_request_data import EscalationPolicyCreateRequestData @@ -3211,6 +3214,7 @@ ) from datadog_api_client.v2.model.escalation_policy_data_type import EscalationPolicyDataType from datadog_api_client.v2.model.escalation_policy_included import EscalationPolicyIncluded +from datadog_api_client.v2.model.escalation_policy_list_item import EscalationPolicyListItem from datadog_api_client.v2.model.escalation_policy_step import EscalationPolicyStep from datadog_api_client.v2.model.escalation_policy_step_attributes import EscalationPolicyStepAttributes from datadog_api_client.v2.model.escalation_policy_step_attributes_assignment import ( @@ -15182,6 +15186,9 @@ "EnvironmentsPaginationMetaPage", "ErrorHandler", "Escalation", + "EscalationPolicies", + "EscalationPoliciesResponseMeta", + "EscalationPoliciesResponseMetaPage", "EscalationPolicy", "EscalationPolicyCreateRequest", "EscalationPolicyCreateRequestData", @@ -15197,6 +15204,7 @@ "EscalationPolicyDataRelationshipsStepsDataItemsType", "EscalationPolicyDataType", "EscalationPolicyIncluded", + "EscalationPolicyListItem", "EscalationPolicyStep", "EscalationPolicyStepAttributes", "EscalationPolicyStepAttributesAssignment", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index 399fd8997a..8131b0f6f4 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -8988,6 +8988,13 @@ "scenario": "Get team on-call users returns \"OK\" response", "version": "v2" }, + { + "feature": "On-Call", + "feature_file": "../../v2/features/on-call.feature", + "file": "v2/on-call/list-on-call-escalation-policies-returns-ok-response.json", + "scenario": "List On-Call escalation policies returns \"OK\" response", + "version": "v2" + }, { "feature": "On-Call", "feature_file": "../../v2/features/on-call.feature", diff --git a/tests/generated-test/test-runner-data/v2/on-call/list-on-call-escalation-policies-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/on-call/list-on-call-escalation-policies-returns-ok-response.json new file mode 100644 index 0000000000..18b6c5dda9 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/on-call/list-on-call-escalation-policies-returns-ok-response.json @@ -0,0 +1,51 @@ +{ + "api": "On-Call", + "expected_status": 200, + "feature": "On-Call", + "id": "v2/On-Call/List On-Call escalation policies returns \"OK\" response", + "operation_id": "ListOnCallEscalationPolicies", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[schedule_id]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "path": "schedule.data.id", + "type": "fixture" + }, + "style": null + }, + { + "explode": null, + "in": "query", + "name": "include", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "steps.targets" + }, + "style": null + } + ], + "path": "/api/v2/on-call/escalation-policies" + }, + "scenario": "List On-Call escalation policies returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-server-data/v2/on-call.json b/tests/generated-test/test-server-data/v2/on-call.json index 436a2fde97..a6fe6f6f7c 100644 --- a/tests/generated-test/test-server-data/v2/on-call.json +++ b/tests/generated-test/test-server-data/v2/on-call.json @@ -3674,6 +3674,340 @@ "scenario": "Get team on-call users returns \"OK\" response", "version": "v2" }, + { + "feature": "On-Call", + "frozen_at": "2026-10-21T07:56:00.111Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "email": "Test-List_On_Call_escalation_policies_returns_OK_response-1792569360@datadoghq.com", + "title": "user title" + }, + "type": "users" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/users", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"type\":\"users\",\"id\":\"b59d1cec-8aae-4b77-90b1-51383a15fa9c\",\"attributes\":{\"uuid\":\"b59d1cec-8aae-4b77-90b1-51383a15fa9c\",\"name\":null,\"handle\":\"test-list_on_call_escalation_policies_returns_ok_response-1792569360@datadoghq.com\",\"created_at\":\"2026-10-21T07:56:00.661034+00:00\",\"modified_at\":\"2026-10-21T07:56:00.661034+00:00\",\"email\":\"test-list_on_call_escalation_policies_returns_ok_response-1792569360@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/d037931a8597527c0e9740820b731ea9?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "Created", + "status": 201 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "handle": "test-handle-4b526d34522a83e5", + "name": "test-name-4b526d34522a83e5" + }, + "type": "team" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/team", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":0,\"created_at\":\"2026-10-21T07:56:01.240173+00:00\",\"description\":null,\"handle\":\"test-handle-4b526d34522a83e5\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2026-10-21T07:56:01.240173+00:00\",\"name\":\"test-name-4b526d34522a83e5\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee/permission-settings\"}}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Created", + "status": 201 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "layers": [ + { + "effective_date": "2026-10-11T07:56:00.111Z", + "end_date": "2026-10-31T07:56:00.111Z", + "interval": { + "days": 1 + }, + "members": [ + { + "user": { + "id": "b59d1cec-8aae-4b77-90b1-51383a15fa9c" + } + } + ], + "name": "Layer 1", + "restrictions": [ + { + "end_day": "friday", + "end_time": "17:00:00", + "start_day": "monday", + "start_time": "09:00:00" + } + ], + "rotation_start": "2026-10-16T07:56:00.111Z" + } + ], + "name": "Test-List_On_Call_escalation_policies_returns_OK_response-1792569360", + "time_zone": "America/New_York" + }, + "relationships": { + "teams": { + "data": [ + { + "id": "65aea9d0-941c-4607-bf8a-14fc0dac2820", + "type": "teams" + } + ] + } + }, + "type": "schedules" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/on-call/schedules", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"4be12f3a-531d-472d-8597-796017572212\",\"type\":\"schedules\",\"attributes\":{\"name\":\"Test-List_On_Call_escalation_policies_returns_OK_response-1792569360\",\"tags\":[],\"time_zone\":\"America/New_York\"},\"relationships\":{\"layers\":{\"data\":[{\"id\":\"397a6351-607e-4151-8617-19f1b2107533\",\"type\":\"layers\"}]},\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Created", + "status": 201 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "name": "Test-List_On_Call_escalation_policies_returns_OK_response-1792569360", + "resolve_page_on_policy_end": true, + "retries": 2, + "steps": [ + { + "assignment": "default", + "escalate_after_seconds": 3600, + "targets": [ + { + "id": "32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee", + "type": "teams" + }, + { + "id": "4be12f3a-531d-472d-8597-796017572212", + "type": "schedules" + }, + { + "config": { + "schedule": { + "position": "previous" + } + }, + "id": "4be12f3a-531d-472d-8597-796017572212", + "type": "schedules" + }, + { + "id": "b59d1cec-8aae-4b77-90b1-51383a15fa9c", + "type": "users" + } + ] + }, + { + "assignment": "round-robin", + "escalate_after_seconds": 3600, + "targets": [ + { + "id": "32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee", + "type": "teams" + } + ] + } + ] + }, + "relationships": { + "teams": { + "data": [ + { + "id": "32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee", + "type": "teams" + } + ] + } + }, + "type": "policies" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/on-call/escalation-policies", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"fa88ac55-aa5d-470d-abbd-5a160d6f4d5c\",\"type\":\"policies\",\"attributes\":{\"name\":\"Test-List_On_Call_escalation_policies_returns_OK_response-1792569360\",\"resolve_page_on_policy_end\":true,\"retries\":2,\"tags\":[]},\"relationships\":{\"steps\":{\"data\":[{\"id\":\"cf613965-854c-48fd-a299-cda5d491a132\",\"type\":\"steps\"},{\"id\":\"11d3ca7e-aa82-4dcc-9147-6a0fec5f222c\",\"type\":\"steps\"}]},\"teams\":{\"data\":[{\"id\":\"32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee\",\"type\":\"teams\"}]}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Created", + "status": 201 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/on-call/escalation-policies", + "query": [ + [ + "filter[schedule_id]", + "4be12f3a-531d-472d-8597-796017572212" + ], + [ + "include", + "steps.targets" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[{\"id\":\"fa88ac55-aa5d-470d-abbd-5a160d6f4d5c\",\"type\":\"policies\",\"attributes\":{\"name\":\"Test-List_On_Call_escalation_policies_returns_OK_response-1792569360\",\"resolve_page_on_policy_end\":true,\"retries\":2,\"tags\":[]},\"relationships\":{\"steps\":{\"data\":[{\"id\":\"cf613965-854c-48fd-a299-cda5d491a132\",\"type\":\"steps\"},{\"id\":\"11d3ca7e-aa82-4dcc-9147-6a0fec5f222c\",\"type\":\"steps\"}]},\"teams\":{\"data\":[{\"id\":\"32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee\",\"type\":\"teams\"}]}}}],\"meta\":{\"page\":{\"type\":\"number_size\",\"number\":0,\"size\":20,\"total\":1,\"first_number\":0,\"prev_number\":null,\"next_number\":null,\"last_number\":0}},\"included\":[{\"id\":\"cf613965-854c-48fd-a299-cda5d491a132\",\"type\":\"steps\",\"attributes\":{\"assignment\":\"default\",\"escalate_after_seconds\":3600},\"relationships\":{\"targets\":{\"data\":[{\"id\":\"32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee\",\"type\":\"teams\"},{\"id\":\"4be12f3a-531d-472d-8597-796017572212\",\"type\":\"schedules\"},{\"id\":\"4be12f3a-531d-472d-8597-796017572212_previous\",\"type\":\"schedule_target\"},{\"id\":\"b59d1cec-8aae-4b77-90b1-51383a15fa9c\",\"type\":\"users\"}]}}},{\"id\":\"4be12f3a-531d-472d-8597-796017572212_previous\",\"type\":\"schedule_target\",\"attributes\":{\"position\":\"previous\"},\"relationships\":{\"schedule\":{\"data\":{\"id\":\"4be12f3a-531d-472d-8597-796017572212\",\"type\":\"schedules\"}}}},{\"id\":\"11d3ca7e-aa82-4dcc-9147-6a0fec5f222c\",\"type\":\"steps\",\"attributes\":{\"assignment\":\"round-robin\",\"escalate_after_seconds\":3600},\"relationships\":{\"targets\":{\"data\":[{\"id\":\"32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee\",\"type\":\"teams\"}]}}},{\"id\":\"32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee\",\"type\":\"teams\",\"attributes\":{\"avatar\":\"\",\"description\":\"\",\"handle\":\"test-handle-4b526d34522a83e5\",\"name\":\"test-name-4b526d34522a83e5\"}},{\"id\":\"4be12f3a-531d-472d-8597-796017572212\",\"type\":\"schedules\",\"attributes\":{\"name\":\"Test-List_On_Call_escalation_policies_returns_OK_response-1792569360\",\"tags\":[],\"time_zone\":\"America/New_York\"},\"relationships\":{\"layers\":{\"data\":[{\"id\":\"397a6351-607e-4151-8617-19f1b2107533\",\"type\":\"layers\"}]},\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}}},{\"id\":\"b59d1cec-8aae-4b77-90b1-51383a15fa9c\",\"type\":\"users\",\"attributes\":{\"email\":\"test-list_on_call_escalation_policies_returns_ok_response-1792569360@datadoghq.com\",\"name\":\"\",\"status\":\"pending\"}}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/on-call/escalation-policies/fa88ac55-aa5d-470d-abbd-5a160d6f4d5c", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/on-call/schedules/4be12f3a-531d-472d-8597-796017572212", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/team/32f0af28-fc1d-4b2e-8e1d-9a39b3fb3aee", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/users/b59d1cec-8aae-4b77-90b1-51383a15fa9c", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "List On-Call escalation policies returns \"OK\" response", + "version": "v2" + }, { "feature": "On-Call", "frozen_at": "2025-12-12T14:40:40.219Z", diff --git a/tests/v2/features/on-call.feature b/tests/v2/features/on-call.feature index 0288aa15cf..f782b41d09 100644 --- a/tests/v2/features/on-call.feature +++ b/tests/v2/features/on-call.feature @@ -426,6 +426,32 @@ Feature: On-Call When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/on-call + Scenario: List On-Call escalation policies returns "Bad Request" response + Given new "ListOnCallEscalationPolicies" request + When the request is sent + Then the response status is 400 Bad Request + + @team:ddoghq/on-call + Scenario: List On-Call escalation policies returns "OK" response + Given new "ListOnCallEscalationPolicies" 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 "filter[schedule_id]" parameter from "schedule.data.id" + And request contains "include" parameter with value "steps.targets" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].id" is equal to "{{ escalation_policy.data.id }}" + + @generated @skip @team:ddoghq/on-call @with-pagination + Scenario: List On-Call escalation policies returns "OK" response with pagination + Given new "ListOnCallEscalationPolicies" request + When the request with pagination is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/on-call Scenario: List On-Call notification channels for a user returns "Bad Request" response Given new "ListUserNotificationChannels" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3f937ed045..37961c9528 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -6656,6 +6656,12 @@ "type": "idempotent" } }, + "ListOnCallEscalationPolicies": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, "CreateOnCallEscalationPolicy": { "tag": "On-Call", "undo": {