-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathCreateDashboardSecureEmbed.py
More file actions
54 lines (50 loc) · 2.51 KB
/
CreateDashboardSecureEmbed.py
File metadata and controls
54 lines (50 loc) · 2.51 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Create a secure embed for a dashboard returns "OK" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.dashboard_secure_embed_api import DashboardSecureEmbedApi
from datadog_api_client.v2.model.secure_embed_create_request import SecureEmbedCreateRequest
from datadog_api_client.v2.model.secure_embed_create_request_attributes import SecureEmbedCreateRequestAttributes
from datadog_api_client.v2.model.secure_embed_create_request_data import SecureEmbedCreateRequestData
from datadog_api_client.v2.model.secure_embed_global_time import SecureEmbedGlobalTime
from datadog_api_client.v2.model.secure_embed_global_time_live_span import SecureEmbedGlobalTimeLiveSpan
from datadog_api_client.v2.model.secure_embed_request_type import SecureEmbedRequestType
from datadog_api_client.v2.model.secure_embed_selectable_template_variable import SecureEmbedSelectableTemplateVariable
from datadog_api_client.v2.model.secure_embed_status import SecureEmbedStatus
from datadog_api_client.v2.model.secure_embed_viewing_preferences import SecureEmbedViewingPreferences
from datadog_api_client.v2.model.secure_embed_viewing_preferences_theme import SecureEmbedViewingPreferencesTheme
body = SecureEmbedCreateRequest(
data=SecureEmbedCreateRequestData(
attributes=SecureEmbedCreateRequestAttributes(
global_time=SecureEmbedGlobalTime(
live_span=SecureEmbedGlobalTimeLiveSpan.PAST_ONE_HOUR,
),
global_time_selectable=True,
selectable_template_vars=[
SecureEmbedSelectableTemplateVariable(
default_values=[
"1",
],
name="org_id",
prefix="org_id",
visible_tags=[
"1",
],
),
],
status=SecureEmbedStatus.ACTIVE,
title="Q1 Metrics Dashboard",
viewing_preferences=SecureEmbedViewingPreferences(
high_density=False,
theme=SecureEmbedViewingPreferencesTheme.SYSTEM,
),
),
type=SecureEmbedRequestType.SECURE_EMBED_REQUEST,
),
)
configuration = Configuration()
configuration.unstable_operations["create_dashboard_secure_embed"] = True
with ApiClient(configuration) as api_client:
api_instance = DashboardSecureEmbedApi(api_client)
response = api_instance.create_dashboard_secure_embed(dashboard_id="dashboard_id", body=body)
print(response)