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
116 changes: 112 additions & 4 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4612,10 +4612,14 @@ components:
- $ref: "#/components/schemas/HeatgridThemeColors"
HeatgridColorBin:
additionalProperties: false
description: A color and optional lower threshold for a discrete bin.
description: A color, optional lower threshold, and optional label for a discrete bin.
properties:
color:
$ref: "#/components/schemas/HeatgridColor"
label:
description: Name of the bin.
maxLength: 255
type: string
lower_bound:
description: Inclusive lower bound. Omit for the first bin.
format: double
Expand Down Expand Up @@ -4749,12 +4753,15 @@ components:
type: object
HeatgridLabelColumn:
additionalProperties: false
description: Configuration of the group label column.
description: Configuration of the group label column. Its width is sized automatically when omitted.
properties:
text_formats:
description: Ordered string replacement rules for the group labels.
items:
$ref: "#/components/schemas/HeatgridTextFormatRule"
type: array
width:
$ref: "#/components/schemas/HeatgridLabelColumnWidth"
required:
- width
type: object
HeatgridLabelColumnWidth:
description: Width of the label column.
Expand Down Expand Up @@ -4880,6 +4887,107 @@ components:
x-enum-varnames:
- ASC
- DESC
HeatgridTextFormatMatch:
additionalProperties: false
description: Match a group label against a string.
properties:
type:
$ref: "#/components/schemas/HeatgridTextFormatMatchType"
value:
description: String to compare with the group label.
example: ""
maxLength: 255
type: string
required:
- type
- value
type: object
HeatgridTextFormatMatchType:
description: Comparison used to match a group label.
enum:
- is
- is_not
- contains
- does_not_contain
- starts_with
- ends_with
example: is
type: string
x-enum-varnames:
- IS
- IS_NOT
- CONTAINS
- DOES_NOT_CONTAIN
- STARTS_WITH
- ENDS_WITH
HeatgridTextFormatReplace:
description: Replace all or part of a matching group label.
oneOf:
- $ref: "#/components/schemas/HeatgridTextFormatReplaceAll"
- $ref: "#/components/schemas/HeatgridTextFormatReplaceSubstring"
HeatgridTextFormatReplaceAll:
additionalProperties: false
description: Replace the entire matching group label.
properties:
type:
$ref: "#/components/schemas/HeatgridTextFormatReplaceAllType"
with:
description: Replacement string.
example: ""
maxLength: 255
type: string
required:
- type
- with
type: object
HeatgridTextFormatReplaceAllType:
description: Replace the entire matching group label.
enum:
- all
example: all
type: string
x-enum-varnames:
- ALL
HeatgridTextFormatReplaceSubstring:
additionalProperties: false
description: Replace a substring of the matching group label.
properties:
substring:
description: Substring to replace.
example: ""
maxLength: 255
type: string
type:
$ref: "#/components/schemas/HeatgridTextFormatReplaceSubstringType"
with:
description: Replacement string.
example: ""
maxLength: 255
type: string
required:
- type
- substring
- with
type: object
HeatgridTextFormatReplaceSubstringType:
description: Replace a substring of a matching group label.
enum:
- substring
example: substring
type: string
x-enum-varnames:
- SUBSTRING
HeatgridTextFormatRule:
additionalProperties: false
description: A rule for matching and optionally replacing a group label.
properties:
match:
$ref: "#/components/schemas/HeatgridTextFormatMatch"
replace:
$ref: "#/components/schemas/HeatgridTextFormatReplace"
required:
- match
type: object
HeatgridThemeColors:
description: Two color strings for the light and dark themes, in that order.
example: ["#FFFFFF", "#000000"]
Expand Down
145 changes: 145 additions & 0 deletions examples/v1/dashboards/CreateDashboard_209524718.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Create a heatgrid widget with bin labels and formatted row labels

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.FormulaAndFunctionMetricDataSource;
import com.datadog.api.client.v1.model.FormulaAndFunctionMetricQueryDefinition;
import com.datadog.api.client.v1.model.FormulaAndFunctionQueryDefinition;
import com.datadog.api.client.v1.model.HeatgridColor;
import com.datadog.api.client.v1.model.HeatgridColorBin;
import com.datadog.api.client.v1.model.HeatgridColorConfig;
import com.datadog.api.client.v1.model.HeatgridCustomColorSource;
import com.datadog.api.client.v1.model.HeatgridDiscreteCustomColor;
import com.datadog.api.client.v1.model.HeatgridDiscreteMode;
import com.datadog.api.client.v1.model.HeatgridLabelColumn;
import com.datadog.api.client.v1.model.HeatgridNestingDisplay;
import com.datadog.api.client.v1.model.HeatgridSort;
import com.datadog.api.client.v1.model.HeatgridSortBy;
import com.datadog.api.client.v1.model.HeatgridSortByLabel;
import com.datadog.api.client.v1.model.HeatgridSortByLabelProperty;
import com.datadog.api.client.v1.model.HeatgridSortOrder;
import com.datadog.api.client.v1.model.HeatgridTextFormatMatch;
import com.datadog.api.client.v1.model.HeatgridTextFormatMatchType;
import com.datadog.api.client.v1.model.HeatgridTextFormatReplace;
import com.datadog.api.client.v1.model.HeatgridTextFormatReplaceAll;
import com.datadog.api.client.v1.model.HeatgridTextFormatReplaceAllType;
import com.datadog.api.client.v1.model.HeatgridTextFormatReplaceSubstring;
import com.datadog.api.client.v1.model.HeatgridTextFormatReplaceSubstringType;
import com.datadog.api.client.v1.model.HeatgridTextFormatRule;
import com.datadog.api.client.v1.model.HeatgridWidgetDefinition;
import com.datadog.api.client.v1.model.HeatgridWidgetDefinitionType;
import com.datadog.api.client.v1.model.HeatgridWidgetFormula;
import com.datadog.api.client.v1.model.HeatgridWidgetRequest;
import com.datadog.api.client.v1.model.HeatgridWidgetResponseFormat;
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();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
DashboardsApi apiInstance = new DashboardsApi(defaultClient);

