Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-03-24 16:41:55.959055",
"spec_repo_commit": "9bdb5ee6"
"regenerated": "2023-03-27 19:48:20.211619",
"spec_repo_commit": "b6741167"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-03-24 16:41:55.974878",
"spec_repo_commit": "9bdb5ee6"
"regenerated": "2023-03-27 19:48:20.224682",
"spec_repo_commit": "b6741167"
}
}
}
8 changes: 8 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,14 @@ components:
description: A role UUID.
type: string
type: array
tags:
description: List of team names representing ownership of a dashboard.
items:
description: The name of a Datadog team of the form `team:<name>`
type: string
maxItems: 5
nullable: true
type: array
template_variable_presets:
description: Array of template variables saved views.
items:
Expand Down
98 changes: 98 additions & 0 deletions examples/v1/dashboards/CreateDashboard_2064651578.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Create a new dashboard with team tags returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.ChangeWidgetDefinition;
import com.datadog.api.client.v1.model.ChangeWidgetDefinitionType;
import com.datadog.api.client.v1.model.ChangeWidgetRequest;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventAggregation;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventQueryDefinition;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventQueryDefinitionCompute;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventQueryDefinitionSearch;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventsDataSource;
import com.datadog.api.client.v1.model.FormulaAndFunctionQueryDefinition;
import com.datadog.api.client.v1.model.FormulaAndFunctionResponseFormat;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetChangeType;
import com.datadog.api.client.v1.model.WidgetCompareTo;
import com.datadog.api.client.v1.model.WidgetDefinition;
import com.datadog.api.client.v1.model.WidgetFormula;
import com.datadog.api.client.v1.model.WidgetLayout;
import com.datadog.api.client.v1.model.WidgetOrderBy;
import com.datadog.api.client.v1.model.WidgetSort;
import com.datadog.api.client.v1.model.WidgetTextAlign;
import com.datadog.api.client.v1.model.WidgetTime;
import java.util.Arrays;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
DashboardsApi apiInstance = new DashboardsApi(defaultClient);

Dashboard body =
new Dashboard()
.title("Example-Create_a_new_dashboard_with_team_tags_returns_OK_response")
.widgets(
Collections.singletonList(
new Widget()
.definition(
new WidgetDefinition(
new ChangeWidgetDefinition()
.title("")
.titleSize("16")
.titleAlign(WidgetTextAlign.LEFT)
.time(new WidgetTime())
.type(ChangeWidgetDefinitionType.CHANGE)
.requests(
Collections.singletonList(
new ChangeWidgetRequest()
.formulas(
Arrays.asList(
new WidgetFormula()
.formula("hour_before(query1)"),
new WidgetFormula().formula("query1")))
.queries(
Collections.singletonList(
new FormulaAndFunctionQueryDefinition(
new FormulaAndFunctionEventQueryDefinition()
.dataSource(
FormulaAndFunctionEventsDataSource
.LOGS)
.name("query1")
.search(
new FormulaAndFunctionEventQueryDefinitionSearch()
.query(""))
.indexes(
Collections.singletonList("*"))
.compute(
new FormulaAndFunctionEventQueryDefinitionCompute()
.aggregation(
FormulaAndFunctionEventAggregation
.COUNT)))))
.responseFormat(
FormulaAndFunctionResponseFormat.SCALAR)
.compareTo(WidgetCompareTo.HOUR_BEFORE)
.increaseGood(true)
.orderBy(WidgetOrderBy.CHANGE)
.changeType(WidgetChangeType.ABSOLUTE)
.orderDir(WidgetSort.DESCENDING)))))
.layout(new WidgetLayout().x(0L).y(0L).width(4L).height(4L))))
.tags(Collections.singletonList("team:foobar"))
.layoutType(DashboardLayoutType.ORDERED);

