|
| 1 | +/* |
| 2 | + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 3 | + * This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 4 | + * Copyright 2019-Present Datadog, Inc. |
| 5 | + */ |
| 6 | + |
| 7 | +package com.datadog.api.client.v1.model; |
| 8 | + |
| 9 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| 10 | +import com.fasterxml.jackson.annotation.JsonAnySetter; |
| 11 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 12 | +import com.fasterxml.jackson.annotation.JsonIgnore; |
| 13 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 14 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 15 | +import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| 16 | +import java.util.ArrayList; |
| 17 | +import java.util.HashMap; |
| 18 | +import java.util.List; |
| 19 | +import java.util.Map; |
| 20 | +import java.util.Objects; |
| 21 | + |
| 22 | +/** |
| 23 | + * A count-based SLI specification, composed of three parts: the good events formula, the total |
| 24 | + * events formula, and the involved queries. |
| 25 | + */ |
| 26 | +@JsonPropertyOrder({ |
| 27 | + SLOCountCondition.JSON_PROPERTY_GOOD_EVENTS_FORMULA, |
| 28 | + SLOCountCondition.JSON_PROPERTY_QUERIES, |
| 29 | + SLOCountCondition.JSON_PROPERTY_TOTAL_EVENTS_FORMULA |
| 30 | +}) |
| 31 | +@jakarta.annotation.Generated( |
| 32 | + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") |
| 33 | +public class SLOCountCondition { |
| 34 | + @JsonIgnore public boolean unparsed = false; |
| 35 | + public static final String JSON_PROPERTY_GOOD_EVENTS_FORMULA = "good_events_formula"; |
| 36 | + private SLOFormula goodEventsFormula; |
| 37 | + |
| 38 | + public static final String JSON_PROPERTY_QUERIES = "queries"; |
| 39 | + private List<SLODataSourceQueryDefinition> queries = new ArrayList<>(); |
| 40 | + |
| 41 | + public static final String JSON_PROPERTY_TOTAL_EVENTS_FORMULA = "total_events_formula"; |
| 42 | + private SLOFormula totalEventsFormula; |
| 43 | + |
| 44 | + public SLOCountCondition() {} |
| 45 | + |
| 46 | + @JsonCreator |
| 47 | + public SLOCountCondition( |
| 48 | + @JsonProperty(required = true, value = JSON_PROPERTY_GOOD_EVENTS_FORMULA) |
| 49 | + SLOFormula goodEventsFormula, |
| 50 | + @JsonProperty(required = true, value = JSON_PROPERTY_QUERIES) |
| 51 | + List<SLODataSourceQueryDefinition> queries, |
| 52 | + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL_EVENTS_FORMULA) |
| 53 | + SLOFormula totalEventsFormula) { |
| 54 | + this.goodEventsFormula = goodEventsFormula; |
| 55 | + this.unparsed |= goodEventsFormula.unparsed; |
| 56 | + this.queries = queries; |
| 57 | + this.totalEventsFormula = totalEventsFormula; |
| 58 | + this.unparsed |= totalEventsFormula.unparsed; |
| 59 | + } |
| 60 | + |
| 61 | + public SLOCountCondition goodEventsFormula(SLOFormula goodEventsFormula) { |
| 62 | + this.goodEventsFormula = goodEventsFormula; |
| 63 | + this.unparsed |= goodEventsFormula.unparsed; |
| 64 | + return this; |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * A formula that specifies how to combine the results of multiple queries. |
| 69 | + * |
| 70 | + * @return goodEventsFormula |
| 71 | + */ |
| 72 | + @JsonProperty(JSON_PROPERTY_GOOD_EVENTS_FORMULA) |
| 73 | + @JsonInclude(value = JsonInclude.Include.ALWAYS) |
| 74 | + public SLOFormula getGoodEventsFormula() { |
| 75 | + return goodEventsFormula; |
| 76 | + } |
| 77 | + |
| 78 | + public void setGoodEventsFormula(SLOFormula goodEventsFormula) { |
| 79 | + this.goodEventsFormula = goodEventsFormula; |
| 80 | + } |
| 81 | + |
| 82 | + public SLOCountCondition queries(List<SLODataSourceQueryDefinition> queries) { |
| 83 | + this.queries = queries; |
| 84 | + for (SLODataSourceQueryDefinition item : queries) { |
| 85 | + this.unparsed |= item.unparsed; |
| 86 | + } |
| 87 | + return this; |
| 88 | + } |
| 89 | + |
| 90 | + public SLOCountCondition addQueriesItem(SLODataSourceQueryDefinition queriesItem) { |
| 91 | + this.queries.add(queriesItem); |
| 92 | + this.unparsed |= queriesItem.unparsed; |
| 93 | + return this; |
| 94 | + } |
| 95 | + |
| 96 | + /** |
| 97 | + * Getqueries |
| 98 | + * |
| 99 | + * @return queries |
| 100 | + */ |
| 101 | + @JsonProperty(JSON_PROPERTY_QUERIES) |
| 102 | + @JsonInclude(value = JsonInclude.Include.ALWAYS) |
| 103 | + public List<SLODataSourceQueryDefinition> getQueries() { |
| 104 | + return queries; |
| 105 | + } |
| 106 | + |
| 107 | + public void setQueries(List<SLODataSourceQueryDefinition> queries) { |
| 108 | + this.queries = queries; |
| 109 | + } |
| 110 | + |
| 111 | + public SLOCountCondition totalEventsFormula(SLOFormula totalEventsFormula) { |
| 112 | + this.totalEventsFormula = totalEventsFormula; |
| 113 | + this.unparsed |= totalEventsFormula.unparsed; |
| 114 | + return this; |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * A formula that specifies how to combine the results of multiple queries. |
| 119 | + * |
| 120 | + * @return totalEventsFormula |
| 121 | + */ |
| 122 | + @JsonProperty(JSON_PROPERTY_TOTAL_EVENTS_FORMULA) |
| 123 | + @JsonInclude(value = JsonInclude.Include.ALWAYS) |
| 124 | + public SLOFormula getTotalEventsFormula() { |
| 125 | + return totalEventsFormula; |
| 126 | + } |
| 127 | + |
| 128 | + public void setTotalEventsFormula(SLOFormula totalEventsFormula) { |
| 129 | + this.totalEventsFormula = totalEventsFormula; |
| 130 | + } |
| 131 | + |
| 132 | + /** |
| 133 | + * A container for additional, undeclared properties. This is a holder for any undeclared |
| 134 | + * properties as specified with the 'additionalProperties' keyword in the OAS document. |
| 135 | + */ |
| 136 | + private Map<String, Object> additionalProperties; |
| 137 | + |
| 138 | + /** |
| 139 | + * Set the additional (undeclared) property with the specified name and value. If the property |
| 140 | + * does not already exist, create it otherwise replace it. |
| 141 | + * |
| 142 | + * @param key The arbitrary key to set |
| 143 | + * @param value The associated value |
| 144 | + * @return SLOCountCondition |
| 145 | + */ |
| 146 | + @JsonAnySetter |
| 147 | + public SLOCountCondition putAdditionalProperty(String key, Object value) { |
| 148 | + if (this.additionalProperties == null) { |
| 149 | + this.additionalProperties = new HashMap<String, Object>(); |
| 150 | + } |
| 151 | + this.additionalProperties.put(key, value); |
| 152 | + return this; |
| 153 | + } |
| 154 | + |
| 155 | + /** |
| 156 | + * Return the additional (undeclared) property. |
| 157 | + * |
| 158 | + * @return The additional properties |
| 159 | + */ |
| 160 | + @JsonAnyGetter |
| 161 | + public Map<String, Object> getAdditionalProperties() { |
| 162 | + return additionalProperties; |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * Return the additional (undeclared) property with the specified name. |
| 167 | + * |
| 168 | + * @param key The arbitrary key to get |
| 169 | + * @return The specific additional property for the given key |
| 170 | + */ |
| 171 | + public Object getAdditionalProperty(String key) { |
| 172 | + if (this.additionalProperties == null) { |
| 173 | + return null; |
| 174 | + } |
| 175 | + return this.additionalProperties.get(key); |
| 176 | + } |
| 177 | + |
| 178 | + /** Return true if this SLOCountCondition object is equal to o. */ |
| 179 | + @Override |
| 180 | + public boolean equals(Object o) { |
| 181 | + if (this == o) { |
| 182 | + return true; |
| 183 | + } |
| 184 | + if (o == null || getClass() != o.getClass()) { |
| 185 | + return false; |
| 186 | + } |
| 187 | + SLOCountCondition sloCountCondition = (SLOCountCondition) o; |
| 188 | + return Objects.equals(this.goodEventsFormula, sloCountCondition.goodEventsFormula) |
| 189 | + && Objects.equals(this.queries, sloCountCondition.queries) |
| 190 | + && Objects.equals(this.totalEventsFormula, sloCountCondition.totalEventsFormula) |
| 191 | + && Objects.equals(this.additionalProperties, sloCountCondition.additionalProperties); |
| 192 | + } |
| 193 | + |
| 194 | + @Override |
| 195 | + public int hashCode() { |
| 196 | + return Objects.hash(goodEventsFormula, queries, totalEventsFormula, additionalProperties); |
| 197 | + } |
| 198 | + |
| 199 | + @Override |
| 200 | + public String toString() { |
| 201 | + StringBuilder sb = new StringBuilder(); |
| 202 | + sb.append("class SLOCountCondition {\n"); |
| 203 | + sb.append(" goodEventsFormula: ").append(toIndentedString(goodEventsFormula)).append("\n"); |
| 204 | + sb.append(" queries: ").append(toIndentedString(queries)).append("\n"); |
| 205 | + sb.append(" totalEventsFormula: ").append(toIndentedString(totalEventsFormula)).append("\n"); |
| 206 | + sb.append(" additionalProperties: ") |
| 207 | + .append(toIndentedString(additionalProperties)) |
| 208 | + .append("\n"); |
| 209 | + sb.append('}'); |
| 210 | + return sb.toString(); |
| 211 | + } |
| 212 | + |
| 213 | + /** |
| 214 | + * Convert the given object to string with each line indented by 4 spaces (except the first line). |
| 215 | + */ |
| 216 | + private String toIndentedString(Object o) { |
| 217 | + if (o == null) { |
| 218 | + return "null"; |
| 219 | + } |
| 220 | + return o.toString().replace("\n", "\n "); |
| 221 | + } |
| 222 | +} |
0 commit comments