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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21602,6 +21602,82 @@ components:
- type
- attributes
type: object
IncidentCreatePageAttributes:
description: Attributes for creating a page from an incident.
properties:
description:
description: Description of the page.
example: Page created for incident response
nullable: true
type: string
services:
description: List of services associated with the page.
example:
- web-service
- api-service
items:
type: string
nullable: true
type: array
tags:
description: List of tags for the page.
example:
- urgent
- production
items:
type: string
nullable: true
type: array
target:
$ref: '#/components/schemas/IncidentPageTarget'
title:
description: Title of the page.
example: Incident Response Page
type: string
required:
- title
- target
type: object
IncidentCreatePageFromIncidentData:
description: Data for creating a page from an incident.
properties:
attributes:
$ref: '#/components/schemas/IncidentCreatePageAttributes'
type:
$ref: '#/components/schemas/IncidentPageType'
required:
- type
- attributes
type: object
IncidentCreatePageFromIncidentRequest:
description: Request to create a page from an incident.
properties:
data:
$ref: '#/components/schemas/IncidentCreatePageFromIncidentData'
required:
- data
type: object
IncidentCreatePageResponse:
description: Response from creating a page from an incident.
properties:
data:
$ref: '#/components/schemas/IncidentCreatePageResponseData'
required:
- data
type: object
IncidentCreatePageResponseData:
description: Data from creating a page.
properties:
id:
description: The UUID of the created page.
example: 00000000-0000-0000-0000-000000000000
type: string
type:
$ref: '#/components/schemas/IncidentPageIdType'
required:
- id
- type
type: object
IncidentCreateRelationships:
description: The relationships the incident will have with other resources once
created.
Expand Down Expand Up @@ -22586,6 +22662,48 @@ components:
- id
- type
type: object
IncidentPageIdType:
description: Incident page ID type.
enum:
- page_uuid
example: page_uuid
type: string
x-enum-varnames:
- PAGE_UUID
IncidentPageTarget:
description: Target for creating a page from an incident.
properties:
identifier:
description: The identifier of the target (team handle, team UUID, or user
UUID).
example: team-handle
type: string
type:
$ref: '#/components/schemas/IncidentPageTargetType'
required:
- type
- identifier
type: object
IncidentPageTargetType:
description: Type of page target for incident pages.
enum:
- team_handle
- team_uuid
- user_uuid
example: team_handle
type: string
x-enum-varnames:
- TEAM_HANDLE
- TEAM_UUID
- USER_UUID
IncidentPageType:
description: Incident page type.
enum:
- page
example: page
type: string
x-enum-varnames:
- PAGE
IncidentPostmortemType:
default: incident_postmortems
description: Incident postmortem resource type.
Expand Down Expand Up @@ -50878,6 +50996,7 @@ components:
is not required to set downtimes.
monitors_read: View monitors.
monitors_write: Edit, delete, and resolve individual monitors.
oncall_page: Create and manage on-call pages.
org_connections_read: Read cross organization connections.
org_connections_write: Create, edit, and delete cross organization connections.
org_management: Edit org configurations, including authentication and
Expand Down Expand Up @@ -59667,6 +59786,54 @@ paths:
x-unstable: '**Note**: This endpoint is in Preview.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/incidents/{incident_id}/page:
post:
description: Create a page from an incident.
operationId: CreatePageFromIncident
parameters:
- $ref: '#/components/parameters/IncidentIDPathParameter'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/IncidentCreatePageFromIncidentRequest'
description: Page creation request payload.
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/IncidentCreatePageResponse'
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:
- incident_read
- oncall_page
summary: Create a page from an incident
tags:
- Incidents
x-codegen-request-body-name: body
x-permission:
operator: AND
permissions:
- incident_read
- oncall_page
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/incidents/{incident_id}/relationships/integrations:
get:
description: Get all integration metadata for an incident.
Expand Down
63 changes: 63 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9027,6 +9027,41 @@ datadog\_api\_client.v2.model.incident\_create\_data module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_create\_page\_attributes module
-----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_create_page_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_create\_page\_from\_incident\_data module
---------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_create_page_from_incident_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_create\_page\_from\_incident\_request module
------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_create_page_from_incident_request
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_create\_page\_response module
---------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_create_page_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_create\_page\_response\_data module
---------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_create_page_response_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_create\_relationships module
--------------------------------------------------------------------

