com.datadog.api.client.v1.model.DashboardTemplateVariable Maven / Gradle / Ivy
/*
* 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 org.openapitools.jackson.nullable.JsonNullable;
/** Template variable. */
@JsonPropertyOrder({
DashboardTemplateVariable.JSON_PROPERTY_AVAILABLE_VALUES,
DashboardTemplateVariable.JSON_PROPERTY_DEFAULT,
DashboardTemplateVariable.JSON_PROPERTY_DEFAULTS,
DashboardTemplateVariable.JSON_PROPERTY_NAME,
DashboardTemplateVariable.JSON_PROPERTY_PREFIX
})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class DashboardTemplateVariable {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_AVAILABLE_VALUES = "available_values";
private JsonNullable> availableValues = JsonNullable.>undefined();
public static final String JSON_PROPERTY_DEFAULT = "default";
private JsonNullable _default = JsonNullable.undefined();
public static final String JSON_PROPERTY_DEFAULTS = "defaults";
private List defaults = null;
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public static final String JSON_PROPERTY_PREFIX = "prefix";
private JsonNullable prefix = JsonNullable.undefined();
public DashboardTemplateVariable() {}
@JsonCreator
public DashboardTemplateVariable(
@JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) {
this.name = name;
}
public DashboardTemplateVariable availableValues(List availableValues) {
this.availableValues = JsonNullable.>of(availableValues);
return this;
}
public DashboardTemplateVariable addAvailableValuesItem(String availableValuesItem) {
if (this.availableValues == null || !this.availableValues.isPresent()) {
this.availableValues = JsonNullable.>of(new ArrayList<>());
}
try {
this.availableValues.get().add(availableValuesItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* The list of values that the template variable drop-down is limited to.
*
* @return availableValues
*/
@jakarta.annotation.Nullable
@JsonIgnore
public List getAvailableValues() {
return availableValues.orElse(null);
}
@JsonProperty(JSON_PROPERTY_AVAILABLE_VALUES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable> getAvailableValues_JsonNullable() {
return availableValues;
}
@JsonProperty(JSON_PROPERTY_AVAILABLE_VALUES)
public void setAvailableValues_JsonNullable(JsonNullable> availableValues) {
this.availableValues = availableValues;
}
public void setAvailableValues(List availableValues) {
this.availableValues = JsonNullable.>of(availableValues);
}
public DashboardTemplateVariable _default(String _default) {
this._default = JsonNullable.of(_default);
return this;
}
/**
* (deprecated) The default value for the template variable on dashboard load. Cannot be used in
* conjunction with defaults
.
*
* @return _default
* @deprecated
*/
@Deprecated
@jakarta.annotation.Nullable
@JsonIgnore
public String getDefault() {
return _default.orElse(null);
}
@Deprecated
@JsonProperty(JSON_PROPERTY_DEFAULT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable getDefault_JsonNullable() {
return _default;
}
@JsonProperty(JSON_PROPERTY_DEFAULT)
public void setDefault_JsonNullable(JsonNullable _default) {
this._default = _default;
}
public void setDefault(String _default) {
this._default = JsonNullable.of(_default);
}
public DashboardTemplateVariable defaults(List defaults) {
this.defaults = defaults;
return this;
}
public DashboardTemplateVariable addDefaultsItem(String defaultsItem) {
if (this.defaults == null) {
this.defaults = new ArrayList<>();
}
this.defaults.add(defaultsItem);
return this;
}
/**
* One or many default values for template variables on load. If more than one default is
* specified, they will be unioned together with OR
. Cannot be used in conjunction
* with default
.
*
* @return defaults
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DEFAULTS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List getDefaults() {
return defaults;
}
public void setDefaults(List defaults) {
this.defaults = defaults;
}
public DashboardTemplateVariable name(String name) {
this.name = name;
return this;
}
/**
* The name of the variable.
*
* @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 DashboardTemplateVariable prefix(String prefix) {
this.prefix = JsonNullable.of(prefix);
return this;
}
/**
* The tag prefix associated with the variable. Only tags with this prefix appear in the variable
* drop-down.
*
* @return prefix
*/
@jakarta.annotation.Nullable
@JsonIgnore
public String getPrefix() {
return prefix.orElse(null);
}
@JsonProperty(JSON_PROPERTY_PREFIX)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable getPrefix_JsonNullable() {
return prefix;
}
@JsonProperty(JSON_PROPERTY_PREFIX)
public void setPrefix_JsonNullable(JsonNullable prefix) {
this.prefix = prefix;
}
public void setPrefix(String prefix) {
this.prefix = JsonNullable.of(prefix);
}
/**
* 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 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 DashboardTemplateVariable
*/
@JsonAnySetter
public DashboardTemplateVariable putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map 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 DashboardTemplateVariable object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DashboardTemplateVariable dashboardTemplateVariable = (DashboardTemplateVariable) o;
return Objects.equals(this.availableValues, dashboardTemplateVariable.availableValues)
&& Objects.equals(this._default, dashboardTemplateVariable._default)
&& Objects.equals(this.defaults, dashboardTemplateVariable.defaults)
&& Objects.equals(this.name, dashboardTemplateVariable.name)
&& Objects.equals(this.prefix, dashboardTemplateVariable.prefix)
&& Objects.equals(
this.additionalProperties, dashboardTemplateVariable.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(availableValues, _default, defaults, name, prefix, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DashboardTemplateVariable {\n");
sb.append(" availableValues: ").append(toIndentedString(availableValues)).append("\n");
sb.append(" _default: ").append(toIndentedString(_default)).append("\n");
sb.append(" defaults: ").append(toIndentedString(defaults)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" prefix: ").append(toIndentedString(prefix)).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 ");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy