Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,892 changes: 2,446 additions & 2,446 deletions .generator/schemas/v1/openapi.yaml

Large diffs are not rendered by default.

26,821 changes: 13,500 additions & 13,321 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions examples/v2/on-call/ListOnCallSchedules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
List On-Call schedules returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.on_call_api import OnCallApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = OnCallApi(api_client)
response = api_instance.list_on_call_schedules()

print(response)
13 changes: 13 additions & 0 deletions examples/v2/on-call/ListOnCallSchedules_2357269993.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
List On-Call schedules returns "OK" response with pagination
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.on_call_api import OnCallApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = OnCallApi(api_client)
items = api_instance.list_on_call_schedules_with_pagination()
for item in items:
print(item)
129 changes: 129 additions & 0 deletions src/datadog_api_client/v2/api/on_call_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

import collections
from typing import Any, Dict, Union
import warnings

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.model_utils import (
set_attribute_from_path,
get_attribute_from_path,
UnsetType,
unset,
)
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
from datadog_api_client.v2.model.schedules import Schedules
from datadog_api_client.v2.model.schedule_list_item import ScheduleListItem
from datadog_api_client.v2.model.schedule import Schedule
from datadog_api_client.v2.model.schedule_create_request import ScheduleCreateRequest
from datadog_api_client.v2.model.schedule_update_request import ScheduleUpdateRequest
Expand Down Expand Up @@ -495,6 +500,43 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._list_on_call_schedules_endpoint = _Endpoint(
settings={
"response_type": (Schedules,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/on-call/schedules",
"operation_id": "list_on_call_schedules",
"http_method": "GET",
"version": "v2",
},
params_map={
"page_size": {
"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",
},
"include": {
"openapi_types": (str,),
"attribute": "include",
"location": "query",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._list_user_notification_channels_endpoint = _Endpoint(
settings={
"response_type": (ListNotificationChannelsResponse,),
Expand Down Expand Up @@ -1056,6 +1098,93 @@ def get_user_notification_rule(

return self._get_user_notification_rule_endpoint.call_with_http_info(**kwargs)

def list_on_call_schedules(
self,
*,
page_size: Union[int, UnsetType] = unset,
page_number: Union[int, UnsetType] = unset,
filter_query: Union[str, UnsetType] = unset,
include: Union[str, UnsetType] = unset,
) -> Schedules:
"""List On-Call schedules.

Retrieve a list of On-Call schedules.

:param page_size: Number of items to return per page. The maximum allowed value is 100.
: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 schedules. Supports free-text search on schedule name (case-insensitive, ``*`` wildcards), and structured filters such as ``team.id:<uuid>`` and ``user.id:<uuid>`` (multiple values can be combined with ``OR`` , e.g. ``user.id:(<uuid> OR <uuid>)`` ).
:type filter_query: str, optional
:param include: Comma-separated list of included relationships to be returned. Allowed value: ``teams``.
:type include: str, optional
:rtype: Schedules
"""
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 include is not unset:
kwargs["include"] = include

return self._list_on_call_schedules_endpoint.call_with_http_info(**kwargs)

def list_on_call_schedules_with_pagination(
self,
*,
page_size: Union[int, UnsetType] = unset,
page_number: Union[int, UnsetType] = unset,
filter_query: Union[str, UnsetType] = unset,
include: Union[str, UnsetType] = unset,
) -> collections.abc.Iterable[ScheduleListItem]:
"""List On-Call schedules.

Provide a paginated version of :meth:`list_on_call_schedules`, returning all items.

:param page_size: Number of items to return per page. The maximum allowed value is 100.
: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 schedules. Supports free-text search on schedule name (case-insensitive, ``*`` wildcards), and structured filters such as ``team.id:<uuid>`` and ``user.id:<uuid>`` (multiple values can be combined with ``OR`` , e.g. ``user.id:(<uuid> OR <uuid>)`` ).
:type filter_query: str, optional
:param include: Comma-separated list of included relationships to be returned. Allowed value: ``teams``.
:type include: str, optional

:return: A generator of paginated results.
:rtype: collections.abc.Iterable[ScheduleListItem]
"""
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 include is not unset:
kwargs["include"] = include

local_page_size = get_attribute_from_path(kwargs, "page_size", 10)
endpoint = self._list_on_call_schedules_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_user_notification_channels(
self,
user_id: str,
Expand Down
73 changes: 73 additions & 0 deletions src/datadog_api_client/v2/model/schedule_list_item.py
Original file line number Diff line number Diff line change
@@ -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.schedule_data_attributes import ScheduleDataAttributes
from datadog_api_client.v2.model.schedule_list_item_relationships import ScheduleListItemRelationships
from datadog_api_client.v2.model.schedule_data_type import ScheduleDataType


class ScheduleListItem(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.schedule_data_attributes import ScheduleDataAttributes
from datadog_api_client.v2.model.schedule_list_item_relationships import ScheduleListItemRelationships
from datadog_api_client.v2.model.schedule_data_type import ScheduleDataType

return {
"attributes": (ScheduleDataAttributes,),
"id": (str,),
"relationships": (ScheduleListItemRelationships,),
"type": (ScheduleDataType,),
}

attribute_map = {
"attributes": "attributes",
"id": "id",
"relationships": "relationships",
"type": "type",
}

def __init__(
self_,
id: str,
type: ScheduleDataType,
attributes: Union[ScheduleDataAttributes, UnsetType] = unset,
relationships: Union[ScheduleListItemRelationships, UnsetType] = unset,
**kwargs,
):
"""
Represents a summary of a schedule, linking its core attributes and team relationships.

:param attributes: Provides core properties of a schedule object such as its name and time zone.
:type attributes: ScheduleDataAttributes, optional

:param id: The schedule's unique identifier.
:type id: str

:param relationships: Groups the relationships for a schedule summary, referencing its teams.
:type relationships: ScheduleListItemRelationships, optional

:param type: Schedules resource type.
:type type: ScheduleDataType
"""
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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.data_relationships_teams import DataRelationshipsTeams


class ScheduleListItemRelationships(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.data_relationships_teams import DataRelationshipsTeams

return {
"teams": (DataRelationshipsTeams,),
}

attribute_map = {
"teams": "teams",
}

def __init__(self_, teams: Union[DataRelationshipsTeams, UnsetType] = unset, **kwargs):
"""
Groups the relationships for a schedule summary, referencing its teams.

:param teams: Associates teams with this schedule in a data structure.
:type teams: DataRelationshipsTeams, optional
"""
if teams is not unset:
kwargs["teams"] = teams
super().__init__(kwargs)
66 changes: 66 additions & 0 deletions src/datadog_api_client/v2/model/schedules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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.schedule_list_item import ScheduleListItem
from datadog_api_client.v2.model.team_reference import TeamReference
from datadog_api_client.v2.model.schedules_response_meta import SchedulesResponseMeta


class Schedules(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.schedule_list_item import ScheduleListItem
from datadog_api_client.v2.model.team_reference import TeamReference
from datadog_api_client.v2.model.schedules_response_meta import SchedulesResponseMeta

return {
"data": ([ScheduleListItem],),
"included": ([TeamReference],),
"meta": (SchedulesResponseMeta,),
}

attribute_map = {
"data": "data",
"included": "included",
"meta": "meta",
}

def __init__(
self_,
data: Union[List[ScheduleListItem], UnsetType] = unset,
included: Union[List[TeamReference], UnsetType] = unset,
meta: Union[SchedulesResponseMeta, UnsetType] = unset,
**kwargs,
):
"""
A list of schedules with pagination metadata and any related included resources (such as teams).

:param data: A list of schedules.
:type data: [ScheduleListItem], optional

:param included: Any additional resources related to the schedules, such as teams.
:type included: [TeamReference], optional

:param meta: Metadata that is included in the response when listing schedules.
:type meta: SchedulesResponseMeta, optional
"""
if data is not unset:
kwargs["data"] = data
if included is not unset:
kwargs["included"] = included
if meta is not unset:
kwargs["meta"] = meta
super().__init__(kwargs)
Loading
Loading