diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 715f38f30c7..f6ca7710d22 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -3942,6 +3942,773 @@ components: type: string x-enum-varnames: - GROUP + GuidedTableColumn: + description: Definition of a single column in a guided table widget. A column + can be a computed value, a preset comparison, or a formula. + oneOf: + - $ref: '#/components/schemas/GuidedTableComputeColumn' + - $ref: '#/components/schemas/GuidedTablePresetColumn' + - $ref: '#/components/schemas/GuidedTableFormulaColumn' + GuidedTableColumnComparison: + description: Comparison to display in a guided table column. + oneOf: + - $ref: '#/components/schemas/GuidedTableColumnComparisonWithSelf' + - $ref: '#/components/schemas/GuidedTableColumnComparisonWithOtherColumn' + GuidedTableColumnComparisonWithOtherColumn: + description: Comparison of a column value against another column. + properties: + column: + description: Name of the column to compare against. + example: '' + type: string + type: + $ref: '#/components/schemas/GuidedTableColumnComparisonWithOtherColumnType' + required: + - type + - column + type: object + GuidedTableColumnComparisonWithOtherColumnType: + enum: + - diff_from + - percent_of + - percent_diff_from + example: diff_from + type: string + x-enum-varnames: + - DIFF_FROM + - PERCENT_OF + - PERCENT_DIFF_FROM + GuidedTableColumnComparisonWithSelf: + description: Comparison of a column value against the column's own total (percent + of column total). + properties: + type: + $ref: '#/components/schemas/GuidedTableColumnComparisonWithSelfType' + required: + - type + type: object + GuidedTableColumnComparisonWithSelfType: + enum: + - percent_column_total + example: percent_column_total + type: string + x-enum-varnames: + - PERCENT_COLUMN_TOTAL + GuidedTableColumnFormat: + description: Visual formatting applied to values in a guided table column. Supports + number/bar mode and trend mode. + oneOf: + - $ref: '#/components/schemas/GuidedTableNumberBarColumnFormat' + - $ref: '#/components/schemas/GuidedTableTrendColumnFormat' + GuidedTableColumnFunction: + description: A function to apply when computing a column's value. + properties: + args: + description: Arguments passed to the function in order. + items: + oneOf: + - type: string + - type: number + - type: boolean + type: array + name: + description: Function name (e.g. `clamp_min`, `abs`, `round`). Not restricted + to a fixed set. + example: '' + type: string + required: + - name + type: object + GuidedTableComputeColumn: + description: A guided table column that computes an aggregation directly from + one of the table's base queries. + properties: + alias: + description: Display name shown as the column header. + type: string + comparison: + $ref: '#/components/schemas/GuidedTableColumnComparison' + compute: + $ref: '#/components/schemas/GuidedTableComputeColumnCompute' + format: + $ref: '#/components/schemas/GuidedTableColumnFormat' + functions: + description: Functions to apply sequentially to the computed value. + items: + $ref: '#/components/schemas/GuidedTableColumnFunction' + type: array + is_hidden: + description: Whether this column is hidden in the rendered table. + type: boolean + name: + description: Auto-generated name used to refer to this column. + example: '' + type: string + type: + $ref: '#/components/schemas/GuidedTableComputeColumnType' + required: + - name + - type + - compute + - format + type: object + GuidedTableComputeColumnCompute: + description: Aggregation configuration. + properties: + aggregation: + description: Aggregation type (e.g. `avg`, `sum`, `count`). + example: '' + type: string + filter: + description: Additional filter criteria. + type: string + property: + description: Attribute to aggregate on. Depends on the data source (e.g. + a log attribute). + type: string + query: + description: Name of the source query. + example: '' + type: string + required: + - query + - aggregation + type: object + GuidedTableComputeColumnType: + enum: + - compute + example: compute + type: string + x-enum-varnames: + - COMPUTE + GuidedTableConditionalFormats: + description: Conditional formatting rules for a guided table column. Either + an array of threshold-based rules or a single range-based rule. + oneOf: + - $ref: '#/components/schemas/GuidedTableThresholdConditionalFormats' + - $ref: '#/components/schemas/GuidedTableRangeConditionalFormats' + GuidedTableEventsQuery: + description: An events-platform query fragment used as source data for a guided + table. Covers logs, RUM, spans, CI pipelines, events, and product analytics. + properties: + alias: + description: Display alias for the query. + type: string + data_source: + $ref: '#/components/schemas/GuidedTableEventsQueryDataSource' + indexes: + description: Indexes to search for events. + items: + type: string + type: array + name: + description: Variable name used to reference this query in columns and formulas. + example: '' + type: string + search: + $ref: '#/components/schemas/GuidedTableEventsQuerySearch' + storage: + $ref: '#/components/schemas/GuidedTableStorageType' + required: + - name + - data_source + type: object + GuidedTableEventsQueryDataSource: + description: Events data source. + enum: + - logs + - rum + - spans + - ci_pipelines + - events + - product_analytics + example: logs + type: string + x-enum-varnames: + - LOGS + - RUM + - SPANS + - CI_PIPELINES + - EVENTS + - PRODUCT_ANALYTICS + GuidedTableEventsQuerySearch: + description: Search filter for matching events. + properties: + query: + description: Events search query string using events-platform search grammar. + type: string + type: object + GuidedTableFormulaColumn: + description: A guided table column that displays the result of evaluating a + formula over other columns. + properties: + alias: + description: Display name shown as the column header. + type: string + comparison: + $ref: '#/components/schemas/GuidedTableColumnComparison' + format: + $ref: '#/components/schemas/GuidedTableColumnFormat' + formula: + description: The formula expression to evaluate. + example: '' + type: string + is_hidden: + description: Whether this column is hidden in the rendered table. + type: boolean + name: + description: Auto-generated name used to refer to this column. + example: '' + type: string + type: + $ref: '#/components/schemas/FormulaType' + required: + - name + - type + - formula + - format + type: object + GuidedTableGroupKey: + description: Maps a specific base query to the field name used for grouping. + properties: + group_key: + description: Field name in the query result used as the grouping key. + example: '' + type: string + query: + description: Name of the source query. + example: '' + type: string + required: + - query + - group_key + type: object + GuidedTableMetricsQuery: + description: A metrics (or cloud cost) query fragment used as source data for + a guided table. Group-by and time/space aggregation are defined separately. + properties: + alias: + description: Display alias for the query. + type: string + data_source: + $ref: '#/components/schemas/GuidedTableMetricsQueryDataSource' + filter: + description: Filter string to apply to the metric query. + type: string + metric_name: + description: Name of the metric to query. + example: '' + type: string + name: + description: Variable name used to reference this query in columns and formulas. + example: '' + type: string + required: + - name + - data_source + - metric_name + type: object + GuidedTableMetricsQueryDataSource: + description: Metrics data source. + enum: + - metrics + - cloud_cost + example: metrics + type: string + x-enum-varnames: + - METRICS + - CLOUD_COST + GuidedTableNumberBarColumnFormat: + description: Formats a guided table column as a number or a bar. + properties: + conditional_formats: + $ref: '#/components/schemas/GuidedTableConditionalFormats' + mode: + $ref: '#/components/schemas/GuidedTableNumberBarColumnFormatMode' + number_format: + $ref: '#/components/schemas/GuidedTableNumberFormat' + required: + - mode + type: object + GuidedTableNumberBarColumnFormatMode: + enum: + - number + - bar + example: number + type: string + x-enum-varnames: + - NUMBER + - BAR + GuidedTableNumberFormat: + description: Number display format for a guided table column value. + properties: + precision: + $ref: '#/components/schemas/GuidedTableNumberFormatPrecision' + unit: + $ref: '#/components/schemas/NumberFormatUnit' + unit_scale: + $ref: '#/components/schemas/NumberFormatUnitScale' + type: object + GuidedTableNumberFormatPrecision: + description: Number of digits after the decimal point. Use `*` for full precision, + `integer` to show full integer values, or omit for automatic precision. + oneOf: + - type: string + - format: int32 + maximum: 100 + minimum: 0 + type: integer + GuidedTablePresetColumn: + description: A guided table column that displays values for the previous time + period based on another column's full query. + properties: + alias: + description: Display name shown as the column header. + type: string + comparison: + $ref: '#/components/schemas/GuidedTableColumnComparison' + format: + $ref: '#/components/schemas/GuidedTableColumnFormat' + functions: + description: Functions to apply sequentially to the computed value. + items: + $ref: '#/components/schemas/GuidedTableColumnFunction' + type: array + is_hidden: + description: Whether this column is hidden in the rendered table. + type: boolean + name: + description: Auto-generated name used to refer to this column. + example: '' + type: string + preset: + $ref: '#/components/schemas/GuidedTablePresetColumnPreset' + type: + $ref: '#/components/schemas/GuidedTablePresetColumnType' + required: + - name + - type + - preset + - format + type: object + GuidedTablePresetColumnPreset: + description: Preset configuration. + properties: + column: + description: Name of the column whose full query is reused. + example: '' + type: string + type: + $ref: '#/components/schemas/GuidedTablePresetColumnPresetType' + required: + - type + - column + type: object + GuidedTablePresetColumnPresetType: + enum: + - previous_period + example: previous_period + type: string + x-enum-varnames: + - PREVIOUS_PERIOD + GuidedTablePresetColumnType: + enum: + - preset + example: preset + type: string + x-enum-varnames: + - PRESET + GuidedTableQuery: + description: A base query used as source data for a guided table widget. Either + a metrics query or an events-platform query. + oneOf: + - $ref: '#/components/schemas/GuidedTableMetricsQuery' + - $ref: '#/components/schemas/GuidedTableEventsQuery' + GuidedTableRangeConditionalFormats: + description: Single range-based conditional formatting rule. + items: + $ref: '#/components/schemas/GuidedTableRangeFormattingRule' + maxItems: 1 + type: array + GuidedTableRangeFormattingRule: + description: Formats values according to where they fall on a color scale. + properties: + max: + description: Maximum value on the mapping scale. + format: double + type: number + min: + description: Minimum value on the mapping scale. + format: double + type: number + palette: + $ref: '#/components/schemas/GuidedTableRangePalette' + reverse: + description: Whether to reverse the palette scale direction. + type: boolean + scale: + $ref: '#/components/schemas/GuidedTableRangeFormattingRuleScale' + type: + $ref: '#/components/schemas/GuidedTableRangeFormattingRuleType' + required: + - type + - palette + type: object + GuidedTableRangeFormattingRuleScale: + description: Scale function for mapping values to colors. + enum: + - linear + - log + - pow + - sqrt + type: string + x-enum-varnames: + - LINEAR + - LOG + - POW + - SQRT + GuidedTableRangeFormattingRuleType: + enum: + - range + example: range + type: string + x-enum-varnames: + - RANGE + GuidedTableRangePalette: + description: Color palette used by range-based conditional formatting rules. + enum: + - transparent_to_green + - transparent_to_orange + - transparent_to_red + - transparent_to_blue + - red_transparent_green + - red_transparent_blue + - vivid_transparent_to_green + - vivid_transparent_to_orange + - vivid_transparent_to_red + - vivid_transparent_to_blue + - vivid_red_transparent_green + - vivid_red_transparent_blue + example: transparent_to_green + type: string + x-enum-varnames: + - TRANSPARENT_TO_GREEN + - TRANSPARENT_TO_ORANGE + - TRANSPARENT_TO_RED + - TRANSPARENT_TO_BLUE + - RED_TRANSPARENT_GREEN + - RED_TRANSPARENT_BLUE + - VIVID_TRANSPARENT_TO_GREEN + - VIVID_TRANSPARENT_TO_ORANGE + - VIVID_TRANSPARENT_TO_RED + - VIVID_TRANSPARENT_TO_BLUE + - VIVID_RED_TRANSPARENT_GREEN + - VIVID_RED_TRANSPARENT_BLUE + GuidedTableRequest: + description: "Request definition for the guided table widget \u2014 a structured, + guided format for defining a table of data. Used when the `graphing_new_table_widget_editor` + feature flag is enabled; otherwise use the classic `TableWidgetRequest`. Defines + base queries, how to produce rows, and how to compute columns." + example: + columns: + - compute: + aggregation: avg + query: query1 + format: + mode: number + name: column1 + type: compute + queries: + - data_source: metrics + metric_name: system.cpu.user + name: query1 + request_type: table + rows: + group_by: + - group_keys: + - group_key: service + query: query1 + name: groupBy1 + sort: + columns: + - column: column1 + order: desc + limit: 10 + properties: + columns: + description: Column definitions that describe how to compute and display + table values. + example: + - compute: + aggregation: avg + query: query1 + format: + mode: number + name: column1 + type: compute + items: + $ref: '#/components/schemas/GuidedTableColumn' + type: array + queries: + description: Base queries that provide the source data for the table. + example: + - data_source: metrics + metric_name: system.cpu.user + name: query1 + items: + $ref: '#/components/schemas/GuidedTableQuery' + minItems: 1 + type: array + request_type: + $ref: '#/components/schemas/GuidedTableRequestRequestType' + rows: + $ref: '#/components/schemas/GuidedTableRows' + required: + - request_type + - queries + - rows + - columns + type: object + GuidedTableRequestRequestType: + description: Identifies this as a guided table request. + enum: + - table + example: table + type: string + x-enum-varnames: + - TABLE + GuidedTableRowGroupBy: + description: Defines one group-by dimension used to produce the rows of a guided + table. + properties: + alias: + description: Display name used as the column header for this group-by. + type: string + format: + $ref: '#/components/schemas/GuidedTableRowGroupByFormat' + group_keys: + description: Mapping from each source query to the field name used as the + grouping key. Different data sources may use different field names for + the same concept. + items: + $ref: '#/components/schemas/GuidedTableGroupKey' + type: array + is_hidden: + description: Whether this group-by column is hidden in the rendered table. + type: boolean + name: + description: Auto-generated name for this group-by parameter. + example: '' + type: string + required: + - name + - group_keys + type: object + GuidedTableRowGroupByFormat: + description: Text formatting configuration for this group-by column. + properties: + text_formats: + items: + $ref: '#/components/schemas/GuidedTableTextFormattingRule' + type: array + type: object + GuidedTableRows: + description: Defines how to compute the rows of a guided table. + properties: + group_by: + description: Grouping dimensions that form each row. Must be non-empty. + items: + $ref: '#/components/schemas/GuidedTableRowGroupBy' + minItems: 1 + type: array + sort: + $ref: '#/components/schemas/GuidedTableSort' + required: + - group_by + - sort + type: object + GuidedTableSort: + description: Sort configuration for a guided table. + properties: + columns: + description: Columns to sort by, in order of application. + items: + $ref: '#/components/schemas/WidgetFieldSort' + type: array + limit: + description: Maximum number of rows to show after sorting. + example: 1 + format: int64 + minimum: 1 + type: integer + required: + - limit + - columns + type: object + GuidedTableStorageType: + description: Storage tier to target for an events-platform query in a guided + table. + enum: + - live + - hot + - online_archives + - driveline + - flex_tier + - case_insensitive + - cloud_prem + type: string + x-enum-varnames: + - LIVE + - HOT + - ONLINE_ARCHIVES + - DRIVELINE + - FLEX_TIER + - CASE_INSENSITIVE + - CLOUD_PREM + GuidedTableTextFormattingRule: + description: Rule for applying visual formatting to text values in a guided + table group-by column. + properties: + custom_bg_color: + description: Custom background color hex code. Used with `custom_bg` palette. + example: '#632ca6' + type: string + custom_fg_color: + description: Custom text color hex code. Used with `custom_text` palette. + example: '#632ca6' + type: string + match: + $ref: '#/components/schemas/TableWidgetTextFormatMatch' + palette: + $ref: '#/components/schemas/GuidedTableThresholdPalette' + replace: + $ref: '#/components/schemas/GuidedTableTextFormattingRuleReplace' + required: + - match + type: object + GuidedTableTextFormattingRuleReplace: + description: Optional replacement to apply to matched text. + oneOf: + - $ref: '#/components/schemas/TableWidgetTextFormatReplaceAll' + - $ref: '#/components/schemas/GuidedTableTextFormattingRuleReplaceSubstring' + GuidedTableTextFormattingRuleReplaceSubstring: + description: Replace a specific substring. + properties: + substring: + example: '' + type: string + type: + $ref: '#/components/schemas/TableWidgetTextFormatReplaceSubstringType' + with: + example: '' + type: string + required: + - type + - substring + - with + type: object + GuidedTableThresholdConditionalFormats: + description: Array of threshold-based conditional formatting rules. + items: + $ref: '#/components/schemas/GuidedTableThresholdFormattingRule' + type: array + GuidedTableThresholdFormattingRule: + description: Conditional formatting rule that applies when a value satisfies + a threshold comparator condition. + properties: + comparator: + $ref: '#/components/schemas/WidgetComparator' + custom_bg_color: + description: Custom background color. Used with `custom_bg` palette. + type: string + custom_fg_color: + description: Custom text color. Used with `custom_text` palette. + type: string + hide_value: + description: Whether to hide the data value when this rule matches. + type: boolean + image_url: + description: URL of an image to display as background. + type: string + palette: + $ref: '#/components/schemas/GuidedTableThresholdPalette' + value: + $ref: '#/components/schemas/GuidedTableThresholdFormattingRuleValue' + required: + - comparator + - palette + type: object + GuidedTableThresholdFormattingRuleValue: + description: Threshold value to compare against. + oneOf: + - format: double + type: number + - type: string + GuidedTableThresholdPalette: + description: Color palette used by threshold-based conditional formatting and + text formatting rules in a guided table. + enum: + - white_on_red + - black_on_light_red + - white_on_green + - black_on_light_green + - white_on_yellow + - black_on_light_yellow + - white_on_gray + - green_on_white + - yellow_on_white + - red_on_white + - gray_on_white + - red + - green + - orange + - gray + - custom_bg + - custom_text + - custom_image + example: white_on_red + type: string + x-enum-varnames: + - WHITE_ON_RED + - BLACK_ON_LIGHT_RED + - WHITE_ON_GREEN + - BLACK_ON_LIGHT_GREEN + - WHITE_ON_YELLOW + - BLACK_ON_LIGHT_YELLOW + - WHITE_ON_GRAY + - GREEN_ON_WHITE + - YELLOW_ON_WHITE + - RED_ON_WHITE + - GRAY_ON_WHITE + - RED + - GREEN + - ORANGE + - GRAY + - CUSTOM_BG + - CUSTOM_TEXT + - CUSTOM_IMAGE + GuidedTableTrendColumnFormat: + description: Formats a guided table column as a trend sparkline. + properties: + conditional_formats: + $ref: '#/components/schemas/GuidedTableConditionalFormats' + mode: + $ref: '#/components/schemas/GuidedTableTrendColumnFormatMode' + number_format: + $ref: '#/components/schemas/GuidedTableNumberFormat' + trend_options: + $ref: '#/components/schemas/WidgetFormulaCellDisplayModeOptions' + required: + - mode + - trend_options + type: object + GuidedTableTrendColumnFormatMode: + enum: + - trend + example: trend + type: string + x-enum-varnames: + - TREND HTTPLog: description: Structured log message. items: @@ -19482,11 +20249,15 @@ components: has_search_bar: $ref: '#/components/schemas/TableWidgetHasSearchBar' requests: - description: Widget definition. + description: Widget definition. Each item is either a classic `TableWidgetRequest` + or an experimental `GuidedTableRequest` (used when the `graphing_new_table_widget_editor` + feature flag is enabled). example: - q/apm_query/log_query: {} items: - $ref: '#/components/schemas/TableWidgetRequest' + oneOf: + - $ref: '#/components/schemas/TableWidgetRequest' + - $ref: '#/components/schemas/GuidedTableRequest' type: array time: $ref: '#/components/schemas/WidgetTime' diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7c5de28af80..7ae721a4124 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -102212,6 +102212,13 @@ paths: get: description: Get the list of all critical assets. operationId: ListSecurityMonitoringCriticalAssets + parameters: + - description: Query string. + in: query + name: query + required: false + schema: + type: string responses: '200': content: diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumn.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumn.java new file mode 100644 index 00000000000..b787deb80e5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumn.java @@ -0,0 +1,346 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GuidedTableColumn.GuidedTableColumnDeserializer.class) +@JsonSerialize(using = GuidedTableColumn.GuidedTableColumnSerializer.class) +public class GuidedTableColumn extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GuidedTableColumn.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableColumnSerializer extends StdSerializer { + public GuidedTableColumnSerializer(Class t) { + super(t); + } + + public GuidedTableColumnSerializer() { + this(null); + } + + @Override + public void serialize(GuidedTableColumn value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableColumnDeserializer extends StdDeserializer { + public GuidedTableColumnDeserializer() { + this(GuidedTableColumn.class); + } + + public GuidedTableColumnDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableColumn deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GuidedTableComputeColumn + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableComputeColumn.class.equals(Integer.class) + || GuidedTableComputeColumn.class.equals(Long.class) + || GuidedTableComputeColumn.class.equals(Float.class) + || GuidedTableComputeColumn.class.equals(Double.class) + || GuidedTableComputeColumn.class.equals(Boolean.class) + || GuidedTableComputeColumn.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableComputeColumn.class.equals(Integer.class) + || GuidedTableComputeColumn.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableComputeColumn.class.equals(Float.class) + || GuidedTableComputeColumn.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableComputeColumn.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableComputeColumn.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTableComputeColumn.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableComputeColumn) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTableComputeColumn'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GuidedTableComputeColumn'", e); + } + + // deserialize GuidedTablePresetColumn + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTablePresetColumn.class.equals(Integer.class) + || GuidedTablePresetColumn.class.equals(Long.class) + || GuidedTablePresetColumn.class.equals(Float.class) + || GuidedTablePresetColumn.class.equals(Double.class) + || GuidedTablePresetColumn.class.equals(Boolean.class) + || GuidedTablePresetColumn.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTablePresetColumn.class.equals(Integer.class) + || GuidedTablePresetColumn.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTablePresetColumn.class.equals(Float.class) + || GuidedTablePresetColumn.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTablePresetColumn.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTablePresetColumn.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTablePresetColumn.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTablePresetColumn) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTablePresetColumn'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GuidedTablePresetColumn'", e); + } + + // deserialize GuidedTableFormulaColumn + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableFormulaColumn.class.equals(Integer.class) + || GuidedTableFormulaColumn.class.equals(Long.class) + || GuidedTableFormulaColumn.class.equals(Float.class) + || GuidedTableFormulaColumn.class.equals(Double.class) + || GuidedTableFormulaColumn.class.equals(Boolean.class) + || GuidedTableFormulaColumn.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableFormulaColumn.class.equals(Integer.class) + || GuidedTableFormulaColumn.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableFormulaColumn.class.equals(Float.class) + || GuidedTableFormulaColumn.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableFormulaColumn.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableFormulaColumn.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTableFormulaColumn.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableFormulaColumn) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTableFormulaColumn'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GuidedTableFormulaColumn'", e); + } + + GuidedTableColumn ret = new GuidedTableColumn(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableColumn getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GuidedTableColumn cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableColumn() { + super("oneOf", Boolean.FALSE); + } + + public GuidedTableColumn(GuidedTableComputeColumn o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableColumn(GuidedTablePresetColumn o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableColumn(GuidedTableFormulaColumn o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GuidedTableComputeColumn", new GenericType() {}); + schemas.put("GuidedTablePresetColumn", new GenericType() {}); + schemas.put("GuidedTableFormulaColumn", new GenericType() {}); + JSON.registerDescendants(GuidedTableColumn.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableColumn.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GuidedTableComputeColumn, GuidedTablePresetColumn, + * GuidedTableFormulaColumn + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GuidedTableComputeColumn.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GuidedTablePresetColumn.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GuidedTableFormulaColumn.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be GuidedTableComputeColumn, GuidedTablePresetColumn," + + " GuidedTableFormulaColumn"); + } + + /** + * Get the actual instance, which can be the following: GuidedTableComputeColumn, + * GuidedTablePresetColumn, GuidedTableFormulaColumn + * + * @return The actual instance (GuidedTableComputeColumn, GuidedTablePresetColumn, + * GuidedTableFormulaColumn) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableComputeColumn`. If the actual instance is not + * `GuidedTableComputeColumn`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableComputeColumn` + * @throws ClassCastException if the instance is not `GuidedTableComputeColumn` + */ + public GuidedTableComputeColumn getGuidedTableComputeColumn() throws ClassCastException { + return (GuidedTableComputeColumn) super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTablePresetColumn`. If the actual instance is not + * `GuidedTablePresetColumn`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTablePresetColumn` + * @throws ClassCastException if the instance is not `GuidedTablePresetColumn` + */ + public GuidedTablePresetColumn getGuidedTablePresetColumn() throws ClassCastException { + return (GuidedTablePresetColumn) super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableFormulaColumn`. If the actual instance is not + * `GuidedTableFormulaColumn`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableFormulaColumn` + * @throws ClassCastException if the instance is not `GuidedTableFormulaColumn` + */ + public GuidedTableFormulaColumn getGuidedTableFormulaColumn() throws ClassCastException { + return (GuidedTableFormulaColumn) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparison.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparison.java new file mode 100644 index 00000000000..5bf87bbb610 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparison.java @@ -0,0 +1,304 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GuidedTableColumnComparison.GuidedTableColumnComparisonDeserializer.class) +@JsonSerialize(using = GuidedTableColumnComparison.GuidedTableColumnComparisonSerializer.class) +public class GuidedTableColumnComparison extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GuidedTableColumnComparison.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableColumnComparisonSerializer + extends StdSerializer { + public GuidedTableColumnComparisonSerializer(Class t) { + super(t); + } + + public GuidedTableColumnComparisonSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableColumnComparison value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableColumnComparisonDeserializer + extends StdDeserializer { + public GuidedTableColumnComparisonDeserializer() { + this(GuidedTableColumnComparison.class); + } + + public GuidedTableColumnComparisonDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableColumnComparison deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GuidedTableColumnComparisonWithSelf + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableColumnComparisonWithSelf.class.equals(Integer.class) + || GuidedTableColumnComparisonWithSelf.class.equals(Long.class) + || GuidedTableColumnComparisonWithSelf.class.equals(Float.class) + || GuidedTableColumnComparisonWithSelf.class.equals(Double.class) + || GuidedTableColumnComparisonWithSelf.class.equals(Boolean.class) + || GuidedTableColumnComparisonWithSelf.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableColumnComparisonWithSelf.class.equals(Integer.class) + || GuidedTableColumnComparisonWithSelf.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableColumnComparisonWithSelf.class.equals(Float.class) + || GuidedTableColumnComparisonWithSelf.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableColumnComparisonWithSelf.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableColumnComparisonWithSelf.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTableColumnComparisonWithSelf.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableColumnComparisonWithSelf) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTableColumnComparisonWithSelf'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'GuidedTableColumnComparisonWithSelf'", + e); + } + + // deserialize GuidedTableColumnComparisonWithOtherColumn + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableColumnComparisonWithOtherColumn.class.equals(Integer.class) + || GuidedTableColumnComparisonWithOtherColumn.class.equals(Long.class) + || GuidedTableColumnComparisonWithOtherColumn.class.equals(Float.class) + || GuidedTableColumnComparisonWithOtherColumn.class.equals(Double.class) + || GuidedTableColumnComparisonWithOtherColumn.class.equals(Boolean.class) + || GuidedTableColumnComparisonWithOtherColumn.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableColumnComparisonWithOtherColumn.class.equals(Integer.class) + || GuidedTableColumnComparisonWithOtherColumn.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableColumnComparisonWithOtherColumn.class.equals(Float.class) + || GuidedTableColumnComparisonWithOtherColumn.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableColumnComparisonWithOtherColumn.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableColumnComparisonWithOtherColumn.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(GuidedTableColumnComparisonWithOtherColumn.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableColumnComparisonWithOtherColumn) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'GuidedTableColumnComparisonWithOtherColumn'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'GuidedTableColumnComparisonWithOtherColumn'", + e); + } + + GuidedTableColumnComparison ret = new GuidedTableColumnComparison(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableColumnComparison getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GuidedTableColumnComparison cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableColumnComparison() { + super("oneOf", Boolean.FALSE); + } + + public GuidedTableColumnComparison(GuidedTableColumnComparisonWithSelf o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableColumnComparison(GuidedTableColumnComparisonWithOtherColumn o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "GuidedTableColumnComparisonWithSelf", + new GenericType() {}); + schemas.put( + "GuidedTableColumnComparisonWithOtherColumn", + new GenericType() {}); + JSON.registerDescendants( + GuidedTableColumnComparison.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableColumnComparison.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GuidedTableColumnComparisonWithSelf, + * GuidedTableColumnComparisonWithOtherColumn + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + GuidedTableColumnComparisonWithSelf.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + GuidedTableColumnComparisonWithOtherColumn.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be GuidedTableColumnComparisonWithSelf," + + " GuidedTableColumnComparisonWithOtherColumn"); + } + + /** + * Get the actual instance, which can be the following: GuidedTableColumnComparisonWithSelf, + * GuidedTableColumnComparisonWithOtherColumn + * + * @return The actual instance (GuidedTableColumnComparisonWithSelf, + * GuidedTableColumnComparisonWithOtherColumn) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableColumnComparisonWithSelf`. If the actual instance is not + * `GuidedTableColumnComparisonWithSelf`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableColumnComparisonWithSelf` + * @throws ClassCastException if the instance is not `GuidedTableColumnComparisonWithSelf` + */ + public GuidedTableColumnComparisonWithSelf getGuidedTableColumnComparisonWithSelf() + throws ClassCastException { + return (GuidedTableColumnComparisonWithSelf) super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableColumnComparisonWithOtherColumn`. If the actual instance + * is not `GuidedTableColumnComparisonWithOtherColumn`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableColumnComparisonWithOtherColumn` + * @throws ClassCastException if the instance is not `GuidedTableColumnComparisonWithOtherColumn` + */ + public GuidedTableColumnComparisonWithOtherColumn getGuidedTableColumnComparisonWithOtherColumn() + throws ClassCastException { + return (GuidedTableColumnComparisonWithOtherColumn) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithOtherColumn.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithOtherColumn.java new file mode 100644 index 00000000000..4f78a584fab --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithOtherColumn.java @@ -0,0 +1,184 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Comparison of a column value against another column. */ +@JsonPropertyOrder({ + GuidedTableColumnComparisonWithOtherColumn.JSON_PROPERTY_COLUMN, + GuidedTableColumnComparisonWithOtherColumn.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableColumnComparisonWithOtherColumn { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COLUMN = "column"; + private String column; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GuidedTableColumnComparisonWithOtherColumnType type; + + public GuidedTableColumnComparisonWithOtherColumn() {} + + @JsonCreator + public GuidedTableColumnComparisonWithOtherColumn( + @JsonProperty(required = true, value = JSON_PROPERTY_COLUMN) String column, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GuidedTableColumnComparisonWithOtherColumnType type) { + this.column = column; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GuidedTableColumnComparisonWithOtherColumn column(String column) { + this.column = column; + return this; + } + + /** + * Name of the column to compare against. + * + * @return column + */ + @JsonProperty(JSON_PROPERTY_COLUMN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getColumn() { + return column; + } + + public void setColumn(String column) { + this.column = column; + } + + public GuidedTableColumnComparisonWithOtherColumn type( + GuidedTableColumnComparisonWithOtherColumnType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Gettype + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableColumnComparisonWithOtherColumnType getType() { + return type; + } + + public void setType(GuidedTableColumnComparisonWithOtherColumnType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 GuidedTableColumnComparisonWithOtherColumn + */ + @JsonAnySetter + public GuidedTableColumnComparisonWithOtherColumn 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 GuidedTableColumnComparisonWithOtherColumn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableColumnComparisonWithOtherColumn guidedTableColumnComparisonWithOtherColumn = + (GuidedTableColumnComparisonWithOtherColumn) o; + return Objects.equals(this.column, guidedTableColumnComparisonWithOtherColumn.column) + && Objects.equals(this.type, guidedTableColumnComparisonWithOtherColumn.type) + && Objects.equals( + this.additionalProperties, + guidedTableColumnComparisonWithOtherColumn.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(column, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableColumnComparisonWithOtherColumn {\n"); + sb.append(" column: ").append(toIndentedString(column)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithOtherColumnType.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithOtherColumnType.java new file mode 100644 index 00000000000..868d070c7d4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithOtherColumnType.java @@ -0,0 +1,67 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize( + using = + GuidedTableColumnComparisonWithOtherColumnType + .GuidedTableColumnComparisonWithOtherColumnTypeSerializer.class) +public class GuidedTableColumnComparisonWithOtherColumnType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("diff_from", "percent_of", "percent_diff_from")); + + public static final GuidedTableColumnComparisonWithOtherColumnType DIFF_FROM = + new GuidedTableColumnComparisonWithOtherColumnType("diff_from"); + public static final GuidedTableColumnComparisonWithOtherColumnType PERCENT_OF = + new GuidedTableColumnComparisonWithOtherColumnType("percent_of"); + public static final GuidedTableColumnComparisonWithOtherColumnType PERCENT_DIFF_FROM = + new GuidedTableColumnComparisonWithOtherColumnType("percent_diff_from"); + + GuidedTableColumnComparisonWithOtherColumnType(String value) { + super(value, allowedValues); + } + + public static class GuidedTableColumnComparisonWithOtherColumnTypeSerializer + extends StdSerializer { + public GuidedTableColumnComparisonWithOtherColumnTypeSerializer( + Class t) { + super(t); + } + + public GuidedTableColumnComparisonWithOtherColumnTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableColumnComparisonWithOtherColumnType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableColumnComparisonWithOtherColumnType fromValue(String value) { + return new GuidedTableColumnComparisonWithOtherColumnType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithSelf.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithSelf.java new file mode 100644 index 00000000000..4c343972426 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithSelf.java @@ -0,0 +1,151 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Comparison of a column value against the column's own total (percent of column total). */ +@JsonPropertyOrder({GuidedTableColumnComparisonWithSelf.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableColumnComparisonWithSelf { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TYPE = "type"; + private GuidedTableColumnComparisonWithSelfType type; + + public GuidedTableColumnComparisonWithSelf() {} + + @JsonCreator + public GuidedTableColumnComparisonWithSelf( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GuidedTableColumnComparisonWithSelfType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GuidedTableColumnComparisonWithSelf type(GuidedTableColumnComparisonWithSelfType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Gettype + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableColumnComparisonWithSelfType getType() { + return type; + } + + public void setType(GuidedTableColumnComparisonWithSelfType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 GuidedTableColumnComparisonWithSelf + */ + @JsonAnySetter + public GuidedTableColumnComparisonWithSelf 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 GuidedTableColumnComparisonWithSelf object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableColumnComparisonWithSelf guidedTableColumnComparisonWithSelf = + (GuidedTableColumnComparisonWithSelf) o; + return Objects.equals(this.type, guidedTableColumnComparisonWithSelf.type) + && Objects.equals( + this.additionalProperties, guidedTableColumnComparisonWithSelf.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableColumnComparisonWithSelf {\n"); + sb.append(" type: ").append(toIndentedString(type)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithSelfType.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithSelfType.java new file mode 100644 index 00000000000..bb2b6cce2a8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnComparisonWithSelfType.java @@ -0,0 +1,63 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize( + using = + GuidedTableColumnComparisonWithSelfType.GuidedTableColumnComparisonWithSelfTypeSerializer + .class) +public class GuidedTableColumnComparisonWithSelfType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("percent_column_total")); + + public static final GuidedTableColumnComparisonWithSelfType PERCENT_COLUMN_TOTAL = + new GuidedTableColumnComparisonWithSelfType("percent_column_total"); + + GuidedTableColumnComparisonWithSelfType(String value) { + super(value, allowedValues); + } + + public static class GuidedTableColumnComparisonWithSelfTypeSerializer + extends StdSerializer { + public GuidedTableColumnComparisonWithSelfTypeSerializer( + Class t) { + super(t); + } + + public GuidedTableColumnComparisonWithSelfTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableColumnComparisonWithSelfType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableColumnComparisonWithSelfType fromValue(String value) { + return new GuidedTableColumnComparisonWithSelfType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFormat.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFormat.java new file mode 100644 index 00000000000..6ebd2a11dc6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFormat.java @@ -0,0 +1,286 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GuidedTableColumnFormat.GuidedTableColumnFormatDeserializer.class) +@JsonSerialize(using = GuidedTableColumnFormat.GuidedTableColumnFormatSerializer.class) +public class GuidedTableColumnFormat extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GuidedTableColumnFormat.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableColumnFormatSerializer + extends StdSerializer { + public GuidedTableColumnFormatSerializer(Class t) { + super(t); + } + + public GuidedTableColumnFormatSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableColumnFormat value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableColumnFormatDeserializer + extends StdDeserializer { + public GuidedTableColumnFormatDeserializer() { + this(GuidedTableColumnFormat.class); + } + + public GuidedTableColumnFormatDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableColumnFormat deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GuidedTableNumberBarColumnFormat + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableNumberBarColumnFormat.class.equals(Integer.class) + || GuidedTableNumberBarColumnFormat.class.equals(Long.class) + || GuidedTableNumberBarColumnFormat.class.equals(Float.class) + || GuidedTableNumberBarColumnFormat.class.equals(Double.class) + || GuidedTableNumberBarColumnFormat.class.equals(Boolean.class) + || GuidedTableNumberBarColumnFormat.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableNumberBarColumnFormat.class.equals(Integer.class) + || GuidedTableNumberBarColumnFormat.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableNumberBarColumnFormat.class.equals(Float.class) + || GuidedTableNumberBarColumnFormat.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableNumberBarColumnFormat.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableNumberBarColumnFormat.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTableNumberBarColumnFormat.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableNumberBarColumnFormat) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTableNumberBarColumnFormat'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'GuidedTableNumberBarColumnFormat'", e); + } + + // deserialize GuidedTableTrendColumnFormat + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableTrendColumnFormat.class.equals(Integer.class) + || GuidedTableTrendColumnFormat.class.equals(Long.class) + || GuidedTableTrendColumnFormat.class.equals(Float.class) + || GuidedTableTrendColumnFormat.class.equals(Double.class) + || GuidedTableTrendColumnFormat.class.equals(Boolean.class) + || GuidedTableTrendColumnFormat.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableTrendColumnFormat.class.equals(Integer.class) + || GuidedTableTrendColumnFormat.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableTrendColumnFormat.class.equals(Float.class) + || GuidedTableTrendColumnFormat.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableTrendColumnFormat.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableTrendColumnFormat.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTableTrendColumnFormat.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableTrendColumnFormat) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTableTrendColumnFormat'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GuidedTableTrendColumnFormat'", e); + } + + GuidedTableColumnFormat ret = new GuidedTableColumnFormat(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableColumnFormat getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GuidedTableColumnFormat cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableColumnFormat() { + super("oneOf", Boolean.FALSE); + } + + public GuidedTableColumnFormat(GuidedTableNumberBarColumnFormat o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableColumnFormat(GuidedTableTrendColumnFormat o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "GuidedTableNumberBarColumnFormat", new GenericType() {}); + schemas.put("GuidedTableTrendColumnFormat", new GenericType() {}); + JSON.registerDescendants(GuidedTableColumnFormat.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableColumnFormat.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GuidedTableNumberBarColumnFormat, GuidedTableTrendColumnFormat + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + GuidedTableNumberBarColumnFormat.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GuidedTableTrendColumnFormat.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be GuidedTableNumberBarColumnFormat," + + " GuidedTableTrendColumnFormat"); + } + + /** + * Get the actual instance, which can be the following: GuidedTableNumberBarColumnFormat, + * GuidedTableTrendColumnFormat + * + * @return The actual instance (GuidedTableNumberBarColumnFormat, GuidedTableTrendColumnFormat) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableNumberBarColumnFormat`. If the actual instance is not + * `GuidedTableNumberBarColumnFormat`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableNumberBarColumnFormat` + * @throws ClassCastException if the instance is not `GuidedTableNumberBarColumnFormat` + */ + public GuidedTableNumberBarColumnFormat getGuidedTableNumberBarColumnFormat() + throws ClassCastException { + return (GuidedTableNumberBarColumnFormat) super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableTrendColumnFormat`. If the actual instance is not + * `GuidedTableTrendColumnFormat`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableTrendColumnFormat` + * @throws ClassCastException if the instance is not `GuidedTableTrendColumnFormat` + */ + public GuidedTableTrendColumnFormat getGuidedTableTrendColumnFormat() throws ClassCastException { + return (GuidedTableTrendColumnFormat) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFunction.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFunction.java new file mode 100644 index 00000000000..8c18123cb63 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFunction.java @@ -0,0 +1,188 @@ +/* + * 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; + +/** A function to apply when computing a column's value. */ +@JsonPropertyOrder({ + GuidedTableColumnFunction.JSON_PROPERTY_ARGS, + GuidedTableColumnFunction.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableColumnFunction { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ARGS = "args"; + private List args = null; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public GuidedTableColumnFunction() {} + + @JsonCreator + public GuidedTableColumnFunction( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public GuidedTableColumnFunction args(List args) { + this.args = args; + for (Object item : args) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTableColumnFunction addArgsItem(Object argsItem) { + if (this.args == null) { + this.args = new ArrayList<>(); + } + this.args.add(argsItem); + this.unparsed |= argsItem.unparsed; + return this; + } + + /** + * Arguments passed to the function in order. + * + * @return args + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ARGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getArgs() { + return args; + } + + public void setArgs(List args) { + this.args = args; + } + + public GuidedTableColumnFunction name(String name) { + this.name = name; + return this; + } + + /** + * Function name (e.g. clamp_min, abs, round). Not + * restricted to a fixed set. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 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 GuidedTableColumnFunction + */ + @JsonAnySetter + public GuidedTableColumnFunction 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 GuidedTableColumnFunction object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableColumnFunction guidedTableColumnFunction = (GuidedTableColumnFunction) o; + return Objects.equals(this.args, guidedTableColumnFunction.args) + && Objects.equals(this.name, guidedTableColumnFunction.name) + && Objects.equals( + this.additionalProperties, guidedTableColumnFunction.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(args, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableColumnFunction {\n"); + sb.append(" args: ").append(toIndentedString(args)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFunctionargsItem.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFunctionargsItem.java new file mode 100644 index 00000000000..a694ac79895 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableColumnFunctionargsItem.java @@ -0,0 +1,338 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = GuidedTableColumnFunctionargsItem.GuidedTableColumnFunctionargsItemDeserializer.class) +@JsonSerialize( + using = GuidedTableColumnFunctionargsItem.GuidedTableColumnFunctionargsItemSerializer.class) +public class GuidedTableColumnFunctionargsItem extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GuidedTableColumnFunctionargsItem.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableColumnFunctionargsItemSerializer + extends StdSerializer { + public GuidedTableColumnFunctionargsItemSerializer(Class t) { + super(t); + } + + public GuidedTableColumnFunctionargsItemSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableColumnFunctionargsItem value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableColumnFunctionargsItemDeserializer + extends StdDeserializer { + public GuidedTableColumnFunctionargsItemDeserializer() { + this(GuidedTableColumnFunctionargsItem.class); + } + + public GuidedTableColumnFunctionargsItemDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableColumnFunctionargsItem deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) + || String.class.equals(Long.class) + || String.class.equals(Float.class) + || String.class.equals(Double.class) + || String.class.equals(Boolean.class) + || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((String.class.equals(Integer.class) || String.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((String.class.equals(Float.class) || String.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (String.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Integer + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Integer.class.equals(Integer.class) + || Integer.class.equals(Long.class) + || Integer.class.equals(Float.class) + || Integer.class.equals(Double.class) + || Integer.class.equals(Boolean.class) + || Integer.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((Integer.class.equals(Integer.class) || Integer.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((Integer.class.equals(Float.class) || Integer.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (Integer.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (Integer.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(Integer.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize Boolean + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Boolean.class.equals(Integer.class) + || Boolean.class.equals(Long.class) + || Boolean.class.equals(Float.class) + || Boolean.class.equals(Double.class) + || Boolean.class.equals(Boolean.class) + || Boolean.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((Boolean.class.equals(Integer.class) || Boolean.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((Boolean.class.equals(Float.class) || Boolean.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (Boolean.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (Boolean.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(Boolean.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'Boolean'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + GuidedTableColumnFunctionargsItem ret = new GuidedTableColumnFunctionargsItem(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableColumnFunctionargsItem getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GuidedTableColumnFunctionargsItem cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableColumnFunctionargsItem() { + super("oneOf", Boolean.FALSE); + } + + public GuidedTableColumnFunctionargsItem(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableColumnFunctionargsItem(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableColumnFunctionargsItem(Boolean o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", new GenericType() {}); + schemas.put("Integer", new GenericType() {}); + schemas.put("Boolean", new GenericType() {}); + JSON.registerDescendants( + GuidedTableColumnFunctionargsItem.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableColumnFunctionargsItem.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: String, Integer, Boolean + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be String, Integer, Boolean"); + } + + /** + * Get the actual instance, which can be the following: String, Integer, Boolean + * + * @return The actual instance (String, Integer, Boolean) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String) super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer) super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumn.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumn.java new file mode 100644 index 00000000000..c384a4be870 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumn.java @@ -0,0 +1,367 @@ +/* + * 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; + +/** + * A guided table column that computes an aggregation directly from one of the table's base queries. + */ +@JsonPropertyOrder({ + GuidedTableComputeColumn.JSON_PROPERTY_ALIAS, + GuidedTableComputeColumn.JSON_PROPERTY_COMPARISON, + GuidedTableComputeColumn.JSON_PROPERTY_COMPUTE, + GuidedTableComputeColumn.JSON_PROPERTY_FORMAT, + GuidedTableComputeColumn.JSON_PROPERTY_FUNCTIONS, + GuidedTableComputeColumn.JSON_PROPERTY_IS_HIDDEN, + GuidedTableComputeColumn.JSON_PROPERTY_NAME, + GuidedTableComputeColumn.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableComputeColumn { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_COMPARISON = "comparison"; + private GuidedTableColumnComparison comparison; + + public static final String JSON_PROPERTY_COMPUTE = "compute"; + private GuidedTableComputeColumnCompute compute; + + public static final String JSON_PROPERTY_FORMAT = "format"; + private GuidedTableColumnFormat format; + + public static final String JSON_PROPERTY_FUNCTIONS = "functions"; + private List functions = null; + + public static final String JSON_PROPERTY_IS_HIDDEN = "is_hidden"; + private Boolean isHidden; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GuidedTableComputeColumnType type; + + public GuidedTableComputeColumn() {} + + @JsonCreator + public GuidedTableComputeColumn( + @JsonProperty(required = true, value = JSON_PROPERTY_COMPUTE) + GuidedTableComputeColumnCompute compute, + @JsonProperty(required = true, value = JSON_PROPERTY_FORMAT) GuidedTableColumnFormat format, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GuidedTableComputeColumnType type) { + this.compute = compute; + this.unparsed |= compute.unparsed; + this.format = format; + this.unparsed |= format.unparsed; + this.name = name; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GuidedTableComputeColumn alias(String alias) { + this.alias = alias; + return this; + } + + /** + * Display name shown as the column header. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public GuidedTableComputeColumn comparison(GuidedTableColumnComparison comparison) { + this.comparison = comparison; + this.unparsed |= comparison.unparsed; + return this; + } + + /** + * Comparison to display in a guided table column. + * + * @return comparison + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPARISON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableColumnComparison getComparison() { + return comparison; + } + + public void setComparison(GuidedTableColumnComparison comparison) { + this.comparison = comparison; + } + + public GuidedTableComputeColumn compute(GuidedTableComputeColumnCompute compute) { + this.compute = compute; + this.unparsed |= compute.unparsed; + return this; + } + + /** + * Aggregation configuration. + * + * @return compute + */ + @JsonProperty(JSON_PROPERTY_COMPUTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableComputeColumnCompute getCompute() { + return compute; + } + + public void setCompute(GuidedTableComputeColumnCompute compute) { + this.compute = compute; + } + + public GuidedTableComputeColumn format(GuidedTableColumnFormat format) { + this.format = format; + this.unparsed |= format.unparsed; + return this; + } + + /** + * Visual formatting applied to values in a guided table column. Supports number/bar mode and + * trend mode. + * + * @return format + */ + @JsonProperty(JSON_PROPERTY_FORMAT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableColumnFormat getFormat() { + return format; + } + + public void setFormat(GuidedTableColumnFormat format) { + this.format = format; + } + + public GuidedTableComputeColumn functions(List functions) { + this.functions = functions; + for (GuidedTableColumnFunction item : functions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTableComputeColumn addFunctionsItem(GuidedTableColumnFunction functionsItem) { + if (this.functions == null) { + this.functions = new ArrayList<>(); + } + this.functions.add(functionsItem); + this.unparsed |= functionsItem.unparsed; + return this; + } + + /** + * Functions to apply sequentially to the computed value. + * + * @return functions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FUNCTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFunctions() { + return functions; + } + + public void setFunctions(List functions) { + this.functions = functions; + } + + public GuidedTableComputeColumn isHidden(Boolean isHidden) { + this.isHidden = isHidden; + return this; + } + + /** + * Whether this column is hidden in the rendered table. + * + * @return isHidden + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_HIDDEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsHidden() { + return isHidden; + } + + public void setIsHidden(Boolean isHidden) { + this.isHidden = isHidden; + } + + public GuidedTableComputeColumn name(String name) { + this.name = name; + return this; + } + + /** + * Auto-generated name used to refer to this column. + * + * @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 GuidedTableComputeColumn type(GuidedTableComputeColumnType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Gettype + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableComputeColumnType getType() { + return type; + } + + public void setType(GuidedTableComputeColumnType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 GuidedTableComputeColumn + */ + @JsonAnySetter + public GuidedTableComputeColumn 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 GuidedTableComputeColumn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableComputeColumn guidedTableComputeColumn = (GuidedTableComputeColumn) o; + return Objects.equals(this.alias, guidedTableComputeColumn.alias) + && Objects.equals(this.comparison, guidedTableComputeColumn.comparison) + && Objects.equals(this.compute, guidedTableComputeColumn.compute) + && Objects.equals(this.format, guidedTableComputeColumn.format) + && Objects.equals(this.functions, guidedTableComputeColumn.functions) + && Objects.equals(this.isHidden, guidedTableComputeColumn.isHidden) + && Objects.equals(this.name, guidedTableComputeColumn.name) + && Objects.equals(this.type, guidedTableComputeColumn.type) + && Objects.equals(this.additionalProperties, guidedTableComputeColumn.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + alias, comparison, compute, format, functions, isHidden, name, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableComputeColumn {\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" comparison: ").append(toIndentedString(comparison)).append("\n"); + sb.append(" compute: ").append(toIndentedString(compute)).append("\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" functions: ").append(toIndentedString(functions)).append("\n"); + sb.append(" isHidden: ").append(toIndentedString(isHidden)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumnCompute.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumnCompute.java new file mode 100644 index 00000000000..d378614dfeb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumnCompute.java @@ -0,0 +1,229 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Aggregation configuration. */ +@JsonPropertyOrder({ + GuidedTableComputeColumnCompute.JSON_PROPERTY_AGGREGATION, + GuidedTableComputeColumnCompute.JSON_PROPERTY_FILTER, + GuidedTableComputeColumnCompute.JSON_PROPERTY_PROPERTY, + GuidedTableComputeColumnCompute.JSON_PROPERTY_QUERY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableComputeColumnCompute { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AGGREGATION = "aggregation"; + private String aggregation; + + public static final String JSON_PROPERTY_FILTER = "filter"; + private String filter; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private String property; + + public static final String JSON_PROPERTY_QUERY = "query"; + private String query; + + public GuidedTableComputeColumnCompute() {} + + @JsonCreator + public GuidedTableComputeColumnCompute( + @JsonProperty(required = true, value = JSON_PROPERTY_AGGREGATION) String aggregation, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY) String query) { + this.aggregation = aggregation; + this.query = query; + } + + public GuidedTableComputeColumnCompute aggregation(String aggregation) { + this.aggregation = aggregation; + return this; + } + + /** + * Aggregation type (e.g. avg, sum, count). + * + * @return aggregation + */ + @JsonProperty(JSON_PROPERTY_AGGREGATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAggregation() { + return aggregation; + } + + public void setAggregation(String aggregation) { + this.aggregation = aggregation; + } + + public GuidedTableComputeColumnCompute filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Additional filter criteria. + * + * @return filter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFilter() { + return filter; + } + + public void setFilter(String filter) { + this.filter = filter; + } + + public GuidedTableComputeColumnCompute property(String property) { + this.property = property; + return this; + } + + /** + * Attribute to aggregate on. Depends on the data source (e.g. a log attribute). + * + * @return property + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public GuidedTableComputeColumnCompute query(String query) { + this.query = query; + return this; + } + + /** + * Name of the source query. + * + * @return query + */ + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + /** + * 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 GuidedTableComputeColumnCompute + */ + @JsonAnySetter + public GuidedTableComputeColumnCompute 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 GuidedTableComputeColumnCompute object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableComputeColumnCompute guidedTableComputeColumnCompute = + (GuidedTableComputeColumnCompute) o; + return Objects.equals(this.aggregation, guidedTableComputeColumnCompute.aggregation) + && Objects.equals(this.filter, guidedTableComputeColumnCompute.filter) + && Objects.equals(this.property, guidedTableComputeColumnCompute.property) + && Objects.equals(this.query, guidedTableComputeColumnCompute.query) + && Objects.equals( + this.additionalProperties, guidedTableComputeColumnCompute.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(aggregation, filter, property, query, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableComputeColumnCompute {\n"); + sb.append(" aggregation: ").append(toIndentedString(aggregation)).append("\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumnType.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumnType.java new file mode 100644 index 00000000000..d7e12e8b5d2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableComputeColumnType.java @@ -0,0 +1,56 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize(using = GuidedTableComputeColumnType.GuidedTableComputeColumnTypeSerializer.class) +public class GuidedTableComputeColumnType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("compute")); + + public static final GuidedTableComputeColumnType COMPUTE = + new GuidedTableComputeColumnType("compute"); + + GuidedTableComputeColumnType(String value) { + super(value, allowedValues); + } + + public static class GuidedTableComputeColumnTypeSerializer + extends StdSerializer { + public GuidedTableComputeColumnTypeSerializer(Class t) { + super(t); + } + + public GuidedTableComputeColumnTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableComputeColumnType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableComputeColumnType fromValue(String value) { + return new GuidedTableComputeColumnType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableConditionalFormats.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableConditionalFormats.java new file mode 100644 index 00000000000..589af2bd6d2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableConditionalFormats.java @@ -0,0 +1,301 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = GuidedTableConditionalFormats.GuidedTableConditionalFormatsDeserializer.class) +@JsonSerialize(using = GuidedTableConditionalFormats.GuidedTableConditionalFormatsSerializer.class) +public class GuidedTableConditionalFormats extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GuidedTableConditionalFormats.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableConditionalFormatsSerializer + extends StdSerializer { + public GuidedTableConditionalFormatsSerializer(Class t) { + super(t); + } + + public GuidedTableConditionalFormatsSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableConditionalFormats value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableConditionalFormatsDeserializer + extends StdDeserializer { + public GuidedTableConditionalFormatsDeserializer() { + this(GuidedTableConditionalFormats.class); + } + + public GuidedTableConditionalFormatsDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableConditionalFormats deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) + || List.class.equals(Long.class) + || List.class.equals(Float.class) + || List.class.equals(Double.class) + || List.class.equals(Boolean.class) + || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((List.class.equals(Integer.class) || List.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((List.class.equals(Float.class) || List.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (List.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(new TypeReference>() {}); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log( + Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'List'", + e); + } + + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) + || List.class.equals(Long.class) + || List.class.equals(Float.class) + || List.class.equals(Double.class) + || List.class.equals(Boolean.class) + || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((List.class.equals(Integer.class) || List.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((List.class.equals(Float.class) || List.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (List.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(new TypeReference>() {}); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'List'", + e); + } + + GuidedTableConditionalFormats ret = new GuidedTableConditionalFormats(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableConditionalFormats getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GuidedTableConditionalFormats cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableConditionalFormats() { + super("oneOf", Boolean.FALSE); + } + + public static GuidedTableConditionalFormats fromGuidedTableThresholdFormattingRuleList( + List o) { + GuidedTableConditionalFormats instance = new GuidedTableConditionalFormats(); + instance.setActualInstance(o); + return instance; + } + + public static GuidedTableConditionalFormats fromGuidedTableRangeFormattingRuleList( + List o) { + GuidedTableConditionalFormats instance = new GuidedTableConditionalFormats(); + instance.setActualInstance(o); + return instance; + } + + static { + schemas.put( + "List", + new GenericType>() {}); + schemas.put( + "List", + new GenericType>() {}); + JSON.registerDescendants( + GuidedTableConditionalFormats.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableConditionalFormats.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: List<GuidedTableThresholdFormattingRule>, + * List<GuidedTableRangeFormattingRule> + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be List," + + " List"); + } + + /** + * Get the actual instance, which can be the following: + * List<GuidedTableThresholdFormattingRule>, List<GuidedTableRangeFormattingRule> + * + * @return The actual instance (List<GuidedTableThresholdFormattingRule>, + * List<GuidedTableRangeFormattingRule>) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List<GuidedTableThresholdFormattingRule>`. If the actual + * instance is not `List<GuidedTableThresholdFormattingRule>`, the ClassCastException will + * be thrown. + * + * @return The actual instance of `List<GuidedTableThresholdFormattingRule>` + * @throws ClassCastException if the instance is not + * `List<GuidedTableThresholdFormattingRule>` + */ + public List getGuidedTableThresholdFormattingRuleList() + throws ClassCastException { + return (List) super.getActualInstance(); + } + + /** + * Get the actual instance of `List<GuidedTableRangeFormattingRule>`. If the actual instance + * is not `List<GuidedTableRangeFormattingRule>`, the ClassCastException will be thrown. + * + * @return The actual instance of `List<GuidedTableRangeFormattingRule>` + * @throws ClassCastException if the instance is not `List<GuidedTableRangeFormattingRule>` + */ + public List getGuidedTableRangeFormattingRuleList() + throws ClassCastException { + return (List) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQuery.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQuery.java new file mode 100644 index 00000000000..9b028a543ef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQuery.java @@ -0,0 +1,305 @@ +/* + * 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; + +/** + * An events-platform query fragment used as source data for a guided table. Covers logs, RUM, + * spans, CI pipelines, events, and product analytics. + */ +@JsonPropertyOrder({ + GuidedTableEventsQuery.JSON_PROPERTY_ALIAS, + GuidedTableEventsQuery.JSON_PROPERTY_DATA_SOURCE, + GuidedTableEventsQuery.JSON_PROPERTY_INDEXES, + GuidedTableEventsQuery.JSON_PROPERTY_NAME, + GuidedTableEventsQuery.JSON_PROPERTY_SEARCH, + GuidedTableEventsQuery.JSON_PROPERTY_STORAGE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableEventsQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private GuidedTableEventsQueryDataSource dataSource; + + public static final String JSON_PROPERTY_INDEXES = "indexes"; + private List indexes = null; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SEARCH = "search"; + private GuidedTableEventsQuerySearch search; + + public static final String JSON_PROPERTY_STORAGE = "storage"; + private GuidedTableStorageType storage; + + public GuidedTableEventsQuery() {} + + @JsonCreator + public GuidedTableEventsQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + GuidedTableEventsQueryDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.name = name; + } + + public GuidedTableEventsQuery alias(String alias) { + this.alias = alias; + return this; + } + + /** + * Display alias for the query. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public GuidedTableEventsQuery dataSource(GuidedTableEventsQueryDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * Events data source. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableEventsQueryDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(GuidedTableEventsQueryDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public GuidedTableEventsQuery indexes(List indexes) { + this.indexes = indexes; + return this; + } + + public GuidedTableEventsQuery addIndexesItem(String indexesItem) { + if (this.indexes == null) { + this.indexes = new ArrayList<>(); + } + this.indexes.add(indexesItem); + return this; + } + + /** + * Indexes to search for events. + * + * @return indexes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INDEXES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIndexes() { + return indexes; + } + + public void setIndexes(List indexes) { + this.indexes = indexes; + } + + public GuidedTableEventsQuery name(String name) { + this.name = name; + return this; + } + + /** + * Variable name used to reference this query in columns and formulas. + * + * @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 GuidedTableEventsQuery search(GuidedTableEventsQuerySearch search) { + this.search = search; + this.unparsed |= search.unparsed; + return this; + } + + /** + * Search filter for matching events. + * + * @return search + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SEARCH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableEventsQuerySearch getSearch() { + return search; + } + + public void setSearch(GuidedTableEventsQuerySearch search) { + this.search = search; + } + + public GuidedTableEventsQuery storage(GuidedTableStorageType storage) { + this.storage = storage; + this.unparsed |= !storage.isValid(); + return this; + } + + /** + * Storage tier to target for an events-platform query in a guided table. + * + * @return storage + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STORAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableStorageType getStorage() { + return storage; + } + + public void setStorage(GuidedTableStorageType storage) { + if (!storage.isValid()) { + this.unparsed = true; + } + this.storage = storage; + } + + /** + * 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 GuidedTableEventsQuery + */ + @JsonAnySetter + public GuidedTableEventsQuery 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 GuidedTableEventsQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableEventsQuery guidedTableEventsQuery = (GuidedTableEventsQuery) o; + return Objects.equals(this.alias, guidedTableEventsQuery.alias) + && Objects.equals(this.dataSource, guidedTableEventsQuery.dataSource) + && Objects.equals(this.indexes, guidedTableEventsQuery.indexes) + && Objects.equals(this.name, guidedTableEventsQuery.name) + && Objects.equals(this.search, guidedTableEventsQuery.search) + && Objects.equals(this.storage, guidedTableEventsQuery.storage) + && Objects.equals(this.additionalProperties, guidedTableEventsQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(alias, dataSource, indexes, name, search, storage, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableEventsQuery {\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" indexes: ").append(toIndentedString(indexes)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" search: ").append(toIndentedString(search)).append("\n"); + sb.append(" storage: ").append(toIndentedString(storage)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQueryDataSource.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQueryDataSource.java new file mode 100644 index 00000000000..bebf572374c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQueryDataSource.java @@ -0,0 +1,69 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Events data source. */ +@JsonSerialize( + using = GuidedTableEventsQueryDataSource.GuidedTableEventsQueryDataSourceSerializer.class) +public class GuidedTableEventsQueryDataSource extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("logs", "rum", "spans", "ci_pipelines", "events", "product_analytics")); + + public static final GuidedTableEventsQueryDataSource LOGS = + new GuidedTableEventsQueryDataSource("logs"); + public static final GuidedTableEventsQueryDataSource RUM = + new GuidedTableEventsQueryDataSource("rum"); + public static final GuidedTableEventsQueryDataSource SPANS = + new GuidedTableEventsQueryDataSource("spans"); + public static final GuidedTableEventsQueryDataSource CI_PIPELINES = + new GuidedTableEventsQueryDataSource("ci_pipelines"); + public static final GuidedTableEventsQueryDataSource EVENTS = + new GuidedTableEventsQueryDataSource("events"); + public static final GuidedTableEventsQueryDataSource PRODUCT_ANALYTICS = + new GuidedTableEventsQueryDataSource("product_analytics"); + + GuidedTableEventsQueryDataSource(String value) { + super(value, allowedValues); + } + + public static class GuidedTableEventsQueryDataSourceSerializer + extends StdSerializer { + public GuidedTableEventsQueryDataSourceSerializer(Class t) { + super(t); + } + + public GuidedTableEventsQueryDataSourceSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableEventsQueryDataSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableEventsQueryDataSource fromValue(String value) { + return new GuidedTableEventsQueryDataSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQuerySearch.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQuerySearch.java new file mode 100644 index 00000000000..75a2389732d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableEventsQuerySearch.java @@ -0,0 +1,136 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Search filter for matching events. */ +@JsonPropertyOrder({GuidedTableEventsQuerySearch.JSON_PROPERTY_QUERY}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableEventsQuerySearch { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_QUERY = "query"; + private String query; + + public GuidedTableEventsQuerySearch query(String query) { + this.query = query; + return this; + } + + /** + * Events search query string using events-platform search grammar. + * + * @return query + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + /** + * 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 GuidedTableEventsQuerySearch + */ + @JsonAnySetter + public GuidedTableEventsQuerySearch 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 GuidedTableEventsQuerySearch object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableEventsQuerySearch guidedTableEventsQuerySearch = (GuidedTableEventsQuerySearch) o; + return Objects.equals(this.query, guidedTableEventsQuerySearch.query) + && Objects.equals( + this.additionalProperties, guidedTableEventsQuerySearch.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(query, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableEventsQuerySearch {\n"); + sb.append(" query: ").append(toIndentedString(query)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableFormulaColumn.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableFormulaColumn.java new file mode 100644 index 00000000000..5f4437f71ad --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableFormulaColumn.java @@ -0,0 +1,320 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A guided table column that displays the result of evaluating a formula over other columns. */ +@JsonPropertyOrder({ + GuidedTableFormulaColumn.JSON_PROPERTY_ALIAS, + GuidedTableFormulaColumn.JSON_PROPERTY_COMPARISON, + GuidedTableFormulaColumn.JSON_PROPERTY_FORMAT, + GuidedTableFormulaColumn.JSON_PROPERTY_FORMULA, + GuidedTableFormulaColumn.JSON_PROPERTY_IS_HIDDEN, + GuidedTableFormulaColumn.JSON_PROPERTY_NAME, + GuidedTableFormulaColumn.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableFormulaColumn { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_COMPARISON = "comparison"; + private GuidedTableColumnComparison comparison; + + public static final String JSON_PROPERTY_FORMAT = "format"; + private GuidedTableColumnFormat format; + + public static final String JSON_PROPERTY_FORMULA = "formula"; + private String formula; + + public static final String JSON_PROPERTY_IS_HIDDEN = "is_hidden"; + private Boolean isHidden; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FormulaType type; + + public GuidedTableFormulaColumn() {} + + @JsonCreator + public GuidedTableFormulaColumn( + @JsonProperty(required = true, value = JSON_PROPERTY_FORMAT) GuidedTableColumnFormat format, + @JsonProperty(required = true, value = JSON_PROPERTY_FORMULA) String formula, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FormulaType type) { + this.format = format; + this.unparsed |= format.unparsed; + this.formula = formula; + this.name = name; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GuidedTableFormulaColumn alias(String alias) { + this.alias = alias; + return this; + } + + /** + * Display name shown as the column header. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public GuidedTableFormulaColumn comparison(GuidedTableColumnComparison comparison) { + this.comparison = comparison; + this.unparsed |= comparison.unparsed; + return this; + } + + /** + * Comparison to display in a guided table column. + * + * @return comparison + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPARISON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableColumnComparison getComparison() { + return comparison; + } + + public void setComparison(GuidedTableColumnComparison comparison) { + this.comparison = comparison; + } + + public GuidedTableFormulaColumn format(GuidedTableColumnFormat format) { + this.format = format; + this.unparsed |= format.unparsed; + return this; + } + + /** + * Visual formatting applied to values in a guided table column. Supports number/bar mode and + * trend mode. + * + * @return format + */ + @JsonProperty(JSON_PROPERTY_FORMAT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableColumnFormat getFormat() { + return format; + } + + public void setFormat(GuidedTableColumnFormat format) { + this.format = format; + } + + public GuidedTableFormulaColumn formula(String formula) { + this.formula = formula; + return this; + } + + /** + * The formula expression to evaluate. + * + * @return formula + */ + @JsonProperty(JSON_PROPERTY_FORMULA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getFormula() { + return formula; + } + + public void setFormula(String formula) { + this.formula = formula; + } + + public GuidedTableFormulaColumn isHidden(Boolean isHidden) { + this.isHidden = isHidden; + return this; + } + + /** + * Whether this column is hidden in the rendered table. + * + * @return isHidden + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_HIDDEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsHidden() { + return isHidden; + } + + public void setIsHidden(Boolean isHidden) { + this.isHidden = isHidden; + } + + public GuidedTableFormulaColumn name(String name) { + this.name = name; + return this; + } + + /** + * Auto-generated name used to refer to this column. + * + * @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 GuidedTableFormulaColumn type(FormulaType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Set the sort type to formula. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FormulaType getType() { + return type; + } + + public void setType(FormulaType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 GuidedTableFormulaColumn + */ + @JsonAnySetter + public GuidedTableFormulaColumn 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 GuidedTableFormulaColumn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableFormulaColumn guidedTableFormulaColumn = (GuidedTableFormulaColumn) o; + return Objects.equals(this.alias, guidedTableFormulaColumn.alias) + && Objects.equals(this.comparison, guidedTableFormulaColumn.comparison) + && Objects.equals(this.format, guidedTableFormulaColumn.format) + && Objects.equals(this.formula, guidedTableFormulaColumn.formula) + && Objects.equals(this.isHidden, guidedTableFormulaColumn.isHidden) + && Objects.equals(this.name, guidedTableFormulaColumn.name) + && Objects.equals(this.type, guidedTableFormulaColumn.type) + && Objects.equals(this.additionalProperties, guidedTableFormulaColumn.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + alias, comparison, format, formula, isHidden, name, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableFormulaColumn {\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" comparison: ").append(toIndentedString(comparison)).append("\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" formula: ").append(toIndentedString(formula)).append("\n"); + sb.append(" isHidden: ").append(toIndentedString(isHidden)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableGroupKey.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableGroupKey.java new file mode 100644 index 00000000000..4ff236b0645 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableGroupKey.java @@ -0,0 +1,173 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Maps a specific base query to the field name used for grouping. */ +@JsonPropertyOrder({ + GuidedTableGroupKey.JSON_PROPERTY_GROUP_KEY, + GuidedTableGroupKey.JSON_PROPERTY_QUERY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableGroupKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_GROUP_KEY = "group_key"; + private String groupKey; + + public static final String JSON_PROPERTY_QUERY = "query"; + private String query; + + public GuidedTableGroupKey() {} + + @JsonCreator + public GuidedTableGroupKey( + @JsonProperty(required = true, value = JSON_PROPERTY_GROUP_KEY) String groupKey, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY) String query) { + this.groupKey = groupKey; + this.query = query; + } + + public GuidedTableGroupKey groupKey(String groupKey) { + this.groupKey = groupKey; + return this; + } + + /** + * Field name in the query result used as the grouping key. + * + * @return groupKey + */ + @JsonProperty(JSON_PROPERTY_GROUP_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getGroupKey() { + return groupKey; + } + + public void setGroupKey(String groupKey) { + this.groupKey = groupKey; + } + + public GuidedTableGroupKey query(String query) { + this.query = query; + return this; + } + + /** + * Name of the source query. + * + * @return query + */ + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + /** + * 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 GuidedTableGroupKey + */ + @JsonAnySetter + public GuidedTableGroupKey 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 GuidedTableGroupKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableGroupKey guidedTableGroupKey = (GuidedTableGroupKey) o; + return Objects.equals(this.groupKey, guidedTableGroupKey.groupKey) + && Objects.equals(this.query, guidedTableGroupKey.query) + && Objects.equals(this.additionalProperties, guidedTableGroupKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(groupKey, query, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableGroupKey {\n"); + sb.append(" groupKey: ").append(toIndentedString(groupKey)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableMetricsQuery.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableMetricsQuery.java new file mode 100644 index 00000000000..e4a6743c72e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableMetricsQuery.java @@ -0,0 +1,264 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * A metrics (or cloud cost) query fragment used as source data for a guided table. Group-by and + * time/space aggregation are defined separately. + */ +@JsonPropertyOrder({ + GuidedTableMetricsQuery.JSON_PROPERTY_ALIAS, + GuidedTableMetricsQuery.JSON_PROPERTY_DATA_SOURCE, + GuidedTableMetricsQuery.JSON_PROPERTY_FILTER, + GuidedTableMetricsQuery.JSON_PROPERTY_METRIC_NAME, + GuidedTableMetricsQuery.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableMetricsQuery { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_DATA_SOURCE = "data_source"; + private GuidedTableMetricsQueryDataSource dataSource; + + public static final String JSON_PROPERTY_FILTER = "filter"; + private String filter; + + public static final String JSON_PROPERTY_METRIC_NAME = "metric_name"; + private String metricName; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public GuidedTableMetricsQuery() {} + + @JsonCreator + public GuidedTableMetricsQuery( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_SOURCE) + GuidedTableMetricsQueryDataSource dataSource, + @JsonProperty(required = true, value = JSON_PROPERTY_METRIC_NAME) String metricName, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + this.metricName = metricName; + this.name = name; + } + + public GuidedTableMetricsQuery alias(String alias) { + this.alias = alias; + return this; + } + + /** + * Display alias for the query. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public GuidedTableMetricsQuery dataSource(GuidedTableMetricsQueryDataSource dataSource) { + this.dataSource = dataSource; + this.unparsed |= !dataSource.isValid(); + return this; + } + + /** + * Metrics data source. + * + * @return dataSource + */ + @JsonProperty(JSON_PROPERTY_DATA_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableMetricsQueryDataSource getDataSource() { + return dataSource; + } + + public void setDataSource(GuidedTableMetricsQueryDataSource dataSource) { + if (!dataSource.isValid()) { + this.unparsed = true; + } + this.dataSource = dataSource; + } + + public GuidedTableMetricsQuery filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Filter string to apply to the metric query. + * + * @return filter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFilter() { + return filter; + } + + public void setFilter(String filter) { + this.filter = filter; + } + + public GuidedTableMetricsQuery metricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Name of the metric to query. + * + * @return metricName + */ + @JsonProperty(JSON_PROPERTY_METRIC_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMetricName() { + return metricName; + } + + public void setMetricName(String metricName) { + this.metricName = metricName; + } + + public GuidedTableMetricsQuery name(String name) { + this.name = name; + return this; + } + + /** + * Variable name used to reference this query in columns and formulas. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 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 GuidedTableMetricsQuery + */ + @JsonAnySetter + public GuidedTableMetricsQuery 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 GuidedTableMetricsQuery object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableMetricsQuery guidedTableMetricsQuery = (GuidedTableMetricsQuery) o; + return Objects.equals(this.alias, guidedTableMetricsQuery.alias) + && Objects.equals(this.dataSource, guidedTableMetricsQuery.dataSource) + && Objects.equals(this.filter, guidedTableMetricsQuery.filter) + && Objects.equals(this.metricName, guidedTableMetricsQuery.metricName) + && Objects.equals(this.name, guidedTableMetricsQuery.name) + && Objects.equals(this.additionalProperties, guidedTableMetricsQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(alias, dataSource, filter, metricName, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableMetricsQuery {\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" dataSource: ").append(toIndentedString(dataSource)).append("\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append(" metricName: ").append(toIndentedString(metricName)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableMetricsQueryDataSource.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableMetricsQueryDataSource.java new file mode 100644 index 00000000000..c70ce3104e9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableMetricsQueryDataSource.java @@ -0,0 +1,60 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Metrics data source. */ +@JsonSerialize( + using = GuidedTableMetricsQueryDataSource.GuidedTableMetricsQueryDataSourceSerializer.class) +public class GuidedTableMetricsQueryDataSource extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("metrics", "cloud_cost")); + + public static final GuidedTableMetricsQueryDataSource METRICS = + new GuidedTableMetricsQueryDataSource("metrics"); + public static final GuidedTableMetricsQueryDataSource CLOUD_COST = + new GuidedTableMetricsQueryDataSource("cloud_cost"); + + GuidedTableMetricsQueryDataSource(String value) { + super(value, allowedValues); + } + + public static class GuidedTableMetricsQueryDataSourceSerializer + extends StdSerializer { + public GuidedTableMetricsQueryDataSourceSerializer(Class t) { + super(t); + } + + public GuidedTableMetricsQueryDataSourceSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableMetricsQueryDataSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableMetricsQueryDataSource fromValue(String value) { + return new GuidedTableMetricsQueryDataSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberBarColumnFormat.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberBarColumnFormat.java new file mode 100644 index 00000000000..27469c826c3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberBarColumnFormat.java @@ -0,0 +1,212 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Formats a guided table column as a number or a bar. */ +@JsonPropertyOrder({ + GuidedTableNumberBarColumnFormat.JSON_PROPERTY_CONDITIONAL_FORMATS, + GuidedTableNumberBarColumnFormat.JSON_PROPERTY_MODE, + GuidedTableNumberBarColumnFormat.JSON_PROPERTY_NUMBER_FORMAT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableNumberBarColumnFormat { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONDITIONAL_FORMATS = "conditional_formats"; + private GuidedTableConditionalFormats conditionalFormats; + + public static final String JSON_PROPERTY_MODE = "mode"; + private GuidedTableNumberBarColumnFormatMode mode; + + public static final String JSON_PROPERTY_NUMBER_FORMAT = "number_format"; + private GuidedTableNumberFormat numberFormat; + + public GuidedTableNumberBarColumnFormat() {} + + @JsonCreator + public GuidedTableNumberBarColumnFormat( + @JsonProperty(required = true, value = JSON_PROPERTY_MODE) + GuidedTableNumberBarColumnFormatMode mode) { + this.mode = mode; + this.unparsed |= !mode.isValid(); + } + + public GuidedTableNumberBarColumnFormat conditionalFormats( + GuidedTableConditionalFormats conditionalFormats) { + this.conditionalFormats = conditionalFormats; + this.unparsed |= conditionalFormats.unparsed; + return this; + } + + /** + * Conditional formatting rules for a guided table column. Either an array of threshold-based + * rules or a single range-based rule. + * + * @return conditionalFormats + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONDITIONAL_FORMATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableConditionalFormats getConditionalFormats() { + return conditionalFormats; + } + + public void setConditionalFormats(GuidedTableConditionalFormats conditionalFormats) { + this.conditionalFormats = conditionalFormats; + } + + public GuidedTableNumberBarColumnFormat mode(GuidedTableNumberBarColumnFormatMode mode) { + this.mode = mode; + this.unparsed |= !mode.isValid(); + return this; + } + + /** + * Getmode + * + * @return mode + */ + @JsonProperty(JSON_PROPERTY_MODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableNumberBarColumnFormatMode getMode() { + return mode; + } + + public void setMode(GuidedTableNumberBarColumnFormatMode mode) { + if (!mode.isValid()) { + this.unparsed = true; + } + this.mode = mode; + } + + public GuidedTableNumberBarColumnFormat numberFormat(GuidedTableNumberFormat numberFormat) { + this.numberFormat = numberFormat; + this.unparsed |= numberFormat.unparsed; + return this; + } + + /** + * Number display format for a guided table column value. + * + * @return numberFormat + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NUMBER_FORMAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableNumberFormat getNumberFormat() { + return numberFormat; + } + + public void setNumberFormat(GuidedTableNumberFormat numberFormat) { + this.numberFormat = numberFormat; + } + + /** + * 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 GuidedTableNumberBarColumnFormat + */ + @JsonAnySetter + public GuidedTableNumberBarColumnFormat 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 GuidedTableNumberBarColumnFormat object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableNumberBarColumnFormat guidedTableNumberBarColumnFormat = + (GuidedTableNumberBarColumnFormat) o; + return Objects.equals( + this.conditionalFormats, guidedTableNumberBarColumnFormat.conditionalFormats) + && Objects.equals(this.mode, guidedTableNumberBarColumnFormat.mode) + && Objects.equals(this.numberFormat, guidedTableNumberBarColumnFormat.numberFormat) + && Objects.equals( + this.additionalProperties, guidedTableNumberBarColumnFormat.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(conditionalFormats, mode, numberFormat, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableNumberBarColumnFormat {\n"); + sb.append(" conditionalFormats: ").append(toIndentedString(conditionalFormats)).append("\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" numberFormat: ").append(toIndentedString(numberFormat)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberBarColumnFormatMode.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberBarColumnFormatMode.java new file mode 100644 index 00000000000..362b65cb58b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberBarColumnFormatMode.java @@ -0,0 +1,62 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize( + using = + GuidedTableNumberBarColumnFormatMode.GuidedTableNumberBarColumnFormatModeSerializer.class) +public class GuidedTableNumberBarColumnFormatMode extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("number", "bar")); + + public static final GuidedTableNumberBarColumnFormatMode NUMBER = + new GuidedTableNumberBarColumnFormatMode("number"); + public static final GuidedTableNumberBarColumnFormatMode BAR = + new GuidedTableNumberBarColumnFormatMode("bar"); + + GuidedTableNumberBarColumnFormatMode(String value) { + super(value, allowedValues); + } + + public static class GuidedTableNumberBarColumnFormatModeSerializer + extends StdSerializer { + public GuidedTableNumberBarColumnFormatModeSerializer( + Class t) { + super(t); + } + + public GuidedTableNumberBarColumnFormatModeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableNumberBarColumnFormatMode value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableNumberBarColumnFormatMode fromValue(String value) { + return new GuidedTableNumberBarColumnFormatMode(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberFormat.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberFormat.java new file mode 100644 index 00000000000..f21532d40e5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberFormat.java @@ -0,0 +1,206 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Number display format for a guided table column value. */ +@JsonPropertyOrder({ + GuidedTableNumberFormat.JSON_PROPERTY_PRECISION, + GuidedTableNumberFormat.JSON_PROPERTY_UNIT, + GuidedTableNumberFormat.JSON_PROPERTY_UNIT_SCALE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableNumberFormat { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PRECISION = "precision"; + private GuidedTableNumberFormatPrecision precision; + + public static final String JSON_PROPERTY_UNIT = "unit"; + private NumberFormatUnit unit; + + public static final String JSON_PROPERTY_UNIT_SCALE = "unit_scale"; + private JsonNullable unitScale = + JsonNullable.undefined(); + + public GuidedTableNumberFormat precision(GuidedTableNumberFormatPrecision precision) { + this.precision = precision; + this.unparsed |= precision.unparsed; + return this; + } + + /** + * Number of digits after the decimal point. Use * for full precision, integer + * to show full integer values, or omit for automatic precision. + * + * @return precision + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRECISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableNumberFormatPrecision getPrecision() { + return precision; + } + + public void setPrecision(GuidedTableNumberFormatPrecision precision) { + this.precision = precision; + } + + public GuidedTableNumberFormat unit(NumberFormatUnit unit) { + this.unit = unit; + this.unparsed |= unit.unparsed; + return this; + } + + /** + * Number format unit. + * + * @return unit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UNIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public NumberFormatUnit getUnit() { + return unit; + } + + public void setUnit(NumberFormatUnit unit) { + this.unit = unit; + } + + public GuidedTableNumberFormat unitScale(NumberFormatUnitScale unitScale) { + this.unitScale = JsonNullable.of(unitScale); + return this; + } + + /** + * The definition of NumberFormatUnitScale object. + * + * @return unitScale + */ + @jakarta.annotation.Nullable + @JsonIgnore + public NumberFormatUnitScale getUnitScale() { + return unitScale.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_UNIT_SCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getUnitScale_JsonNullable() { + return unitScale; + } + + @JsonProperty(JSON_PROPERTY_UNIT_SCALE) + public void setUnitScale_JsonNullable(JsonNullable unitScale) { + this.unitScale = unitScale; + } + + public void setUnitScale(NumberFormatUnitScale unitScale) { + this.unitScale = JsonNullable.of(unitScale); + } + + /** + * 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 GuidedTableNumberFormat + */ + @JsonAnySetter + public GuidedTableNumberFormat 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 GuidedTableNumberFormat object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableNumberFormat guidedTableNumberFormat = (GuidedTableNumberFormat) o; + return Objects.equals(this.precision, guidedTableNumberFormat.precision) + && Objects.equals(this.unit, guidedTableNumberFormat.unit) + && Objects.equals(this.unitScale, guidedTableNumberFormat.unitScale) + && Objects.equals(this.additionalProperties, guidedTableNumberFormat.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(precision, unit, unitScale, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableNumberFormat {\n"); + sb.append(" precision: ").append(toIndentedString(precision)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append(" unitScale: ").append(toIndentedString(unitScale)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberFormatPrecision.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberFormatPrecision.java new file mode 100644 index 00000000000..13f26fc0305 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableNumberFormatPrecision.java @@ -0,0 +1,276 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = GuidedTableNumberFormatPrecision.GuidedTableNumberFormatPrecisionDeserializer.class) +@JsonSerialize( + using = GuidedTableNumberFormatPrecision.GuidedTableNumberFormatPrecisionSerializer.class) +public class GuidedTableNumberFormatPrecision extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GuidedTableNumberFormatPrecision.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableNumberFormatPrecisionSerializer + extends StdSerializer { + public GuidedTableNumberFormatPrecisionSerializer(Class t) { + super(t); + } + + public GuidedTableNumberFormatPrecisionSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableNumberFormatPrecision value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableNumberFormatPrecisionDeserializer + extends StdDeserializer { + public GuidedTableNumberFormatPrecisionDeserializer() { + this(GuidedTableNumberFormatPrecision.class); + } + + public GuidedTableNumberFormatPrecisionDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableNumberFormatPrecision deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) + || String.class.equals(Long.class) + || String.class.equals(Float.class) + || String.class.equals(Double.class) + || String.class.equals(Boolean.class) + || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((String.class.equals(Integer.class) || String.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((String.class.equals(Float.class) || String.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (String.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Integer + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Integer.class.equals(Integer.class) + || Integer.class.equals(Long.class) + || Integer.class.equals(Float.class) + || Integer.class.equals(Double.class) + || Integer.class.equals(Boolean.class) + || Integer.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((Integer.class.equals(Integer.class) || Integer.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((Integer.class.equals(Float.class) || Integer.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (Integer.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (Integer.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(Integer.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + GuidedTableNumberFormatPrecision ret = new GuidedTableNumberFormatPrecision(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableNumberFormatPrecision getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GuidedTableNumberFormatPrecision cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableNumberFormatPrecision() { + super("oneOf", Boolean.FALSE); + } + + public GuidedTableNumberFormatPrecision(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableNumberFormatPrecision(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", new GenericType() {}); + schemas.put("Integer", new GenericType() {}); + JSON.registerDescendants( + GuidedTableNumberFormatPrecision.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableNumberFormatPrecision.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: String, Integer + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be String, Integer"); + } + + /** + * Get the actual instance, which can be the following: String, Integer + * + * @return The actual instance (String, Integer) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String) super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumn.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumn.java new file mode 100644 index 00000000000..0b48f5701d9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumn.java @@ -0,0 +1,367 @@ +/* + * 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; + +/** + * A guided table column that displays values for the previous time period based on another column's + * full query. + */ +@JsonPropertyOrder({ + GuidedTablePresetColumn.JSON_PROPERTY_ALIAS, + GuidedTablePresetColumn.JSON_PROPERTY_COMPARISON, + GuidedTablePresetColumn.JSON_PROPERTY_FORMAT, + GuidedTablePresetColumn.JSON_PROPERTY_FUNCTIONS, + GuidedTablePresetColumn.JSON_PROPERTY_IS_HIDDEN, + GuidedTablePresetColumn.JSON_PROPERTY_NAME, + GuidedTablePresetColumn.JSON_PROPERTY_PRESET, + GuidedTablePresetColumn.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTablePresetColumn { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_COMPARISON = "comparison"; + private GuidedTableColumnComparison comparison; + + public static final String JSON_PROPERTY_FORMAT = "format"; + private GuidedTableColumnFormat format; + + public static final String JSON_PROPERTY_FUNCTIONS = "functions"; + private List functions = null; + + public static final String JSON_PROPERTY_IS_HIDDEN = "is_hidden"; + private Boolean isHidden; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PRESET = "preset"; + private GuidedTablePresetColumnPreset preset; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GuidedTablePresetColumnType type; + + public GuidedTablePresetColumn() {} + + @JsonCreator + public GuidedTablePresetColumn( + @JsonProperty(required = true, value = JSON_PROPERTY_FORMAT) GuidedTableColumnFormat format, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_PRESET) + GuidedTablePresetColumnPreset preset, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) GuidedTablePresetColumnType type) { + this.format = format; + this.unparsed |= format.unparsed; + this.name = name; + this.preset = preset; + this.unparsed |= preset.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GuidedTablePresetColumn alias(String alias) { + this.alias = alias; + return this; + } + + /** + * Display name shown as the column header. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public GuidedTablePresetColumn comparison(GuidedTableColumnComparison comparison) { + this.comparison = comparison; + this.unparsed |= comparison.unparsed; + return this; + } + + /** + * Comparison to display in a guided table column. + * + * @return comparison + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMPARISON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableColumnComparison getComparison() { + return comparison; + } + + public void setComparison(GuidedTableColumnComparison comparison) { + this.comparison = comparison; + } + + public GuidedTablePresetColumn format(GuidedTableColumnFormat format) { + this.format = format; + this.unparsed |= format.unparsed; + return this; + } + + /** + * Visual formatting applied to values in a guided table column. Supports number/bar mode and + * trend mode. + * + * @return format + */ + @JsonProperty(JSON_PROPERTY_FORMAT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableColumnFormat getFormat() { + return format; + } + + public void setFormat(GuidedTableColumnFormat format) { + this.format = format; + } + + public GuidedTablePresetColumn functions(List functions) { + this.functions = functions; + for (GuidedTableColumnFunction item : functions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTablePresetColumn addFunctionsItem(GuidedTableColumnFunction functionsItem) { + if (this.functions == null) { + this.functions = new ArrayList<>(); + } + this.functions.add(functionsItem); + this.unparsed |= functionsItem.unparsed; + return this; + } + + /** + * Functions to apply sequentially to the computed value. + * + * @return functions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FUNCTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFunctions() { + return functions; + } + + public void setFunctions(List functions) { + this.functions = functions; + } + + public GuidedTablePresetColumn isHidden(Boolean isHidden) { + this.isHidden = isHidden; + return this; + } + + /** + * Whether this column is hidden in the rendered table. + * + * @return isHidden + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_HIDDEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsHidden() { + return isHidden; + } + + public void setIsHidden(Boolean isHidden) { + this.isHidden = isHidden; + } + + public GuidedTablePresetColumn name(String name) { + this.name = name; + return this; + } + + /** + * Auto-generated name used to refer to this column. + * + * @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 GuidedTablePresetColumn preset(GuidedTablePresetColumnPreset preset) { + this.preset = preset; + this.unparsed |= preset.unparsed; + return this; + } + + /** + * Preset configuration. + * + * @return preset + */ + @JsonProperty(JSON_PROPERTY_PRESET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTablePresetColumnPreset getPreset() { + return preset; + } + + public void setPreset(GuidedTablePresetColumnPreset preset) { + this.preset = preset; + } + + public GuidedTablePresetColumn type(GuidedTablePresetColumnType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Gettype + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTablePresetColumnType getType() { + return type; + } + + public void setType(GuidedTablePresetColumnType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 GuidedTablePresetColumn + */ + @JsonAnySetter + public GuidedTablePresetColumn 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 GuidedTablePresetColumn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTablePresetColumn guidedTablePresetColumn = (GuidedTablePresetColumn) o; + return Objects.equals(this.alias, guidedTablePresetColumn.alias) + && Objects.equals(this.comparison, guidedTablePresetColumn.comparison) + && Objects.equals(this.format, guidedTablePresetColumn.format) + && Objects.equals(this.functions, guidedTablePresetColumn.functions) + && Objects.equals(this.isHidden, guidedTablePresetColumn.isHidden) + && Objects.equals(this.name, guidedTablePresetColumn.name) + && Objects.equals(this.preset, guidedTablePresetColumn.preset) + && Objects.equals(this.type, guidedTablePresetColumn.type) + && Objects.equals(this.additionalProperties, guidedTablePresetColumn.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + alias, comparison, format, functions, isHidden, name, preset, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTablePresetColumn {\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" comparison: ").append(toIndentedString(comparison)).append("\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" functions: ").append(toIndentedString(functions)).append("\n"); + sb.append(" isHidden: ").append(toIndentedString(isHidden)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" preset: ").append(toIndentedString(preset)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnPreset.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnPreset.java new file mode 100644 index 00000000000..e43e35a982f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnPreset.java @@ -0,0 +1,180 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Preset configuration. */ +@JsonPropertyOrder({ + GuidedTablePresetColumnPreset.JSON_PROPERTY_COLUMN, + GuidedTablePresetColumnPreset.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTablePresetColumnPreset { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COLUMN = "column"; + private String column; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GuidedTablePresetColumnPresetType type; + + public GuidedTablePresetColumnPreset() {} + + @JsonCreator + public GuidedTablePresetColumnPreset( + @JsonProperty(required = true, value = JSON_PROPERTY_COLUMN) String column, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GuidedTablePresetColumnPresetType type) { + this.column = column; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GuidedTablePresetColumnPreset column(String column) { + this.column = column; + return this; + } + + /** + * Name of the column whose full query is reused. + * + * @return column + */ + @JsonProperty(JSON_PROPERTY_COLUMN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getColumn() { + return column; + } + + public void setColumn(String column) { + this.column = column; + } + + public GuidedTablePresetColumnPreset type(GuidedTablePresetColumnPresetType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Gettype + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTablePresetColumnPresetType getType() { + return type; + } + + public void setType(GuidedTablePresetColumnPresetType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 GuidedTablePresetColumnPreset + */ + @JsonAnySetter + public GuidedTablePresetColumnPreset 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 GuidedTablePresetColumnPreset object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTablePresetColumnPreset guidedTablePresetColumnPreset = (GuidedTablePresetColumnPreset) o; + return Objects.equals(this.column, guidedTablePresetColumnPreset.column) + && Objects.equals(this.type, guidedTablePresetColumnPreset.type) + && Objects.equals( + this.additionalProperties, guidedTablePresetColumnPreset.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(column, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTablePresetColumnPreset {\n"); + sb.append(" column: ").append(toIndentedString(column)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnPresetType.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnPresetType.java new file mode 100644 index 00000000000..261718c3017 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnPresetType.java @@ -0,0 +1,58 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize( + using = GuidedTablePresetColumnPresetType.GuidedTablePresetColumnPresetTypeSerializer.class) +public class GuidedTablePresetColumnPresetType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("previous_period")); + + public static final GuidedTablePresetColumnPresetType PREVIOUS_PERIOD = + new GuidedTablePresetColumnPresetType("previous_period"); + + GuidedTablePresetColumnPresetType(String value) { + super(value, allowedValues); + } + + public static class GuidedTablePresetColumnPresetTypeSerializer + extends StdSerializer { + public GuidedTablePresetColumnPresetTypeSerializer(Class t) { + super(t); + } + + public GuidedTablePresetColumnPresetTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTablePresetColumnPresetType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTablePresetColumnPresetType fromValue(String value) { + return new GuidedTablePresetColumnPresetType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnType.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnType.java new file mode 100644 index 00000000000..97d1b9494bc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTablePresetColumnType.java @@ -0,0 +1,56 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize(using = GuidedTablePresetColumnType.GuidedTablePresetColumnTypeSerializer.class) +public class GuidedTablePresetColumnType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("preset")); + + public static final GuidedTablePresetColumnType PRESET = + new GuidedTablePresetColumnType("preset"); + + GuidedTablePresetColumnType(String value) { + super(value, allowedValues); + } + + public static class GuidedTablePresetColumnTypeSerializer + extends StdSerializer { + public GuidedTablePresetColumnTypeSerializer(Class t) { + super(t); + } + + public GuidedTablePresetColumnTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTablePresetColumnType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTablePresetColumnType fromValue(String value) { + return new GuidedTablePresetColumnType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableQuery.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableQuery.java new file mode 100644 index 00000000000..f879151520c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableQuery.java @@ -0,0 +1,277 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = GuidedTableQuery.GuidedTableQueryDeserializer.class) +@JsonSerialize(using = GuidedTableQuery.GuidedTableQuerySerializer.class) +public class GuidedTableQuery extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GuidedTableQuery.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableQuerySerializer extends StdSerializer { + public GuidedTableQuerySerializer(Class t) { + super(t); + } + + public GuidedTableQuerySerializer() { + this(null); + } + + @Override + public void serialize(GuidedTableQuery value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableQueryDeserializer extends StdDeserializer { + public GuidedTableQueryDeserializer() { + this(GuidedTableQuery.class); + } + + public GuidedTableQueryDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableQuery deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GuidedTableMetricsQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableMetricsQuery.class.equals(Integer.class) + || GuidedTableMetricsQuery.class.equals(Long.class) + || GuidedTableMetricsQuery.class.equals(Float.class) + || GuidedTableMetricsQuery.class.equals(Double.class) + || GuidedTableMetricsQuery.class.equals(Boolean.class) + || GuidedTableMetricsQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableMetricsQuery.class.equals(Integer.class) + || GuidedTableMetricsQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableMetricsQuery.class.equals(Float.class) + || GuidedTableMetricsQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableMetricsQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableMetricsQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTableMetricsQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableMetricsQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTableMetricsQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GuidedTableMetricsQuery'", e); + } + + // deserialize GuidedTableEventsQuery + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableEventsQuery.class.equals(Integer.class) + || GuidedTableEventsQuery.class.equals(Long.class) + || GuidedTableEventsQuery.class.equals(Float.class) + || GuidedTableEventsQuery.class.equals(Double.class) + || GuidedTableEventsQuery.class.equals(Boolean.class) + || GuidedTableEventsQuery.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableEventsQuery.class.equals(Integer.class) + || GuidedTableEventsQuery.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableEventsQuery.class.equals(Float.class) + || GuidedTableEventsQuery.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableEventsQuery.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableEventsQuery.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTableEventsQuery.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableEventsQuery) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTableEventsQuery'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GuidedTableEventsQuery'", e); + } + + GuidedTableQuery ret = new GuidedTableQuery(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableQuery getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GuidedTableQuery cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableQuery() { + super("oneOf", Boolean.FALSE); + } + + public GuidedTableQuery(GuidedTableMetricsQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableQuery(GuidedTableEventsQuery o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("GuidedTableMetricsQuery", new GenericType() {}); + schemas.put("GuidedTableEventsQuery", new GenericType() {}); + JSON.registerDescendants(GuidedTableQuery.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableQuery.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GuidedTableMetricsQuery, GuidedTableEventsQuery + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(GuidedTableMetricsQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GuidedTableEventsQuery.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be GuidedTableMetricsQuery, GuidedTableEventsQuery"); + } + + /** + * Get the actual instance, which can be the following: GuidedTableMetricsQuery, + * GuidedTableEventsQuery + * + * @return The actual instance (GuidedTableMetricsQuery, GuidedTableEventsQuery) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableMetricsQuery`. If the actual instance is not + * `GuidedTableMetricsQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableMetricsQuery` + * @throws ClassCastException if the instance is not `GuidedTableMetricsQuery` + */ + public GuidedTableMetricsQuery getGuidedTableMetricsQuery() throws ClassCastException { + return (GuidedTableMetricsQuery) super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableEventsQuery`. If the actual instance is not + * `GuidedTableEventsQuery`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableEventsQuery` + * @throws ClassCastException if the instance is not `GuidedTableEventsQuery` + */ + public GuidedTableEventsQuery getGuidedTableEventsQuery() throws ClassCastException { + return (GuidedTableEventsQuery) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRule.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRule.java new file mode 100644 index 00000000000..6ccb2fa8dd2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRule.java @@ -0,0 +1,298 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Formats values according to where they fall on a color scale. */ +@JsonPropertyOrder({ + GuidedTableRangeFormattingRule.JSON_PROPERTY_MAX, + GuidedTableRangeFormattingRule.JSON_PROPERTY_MIN, + GuidedTableRangeFormattingRule.JSON_PROPERTY_PALETTE, + GuidedTableRangeFormattingRule.JSON_PROPERTY_REVERSE, + GuidedTableRangeFormattingRule.JSON_PROPERTY_SCALE, + GuidedTableRangeFormattingRule.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableRangeFormattingRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_MAX = "max"; + private Double max; + + public static final String JSON_PROPERTY_MIN = "min"; + private Double min; + + public static final String JSON_PROPERTY_PALETTE = "palette"; + private GuidedTableRangePalette palette; + + public static final String JSON_PROPERTY_REVERSE = "reverse"; + private Boolean reverse; + + public static final String JSON_PROPERTY_SCALE = "scale"; + private GuidedTableRangeFormattingRuleScale scale; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GuidedTableRangeFormattingRuleType type; + + public GuidedTableRangeFormattingRule() {} + + @JsonCreator + public GuidedTableRangeFormattingRule( + @JsonProperty(required = true, value = JSON_PROPERTY_PALETTE) GuidedTableRangePalette palette, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + GuidedTableRangeFormattingRuleType type) { + this.palette = palette; + this.unparsed |= !palette.isValid(); + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GuidedTableRangeFormattingRule max(Double max) { + this.max = max; + return this; + } + + /** + * Maximum value on the mapping scale. + * + * @return max + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getMax() { + return max; + } + + public void setMax(Double max) { + this.max = max; + } + + public GuidedTableRangeFormattingRule min(Double min) { + this.min = min; + return this; + } + + /** + * Minimum value on the mapping scale. + * + * @return min + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getMin() { + return min; + } + + public void setMin(Double min) { + this.min = min; + } + + public GuidedTableRangeFormattingRule palette(GuidedTableRangePalette palette) { + this.palette = palette; + this.unparsed |= !palette.isValid(); + return this; + } + + /** + * Color palette used by range-based conditional formatting rules. + * + * @return palette + */ + @JsonProperty(JSON_PROPERTY_PALETTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableRangePalette getPalette() { + return palette; + } + + public void setPalette(GuidedTableRangePalette palette) { + if (!palette.isValid()) { + this.unparsed = true; + } + this.palette = palette; + } + + public GuidedTableRangeFormattingRule reverse(Boolean reverse) { + this.reverse = reverse; + return this; + } + + /** + * Whether to reverse the palette scale direction. + * + * @return reverse + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REVERSE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getReverse() { + return reverse; + } + + public void setReverse(Boolean reverse) { + this.reverse = reverse; + } + + public GuidedTableRangeFormattingRule scale(GuidedTableRangeFormattingRuleScale scale) { + this.scale = scale; + this.unparsed |= !scale.isValid(); + return this; + } + + /** + * Scale function for mapping values to colors. + * + * @return scale + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableRangeFormattingRuleScale getScale() { + return scale; + } + + public void setScale(GuidedTableRangeFormattingRuleScale scale) { + if (!scale.isValid()) { + this.unparsed = true; + } + this.scale = scale; + } + + public GuidedTableRangeFormattingRule type(GuidedTableRangeFormattingRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Gettype + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableRangeFormattingRuleType getType() { + return type; + } + + public void setType(GuidedTableRangeFormattingRuleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * 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 GuidedTableRangeFormattingRule + */ + @JsonAnySetter + public GuidedTableRangeFormattingRule 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 GuidedTableRangeFormattingRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableRangeFormattingRule guidedTableRangeFormattingRule = + (GuidedTableRangeFormattingRule) o; + return Objects.equals(this.max, guidedTableRangeFormattingRule.max) + && Objects.equals(this.min, guidedTableRangeFormattingRule.min) + && Objects.equals(this.palette, guidedTableRangeFormattingRule.palette) + && Objects.equals(this.reverse, guidedTableRangeFormattingRule.reverse) + && Objects.equals(this.scale, guidedTableRangeFormattingRule.scale) + && Objects.equals(this.type, guidedTableRangeFormattingRule.type) + && Objects.equals( + this.additionalProperties, guidedTableRangeFormattingRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(max, min, palette, reverse, scale, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableRangeFormattingRule {\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" palette: ").append(toIndentedString(palette)).append("\n"); + sb.append(" reverse: ").append(toIndentedString(reverse)).append("\n"); + sb.append(" scale: ").append(toIndentedString(scale)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRuleScale.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRuleScale.java new file mode 100644 index 00000000000..0b286c6024d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRuleScale.java @@ -0,0 +1,65 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Scale function for mapping values to colors. */ +@JsonSerialize( + using = GuidedTableRangeFormattingRuleScale.GuidedTableRangeFormattingRuleScaleSerializer.class) +public class GuidedTableRangeFormattingRuleScale extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("linear", "log", "pow", "sqrt")); + + public static final GuidedTableRangeFormattingRuleScale LINEAR = + new GuidedTableRangeFormattingRuleScale("linear"); + public static final GuidedTableRangeFormattingRuleScale LOG = + new GuidedTableRangeFormattingRuleScale("log"); + public static final GuidedTableRangeFormattingRuleScale POW = + new GuidedTableRangeFormattingRuleScale("pow"); + public static final GuidedTableRangeFormattingRuleScale SQRT = + new GuidedTableRangeFormattingRuleScale("sqrt"); + + GuidedTableRangeFormattingRuleScale(String value) { + super(value, allowedValues); + } + + public static class GuidedTableRangeFormattingRuleScaleSerializer + extends StdSerializer { + public GuidedTableRangeFormattingRuleScaleSerializer( + Class t) { + super(t); + } + + public GuidedTableRangeFormattingRuleScaleSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableRangeFormattingRuleScale value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableRangeFormattingRuleScale fromValue(String value) { + return new GuidedTableRangeFormattingRuleScale(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRuleType.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRuleType.java new file mode 100644 index 00000000000..54c4db771ba --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangeFormattingRuleType.java @@ -0,0 +1,58 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize( + using = GuidedTableRangeFormattingRuleType.GuidedTableRangeFormattingRuleTypeSerializer.class) +public class GuidedTableRangeFormattingRuleType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("range")); + + public static final GuidedTableRangeFormattingRuleType RANGE = + new GuidedTableRangeFormattingRuleType("range"); + + GuidedTableRangeFormattingRuleType(String value) { + super(value, allowedValues); + } + + public static class GuidedTableRangeFormattingRuleTypeSerializer + extends StdSerializer { + public GuidedTableRangeFormattingRuleTypeSerializer( + Class t) { + super(t); + } + + public GuidedTableRangeFormattingRuleTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableRangeFormattingRuleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableRangeFormattingRuleType fromValue(String value) { + return new GuidedTableRangeFormattingRuleType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangePalette.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangePalette.java new file mode 100644 index 00000000000..a9002d04da0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRangePalette.java @@ -0,0 +1,92 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Color palette used by range-based conditional formatting rules. */ +@JsonSerialize(using = GuidedTableRangePalette.GuidedTableRangePaletteSerializer.class) +public class GuidedTableRangePalette extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "transparent_to_green", + "transparent_to_orange", + "transparent_to_red", + "transparent_to_blue", + "red_transparent_green", + "red_transparent_blue", + "vivid_transparent_to_green", + "vivid_transparent_to_orange", + "vivid_transparent_to_red", + "vivid_transparent_to_blue", + "vivid_red_transparent_green", + "vivid_red_transparent_blue")); + + public static final GuidedTableRangePalette TRANSPARENT_TO_GREEN = + new GuidedTableRangePalette("transparent_to_green"); + public static final GuidedTableRangePalette TRANSPARENT_TO_ORANGE = + new GuidedTableRangePalette("transparent_to_orange"); + public static final GuidedTableRangePalette TRANSPARENT_TO_RED = + new GuidedTableRangePalette("transparent_to_red"); + public static final GuidedTableRangePalette TRANSPARENT_TO_BLUE = + new GuidedTableRangePalette("transparent_to_blue"); + public static final GuidedTableRangePalette RED_TRANSPARENT_GREEN = + new GuidedTableRangePalette("red_transparent_green"); + public static final GuidedTableRangePalette RED_TRANSPARENT_BLUE = + new GuidedTableRangePalette("red_transparent_blue"); + public static final GuidedTableRangePalette VIVID_TRANSPARENT_TO_GREEN = + new GuidedTableRangePalette("vivid_transparent_to_green"); + public static final GuidedTableRangePalette VIVID_TRANSPARENT_TO_ORANGE = + new GuidedTableRangePalette("vivid_transparent_to_orange"); + public static final GuidedTableRangePalette VIVID_TRANSPARENT_TO_RED = + new GuidedTableRangePalette("vivid_transparent_to_red"); + public static final GuidedTableRangePalette VIVID_TRANSPARENT_TO_BLUE = + new GuidedTableRangePalette("vivid_transparent_to_blue"); + public static final GuidedTableRangePalette VIVID_RED_TRANSPARENT_GREEN = + new GuidedTableRangePalette("vivid_red_transparent_green"); + public static final GuidedTableRangePalette VIVID_RED_TRANSPARENT_BLUE = + new GuidedTableRangePalette("vivid_red_transparent_blue"); + + GuidedTableRangePalette(String value) { + super(value, allowedValues); + } + + public static class GuidedTableRangePaletteSerializer + extends StdSerializer { + public GuidedTableRangePaletteSerializer(Class t) { + super(t); + } + + public GuidedTableRangePaletteSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableRangePalette value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableRangePalette fromValue(String value) { + return new GuidedTableRangePalette(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRequest.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRequest.java new file mode 100644 index 00000000000..3348d2c40f2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRequest.java @@ -0,0 +1,262 @@ +/* + * 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; + +/** + * Request definition for the guided table widget — a structured, guided format for defining a table + * of data. Used when the graphing_new_table_widget_editor feature flag is enabled; + * otherwise use the classic TableWidgetRequest. Defines base queries, how to produce + * rows, and how to compute columns. + */ +@JsonPropertyOrder({ + GuidedTableRequest.JSON_PROPERTY_COLUMNS, + GuidedTableRequest.JSON_PROPERTY_QUERIES, + GuidedTableRequest.JSON_PROPERTY_REQUEST_TYPE, + GuidedTableRequest.JSON_PROPERTY_ROWS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COLUMNS = "columns"; + private List columns = new ArrayList<>(); + + public static final String JSON_PROPERTY_QUERIES = "queries"; + private List queries = new ArrayList<>(); + + public static final String JSON_PROPERTY_REQUEST_TYPE = "request_type"; + private GuidedTableRequestRequestType requestType; + + public static final String JSON_PROPERTY_ROWS = "rows"; + private GuidedTableRows rows; + + public GuidedTableRequest() {} + + @JsonCreator + public GuidedTableRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_COLUMNS) List columns, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERIES) List queries, + @JsonProperty(required = true, value = JSON_PROPERTY_REQUEST_TYPE) + GuidedTableRequestRequestType requestType, + @JsonProperty(required = true, value = JSON_PROPERTY_ROWS) GuidedTableRows rows) { + this.columns = columns; + this.queries = queries; + this.requestType = requestType; + this.unparsed |= !requestType.isValid(); + this.rows = rows; + this.unparsed |= rows.unparsed; + } + + public GuidedTableRequest columns(List columns) { + this.columns = columns; + for (GuidedTableColumn item : columns) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTableRequest addColumnsItem(GuidedTableColumn columnsItem) { + this.columns.add(columnsItem); + this.unparsed |= columnsItem.unparsed; + return this; + } + + /** + * Column definitions that describe how to compute and display table values. + * + * @return columns + */ + @JsonProperty(JSON_PROPERTY_COLUMNS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getColumns() { + return columns; + } + + public void setColumns(List columns) { + this.columns = columns; + } + + public GuidedTableRequest queries(List queries) { + this.queries = queries; + for (GuidedTableQuery item : queries) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTableRequest addQueriesItem(GuidedTableQuery queriesItem) { + this.queries.add(queriesItem); + this.unparsed |= queriesItem.unparsed; + return this; + } + + /** + * Base queries that provide the source data for the table. + * + * @return queries + */ + @JsonProperty(JSON_PROPERTY_QUERIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getQueries() { + return queries; + } + + public void setQueries(List queries) { + this.queries = queries; + } + + public GuidedTableRequest requestType(GuidedTableRequestRequestType requestType) { + this.requestType = requestType; + this.unparsed |= !requestType.isValid(); + return this; + } + + /** + * Identifies this as a guided table request. + * + * @return requestType + */ + @JsonProperty(JSON_PROPERTY_REQUEST_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableRequestRequestType getRequestType() { + return requestType; + } + + public void setRequestType(GuidedTableRequestRequestType requestType) { + if (!requestType.isValid()) { + this.unparsed = true; + } + this.requestType = requestType; + } + + public GuidedTableRequest rows(GuidedTableRows rows) { + this.rows = rows; + this.unparsed |= rows.unparsed; + return this; + } + + /** + * Defines how to compute the rows of a guided table. + * + * @return rows + */ + @JsonProperty(JSON_PROPERTY_ROWS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableRows getRows() { + return rows; + } + + public void setRows(GuidedTableRows rows) { + this.rows = rows; + } + + /** + * 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 GuidedTableRequest + */ + @JsonAnySetter + public GuidedTableRequest 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 GuidedTableRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableRequest guidedTableRequest = (GuidedTableRequest) o; + return Objects.equals(this.columns, guidedTableRequest.columns) + && Objects.equals(this.queries, guidedTableRequest.queries) + && Objects.equals(this.requestType, guidedTableRequest.requestType) + && Objects.equals(this.rows, guidedTableRequest.rows) + && Objects.equals(this.additionalProperties, guidedTableRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(columns, queries, requestType, rows, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableRequest {\n"); + sb.append(" columns: ").append(toIndentedString(columns)).append("\n"); + sb.append(" queries: ").append(toIndentedString(queries)).append("\n"); + sb.append(" requestType: ").append(toIndentedString(requestType)).append("\n"); + sb.append(" rows: ").append(toIndentedString(rows)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRequestRequestType.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRequestRequestType.java new file mode 100644 index 00000000000..0c54067562c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRequestRequestType.java @@ -0,0 +1,56 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Identifies this as a guided table request. */ +@JsonSerialize(using = GuidedTableRequestRequestType.GuidedTableRequestRequestTypeSerializer.class) +public class GuidedTableRequestRequestType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("table")); + + public static final GuidedTableRequestRequestType TABLE = + new GuidedTableRequestRequestType("table"); + + GuidedTableRequestRequestType(String value) { + super(value, allowedValues); + } + + public static class GuidedTableRequestRequestTypeSerializer + extends StdSerializer { + public GuidedTableRequestRequestTypeSerializer(Class t) { + super(t); + } + + public GuidedTableRequestRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableRequestRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableRequestRequestType fromValue(String value) { + return new GuidedTableRequestRequestType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRowGroupBy.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRowGroupBy.java new file mode 100644 index 00000000000..b3086547835 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRowGroupBy.java @@ -0,0 +1,268 @@ +/* + * 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; + +/** Defines one group-by dimension used to produce the rows of a guided table. */ +@JsonPropertyOrder({ + GuidedTableRowGroupBy.JSON_PROPERTY_ALIAS, + GuidedTableRowGroupBy.JSON_PROPERTY_FORMAT, + GuidedTableRowGroupBy.JSON_PROPERTY_GROUP_KEYS, + GuidedTableRowGroupBy.JSON_PROPERTY_IS_HIDDEN, + GuidedTableRowGroupBy.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableRowGroupBy { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALIAS = "alias"; + private String alias; + + public static final String JSON_PROPERTY_FORMAT = "format"; + private GuidedTableRowGroupByFormat format; + + public static final String JSON_PROPERTY_GROUP_KEYS = "group_keys"; + private List groupKeys = new ArrayList<>(); + + public static final String JSON_PROPERTY_IS_HIDDEN = "is_hidden"; + private Boolean isHidden; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public GuidedTableRowGroupBy() {} + + @JsonCreator + public GuidedTableRowGroupBy( + @JsonProperty(required = true, value = JSON_PROPERTY_GROUP_KEYS) + List groupKeys, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.groupKeys = groupKeys; + this.name = name; + } + + public GuidedTableRowGroupBy alias(String alias) { + this.alias = alias; + return this; + } + + /** + * Display name used as the column header for this group-by. + * + * @return alias + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALIAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public GuidedTableRowGroupBy format(GuidedTableRowGroupByFormat format) { + this.format = format; + this.unparsed |= format.unparsed; + return this; + } + + /** + * Text formatting configuration for this group-by column. + * + * @return format + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FORMAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableRowGroupByFormat getFormat() { + return format; + } + + public void setFormat(GuidedTableRowGroupByFormat format) { + this.format = format; + } + + public GuidedTableRowGroupBy groupKeys(List groupKeys) { + this.groupKeys = groupKeys; + for (GuidedTableGroupKey item : groupKeys) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTableRowGroupBy addGroupKeysItem(GuidedTableGroupKey groupKeysItem) { + this.groupKeys.add(groupKeysItem); + this.unparsed |= groupKeysItem.unparsed; + return this; + } + + /** + * Mapping from each source query to the field name used as the grouping key. Different data + * sources may use different field names for the same concept. + * + * @return groupKeys + */ + @JsonProperty(JSON_PROPERTY_GROUP_KEYS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGroupKeys() { + return groupKeys; + } + + public void setGroupKeys(List groupKeys) { + this.groupKeys = groupKeys; + } + + public GuidedTableRowGroupBy isHidden(Boolean isHidden) { + this.isHidden = isHidden; + return this; + } + + /** + * Whether this group-by column is hidden in the rendered table. + * + * @return isHidden + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_HIDDEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsHidden() { + return isHidden; + } + + public void setIsHidden(Boolean isHidden) { + this.isHidden = isHidden; + } + + public GuidedTableRowGroupBy name(String name) { + this.name = name; + return this; + } + + /** + * Auto-generated name for this group-by parameter. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 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 GuidedTableRowGroupBy + */ + @JsonAnySetter + public GuidedTableRowGroupBy 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 GuidedTableRowGroupBy object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableRowGroupBy guidedTableRowGroupBy = (GuidedTableRowGroupBy) o; + return Objects.equals(this.alias, guidedTableRowGroupBy.alias) + && Objects.equals(this.format, guidedTableRowGroupBy.format) + && Objects.equals(this.groupKeys, guidedTableRowGroupBy.groupKeys) + && Objects.equals(this.isHidden, guidedTableRowGroupBy.isHidden) + && Objects.equals(this.name, guidedTableRowGroupBy.name) + && Objects.equals(this.additionalProperties, guidedTableRowGroupBy.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(alias, format, groupKeys, isHidden, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableRowGroupBy {\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" groupKeys: ").append(toIndentedString(groupKeys)).append("\n"); + sb.append(" isHidden: ").append(toIndentedString(isHidden)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRowGroupByFormat.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRowGroupByFormat.java new file mode 100644 index 00000000000..c33c7b391ce --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRowGroupByFormat.java @@ -0,0 +1,151 @@ +/* + * 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.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; + +/** Text formatting configuration for this group-by column. */ +@JsonPropertyOrder({GuidedTableRowGroupByFormat.JSON_PROPERTY_TEXT_FORMATS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableRowGroupByFormat { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TEXT_FORMATS = "text_formats"; + private List textFormats = null; + + public GuidedTableRowGroupByFormat textFormats(List textFormats) { + this.textFormats = textFormats; + for (GuidedTableTextFormattingRule item : textFormats) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTableRowGroupByFormat addTextFormatsItem( + GuidedTableTextFormattingRule textFormatsItem) { + if (this.textFormats == null) { + this.textFormats = new ArrayList<>(); + } + this.textFormats.add(textFormatsItem); + this.unparsed |= textFormatsItem.unparsed; + return this; + } + + /** + * GettextFormats + * + * @return textFormats + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEXT_FORMATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTextFormats() { + return textFormats; + } + + public void setTextFormats(List textFormats) { + this.textFormats = textFormats; + } + + /** + * 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 GuidedTableRowGroupByFormat + */ + @JsonAnySetter + public GuidedTableRowGroupByFormat 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 GuidedTableRowGroupByFormat object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableRowGroupByFormat guidedTableRowGroupByFormat = (GuidedTableRowGroupByFormat) o; + return Objects.equals(this.textFormats, guidedTableRowGroupByFormat.textFormats) + && Objects.equals( + this.additionalProperties, guidedTableRowGroupByFormat.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(textFormats, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableRowGroupByFormat {\n"); + sb.append(" textFormats: ").append(toIndentedString(textFormats)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableRows.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRows.java new file mode 100644 index 00000000000..100896cf285 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableRows.java @@ -0,0 +1,184 @@ +/* + * 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; + +/** Defines how to compute the rows of a guided table. */ +@JsonPropertyOrder({GuidedTableRows.JSON_PROPERTY_GROUP_BY, GuidedTableRows.JSON_PROPERTY_SORT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableRows { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_GROUP_BY = "group_by"; + private List groupBy = new ArrayList<>(); + + public static final String JSON_PROPERTY_SORT = "sort"; + private GuidedTableSort sort; + + public GuidedTableRows() {} + + @JsonCreator + public GuidedTableRows( + @JsonProperty(required = true, value = JSON_PROPERTY_GROUP_BY) + List groupBy, + @JsonProperty(required = true, value = JSON_PROPERTY_SORT) GuidedTableSort sort) { + this.groupBy = groupBy; + this.sort = sort; + this.unparsed |= sort.unparsed; + } + + public GuidedTableRows groupBy(List groupBy) { + this.groupBy = groupBy; + for (GuidedTableRowGroupBy item : groupBy) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTableRows addGroupByItem(GuidedTableRowGroupBy groupByItem) { + this.groupBy.add(groupByItem); + this.unparsed |= groupByItem.unparsed; + return this; + } + + /** + * Grouping dimensions that form each row. Must be non-empty. + * + * @return groupBy + */ + @JsonProperty(JSON_PROPERTY_GROUP_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGroupBy() { + return groupBy; + } + + public void setGroupBy(List groupBy) { + this.groupBy = groupBy; + } + + public GuidedTableRows sort(GuidedTableSort sort) { + this.sort = sort; + this.unparsed |= sort.unparsed; + return this; + } + + /** + * Sort configuration for a guided table. + * + * @return sort + */ + @JsonProperty(JSON_PROPERTY_SORT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableSort getSort() { + return sort; + } + + public void setSort(GuidedTableSort sort) { + this.sort = sort; + } + + /** + * 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 GuidedTableRows + */ + @JsonAnySetter + public GuidedTableRows 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 GuidedTableRows object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableRows guidedTableRows = (GuidedTableRows) o; + return Objects.equals(this.groupBy, guidedTableRows.groupBy) + && Objects.equals(this.sort, guidedTableRows.sort) + && Objects.equals(this.additionalProperties, guidedTableRows.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(groupBy, sort, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableRows {\n"); + sb.append(" groupBy: ").append(toIndentedString(groupBy)).append("\n"); + sb.append(" sort: ").append(toIndentedString(sort)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableSort.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableSort.java new file mode 100644 index 00000000000..5c286bf94c5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableSort.java @@ -0,0 +1,181 @@ +/* + * 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; + +/** Sort configuration for a guided table. */ +@JsonPropertyOrder({GuidedTableSort.JSON_PROPERTY_COLUMNS, GuidedTableSort.JSON_PROPERTY_LIMIT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableSort { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COLUMNS = "columns"; + private List columns = new ArrayList<>(); + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public GuidedTableSort() {} + + @JsonCreator + public GuidedTableSort( + @JsonProperty(required = true, value = JSON_PROPERTY_COLUMNS) List columns, + @JsonProperty(required = true, value = JSON_PROPERTY_LIMIT) Long limit) { + this.columns = columns; + this.limit = limit; + } + + public GuidedTableSort columns(List columns) { + this.columns = columns; + for (WidgetFieldSort item : columns) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GuidedTableSort addColumnsItem(WidgetFieldSort columnsItem) { + this.columns.add(columnsItem); + this.unparsed |= columnsItem.unparsed; + return this; + } + + /** + * Columns to sort by, in order of application. + * + * @return columns + */ + @JsonProperty(JSON_PROPERTY_COLUMNS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getColumns() { + return columns; + } + + public void setColumns(List columns) { + this.columns = columns; + } + + public GuidedTableSort limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Maximum number of rows to show after sorting. minimum: 1 + * + * @return limit + */ + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + /** + * 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 GuidedTableSort + */ + @JsonAnySetter + public GuidedTableSort 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 GuidedTableSort object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableSort guidedTableSort = (GuidedTableSort) o; + return Objects.equals(this.columns, guidedTableSort.columns) + && Objects.equals(this.limit, guidedTableSort.limit) + && Objects.equals(this.additionalProperties, guidedTableSort.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(columns, limit, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableSort {\n"); + sb.append(" columns: ").append(toIndentedString(columns)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableStorageType.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableStorageType.java new file mode 100644 index 00000000000..cd6d8c254f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableStorageType.java @@ -0,0 +1,72 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Storage tier to target for an events-platform query in a guided table. */ +@JsonSerialize(using = GuidedTableStorageType.GuidedTableStorageTypeSerializer.class) +public class GuidedTableStorageType extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "live", + "hot", + "online_archives", + "driveline", + "flex_tier", + "case_insensitive", + "cloud_prem")); + + public static final GuidedTableStorageType LIVE = new GuidedTableStorageType("live"); + public static final GuidedTableStorageType HOT = new GuidedTableStorageType("hot"); + public static final GuidedTableStorageType ONLINE_ARCHIVES = + new GuidedTableStorageType("online_archives"); + public static final GuidedTableStorageType DRIVELINE = new GuidedTableStorageType("driveline"); + public static final GuidedTableStorageType FLEX_TIER = new GuidedTableStorageType("flex_tier"); + public static final GuidedTableStorageType CASE_INSENSITIVE = + new GuidedTableStorageType("case_insensitive"); + public static final GuidedTableStorageType CLOUD_PREM = new GuidedTableStorageType("cloud_prem"); + + GuidedTableStorageType(String value) { + super(value, allowedValues); + } + + public static class GuidedTableStorageTypeSerializer + extends StdSerializer { + public GuidedTableStorageTypeSerializer(Class t) { + super(t); + } + + public GuidedTableStorageTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableStorageType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableStorageType fromValue(String value) { + return new GuidedTableStorageType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRule.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRule.java new file mode 100644 index 00000000000..a1f5808353e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRule.java @@ -0,0 +1,264 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Rule for applying visual formatting to text values in a guided table group-by column. */ +@JsonPropertyOrder({ + GuidedTableTextFormattingRule.JSON_PROPERTY_CUSTOM_BG_COLOR, + GuidedTableTextFormattingRule.JSON_PROPERTY_CUSTOM_FG_COLOR, + GuidedTableTextFormattingRule.JSON_PROPERTY_MATCH, + GuidedTableTextFormattingRule.JSON_PROPERTY_PALETTE, + GuidedTableTextFormattingRule.JSON_PROPERTY_REPLACE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableTextFormattingRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CUSTOM_BG_COLOR = "custom_bg_color"; + private String customBgColor; + + public static final String JSON_PROPERTY_CUSTOM_FG_COLOR = "custom_fg_color"; + private String customFgColor; + + public static final String JSON_PROPERTY_MATCH = "match"; + private TableWidgetTextFormatMatch match; + + public static final String JSON_PROPERTY_PALETTE = "palette"; + private GuidedTableThresholdPalette palette; + + public static final String JSON_PROPERTY_REPLACE = "replace"; + private GuidedTableTextFormattingRuleReplace replace; + + public GuidedTableTextFormattingRule() {} + + @JsonCreator + public GuidedTableTextFormattingRule( + @JsonProperty(required = true, value = JSON_PROPERTY_MATCH) + TableWidgetTextFormatMatch match) { + this.match = match; + this.unparsed |= match.unparsed; + } + + public GuidedTableTextFormattingRule customBgColor(String customBgColor) { + this.customBgColor = customBgColor; + return this; + } + + /** + * Custom background color hex code. Used with custom_bg palette. + * + * @return customBgColor + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_BG_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomBgColor() { + return customBgColor; + } + + public void setCustomBgColor(String customBgColor) { + this.customBgColor = customBgColor; + } + + public GuidedTableTextFormattingRule customFgColor(String customFgColor) { + this.customFgColor = customFgColor; + return this; + } + + /** + * Custom text color hex code. Used with custom_text palette. + * + * @return customFgColor + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_FG_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomFgColor() { + return customFgColor; + } + + public void setCustomFgColor(String customFgColor) { + this.customFgColor = customFgColor; + } + + public GuidedTableTextFormattingRule match(TableWidgetTextFormatMatch match) { + this.match = match; + this.unparsed |= match.unparsed; + return this; + } + + /** + * Match rule for the table widget text format. + * + * @return match + */ + @JsonProperty(JSON_PROPERTY_MATCH) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TableWidgetTextFormatMatch getMatch() { + return match; + } + + public void setMatch(TableWidgetTextFormatMatch match) { + this.match = match; + } + + public GuidedTableTextFormattingRule palette(GuidedTableThresholdPalette palette) { + this.palette = palette; + this.unparsed |= !palette.isValid(); + return this; + } + + /** + * Color palette used by threshold-based conditional formatting and text formatting rules in a + * guided table. + * + * @return palette + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PALETTE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableThresholdPalette getPalette() { + return palette; + } + + public void setPalette(GuidedTableThresholdPalette palette) { + if (!palette.isValid()) { + this.unparsed = true; + } + this.palette = palette; + } + + public GuidedTableTextFormattingRule replace(GuidedTableTextFormattingRuleReplace replace) { + this.replace = replace; + this.unparsed |= replace.unparsed; + return this; + } + + /** + * Optional replacement to apply to matched text. + * + * @return replace + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REPLACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableTextFormattingRuleReplace getReplace() { + return replace; + } + + public void setReplace(GuidedTableTextFormattingRuleReplace replace) { + this.replace = replace; + } + + /** + * 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 GuidedTableTextFormattingRule + */ + @JsonAnySetter + public GuidedTableTextFormattingRule 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 GuidedTableTextFormattingRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableTextFormattingRule guidedTableTextFormattingRule = (GuidedTableTextFormattingRule) o; + return Objects.equals(this.customBgColor, guidedTableTextFormattingRule.customBgColor) + && Objects.equals(this.customFgColor, guidedTableTextFormattingRule.customFgColor) + && Objects.equals(this.match, guidedTableTextFormattingRule.match) + && Objects.equals(this.palette, guidedTableTextFormattingRule.palette) + && Objects.equals(this.replace, guidedTableTextFormattingRule.replace) + && Objects.equals( + this.additionalProperties, guidedTableTextFormattingRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + customBgColor, customFgColor, match, palette, replace, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableTextFormattingRule {\n"); + sb.append(" customBgColor: ").append(toIndentedString(customBgColor)).append("\n"); + sb.append(" customFgColor: ").append(toIndentedString(customFgColor)).append("\n"); + sb.append(" match: ").append(toIndentedString(match)).append("\n"); + sb.append(" palette: ").append(toIndentedString(palette)).append("\n"); + sb.append(" replace: ").append(toIndentedString(replace)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRuleReplace.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRuleReplace.java new file mode 100644 index 00000000000..3b1259e6f56 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRuleReplace.java @@ -0,0 +1,309 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + GuidedTableTextFormattingRuleReplace.GuidedTableTextFormattingRuleReplaceDeserializer.class) +@JsonSerialize( + using = + GuidedTableTextFormattingRuleReplace.GuidedTableTextFormattingRuleReplaceSerializer.class) +public class GuidedTableTextFormattingRuleReplace extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GuidedTableTextFormattingRuleReplace.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableTextFormattingRuleReplaceSerializer + extends StdSerializer { + public GuidedTableTextFormattingRuleReplaceSerializer( + Class t) { + super(t); + } + + public GuidedTableTextFormattingRuleReplaceSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableTextFormattingRuleReplace value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableTextFormattingRuleReplaceDeserializer + extends StdDeserializer { + public GuidedTableTextFormattingRuleReplaceDeserializer() { + this(GuidedTableTextFormattingRuleReplace.class); + } + + public GuidedTableTextFormattingRuleReplaceDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableTextFormattingRuleReplace deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize TableWidgetTextFormatReplaceAll + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TableWidgetTextFormatReplaceAll.class.equals(Integer.class) + || TableWidgetTextFormatReplaceAll.class.equals(Long.class) + || TableWidgetTextFormatReplaceAll.class.equals(Float.class) + || TableWidgetTextFormatReplaceAll.class.equals(Double.class) + || TableWidgetTextFormatReplaceAll.class.equals(Boolean.class) + || TableWidgetTextFormatReplaceAll.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TableWidgetTextFormatReplaceAll.class.equals(Integer.class) + || TableWidgetTextFormatReplaceAll.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TableWidgetTextFormatReplaceAll.class.equals(Float.class) + || TableWidgetTextFormatReplaceAll.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TableWidgetTextFormatReplaceAll.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TableWidgetTextFormatReplaceAll.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TableWidgetTextFormatReplaceAll.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((TableWidgetTextFormatReplaceAll) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TableWidgetTextFormatReplaceAll'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'TableWidgetTextFormatReplaceAll'", e); + } + + // deserialize GuidedTableTextFormattingRuleReplaceSubstring + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Integer.class) + || GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Long.class) + || GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Float.class) + || GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Double.class) + || GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Boolean.class) + || GuidedTableTextFormattingRuleReplaceSubstring.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Integer.class) + || GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Float.class) + || GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableTextFormattingRuleReplaceSubstring.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableTextFormattingRuleReplaceSubstring.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(GuidedTableTextFormattingRuleReplaceSubstring.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableTextFormattingRuleReplaceSubstring) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'GuidedTableTextFormattingRuleReplaceSubstring'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'GuidedTableTextFormattingRuleReplaceSubstring'", + e); + } + + GuidedTableTextFormattingRuleReplace ret = new GuidedTableTextFormattingRuleReplace(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableTextFormattingRuleReplace getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GuidedTableTextFormattingRuleReplace cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableTextFormattingRuleReplace() { + super("oneOf", Boolean.FALSE); + } + + public GuidedTableTextFormattingRuleReplace(TableWidgetTextFormatReplaceAll o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableTextFormattingRuleReplace(GuidedTableTextFormattingRuleReplaceSubstring o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "TableWidgetTextFormatReplaceAll", new GenericType() {}); + schemas.put( + "GuidedTableTextFormattingRuleReplaceSubstring", + new GenericType() {}); + JSON.registerDescendants( + GuidedTableTextFormattingRuleReplace.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableTextFormattingRuleReplace.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: TableWidgetTextFormatReplaceAll, + * GuidedTableTextFormattingRuleReplaceSubstring + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + TableWidgetTextFormatReplaceAll.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + GuidedTableTextFormattingRuleReplaceSubstring.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be TableWidgetTextFormatReplaceAll," + + " GuidedTableTextFormattingRuleReplaceSubstring"); + } + + /** + * Get the actual instance, which can be the following: TableWidgetTextFormatReplaceAll, + * GuidedTableTextFormattingRuleReplaceSubstring + * + * @return The actual instance (TableWidgetTextFormatReplaceAll, + * GuidedTableTextFormattingRuleReplaceSubstring) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `TableWidgetTextFormatReplaceAll`. If the actual instance is not + * `TableWidgetTextFormatReplaceAll`, the ClassCastException will be thrown. + * + * @return The actual instance of `TableWidgetTextFormatReplaceAll` + * @throws ClassCastException if the instance is not `TableWidgetTextFormatReplaceAll` + */ + public TableWidgetTextFormatReplaceAll getTableWidgetTextFormatReplaceAll() + throws ClassCastException { + return (TableWidgetTextFormatReplaceAll) super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableTextFormattingRuleReplaceSubstring`. If the actual + * instance is not `GuidedTableTextFormattingRuleReplaceSubstring`, the ClassCastException will be + * thrown. + * + * @return The actual instance of `GuidedTableTextFormattingRuleReplaceSubstring` + * @throws ClassCastException if the instance is not + * `GuidedTableTextFormattingRuleReplaceSubstring` + */ + public GuidedTableTextFormattingRuleReplaceSubstring + getGuidedTableTextFormattingRuleReplaceSubstring() throws ClassCastException { + return (GuidedTableTextFormattingRuleReplaceSubstring) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRuleReplaceSubstring.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRuleReplaceSubstring.java new file mode 100644 index 00000000000..fc3611880b5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTextFormattingRuleReplaceSubstring.java @@ -0,0 +1,212 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Replace a specific substring. */ +@JsonPropertyOrder({ + GuidedTableTextFormattingRuleReplaceSubstring.JSON_PROPERTY_SUBSTRING, + GuidedTableTextFormattingRuleReplaceSubstring.JSON_PROPERTY_TYPE, + GuidedTableTextFormattingRuleReplaceSubstring.JSON_PROPERTY_WITH +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableTextFormattingRuleReplaceSubstring { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_SUBSTRING = "substring"; + private String substring; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TableWidgetTextFormatReplaceSubstringType type; + + public static final String JSON_PROPERTY_WITH = "with"; + private String with; + + public GuidedTableTextFormattingRuleReplaceSubstring() {} + + @JsonCreator + public GuidedTableTextFormattingRuleReplaceSubstring( + @JsonProperty(required = true, value = JSON_PROPERTY_SUBSTRING) String substring, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + TableWidgetTextFormatReplaceSubstringType type, + @JsonProperty(required = true, value = JSON_PROPERTY_WITH) String with) { + this.substring = substring; + this.type = type; + this.unparsed |= !type.isValid(); + this.with = with; + } + + public GuidedTableTextFormattingRuleReplaceSubstring substring(String substring) { + this.substring = substring; + return this; + } + + /** + * Getsubstring + * + * @return substring + */ + @JsonProperty(JSON_PROPERTY_SUBSTRING) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSubstring() { + return substring; + } + + public void setSubstring(String substring) { + this.substring = substring; + } + + public GuidedTableTextFormattingRuleReplaceSubstring type( + TableWidgetTextFormatReplaceSubstringType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Table widget text format replace sub-string type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TableWidgetTextFormatReplaceSubstringType getType() { + return type; + } + + public void setType(TableWidgetTextFormatReplaceSubstringType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public GuidedTableTextFormattingRuleReplaceSubstring with(String with) { + this.with = with; + return this; + } + + /** + * Getwith + * + * @return with + */ + @JsonProperty(JSON_PROPERTY_WITH) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getWith() { + return with; + } + + public void setWith(String with) { + this.with = with; + } + + /** + * 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 GuidedTableTextFormattingRuleReplaceSubstring + */ + @JsonAnySetter + public GuidedTableTextFormattingRuleReplaceSubstring 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 GuidedTableTextFormattingRuleReplaceSubstring object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableTextFormattingRuleReplaceSubstring guidedTableTextFormattingRuleReplaceSubstring = + (GuidedTableTextFormattingRuleReplaceSubstring) o; + return Objects.equals(this.substring, guidedTableTextFormattingRuleReplaceSubstring.substring) + && Objects.equals(this.type, guidedTableTextFormattingRuleReplaceSubstring.type) + && Objects.equals(this.with, guidedTableTextFormattingRuleReplaceSubstring.with) + && Objects.equals( + this.additionalProperties, + guidedTableTextFormattingRuleReplaceSubstring.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(substring, type, with, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableTextFormattingRuleReplaceSubstring {\n"); + sb.append(" substring: ").append(toIndentedString(substring)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" with: ").append(toIndentedString(with)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdFormattingRule.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdFormattingRule.java new file mode 100644 index 00000000000..bc1f8d0e815 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdFormattingRule.java @@ -0,0 +1,333 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Conditional formatting rule that applies when a value satisfies a threshold comparator condition. + */ +@JsonPropertyOrder({ + GuidedTableThresholdFormattingRule.JSON_PROPERTY_COMPARATOR, + GuidedTableThresholdFormattingRule.JSON_PROPERTY_CUSTOM_BG_COLOR, + GuidedTableThresholdFormattingRule.JSON_PROPERTY_CUSTOM_FG_COLOR, + GuidedTableThresholdFormattingRule.JSON_PROPERTY_HIDE_VALUE, + GuidedTableThresholdFormattingRule.JSON_PROPERTY_IMAGE_URL, + GuidedTableThresholdFormattingRule.JSON_PROPERTY_PALETTE, + GuidedTableThresholdFormattingRule.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableThresholdFormattingRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMPARATOR = "comparator"; + private WidgetComparator comparator; + + public static final String JSON_PROPERTY_CUSTOM_BG_COLOR = "custom_bg_color"; + private String customBgColor; + + public static final String JSON_PROPERTY_CUSTOM_FG_COLOR = "custom_fg_color"; + private String customFgColor; + + public static final String JSON_PROPERTY_HIDE_VALUE = "hide_value"; + private Boolean hideValue; + + public static final String JSON_PROPERTY_IMAGE_URL = "image_url"; + private String imageUrl; + + public static final String JSON_PROPERTY_PALETTE = "palette"; + private GuidedTableThresholdPalette palette; + + public static final String JSON_PROPERTY_VALUE = "value"; + private GuidedTableThresholdFormattingRuleValue value; + + public GuidedTableThresholdFormattingRule() {} + + @JsonCreator + public GuidedTableThresholdFormattingRule( + @JsonProperty(required = true, value = JSON_PROPERTY_COMPARATOR) WidgetComparator comparator, + @JsonProperty(required = true, value = JSON_PROPERTY_PALETTE) + GuidedTableThresholdPalette palette) { + this.comparator = comparator; + this.unparsed |= !comparator.isValid(); + this.palette = palette; + this.unparsed |= !palette.isValid(); + } + + public GuidedTableThresholdFormattingRule comparator(WidgetComparator comparator) { + this.comparator = comparator; + this.unparsed |= !comparator.isValid(); + return this; + } + + /** + * Comparator to apply. + * + * @return comparator + */ + @JsonProperty(JSON_PROPERTY_COMPARATOR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WidgetComparator getComparator() { + return comparator; + } + + public void setComparator(WidgetComparator comparator) { + if (!comparator.isValid()) { + this.unparsed = true; + } + this.comparator = comparator; + } + + public GuidedTableThresholdFormattingRule customBgColor(String customBgColor) { + this.customBgColor = customBgColor; + return this; + } + + /** + * Custom background color. Used with custom_bg palette. + * + * @return customBgColor + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_BG_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomBgColor() { + return customBgColor; + } + + public void setCustomBgColor(String customBgColor) { + this.customBgColor = customBgColor; + } + + public GuidedTableThresholdFormattingRule customFgColor(String customFgColor) { + this.customFgColor = customFgColor; + return this; + } + + /** + * Custom text color. Used with custom_text palette. + * + * @return customFgColor + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_FG_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomFgColor() { + return customFgColor; + } + + public void setCustomFgColor(String customFgColor) { + this.customFgColor = customFgColor; + } + + public GuidedTableThresholdFormattingRule hideValue(Boolean hideValue) { + this.hideValue = hideValue; + return this; + } + + /** + * Whether to hide the data value when this rule matches. + * + * @return hideValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HIDE_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getHideValue() { + return hideValue; + } + + public void setHideValue(Boolean hideValue) { + this.hideValue = hideValue; + } + + public GuidedTableThresholdFormattingRule imageUrl(String imageUrl) { + this.imageUrl = imageUrl; + return this; + } + + /** + * URL of an image to display as background. + * + * @return imageUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IMAGE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public GuidedTableThresholdFormattingRule palette(GuidedTableThresholdPalette palette) { + this.palette = palette; + this.unparsed |= !palette.isValid(); + return this; + } + + /** + * Color palette used by threshold-based conditional formatting and text formatting rules in a + * guided table. + * + * @return palette + */ + @JsonProperty(JSON_PROPERTY_PALETTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableThresholdPalette getPalette() { + return palette; + } + + public void setPalette(GuidedTableThresholdPalette palette) { + if (!palette.isValid()) { + this.unparsed = true; + } + this.palette = palette; + } + + public GuidedTableThresholdFormattingRule value(GuidedTableThresholdFormattingRuleValue value) { + this.value = value; + this.unparsed |= value.unparsed; + return this; + } + + /** + * Threshold value to compare against. + * + * @return value + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableThresholdFormattingRuleValue getValue() { + return value; + } + + public void setValue(GuidedTableThresholdFormattingRuleValue value) { + this.value = value; + } + + /** + * 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 GuidedTableThresholdFormattingRule + */ + @JsonAnySetter + public GuidedTableThresholdFormattingRule 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 GuidedTableThresholdFormattingRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableThresholdFormattingRule guidedTableThresholdFormattingRule = + (GuidedTableThresholdFormattingRule) o; + return Objects.equals(this.comparator, guidedTableThresholdFormattingRule.comparator) + && Objects.equals(this.customBgColor, guidedTableThresholdFormattingRule.customBgColor) + && Objects.equals(this.customFgColor, guidedTableThresholdFormattingRule.customFgColor) + && Objects.equals(this.hideValue, guidedTableThresholdFormattingRule.hideValue) + && Objects.equals(this.imageUrl, guidedTableThresholdFormattingRule.imageUrl) + && Objects.equals(this.palette, guidedTableThresholdFormattingRule.palette) + && Objects.equals(this.value, guidedTableThresholdFormattingRule.value) + && Objects.equals( + this.additionalProperties, guidedTableThresholdFormattingRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + comparator, + customBgColor, + customFgColor, + hideValue, + imageUrl, + palette, + value, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableThresholdFormattingRule {\n"); + sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); + sb.append(" customBgColor: ").append(toIndentedString(customBgColor)).append("\n"); + sb.append(" customFgColor: ").append(toIndentedString(customFgColor)).append("\n"); + sb.append(" hideValue: ").append(toIndentedString(hideValue)).append("\n"); + sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); + sb.append(" palette: ").append(toIndentedString(palette)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdFormattingRuleValue.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdFormattingRuleValue.java new file mode 100644 index 00000000000..98438b3b441 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdFormattingRuleValue.java @@ -0,0 +1,283 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + GuidedTableThresholdFormattingRuleValue.GuidedTableThresholdFormattingRuleValueDeserializer + .class) +@JsonSerialize( + using = + GuidedTableThresholdFormattingRuleValue.GuidedTableThresholdFormattingRuleValueSerializer + .class) +public class GuidedTableThresholdFormattingRuleValue extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GuidedTableThresholdFormattingRuleValue.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GuidedTableThresholdFormattingRuleValueSerializer + extends StdSerializer { + public GuidedTableThresholdFormattingRuleValueSerializer( + Class t) { + super(t); + } + + public GuidedTableThresholdFormattingRuleValueSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableThresholdFormattingRuleValue value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GuidedTableThresholdFormattingRuleValueDeserializer + extends StdDeserializer { + public GuidedTableThresholdFormattingRuleValueDeserializer() { + this(GuidedTableThresholdFormattingRuleValue.class); + } + + public GuidedTableThresholdFormattingRuleValueDeserializer(Class vc) { + super(vc); + } + + @Override + public GuidedTableThresholdFormattingRuleValue deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Double + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Double.class.equals(Integer.class) + || Double.class.equals(Long.class) + || Double.class.equals(Float.class) + || Double.class.equals(Double.class) + || Double.class.equals(Boolean.class) + || Double.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((Double.class.equals(Integer.class) || Double.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((Double.class.equals(Float.class) || Double.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (Double.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (Double.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(Double.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'Double'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Double'", e); + } + + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) + || String.class.equals(Long.class) + || String.class.equals(Float.class) + || String.class.equals(Double.class) + || String.class.equals(Boolean.class) + || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((String.class.equals(Integer.class) || String.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((String.class.equals(Float.class) || String.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (String.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + GuidedTableThresholdFormattingRuleValue ret = new GuidedTableThresholdFormattingRuleValue(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GuidedTableThresholdFormattingRuleValue getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GuidedTableThresholdFormattingRuleValue cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GuidedTableThresholdFormattingRuleValue() { + super("oneOf", Boolean.FALSE); + } + + public GuidedTableThresholdFormattingRuleValue(Double o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GuidedTableThresholdFormattingRuleValue(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Double", new GenericType() {}); + schemas.put("String", new GenericType() {}); + JSON.registerDescendants( + GuidedTableThresholdFormattingRuleValue.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GuidedTableThresholdFormattingRuleValue.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: Double, String + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Double.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be Double, String"); + } + + /** + * Get the actual instance, which can be the following: Double, String + * + * @return The actual instance (Double, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Double`. If the actual instance is not `Double`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Double` + * @throws ClassCastException if the instance is not `Double` + */ + public Double getDouble() throws ClassCastException { + return (Double) super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdPalette.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdPalette.java new file mode 100644 index 00000000000..1b2cbc44847 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableThresholdPalette.java @@ -0,0 +1,110 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Color palette used by threshold-based conditional formatting and text formatting rules in a + * guided table. + */ +@JsonSerialize(using = GuidedTableThresholdPalette.GuidedTableThresholdPaletteSerializer.class) +public class GuidedTableThresholdPalette extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "white_on_red", + "black_on_light_red", + "white_on_green", + "black_on_light_green", + "white_on_yellow", + "black_on_light_yellow", + "white_on_gray", + "green_on_white", + "yellow_on_white", + "red_on_white", + "gray_on_white", + "red", + "green", + "orange", + "gray", + "custom_bg", + "custom_text", + "custom_image")); + + public static final GuidedTableThresholdPalette WHITE_ON_RED = + new GuidedTableThresholdPalette("white_on_red"); + public static final GuidedTableThresholdPalette BLACK_ON_LIGHT_RED = + new GuidedTableThresholdPalette("black_on_light_red"); + public static final GuidedTableThresholdPalette WHITE_ON_GREEN = + new GuidedTableThresholdPalette("white_on_green"); + public static final GuidedTableThresholdPalette BLACK_ON_LIGHT_GREEN = + new GuidedTableThresholdPalette("black_on_light_green"); + public static final GuidedTableThresholdPalette WHITE_ON_YELLOW = + new GuidedTableThresholdPalette("white_on_yellow"); + public static final GuidedTableThresholdPalette BLACK_ON_LIGHT_YELLOW = + new GuidedTableThresholdPalette("black_on_light_yellow"); + public static final GuidedTableThresholdPalette WHITE_ON_GRAY = + new GuidedTableThresholdPalette("white_on_gray"); + public static final GuidedTableThresholdPalette GREEN_ON_WHITE = + new GuidedTableThresholdPalette("green_on_white"); + public static final GuidedTableThresholdPalette YELLOW_ON_WHITE = + new GuidedTableThresholdPalette("yellow_on_white"); + public static final GuidedTableThresholdPalette RED_ON_WHITE = + new GuidedTableThresholdPalette("red_on_white"); + public static final GuidedTableThresholdPalette GRAY_ON_WHITE = + new GuidedTableThresholdPalette("gray_on_white"); + public static final GuidedTableThresholdPalette RED = new GuidedTableThresholdPalette("red"); + public static final GuidedTableThresholdPalette GREEN = new GuidedTableThresholdPalette("green"); + public static final GuidedTableThresholdPalette ORANGE = + new GuidedTableThresholdPalette("orange"); + public static final GuidedTableThresholdPalette GRAY = new GuidedTableThresholdPalette("gray"); + public static final GuidedTableThresholdPalette CUSTOM_BG = + new GuidedTableThresholdPalette("custom_bg"); + public static final GuidedTableThresholdPalette CUSTOM_TEXT = + new GuidedTableThresholdPalette("custom_text"); + public static final GuidedTableThresholdPalette CUSTOM_IMAGE = + new GuidedTableThresholdPalette("custom_image"); + + GuidedTableThresholdPalette(String value) { + super(value, allowedValues); + } + + public static class GuidedTableThresholdPaletteSerializer + extends StdSerializer { + public GuidedTableThresholdPaletteSerializer(Class t) { + super(t); + } + + public GuidedTableThresholdPaletteSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableThresholdPalette value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableThresholdPalette fromValue(String value) { + return new GuidedTableThresholdPalette(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableTrendColumnFormat.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTrendColumnFormat.java new file mode 100644 index 00000000000..d632b047b9b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTrendColumnFormat.java @@ -0,0 +1,243 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Formats a guided table column as a trend sparkline. */ +@JsonPropertyOrder({ + GuidedTableTrendColumnFormat.JSON_PROPERTY_CONDITIONAL_FORMATS, + GuidedTableTrendColumnFormat.JSON_PROPERTY_MODE, + GuidedTableTrendColumnFormat.JSON_PROPERTY_NUMBER_FORMAT, + GuidedTableTrendColumnFormat.JSON_PROPERTY_TREND_OPTIONS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuidedTableTrendColumnFormat { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONDITIONAL_FORMATS = "conditional_formats"; + private GuidedTableConditionalFormats conditionalFormats; + + public static final String JSON_PROPERTY_MODE = "mode"; + private GuidedTableTrendColumnFormatMode mode; + + public static final String JSON_PROPERTY_NUMBER_FORMAT = "number_format"; + private GuidedTableNumberFormat numberFormat; + + public static final String JSON_PROPERTY_TREND_OPTIONS = "trend_options"; + private WidgetFormulaCellDisplayModeOptions trendOptions; + + public GuidedTableTrendColumnFormat() {} + + @JsonCreator + public GuidedTableTrendColumnFormat( + @JsonProperty(required = true, value = JSON_PROPERTY_MODE) + GuidedTableTrendColumnFormatMode mode, + @JsonProperty(required = true, value = JSON_PROPERTY_TREND_OPTIONS) + WidgetFormulaCellDisplayModeOptions trendOptions) { + this.mode = mode; + this.unparsed |= !mode.isValid(); + this.trendOptions = trendOptions; + this.unparsed |= trendOptions.unparsed; + } + + public GuidedTableTrendColumnFormat conditionalFormats( + GuidedTableConditionalFormats conditionalFormats) { + this.conditionalFormats = conditionalFormats; + this.unparsed |= conditionalFormats.unparsed; + return this; + } + + /** + * Conditional formatting rules for a guided table column. Either an array of threshold-based + * rules or a single range-based rule. + * + * @return conditionalFormats + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONDITIONAL_FORMATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableConditionalFormats getConditionalFormats() { + return conditionalFormats; + } + + public void setConditionalFormats(GuidedTableConditionalFormats conditionalFormats) { + this.conditionalFormats = conditionalFormats; + } + + public GuidedTableTrendColumnFormat mode(GuidedTableTrendColumnFormatMode mode) { + this.mode = mode; + this.unparsed |= !mode.isValid(); + return this; + } + + /** + * Getmode + * + * @return mode + */ + @JsonProperty(JSON_PROPERTY_MODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuidedTableTrendColumnFormatMode getMode() { + return mode; + } + + public void setMode(GuidedTableTrendColumnFormatMode mode) { + if (!mode.isValid()) { + this.unparsed = true; + } + this.mode = mode; + } + + public GuidedTableTrendColumnFormat numberFormat(GuidedTableNumberFormat numberFormat) { + this.numberFormat = numberFormat; + this.unparsed |= numberFormat.unparsed; + return this; + } + + /** + * Number display format for a guided table column value. + * + * @return numberFormat + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NUMBER_FORMAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GuidedTableNumberFormat getNumberFormat() { + return numberFormat; + } + + public void setNumberFormat(GuidedTableNumberFormat numberFormat) { + this.numberFormat = numberFormat; + } + + public GuidedTableTrendColumnFormat trendOptions( + WidgetFormulaCellDisplayModeOptions trendOptions) { + this.trendOptions = trendOptions; + this.unparsed |= trendOptions.unparsed; + return this; + } + + /** + * Cell display mode options for the widget formula. (only if cell_display_mode is + * set to trend). + * + * @return trendOptions + */ + @JsonProperty(JSON_PROPERTY_TREND_OPTIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WidgetFormulaCellDisplayModeOptions getTrendOptions() { + return trendOptions; + } + + public void setTrendOptions(WidgetFormulaCellDisplayModeOptions trendOptions) { + this.trendOptions = trendOptions; + } + + /** + * 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 GuidedTableTrendColumnFormat + */ + @JsonAnySetter + public GuidedTableTrendColumnFormat 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 GuidedTableTrendColumnFormat object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuidedTableTrendColumnFormat guidedTableTrendColumnFormat = (GuidedTableTrendColumnFormat) o; + return Objects.equals(this.conditionalFormats, guidedTableTrendColumnFormat.conditionalFormats) + && Objects.equals(this.mode, guidedTableTrendColumnFormat.mode) + && Objects.equals(this.numberFormat, guidedTableTrendColumnFormat.numberFormat) + && Objects.equals(this.trendOptions, guidedTableTrendColumnFormat.trendOptions) + && Objects.equals( + this.additionalProperties, guidedTableTrendColumnFormat.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(conditionalFormats, mode, numberFormat, trendOptions, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuidedTableTrendColumnFormat {\n"); + sb.append(" conditionalFormats: ").append(toIndentedString(conditionalFormats)).append("\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" numberFormat: ").append(toIndentedString(numberFormat)).append("\n"); + sb.append(" trendOptions: ").append(toIndentedString(trendOptions)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GuidedTableTrendColumnFormatMode.java b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTrendColumnFormatMode.java new file mode 100644 index 00000000000..8bf149f1177 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GuidedTableTrendColumnFormatMode.java @@ -0,0 +1,57 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** */ +@JsonSerialize( + using = GuidedTableTrendColumnFormatMode.GuidedTableTrendColumnFormatModeSerializer.class) +public class GuidedTableTrendColumnFormatMode extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("trend")); + + public static final GuidedTableTrendColumnFormatMode TREND = + new GuidedTableTrendColumnFormatMode("trend"); + + GuidedTableTrendColumnFormatMode(String value) { + super(value, allowedValues); + } + + public static class GuidedTableTrendColumnFormatModeSerializer + extends StdSerializer { + public GuidedTableTrendColumnFormatModeSerializer(Class t) { + super(t); + } + + public GuidedTableTrendColumnFormatModeSerializer() { + this(null); + } + + @Override + public void serialize( + GuidedTableTrendColumnFormatMode value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuidedTableTrendColumnFormatMode fromValue(String value) { + return new GuidedTableTrendColumnFormatMode(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TableWidgetDefinition.java b/src/main/java/com/datadog/api/client/v1/model/TableWidgetDefinition.java index 9ddb43e9828..724af2bf3fc 100644 --- a/src/main/java/com/datadog/api/client/v1/model/TableWidgetDefinition.java +++ b/src/main/java/com/datadog/api/client/v1/model/TableWidgetDefinition.java @@ -44,7 +44,7 @@ public class TableWidgetDefinition { private TableWidgetHasSearchBar hasSearchBar; public static final String JSON_PROPERTY_REQUESTS = "requests"; - private List requests = new ArrayList<>(); + private List requests = new ArrayList<>(); public static final String JSON_PROPERTY_TIME = "time"; private WidgetTime time; @@ -65,8 +65,7 @@ public TableWidgetDefinition() {} @JsonCreator public TableWidgetDefinition( - @JsonProperty(required = true, value = JSON_PROPERTY_REQUESTS) - List requests, + @JsonProperty(required = true, value = JSON_PROPERTY_REQUESTS) List requests, @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TableWidgetDefinitionType type) { this.requests = requests; this.type = type; @@ -131,32 +130,34 @@ public void setHasSearchBar(TableWidgetHasSearchBar hasSearchBar) { this.hasSearchBar = hasSearchBar; } - public TableWidgetDefinition requests(List requests) { + public TableWidgetDefinition requests(List requests) { this.requests = requests; - for (TableWidgetRequest item : requests) { + for (Object item : requests) { this.unparsed |= item.unparsed; } return this; } - public TableWidgetDefinition addRequestsItem(TableWidgetRequest requestsItem) { + public TableWidgetDefinition addRequestsItem(Object requestsItem) { this.requests.add(requestsItem); this.unparsed |= requestsItem.unparsed; return this; } /** - * Widget definition. + * Widget definition. Each item is either a classic TableWidgetRequest or an + * experimental GuidedTableRequest (used when the + * graphing_new_table_widget_editor feature flag is enabled). * * @return requests */ @JsonProperty(JSON_PROPERTY_REQUESTS) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getRequests() { + public List getRequests() { return requests; } - public void setRequests(List requests) { + public void setRequests(List requests) { this.requests = requests; } diff --git a/src/main/java/com/datadog/api/client/v1/model/TableWidgetDefinitionrequestsItem.java b/src/main/java/com/datadog/api/client/v1/model/TableWidgetDefinitionrequestsItem.java new file mode 100644 index 00000000000..a3784eb57ae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TableWidgetDefinitionrequestsItem.java @@ -0,0 +1,283 @@ +/* + * 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.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = TableWidgetDefinitionrequestsItem.TableWidgetDefinitionrequestsItemDeserializer.class) +@JsonSerialize( + using = TableWidgetDefinitionrequestsItem.TableWidgetDefinitionrequestsItemSerializer.class) +public class TableWidgetDefinitionrequestsItem extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(TableWidgetDefinitionrequestsItem.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class TableWidgetDefinitionrequestsItemSerializer + extends StdSerializer { + public TableWidgetDefinitionrequestsItemSerializer(Class t) { + super(t); + } + + public TableWidgetDefinitionrequestsItemSerializer() { + this(null); + } + + @Override + public void serialize( + TableWidgetDefinitionrequestsItem value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TableWidgetDefinitionrequestsItemDeserializer + extends StdDeserializer { + public TableWidgetDefinitionrequestsItemDeserializer() { + this(TableWidgetDefinitionrequestsItem.class); + } + + public TableWidgetDefinitionrequestsItemDeserializer(Class vc) { + super(vc); + } + + @Override + public TableWidgetDefinitionrequestsItem deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize TableWidgetRequest + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TableWidgetRequest.class.equals(Integer.class) + || TableWidgetRequest.class.equals(Long.class) + || TableWidgetRequest.class.equals(Float.class) + || TableWidgetRequest.class.equals(Double.class) + || TableWidgetRequest.class.equals(Boolean.class) + || TableWidgetRequest.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TableWidgetRequest.class.equals(Integer.class) + || TableWidgetRequest.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TableWidgetRequest.class.equals(Float.class) + || TableWidgetRequest.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TableWidgetRequest.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TableWidgetRequest.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TableWidgetRequest.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((TableWidgetRequest) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TableWidgetRequest'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'TableWidgetRequest'", e); + } + + // deserialize GuidedTableRequest + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GuidedTableRequest.class.equals(Integer.class) + || GuidedTableRequest.class.equals(Long.class) + || GuidedTableRequest.class.equals(Float.class) + || GuidedTableRequest.class.equals(Double.class) + || GuidedTableRequest.class.equals(Boolean.class) + || GuidedTableRequest.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GuidedTableRequest.class.equals(Integer.class) + || GuidedTableRequest.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GuidedTableRequest.class.equals(Float.class) + || GuidedTableRequest.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GuidedTableRequest.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GuidedTableRequest.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(GuidedTableRequest.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GuidedTableRequest) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'GuidedTableRequest'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GuidedTableRequest'", e); + } + + TableWidgetDefinitionrequestsItem ret = new TableWidgetDefinitionrequestsItem(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public TableWidgetDefinitionrequestsItem getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "TableWidgetDefinitionrequestsItem cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public TableWidgetDefinitionrequestsItem() { + super("oneOf", Boolean.FALSE); + } + + public TableWidgetDefinitionrequestsItem(TableWidgetRequest o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TableWidgetDefinitionrequestsItem(GuidedTableRequest o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("TableWidgetRequest", new GenericType() {}); + schemas.put("GuidedTableRequest", new GenericType() {}); + JSON.registerDescendants( + TableWidgetDefinitionrequestsItem.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return TableWidgetDefinitionrequestsItem.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: TableWidgetRequest, GuidedTableRequest + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(TableWidgetRequest.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(GuidedTableRequest.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be TableWidgetRequest, GuidedTableRequest"); + } + + /** + * Get the actual instance, which can be the following: TableWidgetRequest, GuidedTableRequest + * + * @return The actual instance (TableWidgetRequest, GuidedTableRequest) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `TableWidgetRequest`. If the actual instance is not + * `TableWidgetRequest`, the ClassCastException will be thrown. + * + * @return The actual instance of `TableWidgetRequest` + * @throws ClassCastException if the instance is not `TableWidgetRequest` + */ + public TableWidgetRequest getTableWidgetRequest() throws ClassCastException { + return (TableWidgetRequest) super.getActualInstance(); + } + + /** + * Get the actual instance of `GuidedTableRequest`. If the actual instance is not + * `GuidedTableRequest`, the ClassCastException will be thrown. + * + * @return The actual instance of `GuidedTableRequest` + * @throws ClassCastException if the instance is not `GuidedTableRequest` + */ + public GuidedTableRequest getGuidedTableRequest() throws ClassCastException { + return (GuidedTableRequest) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index 6ea7df0811d..1d8927d8442 100644 --- a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java @@ -10087,6 +10087,22 @@ public ApiResponse listSecurityFindingsWithHttpInf new GenericType() {}); } + /** Manage optional parameters to listSecurityMonitoringCriticalAssets. */ + public static class ListSecurityMonitoringCriticalAssetsOptionalParameters { + private String query; + + /** + * Set query. + * + * @param query Query string. (optional) + * @return ListSecurityMonitoringCriticalAssetsOptionalParameters + */ + public ListSecurityMonitoringCriticalAssetsOptionalParameters query(String query) { + this.query = query; + return this; + } + } + /** * Get all critical assets. * @@ -10097,7 +10113,9 @@ public ApiResponse listSecurityFindingsWithHttpInf */ public SecurityMonitoringCriticalAssetsResponse listSecurityMonitoringCriticalAssets() throws ApiException { - return listSecurityMonitoringCriticalAssetsWithHttpInfo().getData(); + return listSecurityMonitoringCriticalAssetsWithHttpInfo( + new ListSecurityMonitoringCriticalAssetsOptionalParameters()) + .getData(); } /** @@ -10109,7 +10127,40 @@ public SecurityMonitoringCriticalAssetsResponse listSecurityMonitoringCriticalAs */ public CompletableFuture listSecurityMonitoringCriticalAssetsAsync() { - return listSecurityMonitoringCriticalAssetsWithHttpInfoAsync() + return listSecurityMonitoringCriticalAssetsWithHttpInfoAsync( + new ListSecurityMonitoringCriticalAssetsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all critical assets. + * + *

