diff --git a/.apigentools-info b/.apigentools-info index 7779937f87..c5a7d38d0d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-09 14:45:37.430557", - "spec_repo_commit": "79e7c933" + "regenerated": "2025-06-10 00:08:53.016103", + "spec_repo_commit": "4fe79cde" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-09 14:45:37.519358", - "spec_repo_commit": "79e7c933" + "regenerated": "2025-06-10 00:08:53.031420", + "spec_repo_commit": "4fe79cde" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d093ae5abd..031da13398 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13865,6 +13865,21 @@ components: required: - type type: object + EscalationPoliciesResponse: + description: Response with a list of escalation policies. + properties: + data: + description: A list of escalation policies. + items: + $ref: '#/components/schemas/EscalationPolicyData' + type: array + included: + description: Provides any included related resources, such as steps or targets, + returned with the policy. + items: + $ref: '#/components/schemas/EscalationPolicyIncluded' + type: array + type: object EscalationPolicy: description: Represents a complete escalation policy response, including policy data and optionally included related resources. @@ -26994,6 +27009,28 @@ components: - TEAM_ID - TEAM_HANDLE - USER_ID + OnCallUserRelationship: + description: The definition of `OnCallUserRelationship` object. + properties: + data: + $ref: '#/components/schemas/OnCallUserRelationshipData' + type: object + OnCallUserRelationshipData: + description: The definition of `OnCallUserRelationshipData` object. + properties: + id: + description: The ID of the user. + type: string + type: + $ref: '#/components/schemas/OnCallUserRelationshipType' + type: object + OnCallUserRelationshipType: + description: The definition of `OnCallUserRelationshipType` object. + enum: + - users + type: string + x-enum-varnames: + - USERS OnDemandConcurrencyCap: description: On-demand concurrency cap. properties: @@ -27624,6 +27661,118 @@ components: - ARRAY_NUMBER - ARRAY_BOOLEAN - ARRAY_OBJECT + Override: + description: The definition of `Override` object. + properties: + attributes: + $ref: '#/components/schemas/OverrideAttributes' + id: + description: The ID of the override. + type: string + relationships: + $ref: '#/components/schemas/OverrideRelationships' + type: + $ref: '#/components/schemas/OverrideType' + type: object + OverrideAttributes: + description: The definition of `OverrideAttributes` object. + properties: + end: + description: The end time of the override. + format: date-time + type: string + start: + description: The start time of the override. + format: date-time + type: string + type: object + OverrideCreateData: + description: The definition of `OverrideCreateData` object. + properties: + attributes: + $ref: '#/components/schemas/OverrideCreateDataAttributes' + relationships: + $ref: '#/components/schemas/OverrideCreateDataRelationships' + type: + $ref: '#/components/schemas/OverrideCreateDataType' + required: + - attributes + - type + type: object + OverrideCreateDataAttributes: + description: The definition of `OverrideCreateDataAttributes` object. + properties: + end: + description: The end time of the override. + example: '' + format: date-time + type: string + start: + description: The start time of the override. + example: '' + format: date-time + type: string + required: + - start + - end + type: object + OverrideCreateDataRelationships: + description: The definition of `OverrideCreateDataRelationships` object. + properties: + user: + $ref: '#/components/schemas/OnCallUserRelationship' + type: object + OverrideCreateDataType: + description: The definition of `OverrideCreateDataType` object. + enum: + - overrides + example: overrides + type: string + x-enum-varnames: + - OVERRIDES + OverrideRelationships: + description: The definition of `OverrideRelationships` object. + properties: + user: + $ref: '#/components/schemas/OnCallUserRelationship' + type: object + OverrideRequest: + description: The definition of `OverrideRequest` object. + properties: + data: + description: The `OverrideRequest` `data`. + items: + $ref: '#/components/schemas/OverrideCreateData' + type: array + required: + - data + type: object + OverrideResponse: + description: The definition of `OverrideResponse` object. + properties: + data: + description: The `OverrideResponse` `data`. + items: + $ref: '#/components/schemas/Override' + type: array + type: object + OverrideType: + default: overrides + description: The definition of `OverrideType` object. + enum: + - overrides + type: string + x-enum-varnames: + - OVERRIDES + OverridesResponse: + description: The definition of `OverridesResponse` object. + properties: + data: + description: The `OverridesResponse` `data`. + items: + $ref: '#/components/schemas/Override' + type: array + type: object PageUrgency: default: high description: On-Call Page urgency level. @@ -32421,6 +32570,21 @@ components: type: string x-enum-varnames: - USERS + SchedulesResponse: + description: Response with a list of on-call schedules. + properties: + data: + description: A list of on-call schedules. + items: + $ref: '#/components/schemas/ScheduleData' + type: array + included: + description: Any additional resources related to this schedule, such as + teams and layers. + items: + $ref: '#/components/schemas/ScheduleDataIncludedItem' + type: array + type: object ScorecardType: default: scorecard description: The JSON:API type for scorecard. @@ -38209,7 +38373,7 @@ components: type: object TeamOnCallRespondersData: description: Defines the main on-call responder object for a team, including - relationships and metadata. + relationships. properties: id: description: Unique identifier of the on-call responder configuration. @@ -52439,6 +52603,36 @@ paths: contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/on-call/escalation-policies: + get: + description: Get a list of all escalation policies. + operationId: ListOnCallEscalationPolicies + parameters: + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EscalationPoliciesResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a list of all escalation policies + tags: + - On-Call post: description: Create a new On-Call escalation policy operationId: CreateOnCallEscalationPolicy @@ -52833,6 +53027,36 @@ paths: tags: - On-Call Paging /api/v2/on-call/schedules: + get: + description: Get a list of all on-call schedules. + operationId: ListOnCallSchedules + parameters: + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SchedulesResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a list of all on-call schedules + tags: + - On-Call post: description: Create a new On-Call schedule operationId: CreateOnCallSchedule @@ -53053,6 +53277,134 @@ paths: summary: Get the schedule on-call user tags: - On-Call + /api/v2/on-call/schedules/{schedule_id}/overrides: + get: + description: Get a list of all overrides for a given schedule. + operationId: ListOnCallScheduleOverrides + parameters: + - description: The ID of the on-call schedule. + in: path + name: schedule_id + required: true + schema: + type: string + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + - description: The start time (in ISO-8601 format) of the time range to filter + overrides by. Only overrides that overlap with this time range will be returned. + in: query + name: filter[start] + required: true + schema: + type: string + - description: The end time (in ISO-8601 format) of the time range to filter + overrides by. Only overrides that overlap with this time range will be returned. + in: query + name: filter[end] + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OverridesResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a list of all overrides for a schedule + tags: + - On-Call + post: + description: Create an override for a given schedule. + operationId: CreateOnCallScheduleOverride + parameters: + - description: The ID of the on-call schedule. + in: path + name: schedule_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OverrideRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/OverrideResponse' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create an override + tags: + - On-Call + /api/v2/on-call/schedules/{schedule_id}/overrides/{override_id}: + delete: + description: Delete an override for a given schedule. + operationId: DeleteOnCallScheduleOverride + parameters: + - description: The ID of the on-call schedule. + in: path + name: schedule_id + required: true + schema: + type: string + - description: The ID of the override. + in: path + name: override_id + required: true + schema: + type: string + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Delete an override + tags: + - On-Call /api/v2/on-call/teams/{team_id}/on-call: get: description: Get a team's on-call users at a given time diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 70b08bb58b..2655209702 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -5618,6 +5618,13 @@ datadog\_api\_client.v2.model.escalation module :members: :show-inheritance: +datadog\_api\_client.v2.model.escalation\_policies\_response module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.escalation_policies_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.escalation\_policy module ------------------------------------------------------- @@ -11526,6 +11533,27 @@ datadog\_api\_client.v2.model.on\_call\_page\_target\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.on\_call\_user\_relationship module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.on_call_user_relationship + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.on\_call\_user\_relationship\_data module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.on_call_user_relationship_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.on\_call\_user\_relationship\_type module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.on_call_user_relationship_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.on\_demand\_concurrency\_cap module ----------------------------------------------------------------- @@ -11862,6 +11890,83 @@ datadog\_api\_client.v2.model.output\_schema\_parameters\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.override module +--------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.override + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_attributes module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.override_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_create\_data module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.override_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_create\_data\_attributes module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.override_create_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_create\_data\_relationships module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.override_create_data_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_create\_data\_type module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.override_create_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_relationships module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.override_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_request module +------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.override_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_response module +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.override_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.override\_type module +--------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.override_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.overrides\_response module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.overrides_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.page\_urgency module -------------------------------------------------- @@ -14144,6 +14249,13 @@ datadog\_api\_client.v2.model.schedule\_user\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.schedules\_response module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.schedules_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.scorecard\_type module ---------------------------------------------------- diff --git a/examples/v2/on-call/CreateOnCallScheduleOverride.py b/examples/v2/on-call/CreateOnCallScheduleOverride.py new file mode 100644 index 0000000000..f8ac541261 --- /dev/null +++ b/examples/v2/on-call/CreateOnCallScheduleOverride.py @@ -0,0 +1,50 @@ +""" +Create an override returns "Created" response +""" + +from datetime import datetime +from dateutil.relativedelta import relativedelta +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.on_call_api import OnCallApi +from datadog_api_client.v2.model.on_call_user_relationship import OnCallUserRelationship +from datadog_api_client.v2.model.on_call_user_relationship_data import OnCallUserRelationshipData +from datadog_api_client.v2.model.on_call_user_relationship_type import OnCallUserRelationshipType +from datadog_api_client.v2.model.override_create_data import OverrideCreateData +from datadog_api_client.v2.model.override_create_data_attributes import OverrideCreateDataAttributes +from datadog_api_client.v2.model.override_create_data_relationships import OverrideCreateDataRelationships +from datadog_api_client.v2.model.override_create_data_type import OverrideCreateDataType +from datadog_api_client.v2.model.override_request import OverrideRequest + +# there is a valid "schedule" in the system +SCHEDULE_DATA_ID = environ["SCHEDULE_DATA_ID"] + +# there is a valid "user" in the system +USER_DATA_ID = environ["USER_DATA_ID"] + +body = OverrideRequest( + data=[ + OverrideCreateData( + attributes=OverrideCreateDataAttributes( + start=datetime.now(), + end=(datetime.now() + relativedelta(hours=1)), + ), + relationships=OverrideCreateDataRelationships( + user=OnCallUserRelationship( + data=OnCallUserRelationshipData( + id=USER_DATA_ID, + type=OnCallUserRelationshipType.USERS, + ), + ), + ), + type=OverrideCreateDataType.OVERRIDES, + ), + ], +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OnCallApi(api_client) + response = api_instance.create_on_call_schedule_override(schedule_id=SCHEDULE_DATA_ID, body=body) + + print(response) diff --git a/examples/v2/on-call/DeleteOnCallScheduleOverride.py b/examples/v2/on-call/DeleteOnCallScheduleOverride.py new file mode 100644 index 0000000000..a8b6c8e4a3 --- /dev/null +++ b/examples/v2/on-call/DeleteOnCallScheduleOverride.py @@ -0,0 +1,21 @@ +""" +Delete an override returns "No Content" 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"] + +# there is a valid "override" in the system +OVERRIDE_DATA_0_ID = environ["OVERRIDE_DATA_0_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OnCallApi(api_client) + api_instance.delete_on_call_schedule_override( + schedule_id=SCHEDULE_DATA_ID, + override_id=OVERRIDE_DATA_0_ID, + ) diff --git a/examples/v2/on-call/GetOnCallTeamRoutingRules.py b/examples/v2/on-call/GetOnCallTeamRoutingRules.py index c540d4c236..2513f6af61 100644 --- a/examples/v2/on-call/GetOnCallTeamRoutingRules.py +++ b/examples/v2/on-call/GetOnCallTeamRoutingRules.py @@ -2,14 +2,18 @@ Get On-Call team routing rules 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 "dd_team" in the system +DD_TEAM_DATA_ID = environ["DD_TEAM_DATA_ID"] + configuration = Configuration() with ApiClient(configuration) as api_client: api_instance = OnCallApi(api_client) response = api_instance.get_on_call_team_routing_rules( - team_id="27590dae-47be-4a7d-9abf-8f4e45124020", + team_id=DD_TEAM_DATA_ID, ) print(response) diff --git a/examples/v2/on-call/ListOnCallEscalationPolicies.py b/examples/v2/on-call/ListOnCallEscalationPolicies.py new file mode 100644 index 0000000000..c7bc805882 --- /dev/null +++ b/examples/v2/on-call/ListOnCallEscalationPolicies.py @@ -0,0 +1,13 @@ +""" +Get a list of all escalation policies 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_escalation_policies() + + print(response) diff --git a/examples/v2/on-call/ListOnCallScheduleOverrides.py b/examples/v2/on-call/ListOnCallScheduleOverrides.py new file mode 100644 index 0000000000..becb064650 --- /dev/null +++ b/examples/v2/on-call/ListOnCallScheduleOverrides.py @@ -0,0 +1,23 @@ +""" +Get a list of all overrides for a schedule returns "OK" response +""" + +from datetime import datetime +from dateutil.relativedelta import relativedelta +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() +with ApiClient(configuration) as api_client: + api_instance = OnCallApi(api_client) + response = api_instance.list_on_call_schedule_overrides( + schedule_id=SCHEDULE_DATA_ID, + filter_start=(datetime.now() + relativedelta(hours=-1)), + filter_end=(datetime.now() + relativedelta(hours=1)), + ) + + print(response) diff --git a/examples/v2/on-call/ListOnCallSchedules.py b/examples/v2/on-call/ListOnCallSchedules.py new file mode 100644 index 0000000000..177b68cb53 --- /dev/null +++ b/examples/v2/on-call/ListOnCallSchedules.py @@ -0,0 +1,13 @@ +""" +Get a list of all 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) 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 34755ee80e..5fcea8c6b1 100644 --- a/src/datadog_api_client/v2/api/on_call_api.py +++ b/src/datadog_api_client/v2/api/on_call_api.py @@ -11,13 +11,18 @@ UnsetType, unset, ) +from datadog_api_client.v2.model.escalation_policies_response import EscalationPoliciesResponse 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_response import SchedulesResponse 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 from datadog_api_client.v2.model.shift import Shift +from datadog_api_client.v2.model.overrides_response import OverridesResponse +from datadog_api_client.v2.model.override_response import OverrideResponse +from datadog_api_client.v2.model.override_request import OverrideRequest from datadog_api_client.v2.model.team_on_call_responders import TeamOnCallResponders from datadog_api_client.v2.model.team_routing_rules import TeamRoutingRules from datadog_api_client.v2.model.team_routing_rules_request import TeamRoutingRulesRequest @@ -84,6 +89,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_on_call_schedule_override_endpoint = _Endpoint( + settings={ + "response_type": (OverrideResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/on-call/schedules/{schedule_id}/overrides", + "operation_id": "create_on_call_schedule_override", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "schedule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "schedule_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (OverrideRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_on_call_escalation_policy_endpoint = _Endpoint( settings={ "response_type": None, @@ -130,6 +161,35 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_on_call_schedule_override_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/on-call/schedules/{schedule_id}/overrides/{override_id}", + "operation_id": "delete_on_call_schedule_override", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "schedule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "schedule_id", + "location": "path", + }, + "override_id": { + "required": True, + "openapi_types": (str,), + "attribute": "override_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._get_on_call_escalation_policy_endpoint = _Endpoint( settings={ "response_type": (EscalationPolicy,), @@ -275,6 +335,105 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_on_call_escalation_policies_endpoint = _Endpoint( + settings={ + "response_type": (EscalationPoliciesResponse,), + "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": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_on_call_schedule_overrides_endpoint = _Endpoint( + settings={ + "response_type": (OverridesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/on-call/schedules/{schedule_id}/overrides", + "operation_id": "list_on_call_schedule_overrides", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "schedule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "schedule_id", + "location": "path", + }, + "page_size": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + "filter_start": { + "required": True, + "openapi_types": (str,), + "attribute": "filter[start]", + "location": "query", + }, + "filter_end": { + "required": True, + "openapi_types": (str,), + "attribute": "filter[end]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_on_call_schedules_endpoint = _Endpoint( + settings={ + "response_type": (SchedulesResponse,), + "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", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._set_on_call_team_routing_rules_endpoint = _Endpoint( settings={ "response_type": (TeamRoutingRules,), @@ -414,6 +573,27 @@ def create_on_call_schedule( return self._create_on_call_schedule_endpoint.call_with_http_info(**kwargs) + def create_on_call_schedule_override( + self, + schedule_id: str, + body: OverrideRequest, + ) -> OverrideResponse: + """Create an override. + + Create an override for a given schedule. + + :param schedule_id: The ID of the on-call schedule. + :type schedule_id: str + :type body: OverrideRequest + :rtype: OverrideResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["schedule_id"] = schedule_id + + kwargs["body"] = body + + return self._create_on_call_schedule_override_endpoint.call_with_http_info(**kwargs) + def delete_on_call_escalation_policy( self, policy_id: str, @@ -448,6 +628,28 @@ def delete_on_call_schedule( return self._delete_on_call_schedule_endpoint.call_with_http_info(**kwargs) + def delete_on_call_schedule_override( + self, + schedule_id: str, + override_id: str, + ) -> None: + """Delete an override. + + Delete an override for a given schedule. + + :param schedule_id: The ID of the on-call schedule. + :type schedule_id: str + :param override_id: The ID of the override. + :type override_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["schedule_id"] = schedule_id + + kwargs["override_id"] = override_id + + return self._delete_on_call_schedule_override_endpoint.call_with_http_info(**kwargs) + def get_on_call_escalation_policy( self, policy_id: str, @@ -574,6 +776,96 @@ def get_team_on_call_users( return self._get_team_on_call_users_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, + ) -> EscalationPoliciesResponse: + """Get a list of all escalation policies. + + Get a list of all escalation policies. + + :param page_size: Size for a given 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 + :rtype: EscalationPoliciesResponse + """ + 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 + + return self._list_on_call_escalation_policies_endpoint.call_with_http_info(**kwargs) + + def list_on_call_schedule_overrides( + self, + schedule_id: str, + filter_start: str, + filter_end: str, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + ) -> OverridesResponse: + """Get a list of all overrides for a schedule. + + Get a list of all overrides for a given schedule. + + :param schedule_id: The ID of the on-call schedule. + :type schedule_id: str + :param filter_start: The start time (in ISO-8601 format) of the time range to filter overrides by. Only overrides that overlap with this time range will be returned. + :type filter_start: str + :param filter_end: The end time (in ISO-8601 format) of the time range to filter overrides by. Only overrides that overlap with this time range will be returned. + :type filter_end: str + :param page_size: Size for a given 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 + :rtype: OverridesResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["schedule_id"] = schedule_id + + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + kwargs["filter_start"] = filter_start + + kwargs["filter_end"] = filter_end + + return self._list_on_call_schedule_overrides_endpoint.call_with_http_info(**kwargs) + + def list_on_call_schedules( + self, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + ) -> SchedulesResponse: + """Get a list of all on-call schedules. + + Get a list of all on-call schedules. + + :param page_size: Size for a given 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 + :rtype: SchedulesResponse + """ + 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 + + return self._list_on_call_schedules_endpoint.call_with_http_info(**kwargs) + def set_on_call_team_routing_rules( self, team_id: str, diff --git a/src/datadog_api_client/v2/model/escalation_policies_response.py b/src/datadog_api_client/v2/model/escalation_policies_response.py new file mode 100644 index 0000000000..c1d0f0c102 --- /dev/null +++ b/src/datadog_api_client/v2/model/escalation_policies_response.py @@ -0,0 +1,65 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +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_data import EscalationPolicyData + from datadog_api_client.v2.model.escalation_policy_included import EscalationPolicyIncluded + from datadog_api_client.v2.model.team_reference import TeamReference + 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 + + +class EscalationPoliciesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.escalation_policy_data import EscalationPolicyData + from datadog_api_client.v2.model.escalation_policy_included import EscalationPolicyIncluded + + return { + "data": ([EscalationPolicyData],), + "included": ([EscalationPolicyIncluded],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__( + self_, + data: Union[List[EscalationPolicyData], UnsetType] = unset, + included: Union[ + List[ + Union[EscalationPolicyIncluded, TeamReference, EscalationPolicyStep, EscalationPolicyUser, ScheduleData] + ], + UnsetType, + ] = unset, + **kwargs, + ): + """ + Response with a list of escalation policies. + + :param data: A list of escalation policies. + :type data: [EscalationPolicyData], optional + + :param included: Provides any included related resources, such as steps or targets, returned with the policy. + :type included: [EscalationPolicyIncluded], optional + """ + if data is not unset: + kwargs["data"] = data + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/on_call_user_relationship.py b/src/datadog_api_client/v2/model/on_call_user_relationship.py new file mode 100644 index 0000000000..d4cdf6dfa9 --- /dev/null +++ b/src/datadog_api_client/v2/model/on_call_user_relationship.py @@ -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.on_call_user_relationship_data import OnCallUserRelationshipData + + +class OnCallUserRelationship(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.on_call_user_relationship_data import OnCallUserRelationshipData + + return { + "data": (OnCallUserRelationshipData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[OnCallUserRelationshipData, UnsetType] = unset, **kwargs): + """ + The definition of ``OnCallUserRelationship`` object. + + :param data: The definition of ``OnCallUserRelationshipData`` object. + :type data: OnCallUserRelationshipData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/on_call_user_relationship_data.py b/src/datadog_api_client/v2/model/on_call_user_relationship_data.py new file mode 100644 index 0000000000..8ca514a8c6 --- /dev/null +++ b/src/datadog_api_client/v2/model/on_call_user_relationship_data.py @@ -0,0 +1,51 @@ +# 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.on_call_user_relationship_type import OnCallUserRelationshipType + + +class OnCallUserRelationshipData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.on_call_user_relationship_type import OnCallUserRelationshipType + + return { + "id": (str,), + "type": (OnCallUserRelationshipType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__( + self_, id: Union[str, UnsetType] = unset, type: Union[OnCallUserRelationshipType, UnsetType] = unset, **kwargs + ): + """ + The definition of ``OnCallUserRelationshipData`` object. + + :param id: The ID of the user. + :type id: str, optional + + :param type: The definition of ``OnCallUserRelationshipType`` object. + :type type: OnCallUserRelationshipType, optional + """ + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/on_call_user_relationship_type.py b/src/datadog_api_client/v2/model/on_call_user_relationship_type.py new file mode 100644 index 0000000000..4ecef3cc97 --- /dev/null +++ b/src/datadog_api_client/v2/model/on_call_user_relationship_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OnCallUserRelationshipType(ModelSimple): + """ + The definition of `OnCallUserRelationshipType` object. + + :param value: If omitted defaults to "users". Must be one of ["users"]. + :type value: str + """ + + allowed_values = { + "users", + } + USERS: ClassVar["OnCallUserRelationshipType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OnCallUserRelationshipType.USERS = OnCallUserRelationshipType("users") diff --git a/src/datadog_api_client/v2/model/override.py b/src/datadog_api_client/v2/model/override.py new file mode 100644 index 0000000000..39330ad8d5 --- /dev/null +++ b/src/datadog_api_client/v2/model/override.py @@ -0,0 +1,74 @@ +# 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.override_attributes import OverrideAttributes + from datadog_api_client.v2.model.override_relationships import OverrideRelationships + from datadog_api_client.v2.model.override_type import OverrideType + + +class Override(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.override_attributes import OverrideAttributes + from datadog_api_client.v2.model.override_relationships import OverrideRelationships + from datadog_api_client.v2.model.override_type import OverrideType + + return { + "attributes": (OverrideAttributes,), + "id": (str,), + "relationships": (OverrideRelationships,), + "type": (OverrideType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: Union[OverrideAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + relationships: Union[OverrideRelationships, UnsetType] = unset, + type: Union[OverrideType, UnsetType] = unset, + **kwargs, + ): + """ + The definition of ``Override`` object. + + :param attributes: The definition of ``OverrideAttributes`` object. + :type attributes: OverrideAttributes, optional + + :param id: The ID of the override. + :type id: str, optional + + :param relationships: The definition of ``OverrideRelationships`` object. + :type relationships: OverrideRelationships, optional + + :param type: The definition of ``OverrideType`` object. + :type type: OverrideType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if relationships is not unset: + kwargs["relationships"] = relationships + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/override_attributes.py b/src/datadog_api_client/v2/model/override_attributes.py new file mode 100644 index 0000000000..b4d90bf97f --- /dev/null +++ b/src/datadog_api_client/v2/model/override_attributes.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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +class OverrideAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "end": (datetime,), + "start": (datetime,), + } + + attribute_map = { + "end": "end", + "start": "start", + } + + def __init__(self_, end: Union[datetime, UnsetType] = unset, start: Union[datetime, UnsetType] = unset, **kwargs): + """ + The definition of ``OverrideAttributes`` object. + + :param end: The end time of the override. + :type end: datetime, optional + + :param start: The start time of the override. + :type start: datetime, optional + """ + if end is not unset: + kwargs["end"] = end + if start is not unset: + kwargs["start"] = start + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/override_create_data.py b/src/datadog_api_client/v2/model/override_create_data.py new file mode 100644 index 0000000000..ee36bdeeb4 --- /dev/null +++ b/src/datadog_api_client/v2/model/override_create_data.py @@ -0,0 +1,65 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +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.override_create_data_attributes import OverrideCreateDataAttributes + from datadog_api_client.v2.model.override_create_data_relationships import OverrideCreateDataRelationships + from datadog_api_client.v2.model.override_create_data_type import OverrideCreateDataType + + +class OverrideCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.override_create_data_attributes import OverrideCreateDataAttributes + from datadog_api_client.v2.model.override_create_data_relationships import OverrideCreateDataRelationships + from datadog_api_client.v2.model.override_create_data_type import OverrideCreateDataType + + return { + "attributes": (OverrideCreateDataAttributes,), + "relationships": (OverrideCreateDataRelationships,), + "type": (OverrideCreateDataType,), + } + + attribute_map = { + "attributes": "attributes", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: OverrideCreateDataAttributes, + type: OverrideCreateDataType, + relationships: Union[OverrideCreateDataRelationships, UnsetType] = unset, + **kwargs, + ): + """ + The definition of ``OverrideCreateData`` object. + + :param attributes: The definition of ``OverrideCreateDataAttributes`` object. + :type attributes: OverrideCreateDataAttributes + + :param relationships: The definition of ``OverrideCreateDataRelationships`` object. + :type relationships: OverrideCreateDataRelationships, optional + + :param type: The definition of ``OverrideCreateDataType`` object. + :type type: OverrideCreateDataType + """ + if relationships is not unset: + kwargs["relationships"] = relationships + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/override_create_data_attributes.py b/src/datadog_api_client/v2/model/override_create_data_attributes.py new file mode 100644 index 0000000000..eaf4ca8611 --- /dev/null +++ b/src/datadog_api_client/v2/model/override_create_data_attributes.py @@ -0,0 +1,40 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +class OverrideCreateDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "end": (datetime,), + "start": (datetime,), + } + + attribute_map = { + "end": "end", + "start": "start", + } + + def __init__(self_, end: datetime, start: datetime, **kwargs): + """ + The definition of ``OverrideCreateDataAttributes`` object. + + :param end: The end time of the override. + :type end: datetime + + :param start: The start time of the override. + :type start: datetime + """ + super().__init__(kwargs) + + self_.end = end + self_.start = start diff --git a/src/datadog_api_client/v2/model/override_create_data_relationships.py b/src/datadog_api_client/v2/model/override_create_data_relationships.py new file mode 100644 index 0000000000..65271b604b --- /dev/null +++ b/src/datadog_api_client/v2/model/override_create_data_relationships.py @@ -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.on_call_user_relationship import OnCallUserRelationship + + +class OverrideCreateDataRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.on_call_user_relationship import OnCallUserRelationship + + return { + "user": (OnCallUserRelationship,), + } + + attribute_map = { + "user": "user", + } + + def __init__(self_, user: Union[OnCallUserRelationship, UnsetType] = unset, **kwargs): + """ + The definition of ``OverrideCreateDataRelationships`` object. + + :param user: The definition of ``OnCallUserRelationship`` object. + :type user: OnCallUserRelationship, optional + """ + if user is not unset: + kwargs["user"] = user + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/override_create_data_type.py b/src/datadog_api_client/v2/model/override_create_data_type.py new file mode 100644 index 0000000000..7769b0de15 --- /dev/null +++ b/src/datadog_api_client/v2/model/override_create_data_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OverrideCreateDataType(ModelSimple): + """ + The definition of `OverrideCreateDataType` object. + + :param value: If omitted defaults to "overrides". Must be one of ["overrides"]. + :type value: str + """ + + allowed_values = { + "overrides", + } + OVERRIDES: ClassVar["OverrideCreateDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OverrideCreateDataType.OVERRIDES = OverrideCreateDataType("overrides") diff --git a/src/datadog_api_client/v2/model/override_relationships.py b/src/datadog_api_client/v2/model/override_relationships.py new file mode 100644 index 0000000000..a30e82524f --- /dev/null +++ b/src/datadog_api_client/v2/model/override_relationships.py @@ -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.on_call_user_relationship import OnCallUserRelationship + + +class OverrideRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.on_call_user_relationship import OnCallUserRelationship + + return { + "user": (OnCallUserRelationship,), + } + + attribute_map = { + "user": "user", + } + + def __init__(self_, user: Union[OnCallUserRelationship, UnsetType] = unset, **kwargs): + """ + The definition of ``OverrideRelationships`` object. + + :param user: The definition of ``OnCallUserRelationship`` object. + :type user: OnCallUserRelationship, optional + """ + if user is not unset: + kwargs["user"] = user + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/override_request.py b/src/datadog_api_client/v2/model/override_request.py new file mode 100644 index 0000000000..26513f3771 --- /dev/null +++ b/src/datadog_api_client/v2/model/override_request.py @@ -0,0 +1,40 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.override_create_data import OverrideCreateData + + +class OverrideRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.override_create_data import OverrideCreateData + + return { + "data": ([OverrideCreateData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[OverrideCreateData], **kwargs): + """ + The definition of ``OverrideRequest`` object. + + :param data: The ``OverrideRequest`` ``data``. + :type data: [OverrideCreateData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/override_response.py b/src/datadog_api_client/v2/model/override_response.py new file mode 100644 index 0000000000..f46055ce81 --- /dev/null +++ b/src/datadog_api_client/v2/model/override_response.py @@ -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 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.override import Override + + +class OverrideResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.override import Override + + return { + "data": ([Override],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[Override], UnsetType] = unset, **kwargs): + """ + The definition of ``OverrideResponse`` object. + + :param data: The ``OverrideResponse`` ``data``. + :type data: [Override], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/override_type.py b/src/datadog_api_client/v2/model/override_type.py new file mode 100644 index 0000000000..7cf475932c --- /dev/null +++ b/src/datadog_api_client/v2/model/override_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OverrideType(ModelSimple): + """ + The definition of `OverrideType` object. + + :param value: If omitted defaults to "overrides". Must be one of ["overrides"]. + :type value: str + """ + + allowed_values = { + "overrides", + } + OVERRIDES: ClassVar["OverrideType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OverrideType.OVERRIDES = OverrideType("overrides") diff --git a/src/datadog_api_client/v2/model/overrides_response.py b/src/datadog_api_client/v2/model/overrides_response.py new file mode 100644 index 0000000000..cc2b982f34 --- /dev/null +++ b/src/datadog_api_client/v2/model/overrides_response.py @@ -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 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.override import Override + + +class OverridesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.override import Override + + return { + "data": ([Override],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[Override], UnsetType] = unset, **kwargs): + """ + The definition of ``OverridesResponse`` object. + + :param data: The ``OverridesResponse`` ``data``. + :type data: [Override], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/schedules_response.py b/src/datadog_api_client/v2/model/schedules_response.py new file mode 100644 index 0000000000..57c90374bc --- /dev/null +++ b/src/datadog_api_client/v2/model/schedules_response.py @@ -0,0 +1,62 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +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_data import ScheduleData + from datadog_api_client.v2.model.schedule_data_included_item import ScheduleDataIncludedItem + from datadog_api_client.v2.model.team_reference import TeamReference + from datadog_api_client.v2.model.layer import Layer + from datadog_api_client.v2.model.schedule_member import ScheduleMember + from datadog_api_client.v2.model.schedule_user import ScheduleUser + + +class SchedulesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.schedule_data import ScheduleData + from datadog_api_client.v2.model.schedule_data_included_item import ScheduleDataIncludedItem + + return { + "data": ([ScheduleData],), + "included": ([ScheduleDataIncludedItem],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__( + self_, + data: Union[List[ScheduleData], UnsetType] = unset, + included: Union[ + List[Union[ScheduleDataIncludedItem, TeamReference, Layer, ScheduleMember, ScheduleUser]], UnsetType + ] = unset, + **kwargs, + ): + """ + Response with a list of on-call schedules. + + :param data: A list of on-call schedules. + :type data: [ScheduleData], optional + + :param included: Any additional resources related to this schedule, such as teams and layers. + :type included: [ScheduleDataIncludedItem], optional + """ + if data is not unset: + kwargs["data"] = data + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/team_on_call_responders.py b/src/datadog_api_client/v2/model/team_on_call_responders.py index acae0b351b..aaf57a83d7 100644 --- a/src/datadog_api_client/v2/model/team_on_call_responders.py +++ b/src/datadog_api_client/v2/model/team_on_call_responders.py @@ -45,7 +45,7 @@ def __init__( """ Root object representing a team's on-call responder configuration. - :param data: Defines the main on-call responder object for a team, including relationships and metadata. + :param data: Defines the main on-call responder object for a team, including relationships. :type data: TeamOnCallRespondersData, optional :param included: The ``TeamOnCallResponders`` ``included``. diff --git a/src/datadog_api_client/v2/model/team_on_call_responders_data.py b/src/datadog_api_client/v2/model/team_on_call_responders_data.py index 4f2f61ff77..61e93b3dd1 100644 --- a/src/datadog_api_client/v2/model/team_on_call_responders_data.py +++ b/src/datadog_api_client/v2/model/team_on_call_responders_data.py @@ -48,7 +48,7 @@ def __init__( **kwargs, ): """ - Defines the main on-call responder object for a team, including relationships and metadata. + Defines the main on-call responder object for a team, including relationships. :param id: Unique identifier of the on-call responder configuration. :type id: str, optional diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 436bec9e1c..1afcd374bd 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1069,6 +1069,7 @@ from datadog_api_client.v2.model.entity_v3_system_spec import EntityV3SystemSpec 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_response import EscalationPoliciesResponse 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 @@ -2350,6 +2351,9 @@ from datadog_api_client.v2.model.okta_account_update_request_data import OktaAccountUpdateRequestData from datadog_api_client.v2.model.okta_accounts_response import OktaAccountsResponse from datadog_api_client.v2.model.on_call_page_target_type import OnCallPageTargetType +from datadog_api_client.v2.model.on_call_user_relationship import OnCallUserRelationship +from datadog_api_client.v2.model.on_call_user_relationship_data import OnCallUserRelationshipData +from datadog_api_client.v2.model.on_call_user_relationship_type import OnCallUserRelationshipType from datadog_api_client.v2.model.on_demand_concurrency_cap import OnDemandConcurrencyCap from datadog_api_client.v2.model.on_demand_concurrency_cap_attributes import OnDemandConcurrencyCapAttributes from datadog_api_client.v2.model.on_demand_concurrency_cap_response import OnDemandConcurrencyCapResponse @@ -2400,6 +2404,17 @@ from datadog_api_client.v2.model.output_schema import OutputSchema from datadog_api_client.v2.model.output_schema_parameters import OutputSchemaParameters from datadog_api_client.v2.model.output_schema_parameters_type import OutputSchemaParametersType +from datadog_api_client.v2.model.override import Override +from datadog_api_client.v2.model.override_attributes import OverrideAttributes +from datadog_api_client.v2.model.override_create_data import OverrideCreateData +from datadog_api_client.v2.model.override_create_data_attributes import OverrideCreateDataAttributes +from datadog_api_client.v2.model.override_create_data_relationships import OverrideCreateDataRelationships +from datadog_api_client.v2.model.override_create_data_type import OverrideCreateDataType +from datadog_api_client.v2.model.override_relationships import OverrideRelationships +from datadog_api_client.v2.model.override_request import OverrideRequest +from datadog_api_client.v2.model.override_response import OverrideResponse +from datadog_api_client.v2.model.override_type import OverrideType +from datadog_api_client.v2.model.overrides_response import OverridesResponse from datadog_api_client.v2.model.page_urgency import PageUrgency from datadog_api_client.v2.model.pagination import Pagination from datadog_api_client.v2.model.parameter import Parameter @@ -2767,6 +2782,7 @@ from datadog_api_client.v2.model.schedule_user import ScheduleUser from datadog_api_client.v2.model.schedule_user_attributes import ScheduleUserAttributes from datadog_api_client.v2.model.schedule_user_type import ScheduleUserType +from datadog_api_client.v2.model.schedules_response import SchedulesResponse from datadog_api_client.v2.model.scorecard_type import ScorecardType from datadog_api_client.v2.model.security_filter import SecurityFilter from datadog_api_client.v2.model.security_filter_attributes import SecurityFilterAttributes @@ -4293,6 +4309,7 @@ "EntityV3SystemSpec", "ErrorHandler", "Escalation", + "EscalationPoliciesResponse", "EscalationPolicy", "EscalationPolicyCreateRequest", "EscalationPolicyCreateRequestData", @@ -5138,6 +5155,9 @@ "OktaAccountUpdateRequestData", "OktaAccountsResponse", "OnCallPageTargetType", + "OnCallUserRelationship", + "OnCallUserRelationshipData", + "OnCallUserRelationshipType", "OnDemandConcurrencyCap", "OnDemandConcurrencyCapAttributes", "OnDemandConcurrencyCapResponse", @@ -5186,6 +5206,17 @@ "OutputSchema", "OutputSchemaParameters", "OutputSchemaParametersType", + "Override", + "OverrideAttributes", + "OverrideCreateData", + "OverrideCreateDataAttributes", + "OverrideCreateDataRelationships", + "OverrideCreateDataType", + "OverrideRelationships", + "OverrideRequest", + "OverrideResponse", + "OverrideType", + "OverridesResponse", "PageUrgency", "Pagination", "Parameter", @@ -5519,6 +5550,7 @@ "ScheduleUser", "ScheduleUserAttributes", "ScheduleUserType", + "SchedulesResponse", "ScorecardType", "SecurityFilter", "SecurityFilterAttributes", diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_override_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_an_override_returns_created_response.frozen new file mode 100644 index 0000000000..e5dca6e90b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_override_returns_created_response.frozen @@ -0,0 +1 @@ +2025-06-09T23:29:57.648Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_override_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_an_override_returns_created_response.yaml new file mode 100644 index 0000000000..2c8e8bff4e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_override_returns_created_response.yaml @@ -0,0 +1,106 @@ +interactions: +- request: + body: '{"data":{"attributes":{"email":"Test-Create_an_override_returns_Created_response-1749511797@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: + string: '{"data":{"type":"users","id":"a8378345-4589-11f0-8c93-d6008d2166ed","attributes":{"name":null,"handle":"test-create_an_override_returns_created_response-1749511797@datadoghq.com","created_at":"2025-06-09T23:29:58.353218+00:00","modified_at":"2025-06-09T23:29:58.353218+00:00","email":"test-create_an_override_returns_created_response-1749511797@datadoghq.com","icon":"https://secure.gravatar.com/avatar/7995727f01e644529125dadf775bd0e7?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 +- request: + body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-05-30T23:29:57.648Z","end_date":"2025-06-19T23:29:57.648Z","interval":{"days":1},"members":[{"user":{"id":"a8378345-4589-11f0-8c93-d6008d2166ed"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-06-04T23:29:57.648Z"}],"name":"Test-Create_an_override_returns_Created_response-1749511797","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: + string: '{"data":{"id":"72f3a655-502c-491e-adb4-1e67a7aef424","type":"schedules","attributes":{"name":"Test-Create_an_override_returns_Created_response-1749511797","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"314f8781-e48b-4dad-a86d-0d85ee7e34f5","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":[{"attributes":{"end":"2025-06-10T00:29:57.648Z","start":"2025-06-09T23:29:57.648Z"},"relationships":{"user":{"data":{"id":"a8378345-4589-11f0-8c93-d6008d2166ed","type":"users"}}},"type":"overrides"}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules/72f3a655-502c-491e-adb4-1e67a7aef424/overrides + response: + body: + string: '{"data":[{"id":"c19f68f9-e22d-424b-8ee2-74068a2d41f4","type":"overrides","attributes":{"end":"2025-06-10T00:29:57.648Z","start":"2025-06-09T23:29:57.648Z"},"relationships":{"user":{"data":{"id":"a8378345-4589-11f0-8c93-d6008d2166ed","type":"users"}}}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/%7Bschedule_id%7D/overrides/c19f68f9-e22d-424b-8ee2-74068a2d41f4 + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"uuid\" [{schedule_id}] is not a valid UUID"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/72f3a655-502c-491e-adb4-1e67a7aef424 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/a8378345-4589-11f0-8c93-d6008d2166ed + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_override_returns_no_content_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_an_override_returns_no_content_response.frozen new file mode 100644 index 0000000000..5bfc4c770b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_override_returns_no_content_response.frozen @@ -0,0 +1 @@ +2025-06-09T23:30:15.221Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_override_returns_no_content_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_an_override_returns_no_content_response.yaml new file mode 100644 index 0000000000..36669c3a93 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_override_returns_no_content_response.yaml @@ -0,0 +1,120 @@ +interactions: +- request: + body: '{"data":{"attributes":{"email":"Test-Delete_an_override_returns_No_Content_response-1749511815@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: + string: '{"data":{"type":"users","id":"b2a8c8e6-4589-11f0-8c93-d6008d2166ed","attributes":{"name":null,"handle":"test-delete_an_override_returns_no_content_response-1749511815@datadoghq.com","created_at":"2025-06-09T23:30:15.872777+00:00","modified_at":"2025-06-09T23:30:15.872777+00:00","email":"test-delete_an_override_returns_no_content_response-1749511815@datadoghq.com","icon":"https://secure.gravatar.com/avatar/49f12a88e1d0d2808f4ad18cf228a08c?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 +- request: + body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-05-30T23:30:15.221Z","end_date":"2025-06-19T23:30:15.221Z","interval":{"days":1},"members":[{"user":{"id":"b2a8c8e6-4589-11f0-8c93-d6008d2166ed"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-06-04T23:30:15.221Z"}],"name":"Test-Delete_an_override_returns_No_Content_response-1749511815","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: + string: '{"data":{"id":"bc5808ac-2b71-4213-8f8d-b9bcdb59b605","type":"schedules","attributes":{"name":"Test-Delete_an_override_returns_No_Content_response-1749511815","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"af7496af-5a70-4599-8c90-aa4a6a9fc8b7","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":[{"attributes":{"end":"2025-06-10T00:30:15.221Z","start":"2025-06-09T23:30:15.221Z"},"relationships":{"user":{"data":{"id":"b2a8c8e6-4589-11f0-8c93-d6008d2166ed","type":"users"}}},"type":"overrides"}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules/bc5808ac-2b71-4213-8f8d-b9bcdb59b605/overrides + response: + body: + string: '{"data":[{"id":"b289bd65-d407-4dc8-b606-d7dedcffc88e","type":"overrides","attributes":{"end":"2025-06-10T00:30:15.221Z","start":"2025-06-09T23:30:15.221Z"},"relationships":{"user":{"data":{"id":"b2a8c8e6-4589-11f0-8c93-d6008d2166ed","type":"users"}}}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/bc5808ac-2b71-4213-8f8d-b9bcdb59b605/overrides/b289bd65-d407-4dc8-b606-d7dedcffc88e + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/%7Bschedule_id%7D/overrides/b289bd65-d407-4dc8-b606-d7dedcffc88e + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"uuid\" [{schedule_id}] is not a valid UUID"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/bc5808ac-2b71-4213-8f8d-b9bcdb59b605 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/b2a8c8e6-4589-11f0-8c93-d6008d2166ed + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_escalation_policies_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_escalation_policies_returns_ok_response.frozen new file mode 100644 index 0000000000..6af0451d3e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_escalation_policies_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-06-09T23:30:40.718Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_escalation_policies_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_escalation_policies_returns_ok_response.yaml new file mode 100644 index 0000000000..dafbcd3c44 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_escalation_policies_returns_ok_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/escalation-policies + response: + body: + string: '{"data":[{"id":"9e6a4f8a-38c8-4d53-b84a-7362507ac67a","type":"policies","attributes":{"name":"Example-Get_team_on_call_users_returns_OK_response_1749118317","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"1499c12c-51e8-4b6b-9c40-e6965291652b","type":"steps"},{"id":"6c1aa92d-07fe-4181-be84-6e1bfc727c39","type":"steps"}]},"teams":{"data":[{"id":"092bfdbb-f088-4937-b74f-48e6ce64fd96","type":"teams"}]}}},{"id":"7603f4f8-fce7-49e4-afea-7de0da5dd8b7","type":"policies","attributes":{"name":"Example-Get_team_on_call_users_returns_OK_response_1749132717","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"0f4e62cd-84f7-43f5-a84f-8d66452ff36b","type":"steps"},{"id":"b533a8bf-f2b1-4ed3-ac96-814ea111e2c5","type":"steps"}]},"teams":{"data":[{"id":"98024b06-8bd0-47ae-920d-3203ce3b5127","type":"teams"}]}}},{"id":"ab8a9bde-19c8-4df4-ac35-f95003fd3712","type":"policies","attributes":{"name":"Example-Get_team_on_call_users_returns_OK_response_1749363117","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"1a23f433-5197-48eb-9281-feac6fea5f6b","type":"steps"},{"id":"e832663d-dbe5-4120-abf5-7a9d9c0dd45f","type":"steps"}]},"teams":{"data":[{"id":"43fb5743-68fe-451d-9adc-56a4ff53b14e","type":"teams"}]}}},{"id":"33349f9f-c668-4af6-8cec-6613c292d5f6","type":"policies","attributes":{"name":"Example-Get_team_on_call_users_returns_OK_response_1749420717","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"3ee94972-d592-4d9e-80f2-16fb907a13fd","type":"steps"},{"id":"3a964219-88e0-4e98-ae3b-6be149da2a93","type":"steps"}]},"teams":{"data":[{"id":"70cf2e63-99bd-496c-9918-e2afb58d0d48","type":"teams"}]}}},{"id":"b7963110-a1f6-4bb9-bf1f-9a3c46f9f24e","type":"policies","attributes":{"name":"Example-Get_team_on_call_users_returns_OK_response_1749449517","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"341185ff-1caa-4b67-8012-3472f12db184","type":"steps"},{"id":"56e2e892-95d0-4da0-82e3-e16d878baabc","type":"steps"}]},"teams":{"data":[{"id":"67b9410d-2eeb-443b-9514-525bf64816fb","type":"teams"}]}}},{"id":"87ac03ad-824d-4b1f-acc1-1aa609c42677","type":"policies","attributes":{"name":"Example-Get_team_on_call_users_returns_OK_response_1749463917","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"b21b351f-dd89-4be4-b34a-09154911303e","type":"steps"},{"id":"394399ec-8749-4f51-96e9-7dc566dc9901","type":"steps"}]},"teams":{"data":[{"id":"492ba665-e23a-4260-a1fe-3963ba1d2f69","type":"teams"}]}}},{"id":"7bb2cd11-e5d5-4523-b063-6118e9bb9bd4","type":"policies","attributes":{"name":"Example-Get_team_on_call_users_returns_OK_response_1749478317","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"ea35814d-bd58-4d81-b19b-fcbcbe26d055","type":"steps"},{"id":"ac8020d4-29b9-41e6-b775-f8d29869a6f6","type":"steps"}]},"teams":{"data":[{"id":"e44c2257-edc1-45ef-8c76-1788c7d17ccb","type":"teams"}]}}},{"id":"20d2ad2a-bb6b-4ba4-bb50-bc2f3bd393b4","type":"policies","attributes":{"name":"Example-Get_team_on_call_users_returns_OK_response_1749507117","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"aa0c1ebd-d9e5-49a6-ad85-79d7b91037ca","type":"steps"},{"id":"dd2cebbc-9c10-4fae-8f7f-209ca0e336c4","type":"steps"}]},"teams":{"data":[{"id":"a088484c-cc12-44b6-87e2-3dcfb389efcc","type":"teams"}]}}},{"id":"0991013e-3bbb-48e5-b6d0-7cc8fa10ba74","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1746828011","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"da85b66b-5ea0-490a-a8d0-93c75b5f7b07","type":"steps"},{"id":"ebb2f627-64b7-46e3-8938-c7cdcd6554ef","type":"steps"}]},"teams":{"data":[{"id":"6f2a747e-9f8c-4695-a6b2-b2860e4d4fc0","type":"teams"}]}}},{"id":"2ff311aa-0b5e-48cc-bb2a-be6152222dd3","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1746856811","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"7462f209-e54f-44cf-807f-184757fa5b4e","type":"steps"},{"id":"9414ada0-738a-4efc-9d81-f40827b13a56","type":"steps"}]},"teams":{"data":[{"id":"92075ea4-a4fd-48d9-a4ed-e6667b25cb4f","type":"teams"}]}}},{"id":"57239328-7c48-4b42-b2f9-056b4d22de8e","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1746871211","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"2252e135-ef1f-4152-bc0c-b823cb45aa43","type":"steps"},{"id":"69700d34-d03d-4852-a4f3-e50888a79639","type":"steps"}]},"teams":{"data":[{"id":"85c22af6-eacf-476e-860d-d02b5cadae3d","type":"teams"}]}}},{"id":"0e0ea7ba-81f5-4e8f-ade5-36842e3a0ff7","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1747784317","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"da7518e3-3770-4a0f-ab85-e33c988f309d","type":"steps"},{"id":"ef6671d5-b97d-42f7-afc7-b5d9f68e7bf8","type":"steps"}]},"teams":{"data":[{"id":"04d308e7-5afd-46db-be62-292edd22d68e","type":"teams"}]}}},{"id":"d8c7be7d-2369-4302-b429-4f2145ab4c69","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1747913917","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"ea43717f-300f-491a-ae8d-7741546ea49b","type":"steps"},{"id":"9244a679-ffab-4e64-a685-55eb8885493c","type":"steps"}]},"teams":{"data":[{"id":"ed071279-c7c8-42e3-80fa-e5387659a2bb","type":"teams"}]}}},{"id":"2ab3cc83-71e1-4120-b617-531034ab8cb7","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1747928317","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"9e01cdf1-9508-42d0-a2a0-9055c9294f15","type":"steps"},{"id":"e177f81e-e349-4bb1-b1c9-b25c9b6c93b3","type":"steps"}]},"teams":{"data":[{"id":"48533ff1-261a-4334-b153-51cafdc1e827","type":"teams"}]}}},{"id":"40dcec8f-f96a-4684-b889-d09421797c82","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1748000317","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"b20b0a32-219c-426f-bf5e-3c06da071e90","type":"steps"},{"id":"77f3333c-5c00-4d27-8bec-9c654cb85658","type":"steps"}]},"teams":{"data":[{"id":"2d044b70-3bfe-4be7-893d-d8d845f7c43a","type":"teams"}]}}},{"id":"181d2236-ab90-4035-a7bd-d1b812eb00a1","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1748086717","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"d58ed7f5-b9d3-4e8a-bc29-fa2a85254005","type":"steps"},{"id":"ba092ae4-ce21-462a-b5a6-1bfc9c105b31","type":"steps"}]},"teams":{"data":[{"id":"66809f57-b5c5-4308-99d5-aec66d1256c4","type":"teams"}]}}},{"id":"93ba2d28-788d-421e-8525-7926932bf594","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1748187517","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"576d53cb-e341-4f7d-91ad-5f7c751ad449","type":"steps"},{"id":"383b175a-8396-44f1-8378-467f8ff8038e","type":"steps"}]},"teams":{"data":[{"id":"d563c9e0-1301-41c9-b3f0-8aaadabd2f36","type":"teams"}]}}},{"id":"1806ab18-43ae-429d-8ba3-5e53d7ff4b4c","type":"policies","attributes":{"name":"Example-Set_on_call_team_routing_rules_returns_OK_response_1748216317","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"c59bb49b-9f2b-4677-94b4-22c87c0a4f75","type":"steps"},{"id":"94a6bd87-c332-4391-9bd7-be1f3ca65a61","type":"steps"}]},"teams":{"data":[{"id":"5154559d-3e7b-4268-ad93-744a5017a042","type":"teams"}]}}},{"id":"85942d6c-5f15-48bb-ad41-075d9dffca29","type":"policies","attributes":{"name":"Example-Set_On_Call_team_routing_rules_returns_OK_response_1748289248","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"e6d0a20a-c3f1-4a03-ba61-155c313120aa","type":"steps"},{"id":"7c4b9961-d86a-46bf-bfef-2634daf0515d","type":"steps"}]},"teams":{"data":[{"id":"15579af2-0fc0-43e9-b052-348453b55353","type":"teams"}]}}},{"id":"7096bd54-e0cf-4279-b44e-24b312720bc5","type":"policies","attributes":{"name":"Example-Set_On_Call_team_routing_rules_returns_OK_response_1748303647","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"de0e4a0e-b2da-48f2-b1cd-afbf98b79a48","type":"steps"},{"id":"a76fade4-12b5-4f8b-9bf1-14a3b148e733","type":"steps"}]},"teams":{"data":[{"id":"bddb40f8-4674-46e5-bd4e-d8c66368f25d","type":"teams"}]}}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_oncall_schedules_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_oncall_schedules_returns_ok_response.frozen new file mode 100644 index 0000000000..e499279bb6 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_oncall_schedules_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-06-09T23:30:41.370Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_oncall_schedules_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_oncall_schedules_returns_ok_response.yaml new file mode 100644 index 0000000000..b3c65f9f5b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_oncall_schedules_returns_ok_response.yaml @@ -0,0 +1,28 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/schedules + response: + body: + string: '{"data":[{"id":"35bb154a-c72c-4229-9fc0-04e07488af4f","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"e53202ff-ace0-48b9-94cc-02fd7cc4db19","type":"teams"}]}}},{"id":"671c7d3f-9587-42fa-8c7e-8755930bbdac","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallescalationpolicycreateandupdate-local-1747734855","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"74e02075-633b-44c4-abac-614efb1d8536","type":"teams"}]}}},{"id":"2dab1cc6-fd41-471a-9012-ddd61aaa1efd","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallescalationpolicycreateandupdate-local-1747735035","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"50238947-4947-4d29-acf4-a5a0af3c71dc","type":"teams"}]}}},{"id":"e0fe19e8-b263-4737-901d-949665a6a8b9","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallteamroutingrulescreateandupdate-local-1748264615","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"d093df59-ea15-49d7-a826-cf39241268a7","type":"teams"}]}}},{"id":"1ec1cf5a-34fe-4287-be5f-6624b26eea21","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallteamroutingrulescreateandupdate-local-1748264794","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"24081181-e2e6-4979-b1c4-3186f3bbb1c3","type":"teams"}]}}},{"id":"08429594-1286-407e-b915-9b08127abc8b","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallteamroutingrulescreateandupdate-local-1748264832","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"35554fbf-0d9d-46b2-958d-c770abba0ea7","type":"teams"}]}}},{"id":"dadf713e-540d-4387-8e0a-a172d453ebfa","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallteamroutingrulescreateandupdate-local-1748264900","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"14e0b9be-eb14-4031-9f20-c5fa79d5a61c","type":"teams"}]}}},{"id":"d6714916-109d-4422-99b7-a4b59f98c9c1","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallteamroutingrulescreateandupdate-local-1748264953","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"190b0a25-e77f-46b1-b0c6-31d3170becfa","type":"teams"}]}}},{"id":"3d2695af-1c25-4510-8829-44d961a18ded","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallteamroutingrulescreateandupdate-local-1748264975","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"a840a585-6d24-4c3a-8fd7-11c707411fa3","type":"teams"}]}}},{"id":"a5be0ef7-c2b5-464b-8b21-4399f0a96378","type":"schedules","attributes":{"name":"Escalation + Policy Test Schedule tf-testacconcallteamroutingrulescreateandupdate-local-1748265056","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"a70c7ad7-db1a-4f6d-8365-18459aa9ee2d","type":"teams"}]}}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_overrides_for_a_schedule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_overrides_for_a_schedule_returns_ok_response.frozen new file mode 100644 index 0000000000..4de290ec63 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_overrides_for_a_schedule_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-06-09T23:37:07.887Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_overrides_for_a_schedule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_overrides_for_a_schedule_returns_ok_response.yaml new file mode 100644 index 0000000000..02c7eba36d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_list_of_all_overrides_for_a_schedule_returns_ok_response.yaml @@ -0,0 +1,122 @@ +interactions: +- request: + body: '{"data":{"attributes":{"email":"Test-Get_a_list_of_all_overrides_for_a_schedule_returns_OK_response-1749512227@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: + string: '{"data":{"type":"users","id":"a8c6f210-458a-11f0-8c93-d6008d2166ed","attributes":{"name":null,"handle":"test-get_a_list_of_all_overrides_for_a_schedule_returns_ok_response-1749512227@datadoghq.com","created_at":"2025-06-09T23:37:08.789947+00:00","modified_at":"2025-06-09T23:37:08.789947+00:00","email":"test-get_a_list_of_all_overrides_for_a_schedule_returns_ok_response-1749512227@datadoghq.com","icon":"https://secure.gravatar.com/avatar/d258e3db456139b683f980ed2d272d47?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 +- request: + body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-05-30T23:37:07.887Z","end_date":"2025-06-19T23:37:07.887Z","interval":{"days":1},"members":[{"user":{"id":"a8c6f210-458a-11f0-8c93-d6008d2166ed"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-06-04T23:37:07.887Z"}],"name":"Test-Get_a_list_of_all_overrides_for_a_schedule_returns_OK_response-1749512227","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: + string: '{"data":{"id":"f6b4026c-2306-4f1c-a5f7-87af6ce59d46","type":"schedules","attributes":{"name":"Test-Get_a_list_of_all_overrides_for_a_schedule_returns_OK_response-1749512227","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"b90bdf1d-1926-4099-abb7-0c37a39b68ce","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":[{"attributes":{"end":"2025-06-10T00:37:07.887Z","start":"2025-06-09T23:37:07.887Z"},"relationships":{"user":{"data":{"id":"a8c6f210-458a-11f0-8c93-d6008d2166ed","type":"users"}}},"type":"overrides"}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules/f6b4026c-2306-4f1c-a5f7-87af6ce59d46/overrides + response: + body: + string: '{"data":[{"id":"e132c48c-af33-42c2-9355-aeeedef6381d","type":"overrides","attributes":{"end":"2025-06-10T00:37:07.887Z","start":"2025-06-09T23:37:07.887Z"},"relationships":{"user":{"data":{"id":"a8c6f210-458a-11f0-8c93-d6008d2166ed","type":"users"}}}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/schedules/f6b4026c-2306-4f1c-a5f7-87af6ce59d46/overrides?filter%5Bstart%5D=2025-06-09T22%3A37%3A07.887Z&filter%5Bend%5D=2025-06-10T00%3A37%3A07.887Z + response: + body: + string: '{"data":[{"id":"e132c48c-af33-42c2-9355-aeeedef6381d","type":"overrides","attributes":{"end":"2025-06-10T00:37:07.887Z","start":"2025-06-09T23:37:07.887Z"},"relationships":{"user":{"data":{"id":"a8c6f210-458a-11f0-8c93-d6008d2166ed","type":"users"}}}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/%7Bschedule_id%7D/overrides/e132c48c-af33-42c2-9355-aeeedef6381d + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"uuid\" [{schedule_id}] is not a valid UUID"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/f6b4026c-2306-4f1c-a5f7-87af6ce59d46 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/a8c6f210-458a-11f0-8c93-d6008d2166ed + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_oncall_team_routing_rules_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_oncall_team_routing_rules_returns_ok_response.frozen new file mode 100644 index 0000000000..3b1ca99f90 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_oncall_team_routing_rules_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-06-09T23:30:31.779Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_oncall_team_routing_rules_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_oncall_team_routing_rules_returns_ok_response.yaml new file mode 100644 index 0000000000..dfdb159920 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_oncall_team_routing_rules_returns_ok_response.yaml @@ -0,0 +1,177 @@ +interactions: +- request: + body: '{"data":{"attributes":{"email":"Test-Get_On_Call_team_routing_rules_returns_OK_response-1749511831@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: + string: '{"data":{"type":"users","id":"bc907b9d-4589-11f0-90a5-c6be27f34b35","attributes":{"name":null,"handle":"test-get_on_call_team_routing_rules_returns_ok_response-1749511831@datadoghq.com","created_at":"2025-06-09T23:30:32.490724+00:00","modified_at":"2025-06-09T23:30:32.490724+00:00","email":"test-get_on_call_team_routing_rules_returns_ok_response-1749511831@datadoghq.com","icon":"https://secure.gravatar.com/avatar/282e20cbe2179ced95eabd4f0895be11?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 +- request: + body: '{"data":{"attributes":{"handle":"test-handle-437ab09a446c969f","name":"test-name-437ab09a446c969f"},"type":"team"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + string: '{"data":{"type":"team","id":"2c5640af-2bbe-4fa7-9912-ffb41692f45a","attributes":{"name":"test-name-437ab09a446c969f","handle":"test-handle-437ab09a446c969f","summary":null,"description":null,"avatar":null,"banner":13,"visible_modules":[],"hidden_modules":[],"created_at":"2025-06-09T23:30:33.256609+00:00","modified_at":"2025-06-09T23:30:33.256619+00:00","user_count":0,"link_count":0},"relationships":{"team_links":{"links":{"related":"/api/v2/team/2c5640af-2bbe-4fa7-9912-ffb41692f45a/links"}},"user_team_permissions":{"links":{"related":"/api/v2/team/2c5640af-2bbe-4fa7-9912-ffb41692f45a/permission-settings"}}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-05-30T23:30:31.779Z","end_date":"2025-06-19T23:30:31.779Z","interval":{"days":1},"members":[{"user":{"id":"bc907b9d-4589-11f0-90a5-c6be27f34b35"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-06-04T23:30:31.779Z"}],"name":"Test-Get_On_Call_team_routing_rules_returns_OK_response-1749511831","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: + string: '{"data":{"id":"5577a3fa-b188-4de6-974b-15f85012d023","type":"schedules","attributes":{"name":"Test-Get_On_Call_team_routing_rules_returns_OK_response-1749511831","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"10797d12-72b5-42a5-9419-c443041a40d9","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"name":"Test-Get_On_Call_team_routing_rules_returns_OK_response-1749511831","resolve_page_on_policy_end":true,"retries":2,"steps":[{"assignment":"default","escalate_after_seconds":3600,"targets":[{"id":"2c5640af-2bbe-4fa7-9912-ffb41692f45a","type":"teams"},{"id":"5577a3fa-b188-4de6-974b-15f85012d023","type":"schedules"},{"id":"bc907b9d-4589-11f0-90a5-c6be27f34b35","type":"users"}]},{"assignment":"round-robin","escalate_after_seconds":3600,"targets":[{"id":"2c5640af-2bbe-4fa7-9912-ffb41692f45a","type":"teams"}]}]},"relationships":{"teams":{"data":[{"id":"2c5640af-2bbe-4fa7-9912-ffb41692f45a","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: + string: '{"data":{"id":"ba689dcc-6308-4988-beef-6bff469062e0","type":"policies","attributes":{"name":"Test-Get_On_Call_team_routing_rules_returns_OK_response-1749511831","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"7a46faac-d206-4583-b04b-739811011b6e","type":"steps"},{"id":"421f115d-86cc-4aa0-b855-99a6670de8a0","type":"steps"}]},"teams":{"data":[{"id":"2c5640af-2bbe-4fa7-9912-ffb41692f45a","type":"teams"}]}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"rules":[{"actions":[],"policy_id":"ba689dcc-6308-4988-beef-6bff469062e0","query":"","urgency":"low"}]},"id":"2c5640af-2bbe-4fa7-9912-ffb41692f45a","type":"team_routing_rules"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/on-call/teams/2c5640af-2bbe-4fa7-9912-ffb41692f45a/routing-rules + response: + body: + string: '{"data":{"id":"2c5640af-2bbe-4fa7-9912-ffb41692f45a","type":"team_routing_rules","relationships":{"rules":{"data":[{"id":"virtual-2c5640af-2bbe-4fa7-9912-ffb41692f45a-rule-0","type":"team_routing_rules"}]}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/teams/2c5640af-2bbe-4fa7-9912-ffb41692f45a/routing-rules + response: + body: + string: '{"data":{"id":"2c5640af-2bbe-4fa7-9912-ffb41692f45a","type":"team_routing_rules","relationships":{"rules":{"data":[{"id":"virtual-2c5640af-2bbe-4fa7-9912-ffb41692f45a-rule-0","type":"team_routing_rules"}]}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/escalation-policies/ba689dcc-6308-4988-beef-6bff469062e0 + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"policy[ba689dcc-6308-4988-beef-6bff469062e0] + is in use"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/5577a3fa-b188-4de6-974b-15f85012d023 + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"schedule[5577a3fa-b188-4de6-974b-15f85012d023] + is in use"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/2c5640af-2bbe-4fa7-9912-ffb41692f45a + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/bc907b9d-4589-11f0-90a5-c6be27f34b35 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index dd414a687e..2e671684d8 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -508,6 +508,22 @@ "tag": "On-Call", "operationId": "CreateOnCallSchedule" }, + { + "parameters": [ + { + "name": "schedule_id", + "source": "schedule.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": [\n {\n \"attributes\": {\n \"start\": \"{{ timeISO('now') }}\",\n \"end\": \"{{ timeISO('now + 1h') }}\"\n },\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"{{ user.data.id }}\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"overrides\"\n }\n ]\n}" + } + ], + "step": "there is a valid \"override\" in the system", + "key": "override", + "tag": "On-Call", + "operationId": "CreateOnCallScheduleOverride" + }, { "parameters": [ { diff --git a/tests/v2/features/on-call.feature b/tests/v2/features/on-call.feature index 2e612c6bf7..d0ec634a2f 100644 --- a/tests/v2/features/on-call.feature +++ b/tests/v2/features/on-call.feature @@ -43,6 +43,32 @@ Feature: On-Call When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/bugle + Scenario: Create an override returns "Bad Request" response + Given new "CreateOnCallScheduleOverride" request + And request contains "schedule_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"end": "", "start": ""}, "relationships": {"user": {"data": {"type": "users"}}}, "type": "overrides"}]} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/bugle + Scenario: Create an override returns "Created" response + Given new "CreateOnCallScheduleOverride" request + And there is a valid "user" in the system + And there is a valid "schedule" in the system + And request contains "schedule_id" parameter from "schedule.data.id" + And body with value {"data": [{"attributes": {"start": "{{ timeISO('now') }}", "end": "{{ timeISO('now + 1h') }}"}, "relationships": {"user": {"data": {"id": "{{ user.data.id }}", "type": "users"}}}, "type": "overrides"}]} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/bugle + Scenario: Create an override returns "Not Found" response + Given new "CreateOnCallScheduleOverride" request + And request contains "schedule_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"end": "", "start": ""}, "relationships": {"user": {"data": {"type": "users"}}}, "type": "overrides"}]} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/bugle Scenario: Delete On-Call escalation policy returns "No Content" response Given new "DeleteOnCallEscalationPolicy" request @@ -77,6 +103,33 @@ Feature: On-Call When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/bugle + Scenario: Delete an override returns "Bad Request" response + Given new "DeleteOnCallScheduleOverride" request + And request contains "schedule_id" parameter from "REPLACE.ME" + And request contains "override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/bugle + Scenario: Delete an override returns "No Content" response + Given new "DeleteOnCallScheduleOverride" request + And there is a valid "user" in the system + And there is a valid "schedule" in the system + And there is a valid "override" in the system + And request contains "schedule_id" parameter from "schedule.data.id" + And request contains "override_id" parameter from "override.data[0].id" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/bugle + Scenario: Delete an override returns "Not Found" response + Given new "DeleteOnCallScheduleOverride" request + And request contains "schedule_id" parameter from "REPLACE.ME" + And request contains "override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/bugle Scenario: Get On-Call escalation policy returns "Bad Request" response Given new "GetOnCallEscalationPolicy" request @@ -119,10 +172,81 @@ Feature: On-Call When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/bugle + @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" + 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 there are valid "routing_rules" in the system + And request contains "team_id" parameter from "dd_team.data.id" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/bugle + Scenario: Get a list of all escalation policies returns "Bad Request" response + Given new "ListOnCallEscalationPolicies" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/bugle + Scenario: Get a list of all escalation policies returns "Not Found" response + Given new "ListOnCallEscalationPolicies" request + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/bugle + Scenario: Get a list of all escalation policies returns "OK" response + Given new "ListOnCallEscalationPolicies" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/bugle + Scenario: Get a list of all on-call schedules returns "Bad Request" response + Given new "ListOnCallSchedules" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/bugle + Scenario: Get a list of all on-call schedules returns "Not Found" response + Given new "ListOnCallSchedules" request + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/bugle + Scenario: Get a list of all on-call schedules returns "OK" response + Given new "ListOnCallSchedules" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/bugle + Scenario: Get a list of all overrides for a schedule returns "Bad Request" response + Given new "ListOnCallScheduleOverrides" request + And request contains "schedule_id" parameter from "REPLACE.ME" + And request contains "filter[start]" parameter from "REPLACE.ME" + And request contains "filter[end]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/bugle + Scenario: Get a list of all overrides for a schedule returns "Not Found" response + Given new "ListOnCallScheduleOverrides" request + And request contains "schedule_id" parameter from "REPLACE.ME" + And request contains "filter[start]" parameter from "REPLACE.ME" + And request contains "filter[end]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/bugle + Scenario: Get a list of all overrides for a schedule returns "OK" response + Given new "ListOnCallScheduleOverrides" request + And there is a valid "user" in the system + And there is a valid "schedule" in the system + And there is a valid "override" in the system + And request contains "schedule_id" parameter from "schedule.data.id" + And request contains "filter[start]" parameter with value "{{ timeISO('now - 1h') }}" + And request contains "filter[end]" parameter with value "{{ timeISO('now + 1h') }}" When the request is sent Then the response status is 200 OK @@ -176,7 +300,7 @@ Feature: On-Call When the request is sent Then the response status is 200 OK - @skip-python @team:DataDog/bugle + @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 diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 2d33b5cd71..bdc1233b37 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1926,6 +1926,12 @@ "type": "safe" } }, + "ListOnCallEscalationPolicies": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, "CreateOnCallEscalationPolicy": { "tag": "On-Call", "undo": { @@ -1985,6 +1991,12 @@ "type": "unsafe" } }, + "ListOnCallSchedules": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, "CreateOnCallSchedule": { "tag": "On-Call", "undo": { @@ -2022,6 +2034,31 @@ "type": "safe" } }, + "ListOnCallScheduleOverrides": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "CreateOnCallScheduleOverride": { + "tag": "On-Call", + "undo": { + "operationId": "DeleteOnCallScheduleOverride", + "parameters": [ + { + "name": "override_id", + "source": "data[0].id" + } + ], + "type": "unsafe" + } + }, + "DeleteOnCallScheduleOverride": { + "tag": "On-Call", + "undo": { + "type": "idempotent" + } + }, "GetTeamOnCallUsers": { "tag": "On-Call", "undo": {