Skip to content

Commit fb03d19

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit af0cd40 of spec repo
1 parent 07a8e7d commit fb03d19

File tree

11 files changed

+493
-0
lines changed

11 files changed

+493
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17289,6 +17289,76 @@ components:
1728917289
- score
1729017290
- severity
1729117291
type: object
17292+
Email:
17293+
description: On-Call User Email.
17294+
example:
17295+
data:
17296+
attributes:
17297+
active: true
17298+
17299+
alias: ''
17300+
blocked: false
17301+
created_at: '2024-04-16T23:38:50.388642Z'
17302+
formats:
17303+
- html
17304+
modified_at: '2024-04-16T23:38:50.388642Z'
17305+
id: 45cd9fe5-dd96-42ad-83de-2242ea9f6efd
17306+
type: emails
17307+
properties:
17308+
data:
17309+
$ref: '#/components/schemas/EmailData'
17310+
type: object
17311+
EmailAttributes:
17312+
description: Attributes for an on-call email.
17313+
properties:
17314+
active:
17315+
description: Whether the email is currently active.
17316+
type: boolean
17317+
address:
17318+
description: Email address.
17319+
type: string
17320+
alias:
17321+
description: Optional display alias for the email.
17322+
type: string
17323+
blocked:
17324+
description: Whether the email is blocked.
17325+
type: boolean
17326+
created_at:
17327+
description: Creation time of the email resource.
17328+
format: date-time
17329+
type: string
17330+
formats:
17331+
description: Preferred content formats for notifications.
17332+
items:
17333+
type: string
17334+
type: array
17335+
modified_at:
17336+
description: Last modification time of the email resource.
17337+
format: date-time
17338+
type: string
17339+
type: object
17340+
EmailData:
17341+
description: Data for an on-call email resource.
17342+
properties:
17343+
attributes:
17344+
$ref: '#/components/schemas/EmailAttributes'
17345+
id:
17346+
description: The email's unique identifier.
17347+
type: string
17348+
type:
17349+
$ref: '#/components/schemas/EmailType'
17350+
required:
17351+
- type
17352+
type: object
17353+
EmailType:
17354+
default: emails
17355+
description: Indicates that the resource is of type 'emails'.
17356+
enum:
17357+
- emails
17358+
example: emails
17359+
type: string
17360+
x-enum-varnames:
17361+
- EMAILS
1729217362
Enabled:
1729317363
description: Field used to enable or disable the rule.
1729417364
example: true
@@ -70837,6 +70907,48 @@ paths:
7083770907
operator: AND
7083870908
permissions:
7083970909
- on_call_write
70910+
/api/v2/on-call/users/{user_id}/notification-channels/emails:
70911+
post:
70912+
description: Create a new email notification channel for an on-call user
70913+
operationId: CreateUserEmailNotificationChannel
70914+
parameters:
70915+
- description: The user ID
70916+
in: path
70917+
name: user_id
70918+
required: true
70919+
schema:
70920+
example: 00000000-0000-0000-0000-000000000000
70921+
type: string
70922+
requestBody:
70923+
content:
70924+
application/json:
70925+
schema:
70926+
$ref: '#/components/schemas/Email'
70927+
required: true
70928+
responses:
70929+
'201':
70930+
description: Created
70931+
'400':
70932+
$ref: '#/components/responses/BadRequestResponse'
70933+
'401':
70934+
$ref: '#/components/responses/UnauthorizedResponse'
70935+
'403':
70936+
$ref: '#/components/responses/ForbiddenResponse'
70937+
'404':
70938+
$ref: '#/components/responses/NotFoundResponse'
70939+
'429':
70940+
$ref: '#/components/responses/TooManyRequestsResponse'
70941+
security:
70942+
- apiKeyAuth: []
70943+
appKeyAuth: []
70944+
- AuthZ: []
70945+
summary: Create email notification channel for user
70946+
tags:
70947+
- On-Call
70948+
x-permission:
70949+
operator: AND
70950+
permissions:
70951+
- on_call_admin
7084070952
/api/v2/org_configs:
7084170953
get:
7084270954
description: Returns all Org Configs (name, description, and value).

