Skip to content

Commit ec18501

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 09cb5b9 of spec repo (#3944)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 4ebaec4 commit ec18501

11 files changed

Lines changed: 1044 additions & 3 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,10 @@ components:
14431443
format: date-time
14441444
readOnly: true
14451445
type: string
1446+
default_timeframe:
1447+
$ref: "#/components/schemas/DashboardDefaultTimeframeSetting"
1448+
description: The default timeframe applied when opening the dashboard. Set to `null` to clear.
1449+
nullable: true
14461450
description:
14471451
description: Description of the dashboard.
14481452
nullable: true
@@ -1557,13 +1561,48 @@ components:
15571561
required:
15581562
- data
15591563
type: object
1564+
DashboardDefaultTimeframeSetting:
1565+
description: The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
1566+
oneOf:
1567+
- $ref: "#/components/schemas/DashboardLiveTimeframe"
1568+
- $ref: "#/components/schemas/DashboardFixedTimeframe"
15601569
DashboardDeleteResponse:
15611570
description: Response from the delete dashboard call.
15621571
properties:
15631572
deleted_dashboard_id:
15641573
description: ID of the deleted dashboard.
15651574
type: string
15661575
type: object
1576+
DashboardFixedTimeframe:
1577+
description: A fixed dashboard timeframe.
1578+
properties:
1579+
from:
1580+
description: Start time in milliseconds since epoch.
1581+
example: 1712080128000
1582+
format: int64
1583+
minimum: 0
1584+
type: integer
1585+
to:
1586+
description: End time in milliseconds since epoch.
1587+
example: 1712083128000
1588+
format: int64
1589+
minimum: 0
1590+
type: integer
1591+
type:
1592+
$ref: "#/components/schemas/DashboardFixedTimeframeType"
1593+
required:
1594+
- type
1595+
- from
1596+
- to
1597+
type: object
1598+
DashboardFixedTimeframeType:
1599+
description: Type of fixed timeframe.
1600+
enum:
1601+
- fixed
1602+
example: fixed
1603+
type: string
1604+
x-enum-varnames:
1605+
- FIXED
15671606
DashboardGlobalTime:
15681607
description: Object containing the live span selection for the dashboard.
15691608
properties:
@@ -1672,6 +1711,32 @@ components:
16721711
$ref: "#/components/schemas/DashboardList"
16731712
type: array
16741713
type: object
1714+
DashboardLiveTimeframe:
1715+
description: A live dashboard timeframe.
1716+
properties:
1717+
type:
1718+
$ref: "#/components/schemas/DashboardLiveTimeframeType"
1719+
unit:
1720+
$ref: "#/components/schemas/WidgetLiveSpanUnit"
1721+
value:
1722+
description: Value of the live timeframe span.
1723+
example: 4
1724+
format: int64
1725+
minimum: 1
1726+
type: integer
1727+
required:
1728+
- type
1729+
- value
1730+
- unit
1731+
type: object
1732+
DashboardLiveTimeframeType:
1733+
description: Type of live timeframe.
1734+
enum:
1735+
- live
1736+
example: live
1737+
type: string
1738+
x-enum-varnames:
1739+
- LIVE
16751740
DashboardReflowType:
16761741
description: |-
16771742
Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Create a new dashboard with a live default_timeframe returns "OK" response
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.DashboardDefaultTimeframeSetting;
8+
import com.datadog.api.client.v1.model.DashboardLayoutType;
9+
import com.datadog.api.client.v1.model.DashboardLiveTimeframe;
10+
import com.datadog.api.client.v1.model.DashboardLiveTimeframeType;
11+
import com.datadog.api.client.v1.model.NoteWidgetDefinition;
12+
import com.datadog.api.client.v1.model.NoteWidgetDefinitionType;
13+
import com.datadog.api.client.v1.model.Widget;
14+
import com.datadog.api.client.v1.model.WidgetDefinition;
15+
import com.datadog.api.client.v1.model.WidgetLiveSpanUnit;
16+
import com.datadog.api.client.v1.model.WidgetTextAlign;
17+
import com.datadog.api.client.v1.model.WidgetTickEdge;
18+
import java.util.Collections;
19+
20+
public class Example {
21+
public static void main(String[] args) {
22+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
23+
DashboardsApi apiInstance = new DashboardsApi(defaultClient);
24+
25+
Dashboard body =
26+
new Dashboard()
27+
.title("Example-Dashboard")
28+
.layoutType(DashboardLayoutType.ORDERED)
29+
.widgets(
30+
Collections.singletonList(
31+
new Widget()
32+
.definition(
33+
new WidgetDefinition(
34+
new NoteWidgetDefinition()
35+
.type(NoteWidgetDefinitionType.NOTE)
36+
.content("test")
37+
.backgroundColor("white")
38+
.fontSize("14")
39+
.textAlign(WidgetTextAlign.LEFT)
40+
.showTick(false)
41+
.tickPos("50%")
42+
.tickEdge(WidgetTickEdge.LEFT)))))
43+
.defaultTimeframe(
44+
new DashboardDefaultTimeframeSetting(
45+
new DashboardLiveTimeframe()
46+
.type(DashboardLiveTimeframeType.LIVE)
47+
.unit(WidgetLiveSpanUnit.HOUR)
48+
.value(4L)));
49+
50+
try {
51+
Dashboard result = apiInstance.createDashboard(body);
52+
System.out.println(result);
53+
} catch (ApiException e) {
54+
System.err.println("Exception when calling DashboardsApi#createDashboard");
55+
System.err.println("Status code: " + e.getCode());
56+
System.err.println("Reason: " + e.getResponseBody());
57+
System.err.println("Response headers: " + e.getResponseHeaders());
58+
e.printStackTrace();
59+
}
60+
}
61+
}

src/main/java/com/datadog/api/client/v1/model/Dashboard.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
Dashboard.JSON_PROPERTY_AUTHOR_HANDLE,
3030
Dashboard.JSON_PROPERTY_AUTHOR_NAME,
3131
Dashboard.JSON_PROPERTY_CREATED_AT,
32+
Dashboard.JSON_PROPERTY_DEFAULT_TIMEFRAME,
3233
Dashboard.JSON_PROPERTY_DESCRIPTION,
3334
Dashboard.JSON_PROPERTY_ID,
3435
Dashboard.JSON_PROPERTY_IS_READ_ONLY,
@@ -58,6 +59,9 @@ public class Dashboard {
5859
public static final String JSON_PROPERTY_CREATED_AT = "created_at";
5960
private OffsetDateTime createdAt;
6061

62+
public static final String JSON_PROPERTY_DEFAULT_TIMEFRAME = "default_timeframe";
63+
private DashboardDefaultTimeframeSetting defaultTimeframe;
64+
6165
public static final String JSON_PROPERTY_DESCRIPTION = "description";
6266
private JsonNullable<String> description = JsonNullable.<String>undefined();
6367

@@ -172,6 +176,32 @@ public OffsetDateTime getCreatedAt() {
172176
return createdAt;
173177
}
174178

179+
public Dashboard defaultTimeframe(DashboardDefaultTimeframeSetting defaultTimeframe) {
180+
this.defaultTimeframe = defaultTimeframe;
181+
this.unparsed |= defaultTimeframe.unparsed;
182+
return this;
183+
}
184+
185+
/**
186+
* The default timeframe applied when opening the dashboard. Set to <code>null</code> to clear the
187+
* dashboard's default timeframe.
188+
*
189+
* @return defaultTimeframe
190+
*/
191+
@jakarta.annotation.Nullable
192+
@JsonProperty(JSON_PROPERTY_DEFAULT_TIMEFRAME)
193+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
194+
public DashboardDefaultTimeframeSetting getDefaultTimeframe() {
195+
return defaultTimeframe;
196+
}
197+
198+
public void setDefaultTimeframe(DashboardDefaultTimeframeSetting defaultTimeframe) {
199+
this.defaultTimeframe = defaultTimeframe;
200+
if (defaultTimeframe != null) {
201+
this.unparsed |= defaultTimeframe.unparsed;
202+
}
203+
}
204+
175205
public Dashboard description(String description) {
176206
this.description = JsonNullable.<String>of(description);
177207
return this;
@@ -686,6 +716,7 @@ public boolean equals(Object o) {
686716
return Objects.equals(this.authorHandle, dashboard.authorHandle)
687717
&& Objects.equals(this.authorName, dashboard.authorName)
688718
&& Objects.equals(this.createdAt, dashboard.createdAt)
719+
&& Objects.equals(this.defaultTimeframe, dashboard.defaultTimeframe)
689720
&& Objects.equals(this.description, dashboard.description)
690721
&& Objects.equals(this.id, dashboard.id)
691722
&& Objects.equals(this.isReadOnly, dashboard.isReadOnly)
@@ -710,6 +741,7 @@ public int hashCode() {
710741
authorHandle,
711742
authorName,
712743
createdAt,
744+
defaultTimeframe,
713745
description,
714746
id,
715747
isReadOnly,
@@ -735,6 +767,7 @@ public String toString() {
735767
sb.append(" authorHandle: ").append(toIndentedString(authorHandle)).append("\n");
736768
sb.append(" authorName: ").append(toIndentedString(authorName)).append("\n");
737769
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
770+
sb.append(" defaultTimeframe: ").append(toIndentedString(defaultTimeframe)).append("\n");
738771
sb.append(" description: ").append(toIndentedString(description)).append("\n");
739772
sb.append(" id: ").append(toIndentedString(id)).append("\n");
740773
sb.append(" isReadOnly: ").append(toIndentedString(isReadOnly)).append("\n");

0 commit comments

Comments
 (0)