Expand Down Expand Up @@ -9475,6 +9510,34 @@ datadog\_api\_client.v2.model.incident\_notification\_template\_update\_data mod
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_page\_id\_type module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_page_id_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_page\_target module
-----------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_page_target
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_page\_target\_type module
-----------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_page_target_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_page\_type module
---------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.incident_page_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.incident\_postmortem\_type module
---------------------------------------------------------------

Expand Down
42 changes: 42 additions & 0 deletions examples/v2/incidents/CreatePageFromIncident.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Create a page from an incident returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_create_page_attributes import IncidentCreatePageAttributes
from datadog_api_client.v2.model.incident_create_page_from_incident_data import IncidentCreatePageFromIncidentData
from datadog_api_client.v2.model.incident_create_page_from_incident_request import IncidentCreatePageFromIncidentRequest
from datadog_api_client.v2.model.incident_page_target import IncidentPageTarget
from datadog_api_client.v2.model.incident_page_target_type import IncidentPageTargetType
from datadog_api_client.v2.model.incident_page_type import IncidentPageType

body = IncidentCreatePageFromIncidentRequest(
data=IncidentCreatePageFromIncidentData(
attributes=IncidentCreatePageAttributes(
description="Page created for incident response",
services=[
"web-service",
"api-service",
],
tags=[
"urgent",
"production",
],
target=IncidentPageTarget(
identifier="team-handle",
type=IncidentPageTargetType.TEAM_HANDLE,
),
title="Incident Response Page",
),
type=IncidentPageType.PAGE,
),
)

configuration = Configuration()
configuration.unstable_operations["create_page_from_incident"] = True
with ApiClient(configuration) as api_client:
api_instance = IncidentsApi(api_client)
response = api_instance.create_page_from_incident(incident_id="incident_id", body=body)

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def __init__(
"v2.create_incident_notification_template": False,
"v2.create_incident_todo": False,
"v2.create_incident_type": False,
"v2.create_page_from_incident": False,
"v2.delete_incident": False,
"v2.delete_incident_impact": False,
"v2.delete_incident_integration": False,
Expand Down
50 changes: 50 additions & 0 deletions src/datadog_api_client/v2/api/incidents_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
from datadog_api_client.v2.model.incident_impact_related_object import IncidentImpactRelatedObject
from datadog_api_client.v2.model.incident_impact_response import IncidentImpactResponse
from datadog_api_client.v2.model.incident_impact_create_request import IncidentImpactCreateRequest
from datadog_api_client.v2.model.incident_create_page_response import IncidentCreatePageResponse
from datadog_api_client.v2.model.incident_create_page_from_incident_request import IncidentCreatePageFromIncidentRequest
from datadog_api_client.v2.model.incident_integration_metadata_list_response import (
IncidentIntegrationMetadataListResponse,
)
Expand Down Expand Up @@ -239,6 +241,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._create_page_from_incident_endpoint = _Endpoint(
settings={
"response_type": (IncidentCreatePageResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/incidents/{incident_id}/page",
"operation_id": "create_page_from_incident",
"http_method": "POST",
"version": "v2",
},
params_map={
"incident_id": {
"required": True,
"openapi_types": (str,),
"attribute": "incident_id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (IncidentCreatePageFromIncidentRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

self._delete_incident_endpoint = _Endpoint(
settings={
"response_type": None,
Expand Down Expand Up @@ -1206,6 +1234,28 @@ def create_incident_type(

return self._create_incident_type_endpoint.call_with_http_info(**kwargs)

def create_page_from_incident(
self,
incident_id: str,
body: IncidentCreatePageFromIncidentRequest,
) -> IncidentCreatePageResponse:
"""Create a page from an incident.

Create a page from an incident.

:param incident_id: The UUID of the incident.
:type incident_id: str
:param body: Page creation request payload.
:type body: IncidentCreatePageFromIncidentRequest
:rtype: IncidentCreatePageResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["incident_id"] = incident_id

kwargs["body"] = body

return self._create_page_from_incident_endpoint.call_with_http_info(**kwargs)

def delete_incident(
self,
incident_id: str,
Expand Down
Loading