Skip to content

Commit dee73bc

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add powerpack widget to dashboard schema (#2006)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 448404a commit dee73bc

18 files changed

+1199
-31
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:13.273150",
8-
"spec_repo_commit": "aee9e14a"
7+
"regenerated": "2023-10-04 17:33:04.961391",
8+
"spec_repo_commit": "adf28ce4"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-02 18:58:13.288015",
13-
"spec_repo_commit": "aee9e14a"
12+
"regenerated": "2023-10-04 17:33:04.978253",
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'
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Create a new dashboard with powerpack widget
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v1.api.DashboardsApi;
6+
import com.datadog.api.client.v1.model.Dashboard;
7+
import com.datadog.api.client.v1.model.DashboardLayoutType;
8+
import com.datadog.api.client.v1.model.PowerpackTemplateVariableContents;
9+
import com.datadog.api.client.v1.model.PowerpackTemplateVariables;
10+
import com.datadog.api.client.v1.model.PowerpackWidgetDefinition;
11+
import com.datadog.api.client.v1.model.PowerpackWidgetDefinitionType;
12+
import com.datadog.api.client.v1.model.Widget;
13+
import com.datadog.api.client.v1.model.WidgetDefinition;
14+
import com.datadog.api.client.v1.model.WidgetLayout;
15+
import java.util.Arrays;
16+
import java.util.Collections;
17+
18+
public class Example {
19+
public static void main(String[] args) {
20+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
21+
DashboardsApi apiInstance = new DashboardsApi(defaultClient);
22+
23+
// there is a valid "powerpack" in the system
24+
String POWERPACK_DATA_ID = System.getenv("POWERPACK_DATA_ID");
25+
26+
Dashboard body =
27+
new Dashboard()
28+
.title("Example-Dashboard with powerpack widget")
29+
.layoutType(DashboardLayoutType.ORDERED)
30+
.widgets(
31+
Collections.singletonList(
32+
new Widget()
33+
.definition(
34+
new WidgetDefinition(
35+
new PowerpackWidgetDefinition()
36+
.type(PowerpackWidgetDefinitionType.POWERPACK)
37+
.powerpackId(POWERPACK_DATA_ID)
38+
.templateVariables(
39+
new PowerpackTemplateVariables()
40+
.controlledByPowerpack(
41+
Collections.singletonList(
42+
new PowerpackTemplateVariableContents()
43+
.name("foo")
44+
.prefix("bar")
45+
.values(
46+
Arrays.asList(
47+
"baz", "qux", "quuz")))))))
48+
.layout(
49+
new WidgetLayout()
50+
.x(1L)
51+
.y(1L)
52+
.width(2L)
53+
.height(2L)
54+
.isColumnBreak(false))))
55+
.description("description")
56+
.isReadOnly(false);
57+
58+
try {
59+
Dashboard result = apiInstance.createDashboard(body);
60+
System.out.println(result);
61+
} catch (ApiException e) {
62+
System.err.println("Exception when calling DashboardsApi#createDashboard");
63+
System.err.println("Status code: " + e.getCode());
64+
System.err.println("Reason: " + e.getResponseBody());
65+
System.err.println("Response headers: " + e.getResponseHeaders());
66+
e.printStackTrace();
67+
}
68+
}
69+
}
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2019-Present Datadog, Inc.
5+
*/
6+
7+
package com.datadog.api.client.v1.model;
8+
9+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
10+
import com.fasterxml.jackson.annotation.JsonAnySetter;
11+
import com.fasterxml.jackson.annotation.JsonCreator;
12+
import com.fasterxml.jackson.annotation.JsonIgnore;
13+
import com.fasterxml.jackson.annotation.JsonInclude;
14+
import com.fasterxml.jackson.annotation.JsonProperty;
15+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
16+
import java.util.ArrayList;
17+
import java.util.HashMap;
18+
import java.util.List;
19+
import java.util.Map;
20+
import java.util.Objects;
21+
22+
/** Powerpack template variable contents. */
23+
@JsonPropertyOrder({
24+
PowerpackTemplateVariableContents.JSON_PROPERTY_NAME,
25+
PowerpackTemplateVariableContents.JSON_PROPERTY_PREFIX,
26+
PowerpackTemplateVariableContents.JSON_PROPERTY_VALUES
27+
})
28+
@jakarta.annotation.Generated(
29+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
30+
public class PowerpackTemplateVariableContents {
31+
@JsonIgnore public boolean unparsed = false;
32+
public static final String JSON_PROPERTY_NAME = "name";
33+
private String name;
34+
35+
public static final String JSON_PROPERTY_PREFIX = "prefix";
36+
private String prefix;
37+
38+
public static final String JSON_PROPERTY_VALUES = "values";
39+
private List<String> values = new ArrayList<>();
40+
41+
public PowerpackTemplateVariableContents() {}
42+
43+
@JsonCreator
44+
public PowerpackTemplateVariableContents(
45+
@JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name,
46+
@JsonProperty(required = true, value = JSON_PROPERTY_VALUES) List<String> values) {
47+
this.name = name;
48+
this.values = values;
49+
}
50+
51+
public PowerpackTemplateVariableContents name(String name) {
52+
this.name = name;
53+
return this;
54+
}
55+
56+
/**
57+
* The name of the variable.
58+
*
59+
* @return name
60+
*/
61+
@JsonProperty(JSON_PROPERTY_NAME)
62+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
63+
public String getName() {
64+
return name;
65+
}
66+
67+
public void setName(String name) {
68+
this.name = name;
69+
}
70+
71+
public PowerpackTemplateVariableContents prefix(String prefix) {
72+
this.prefix = prefix;
73+
return this;
74+
}
75+
76+
/**
77+
* The tag prefix associated with the variable.
78+
*
79+
* @return prefix
80+
*/
81+
@jakarta.annotation.Nullable
82+
@JsonProperty(JSON_PROPERTY_PREFIX)
83+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
84+
public String getPrefix() {
85+
return prefix;
86+
}
87+
88+
public void setPrefix(String prefix) {
89+
this.prefix = prefix;
90+
}
91+
92+
public PowerpackTemplateVariableContents values(List<String> values) {
93+
this.values = values;
94+
return this;
95+
}
96+
97+
public PowerpackTemplateVariableContents addValuesItem(String valuesItem) {
98+
this.values.add(valuesItem);
99+
return this;
100+
}
101+
102+
/**
103+
* One or many template variable values within the saved view, which will be unioned together
104+
* using <code>OR</code> if more than one is specified.
105+
*
106+
* @return values
107+
*/
108+
@JsonProperty(JSON_PROPERTY_VALUES)
109+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
110+
public List<String> getValues() {
111+
return values;
112+
}
113+
114+
public void setValues(List<String> values) {
115+
this.values = values;
116+
}
117+
118+
/**
119+
* A container for additional, undeclared properties. This is a holder for any undeclared
120+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
121+
*/
122+
private Map<String, Object> additionalProperties;
123+
124+
/**
125+
* Set the additional (undeclared) property with the specified name and value. If the property
126+
* does not already exist, create it otherwise replace it.
127+
*
128+
* @param key The arbitrary key to set
129+
* @param value The associated value
130+
* @return PowerpackTemplateVariableContents
131+
*/
132+
@JsonAnySetter
133+
public PowerpackTemplateVariableContents putAdditionalProperty(String key, Object value) {
134+
if (this.additionalProperties == null) {
135+
this.additionalProperties = new HashMap<String, Object>();
136+
}
137+
this.additionalProperties.put(key, value);
138+
return this;
139+
}
140+
141+
/**
142+
* Return the additional (undeclared) property.
143+
*
144+
* @return The additional properties
145+
*/
146+
@JsonAnyGetter
147+
public Map<String, Object> getAdditionalProperties() {
148+
return additionalProperties;
149+
}
150+
151+
/**
152+
* Return the additional (undeclared) property with the specified name.
153+
*
154+
* @param key The arbitrary key to get
155+
* @return The specific additional property for the given key
156+
*/
157+
public Object getAdditionalProperty(String key) {
158+
if (this.additionalProperties == null) {
159+
return null;
160+
}
161+
return this.additionalProperties.get(key);
162+
}
163+
164+
/** Return true if this PowerpackTemplateVariableContents object is equal to o. */
165+
@Override
166+
public boolean equals(Object o) {
167+
if (this == o) {
168+
return true;
169+
}
170+
if (o == null || getClass() != o.getClass()) {
171+
return false;
172+
}
173+
PowerpackTemplateVariableContents powerpackTemplateVariableContents =
174+
(PowerpackTemplateVariableContents) o;
175+
return Objects.equals(this.name, powerpackTemplateVariableContents.name)
176+
&& Objects.equals(this.prefix, powerpackTemplateVariableContents.prefix)
177+
&& Objects.equals(this.values, powerpackTemplateVariableContents.values)
178+
&& Objects.equals(
179+
this.additionalProperties, powerpackTemplateVariableContents.additionalProperties);
180+
}
181+
182+
@Override
183+
public int hashCode() {
184+
return Objects.hash(name, prefix, values, additionalProperties);
185+
}
186+
187+
@Override
188+
public String toString() {
189+
StringBuilder sb = new StringBuilder();
190+
sb.append("class PowerpackTemplateVariableContents {\n");
191+
sb.append(" name: ").append(toIndentedString(name)).append("\n");
192+
sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n");
193+
sb.append(" values: ").append(toIndentedString(values)).append("\n");
194+
sb.append(" additionalProperties: ")
195+
.append(toIndentedString(additionalProperties))
196+
.append("\n");
197+
sb.append("}");
198+
return sb.toString();
199+
}
200+
201+
/**
202+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
203+
*/
204+
private String toIndentedString(Object o) {
205+
if (o == null) {
206+
return "null";
207+
}
208+
return o.toString().replace("\n", "\n ");
209+
}
210+
}

0 commit comments

Comments
 (0)