diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 17fc41e6b2a..3f09c0483c4 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -22509,11 +22509,274 @@ components: scaling: $ref: "#/components/schemas/ToplistWidgetScaling" type: object + TopologyMapInlineColumnKindScalar: + default: scalar + description: Column of numbers. + enum: + - scalar + example: scalar + type: string + x-enum-varnames: + - SCALAR + TopologyMapInlineColumnKindString: + default: string + description: Column of strings. + enum: + - string + example: string + type: string + x-enum-varnames: + - STRING + TopologyMapInlineData: + additionalProperties: false + description: >- + Static nodes and edges, stored in columns. Within a table, every column must have the same number of values and a unique `id`. + properties: + edges: + $ref: "#/components/schemas/TopologyMapInlineEdgesData" + nodes: + $ref: "#/components/schemas/TopologyMapInlineNodesData" + type: object + TopologyMapInlineEdgeColumn: + additionalProperties: false + description: Column of edge endpoint node IDs. + properties: + id: + $ref: "#/components/schemas/TopologyMapInlineEdgeColumnId" + kind: + $ref: "#/components/schemas/TopologyMapInlineColumnKindString" + values: + description: Node IDs. + example: ["service:web"] + items: + description: Node ID. + type: string + type: array + required: + - kind + - id + - values + type: object + TopologyMapInlineEdgeColumnId: + description: Edge endpoint the column holds. + enum: + - source + - target + example: source + type: string + x-enum-varnames: + - SOURCE + - TARGET + TopologyMapInlineEdgesData: + additionalProperties: false + description: Table of edges, one row per edge. + properties: + columns: + description: Columns of the edges table. Must include one `source` column and one `target` column. + items: + $ref: "#/components/schemas/TopologyMapInlineEdgeColumn" + type: array + required: + - columns + type: object + TopologyMapInlineNodeColumn: + description: Column of the nodes table. + oneOf: + - $ref: "#/components/schemas/TopologyMapInlineNodeIdColumn" + - $ref: "#/components/schemas/TopologyMapInlineNodeStringColumn" + - $ref: "#/components/schemas/TopologyMapInlineNodeValueColumn" + TopologyMapInlineNodeIdColumn: + additionalProperties: false + description: Column of node IDs. + properties: + id: + $ref: "#/components/schemas/TopologyMapInlineNodeIdColumnId" + kind: + $ref: "#/components/schemas/TopologyMapInlineColumnKindString" + values: + description: Node IDs. + example: ["service:web", "service:db"] + items: + description: Node ID. + type: string + type: array + required: + - kind + - id + - values + type: object + TopologyMapInlineNodeIdColumnId: + default: id + description: ID of the node ID column. + enum: + - id + example: id + type: string + x-enum-varnames: + - ID + TopologyMapInlineNodeStringColumn: + additionalProperties: false + description: Column of node text. + properties: + id: + $ref: "#/components/schemas/TopologyMapInlineNodeStringColumnId" + kind: + $ref: "#/components/schemas/TopologyMapInlineColumnKindString" + values: + description: >- + Text for each node. A null `title` shows the node's ID; a null `subtitle` shows no subtitle. + example: ["api-team", null] + items: + description: Text for one node. + nullable: true + type: string + type: array + required: + - kind + - id + - values + type: object + TopologyMapInlineNodeStringColumnId: + description: >- + Node field the column fills. `title` is bold text at the top of the node; `subtitle` is smaller text below it. + enum: + - title + - subtitle + example: title + type: string + x-enum-varnames: + - TITLE + - SUBTITLE + TopologyMapInlineNodeValueColumn: + additionalProperties: false + description: >- + Column of numeric node values. Nodes display non-null values in order of column `id`. + properties: + id: + description: Position of the value in the node, as `values[N]`. The smallest N appears first. + example: "values[0]" + pattern: '^values\[(0|[1-9][0-9]*)\]$' + type: string + kind: + $ref: "#/components/schemas/TopologyMapInlineColumnKindScalar" + meta: + $ref: "#/components/schemas/TopologyMapInlineNodeValueColumnMeta" + values: + description: Value for each node. Null values are not displayed. + example: [1.5, null] + items: + description: Value for one node. + format: double + nullable: true + type: number + type: array + required: + - kind + - id + - values + type: object + TopologyMapInlineNodeValueColumnMeta: + additionalProperties: false + description: Display options for a value column. + properties: + unit: + $ref: "#/components/schemas/NumberFormatUnit" + type: object + TopologyMapInlineNodesData: + additionalProperties: false + description: Table of nodes, one row per node. + properties: + columns: + description: >- + Columns of the nodes table. Must include an `id` column, unless the list is empty (no nodes). + items: + $ref: "#/components/schemas/TopologyMapInlineNodeColumn" + type: array + required: + - columns + type: object + TopologyMapLayout: + additionalProperties: false + description: >- + Algorithm that positions nodes and edges. The `hierarchical` layout places nodes in ranks so edges flow in one direction. + properties: + direction: + $ref: "#/components/schemas/TopologyMapLayoutDirection" + type: + $ref: "#/components/schemas/TopologyMapLayoutType" + required: + - type + - direction + type: object + TopologyMapLayoutDirection: + description: >- + Direction of ranks. For example, `top-to-bottom` places first-rank nodes at the top and last-rank nodes at the bottom. + enum: + - top-to-bottom + - bottom-to-top + - left-to-right + - right-to-left + example: top-to-bottom + type: string + x-enum-varnames: + - TOP_TO_BOTTOM + - BOTTOM_TO_TOP + - LEFT_TO_RIGHT + - RIGHT_TO_LEFT + TopologyMapLayoutType: + default: hierarchical + description: Type of layout algorithm. + enum: + - hierarchical + example: hierarchical + type: string + x-enum-varnames: + - HIERARCHICAL TopologyMapWidgetDefinition: description: This widget displays a topology of nodes and edges for different data sources. It replaces the service map widget. oneOf: - $ref: "#/components/schemas/TopologyMapWidgetDefinitionDataStreams" - $ref: "#/components/schemas/TopologyMapWidgetDefinitionServiceMap" + - $ref: "#/components/schemas/TopologyMapWidgetDefinitionCustom" + TopologyMapWidgetDefinitionCustom: + additionalProperties: false + description: >- + Custom topology map widget. Renders nodes and edges from inline `data` and from scalar `requests`. There is one node for each node ID found in `data.nodes`, `data.edges`, and `requests`. When `data` and several requests set the same field on the same node (such as `title` or `values[0]`), the last non-null value wins. + properties: + custom_links: + description: List of custom links. + items: + $ref: "#/components/schemas/WidgetCustomLink" + type: array + data: + $ref: "#/components/schemas/TopologyMapInlineData" + description: + description: The description of the widget. + type: string + layout: + $ref: "#/components/schemas/TopologyMapLayout" + requests: + description: List of scalar requests that supply node data. Can be empty. + items: + $ref: "#/components/schemas/TopologyRequestCustom" + type: array + time: + $ref: "#/components/schemas/WidgetTime" + title: + description: Title of your widget. + type: string + title_align: + $ref: "#/components/schemas/WidgetTextAlign" + title_size: + description: Size of the title. + type: string + type: + $ref: "#/components/schemas/TopologyMapWidgetDefinitionType" + required: + - type + - requests + - layout + type: object TopologyMapWidgetDefinitionDataStreams: additionalProperties: false description: Topology map widget backed by the data streams data source. @@ -22661,6 +22924,87 @@ components: type: string x-enum-varnames: - SERVICE_MAP + TopologyRequestCustom: + additionalProperties: false + description: Scalar request whose result rows become nodes. + properties: + formulas: + description: List of formulas that operate on queries. + items: + $ref: "#/components/schemas/WidgetFormula" + type: array + projection: + $ref: "#/components/schemas/TopologyRequestCustomProjection" + queries: + description: List of queries that can be returned directly or used in formulas. + example: + - data_source: "metrics" + name: "my_query" + query: "avg:system.cpu.user{*}" + items: + $ref: "#/components/schemas/FormulaAndFunctionQueryDefinition" + type: array + response_format: + $ref: "#/components/schemas/TopologyRequestCustomResponseFormat" + sort: + $ref: "#/components/schemas/WidgetSortBy" + required: + - response_format + - queries + - projection + type: object + TopologyRequestCustomProjection: + additionalProperties: false + description: >- + Mapping from result columns to node fields. Each result row feeds one node. + properties: + dimensions: + description: List of mappings from a result column to a node field. Each `dimension` must be unique. + items: + $ref: "#/components/schemas/TopologyRequestCustomProjectionDimension" + type: array + type: + $ref: "#/components/schemas/TopologyRequestCustomProjectionType" + required: + - type + - dimensions + type: object + TopologyRequestCustomProjectionDimension: + additionalProperties: false + description: Mapping from one result column to one node field. + properties: + column: + description: Column name from the result. Must be a group-by tag key or a formula. + example: service + type: string + dimension: + description: >- + Node field that receives the column's value: `id`, `title`, `subtitle`, or `values[N]` for the value at position N. When `id` is not set, each node's ID is derived from the group-by tags (for example, `env:prod,service:web`). When `title` is not set, the title is the node's ID. When several rows set the same non-`id` field on a node, the last non-null value wins. + example: "values[0]" + pattern: '^(id|title|subtitle|values\[(0|[1-9][0-9]*)\])$' + type: string + required: + - column + - dimension + type: object + TopologyRequestCustomProjectionType: + default: custom_topology_map_node + description: Projection type. Each result row is a node. + enum: + - custom_topology_map_node + example: custom_topology_map_node + type: string + x-enum-varnames: + - CUSTOM_TOPOLOGY_MAP_NODE + TopologyRequestCustomResponseFormat: + default: scalar + description: Response format of a custom topology map request. + enum: + - scalar + example: scalar + type: string + x-enum-varnames: + - SCALAR TopologyRequestDataStreams: description: Request that returns nodes and edges from the data streams data source. properties: diff --git a/examples/v1/dashboards/CreateDashboard_620827773.java b/examples/v1/dashboards/CreateDashboard_620827773.java new file mode 100644 index 00000000000..41d49b2b0f8 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_620827773.java @@ -0,0 +1,193 @@ +// Create a new dashboard with topology_map custom widget + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.Dashboard; +import com.datadog.api.client.v1.model.DashboardLayoutType; +import com.datadog.api.client.v1.model.FormulaAndFunctionMetricAggregation; +import com.datadog.api.client.v1.model.FormulaAndFunctionMetricDataSource; +import com.datadog.api.client.v1.model.FormulaAndFunctionMetricQueryDefinition; +import com.datadog.api.client.v1.model.FormulaAndFunctionQueryDefinition; +import com.datadog.api.client.v1.model.NumberFormatUnit; +import com.datadog.api.client.v1.model.NumberFormatUnitCanonical; +import com.datadog.api.client.v1.model.NumberFormatUnitScaleType; +import com.datadog.api.client.v1.model.TopologyMapInlineColumnKindScalar; +import com.datadog.api.client.v1.model.TopologyMapInlineColumnKindString; +import com.datadog.api.client.v1.model.TopologyMapInlineData; +import com.datadog.api.client.v1.model.TopologyMapInlineEdgeColumn; +import com.datadog.api.client.v1.model.TopologyMapInlineEdgeColumnId; +import com.datadog.api.client.v1.model.TopologyMapInlineEdgesData; +import com.datadog.api.client.v1.model.TopologyMapInlineNodeColumn; +import com.datadog.api.client.v1.model.TopologyMapInlineNodeIdColumn; +import com.datadog.api.client.v1.model.TopologyMapInlineNodeIdColumnId; +import com.datadog.api.client.v1.model.TopologyMapInlineNodeStringColumn; +import com.datadog.api.client.v1.model.TopologyMapInlineNodeStringColumnId; +import com.datadog.api.client.v1.model.TopologyMapInlineNodeValueColumn; +import com.datadog.api.client.v1.model.TopologyMapInlineNodeValueColumnMeta; +import com.datadog.api.client.v1.model.TopologyMapInlineNodesData; +import com.datadog.api.client.v1.model.TopologyMapLayout; +import com.datadog.api.client.v1.model.TopologyMapLayoutDirection; +import com.datadog.api.client.v1.model.TopologyMapLayoutType; +import com.datadog.api.client.v1.model.TopologyMapWidgetDefinition; +import com.datadog.api.client.v1.model.TopologyMapWidgetDefinitionCustom; +import com.datadog.api.client.v1.model.TopologyMapWidgetDefinitionType; +import com.datadog.api.client.v1.model.TopologyRequestCustom; +import com.datadog.api.client.v1.model.TopologyRequestCustomProjection; +import com.datadog.api.client.v1.model.TopologyRequestCustomProjectionDimension; +import com.datadog.api.client.v1.model.TopologyRequestCustomProjectionType; +import com.datadog.api.client.v1.model.TopologyRequestCustomResponseFormat; +import com.datadog.api.client.v1.model.Widget; +import com.datadog.api.client.v1.model.WidgetDefinition; +import com.datadog.api.client.v1.model.WidgetFormula; +import com.datadog.api.client.v1.model.WidgetLayout; +import com.datadog.api.client.v1.model.WidgetTextAlign; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + Dashboard body = + new Dashboard() + .title("Example-Dashboard") + .description("") + .widgets( + Collections.singletonList( + new Widget() + .layout(new WidgetLayout().x(0L).y(0L).width(47L).height(15L)) + .definition( + new WidgetDefinition( + new TopologyMapWidgetDefinition( + new TopologyMapWidgetDefinitionCustom() + .title("") + .titleSize("16") + .titleAlign(WidgetTextAlign.LEFT) + .type(TopologyMapWidgetDefinitionType.TOPOLOGY_MAP) + .layout( + new TopologyMapLayout() + .type(TopologyMapLayoutType.HIERARCHICAL) + .direction( + TopologyMapLayoutDirection.LEFT_TO_RIGHT)) + .data( + new TopologyMapInlineData() + .nodes( + new TopologyMapInlineNodesData() + .columns( + Arrays.asList( + new TopologyMapInlineNodeColumn( + new TopologyMapInlineNodeIdColumn() + .kind( + TopologyMapInlineColumnKindString + .STRING) + .id( + TopologyMapInlineNodeIdColumnId + .ID) + .values( + Arrays.asList( + "service:web", + "service:db"))), + new TopologyMapInlineNodeColumn( + new TopologyMapInlineNodeStringColumn() + .kind( + TopologyMapInlineColumnKindString + .STRING) + .id( + TopologyMapInlineNodeStringColumnId + .SUBTITLE) + .values( + Arrays.asList( + "api-team", null))), + new TopologyMapInlineNodeColumn( + new TopologyMapInlineNodeValueColumn() + .kind( + TopologyMapInlineColumnKindScalar + .SCALAR) + .id("values[1]") + .values( + Arrays.asList( + 1.5, null)) + .meta( + new TopologyMapInlineNodeValueColumnMeta() + .unit( + new NumberFormatUnit( + new NumberFormatUnitCanonical() + .type( + NumberFormatUnitScaleType + .CANONICAL_UNIT) + .unitName( + "second")))))))) + .edges( + new TopologyMapInlineEdgesData() + .columns( + Arrays.asList( + new TopologyMapInlineEdgeColumn() + .kind( + TopologyMapInlineColumnKindString + .STRING) + .id( + TopologyMapInlineEdgeColumnId + .SOURCE) + .values( + Collections.singletonList( + "service:web")), + new TopologyMapInlineEdgeColumn() + .kind( + TopologyMapInlineColumnKindString + .STRING) + .id( + TopologyMapInlineEdgeColumnId + .TARGET) + .values( + Collections.singletonList( + "service:db")))))) + .requests( + Collections.singletonList( + new TopologyRequestCustom() + .responseFormat( + TopologyRequestCustomResponseFormat.SCALAR) + .queries( + Collections.singletonList( + new FormulaAndFunctionQueryDefinition( + new FormulaAndFunctionMetricQueryDefinition() + .dataSource( + FormulaAndFunctionMetricDataSource + .METRICS) + .name("a") + .query( + "avg:system.cpu.user{*} by" + + " {service}") + .aggregator( + FormulaAndFunctionMetricAggregation + .AVG)))) + .formulas( + Collections.singletonList( + new WidgetFormula().formula("a"))) + .projection( + new TopologyRequestCustomProjection() + .type( + TopologyRequestCustomProjectionType + .CUSTOM_TOPOLOGY_MAP_NODE) + .dimensions( + Collections.singletonList( + new TopologyRequestCustomProjectionDimension() + .column("a") + .dimension( + "values[0]"))))))))))) + .layoutType(DashboardLayoutType.FREE); + + try { + Dashboard result = apiInstance.createDashboard(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#createDashboard"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineColumnKindScalar.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineColumnKindScalar.java new file mode 100644 index 00000000000..d3ba28a358a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineColumnKindScalar.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; + +/** Column of numbers. */ +@JsonSerialize( + using = TopologyMapInlineColumnKindScalar.TopologyMapInlineColumnKindScalarSerializer.class) +public class TopologyMapInlineColumnKindScalar extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("scalar")); + + public static final TopologyMapInlineColumnKindScalar SCALAR = + new TopologyMapInlineColumnKindScalar("scalar"); + + TopologyMapInlineColumnKindScalar(String value) { + super(value, allowedValues); + } + + public static class TopologyMapInlineColumnKindScalarSerializer + extends StdSerializer { + public TopologyMapInlineColumnKindScalarSerializer(Class t) { + super(t); + } + + public TopologyMapInlineColumnKindScalarSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyMapInlineColumnKindScalar value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyMapInlineColumnKindScalar fromValue(String value) { + return new TopologyMapInlineColumnKindScalar(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineColumnKindString.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineColumnKindString.java new file mode 100644 index 00000000000..69d2862b985 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineColumnKindString.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; + +/** Column of strings. */ +@JsonSerialize( + using = TopologyMapInlineColumnKindString.TopologyMapInlineColumnKindStringSerializer.class) +public class TopologyMapInlineColumnKindString extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("string")); + + public static final TopologyMapInlineColumnKindString STRING = + new TopologyMapInlineColumnKindString("string"); + + TopologyMapInlineColumnKindString(String value) { + super(value, allowedValues); + } + + public static class TopologyMapInlineColumnKindStringSerializer + extends StdSerializer { + public TopologyMapInlineColumnKindStringSerializer(Class t) { + super(t); + } + + public TopologyMapInlineColumnKindStringSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyMapInlineColumnKindString value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyMapInlineColumnKindString fromValue(String value) { + return new TopologyMapInlineColumnKindString(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineData.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineData.java new file mode 100644 index 00000000000..0eb970b0a0a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineData.java @@ -0,0 +1,121 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** + * Static nodes and edges, stored in columns. Within a table, every column must have the same number + * of values and a unique id. + */ +@JsonPropertyOrder({ + TopologyMapInlineData.JSON_PROPERTY_EDGES, + TopologyMapInlineData.JSON_PROPERTY_NODES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapInlineData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EDGES = "edges"; + private TopologyMapInlineEdgesData edges; + + public static final String JSON_PROPERTY_NODES = "nodes"; + private TopologyMapInlineNodesData nodes; + + public TopologyMapInlineData edges(TopologyMapInlineEdgesData edges) { + this.edges = edges; + this.unparsed |= edges.unparsed; + return this; + } + + /** + * Table of edges, one row per edge. + * + * @return edges + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EDGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TopologyMapInlineEdgesData getEdges() { + return edges; + } + + public void setEdges(TopologyMapInlineEdgesData edges) { + this.edges = edges; + if (edges != null) { + this.unparsed |= edges.unparsed; + } + } + + public TopologyMapInlineData nodes(TopologyMapInlineNodesData nodes) { + this.nodes = nodes; + this.unparsed |= nodes.unparsed; + return this; + } + + /** + * Table of nodes, one row per node. + * + * @return nodes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NODES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TopologyMapInlineNodesData getNodes() { + return nodes; + } + + public void setNodes(TopologyMapInlineNodesData nodes) { + this.nodes = nodes; + if (nodes != null) { + this.unparsed |= nodes.unparsed; + } + } + + /** Return true if this TopologyMapInlineData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapInlineData topologyMapInlineData = (TopologyMapInlineData) o; + return Objects.equals(this.edges, topologyMapInlineData.edges) + && Objects.equals(this.nodes, topologyMapInlineData.nodes); + } + + @Override + public int hashCode() { + return Objects.hash(edges, nodes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapInlineData {\n"); + sb.append(" edges: ").append(toIndentedString(edges)).append("\n"); + sb.append(" nodes: ").append(toIndentedString(nodes)).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/TopologyMapInlineEdgeColumn.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineEdgeColumn.java new file mode 100644 index 00000000000..cdc03bd82f4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineEdgeColumn.java @@ -0,0 +1,165 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** Column of edge endpoint node IDs. */ +@JsonPropertyOrder({ + TopologyMapInlineEdgeColumn.JSON_PROPERTY_ID, + TopologyMapInlineEdgeColumn.JSON_PROPERTY_KIND, + TopologyMapInlineEdgeColumn.JSON_PROPERTY_VALUES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapInlineEdgeColumn { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private TopologyMapInlineEdgeColumnId id; + + public static final String JSON_PROPERTY_KIND = "kind"; + private TopologyMapInlineColumnKindString kind = TopologyMapInlineColumnKindString.STRING; + + public static final String JSON_PROPERTY_VALUES = "values"; + private List values = new ArrayList<>(); + + public TopologyMapInlineEdgeColumn() {} + + @JsonCreator + public TopologyMapInlineEdgeColumn( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) TopologyMapInlineEdgeColumnId id, + @JsonProperty(required = true, value = JSON_PROPERTY_KIND) + TopologyMapInlineColumnKindString kind, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUES) List values) { + this.id = id; + this.unparsed |= !id.isValid(); + this.kind = kind; + this.unparsed |= !kind.isValid(); + this.values = values; + } + + public TopologyMapInlineEdgeColumn id(TopologyMapInlineEdgeColumnId id) { + this.id = id; + this.unparsed |= !id.isValid(); + return this; + } + + /** + * Edge endpoint the column holds. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapInlineEdgeColumnId getId() { + return id; + } + + public void setId(TopologyMapInlineEdgeColumnId id) { + if (!id.isValid()) { + this.unparsed = true; + } + this.id = id; + } + + public TopologyMapInlineEdgeColumn kind(TopologyMapInlineColumnKindString kind) { + this.kind = kind; + this.unparsed |= !kind.isValid(); + return this; + } + + /** + * Column of strings. + * + * @return kind + */ + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapInlineColumnKindString getKind() { + return kind; + } + + public void setKind(TopologyMapInlineColumnKindString kind) { + if (!kind.isValid()) { + this.unparsed = true; + } + this.kind = kind; + } + + public TopologyMapInlineEdgeColumn values(List values) { + this.values = values; + return this; + } + + public TopologyMapInlineEdgeColumn addValuesItem(String valuesItem) { + this.values.add(valuesItem); + return this; + } + + /** + * Node IDs. + * + * @return values + */ + @JsonProperty(JSON_PROPERTY_VALUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } + + /** Return true if this TopologyMapInlineEdgeColumn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapInlineEdgeColumn topologyMapInlineEdgeColumn = (TopologyMapInlineEdgeColumn) o; + return Objects.equals(this.id, topologyMapInlineEdgeColumn.id) + && Objects.equals(this.kind, topologyMapInlineEdgeColumn.kind) + && Objects.equals(this.values, topologyMapInlineEdgeColumn.values); + } + + @Override + public int hashCode() { + return Objects.hash(id, kind, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapInlineEdgeColumn {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).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/TopologyMapInlineEdgeColumnId.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineEdgeColumnId.java new file mode 100644 index 00000000000..e216fe08877 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineEdgeColumnId.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** Edge endpoint the column holds. */ +@JsonSerialize(using = TopologyMapInlineEdgeColumnId.TopologyMapInlineEdgeColumnIdSerializer.class) +public class TopologyMapInlineEdgeColumnId extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("source", "target")); + + public static final TopologyMapInlineEdgeColumnId SOURCE = + new TopologyMapInlineEdgeColumnId("source"); + public static final TopologyMapInlineEdgeColumnId TARGET = + new TopologyMapInlineEdgeColumnId("target"); + + TopologyMapInlineEdgeColumnId(String value) { + super(value, allowedValues); + } + + public static class TopologyMapInlineEdgeColumnIdSerializer + extends StdSerializer { + public TopologyMapInlineEdgeColumnIdSerializer(Class t) { + super(t); + } + + public TopologyMapInlineEdgeColumnIdSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyMapInlineEdgeColumnId value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyMapInlineEdgeColumnId fromValue(String value) { + return new TopologyMapInlineEdgeColumnId(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineEdgesData.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineEdgesData.java new file mode 100644 index 00000000000..e6de236a82c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineEdgesData.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.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.List; +import java.util.Objects; + +/** Table of edges, one row per edge. */ +@JsonPropertyOrder({TopologyMapInlineEdgesData.JSON_PROPERTY_COLUMNS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapInlineEdgesData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COLUMNS = "columns"; + private List columns = new ArrayList<>(); + + public TopologyMapInlineEdgesData() {} + + @JsonCreator + public TopologyMapInlineEdgesData( + @JsonProperty(required = true, value = JSON_PROPERTY_COLUMNS) + List columns) { + this.columns = columns; + for (TopologyMapInlineEdgeColumn item : columns) { + this.unparsed |= item.unparsed; + } + } + + public TopologyMapInlineEdgesData columns(List columns) { + this.columns = columns; + for (TopologyMapInlineEdgeColumn item : columns) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TopologyMapInlineEdgesData addColumnsItem(TopologyMapInlineEdgeColumn columnsItem) { + this.columns.add(columnsItem); + this.unparsed |= columnsItem.unparsed; + return this; + } + + /** + * Columns of the edges table. Must include one source column and one target + * column. + * + * @return columns + */ + @JsonProperty(JSON_PROPERTY_COLUMNS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getColumns() { + return columns; + } + + public void setColumns(List columns) { + this.columns = columns; + if (columns != null) { + for (TopologyMapInlineEdgeColumn item : columns) { + this.unparsed |= item.unparsed; + } + } + } + + /** Return true if this TopologyMapInlineEdgesData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapInlineEdgesData topologyMapInlineEdgesData = (TopologyMapInlineEdgesData) o; + return Objects.equals(this.columns, topologyMapInlineEdgesData.columns); + } + + @Override + public int hashCode() { + return Objects.hash(columns); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapInlineEdgesData {\n"); + sb.append(" columns: ").append(toIndentedString(columns)).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/TopologyMapInlineNodeColumn.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeColumn.java new file mode 100644 index 00000000000..bcdf48faace --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeColumn.java @@ -0,0 +1,363 @@ +/* + * 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 = TopologyMapInlineNodeColumn.TopologyMapInlineNodeColumnDeserializer.class) +@JsonSerialize(using = TopologyMapInlineNodeColumn.TopologyMapInlineNodeColumnSerializer.class) +public class TopologyMapInlineNodeColumn extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(TopologyMapInlineNodeColumn.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class TopologyMapInlineNodeColumnSerializer + extends StdSerializer { + public TopologyMapInlineNodeColumnSerializer(Class t) { + super(t); + } + + public TopologyMapInlineNodeColumnSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyMapInlineNodeColumn value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TopologyMapInlineNodeColumnDeserializer + extends StdDeserializer { + public TopologyMapInlineNodeColumnDeserializer() { + this(TopologyMapInlineNodeColumn.class); + } + + public TopologyMapInlineNodeColumnDeserializer(Class vc) { + super(vc); + } + + @Override + public TopologyMapInlineNodeColumn 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 TopologyMapInlineNodeIdColumn + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TopologyMapInlineNodeIdColumn.class.equals(Integer.class) + || TopologyMapInlineNodeIdColumn.class.equals(Long.class) + || TopologyMapInlineNodeIdColumn.class.equals(Float.class) + || TopologyMapInlineNodeIdColumn.class.equals(Double.class) + || TopologyMapInlineNodeIdColumn.class.equals(Boolean.class) + || TopologyMapInlineNodeIdColumn.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TopologyMapInlineNodeIdColumn.class.equals(Integer.class) + || TopologyMapInlineNodeIdColumn.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TopologyMapInlineNodeIdColumn.class.equals(Float.class) + || TopologyMapInlineNodeIdColumn.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TopologyMapInlineNodeIdColumn.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TopologyMapInlineNodeIdColumn.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TopologyMapInlineNodeIdColumn.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 (!((TopologyMapInlineNodeIdColumn) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TopologyMapInlineNodeIdColumn'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'TopologyMapInlineNodeIdColumn'", e); + } + + // deserialize TopologyMapInlineNodeStringColumn + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TopologyMapInlineNodeStringColumn.class.equals(Integer.class) + || TopologyMapInlineNodeStringColumn.class.equals(Long.class) + || TopologyMapInlineNodeStringColumn.class.equals(Float.class) + || TopologyMapInlineNodeStringColumn.class.equals(Double.class) + || TopologyMapInlineNodeStringColumn.class.equals(Boolean.class) + || TopologyMapInlineNodeStringColumn.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TopologyMapInlineNodeStringColumn.class.equals(Integer.class) + || TopologyMapInlineNodeStringColumn.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TopologyMapInlineNodeStringColumn.class.equals(Float.class) + || TopologyMapInlineNodeStringColumn.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TopologyMapInlineNodeStringColumn.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TopologyMapInlineNodeStringColumn.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TopologyMapInlineNodeStringColumn.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 (!((TopologyMapInlineNodeStringColumn) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TopologyMapInlineNodeStringColumn'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'TopologyMapInlineNodeStringColumn'", e); + } + + // deserialize TopologyMapInlineNodeValueColumn + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TopologyMapInlineNodeValueColumn.class.equals(Integer.class) + || TopologyMapInlineNodeValueColumn.class.equals(Long.class) + || TopologyMapInlineNodeValueColumn.class.equals(Float.class) + || TopologyMapInlineNodeValueColumn.class.equals(Double.class) + || TopologyMapInlineNodeValueColumn.class.equals(Boolean.class) + || TopologyMapInlineNodeValueColumn.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TopologyMapInlineNodeValueColumn.class.equals(Integer.class) + || TopologyMapInlineNodeValueColumn.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TopologyMapInlineNodeValueColumn.class.equals(Float.class) + || TopologyMapInlineNodeValueColumn.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TopologyMapInlineNodeValueColumn.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TopologyMapInlineNodeValueColumn.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TopologyMapInlineNodeValueColumn.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 (!((TopologyMapInlineNodeValueColumn) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TopologyMapInlineNodeValueColumn'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'TopologyMapInlineNodeValueColumn'", e); + } + + TopologyMapInlineNodeColumn ret = new TopologyMapInlineNodeColumn(); + 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 TopologyMapInlineNodeColumn getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "TopologyMapInlineNodeColumn cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public TopologyMapInlineNodeColumn() { + super("oneOf", Boolean.FALSE); + } + + public TopologyMapInlineNodeColumn(TopologyMapInlineNodeIdColumn o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TopologyMapInlineNodeColumn(TopologyMapInlineNodeStringColumn o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TopologyMapInlineNodeColumn(TopologyMapInlineNodeValueColumn o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "TopologyMapInlineNodeIdColumn", new GenericType() {}); + schemas.put( + "TopologyMapInlineNodeStringColumn", + new GenericType() {}); + schemas.put( + "TopologyMapInlineNodeValueColumn", new GenericType() {}); + JSON.registerDescendants( + TopologyMapInlineNodeColumn.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return TopologyMapInlineNodeColumn.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: TopologyMapInlineNodeIdColumn, + * TopologyMapInlineNodeStringColumn, TopologyMapInlineNodeValueColumn + * + *

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(TopologyMapInlineNodeIdColumn.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + TopologyMapInlineNodeStringColumn.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + TopologyMapInlineNodeValueColumn.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 TopologyMapInlineNodeIdColumn," + + " TopologyMapInlineNodeStringColumn, TopologyMapInlineNodeValueColumn"); + } + + /** + * Get the actual instance, which can be the following: TopologyMapInlineNodeIdColumn, + * TopologyMapInlineNodeStringColumn, TopologyMapInlineNodeValueColumn + * + * @return The actual instance (TopologyMapInlineNodeIdColumn, TopologyMapInlineNodeStringColumn, + * TopologyMapInlineNodeValueColumn) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `TopologyMapInlineNodeIdColumn`. If the actual instance is not + * `TopologyMapInlineNodeIdColumn`, the ClassCastException will be thrown. + * + * @return The actual instance of `TopologyMapInlineNodeIdColumn` + * @throws ClassCastException if the instance is not `TopologyMapInlineNodeIdColumn` + */ + public TopologyMapInlineNodeIdColumn getTopologyMapInlineNodeIdColumn() + throws ClassCastException { + return (TopologyMapInlineNodeIdColumn) super.getActualInstance(); + } + + /** + * Get the actual instance of `TopologyMapInlineNodeStringColumn`. If the actual instance is not + * `TopologyMapInlineNodeStringColumn`, the ClassCastException will be thrown. + * + * @return The actual instance of `TopologyMapInlineNodeStringColumn` + * @throws ClassCastException if the instance is not `TopologyMapInlineNodeStringColumn` + */ + public TopologyMapInlineNodeStringColumn getTopologyMapInlineNodeStringColumn() + throws ClassCastException { + return (TopologyMapInlineNodeStringColumn) super.getActualInstance(); + } + + /** + * Get the actual instance of `TopologyMapInlineNodeValueColumn`. If the actual instance is not + * `TopologyMapInlineNodeValueColumn`, the ClassCastException will be thrown. + * + * @return The actual instance of `TopologyMapInlineNodeValueColumn` + * @throws ClassCastException if the instance is not `TopologyMapInlineNodeValueColumn` + */ + public TopologyMapInlineNodeValueColumn getTopologyMapInlineNodeValueColumn() + throws ClassCastException { + return (TopologyMapInlineNodeValueColumn) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeIdColumn.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeIdColumn.java new file mode 100644 index 00000000000..821e2e474fa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeIdColumn.java @@ -0,0 +1,165 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** Column of node IDs. */ +@JsonPropertyOrder({ + TopologyMapInlineNodeIdColumn.JSON_PROPERTY_ID, + TopologyMapInlineNodeIdColumn.JSON_PROPERTY_KIND, + TopologyMapInlineNodeIdColumn.JSON_PROPERTY_VALUES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapInlineNodeIdColumn { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private TopologyMapInlineNodeIdColumnId id = TopologyMapInlineNodeIdColumnId.ID; + + public static final String JSON_PROPERTY_KIND = "kind"; + private TopologyMapInlineColumnKindString kind = TopologyMapInlineColumnKindString.STRING; + + public static final String JSON_PROPERTY_VALUES = "values"; + private List values = new ArrayList<>(); + + public TopologyMapInlineNodeIdColumn() {} + + @JsonCreator + public TopologyMapInlineNodeIdColumn( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) TopologyMapInlineNodeIdColumnId id, + @JsonProperty(required = true, value = JSON_PROPERTY_KIND) + TopologyMapInlineColumnKindString kind, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUES) List values) { + this.id = id; + this.unparsed |= !id.isValid(); + this.kind = kind; + this.unparsed |= !kind.isValid(); + this.values = values; + } + + public TopologyMapInlineNodeIdColumn id(TopologyMapInlineNodeIdColumnId id) { + this.id = id; + this.unparsed |= !id.isValid(); + return this; + } + + /** + * ID of the node ID column. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapInlineNodeIdColumnId getId() { + return id; + } + + public void setId(TopologyMapInlineNodeIdColumnId id) { + if (!id.isValid()) { + this.unparsed = true; + } + this.id = id; + } + + public TopologyMapInlineNodeIdColumn kind(TopologyMapInlineColumnKindString kind) { + this.kind = kind; + this.unparsed |= !kind.isValid(); + return this; + } + + /** + * Column of strings. + * + * @return kind + */ + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapInlineColumnKindString getKind() { + return kind; + } + + public void setKind(TopologyMapInlineColumnKindString kind) { + if (!kind.isValid()) { + this.unparsed = true; + } + this.kind = kind; + } + + public TopologyMapInlineNodeIdColumn values(List values) { + this.values = values; + return this; + } + + public TopologyMapInlineNodeIdColumn addValuesItem(String valuesItem) { + this.values.add(valuesItem); + return this; + } + + /** + * Node IDs. + * + * @return values + */ + @JsonProperty(JSON_PROPERTY_VALUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } + + /** Return true if this TopologyMapInlineNodeIdColumn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapInlineNodeIdColumn topologyMapInlineNodeIdColumn = (TopologyMapInlineNodeIdColumn) o; + return Objects.equals(this.id, topologyMapInlineNodeIdColumn.id) + && Objects.equals(this.kind, topologyMapInlineNodeIdColumn.kind) + && Objects.equals(this.values, topologyMapInlineNodeIdColumn.values); + } + + @Override + public int hashCode() { + return Objects.hash(id, kind, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapInlineNodeIdColumn {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).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/TopologyMapInlineNodeIdColumnId.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeIdColumnId.java new file mode 100644 index 00000000000..0d5a6442e80 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeIdColumnId.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; + +/** ID of the node ID column. */ +@JsonSerialize( + using = TopologyMapInlineNodeIdColumnId.TopologyMapInlineNodeIdColumnIdSerializer.class) +public class TopologyMapInlineNodeIdColumnId extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("id")); + + public static final TopologyMapInlineNodeIdColumnId ID = + new TopologyMapInlineNodeIdColumnId("id"); + + TopologyMapInlineNodeIdColumnId(String value) { + super(value, allowedValues); + } + + public static class TopologyMapInlineNodeIdColumnIdSerializer + extends StdSerializer { + public TopologyMapInlineNodeIdColumnIdSerializer(Class t) { + super(t); + } + + public TopologyMapInlineNodeIdColumnIdSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyMapInlineNodeIdColumnId value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyMapInlineNodeIdColumnId fromValue(String value) { + return new TopologyMapInlineNodeIdColumnId(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeStringColumn.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeStringColumn.java new file mode 100644 index 00000000000..1ea11511bf6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeStringColumn.java @@ -0,0 +1,169 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** Column of node text. */ +@JsonPropertyOrder({ + TopologyMapInlineNodeStringColumn.JSON_PROPERTY_ID, + TopologyMapInlineNodeStringColumn.JSON_PROPERTY_KIND, + TopologyMapInlineNodeStringColumn.JSON_PROPERTY_VALUES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapInlineNodeStringColumn { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private TopologyMapInlineNodeStringColumnId id; + + public static final String JSON_PROPERTY_KIND = "kind"; + private TopologyMapInlineColumnKindString kind = TopologyMapInlineColumnKindString.STRING; + + public static final String JSON_PROPERTY_VALUES = "values"; + private List values = new ArrayList<>(); + + public TopologyMapInlineNodeStringColumn() {} + + @JsonCreator + public TopologyMapInlineNodeStringColumn( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) + TopologyMapInlineNodeStringColumnId id, + @JsonProperty(required = true, value = JSON_PROPERTY_KIND) + TopologyMapInlineColumnKindString kind, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUES) List values) { + this.id = id; + this.unparsed |= !id.isValid(); + this.kind = kind; + this.unparsed |= !kind.isValid(); + this.values = values; + } + + public TopologyMapInlineNodeStringColumn id(TopologyMapInlineNodeStringColumnId id) { + this.id = id; + this.unparsed |= !id.isValid(); + return this; + } + + /** + * Node field the column fills. title is bold text at the top of the node; + * subtitle is smaller text below it. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapInlineNodeStringColumnId getId() { + return id; + } + + public void setId(TopologyMapInlineNodeStringColumnId id) { + if (!id.isValid()) { + this.unparsed = true; + } + this.id = id; + } + + public TopologyMapInlineNodeStringColumn kind(TopologyMapInlineColumnKindString kind) { + this.kind = kind; + this.unparsed |= !kind.isValid(); + return this; + } + + /** + * Column of strings. + * + * @return kind + */ + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapInlineColumnKindString getKind() { + return kind; + } + + public void setKind(TopologyMapInlineColumnKindString kind) { + if (!kind.isValid()) { + this.unparsed = true; + } + this.kind = kind; + } + + public TopologyMapInlineNodeStringColumn values(List values) { + this.values = values; + return this; + } + + public TopologyMapInlineNodeStringColumn addValuesItem(String valuesItem) { + this.values.add(valuesItem); + return this; + } + + /** + * Text for each node. A null title shows the node's ID; a null subtitle + * shows no subtitle. + * + * @return values + */ + @JsonProperty(JSON_PROPERTY_VALUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } + + /** Return true if this TopologyMapInlineNodeStringColumn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapInlineNodeStringColumn topologyMapInlineNodeStringColumn = + (TopologyMapInlineNodeStringColumn) o; + return Objects.equals(this.id, topologyMapInlineNodeStringColumn.id) + && Objects.equals(this.kind, topologyMapInlineNodeStringColumn.kind) + && Objects.equals(this.values, topologyMapInlineNodeStringColumn.values); + } + + @Override + public int hashCode() { + return Objects.hash(id, kind, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapInlineNodeStringColumn {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).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/TopologyMapInlineNodeStringColumnId.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeStringColumnId.java new file mode 100644 index 00000000000..fd25d00c26e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeStringColumnId.java @@ -0,0 +1,64 @@ +/* + * 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; + +/** + * Node field the column fills. title is bold text at the top of the node; + * subtitle is smaller text below it. + */ +@JsonSerialize( + using = TopologyMapInlineNodeStringColumnId.TopologyMapInlineNodeStringColumnIdSerializer.class) +public class TopologyMapInlineNodeStringColumnId extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("title", "subtitle")); + + public static final TopologyMapInlineNodeStringColumnId TITLE = + new TopologyMapInlineNodeStringColumnId("title"); + public static final TopologyMapInlineNodeStringColumnId SUBTITLE = + new TopologyMapInlineNodeStringColumnId("subtitle"); + + TopologyMapInlineNodeStringColumnId(String value) { + super(value, allowedValues); + } + + public static class TopologyMapInlineNodeStringColumnIdSerializer + extends StdSerializer { + public TopologyMapInlineNodeStringColumnIdSerializer( + Class t) { + super(t); + } + + public TopologyMapInlineNodeStringColumnIdSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyMapInlineNodeStringColumnId value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyMapInlineNodeStringColumnId fromValue(String value) { + return new TopologyMapInlineNodeStringColumnId(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeValueColumn.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeValueColumn.java new file mode 100644 index 00000000000..582f8816857 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeValueColumn.java @@ -0,0 +1,194 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** + * Column of numeric node values. Nodes display non-null values in order of column id. + */ +@JsonPropertyOrder({ + TopologyMapInlineNodeValueColumn.JSON_PROPERTY_ID, + TopologyMapInlineNodeValueColumn.JSON_PROPERTY_KIND, + TopologyMapInlineNodeValueColumn.JSON_PROPERTY_META, + TopologyMapInlineNodeValueColumn.JSON_PROPERTY_VALUES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapInlineNodeValueColumn { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_KIND = "kind"; + private TopologyMapInlineColumnKindScalar kind = TopologyMapInlineColumnKindScalar.SCALAR; + + public static final String JSON_PROPERTY_META = "meta"; + private TopologyMapInlineNodeValueColumnMeta meta; + + public static final String JSON_PROPERTY_VALUES = "values"; + private List values = new ArrayList<>(); + + public TopologyMapInlineNodeValueColumn() {} + + @JsonCreator + public TopologyMapInlineNodeValueColumn( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_KIND) + TopologyMapInlineColumnKindScalar kind, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUES) List values) { + this.id = id; + this.kind = kind; + this.unparsed |= !kind.isValid(); + this.values = values; + } + + public TopologyMapInlineNodeValueColumn id(String id) { + this.id = id; + return this; + } + + /** + * Position of the value in the node, as values[N]. The smallest N appears first. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public TopologyMapInlineNodeValueColumn kind(TopologyMapInlineColumnKindScalar kind) { + this.kind = kind; + this.unparsed |= !kind.isValid(); + return this; + } + + /** + * Column of numbers. + * + * @return kind + */ + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapInlineColumnKindScalar getKind() { + return kind; + } + + public void setKind(TopologyMapInlineColumnKindScalar kind) { + if (!kind.isValid()) { + this.unparsed = true; + } + this.kind = kind; + } + + public TopologyMapInlineNodeValueColumn meta(TopologyMapInlineNodeValueColumnMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Display options for a value column. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TopologyMapInlineNodeValueColumnMeta getMeta() { + return meta; + } + + public void setMeta(TopologyMapInlineNodeValueColumnMeta meta) { + this.meta = meta; + if (meta != null) { + this.unparsed |= meta.unparsed; + } + } + + public TopologyMapInlineNodeValueColumn values(List values) { + this.values = values; + return this; + } + + public TopologyMapInlineNodeValueColumn addValuesItem(Double valuesItem) { + this.values.add(valuesItem); + return this; + } + + /** + * Value for each node. Null values are not displayed. + * + * @return values + */ + @JsonProperty(JSON_PROPERTY_VALUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } + + /** Return true if this TopologyMapInlineNodeValueColumn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapInlineNodeValueColumn topologyMapInlineNodeValueColumn = + (TopologyMapInlineNodeValueColumn) o; + return Objects.equals(this.id, topologyMapInlineNodeValueColumn.id) + && Objects.equals(this.kind, topologyMapInlineNodeValueColumn.kind) + && Objects.equals(this.meta, topologyMapInlineNodeValueColumn.meta) + && Objects.equals(this.values, topologyMapInlineNodeValueColumn.values); + } + + @Override + public int hashCode() { + return Objects.hash(id, kind, meta, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapInlineNodeValueColumn {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).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/TopologyMapInlineNodeValueColumnMeta.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeValueColumnMeta.java new file mode 100644 index 00000000000..c76013cd2bd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodeValueColumnMeta.java @@ -0,0 +1,86 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Display options for a value column. */ +@JsonPropertyOrder({TopologyMapInlineNodeValueColumnMeta.JSON_PROPERTY_UNIT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapInlineNodeValueColumnMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_UNIT = "unit"; + private NumberFormatUnit unit; + + public TopologyMapInlineNodeValueColumnMeta 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; + if (unit != null) { + this.unparsed |= unit.unparsed; + } + } + + /** Return true if this TopologyMapInlineNodeValueColumnMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapInlineNodeValueColumnMeta topologyMapInlineNodeValueColumnMeta = + (TopologyMapInlineNodeValueColumnMeta) o; + return Objects.equals(this.unit, topologyMapInlineNodeValueColumnMeta.unit); + } + + @Override + public int hashCode() { + return Objects.hash(unit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapInlineNodeValueColumnMeta {\n"); + sb.append(" unit: ").append(toIndentedString(unit)).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/TopologyMapInlineNodesData.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodesData.java new file mode 100644 index 00000000000..15525d3fefa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapInlineNodesData.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.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.List; +import java.util.Objects; + +/** Table of nodes, one row per node. */ +@JsonPropertyOrder({TopologyMapInlineNodesData.JSON_PROPERTY_COLUMNS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapInlineNodesData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COLUMNS = "columns"; + private List columns = new ArrayList<>(); + + public TopologyMapInlineNodesData() {} + + @JsonCreator + public TopologyMapInlineNodesData( + @JsonProperty(required = true, value = JSON_PROPERTY_COLUMNS) + List columns) { + this.columns = columns; + for (TopologyMapInlineNodeColumn item : columns) { + this.unparsed |= item.unparsed; + } + } + + public TopologyMapInlineNodesData columns(List columns) { + this.columns = columns; + for (TopologyMapInlineNodeColumn item : columns) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TopologyMapInlineNodesData addColumnsItem(TopologyMapInlineNodeColumn columnsItem) { + this.columns.add(columnsItem); + this.unparsed |= columnsItem.unparsed; + return this; + } + + /** + * Columns of the nodes table. Must include an id column, unless the list is empty + * (no nodes). + * + * @return columns + */ + @JsonProperty(JSON_PROPERTY_COLUMNS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getColumns() { + return columns; + } + + public void setColumns(List columns) { + this.columns = columns; + if (columns != null) { + for (TopologyMapInlineNodeColumn item : columns) { + this.unparsed |= item.unparsed; + } + } + } + + /** Return true if this TopologyMapInlineNodesData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapInlineNodesData topologyMapInlineNodesData = (TopologyMapInlineNodesData) o; + return Objects.equals(this.columns, topologyMapInlineNodesData.columns); + } + + @Override + public int hashCode() { + return Objects.hash(columns); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapInlineNodesData {\n"); + sb.append(" columns: ").append(toIndentedString(columns)).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/TopologyMapLayout.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapLayout.java new file mode 100644 index 00000000000..c317e4c7b92 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapLayout.java @@ -0,0 +1,134 @@ +/* + * 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.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.Objects; + +/** + * Algorithm that positions nodes and edges. The hierarchical layout places nodes in + * ranks so edges flow in one direction. + */ +@JsonPropertyOrder({ + TopologyMapLayout.JSON_PROPERTY_DIRECTION, + TopologyMapLayout.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapLayout { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DIRECTION = "direction"; + private TopologyMapLayoutDirection direction; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TopologyMapLayoutType type = TopologyMapLayoutType.HIERARCHICAL; + + public TopologyMapLayout() {} + + @JsonCreator + public TopologyMapLayout( + @JsonProperty(required = true, value = JSON_PROPERTY_DIRECTION) + TopologyMapLayoutDirection direction, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TopologyMapLayoutType type) { + this.direction = direction; + this.unparsed |= !direction.isValid(); + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TopologyMapLayout direction(TopologyMapLayoutDirection direction) { + this.direction = direction; + this.unparsed |= !direction.isValid(); + return this; + } + + /** + * Direction of ranks. For example, top-to-bottom places first-rank nodes at the top + * and last-rank nodes at the bottom. + * + * @return direction + */ + @JsonProperty(JSON_PROPERTY_DIRECTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapLayoutDirection getDirection() { + return direction; + } + + public void setDirection(TopologyMapLayoutDirection direction) { + if (!direction.isValid()) { + this.unparsed = true; + } + this.direction = direction; + } + + public TopologyMapLayout type(TopologyMapLayoutType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of layout algorithm. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapLayoutType getType() { + return type; + } + + public void setType(TopologyMapLayoutType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this TopologyMapLayout object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapLayout topologyMapLayout = (TopologyMapLayout) o; + return Objects.equals(this.direction, topologyMapLayout.direction) + && Objects.equals(this.type, topologyMapLayout.type); + } + + @Override + public int hashCode() { + return Objects.hash(direction, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapLayout {\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/TopologyMapLayoutDirection.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapLayoutDirection.java new file mode 100644 index 00000000000..f29d3db280d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapLayoutDirection.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; + +/** + * Direction of ranks. For example, top-to-bottom places first-rank nodes at the top + * and last-rank nodes at the bottom. + */ +@JsonSerialize(using = TopologyMapLayoutDirection.TopologyMapLayoutDirectionSerializer.class) +public class TopologyMapLayoutDirection extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("top-to-bottom", "bottom-to-top", "left-to-right", "right-to-left")); + + public static final TopologyMapLayoutDirection TOP_TO_BOTTOM = + new TopologyMapLayoutDirection("top-to-bottom"); + public static final TopologyMapLayoutDirection BOTTOM_TO_TOP = + new TopologyMapLayoutDirection("bottom-to-top"); + public static final TopologyMapLayoutDirection LEFT_TO_RIGHT = + new TopologyMapLayoutDirection("left-to-right"); + public static final TopologyMapLayoutDirection RIGHT_TO_LEFT = + new TopologyMapLayoutDirection("right-to-left"); + + TopologyMapLayoutDirection(String value) { + super(value, allowedValues); + } + + public static class TopologyMapLayoutDirectionSerializer + extends StdSerializer { + public TopologyMapLayoutDirectionSerializer(Class t) { + super(t); + } + + public TopologyMapLayoutDirectionSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyMapLayoutDirection value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyMapLayoutDirection fromValue(String value) { + return new TopologyMapLayoutDirection(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapLayoutType.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapLayoutType.java new file mode 100644 index 00000000000..8d0d7449431 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapLayoutType.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; + +/** Type of layout algorithm. */ +@JsonSerialize(using = TopologyMapLayoutType.TopologyMapLayoutTypeSerializer.class) +public class TopologyMapLayoutType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("hierarchical")); + + public static final TopologyMapLayoutType HIERARCHICAL = + new TopologyMapLayoutType("hierarchical"); + + TopologyMapLayoutType(String value) { + super(value, allowedValues); + } + + public static class TopologyMapLayoutTypeSerializer extends StdSerializer { + public TopologyMapLayoutTypeSerializer(Class t) { + super(t); + } + + public TopologyMapLayoutTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyMapLayoutType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyMapLayoutType fromValue(String value) { + return new TopologyMapLayoutType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapWidgetDefinition.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapWidgetDefinition.java index 1c56033436d..9d6720c9653 100644 --- a/src/main/java/com/datadog/api/client/v1/model/TopologyMapWidgetDefinition.java +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapWidgetDefinition.java @@ -180,6 +180,52 @@ public TopologyMapWidgetDefinition deserialize(JsonParser jp, DeserializationCon e); } + // deserialize TopologyMapWidgetDefinitionCustom + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TopologyMapWidgetDefinitionCustom.class.equals(Integer.class) + || TopologyMapWidgetDefinitionCustom.class.equals(Long.class) + || TopologyMapWidgetDefinitionCustom.class.equals(Float.class) + || TopologyMapWidgetDefinitionCustom.class.equals(Double.class) + || TopologyMapWidgetDefinitionCustom.class.equals(Boolean.class) + || TopologyMapWidgetDefinitionCustom.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TopologyMapWidgetDefinitionCustom.class.equals(Integer.class) + || TopologyMapWidgetDefinitionCustom.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TopologyMapWidgetDefinitionCustom.class.equals(Float.class) + || TopologyMapWidgetDefinitionCustom.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TopologyMapWidgetDefinitionCustom.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TopologyMapWidgetDefinitionCustom.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TopologyMapWidgetDefinitionCustom.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 (!((TopologyMapWidgetDefinitionCustom) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TopologyMapWidgetDefinitionCustom'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'TopologyMapWidgetDefinitionCustom'", e); + } + TopologyMapWidgetDefinition ret = new TopologyMapWidgetDefinition(); if (match == 1) { ret.setActualInstance(deserialized); @@ -220,6 +266,11 @@ public TopologyMapWidgetDefinition(TopologyMapWidgetDefinitionServiceMap o) { setActualInstance(o); } + public TopologyMapWidgetDefinition(TopologyMapWidgetDefinitionCustom o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "TopologyMapWidgetDefinitionDataStreams", @@ -227,6 +278,9 @@ public TopologyMapWidgetDefinition(TopologyMapWidgetDefinitionServiceMap o) { schemas.put( "TopologyMapWidgetDefinitionServiceMap", new GenericType() {}); + schemas.put( + "TopologyMapWidgetDefinitionCustom", + new GenericType() {}); JSON.registerDescendants( TopologyMapWidgetDefinition.class, Collections.unmodifiableMap(schemas)); } @@ -239,7 +293,7 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: TopologyMapWidgetDefinitionDataStreams, - * TopologyMapWidgetDefinitionServiceMap + * TopologyMapWidgetDefinitionServiceMap, TopologyMapWidgetDefinitionCustom * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -256,6 +310,11 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf( + TopologyMapWidgetDefinitionCustom.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); @@ -263,15 +322,15 @@ public void setActualInstance(Object instance) { } throw new RuntimeException( "Invalid instance type. Must be TopologyMapWidgetDefinitionDataStreams," - + " TopologyMapWidgetDefinitionServiceMap"); + + " TopologyMapWidgetDefinitionServiceMap, TopologyMapWidgetDefinitionCustom"); } /** * Get the actual instance, which can be the following: TopologyMapWidgetDefinitionDataStreams, - * TopologyMapWidgetDefinitionServiceMap + * TopologyMapWidgetDefinitionServiceMap, TopologyMapWidgetDefinitionCustom * * @return The actual instance (TopologyMapWidgetDefinitionDataStreams, - * TopologyMapWidgetDefinitionServiceMap) + * TopologyMapWidgetDefinitionServiceMap, TopologyMapWidgetDefinitionCustom) */ @Override public Object getActualInstance() { @@ -301,4 +360,16 @@ public TopologyMapWidgetDefinitionServiceMap getTopologyMapWidgetDefinitionServi throws ClassCastException { return (TopologyMapWidgetDefinitionServiceMap) super.getActualInstance(); } + + /** + * Get the actual instance of `TopologyMapWidgetDefinitionCustom`. If the actual instance is not + * `TopologyMapWidgetDefinitionCustom`, the ClassCastException will be thrown. + * + * @return The actual instance of `TopologyMapWidgetDefinitionCustom` + * @throws ClassCastException if the instance is not `TopologyMapWidgetDefinitionCustom` + */ + public TopologyMapWidgetDefinitionCustom getTopologyMapWidgetDefinitionCustom() + throws ClassCastException { + return (TopologyMapWidgetDefinitionCustom) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyMapWidgetDefinitionCustom.java b/src/main/java/com/datadog/api/client/v1/model/TopologyMapWidgetDefinitionCustom.java new file mode 100644 index 00000000000..3e4d62bcfae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyMapWidgetDefinitionCustom.java @@ -0,0 +1,408 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** + * Custom topology map widget. Renders nodes and edges from inline data and from scalar + * requests. There is one node for each node ID found in data.nodes, + * data.edges, and requests. When data and several requests + * set the same field on the same node (such as title or values[0]), the + * last non-null value wins. + */ +@JsonPropertyOrder({ + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_CUSTOM_LINKS, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_DATA, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_DESCRIPTION, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_LAYOUT, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_REQUESTS, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_TIME, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_TITLE, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_TITLE_ALIGN, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_TITLE_SIZE, + TopologyMapWidgetDefinitionCustom.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyMapWidgetDefinitionCustom { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CUSTOM_LINKS = "custom_links"; + private List customLinks = null; + + public static final String JSON_PROPERTY_DATA = "data"; + private TopologyMapInlineData data; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_LAYOUT = "layout"; + private TopologyMapLayout layout; + + public static final String JSON_PROPERTY_REQUESTS = "requests"; + private List requests = new ArrayList<>(); + + public static final String JSON_PROPERTY_TIME = "time"; + private WidgetTime time; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_TITLE_ALIGN = "title_align"; + private WidgetTextAlign titleAlign; + + public static final String JSON_PROPERTY_TITLE_SIZE = "title_size"; + private String titleSize; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TopologyMapWidgetDefinitionType type = TopologyMapWidgetDefinitionType.TOPOLOGY_MAP; + + public TopologyMapWidgetDefinitionCustom() {} + + @JsonCreator + public TopologyMapWidgetDefinitionCustom( + @JsonProperty(required = true, value = JSON_PROPERTY_LAYOUT) TopologyMapLayout layout, + @JsonProperty(required = true, value = JSON_PROPERTY_REQUESTS) + List requests, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + TopologyMapWidgetDefinitionType type) { + this.layout = layout; + this.unparsed |= layout.unparsed; + this.requests = requests; + for (TopologyRequestCustom item : requests) { + this.unparsed |= item.unparsed; + } + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TopologyMapWidgetDefinitionCustom customLinks(List customLinks) { + this.customLinks = customLinks; + if (customLinks != null) { + for (WidgetCustomLink item : customLinks) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public TopologyMapWidgetDefinitionCustom addCustomLinksItem(WidgetCustomLink customLinksItem) { + if (this.customLinks == null) { + this.customLinks = new ArrayList<>(); + } + this.customLinks.add(customLinksItem); + this.unparsed |= customLinksItem.unparsed; + return this; + } + + /** + * List of custom links. + * + * @return customLinks + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getCustomLinks() { + return customLinks; + } + + public void setCustomLinks(List customLinks) { + this.customLinks = customLinks; + if (customLinks != null) { + for (WidgetCustomLink item : customLinks) { + this.unparsed |= item.unparsed; + } + } + } + + public TopologyMapWidgetDefinitionCustom data(TopologyMapInlineData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Static nodes and edges, stored in columns. Within a table, every column must have the same + * number of values and a unique id. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TopologyMapInlineData getData() { + return data; + } + + public void setData(TopologyMapInlineData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + public TopologyMapWidgetDefinitionCustom description(String description) { + this.description = description; + return this; + } + + /** + * The description of the widget. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public TopologyMapWidgetDefinitionCustom layout(TopologyMapLayout layout) { + this.layout = layout; + this.unparsed |= layout.unparsed; + return this; + } + + /** + * Algorithm that positions nodes and edges. The hierarchical layout places nodes in + * ranks so edges flow in one direction. + * + * @return layout + */ + @JsonProperty(JSON_PROPERTY_LAYOUT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapLayout getLayout() { + return layout; + } + + public void setLayout(TopologyMapLayout layout) { + this.layout = layout; + if (layout != null) { + this.unparsed |= layout.unparsed; + } + } + + public TopologyMapWidgetDefinitionCustom requests(List requests) { + this.requests = requests; + for (TopologyRequestCustom item : requests) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TopologyMapWidgetDefinitionCustom addRequestsItem(TopologyRequestCustom requestsItem) { + this.requests.add(requestsItem); + this.unparsed |= requestsItem.unparsed; + return this; + } + + /** + * List of scalar requests that supply node data. Can be empty. + * + * @return requests + */ + @JsonProperty(JSON_PROPERTY_REQUESTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRequests() { + return requests; + } + + public void setRequests(List requests) { + this.requests = requests; + if (requests != null) { + for (TopologyRequestCustom item : requests) { + this.unparsed |= item.unparsed; + } + } + } + + public TopologyMapWidgetDefinitionCustom time(WidgetTime time) { + this.time = time; + this.unparsed |= time.unparsed; + return this; + } + + /** + * Time setting for the widget. + * + * @return time + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetTime getTime() { + return time; + } + + public void setTime(WidgetTime time) { + this.time = time; + if (time != null) { + this.unparsed |= time.unparsed; + } + } + + public TopologyMapWidgetDefinitionCustom title(String title) { + this.title = title; + return this; + } + + /** + * Title of your widget. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public TopologyMapWidgetDefinitionCustom titleAlign(WidgetTextAlign titleAlign) { + this.titleAlign = titleAlign; + this.unparsed |= !titleAlign.isValid(); + return this; + } + + /** + * How to align the text on the widget. + * + * @return titleAlign + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE_ALIGN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetTextAlign getTitleAlign() { + return titleAlign; + } + + public void setTitleAlign(WidgetTextAlign titleAlign) { + if (!titleAlign.isValid()) { + this.unparsed = true; + } + this.titleAlign = titleAlign; + } + + public TopologyMapWidgetDefinitionCustom titleSize(String titleSize) { + this.titleSize = titleSize; + return this; + } + + /** + * Size of the title. + * + * @return titleSize + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitleSize() { + return titleSize; + } + + public void setTitleSize(String titleSize) { + this.titleSize = titleSize; + } + + public TopologyMapWidgetDefinitionCustom type(TopologyMapWidgetDefinitionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the topology map widget. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyMapWidgetDefinitionType getType() { + return type; + } + + public void setType(TopologyMapWidgetDefinitionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this TopologyMapWidgetDefinitionCustom object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyMapWidgetDefinitionCustom topologyMapWidgetDefinitionCustom = + (TopologyMapWidgetDefinitionCustom) o; + return Objects.equals(this.customLinks, topologyMapWidgetDefinitionCustom.customLinks) + && Objects.equals(this.data, topologyMapWidgetDefinitionCustom.data) + && Objects.equals(this.description, topologyMapWidgetDefinitionCustom.description) + && Objects.equals(this.layout, topologyMapWidgetDefinitionCustom.layout) + && Objects.equals(this.requests, topologyMapWidgetDefinitionCustom.requests) + && Objects.equals(this.time, topologyMapWidgetDefinitionCustom.time) + && Objects.equals(this.title, topologyMapWidgetDefinitionCustom.title) + && Objects.equals(this.titleAlign, topologyMapWidgetDefinitionCustom.titleAlign) + && Objects.equals(this.titleSize, topologyMapWidgetDefinitionCustom.titleSize) + && Objects.equals(this.type, topologyMapWidgetDefinitionCustom.type); + } + + @Override + public int hashCode() { + return Objects.hash( + customLinks, data, description, layout, requests, time, title, titleAlign, titleSize, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyMapWidgetDefinitionCustom {\n"); + sb.append(" customLinks: ").append(toIndentedString(customLinks)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" layout: ").append(toIndentedString(layout)).append("\n"); + sb.append(" requests: ").append(toIndentedString(requests)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" titleAlign: ").append(toIndentedString(titleAlign)).append("\n"); + sb.append(" titleSize: ").append(toIndentedString(titleSize)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/TopologyRequestCustom.java b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustom.java new file mode 100644 index 00000000000..c961c57bb86 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustom.java @@ -0,0 +1,257 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** Scalar request whose result rows become nodes. */ +@JsonPropertyOrder({ + TopologyRequestCustom.JSON_PROPERTY_FORMULAS, + TopologyRequestCustom.JSON_PROPERTY_PROJECTION, + TopologyRequestCustom.JSON_PROPERTY_QUERIES, + TopologyRequestCustom.JSON_PROPERTY_RESPONSE_FORMAT, + TopologyRequestCustom.JSON_PROPERTY_SORT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyRequestCustom { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FORMULAS = "formulas"; + private List formulas = null; + + public static final String JSON_PROPERTY_PROJECTION = "projection"; + private TopologyRequestCustomProjection projection; + + public static final String JSON_PROPERTY_QUERIES = "queries"; + private List queries = new ArrayList<>(); + + public static final String JSON_PROPERTY_RESPONSE_FORMAT = "response_format"; + private TopologyRequestCustomResponseFormat responseFormat = + TopologyRequestCustomResponseFormat.SCALAR; + + public static final String JSON_PROPERTY_SORT = "sort"; + private WidgetSortBy sort; + + public TopologyRequestCustom() {} + + @JsonCreator + public TopologyRequestCustom( + @JsonProperty(required = true, value = JSON_PROPERTY_PROJECTION) + TopologyRequestCustomProjection projection, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERIES) + List queries, + @JsonProperty(required = true, value = JSON_PROPERTY_RESPONSE_FORMAT) + TopologyRequestCustomResponseFormat responseFormat) { + this.projection = projection; + this.unparsed |= projection.unparsed; + this.queries = queries; + for (FormulaAndFunctionQueryDefinition item : queries) { + this.unparsed |= item.unparsed; + } + this.responseFormat = responseFormat; + this.unparsed |= !responseFormat.isValid(); + } + + public TopologyRequestCustom formulas(List formulas) { + this.formulas = formulas; + if (formulas != null) { + for (WidgetFormula item : formulas) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public TopologyRequestCustom addFormulasItem(WidgetFormula formulasItem) { + if (this.formulas == null) { + this.formulas = new ArrayList<>(); + } + this.formulas.add(formulasItem); + this.unparsed |= formulasItem.unparsed; + return this; + } + + /** + * List of formulas that operate on queries. + * + * @return formulas + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FORMULAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFormulas() { + return formulas; + } + + public void setFormulas(List formulas) { + this.formulas = formulas; + if (formulas != null) { + for (WidgetFormula item : formulas) { + this.unparsed |= item.unparsed; + } + } + } + + public TopologyRequestCustom projection(TopologyRequestCustomProjection projection) { + this.projection = projection; + this.unparsed |= projection.unparsed; + return this; + } + + /** + * Mapping from result columns to node fields. Each result row feeds one node. + * + * @return projection + */ + @JsonProperty(JSON_PROPERTY_PROJECTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyRequestCustomProjection getProjection() { + return projection; + } + + public void setProjection(TopologyRequestCustomProjection projection) { + this.projection = projection; + if (projection != null) { + this.unparsed |= projection.unparsed; + } + } + + public TopologyRequestCustom queries(List queries) { + this.queries = queries; + for (FormulaAndFunctionQueryDefinition item : queries) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TopologyRequestCustom addQueriesItem(FormulaAndFunctionQueryDefinition queriesItem) { + this.queries.add(queriesItem); + this.unparsed |= queriesItem.unparsed; + return this; + } + + /** + * List of queries that can be returned directly or used in formulas. + * + * @return queries + */ + @JsonProperty(JSON_PROPERTY_QUERIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getQueries() { + return queries; + } + + public void setQueries(List queries) { + this.queries = queries; + if (queries != null) { + for (FormulaAndFunctionQueryDefinition item : queries) { + this.unparsed |= item.unparsed; + } + } + } + + public TopologyRequestCustom responseFormat(TopologyRequestCustomResponseFormat responseFormat) { + this.responseFormat = responseFormat; + this.unparsed |= !responseFormat.isValid(); + return this; + } + + /** + * Response format of a custom topology map request. + * + * @return responseFormat + */ + @JsonProperty(JSON_PROPERTY_RESPONSE_FORMAT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyRequestCustomResponseFormat getResponseFormat() { + return responseFormat; + } + + public void setResponseFormat(TopologyRequestCustomResponseFormat responseFormat) { + if (!responseFormat.isValid()) { + this.unparsed = true; + } + this.responseFormat = responseFormat; + } + + public TopologyRequestCustom sort(WidgetSortBy sort) { + this.sort = sort; + this.unparsed |= sort.unparsed; + return this; + } + + /** + * The controls for sorting the widget. + * + * @return sort + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SORT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetSortBy getSort() { + return sort; + } + + public void setSort(WidgetSortBy sort) { + this.sort = sort; + if (sort != null) { + this.unparsed |= sort.unparsed; + } + } + + /** Return true if this TopologyRequestCustom object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyRequestCustom topologyRequestCustom = (TopologyRequestCustom) o; + return Objects.equals(this.formulas, topologyRequestCustom.formulas) + && Objects.equals(this.projection, topologyRequestCustom.projection) + && Objects.equals(this.queries, topologyRequestCustom.queries) + && Objects.equals(this.responseFormat, topologyRequestCustom.responseFormat) + && Objects.equals(this.sort, topologyRequestCustom.sort); + } + + @Override + public int hashCode() { + return Objects.hash(formulas, projection, queries, responseFormat, sort); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyRequestCustom {\n"); + sb.append(" formulas: ").append(toIndentedString(formulas)).append("\n"); + sb.append(" projection: ").append(toIndentedString(projection)).append("\n"); + sb.append(" queries: ").append(toIndentedString(queries)).append("\n"); + sb.append(" responseFormat: ").append(toIndentedString(responseFormat)).append("\n"); + sb.append(" sort: ").append(toIndentedString(sort)).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/TopologyRequestCustomProjection.java b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomProjection.java new file mode 100644 index 00000000000..183115534aa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomProjection.java @@ -0,0 +1,150 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** Mapping from result columns to node fields. Each result row feeds one node. */ +@JsonPropertyOrder({ + TopologyRequestCustomProjection.JSON_PROPERTY_DIMENSIONS, + TopologyRequestCustomProjection.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyRequestCustomProjection { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DIMENSIONS = "dimensions"; + private List dimensions = new ArrayList<>(); + + public static final String JSON_PROPERTY_TYPE = "type"; + private TopologyRequestCustomProjectionType type = + TopologyRequestCustomProjectionType.CUSTOM_TOPOLOGY_MAP_NODE; + + public TopologyRequestCustomProjection() {} + + @JsonCreator + public TopologyRequestCustomProjection( + @JsonProperty(required = true, value = JSON_PROPERTY_DIMENSIONS) + List dimensions, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + TopologyRequestCustomProjectionType type) { + this.dimensions = dimensions; + for (TopologyRequestCustomProjectionDimension item : dimensions) { + this.unparsed |= item.unparsed; + } + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TopologyRequestCustomProjection dimensions( + List dimensions) { + this.dimensions = dimensions; + for (TopologyRequestCustomProjectionDimension item : dimensions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TopologyRequestCustomProjection addDimensionsItem( + TopologyRequestCustomProjectionDimension dimensionsItem) { + this.dimensions.add(dimensionsItem); + this.unparsed |= dimensionsItem.unparsed; + return this; + } + + /** + * List of mappings from a result column to a node field. Each dimension must be + * unique. + * + * @return dimensions + */ + @JsonProperty(JSON_PROPERTY_DIMENSIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getDimensions() { + return dimensions; + } + + public void setDimensions(List dimensions) { + this.dimensions = dimensions; + if (dimensions != null) { + for (TopologyRequestCustomProjectionDimension item : dimensions) { + this.unparsed |= item.unparsed; + } + } + } + + public TopologyRequestCustomProjection type(TopologyRequestCustomProjectionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Projection type. Each result row is a node. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TopologyRequestCustomProjectionType getType() { + return type; + } + + public void setType(TopologyRequestCustomProjectionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this TopologyRequestCustomProjection object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyRequestCustomProjection topologyRequestCustomProjection = + (TopologyRequestCustomProjection) o; + return Objects.equals(this.dimensions, topologyRequestCustomProjection.dimensions) + && Objects.equals(this.type, topologyRequestCustomProjection.type); + } + + @Override + public int hashCode() { + return Objects.hash(dimensions, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyRequestCustomProjection {\n"); + sb.append(" dimensions: ").append(toIndentedString(dimensions)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/TopologyRequestCustomProjectionDimension.java b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomProjectionDimension.java new file mode 100644 index 00000000000..e42ab46f7cb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomProjectionDimension.java @@ -0,0 +1,125 @@ +/* + * 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.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.Objects; + +/** Mapping from one result column to one node field. */ +@JsonPropertyOrder({ + TopologyRequestCustomProjectionDimension.JSON_PROPERTY_COLUMN, + TopologyRequestCustomProjectionDimension.JSON_PROPERTY_DIMENSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TopologyRequestCustomProjectionDimension { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COLUMN = "column"; + private String column; + + public static final String JSON_PROPERTY_DIMENSION = "dimension"; + private String dimension; + + public TopologyRequestCustomProjectionDimension() {} + + @JsonCreator + public TopologyRequestCustomProjectionDimension( + @JsonProperty(required = true, value = JSON_PROPERTY_COLUMN) String column, + @JsonProperty(required = true, value = JSON_PROPERTY_DIMENSION) String dimension) { + this.column = column; + this.dimension = dimension; + } + + public TopologyRequestCustomProjectionDimension column(String column) { + this.column = column; + return this; + } + + /** + * Column name from the result. Must be a group-by tag key or a formula. + * + * @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 TopologyRequestCustomProjectionDimension dimension(String dimension) { + this.dimension = dimension; + return this; + } + + /** + * Node field that receives the column's value: id, title, + * subtitle, or values[N] for the value at position N. When id is + * not set, each node's ID is derived from the group-by tags (for example, + * env:prod,service:web). When title is not set, the title is the node's ID. + * When several rows set the same non-id field on a node, the last non-null value + * wins. + * + * @return dimension + */ + @JsonProperty(JSON_PROPERTY_DIMENSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDimension() { + return dimension; + } + + public void setDimension(String dimension) { + this.dimension = dimension; + } + + /** Return true if this TopologyRequestCustomProjectionDimension object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TopologyRequestCustomProjectionDimension topologyRequestCustomProjectionDimension = + (TopologyRequestCustomProjectionDimension) o; + return Objects.equals(this.column, topologyRequestCustomProjectionDimension.column) + && Objects.equals(this.dimension, topologyRequestCustomProjectionDimension.dimension); + } + + @Override + public int hashCode() { + return Objects.hash(column, dimension); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TopologyRequestCustomProjectionDimension {\n"); + sb.append(" column: ").append(toIndentedString(column)).append("\n"); + sb.append(" dimension: ").append(toIndentedString(dimension)).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/TopologyRequestCustomProjectionType.java b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomProjectionType.java new file mode 100644 index 00000000000..a513f914164 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomProjectionType.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** Projection type. Each result row is a node. */ +@JsonSerialize( + using = TopologyRequestCustomProjectionType.TopologyRequestCustomProjectionTypeSerializer.class) +public class TopologyRequestCustomProjectionType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("custom_topology_map_node")); + + public static final TopologyRequestCustomProjectionType CUSTOM_TOPOLOGY_MAP_NODE = + new TopologyRequestCustomProjectionType("custom_topology_map_node"); + + TopologyRequestCustomProjectionType(String value) { + super(value, allowedValues); + } + + public static class TopologyRequestCustomProjectionTypeSerializer + extends StdSerializer { + public TopologyRequestCustomProjectionTypeSerializer( + Class t) { + super(t); + } + + public TopologyRequestCustomProjectionTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyRequestCustomProjectionType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyRequestCustomProjectionType fromValue(String value) { + return new TopologyRequestCustomProjectionType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomResponseFormat.java b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomResponseFormat.java new file mode 100644 index 00000000000..c48e0af0d72 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/TopologyRequestCustomResponseFormat.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; + +/** Response format of a custom topology map request. */ +@JsonSerialize( + using = TopologyRequestCustomResponseFormat.TopologyRequestCustomResponseFormatSerializer.class) +public class TopologyRequestCustomResponseFormat extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("scalar")); + + public static final TopologyRequestCustomResponseFormat SCALAR = + new TopologyRequestCustomResponseFormat("scalar"); + + TopologyRequestCustomResponseFormat(String value) { + super(value, allowedValues); + } + + public static class TopologyRequestCustomResponseFormatSerializer + extends StdSerializer { + public TopologyRequestCustomResponseFormatSerializer( + Class t) { + super(t); + } + + public TopologyRequestCustomResponseFormatSerializer() { + this(null); + } + + @Override + public void serialize( + TopologyRequestCustomResponseFormat value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TopologyRequestCustomResponseFormat fromValue(String value) { + return new TopologyRequestCustomResponseFormat(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature b/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature index 10d1ecf15be..311dff9a97a 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature @@ -1218,6 +1218,22 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula" And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0 + @team:ddoghq/dashboards-backend + Scenario: Create a new dashboard with topology_map custom widget + Given new "CreateDashboard" request + And body from file "dashboards_json_payload/topology_map_widget_custom.json" + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "topology_map" + And the response "widgets[0].definition.layout.type" is equal to "hierarchical" + And the response "widgets[0].definition.layout.direction" is equal to "left-to-right" + And the response "widgets[0].definition.data.nodes.columns[0].id" is equal to "id" + And the response "widgets[0].definition.data.nodes.columns[2].meta.unit.unit_name" is equal to "second" + And the response "widgets[0].definition.data.edges.columns[1].values" is equal to ["service:db"] + And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar" + And the response "widgets[0].definition.requests[0].projection.type" is equal to "custom_topology_map_node" + And the response "widgets[0].definition.requests[0].projection.dimensions[0].dimension" is equal to "values[0]" + @team:ddoghq/dashboards-backend Scenario: Create a new dashboard with topology_map data_streams widget Given new "CreateDashboard" request diff --git a/src/test/resources/com/datadog/api/client/v1/api/dashboards_json_payload/topology_map_widget_custom.json b/src/test/resources/com/datadog/api/client/v1/api/dashboards_json_payload/topology_map_widget_custom.json new file mode 100644 index 00000000000..b6aa927a133 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v1/api/dashboards_json_payload/topology_map_widget_custom.json @@ -0,0 +1,95 @@ +{ + "title": "{{ unique }}", + "description": "", + "widgets": [ + { + "layout": { + "x": 0, + "y": 0, + "width": 47, + "height": 15 + }, + "definition": { + "title": "", + "title_size": "16", + "title_align": "left", + "type": "topology_map", + "layout": { + "type": "hierarchical", + "direction": "left-to-right" + }, + "data": { + "nodes": { + "columns": [ + { + "kind": "string", + "id": "id", + "values": ["service:web", "service:db"] + }, + { + "kind": "string", + "id": "subtitle", + "values": ["api-team", null] + }, + { + "kind": "scalar", + "id": "values[1]", + "values": [1.5, null], + "meta": { + "unit": { + "type": "canonical_unit", + "unit_name": "second" + } + } + } + ] + }, + "edges": { + "columns": [ + { + "kind": "string", + "id": "source", + "values": ["service:web"] + }, + { + "kind": "string", + "id": "target", + "values": ["service:db"] + } + ] + } + }, + "requests": [ + { + "response_format": "scalar", + "queries": [ + { + "data_source": "metrics", + "name": "a", + "query": "avg:system.cpu.user{*} by {service}", + "aggregator": "avg" + } + ], + "formulas": [ + { + "formula": "a" + } + ], + "projection": { + "type": "custom_topology_map_node", + "dimensions": [ + { + "column": "a", + "dimension": "values[0]" + } + ] + } + } + ] + } + } + ], + "template_variables": [], + "layout_type": "free", + "notify_list": [] +} diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index 49d84fde6c0..b37f828e5fc 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -840,6 +840,13 @@ "scenario": "Create a new dashboard with toplist widget", "version": "v1" }, + { + "feature": "Dashboards", + "feature_file": "../../com/datadog/api/client/v1/api/dashboards.feature", + "file": "v1/dashboards/create-a-new-dashboard-with-topology-map-custom-widget.json", + "scenario": "Create a new dashboard with topology_map custom widget", + "version": "v1" + }, { "feature": "Dashboards", "feature_file": "../../com/datadog/api/client/v1/api/dashboards.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-topology-map-custom-widget.json b/src/test/resources/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-topology-map-custom-widget.json new file mode 100644 index 00000000000..f275ce759c0 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-topology-map-custom-widget.json @@ -0,0 +1,133 @@ +{ + "api": "Dashboards", + "expected_status": 200, + "feature": "Dashboards", + "id": "v1/Dashboards/Create a new dashboard with topology_map custom widget", + "operation_id": "CreateDashboard", + "request": { + "body": { + "schema": { + "format": null, + "ref": "Dashboard", + "type": "object" + }, + "source": "dashboards_json_payload/topology_map_widget_custom.json", + "value": { + "description": "", + "layout_type": "free", + "notify_list": [], + "template_variables": [], + "title": "{{ unique }}", + "widgets": [ + { + "definition": { + "data": { + "edges": { + "columns": [ + { + "id": "source", + "kind": "string", + "values": [ + "service:web" + ] + }, + { + "id": "target", + "kind": "string", + "values": [ + "service:db" + ] + } + ] + }, + "nodes": { + "columns": [ + { + "id": "id", + "kind": "string", + "values": [ + "service:web", + "service:db" + ] + }, + { + "id": "subtitle", + "kind": "string", + "values": [ + "api-team", + null + ] + }, + { + "id": "values[1]", + "kind": "scalar", + "meta": { + "unit": { + "type": "canonical_unit", + "unit_name": "second" + } + }, + "values": [ + 1.5, + null + ] + } + ] + } + }, + "layout": { + "direction": "left-to-right", + "type": "hierarchical" + }, + "requests": [ + { + "formulas": [ + { + "formula": "a" + } + ], + "projection": { + "dimensions": [ + { + "column": "a", + "dimension": "values[0]" + } + ], + "type": "custom_topology_map_node" + }, + "queries": [ + { + "aggregator": "avg", + "data_source": "metrics", + "name": "a", + "query": "avg:system.cpu.user{*} by {service}" + } + ], + "response_format": "scalar" + } + ], + "title": "", + "title_align": "left", + "title_size": "16", + "type": "topology_map" + }, + "layout": { + "height": 15, + "width": 47, + "x": 0, + "y": 0 + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v1/dashboard" + }, + "scenario": "Create a new dashboard with topology_map custom widget", + "schema_version": 1, + "version": "v1" +} diff --git a/src/test/resources/generated-test/test-server-data/v1/dashboards.json b/src/test/resources/generated-test/test-server-data/v1/dashboards.json index 7f8ed4b0cf7..c11782ed7a1 100644 --- a/src/test/resources/generated-test/test-server-data/v1/dashboards.json +++ b/src/test/resources/generated-test/test-server-data/v1/dashboards.json @@ -10352,6 +10352,167 @@ "scenario": "Create a new dashboard with toplist widget", "version": "v1" }, + { + "feature": "Dashboards", + "frozen_at": "2026-10-27T13:31:23.791Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "description": "", + "layout_type": "free", + "notify_list": [], + "template_variables": [], + "title": "Test-Create_a_new_dashboard_with_topology_map_custom_widget-1793107883", + "widgets": [ + { + "definition": { + "data": { + "edges": { + "columns": [ + { + "id": "source", + "kind": "string", + "values": [ + "service:web" + ] + }, + { + "id": "target", + "kind": "string", + "values": [ + "service:db" + ] + } + ] + }, + "nodes": { + "columns": [ + { + "id": "id", + "kind": "string", + "values": [ + "service:web", + "service:db" + ] + }, + { + "id": "subtitle", + "kind": "string", + "values": [ + "api-team", + null + ] + }, + { + "id": "values[1]", + "kind": "scalar", + "meta": { + "unit": { + "type": "canonical_unit", + "unit_name": "second" + } + }, + "values": [ + 1.5, + null + ] + } + ] + } + }, + "layout": { + "direction": "left-to-right", + "type": "hierarchical" + }, + "requests": [ + { + "formulas": [ + { + "formula": "a" + } + ], + "projection": { + "dimensions": [ + { + "column": "a", + "dimension": "values[0]" + } + ], + "type": "custom_topology_map_node" + }, + "queries": [ + { + "aggregator": "avg", + "data_source": "metrics", + "name": "a", + "query": "avg:system.cpu.user{*} by {service}" + } + ], + "response_format": "scalar" + } + ], + "title": "", + "title_align": "left", + "title_size": "16", + "type": "topology_map" + }, + "layout": { + "height": 15, + "width": 47, + "x": 0, + "y": 0 + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v1/dashboard", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"id\":\"xnh-jbg-tsu\",\"title\":\"Test-Create_a_new_dashboard_with_topology_map_custom_widget-1793107883\",\"description\":\"\",\"author_handle\":\"adam.hooper@datadoghq.com\",\"author_name\":\"Adam Hooper\",\"layout_type\":\"free\",\"url\":\"/dashboard/xnh-jbg-tsu/test-createanewdashboardwithtopologymapcustomwidget-1793107883\",\"template_variables\":[],\"widgets\":[{\"definition\":{\"data\":{\"edges\":{\"columns\":[{\"id\":\"source\",\"kind\":\"string\",\"values\":[\"service:web\"]},{\"id\":\"target\",\"kind\":\"string\",\"values\":[\"service:db\"]}]},\"nodes\":{\"columns\":[{\"id\":\"id\",\"kind\":\"string\",\"values\":[\"service:web\",\"service:db\"]},{\"id\":\"subtitle\",\"kind\":\"string\",\"values\":[\"api-team\",null]},{\"id\":\"values[1]\",\"kind\":\"scalar\",\"meta\":{\"unit\":{\"type\":\"canonical_unit\",\"unit_name\":\"second\"}},\"values\":[1.5,null]}]}},\"layout\":{\"direction\":\"left-to-right\",\"type\":\"hierarchical\"},\"requests\":[{\"formulas\":[{\"formula\":\"a\"}],\"projection\":{\"dimensions\":[{\"column\":\"a\",\"dimension\":\"values[0]\"}],\"type\":\"custom_topology_map_node\"},\"queries\":[{\"aggregator\":\"avg\",\"data_source\":\"metrics\",\"name\":\"a\",\"query\":\"avg:system.cpu.user{*} by {service}\"}],\"response_format\":\"scalar\"}],\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"topology_map\"},\"layout\":{\"height\":15,\"width\":47,\"x\":0,\"y\":0},\"id\":4010058712923256}],\"notify_list\":[],\"created_at\":\"2026-10-27T13:31:23.986826+00:00\",\"modified_at\":\"2026-10-27T13:31:23.986826+00:00\",\"experience_type\":\"default\",\"archived_at\":null,\"restricted_roles\":[]}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v1/dashboard/xnh-jbg-tsu", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_dashboard_id\":\"xnh-jbg-tsu\"}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Create a new dashboard with topology_map custom widget", + "version": "v1" + }, { "feature": "Dashboards", "frozen_at": "2026-03-20T18:16:51.929Z",