Skip to content
Open
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
901 changes: 882 additions & 19 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/v2/on-call-paging/AcknowledgeOnCallPage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Acknowledge On-Call Page returns "Accepted." response
Acknowledge On-Call Page returns "No Content." response
"""

from os import environ
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/on-call-paging/CreateOnCallPage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Create On-Call Page returns "OK." response
Create On-Call Page returns "Created." response
"""

from os import environ
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/on-call-paging/EscalateOnCallPage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Escalate On-Call Page returns "Accepted." response
Escalate On-Call Page returns "No Content." response
"""

from os import environ
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/on-call-paging/ResolveOnCallPage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Resolve On-Call Page returns "Accepted." response
Resolve On-Call Page returns "No Content." response
"""

from os import environ
Expand Down
17 changes: 17 additions & 0 deletions examples/v2/on-call/GetOnCallPage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Get On-Call page 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

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = OnCallApi(api_client)
response = api_instance.get_on_call_page(
page_id="f63eb677-07ce-46ab-b2e0-80ca1ffe91bf",
)

print(response)
17 changes: 17 additions & 0 deletions examples/v2/on-call/ListOnCallPages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
List On-Call pages 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

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_pages(
filter_query="key:1",
)

print(response)
15 changes: 15 additions & 0 deletions examples/v2/on-call/ListOnCallPages_785978425.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
List On-Call pages 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_pages_with_pagination()
for item in items:
print(item)
174 changes: 174 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 @@ -21,6 +21,10 @@
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.on_call_pages_response import OnCallPagesResponse
from datadog_api_client.v2.model.on_call_pages_sort import OnCallPagesSort
from datadog_api_client.v2.model.on_call_page_data import OnCallPageData
from datadog_api_client.v2.model.on_call_page_response import OnCallPageResponse
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
Expand Down Expand Up @@ -349,6 +353,29 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._get_on_call_page_endpoint = _Endpoint(
settings={
"response_type": (OnCallPageResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/on-call/pages/{page_id}",
"operation_id": "get_on_call_page",
"http_method": "GET",
"version": "v2",
},
params_map={
"page_id": {
"required": True,
"openapi_types": (str,),
"attribute": "page_id",
"location": "path",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._get_on_call_schedule_endpoint = _Endpoint(
settings={
"response_type": (Schedule,),
Expand Down Expand Up @@ -632,6 +659,49 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._list_on_call_pages_endpoint = _Endpoint(
settings={
"response_type": (OnCallPagesResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/on-call/pages",
"operation_id": "list_on_call_pages",
"http_method": "GET",
"version": "v2",
},
params_map={
"page_size": {
"validation": {
"inclusive_maximum": 1000,
},
"openapi_types": (int,),
"attribute": "page[size]",
"location": "query",
},
"page_number": {
"validation": {
"inclusive_minimum": 0,
},
"openapi_types": (int,),
"attribute": "page[number]",
"location": "query",
},
"filter_query": {
"openapi_types": (str,),
"attribute": "filter[query]",
"location": "query",
},
"sort": {
"openapi_types": (OnCallPagesSort,),
"attribute": "sort",
"location": "query",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._list_on_call_schedules_endpoint = _Endpoint(
settings={
"response_type": (Schedules,),
Expand Down Expand Up @@ -1143,6 +1213,23 @@ def get_on_call_escalation_policy(

return self._get_on_call_escalation_policy_endpoint.call_with_http_info(**kwargs)

def get_on_call_page(
self,
page_id: str,
) -> OnCallPageResponse:
"""Get On-Call page.

Get the details of an On-Call page.

:param page_id: The ID of the page, or its key.
:type page_id: str
:rtype: OnCallPageResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["page_id"] = page_id

return self._get_on_call_page_endpoint.call_with_http_info(**kwargs)

def get_on_call_schedule(
self,
schedule_id: str,
Expand Down Expand Up @@ -1480,6 +1567,93 @@ def list_on_call_escalation_policies_with_pagination(
}
return endpoint.call_with_http_info_paginated(pagination)

def list_on_call_pages(
self,
*,
page_size: Union[int, UnsetType] = unset,
page_number: Union[int, UnsetType] = unset,
filter_query: Union[str, UnsetType] = unset,
sort: Union[OnCallPagesSort, UnsetType] = unset,
) -> OnCallPagesResponse:
"""List On-Call pages.

Retrieve a paginated list of On-Call pages, optionally filtered by a search query and sorted.

:param page_size: Number of On-Call Pages to return per page of results. The maximum allowed value is 1000.
:type page_size: int, optional
:param page_number: Page of results to return, starting at 0. ``page[number]`` multiplied by ``page[size]`` must be less than 50000.
:type page_number: int, optional
:param filter_query: Search query to filter pages. Supports filters such as ``status`` , ``urgency`` , ``team`` , ``service`` , and ``tags`` , for example ``status:triggered``.
:type filter_query: str, optional
:param sort: Sort pages by the given field. Only one field is allowed.
:type sort: OnCallPagesSort, optional
:rtype: OnCallPagesResponse
"""
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 sort is not unset:
kwargs["sort"] = sort

return self._list_on_call_pages_endpoint.call_with_http_info(**kwargs)

def list_on_call_pages_with_pagination(
self,
*,
page_size: Union[int, UnsetType] = unset,
page_number: Union[int, UnsetType] = unset,
filter_query: Union[str, UnsetType] = unset,
sort: Union[OnCallPagesSort, UnsetType] = unset,
) -> collections.abc.Iterable[OnCallPageData]:
"""List On-Call pages.

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

:param page_size: Number of On-Call Pages to return per page of results. The maximum allowed value is 1000.
:type page_size: int, optional
:param page_number: Page of results to return, starting at 0. ``page[number]`` multiplied by ``page[size]`` must be less than 50000.
:type page_number: int, optional
:param filter_query: Search query to filter pages. Supports filters such as ``status`` , ``urgency`` , ``team`` , ``service`` , and ``tags`` , for example ``status:triggered``.
:type filter_query: str, optional
:param sort: Sort pages by the given field. Only one field is allowed.
:type sort: OnCallPagesSort, optional

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

local_page_size = get_attribute_from_path(kwargs, "page_size", 100)
endpoint = self._list_on_call_pages_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,
*,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(
:param attributes: Attributes for creating an on-call notification channel.
:type attributes: CreateNotificationChannelAttributes, optional

:param type: Indicates that the resource is of type 'notification_channels'.
:param type: Indicates that the resource is of type ``notification_channels``.
:type type: NotificationChannelType
"""
if attributes is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
:param relationships: Relationship object for creating a notification rule
:type relationships: OnCallNotificationRuleRelationships, optional

:param type: Indicates that the resource is of type 'notification_rules'.
:param type: Indicates that the resource is of type ``notification_rules``.
:type type: OnCallNotificationRuleType
"""
if attributes is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(
:param relationships: Relationships to set when creating an on-call schedule override.
:type relationships: CreateOverrideRequestRelationships, optional

:param type: Indicates that the resource is of type 'overrides'.
:param type: Indicates that the resource is of type ``overrides``.
:type type: OverrideDataType
"""
if relationships is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(
:param id: Unique identifier for the channel
:type id: str, optional

:param type: Indicates that the resource is of type 'notification_channels'.
:param type: Indicates that the resource is of type ``notification_channels``.
:type type: NotificationChannelType
"""
if attributes is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class NotificationChannelType(ModelSimple):
"""
Indicates that the resource is of type 'notification_channels'.
Indicates that the resource is of type `notification_channels`.

:param value: If omitted defaults to "notification_channels". Must be one of ["notification_channels"].
:type value: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
:param id: ID of the notification channel
:type id: str, optional

:param type: Indicates that the resource is of type 'notification_channels'.
:param type: Indicates that the resource is of type ``notification_channels``.
:type type: NotificationChannelType, optional
"""
if id is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(
:param relationships: Relationship object for creating a notification rule
:type relationships: OnCallNotificationRuleRelationships, optional

:param type: Indicates that the resource is of type 'notification_rules'.
:param type: Indicates that the resource is of type ``notification_rules``.
:type type: OnCallNotificationRuleType
"""
if attributes is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class OnCallNotificationRuleType(ModelSimple):
"""
Indicates that the resource is of type 'notification_rules'.
Indicates that the resource is of type `notification_rules`.

:param value: If omitted defaults to "notification_rules". Must be one of ["notification_rules"].
:type value: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, **kwargs):
:param id: Unique identifier for the channel
:type id: str, optional

:param type: Indicates that the resource is of type 'notification_channels'.
:param type: Indicates that the resource is of type `notification_channels`.
:type type: NotificationChannelType
"""
super().__init__(kwargs)
Expand Down
Loading
Loading