docs/datadog_api_client.v2.model.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7039,6 +7039,34 @@ datadog\_api\_client.v2.model.downtime\_update\_request\_data module
70397039
:members:
70407040
:show-inheritance:
70417041

7042+
datadog\_api\_client.v2.model.email module
7043+
------------------------------------------
7044+
7045+
.. automodule:: datadog_api_client.v2.model.email
7046+
:members:
7047+
:show-inheritance:
7048+
7049+
datadog\_api\_client.v2.model.email\_attributes module
7050+
------------------------------------------------------
7051+
7052+
.. automodule:: datadog_api_client.v2.model.email_attributes
7053+
:members:
7054+
:show-inheritance:
7055+
7056+
datadog\_api\_client.v2.model.email\_data module
7057+
------------------------------------------------
7058+
7059+
.. automodule:: datadog_api_client.v2.model.email_data
7060+
:members:
7061+
:show-inheritance:
7062+
7063+
datadog\_api\_client.v2.model.email\_type module
7064+
------------------------------------------------
7065+
7066+
.. automodule:: datadog_api_client.v2.model.email_type
7067+
:members:
7068+
:show-inheritance:
7069+
70427070
datadog\_api\_client.v2.model.entity\_attributes module
70437071
-------------------------------------------------------
70447072

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Create email notification channel for user returns "Created" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.on_call_api import OnCallApi
7+
from datadog_api_client.v2.model.email import Email
8+
from datadog_api_client.v2.model.email_attributes import EmailAttributes
9+
from datadog_api_client.v2.model.email_data import EmailData
10+
from datadog_api_client.v2.model.email_type import EmailType
11+
from datetime import datetime
12+
from dateutil.tz import tzutc
13+
14+
body = Email(
15+
data=EmailData(
16+
attributes=EmailAttributes(
17+
active=True,
18+
address="[email protected]",
19+
alias="",
20+
blocked=False,
21+
created_at=datetime(2024, 4, 16, 23, 38, 50, 388642, tzinfo=tzutc()),
22+
formats=[
23+
"html",
24+
],
25+
modified_at=datetime(2024, 4, 16, 23, 38, 50, 388642, tzinfo=tzutc()),
26+
),
27+
id="45cd9fe5-dd96-42ad-83de-2242ea9f6efd",
28+
type=EmailType.EMAILS,
29+
),
30+
)
31+
32+
configuration = Configuration()
33+
with ApiClient(configuration) as api_client:
34+
api_instance = OnCallApi(api_client)
35+
api_instance.create_user_email_notification_channel(user_id="00000000-0000-0000-0000-000000000000", body=body)

src/datadog_api_client/v2/api/on_call_api.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from datadog_api_client.v2.model.team_on_call_responders import TeamOnCallResponders
2222
from datadog_api_client.v2.model.team_routing_rules import TeamRoutingRules
2323
from datadog_api_client.v2.model.team_routing_rules_request import TeamRoutingRulesRequest
24+
from datadog_api_client.v2.model.email import Email
2425

2526

2627
class OnCallApi:
@@ -84,6 +85,32 @@ def __init__(self, api_client=None):
8485
api_client=api_client,
8586
)
8687

