|
| 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 | +/** Data source for cost queries. */ |
| 22 | +@JsonSerialize( |
| 23 | + using = |
| 24 | + MonitorFormulaAndFunctionCostDataSource.MonitorFormulaAndFunctionCostDataSourceSerializer |
| 25 | + .class) |
| 26 | +public class MonitorFormulaAndFunctionCostDataSource extends ModelEnum<String> { |
| 27 | + |
| 28 | + private static final Set<String> allowedValues = |
| 29 | + new HashSet<String>(Arrays.asList("metrics", "cloud_cost", "datadog_usage")); |
| 30 | + |
| 31 | + public static final MonitorFormulaAndFunctionCostDataSource METRICS = |
| 32 | + new MonitorFormulaAndFunctionCostDataSource("metrics"); |
| 33 | + public static final MonitorFormulaAndFunctionCostDataSource CLOUD_COST = |
| 34 | + new MonitorFormulaAndFunctionCostDataSource("cloud_cost"); |
| 35 | + public static final MonitorFormulaAndFunctionCostDataSource DATADOG_USAGE = |
| 36 | + new MonitorFormulaAndFunctionCostDataSource("datadog_usage"); |
| 37 | + |
| 38 | + MonitorFormulaAndFunctionCostDataSource(String value) { |
| 39 | + super(value, allowedValues); |
| 40 | + } |
| 41 | + |
| 42 | + public static class MonitorFormulaAndFunctionCostDataSourceSerializer |
| 43 | + extends StdSerializer<MonitorFormulaAndFunctionCostDataSource> { |
| 44 | + public MonitorFormulaAndFunctionCostDataSourceSerializer( |
| 45 | + Class<MonitorFormulaAndFunctionCostDataSource> t) { |
| 46 | + super(t); |
| 47 | + } |
| 48 | + |
| 49 | + public MonitorFormulaAndFunctionCostDataSourceSerializer() { |
| 50 | + this(null); |
| 51 | + } |
| 52 | + |
| 53 | + @Override |
| 54 | + public void serialize( |
| 55 | + MonitorFormulaAndFunctionCostDataSource value, |
| 56 | + JsonGenerator jgen, |
| 57 | + SerializerProvider provider) |
| 58 | + throws IOException, JsonProcessingException { |
| 59 | + jgen.writeObject(value.value); |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + @JsonCreator |
| 64 | + public static MonitorFormulaAndFunctionCostDataSource fromValue(String value) { |
| 65 | + return new MonitorFormulaAndFunctionCostDataSource(value); |
| 66 | + } |
| 67 | +} |
0 commit comments