Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,13 @@ components:
description: A role UUID.
type: string
type: array
tabs:
description: List of tabs for organizing dashboard widgets into groups.
items:
$ref: '#/components/schemas/DashboardTab'
maxItems: 100
nullable: true
type: array
tags:
description: List of team names representing ownership of a dashboard.
items:
Expand Down Expand Up @@ -1681,6 +1688,36 @@ components:
description: URL of the dashboard.
type: string
type: object
DashboardTab:
description: Dashboard tab for organizing widgets.
properties:
id:
description: UUID of the tab.
example: ''
format: uuid
type: string
name:
description: Name of the tab.
example: L
maxLength: 100
minLength: 1
type: string
widget_ids:
description: List of widget IDs belonging to this tab. The backend also
accepts positional references in @N format (1-indexed) as a convenience
for Terraform and other declarative tools.
example:
- 0
items:
description: Widget ID.
format: int64
type: integer
type: array
required:
- id
- name
- widget_ids
type: object
DashboardTemplateVariable:
description: Template variable.
properties:
Expand Down
50 changes: 50 additions & 0 deletions src/main/java/com/datadog/api/client/v1/model/Dashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
Dashboard.JSON_PROPERTY_NOTIFY_LIST,
Dashboard.JSON_PROPERTY_REFLOW_TYPE,
Dashboard.JSON_PROPERTY_RESTRICTED_ROLES,
Dashboard.JSON_PROPERTY_TABS,
Dashboard.JSON_PROPERTY_TAGS,
Dashboard.JSON_PROPERTY_TEMPLATE_VARIABLE_PRESETS,
Dashboard.JSON_PROPERTY_TEMPLATE_VARIABLES,
Expand Down Expand Up @@ -81,6 +82,9 @@ public class Dashboard {
public static final String JSON_PROPERTY_RESTRICTED_ROLES = "restricted_roles";
private List<String> restrictedRoles = null;

public static final String JSON_PROPERTY_TABS = "tabs";
private JsonNullable<List<DashboardTab>> tabs = JsonNullable.<List<DashboardTab>>undefined();

public static final String JSON_PROPERTY_TAGS = "tags";
private JsonNullable<List<String>> tags = JsonNullable.<List<String>>undefined();

Expand Down Expand Up @@ -373,6 +377,49 @@ public void setRestrictedRoles(List<String> restrictedRoles) {
this.restrictedRoles = restrictedRoles;
}

public Dashboard tabs(List<DashboardTab> tabs) {
this.tabs = JsonNullable.<List<DashboardTab>>of(tabs);
return this;
}

public Dashboard addTabsItem(DashboardTab tabsItem) {
if (this.tabs == null || !this.tabs.isPresent()) {
this.tabs = JsonNullable.<List<DashboardTab>>of(new ArrayList<>());
}
try {
this.tabs.get().add(tabsItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}

/**
* List of tabs for organizing dashboard widgets into groups.
*
* @return tabs
*/
@jakarta.annotation.Nullable
@JsonIgnore
public List<DashboardTab> getTabs() {
return tabs.orElse(null);
}

@JsonProperty(JSON_PROPERTY_TABS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<List<DashboardTab>> getTabs_JsonNullable() {
return tabs;
}

@JsonProperty(JSON_PROPERTY_TABS)
public void setTabs_JsonNullable(JsonNullable<List<DashboardTab>> tabs) {
this.tabs = tabs;
}

public void setTabs(List<DashboardTab> tabs) {
this.tabs = JsonNullable.<List<DashboardTab>>of(tabs);
}

public Dashboard tags(List<String> tags) {
this.tags = JsonNullable.<List<String>>of(tags);
return this;
Expand Down Expand Up @@ -639,6 +686,7 @@ public boolean equals(Object o) {
&& Objects.equals(this.notifyList, dashboard.notifyList)
&& Objects.equals(this.reflowType, dashboard.reflowType)
&& Objects.equals(this.restrictedRoles, dashboard.restrictedRoles)
&& Objects.equals(this.tabs, dashboard.tabs)
&& Objects.equals(this.tags, dashboard.tags)
&& Objects.equals(this.templateVariablePresets, dashboard.templateVariablePresets)
&& Objects.equals(this.templateVariables, dashboard.templateVariables)
Expand All @@ -662,6 +710,7 @@ public int hashCode() {
notifyList,
reflowType,
restrictedRoles,
tabs,
tags,
templateVariablePresets,
templateVariables,
Expand All @@ -686,6 +735,7 @@ public String toString() {
sb.append(" notifyList: ").append(toIndentedString(notifyList)).append("\n");
sb.append(" reflowType: ").append(toIndentedString(reflowType)).append("\n");
sb.append(" restrictedRoles: ").append(toIndentedString(restrictedRoles)).append("\n");
sb.append(" tabs: ").append(toIndentedString(tabs)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" templateVariablePresets: ")
.append(toIndentedString(templateVariablePresets))
Expand Down
210 changes: 210 additions & 0 deletions src/main/java/com/datadog/api/client/v1/model/DashboardTab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/

package com.datadog.api.client.v1.model;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

/** Dashboard tab for organizing widgets. */
@JsonPropertyOrder({
DashboardTab.JSON_PROPERTY_ID,
DashboardTab.JSON_PROPERTY_NAME,
DashboardTab.JSON_PROPERTY_WIDGET_IDS
})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class DashboardTab {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_ID = "id";
private UUID id;

public static final String JSON_PROPERTY_NAME = "name";
private String name;

public static final String JSON_PROPERTY_WIDGET_IDS = "widget_ids";
private List<Long> widgetIds = new ArrayList<>();

public DashboardTab() {}

@JsonCreator
public DashboardTab(
@JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id,
@JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name,
@JsonProperty(required = true, value = JSON_PROPERTY_WIDGET_IDS) List<Long> widgetIds) {
this.id = id;
this.name = name;
this.widgetIds = widgetIds;
}

public DashboardTab id(UUID id) {
this.id = id;
return this;
}

/**
* UUID of the tab.
*
* @return id
*/
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public UUID getId() {
return id;
}

public void setId(UUID id) {
this.id = id;
}

public DashboardTab name(String name) {
this.name = name;
return this;
}

/**
* Name of the tab.
*
* @return name
*/
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public DashboardTab widgetIds(List<Long> widgetIds) {
this.widgetIds = widgetIds;
return this;
}

public DashboardTab addWidgetIdsItem(Long widgetIdsItem) {
this.widgetIds.add(widgetIdsItem);
return this;
}

/**
* List of widget IDs belonging to this tab. The backend also accepts positional references in @N
* format (1-indexed) as a convenience for Terraform and other declarative tools.
*
* @return widgetIds
*/
@JsonProperty(JSON_PROPERTY_WIDGET_IDS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List<Long> getWidgetIds() {
return widgetIds;
}

public void setWidgetIds(List<Long> widgetIds) {
this.widgetIds = widgetIds;
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;

/**
* Set the additional (undeclared) property with the specified name and value. If the property
* does not already exist, create it otherwise replace it.
*
* @param key The arbitrary key to set
* @param value The associated value
* @return DashboardTab
*/
@JsonAnySetter
public DashboardTab putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}

/**
* Return the additional (undeclared) property with the specified name.
*
* @param key The arbitrary key to get
* @return The specific additional property for the given key
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}

/** Return true if this DashboardTab object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DashboardTab dashboardTab = (DashboardTab) o;
return Objects.equals(this.id, dashboardTab.id)
&& Objects.equals(this.name, dashboardTab.name)
&& Objects.equals(this.widgetIds, dashboardTab.widgetIds)
&& Objects.equals(this.additionalProperties, dashboardTab.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(id, name, widgetIds, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DashboardTab {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" widgetIds: ").append(toIndentedString(widgetIds)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
sb.append('}');
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Feature: Dashboards
@generated @skip @team:DataDog/dashboards-backend
Scenario: Create a new dashboard returns "Bad Request" response
Given new "CreateDashboard" request
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
When the request is sent
Then the response status is 400 Bad Request

Expand Down Expand Up @@ -1342,15 +1342,15 @@ Feature: Dashboards
Scenario: Update a dashboard returns "Bad Request" response
Given new "UpdateDashboard" request
And request contains "dashboard_id" parameter from "REPLACE.ME"
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/dashboards-backend
Scenario: Update a dashboard returns "Item Not Found" response
Given new "UpdateDashboard" request
And request contains "dashboard_id" parameter from "REPLACE.ME"
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
When the request is sent
Then the response status is 404 Item Not Found

Expand Down
Loading