Skip to content

Commit 75a4192

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add powerpack widget to dashboard schema (#1697)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 4c53cf6 commit 75a4192

15 files changed

+547
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-10-02 18:58:17.933721",
8-
"spec_repo_commit": "aee9e14a"
7+
"regenerated": "2023-10-04 17:33:10.073416",
8+
"spec_repo_commit": "adf28ce4"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-02 18:58:17.947416",
13-
"spec_repo_commit": "aee9e14a"
12+
"regenerated": "2023-10-04 17:33:10.095399",
13+
"spec_repo_commit": "adf28ce4"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9085,6 +9085,86 @@ components:
90859085
maxItems: 2
90869086
minItems: 2
90879087
type: array
9088+
PowerpackTemplateVariableContents:
9089+
description: Powerpack template variable contents.
9090+
properties:
9091+
name:
9092+
description: The name of the variable.
9093+
example: host1
9094+
type: string
9095+
prefix:
9096+
description: The tag prefix associated with the variable.
9097+
type: string
9098+
values:
9099+
description: One or many template variable values within the saved view,
9100+
which will be unioned together using `OR` if more than one is specified.
9101+
example:
9102+
- my-host
9103+
- host1
9104+
- host2
9105+
items:
9106+
description: One or more possible values of the template variable.
9107+
minLength: 1
9108+
type: string
9109+
type: array
9110+
required:
9111+
- name
9112+
- values
9113+
type: object
9114+
PowerpackTemplateVariables:
9115+
description: Powerpack template variables.
9116+
properties:
9117+
controlled_by_powerpack:
9118+
description: Template variables controlled at the powerpack level.
9119+
items:
9120+
$ref: '#/components/schemas/PowerpackTemplateVariableContents'
9121+
type: array
9122+
controlled_externally:
9123+
description: Template variables controlled by the external resource, such
9124+
as the dashboard this powerpack is on.
9125+
items:
9126+
$ref: '#/components/schemas/PowerpackTemplateVariableContents'
9127+
type: array
9128+
type: object
9129+
PowerpackWidgetDefinition:
9130+
description: The powerpack widget allows you to keep similar graphs together
9131+
on your timeboard. Each group has a custom header, can hold one to many graphs,
9132+
and is collapsible.
9133+
properties:
9134+
background_color:
9135+
description: Background color of the powerpack title.
9136+
type: string
9137+
banner_img:
9138+
description: URL of image to display as a banner for the powerpack.
9139+
type: string
9140+
powerpack_id:
9141+
description: UUID of the associated powerpack.
9142+
example: df43cf2a-6475-490d-b686-6fbc6cb9a49c
9143+
type: string
9144+
show_title:
9145+
default: true
9146+
description: Whether to show the title or not.
9147+
type: boolean
9148+
template_variables:
9149+
$ref: '#/components/schemas/PowerpackTemplateVariables'
9150+
title:
9151+
description: Title of the widget.
9152+
type: string
9153+
type:
9154+
$ref: '#/components/schemas/PowerpackWidgetDefinitionType'
9155+
required:
9156+
- type
9157+
- powerpack_id
9158+
type: object
9159+
PowerpackWidgetDefinitionType:
9160+
default: powerpack
9161+
description: Type of the powerpack widget.
9162+
enum:
9163+
- powerpack
9164+
example: powerpack
9165+
type: string
9166+
x-enum-varnames:
9167+
- POWERPACK
90889168
ProcessQueryDefinition:
90899169
description: The process query to use in the widget.
90909170
properties:
@@ -19975,6 +20055,7 @@ components:
1997520055
- $ref: '#/components/schemas/LogStreamWidgetDefinition'
1997620056
- $ref: '#/components/schemas/MonitorSummaryWidgetDefinition'
1997720057
- $ref: '#/components/schemas/NoteWidgetDefinition'
20058+
- $ref: '#/components/schemas/PowerpackWidgetDefinition'
1997820059
- $ref: '#/components/schemas/QueryValueWidgetDefinition'
1997920060
- $ref: '#/components/schemas/RunWorkflowWidgetDefinition'
1998020061
- $ref: '#/components/schemas/SLOListWidgetDefinition'

docs/datadog_api_client.v1.model.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,6 +2654,34 @@ point
26542654
:members:
26552655
:show-inheritance:
26562656

2657+
powerpack\_template\_variable\_contents
2658+
---------------------------------------
2659+
2660+
.. automodule:: datadog_api_client.v1.model.powerpack_template_variable_contents
2661+
:members:
2662+
:show-inheritance:
2663+
2664+
powerpack\_template\_variables
2665+
------------------------------
2666+
2667+
.. automodule:: datadog_api_client.v1.model.powerpack_template_variables
2668+
:members:
2669+
:show-inheritance:
2670+
2671+
powerpack\_widget\_definition
2672+
-----------------------------
2673+
2674+
.. automodule:: datadog_api_client.v1.model.powerpack_widget_definition
2675+
:members:
2676+
:show-inheritance:
2677+
2678+
powerpack\_widget\_definition\_type
2679+
-----------------------------------
2680+
2681+
.. automodule:: datadog_api_client.v1.model.powerpack_widget_definition_type
2682+
:members:
2683+
:show-inheritance:
2684+
26572685
process\_query\_definition
26582686
--------------------------
26592687

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""
2+
Create a new dashboard with powerpack widget
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
8+
from datadog_api_client.v1.model.dashboard import Dashboard
9+
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
10+
from datadog_api_client.v1.model.powerpack_template_variable_contents import PowerpackTemplateVariableContents
11+
from datadog_api_client.v1.model.powerpack_template_variables import PowerpackTemplateVariables
12+
from datadog_api_client.v1.model.powerpack_widget_definition import PowerpackWidgetDefinition
13+
from datadog_api_client.v1.model.powerpack_widget_definition_type import PowerpackWidgetDefinitionType
14+
from datadog_api_client.v1.model.widget import Widget
15+
from datadog_api_client.v1.model.widget_layout import WidgetLayout
16+
17+
# there is a valid "powerpack" in the system
18+
POWERPACK_DATA_ID = environ["POWERPACK_DATA_ID"]
19+
20+
body = Dashboard(
21+
title="Example-Dashboard with powerpack widget",
22+
layout_type=DashboardLayoutType.ORDERED,
23+
widgets=[
24+
Widget(
25+
definition=PowerpackWidgetDefinition(
26+
type=PowerpackWidgetDefinitionType.POWERPACK,
27+
powerpack_id=POWERPACK_DATA_ID,
28+
template_variables=PowerpackTemplateVariables(
29+
controlled_externally=[],
30+
controlled_by_powerpack=[
31+
PowerpackTemplateVariableContents(
32+
name="foo",
33+
prefix="bar",
34+
values=[
35+
"baz",
36+
"qux",
37+
"quuz",
38+
],
39+
),
40+
],
41+
),
42+
),
43+
layout=WidgetLayout(
44+
x=1,
45+
y=1,
46+
width=2,
47+
height=2,
48+
is_column_break=False,
49+
),
50+
),
51+
],
52+
description="description",
53+
is_read_only=False,
54+
)
55+
56+
configuration = Configuration()
57+
with ApiClient(configuration) as api_client:
58+
api_instance = DashboardsApi(api_client)
59+
response = api_instance.create_dashboard(body=body)
60+
61+
print(response)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
class PowerpackTemplateVariableContents(ModelNormal):
17+
@cached_property
18+
def openapi_types(_):
19+
return {
20+
"name": (str,),
21+
"prefix": (str,),
22+
"values": ([str],),
23+
}
24+
25+
attribute_map = {
26+
"name": "name",
27+
"prefix": "prefix",
28+
"values": "values",
29+
}
30+
31+
def __init__(self_, name: str, values: List[str], prefix: Union[str, UnsetType] = unset, **kwargs):
32+
"""
33+
Powerpack template variable contents.
34+
35+
:param name: The name of the variable.
36+
:type name: str
37+
38+
:param prefix: The tag prefix associated with the variable.
39+
:type prefix: str, optional
40+
41+
:param values: One or many template variable values within the saved view, which will be unioned together using ``OR`` if more than one is specified.
42+
:type values: [str]
43+
"""
44+
if prefix is not unset:
45+
kwargs["prefix"] = prefix
46+
super().__init__(kwargs)
47+
48+
self_.name = name
49+
self_.values = values
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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, 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.v1.model.powerpack_template_variable_contents import PowerpackTemplateVariableContents
18+
19+
20+
class PowerpackTemplateVariables(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v1.model.powerpack_template_variable_contents import PowerpackTemplateVariableContents
24+
25+
return {
26+
"controlled_by_powerpack": ([PowerpackTemplateVariableContents],),
27+
"controlled_externally": ([PowerpackTemplateVariableContents],),
28+
}
29+
30+
attribute_map = {
31+
"controlled_by_powerpack": "controlled_by_powerpack",
32+
"controlled_externally": "controlled_externally",
33+
}
34+
35+
def __init__(
36+
self_,
37+
controlled_by_powerpack: Union[List[PowerpackTemplateVariableContents], UnsetType] = unset,
38+
controlled_externally: Union[List[PowerpackTemplateVariableContents], UnsetType] = unset,
39+
**kwargs,
40+
):
41+
"""
42+
Powerpack template variables.
43+
44+
:param controlled_by_powerpack: Template variables controlled at the powerpack level.
45+
:type controlled_by_powerpack: [PowerpackTemplateVariableContents], optional
46+
47+
:param controlled_externally: Template variables controlled by the external resource, such as the dashboard this powerpack is on.
48+
:type controlled_externally: [PowerpackTemplateVariableContents], optional
49+
"""
50+
if controlled_by_powerpack is not unset:
51+
kwargs["controlled_by_powerpack"] = controlled_by_powerpack
52+
if controlled_externally is not unset:
53+
kwargs["controlled_externally"] = controlled_externally
54+
super().__init__(kwargs)

0 commit comments

Comments
 (0)