From 9d17702c96e260a015790187c543af8b0645b7a9 Mon Sep 17 00:00:00 2001 From: lostbean Date: Tue, 2 Jul 2024 12:03:53 -0300 Subject: [PATCH] update topology API response to capture node's type and parent --- .../api/golang/server/server.gen.go | 27 ++++++++++--------- .../api/golang/types/types.gen.go | 17 ++++++++++++ .../api/typescript/client/types.d.ts | 7 +++++ libs/cli-kontrol-api/specs/api.yaml | 8 ++++++ 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/libs/cli-kontrol-api/api/golang/server/server.gen.go b/libs/cli-kontrol-api/api/golang/server/server.gen.go index dbb2a65b..af127f62 100644 --- a/libs/cli-kontrol-api/api/golang/server/server.gen.go +++ b/libs/cli-kontrol-api/api/golang/server/server.gen.go @@ -362,19 +362,20 @@ func (sh *strictHandler) GetTenantUuidTopology(ctx echo.Context, uuid Uuid) erro // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/9RWTW/jNhD9KwTbQwtIltvedGvttjC6KAJsclrsgSbHMnclDpcceWMY+u8LkpK/pAQO", - "cklOtsT5ePPeDEcHLrGxaMCQ5+WBW+FEAwQuPrWtVuFXgZdOW9JoeMkfHlZLhhtGW2AOPLZOAs+4DmdW", - "0JZn3IgGeJn8M+7gW6sdKF6SayHjXm6hESEw7W2w8+S0qXjXdcNhTL+oW0/g7tFijdU+4nNowZGGaACq", - "Sn80QRP//Oxgw0v+U3Eqq+gjFn+rCniXDUmFc2Ifng2qF0T5H9VElO68yk99yKwH+PlojesvICm4L2H3", - "T43fP1qQ47oUyq/g8pjdwwW0x7zCvI/Wn88+gttpCQs0G13x7GST68aio+DXKzKEzJJSJa80bdv1TGJT", - "9Ge5tyCPDxUWIZKPJV4zpxtRQV6jFIQuCvIoGlsHm7WQX8GoXJS1IPDEs2uxM+4T7jxhm/IeLMTYvZsg", - "NSo8YrMWa6jHbfwhvGYbdLGRg1KzSZCpv0fu91tgWoEhvdHghnlI1izoP7x6MjIJVwHdGjlZ3xL5qheP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mh/3lQ1xqIeETfZ/EZ/ay/wDQwGZJN53sT/k95WODATLN3F9eg3SW5cGFG7t0f2ek8wbRNoqgTBo9jz", + "Y1me3vIdOB8CBGKVPm/oJziPv71oMsX2nUP13pt/3H5hSZsNxv+6ptjHiw+r4j805LBmf96teMYHKkv+", + "22w+mwc60IIRVvOS/xGXEryYcEFghKHiECZJVyiwNaY5gD5mFogTQdyVCjWBnu6jx0Or1TJZZxdD7dP0", + "3/1kUsSh1X1OgoKnv1DFIyUa6itRWFtrGc8tvviQzeFsqD03PS6kj5RdFmjCzASzDhVDU++ZTFNwNEdj", + "yXmLxqe6+X0+fxHMidl7jWXHNjU+MukgBmGeBLWhGoLxlTbBsoiWcKtAgYhF8nhTIp3P5gleEmQmmOoJ", + "ehfSKKjhZdIsk8c765+A+agM+8XBDhyxcKFghKe2+vWti0Znt97+mnAp2L9wptfxjvwKtV6R+3OSXd/i", + "J5gZ9liYH66Jp0RWuu5HAAAA//8733XGoQwAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/libs/cli-kontrol-api/api/golang/types/types.gen.go b/libs/cli-kontrol-api/api/golang/types/types.gen.go index 0f9d8314..21a81a9b 100644 --- a/libs/cli-kontrol-api/api/golang/types/types.gen.go +++ b/libs/cli-kontrol-api/api/golang/types/types.gen.go @@ -7,6 +7,14 @@ import ( compose "github.com/compose-spec/compose-go/types" ) +// Defines values for NodeType. +const ( + Gateway NodeType = "gateway" + Redis NodeType = "redis" + Service NodeType = "service" + ServiceVersion NodeType = "service-version" +) + // ClusterTopology defines model for ClusterTopology. type ClusterTopology struct { Edges []Edge `json:"edges"` @@ -39,8 +47,17 @@ type Node struct { // Label Label for the node. Label *string `json:"label,omitempty"` + + // Parent Parent node + Parent *string `json:"parent,omitempty"` + + // Type Type of the node + Type NodeType `json:"type"` } +// NodeType Type of the node +type NodeType string + // ProdFlowSpec defines model for ProdFlowSpec. type ProdFlowSpec struct { DockerCompose *[]compose.ServiceConfig `json:"docker-compose,omitempty"` diff --git a/libs/cli-kontrol-api/api/typescript/client/types.d.ts b/libs/cli-kontrol-api/api/typescript/client/types.d.ts index 0123d294..619b0f0f 100644 --- a/libs/cli-kontrol-api/api/typescript/client/types.d.ts +++ b/libs/cli-kontrol-api/api/typescript/client/types.d.ts @@ -112,6 +112,13 @@ export interface components { id: string; /** @description Label for the node. */ label?: string; + /** + * @description Type of the node + * @enum {string} + */ + type: "gateway" | "service" | "service-version" | "redis"; + /** @description Parent node */ + parent?: string; }; Edge: { /** @description The identifier of the source node of the edge. */ diff --git a/libs/cli-kontrol-api/specs/api.yaml b/libs/cli-kontrol-api/specs/api.yaml index 0b6ef2b0..1e51d9cd 100644 --- a/libs/cli-kontrol-api/specs/api.yaml +++ b/libs/cli-kontrol-api/specs/api.yaml @@ -117,8 +117,16 @@ components: label: type: string description: Label for the node. + type: + type: string + enum: [gateway, service, service-version, redis] + description: Type of the node + parent: + type: string + description: Parent node required: - id + - type Edge: type: object