try {
Dashboard result = apiInstance.createDashboard(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#createDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
70 changes: 70 additions & 0 deletions examples/v1/dashboards/UpdateDashboard_3454865944.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Update a dashboard with tags returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.ListStreamColumn;
import com.datadog.api.client.v1.model.ListStreamColumnWidth;
import com.datadog.api.client.v1.model.ListStreamQuery;
import com.datadog.api.client.v1.model.ListStreamResponseFormat;
import com.datadog.api.client.v1.model.ListStreamSource;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinition;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinitionType;
import com.datadog.api.client.v1.model.ListStreamWidgetRequest;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import java.util.Arrays;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
DashboardsApi apiInstance = new DashboardsApi(defaultClient);

// there is a valid "dashboard" in the system
String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

Dashboard body =
new Dashboard()
.layoutType(DashboardLayoutType.ORDERED)
.title(
"Example-Update_a_dashboard_with_tags_returns_OK_response with list_stream widget")
.description("Updated description")
.tags(Arrays.asList("team:foo", "team:bar"))
.widgets(
Collections.singletonList(
new Widget()
.definition(
new WidgetDefinition(
new ListStreamWidgetDefinition()
.type(ListStreamWidgetDefinitionType.LIST_STREAM)
.requests(
Collections.singletonList(
new ListStreamWidgetRequest()
.columns(
Collections.singletonList(
new ListStreamColumn()
.width(ListStreamColumnWidth.AUTO)
.field("timestamp")))
.query(
new ListStreamQuery()
.dataSource(
ListStreamSource.APM_ISSUE_STREAM)
.queryString(""))
.responseFormat(
ListStreamResponseFormat.EVENT_LIST)))))));

try {
Dashboard result = apiInstance.updateDashboard(DASHBOARD_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#updateDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
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 @@ -35,6 +35,7 @@
Dashboard.JSON_PROPERTY_NOTIFY_LIST,
Dashboard.JSON_PROPERTY_REFLOW_TYPE,
Dashboard.JSON_PROPERTY_RESTRICTED_ROLES,
Dashboard.JSON_PROPERTY_TAGS,
Dashboard.JSON_PROPERTY_TEMPLATE_VARIABLE_PRESETS,
Dashboard.JSON_PROPERTY_TEMPLATE_VARIABLES,
Dashboard.JSON_PROPERTY_TITLE,
Expand Down Expand Up @@ -82,6 +83,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_TAGS = "tags";
private JsonNullable<List<String>> tags = JsonNullable.<List<String>>undefined();

public static final String JSON_PROPERTY_TEMPLATE_VARIABLE_PRESETS = "template_variable_presets";
private JsonNullable<List<DashboardTemplateVariablePreset>> templateVariablePresets =
JsonNullable.<List<DashboardTemplateVariablePreset>>undefined();
Expand Down Expand Up @@ -367,6 +371,49 @@ public void setRestrictedRoles(List<String> restrictedRoles) {
this.restrictedRoles = restrictedRoles;
}

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

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

/**
* List of team names representing ownership of a dashboard.
*
* @return tags
*/
@jakarta.annotation.Nullable
@JsonIgnore
public List<String> getTags() {
return tags.orElse(null);
}

@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<List<String>> getTags_JsonNullable() {
return tags;
}

@JsonProperty(JSON_PROPERTY_TAGS)
public void setTags_JsonNullable(JsonNullable<List<String>> tags) {
this.tags = tags;
}

public void setTags(List<String> tags) {
this.tags = JsonNullable.<List<String>>of(tags);
}

public Dashboard templateVariablePresets(
List<DashboardTemplateVariablePreset> templateVariablePresets) {
this.templateVariablePresets =
Expand Down Expand Up @@ -544,6 +591,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.tags, dashboard.tags)
&& Objects.equals(this.templateVariablePresets, dashboard.templateVariablePresets)
&& Objects.equals(this.templateVariables, dashboard.templateVariables)
&& Objects.equals(this.title, dashboard.title)
Expand All @@ -565,6 +613,7 @@ public int hashCode() {
notifyList,
reflowType,
restrictedRoles,
tags,
templateVariablePresets,
templateVariables,
title,
Expand All @@ -587,6 +636,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(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" templateVariablePresets: ")
.append(toIndentedString(templateVariablePresets))
.append("\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-03-08T22:44:59.472Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"layout_type\":\"ordered\",\"tags\":[\"tm:foobar\"],\"title\":\"Test-Create_a_new_dashboard_with_invalid_team_tags_returns_Bad_Request_response-1678315499\",\"widgets\":[{\"definition\":{\"requests\":[{\"change_type\":\"absolute\",\"compare_to\":\"hour_before\",\"formulas\":[{\"formula\":\"hour_before(query1)\"},{\"formula\":\"query1\"}],\"increase_good\":true,\"order_by\":\"change\",\"order_dir\":\"desc\",\"queries\":[{\"compute\":{\"aggregation\":\"count\"},\"data_source\":\"logs\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"\"}}],\"response_format\":\"scalar\"}],\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"change\"},\"layout\":{\"height\":4,\"width\":4,\"x\":0,\"y\":0}}]}"
},
"headers": {},
"method": "POST",
"path": "/api/v1/dashboard",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"errors\":[\"Invalid tag format. Tag key must be `team`.\"]}",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 400,
"reasonPhrase": "Bad Request"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "56fcc8f4-a1be-ee23-e0c7-69e483b38177"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-03-08T20:53:52.326Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"layout_type\":\"ordered\",\"tags\":[\"team:foobar\"],\"title\":\"Test-Create_a_new_dashboard_with_team_tags_returns_OK_response-1678308832\",\"widgets\":[{\"definition\":{\"requests\":[{\"change_type\":\"absolute\",\"compare_to\":\"hour_before\",\"formulas\":[{\"formula\":\"hour_before(query1)\"},{\"formula\":\"query1\"}],\"increase_good\":true,\"order_by\":\"change\",\"order_dir\":\"desc\",\"queries\":[{\"compute\":{\"aggregation\":\"count\"},\"data_source\":\"logs\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"\"}}],\"response_format\":\"scalar\"}],\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"change\"},\"layout\":{\"height\":4,\"width\":4,\"x\":0,\"y\":0}}]}"
},
"headers": {},
"method": "POST",
"path": "/api/v1/dashboard",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"id\":\"cvx-m2c-ntf\",\"title\":\"Test-Create_a_new_dashboard_with_team_tags_returns_OK_response-1678308832\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/cvx-m2c-ntf/test-createanewdashboardwithteamtagsreturnsokresponse-1678308832\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"change_type\":\"absolute\",\"compare_to\":\"hour_before\",\"formulas\":[{\"formula\":\"hour_before(query1)\"},{\"formula\":\"query1\"}],\"increase_good\":true,\"order_by\":\"change\",\"order_dir\":\"desc\",\"queries\":[{\"compute\":{\"aggregation\":\"count\"},\"data_source\":\"logs\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"\"}}],\"response_format\":\"scalar\"}],\"time\":{},\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"change\"},\"layout\":{\"height\":4,\"width\":4,\"x\":0,\"y\":0},\"id\":3494387223047491}],\"notify_list\":null,\"created_at\":\"2023-03-08T20:53:52.690739+00:00\",\"modified_at\":\"2023-03-08T20:53:52.690739+00:00\",\"tags\":[\"team:foobar\"],\"restricted_roles\":[]}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "0aa37866-6c06-aa7a-3960-6c8d0dd7cad7"
},
{
"httpRequest": {
"headers": {},
"method": "DELETE",
"path": "/api/v1/dashboard/cvx-m2c-ntf",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"deleted_dashboard_id\":\"cvx-m2c-ntf\"}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "366a001e-8e89-b50d-d636-4c67ea56664f"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-03-10T23:23:35.716Z
Loading