-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathCreateServiceNowTemplate.py
More file actions
38 lines (34 loc) · 1.59 KB
/
CreateServiceNowTemplate.py
File metadata and controls
38 lines (34 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Create ServiceNow template returns "Created" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.service_now_integration_api import ServiceNowIntegrationApi
from datadog_api_client.v2.model.service_now_template_create_request import ServiceNowTemplateCreateRequest
from datadog_api_client.v2.model.service_now_template_create_request_attributes import (
ServiceNowTemplateCreateRequestAttributes,
)
from datadog_api_client.v2.model.service_now_template_create_request_data import ServiceNowTemplateCreateRequestData
from datadog_api_client.v2.model.service_now_template_type import ServiceNowTemplateType
from uuid import UUID
body = ServiceNowTemplateCreateRequest(
data=ServiceNowTemplateCreateRequestData(
attributes=ServiceNowTemplateCreateRequestAttributes(
assignment_group_id=UUID("65b3341b-0680-47f9-a6d4-134db45c603e"),
business_service_id=UUID("65b3341b-0680-47f9-a6d4-134db45c603e"),
fields_mapping=dict(
category="software",
priority="1",
),
handle_name="incident-template",
instance_id=UUID("65b3341b-0680-47f9-a6d4-134db45c603e"),
servicenow_tablename="incident",
user_id=UUID("65b3341b-0680-47f9-a6d4-134db45c603e"),
),
type=ServiceNowTemplateType.SERVICENOW_TEMPLATES,
),
)
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = ServiceNowIntegrationApi(api_client)
response = api_instance.create_service_now_template(body=body)
print(response)