Dashboard body =
new Dashboard()
.title("Example-Dashboard")
.layoutType(DashboardLayoutType.ORDERED)
.widgets(
Collections.singletonList(
new Widget()
.definition(
new WidgetDefinition(
new HeatgridWidgetDefinition()
.type(HeatgridWidgetDefinitionType.HEATGRID)
.requests(
Collections.singletonList(
new HeatgridWidgetRequest()
.responseFormat(
HeatgridWidgetResponseFormat.TIMESERIES)
.queries(
Collections.singletonList(
new FormulaAndFunctionQueryDefinition(
new FormulaAndFunctionMetricQueryDefinition()
.dataSource(
FormulaAndFunctionMetricDataSource
.METRICS)
.name("query1")
.query(
"avg:system.cpu.user{*} by"
+ " {host}"))))
.formulas(
Collections.singletonList(
new HeatgridWidgetFormula()
.formula("query1")))))
.sort(
new HeatgridSort()
.nestingDisplay(HeatgridNestingDisplay.FLAT)
.sortBy(
new HeatgridSortBy(
new HeatgridSortByLabel()
.property(HeatgridSortByLabelProperty.LABEL)
.order(HeatgridSortOrder.ASC))))
.color(
new HeatgridColorConfig(
new HeatgridDiscreteCustomColor()
.mode(HeatgridDiscreteMode.DISCRETE)
.source(HeatgridCustomColorSource.CUSTOM)
.bins(
Arrays.asList(
new HeatgridColorBin()
.color(new HeatgridColor("#00FF00"))
.label("Normal"),
new HeatgridColorBin()
.color(new HeatgridColor("#FF0000"))
.lowerBound(80.0)
.label("High")))))
.labelColumn(
new HeatgridLabelColumn()
.textFormats(
Arrays.asList(
new HeatgridTextFormatRule()
.match(
new HeatgridTextFormatMatch()
.type(
HeatgridTextFormatMatchType
.STARTS_WITH)
.value("api-"))
.replace(
new HeatgridTextFormatReplace(
new HeatgridTextFormatReplaceSubstring()
.type(
HeatgridTextFormatReplaceSubstringType
.SUBSTRING)
.substring("api-")
.with(""))),
new HeatgridTextFormatRule()
.match(
new HeatgridTextFormatMatch()
.type(
HeatgridTextFormatMatchType.IS)
.value("unknown"))
.replace(
new HeatgridTextFormatReplace(
new HeatgridTextFormatReplaceAll()
.type(
HeatgridTextFormatReplaceAllType
.ALL)
.with("Other"))))))))));

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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.Objects;

/** A color and optional lower threshold for a discrete bin. */
/** A color, optional lower threshold, and optional label for a discrete bin. */
@JsonPropertyOrder({
HeatgridColorBin.JSON_PROPERTY_COLOR,
HeatgridColorBin.JSON_PROPERTY_LABEL,
HeatgridColorBin.JSON_PROPERTY_LOWER_BOUND
})
@jakarta.annotation.Generated(
Expand All @@ -25,6 +26,9 @@ public class HeatgridColorBin {
public static final String JSON_PROPERTY_COLOR = "color";
private HeatgridColor color;

public static final String JSON_PROPERTY_LABEL = "label";
private String label;

public static final String JSON_PROPERTY_LOWER_BOUND = "lower_bound";
private Double lowerBound;

Expand Down Expand Up @@ -61,6 +65,27 @@ public void setColor(HeatgridColor color) {
}
}

public HeatgridColorBin label(String label) {
this.label = label;
return this;
}

/**
* Name of the bin.
*
* @return label
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_LABEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getLabel() {
return label;
}

public void setLabel(String label) {
this.label = label;
}

public HeatgridColorBin lowerBound(Double lowerBound) {
this.lowerBound = lowerBound;
return this;
Expand Down Expand Up @@ -93,19 +118,21 @@ public boolean equals(Object o) {
}
HeatgridColorBin heatgridColorBin = (HeatgridColorBin) o;
return Objects.equals(this.color, heatgridColorBin.color)
&& Objects.equals(this.label, heatgridColorBin.label)
&& Objects.equals(this.lowerBound, heatgridColorBin.lowerBound);
}

@Override
public int hashCode() {
return Objects.hash(color, lowerBound);
return Objects.hash(color, label, lowerBound);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class HeatgridColorBin {\n");
sb.append(" color: ").append(toIndentedString(color)).append("\n");
sb.append(" label: ").append(toIndentedString(label)).append("\n");
sb.append(" lowerBound: ").append(toIndentedString(lowerBound)).append("\n");
sb.append('}');
return sb.toString();
Expand Down
Loading
Loading