-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathUpdateServiceNowTemplate.py
More file actions
40 lines (36 loc) · 1.67 KB
/
UpdateServiceNowTemplate.py
File metadata and controls
40 lines (36 loc) · 1.67 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
39
40
"""
Update ServiceNow template returns "OK" 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_type import ServiceNowTemplateType
from datadog_api_client.v2.model.service_now_template_update_request import ServiceNowTemplateUpdateRequest
from datadog_api_client.v2.model.service_now_template_update_request_attributes import (
ServiceNowTemplateUpdateRequestAttributes,
)
from datadog_api_client.v2.model.service_now_template_update_request_data import ServiceNowTemplateUpdateRequestData
from uuid import UUID
body = ServiceNowTemplateUpdateRequest(
data=ServiceNowTemplateUpdateRequestData(
attributes=ServiceNowTemplateUpdateRequestAttributes(
assignment_group_id=UUID("65b3341b-0680-47f9-a6d4-134db45c603e"),
business_service_id=UUID("65b3341b-0680-47f9-a6d4-134db45c603e"),
fields_mapping=dict(
category="hardware",
priority="2",
),
handle_name="incident-template-updated",
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.update_service_now_template(
template_id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body=body
)
print(response)