88+
self._create_user_email_notification_channel_endpoint = _Endpoint(
89+
settings={
90+
"response_type": None,
91+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
92+
"endpoint_path": "/api/v2/on-call/users/{user_id}/notification-channels/emails",
93+
"operation_id": "create_user_email_notification_channel",
94+
"http_method": "POST",
95+
"version": "v2",
96+
},
97+
params_map={
98+
"user_id": {
99+
"required": True,
100+
"openapi_types": (str,),
101+
"attribute": "user_id",
102+
"location": "path",
103+
},
104+
"body": {
105+
"required": True,
106+
"openapi_types": (Email,),
107+
"location": "body",
108+
},
109+
},
110+
headers_map={"accept": ["*/*"], "content_type": ["application/json"]},
111+
api_client=api_client,
112+
)
113+
87114
self._delete_on_call_escalation_policy_endpoint = _Endpoint(
88115
settings={
89116
"response_type": None,
@@ -414,6 +441,27 @@ def create_on_call_schedule(
414441

415442
return self._create_on_call_schedule_endpoint.call_with_http_info(**kwargs)
416443

444+
def create_user_email_notification_channel(
445+
self,
446+
user_id: str,
447+
body: Email,
448+
) -> None:
449+
"""Create email notification channel for user.
450+
451+
Create a new email notification channel for an on-call user
452+
453+
:param user_id: The user ID
454+
:type user_id: str
455+
:type body: Email
456+
:rtype: None
457+
"""
458+
kwargs: Dict[str, Any] = {}
459+
kwargs["user_id"] = user_id
460+
461+
kwargs["body"] = body
462+
463+
return self._create_user_email_notification_channel_endpoint.call_with_http_info(**kwargs)
464+
417465
def delete_on_call_escalation_policy(
418466
self,
419467
policy_id: str,
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.email_data import EmailData
18+
19+
20+
class Email(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v2.model.email_data import EmailData
24+
25+
return {
26+
"data": (EmailData,),
27+
}
28+
29+
attribute_map = {
30+
"data": "data",
31+
}
32+
33+
def __init__(self_, data: Union[EmailData, UnsetType] = unset, **kwargs):
34+
"""
35+
On-Call User Email.
36+
37+
:param data: Data for an on-call email resource.
38+
:type data: EmailData, optional
39+
"""
40+
if data is not unset:
41+
kwargs["data"] = data
42+
super().__init__(kwargs)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import List, Union
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
datetime,
12+
unset,
13+
UnsetType,
14+
)
15+
16+
17+
class EmailAttributes(ModelNormal):
18+
@cached_property
19+
def openapi_types(_):
20+
return {
21+
"active": (bool,),
22+
"address": (str,),
23+
"alias": (str,),
24+
"blocked": (bool,),
25+
"created_at": (datetime,),
26+
"formats": ([str],),
27+
"modified_at": (datetime,),
28+
}
29+
30+
attribute_map = {
31+
"active": "active",
32+
"address": "address",
33+
"alias": "alias",
34+
"blocked": "blocked",
35+
"created_at": "created_at",
36+
"formats": "formats",
37+
"modified_at": "modified_at",
38+
}
39+
40+
def __init__(
41+
self_,
42+
active: Union[bool, UnsetType] = unset,
43+
address: Union[str, UnsetType] = unset,
44+
alias: Union[str, UnsetType] = unset,
45+
blocked: Union[bool, UnsetType] = unset,
46+
created_at: Union[datetime, UnsetType] = unset,
47+
formats: Union[List[str], UnsetType] = unset,
48+
modified_at: Union[datetime, UnsetType] = unset,
49+
**kwargs,
50+
):
51+
"""
52+
Attributes for an on-call email.
53+
54+
:param active: Whether the email is currently active.
55+
:type active: bool, optional
56+
57+
:param address: Email address.
58+
:type address: str, optional
59+
60+
:param alias: Optional display alias for the email.
61+
:type alias: str, optional
62+
63+
:param blocked: Whether the email is blocked.
64+
:type blocked: bool, optional
65+
66+
:param created_at: Creation time of the email resource.
67+
:type created_at: datetime, optional
68+
69+
:param formats: Preferred content formats for notifications.
70+
:type formats: [str], optional
71+
72+
:param modified_at: Last modification time of the email resource.
73+
:type modified_at: datetime, optional
74+
"""
75+
if active is not unset:
76+
kwargs["active"] = active
77+
if address is not unset:
78+
kwargs["address"] = address
79+
if alias is not unset:
80+
kwargs["alias"] = alias
81+
if blocked is not unset:
82+
kwargs["blocked"] = blocked
83+
if created_at is not unset:
84+
kwargs["created_at"] = created_at
85+
if formats is not unset:
86+
kwargs["formats"] = formats
87+
if modified_at is not unset:
88+
kwargs["modified_at"] = modified_at
89+
super().__init__(kwargs)

0 commit comments

Comments
 (0)