See {@link #listSecurityMonitoringCriticalAssetsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return SecurityMonitoringCriticalAssetsResponse + * @throws ApiException if fails to make API call + */ + public SecurityMonitoringCriticalAssetsResponse listSecurityMonitoringCriticalAssets( + ListSecurityMonitoringCriticalAssetsOptionalParameters parameters) throws ApiException { + return listSecurityMonitoringCriticalAssetsWithHttpInfo(parameters).getData(); + } + + /** + * Get all critical assets. + * + *

See {@link #listSecurityMonitoringCriticalAssetsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<SecurityMonitoringCriticalAssetsResponse> + */ + public CompletableFuture + listSecurityMonitoringCriticalAssetsAsync( + ListSecurityMonitoringCriticalAssetsOptionalParameters parameters) { + return listSecurityMonitoringCriticalAssetsWithHttpInfoAsync(parameters) .thenApply( response -> { return response.getData(); @@ -10119,6 +10170,7 @@ public SecurityMonitoringCriticalAssetsResponse listSecurityMonitoringCriticalAs /** * Get the list of all critical assets. * + * @param parameters Optional parameters for the request. * @return ApiResponse<SecurityMonitoringCriticalAssetsResponse> * @throws ApiException if fails to make API call * @http.response.details @@ -10131,18 +10183,23 @@ public SecurityMonitoringCriticalAssetsResponse listSecurityMonitoringCriticalAs * */ public ApiResponse - listSecurityMonitoringCriticalAssetsWithHttpInfo() throws ApiException { + listSecurityMonitoringCriticalAssetsWithHttpInfo( + ListSecurityMonitoringCriticalAssetsOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; + String query = parameters.query; // create path and map variables String localVarPath = "/api/v2/security_monitoring/configuration/critical_assets"; + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + Invocation.Builder builder = apiClient.createBuilder( "v2.SecurityMonitoringApi.listSecurityMonitoringCriticalAssets", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -10163,23 +10220,29 @@ public SecurityMonitoringCriticalAssetsResponse listSecurityMonitoringCriticalAs * *

See {@link #listSecurityMonitoringCriticalAssetsWithHttpInfo}. * + * @param parameters Optional parameters for the request. * @return CompletableFuture<ApiResponse<SecurityMonitoringCriticalAssetsResponse>> */ public CompletableFuture> - listSecurityMonitoringCriticalAssetsWithHttpInfoAsync() { + listSecurityMonitoringCriticalAssetsWithHttpInfoAsync( + ListSecurityMonitoringCriticalAssetsOptionalParameters parameters) { Object localVarPostBody = null; + String query = parameters.query; // create path and map variables String localVarPath = "/api/v2/security_monitoring/configuration/critical_assets"; + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.SecurityMonitoringApi.listSecurityMonitoringCriticalAssets", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"},