|
| 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.datadog.api.client.ModelEnum; |
| 10 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 11 | +import com.fasterxml.jackson.core.JsonGenerator; |
| 12 | +import com.fasterxml.jackson.core.JsonProcessingException; |
| 13 | +import com.fasterxml.jackson.databind.SerializerProvider; |
| 14 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| 15 | +import com.fasterxml.jackson.databind.ser.std.StdSerializer; |
| 16 | +import java.io.IOException; |
| 17 | +import java.util.Arrays; |
| 18 | +import java.util.HashSet; |
| 19 | +import java.util.Set; |
| 20 | + |
| 21 | +/** Aggregation methods for metric queries. */ |
| 22 | +@JsonSerialize( |
| 23 | + using = |
| 24 | + MonitorFormulaAndFunctionCostAggregator.MonitorFormulaAndFunctionCostAggregatorSerializer |
| 25 | + .class) |
| 26 | +public class MonitorFormulaAndFunctionCostAggregator extends ModelEnum<String> { |
| 27 | + |
| 28 | + private static final Set<String> allowedValues = |
| 29 | + new HashSet<String>( |
| 30 | + Arrays.asList( |
| 31 | + "avg", "sum", "max", "min", "last", "area", "l2norm", "percentile", "stddev")); |
| 32 | + |
| 33 | + public static final MonitorFormulaAndFunctionCostAggregator AVG = |
| 34 | + new MonitorFormulaAndFunctionCostAggregator("avg"); |
| 35 | + public static final MonitorFormulaAndFunctionCostAggregator SUM = |
| 36 | + new MonitorFormulaAndFunctionCostAggregator("sum"); |
| 37 | + public static final MonitorFormulaAndFunctionCostAggregator MAX = |
| 38 | + new MonitorFormulaAndFunctionCostAggregator("max"); |
| 39 | + public static final MonitorFormulaAndFunctionCostAggregator MIN = |
| 40 | + new MonitorFormulaAndFunctionCostAggregator("min"); |
| 41 | + public static final MonitorFormulaAndFunctionCostAggregator LAST = |
| 42 | + new MonitorFormulaAndFunctionCostAggregator("last"); |
| 43 | + public static final MonitorFormulaAndFunctionCostAggregator AREA = |
| 44 | + new MonitorFormulaAndFunctionCostAggregator("area"); |
| 45 | + public static final MonitorFormulaAndFunctionCostAggregator L2NORM = |
| 46 | + new MonitorFormulaAndFunctionCostAggregator("l2norm"); |
| 47 | + public static final MonitorFormulaAndFunctionCostAggregator PERCENTILE = |
| 48 | + new MonitorFormulaAndFunctionCostAggregator("percentile"); |
| 49 | + public static final MonitorFormulaAndFunctionCostAggregator STDDEV = |
| 50 | + new MonitorFormulaAndFunctionCostAggregator("stddev"); |
| 51 | + |
| 52 | + MonitorFormulaAndFunctionCostAggregator(String value) { |
| 53 | + super(value, allowedValues); |
| 54 | + } |
| 55 | + |
| 56 | + public static class MonitorFormulaAndFunctionCostAggregatorSerializer |
| 57 | + extends StdSerializer<MonitorFormulaAndFunctionCostAggregator> { |
| 58 | + public MonitorFormulaAndFunctionCostAggregatorSerializer( |
| 59 | + Class<MonitorFormulaAndFunctionCostAggregator> t) { |
| 60 | + super(t); |
| 61 | + } |
| 62 | + |
| 63 | + public MonitorFormulaAndFunctionCostAggregatorSerializer() { |
| 64 | + this(null); |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public void serialize( |
| 69 | + MonitorFormulaAndFunctionCostAggregator value, |
| 70 | + JsonGenerator jgen, |
| 71 | + SerializerProvider provider) |
| 72 | + throws IOException, JsonProcessingException { |
| 73 | + jgen.writeObject(value.value); |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + @JsonCreator |
| 78 | + public static MonitorFormulaAndFunctionCostAggregator fromValue(String value) { |
| 79 | + return new MonitorFormulaAndFunctionCostAggregator(value); |
| 80 | + } |
| 81 | +} |
0 commit comments