diff --git a/README.md b/README.md index 3ee86ae3..4f3802f6 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,26 @@ minikube tunnel ## Deploying Kardinal Manager to local cluster +Configure it by setting the following environment variables: + +```bash +KARDINAL_MANAGER_CLUSTER_CONFIG_ENDPOINT=http://localhost:8080/tenant/{36e22127-3c9e-4110-aa83-af552cd94b88}/cluster-resources +KARDINAL_MANAGER_FETCHER_JOB_DURATION_SECONDS=10 +``` + +or in the `kardinal-manager/deployment/k8s.yaml`: + +```yaml + env: + - name: KARDINAL_MANAGER_CLUSTER_CONFIG_ENDPOINT + # This is valid for reaching out the Kardinal Kontrol if this is running on the host + value: "http://localhost:8080/tenant/{36e22127-3c9e-4110-aa83-af552cd94b88}/cluster-resources" + - name: KARDINAL_MANAGER_FETCHER_JOB_DURATION_SECONDS + value: "10" +``` + +NOTE: you can get your tenant UUID by running any CLI command + You can use tilt deploy and keeping the image hot-reloading: ```bash diff --git a/go.work.sum b/go.work.sum index 5b1296b2..e4aa9633 100644 --- a/go.work.sum +++ b/go.work.sum @@ -40,14 +40,18 @@ github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1t github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k= github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -112,6 +116,7 @@ github.com/tdewolff/minify/v2 v2.12.9 h1:dvn5MtmuQ/DFMwqf5j8QhEVpPX6fi3WGImhv8RU github.com/tdewolff/minify/v2 v2.12.9/go.mod h1:qOqdlDfL+7v0/fyymB+OP497nIxJYSvX4MQWA8OoiXU= github.com/tdewolff/parse/v2 v2.6.8 h1:mhNZXYCx//xG7Yq2e/kVLNZw4YfYmeHbhx+Zc0OvFMA= github.com/tdewolff/parse/v2 v2.6.8/go.mod h1:XHDhaU6IBgsryfdnpzUXBlT6leW/l25yrFBTEb4eIyM= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= diff --git a/kardinal-cli/cmd/root.go b/kardinal-cli/cmd/root.go index 8c8a8138..9c6c3e6a 100644 --- a/kardinal-cli/cmd/root.go +++ b/kardinal-cli/cmd/root.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "kardinal.cli/tenant" "log" "net/http" @@ -43,7 +44,12 @@ var deployCmd = &cobra.Command{ if err != nil { log.Fatalf("Error loading compose file: %v", err) } - deploy(services) + tenantUuid, err := tenant.GetOrCreateUserTenantUUID() + if err != nil { + log.Fatal("Error getting or creating user tenant UUID", err) + } + + deploy(tenantUuid.String(), services) }, } @@ -58,8 +64,13 @@ var createCmd = &cobra.Command{ log.Fatalf("Error loading compose file: %v", err) } + tenantUuid, err := tenant.GetOrCreateUserTenantUUID() + if err != nil { + log.Fatal("Error getting or creating user tenant UUID", err) + } + fmt.Printf("Creating service %s with image %s in development mode...\n", serviceName, imageName) - createDevFlow(services, imageName, serviceName) + createDevFlow(tenantUuid.String(), services, imageName, serviceName) }, } @@ -72,7 +83,12 @@ var deleteCmd = &cobra.Command{ if err != nil { log.Fatalf("Error loading compose file: %v", err) } - deleteFlow(services) + + tenantUuid, err := tenant.GetOrCreateUserTenantUUID() + if err != nil { + log.Fatal("Error getting or creating user tenant UUID", err) + } + deleteFlow(tenantUuid.String(), services) fmt.Print("Deleting dev flow") }, @@ -139,20 +155,17 @@ func parseComposeFile(composeFile string) ([]types.ServiceConfig, error) { return project.Services, nil } -func createDevFlow(services []types.ServiceConfig, imageLocator, serviceName string) { +func createDevFlow(tenantUuid api_types.Uuid, services []types.ServiceConfig, imageLocator, serviceName string) { ctx := context.Background() - // fmt.Printf("Services:\n%v", services) - // fmt.Printf("%v", serviceName) - // fmt.Printf("%v", imageLocator) - body := api_types.PostFlowCreateJSONRequestBody{ + body := api_types.PostTenantUuidFlowCreateJSONRequestBody{ DockerCompose: &services, ServiceName: &serviceName, ImageLocator: &imageLocator, } client := getKontrolServiceClient() - resp, err := client.PostFlowCreateWithResponse(ctx, body) + resp, err := client.PostTenantUuidFlowCreateWithResponse(ctx, tenantUuid, body) if err != nil { log.Fatalf("Failed to create dev flow: %v", err) } @@ -161,15 +174,15 @@ func createDevFlow(services []types.ServiceConfig, imageLocator, serviceName str fmt.Printf("Response: %s\n", resp) } -func deploy(services []types.ServiceConfig) { +func deploy(tenantUuid api_types.Uuid, services []types.ServiceConfig) { ctx := context.Background() - body := api_types.PostDeployJSONRequestBody{ + body := api_types.PostTenantUuidDeployJSONRequestBody{ DockerCompose: &services, } client := getKontrolServiceClient() - resp, err := client.PostDeployWithResponse(ctx, body) + resp, err := client.PostTenantUuidDeployWithResponse(ctx, tenantUuid, body) if err != nil { log.Fatalf("Failed to deploy: %v", err) } @@ -177,15 +190,15 @@ func deploy(services []types.ServiceConfig) { fmt.Printf("Response: %s\n", string(resp.Body)) } -func deleteFlow(services []types.ServiceConfig) { +func deleteFlow(tenantUuid api_types.Uuid, services []types.ServiceConfig) { ctx := context.Background() - body := api_types.PostFlowDeleteJSONRequestBody{ + body := api_types.PostTenantUuidFlowDeleteJSONRequestBody{ DockerCompose: &services, } client := getKontrolServiceClient() - resp, err := client.PostFlowDeleteWithResponse(ctx, body) + resp, err := client.PostTenantUuidFlowDeleteWithResponse(ctx, tenantUuid, body) if err != nil { log.Fatalf("Failed to delete flow: %v", err) } diff --git a/kardinal-cli/go.mod b/kardinal-cli/go.mod index b2f9cc98..15844490 100644 --- a/kardinal-cli/go.mod +++ b/kardinal-cli/go.mod @@ -3,13 +3,15 @@ module kardinal.cli go 1.22 require ( + github.com/adrg/xdg v0.4.0 github.com/compose-spec/compose-go v1.20.2 + github.com/google/uuid v1.5.0 + github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 github.com/spf13/cobra v1.8.0 ) require ( github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect - github.com/google/uuid v1.5.0 // indirect github.com/oapi-codegen/runtime v1.1.1 // indirect ) @@ -28,7 +30,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect + github.com/sirupsen/logrus v1.9.3 github.com/spf13/pflag v1.0.5 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect diff --git a/kardinal-cli/go.sum b/kardinal-cli/go.sum index 56f64843..da35513f 100644 --- a/kardinal-cli/go.sum +++ b/kardinal-cli/go.sum @@ -1,4 +1,6 @@ github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= +github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= +github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= @@ -31,6 +33,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 h1:YQTATifMUwZEtZYb0LVA7DK2pj8s71iY8rzweuUQ5+g= +github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409/go.mod h1:y5weVs5d9wXXHcDA1awRxkIhhHC1xxYJN8a7aXnE6S8= github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk= github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -70,6 +74,7 @@ golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xpp golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/kardinal-cli/gomod2nix.toml b/kardinal-cli/gomod2nix.toml index 413de668..723fc144 100644 --- a/kardinal-cli/gomod2nix.toml +++ b/kardinal-cli/gomod2nix.toml @@ -28,6 +28,9 @@ schema = 3 [mod."github.com/Shopify/goreferrer"] version = "v0.0.0-20220729165902-8cddb4f5de06" hash = "sha256-zyP8NdtP79I7DOH7bUw54pY5ge1yWkSIbh4jnp8gel4=" + [mod."github.com/adrg/xdg"] + version = "v0.4.0" + hash = "sha256-zGjkdUQmrVqD6rMO9oDY+TeJCpuqnHyvkPCaXDlac/U=" [mod."github.com/andybalholm/brotli"] version = "v1.0.5" hash = "sha256-/qS8wU8yZQJ+uTOg66rEl9s7spxq9VIXF5L1BcaEClc=" @@ -53,11 +56,8 @@ schema = 3 version = "v1.27.10" hash = "sha256-EltjBddI8lJOxiONk2GgbjtHp7ysV00CK7BRVbAOLZ4=" [mod."github.com/bytedance/sonic"] - version = "v1.11.6" - hash = "sha256-oGDdBbAHDwQYFFcg3AeYaHwOGQNa1q4n/0w4y2eqsxk=" - [mod."github.com/bytedance/sonic/loader"] - version = "v0.1.1" - hash = "sha256-9MzO8LYUrun40uXTexcbKtQO1MvXhlD6Er6T6v9TOtE=" + version = "v1.10.0-rc3" + hash = "sha256-K8194CwIvSvMpaqMtLWV9YSfA0Q5hpHV8oHAnwwn0T8=" [mod."github.com/cespare/xxhash/v2"] version = "v2.3.0" hash = "sha256-7hRlwSR+fos1kx4VZmJ/7snR7zHh8ZFKX+qqqqGcQpY=" @@ -67,12 +67,6 @@ schema = 3 [mod."github.com/chenzhuoyu/iasm"] version = "v0.9.0" hash = "sha256-xlZIAcRAD9dufk7JZfyKyiBzw6Gzfj4oKh2wbjKukQg=" - [mod."github.com/cloudwego/base64x"] - version = "v0.1.4" - hash = "sha256-umCZR3iNmHFm+BC76kfpdcRG+pTQd6Jcu/c2kQDnyfw=" - [mod."github.com/cloudwego/iasm"] - version = "v0.2.0" - hash = "sha256-TzIP2N3HOesXrKACsRr/ShcoqttwPGZPckIepsTyHOA=" [mod."github.com/compose-spec/compose-go"] version = "v1.20.2" hash = "sha256-uICczxxRYLAW4jMHEsNxcOUBoCT5l5AMSrexHJ3xTcA=" @@ -119,8 +113,8 @@ schema = 3 version = "v2.6.0" hash = "sha256-8EMjmc2FYVb0OXuzU1FWkSqYEtJjYdIT2PWsChoiTyQ=" [mod."github.com/gabriel-vasile/mimetype"] - version = "v1.4.3" - hash = "sha256-EDmlRi3av27dq/ISVTglv08z4yZzMQ/SxL1c46EJro0=" + version = "v1.4.2" + hash = "sha256-laV+IkgbnEG07h1eFfPISqp0ctnLXfzchz/CLR1lftk=" [mod."github.com/getkin/kin-openapi"] version = "v0.125.0" hash = "sha256-4g7MoGIyH80ek9SEqHYV1TjsYAx+wTzvipEKhfddGYA=" @@ -128,8 +122,8 @@ schema = 3 version = "v0.1.0" hash = "sha256-zYbMTao+1F+385Lvsba9roLmmt9eYqr57sUWo0LCVhw=" [mod."github.com/gin-gonic/gin"] - version = "v1.10.0" - hash = "sha256-esJasHrJtuTBwGPGAoc/XSb428J8va+tPGcZ0gTfsgc=" + version = "v1.9.1" + hash = "sha256-3FHywH5QuhTeQcdF8v06jt9vIkH0ON6ydpMYciAc8xQ=" [mod."github.com/go-logr/logr"] version = "v1.4.1" hash = "sha256-WM4badoqxXlBmqCRrnmtNce63dLlr/FJav3BJSYHvaY=" @@ -142,9 +136,6 @@ schema = 3 [mod."github.com/go-openapi/swag"] version = "v0.22.8" hash = "sha256-YMJpCbWT9ABlCmuLjxQRwhddlYYqDBWcyDIdnV8bAMc=" - [mod."github.com/go-playground/assert/v2"] - version = "v2.2.0" - hash = "sha256-jBDvfGBS2EWzN6Ve+ZU2TyAj3c2Wqbxw88kz2NsBq44=" [mod."github.com/go-playground/locales"] version = "v0.14.1" hash = "sha256-BMJGAexq96waZn60DJXZfByRHb8zA/JP/i6f/YrW9oQ=" @@ -152,8 +143,8 @@ schema = 3 version = "v0.18.1" hash = "sha256-2/B2qP51zfiY+k8G0w0D03KXUc7XpWj6wKY7NjNP/9E=" [mod."github.com/go-playground/validator/v10"] - version = "v10.20.0" - hash = "sha256-FKF+ebrSedNdh5Wq8aE8UP+5LiM8B28bk8v3gyqqdDk=" + version = "v10.14.1" + hash = "sha256-13J8JqIuhI7lbBagaR7INykFRXqRbB7tjXtMZI3PNvA=" [mod."github.com/go-task/slim-sprig"] version = "v0.0.0-20230315185526-52ccab3ef572" hash = "sha256-D6NjCQbcYC53NdwzyAm4i9M1OjTJIVu4EIt3AD/Vxfg=" @@ -260,11 +251,8 @@ schema = 3 version = "v1.16.7" hash = "sha256-8miX/lnXyNLPSqhhn5BesLauaIAxETpQpWtr1cu2f+0=" [mod."github.com/klauspost/cpuid/v2"] - version = "v2.2.7" - hash = "sha256-bjinp7b7qWk+DcZDDv1EedJxZqGxp2NWY+NYKBfE5xU=" - [mod."github.com/knz/go-libedit"] - version = "v1.10.1" - hash = "sha256-9QLTNZPo8qq+6JhvlTbETNqx1SFrv7l9YLH1kQEF+CE=" + version = "v2.2.5" + hash = "sha256-/M8CHNah2/EPr0va44r1Sx+3H6E+jN8bGFi5jQkLBrM=" [mod."github.com/kr/pretty"] version = "v0.3.1" hash = "sha256-DlER7XM+xiaLjvebcIPiB12oVNjyZHuJHoRGITzzpKU=" @@ -284,8 +272,8 @@ schema = 3 version = "v0.4.2" hash = "sha256-395+BETDpv15L2lsCiEccwakXgEQxKHlYBAU0Ot3qhY=" [mod."github.com/leodido/go-urn"] - version = "v1.4.0" - hash = "sha256-Q6kplWkY37Tzy6GOme3Wut40jFK4Izun+ij/BJvcEu0=" + version = "v1.2.4" + hash = "sha256-N2HO7ChScxI79KGvXI9LxoIlr+lkBNdDZP9OPGwPRK0=" [mod."github.com/mailgun/raymond/v2"] version = "v2.0.48" hash = "sha256-HC2vbTL9eCgk1m00h6Mg6W/pu6n/Y7Qr4MJuVQIX4v0=" @@ -338,8 +326,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-cfVDjHyWItmUGZ2dzQhCHgmOmou8v7N+itDkLZVkqkQ=" [mod."github.com/pelletier/go-toml/v2"] - version = "v2.2.2" - hash = "sha256-ukxk1Cfm6cQW18g/aa19tLcUu5BnF7VmfAvrDHAOl6A=" + version = "v2.0.9" + hash = "sha256-mLpNBZOK72qPpForSmzQkDrqR5xzmpUdM/0XxB2AYFA=" [mod."github.com/perimeterx/marshmallow"] version = "v1.1.5" hash = "sha256-fFWjg0FNohDSV0/wUjQ8fBq1g8h6yIqTrHkxqL2Tt0s=" @@ -359,8 +347,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-/FtmHnaGjdvEIKAJtrUfEhV7EVo5A/eYrtdnUkuxLDA=" [mod."github.com/redis/go-redis/v9"] - version = "v9.5.3" - hash = "sha256-XqJGBm6y6PPo5pxRsmDX4TGMp62V+4kDHBqOVNOZFjA=" + version = "v9.5.2" + hash = "sha256-5LAHJam4xU7MvQxL91UL66Zx4UTLCE6hrtv5A+JCpw4=" [mod."github.com/rogpeppe/go-internal"] version = "v1.12.0" hash = "sha256-qvDNCe3l84/LgrA8X4O15e1FeDcazyX91m9LmXGXX6M=" @@ -410,8 +398,8 @@ schema = 3 version = "v0.15.1" hash = "sha256-HLk6oUe7EoITrNvP0y8D6BtIgIcmDZYtb/xl/dufIoY=" [mod."github.com/ugorji/go/codec"] - version = "v1.2.12" - hash = "sha256-sp1LJ93UK7mFwgZqG8jxCgTCPgKR74HNU6XxX0Jfjm0=" + version = "v1.2.11" + hash = "sha256-hfcj+YsznH6MeERSdIPjSrsM7gbDcIzH/TbgHzYbPww=" [mod."github.com/valyala/bytebufferpool"] version = "v1.0.0" hash = "sha256-I9FPZ3kCNRB+o0dpMwBnwZ35Fj9+ThvITn8a3Jr8mAY=" @@ -443,8 +431,8 @@ schema = 3 version = "v1.4.13" hash = "sha256-GVwFKZY6moIS6I0ZGuio/WtDif+lkZRfqWS6b4AAJyI=" [mod."golang.org/x/arch"] - version = "v0.8.0" - hash = "sha256-zz9sbr+yT6eqjHVlVBfDZVmIkzOT6DZFpN3eaQT4Afw=" + version = "v0.4.0" + hash = "sha256-jKi0m79VwPy8XxGh1e5YRZX5jfb2drWfmLWxNR3HvAU=" [mod."golang.org/x/crypto"] version = "v0.23.0" hash = "sha256-6hZjb/OazWFBef0C/aH63l49YQnzCh2vpIduzyfSSG8=" @@ -497,8 +485,8 @@ schema = 3 version = "v1.62.1" hash = "sha256-1su6X0YT7MUflrTJijbq1CiisADZHudEx5sJq01TEaE=" [mod."google.golang.org/protobuf"] - version = "v1.34.1" - hash = "sha256-qnHqY6KLZiZDbTVTN6uzF4jedxROYlPCYHoiv6XI0sc=" + version = "v1.33.0" + hash = "sha256-cWwQjtUwSIEkAlAadrlxK1PYZXTRrV4NKzt7xDpJgIU=" [mod."gopkg.in/check.v1"] version = "v1.0.0-20201130134442-10cb98267c6c" hash = "sha256-VlIpM2r/OD+kkyItn6vW35dyc0rtkJufA93rjFyzncs=" @@ -544,12 +532,6 @@ schema = 3 [mod."k8s.io/utils"] version = "v0.0.0-20230726121419-3b25d923346b" hash = "sha256-r8VhhAYGPouGGgXu02ymVwF6k+WmBc4ij0qynPRtXEE=" - [mod."nullprogram.com/x/optparse"] - version = "v1.0.0" - hash = "sha256-qfqfwuRikFqp1hjQRJ4MV0JdcUgswRlRe6i2XiH99/s=" - [mod."rsc.io/pdf"] - version = "v0.1.1" - hash = "sha256-BHVEebJPCm+e4MIyfp2IQCP2y8MdmNG+FKpYixSXEgc=" [mod."sigs.k8s.io/json"] version = "v0.0.0-20221116044647-bc3834ca7abd" hash = "sha256-XDBMN2o450IHiAwEpBVsvo9e7tYZa+EXWrifUNTdNMU=" diff --git a/kardinal-cli/tenant/host_machine_directories/host_machine_directories.go b/kardinal-cli/tenant/host_machine_directories/host_machine_directories.go new file mode 100644 index 00000000..5e95d9df --- /dev/null +++ b/kardinal-cli/tenant/host_machine_directories/host_machine_directories.go @@ -0,0 +1,26 @@ +package host_machine_directories + +import ( + "github.com/adrg/xdg" + "github.com/kurtosis-tech/stacktrace" + "path" +) + +const ( + applicationDirname = "kardinal" + fkTenantUUID = "fk-tenant-uuid" +) + +func GetKardinalFkTenantUuidFilepath() (string, error) { + xdgRelFilepath := getRelativeFilepathForXDG(fkTenantUUID) + fkTenantUuidFilepath, err := xdg.DataFile(xdgRelFilepath) + if err != nil { + return "", stacktrace.Propagate(err, "An error occurred getting the fk tenant UUID filepath from relative path '%v'", xdgRelFilepath) + } + return fkTenantUuidFilepath, nil +} + +// Joins the "kardinal" app directory in front of whichever filepath +func getRelativeFilepathForXDG(filepathRelativeToKurtosisDir string) string { + return path.Join(applicationDirname, filepathRelativeToKurtosisDir) +} diff --git a/kardinal-cli/tenant/tenant.go b/kardinal-cli/tenant/tenant.go new file mode 100644 index 00000000..a190c948 --- /dev/null +++ b/kardinal-cli/tenant/tenant.go @@ -0,0 +1,56 @@ +package tenant + +import ( + "github.com/google/uuid" + "github.com/kurtosis-tech/stacktrace" + "github.com/sirupsen/logrus" + "kardinal.cli/tenant/host_machine_directories" + "os" +) + +const ( + tenantUuidFilePermissions os.FileMode = 0644 +) + +func GetOrCreateUserTenantUUID() (uuid.UUID, error) { + + kardinalFkTenantUuidFilepath, err := host_machine_directories.GetKardinalFkTenantUuidFilepath() + if err != nil { + return uuid.UUID{}, stacktrace.Propagate(err, "An error occurred getting the tenant UUID filepath") + } + + _, err = os.Stat(kardinalFkTenantUuidFilepath) + if err != nil { + if os.IsNotExist(err) { + + newUUID, err := uuid.NewRandom() + if err != nil { + return uuid.UUID{}, stacktrace.Propagate(err, "An error occurred generating a new UUID") + } + + if err := os.WriteFile(kardinalFkTenantUuidFilepath, []byte(newUUID.String()), tenantUuidFilePermissions); err != nil { + return uuid.UUID{}, stacktrace.Propagate(err, "An error occurred writing fk tenant UUID file '%v'", kardinalFkTenantUuidFilepath) + } + logrus.Debugf("Kardinal fk tenant UUID file saved to %v", kardinalFkTenantUuidFilepath) + logrus.Infof("Creating new tenant UUID %s", newUUID) + return newUUID, nil + } else { + return uuid.UUID{}, stacktrace.Propagate(err, "An error occurred getting fk tenant UUID file info") + } + } + + kardinalFkTenantUuidFileBytes, err := os.ReadFile(kardinalFkTenantUuidFilepath) + if err != nil { + return uuid.UUID{}, stacktrace.Propagate(err, "attempted to read file fk tenant UUID with path '%s' but failed", kardinalFkTenantUuidFilepath) + } + + kardinalFkTenantUuidFileStr := string(kardinalFkTenantUuidFileBytes) + + parsedUuid, err := uuid.Parse(kardinalFkTenantUuidFileStr) + if err != nil { + return uuid.UUID{}, stacktrace.Propagate(err, "An error occurred parsing the UUID str '%s' to UUID", kardinalFkTenantUuidFileStr) + } + + logrus.Infof("Using tenant UUID %s", kardinalFkTenantUuidFileStr) + return parsedUuid, nil +} diff --git a/kardinal-manager/deployment/k8s.yaml b/kardinal-manager/deployment/k8s.yaml index 6ce07e82..52b11e6f 100644 --- a/kardinal-manager/deployment/k8s.yaml +++ b/kardinal-manager/deployment/k8s.yaml @@ -55,8 +55,8 @@ spec: value: "kubernetes.default.svc" - name: KUBERNETES_SERVICE_PORT value: "443" - - name: CLUSTER_CONFIG_ENDPOINT + - name: KARDINAL_MANAGER_CLUSTER_CONFIG_ENDPOINT # This is valid for reaching out the Kardinal Kontrol if this is running on the host - value: "http://host.minikube.internal:8080/cluster-resources" - - name: FETCHER_JOB_DURATION_SECONDS + value: "http://host.minikube.internal:8080/tenant/58d33536-3c9e-4110-aa83-bf112ae94a49/cluster-resources" + - name: KARDINAL_MANAGER_FETCHER_JOB_DURATION_SECONDS value: "10" diff --git a/kardinal-manager/gomod2nix.toml b/kardinal-manager/gomod2nix.toml index 413de668..723fc144 100644 --- a/kardinal-manager/gomod2nix.toml +++ b/kardinal-manager/gomod2nix.toml @@ -28,6 +28,9 @@ schema = 3 [mod."github.com/Shopify/goreferrer"] version = "v0.0.0-20220729165902-8cddb4f5de06" hash = "sha256-zyP8NdtP79I7DOH7bUw54pY5ge1yWkSIbh4jnp8gel4=" + [mod."github.com/adrg/xdg"] + version = "v0.4.0" + hash = "sha256-zGjkdUQmrVqD6rMO9oDY+TeJCpuqnHyvkPCaXDlac/U=" [mod."github.com/andybalholm/brotli"] version = "v1.0.5" hash = "sha256-/qS8wU8yZQJ+uTOg66rEl9s7spxq9VIXF5L1BcaEClc=" @@ -53,11 +56,8 @@ schema = 3 version = "v1.27.10" hash = "sha256-EltjBddI8lJOxiONk2GgbjtHp7ysV00CK7BRVbAOLZ4=" [mod."github.com/bytedance/sonic"] - version = "v1.11.6" - hash = "sha256-oGDdBbAHDwQYFFcg3AeYaHwOGQNa1q4n/0w4y2eqsxk=" - [mod."github.com/bytedance/sonic/loader"] - version = "v0.1.1" - hash = "sha256-9MzO8LYUrun40uXTexcbKtQO1MvXhlD6Er6T6v9TOtE=" + version = "v1.10.0-rc3" + hash = "sha256-K8194CwIvSvMpaqMtLWV9YSfA0Q5hpHV8oHAnwwn0T8=" [mod."github.com/cespare/xxhash/v2"] version = "v2.3.0" hash = "sha256-7hRlwSR+fos1kx4VZmJ/7snR7zHh8ZFKX+qqqqGcQpY=" @@ -67,12 +67,6 @@ schema = 3 [mod."github.com/chenzhuoyu/iasm"] version = "v0.9.0" hash = "sha256-xlZIAcRAD9dufk7JZfyKyiBzw6Gzfj4oKh2wbjKukQg=" - [mod."github.com/cloudwego/base64x"] - version = "v0.1.4" - hash = "sha256-umCZR3iNmHFm+BC76kfpdcRG+pTQd6Jcu/c2kQDnyfw=" - [mod."github.com/cloudwego/iasm"] - version = "v0.2.0" - hash = "sha256-TzIP2N3HOesXrKACsRr/ShcoqttwPGZPckIepsTyHOA=" [mod."github.com/compose-spec/compose-go"] version = "v1.20.2" hash = "sha256-uICczxxRYLAW4jMHEsNxcOUBoCT5l5AMSrexHJ3xTcA=" @@ -119,8 +113,8 @@ schema = 3 version = "v2.6.0" hash = "sha256-8EMjmc2FYVb0OXuzU1FWkSqYEtJjYdIT2PWsChoiTyQ=" [mod."github.com/gabriel-vasile/mimetype"] - version = "v1.4.3" - hash = "sha256-EDmlRi3av27dq/ISVTglv08z4yZzMQ/SxL1c46EJro0=" + version = "v1.4.2" + hash = "sha256-laV+IkgbnEG07h1eFfPISqp0ctnLXfzchz/CLR1lftk=" [mod."github.com/getkin/kin-openapi"] version = "v0.125.0" hash = "sha256-4g7MoGIyH80ek9SEqHYV1TjsYAx+wTzvipEKhfddGYA=" @@ -128,8 +122,8 @@ schema = 3 version = "v0.1.0" hash = "sha256-zYbMTao+1F+385Lvsba9roLmmt9eYqr57sUWo0LCVhw=" [mod."github.com/gin-gonic/gin"] - version = "v1.10.0" - hash = "sha256-esJasHrJtuTBwGPGAoc/XSb428J8va+tPGcZ0gTfsgc=" + version = "v1.9.1" + hash = "sha256-3FHywH5QuhTeQcdF8v06jt9vIkH0ON6ydpMYciAc8xQ=" [mod."github.com/go-logr/logr"] version = "v1.4.1" hash = "sha256-WM4badoqxXlBmqCRrnmtNce63dLlr/FJav3BJSYHvaY=" @@ -142,9 +136,6 @@ schema = 3 [mod."github.com/go-openapi/swag"] version = "v0.22.8" hash = "sha256-YMJpCbWT9ABlCmuLjxQRwhddlYYqDBWcyDIdnV8bAMc=" - [mod."github.com/go-playground/assert/v2"] - version = "v2.2.0" - hash = "sha256-jBDvfGBS2EWzN6Ve+ZU2TyAj3c2Wqbxw88kz2NsBq44=" [mod."github.com/go-playground/locales"] version = "v0.14.1" hash = "sha256-BMJGAexq96waZn60DJXZfByRHb8zA/JP/i6f/YrW9oQ=" @@ -152,8 +143,8 @@ schema = 3 version = "v0.18.1" hash = "sha256-2/B2qP51zfiY+k8G0w0D03KXUc7XpWj6wKY7NjNP/9E=" [mod."github.com/go-playground/validator/v10"] - version = "v10.20.0" - hash = "sha256-FKF+ebrSedNdh5Wq8aE8UP+5LiM8B28bk8v3gyqqdDk=" + version = "v10.14.1" + hash = "sha256-13J8JqIuhI7lbBagaR7INykFRXqRbB7tjXtMZI3PNvA=" [mod."github.com/go-task/slim-sprig"] version = "v0.0.0-20230315185526-52ccab3ef572" hash = "sha256-D6NjCQbcYC53NdwzyAm4i9M1OjTJIVu4EIt3AD/Vxfg=" @@ -260,11 +251,8 @@ schema = 3 version = "v1.16.7" hash = "sha256-8miX/lnXyNLPSqhhn5BesLauaIAxETpQpWtr1cu2f+0=" [mod."github.com/klauspost/cpuid/v2"] - version = "v2.2.7" - hash = "sha256-bjinp7b7qWk+DcZDDv1EedJxZqGxp2NWY+NYKBfE5xU=" - [mod."github.com/knz/go-libedit"] - version = "v1.10.1" - hash = "sha256-9QLTNZPo8qq+6JhvlTbETNqx1SFrv7l9YLH1kQEF+CE=" + version = "v2.2.5" + hash = "sha256-/M8CHNah2/EPr0va44r1Sx+3H6E+jN8bGFi5jQkLBrM=" [mod."github.com/kr/pretty"] version = "v0.3.1" hash = "sha256-DlER7XM+xiaLjvebcIPiB12oVNjyZHuJHoRGITzzpKU=" @@ -284,8 +272,8 @@ schema = 3 version = "v0.4.2" hash = "sha256-395+BETDpv15L2lsCiEccwakXgEQxKHlYBAU0Ot3qhY=" [mod."github.com/leodido/go-urn"] - version = "v1.4.0" - hash = "sha256-Q6kplWkY37Tzy6GOme3Wut40jFK4Izun+ij/BJvcEu0=" + version = "v1.2.4" + hash = "sha256-N2HO7ChScxI79KGvXI9LxoIlr+lkBNdDZP9OPGwPRK0=" [mod."github.com/mailgun/raymond/v2"] version = "v2.0.48" hash = "sha256-HC2vbTL9eCgk1m00h6Mg6W/pu6n/Y7Qr4MJuVQIX4v0=" @@ -338,8 +326,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-cfVDjHyWItmUGZ2dzQhCHgmOmou8v7N+itDkLZVkqkQ=" [mod."github.com/pelletier/go-toml/v2"] - version = "v2.2.2" - hash = "sha256-ukxk1Cfm6cQW18g/aa19tLcUu5BnF7VmfAvrDHAOl6A=" + version = "v2.0.9" + hash = "sha256-mLpNBZOK72qPpForSmzQkDrqR5xzmpUdM/0XxB2AYFA=" [mod."github.com/perimeterx/marshmallow"] version = "v1.1.5" hash = "sha256-fFWjg0FNohDSV0/wUjQ8fBq1g8h6yIqTrHkxqL2Tt0s=" @@ -359,8 +347,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-/FtmHnaGjdvEIKAJtrUfEhV7EVo5A/eYrtdnUkuxLDA=" [mod."github.com/redis/go-redis/v9"] - version = "v9.5.3" - hash = "sha256-XqJGBm6y6PPo5pxRsmDX4TGMp62V+4kDHBqOVNOZFjA=" + version = "v9.5.2" + hash = "sha256-5LAHJam4xU7MvQxL91UL66Zx4UTLCE6hrtv5A+JCpw4=" [mod."github.com/rogpeppe/go-internal"] version = "v1.12.0" hash = "sha256-qvDNCe3l84/LgrA8X4O15e1FeDcazyX91m9LmXGXX6M=" @@ -410,8 +398,8 @@ schema = 3 version = "v0.15.1" hash = "sha256-HLk6oUe7EoITrNvP0y8D6BtIgIcmDZYtb/xl/dufIoY=" [mod."github.com/ugorji/go/codec"] - version = "v1.2.12" - hash = "sha256-sp1LJ93UK7mFwgZqG8jxCgTCPgKR74HNU6XxX0Jfjm0=" + version = "v1.2.11" + hash = "sha256-hfcj+YsznH6MeERSdIPjSrsM7gbDcIzH/TbgHzYbPww=" [mod."github.com/valyala/bytebufferpool"] version = "v1.0.0" hash = "sha256-I9FPZ3kCNRB+o0dpMwBnwZ35Fj9+ThvITn8a3Jr8mAY=" @@ -443,8 +431,8 @@ schema = 3 version = "v1.4.13" hash = "sha256-GVwFKZY6moIS6I0ZGuio/WtDif+lkZRfqWS6b4AAJyI=" [mod."golang.org/x/arch"] - version = "v0.8.0" - hash = "sha256-zz9sbr+yT6eqjHVlVBfDZVmIkzOT6DZFpN3eaQT4Afw=" + version = "v0.4.0" + hash = "sha256-jKi0m79VwPy8XxGh1e5YRZX5jfb2drWfmLWxNR3HvAU=" [mod."golang.org/x/crypto"] version = "v0.23.0" hash = "sha256-6hZjb/OazWFBef0C/aH63l49YQnzCh2vpIduzyfSSG8=" @@ -497,8 +485,8 @@ schema = 3 version = "v1.62.1" hash = "sha256-1su6X0YT7MUflrTJijbq1CiisADZHudEx5sJq01TEaE=" [mod."google.golang.org/protobuf"] - version = "v1.34.1" - hash = "sha256-qnHqY6KLZiZDbTVTN6uzF4jedxROYlPCYHoiv6XI0sc=" + version = "v1.33.0" + hash = "sha256-cWwQjtUwSIEkAlAadrlxK1PYZXTRrV4NKzt7xDpJgIU=" [mod."gopkg.in/check.v1"] version = "v1.0.0-20201130134442-10cb98267c6c" hash = "sha256-VlIpM2r/OD+kkyItn6vW35dyc0rtkJufA93rjFyzncs=" @@ -544,12 +532,6 @@ schema = 3 [mod."k8s.io/utils"] version = "v0.0.0-20230726121419-3b25d923346b" hash = "sha256-r8VhhAYGPouGGgXu02ymVwF6k+WmBc4ij0qynPRtXEE=" - [mod."nullprogram.com/x/optparse"] - version = "v1.0.0" - hash = "sha256-qfqfwuRikFqp1hjQRJ4MV0JdcUgswRlRe6i2XiH99/s=" - [mod."rsc.io/pdf"] - version = "v0.1.1" - hash = "sha256-BHVEebJPCm+e4MIyfp2IQCP2y8MdmNG+FKpYixSXEgc=" [mod."sigs.k8s.io/json"] version = "v0.0.0-20221116044647-bc3834ca7abd" hash = "sha256-XDBMN2o450IHiAwEpBVsvo9e7tYZa+EXWrifUNTdNMU=" diff --git a/kardinal-manager/kardinal-manager/cluster_manager/cluster_manager.go b/kardinal-manager/kardinal-manager/cluster_manager/cluster_manager.go index a56c9ef1..b883b245 100644 --- a/kardinal-manager/kardinal-manager/cluster_manager/cluster_manager.go +++ b/kardinal-manager/kardinal-manager/cluster_manager/cluster_manager.go @@ -182,8 +182,8 @@ func (manager *ClusterManager) GetTopologyForNameSpace(namespace string) (map[st func (manager *ClusterManager) ApplyClusterResources(ctx context.Context, clusterResources *types.ClusterResources) error { - if clusterResources == nil { - logrus.Debugf("the received cluster resources is nil, nothing to apply.") + if !isValid(clusterResources) { + logrus.Debugf("the received cluster resources is not valid, nothing to apply.") return nil } @@ -236,6 +236,11 @@ func (manager *ClusterManager) ApplyClusterResources(ctx context.Context, cluste func (manager *ClusterManager) CleanUpClusterResources(ctx context.Context, clusterResources *types.ClusterResources) error { + if !isValid(clusterResources) { + logrus.Debugf("the received cluster resources is not valid, nothing to clean up.") + return nil + } + // Clean up services servicesByNS := lo.GroupBy(*clusterResources.Services, func(item corev1.Service) string { return item.Namespace @@ -511,3 +516,21 @@ func (manager *ClusterManager) cleanUpGatewaysInNamespace(ctx context.Context, n } func int64Ptr(i int64) *int64 { return &i } + +func isValid(clusterResources *types.ClusterResources) bool { + if clusterResources == nil { + logrus.Debugf("cluster resources is nil.") + return false + } + + if clusterResources.Gateway == nil && + clusterResources.Deployments == nil && + clusterResources.DestinationRules == nil && + clusterResources.Services == nil && + clusterResources.VirtualServices == nil { + logrus.Debugf("cluster resources is empty.") + return false + } + + return true +} diff --git a/kardinal-manager/kardinal-manager/fetcher/fetcher.go b/kardinal-manager/kardinal-manager/fetcher/fetcher.go index 4c341224..3c9aa0a9 100644 --- a/kardinal-manager/kardinal-manager/fetcher/fetcher.go +++ b/kardinal-manager/kardinal-manager/fetcher/fetcher.go @@ -10,12 +10,13 @@ import ( "kardinal.kontrol/kardinal-manager/cluster_manager" "kardinal.kontrol/kardinal-manager/utils" "net/http" + "net/url" "time" ) const ( defaultTickerDuration = time.Second * 5 - fetcherJobDurationSecondsEnvVarKey = "FETCHER_JOB_DURATION_SECONDS" + fetcherJobDurationSecondsEnvVarKey = "KARDINAL_MANAGER_FETCHER_JOB_DURATION_SECONDS" ) type fetcher struct { @@ -72,7 +73,13 @@ func (fetcher *fetcher) fetchAndApply(ctx context.Context) error { } func (fetcher *fetcher) getClusterResourcesFromCloud() (*types.ClusterResources, error) { - resp, err := http.Get(fetcher.configEndpoint) + + configEndpointURL, err := url.Parse(fetcher.configEndpoint) + if err != nil { + return nil, stacktrace.Propagate(err, "An error occurred parsing the config endpoint '%s'", fetcher.configEndpoint) + } + + resp, err := http.Get(configEndpointURL.String()) if err != nil { return nil, stacktrace.Propagate(err, "Error fetching cluster resources from endpoint '%s'", fetcher.configEndpoint) } @@ -83,6 +90,11 @@ func (fetcher *fetcher) getClusterResourcesFromCloud() (*types.ClusterResources, return nil, stacktrace.Propagate(err, "Error reading the response from '%v'", fetcher.configEndpoint) } + if len(responseBodyBytes) == 0 { + logrus.Debugf("The cluster resources endpoint '%s' returned an empty body", fetcher.configEndpoint) + return nil, nil + } + var clusterResources *types.ClusterResources if err = json.Unmarshal(responseBodyBytes, &clusterResources); err != nil { diff --git a/kardinal-manager/kardinal-manager/main.go b/kardinal-manager/kardinal-manager/main.go index a1e94b35..5b351b04 100644 --- a/kardinal-manager/kardinal-manager/main.go +++ b/kardinal-manager/kardinal-manager/main.go @@ -12,7 +12,8 @@ import ( const ( successExitCode = 0 - clusterConfigEndpointEnvVarKey = "CLUSTER_CONFIG_ENDPOINT" + clusterConfigEndpointEnvVarKey = "KARDINAL_MANAGER_CLUSTER_CONFIG_ENDPOINT" + tenantUuidEnvVarKey = "KARDINAL_MANAGER_TENANT_UUID" ) func main() { diff --git a/libs/cli-kontrol-api/api/golang/client/client.gen.go b/libs/cli-kontrol-api/api/golang/client/client.gen.go index 65633a46..38434a6e 100644 --- a/libs/cli-kontrol-api/api/golang/client/client.gen.go +++ b/libs/cli-kontrol-api/api/golang/client/client.gen.go @@ -90,27 +90,27 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { - // PostDeployWithBody request with any body - PostDeployWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostTenantUuidDeployWithBody request with any body + PostTenantUuidDeployWithBody(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostDeploy(ctx context.Context, body PostDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + PostTenantUuidDeploy(ctx context.Context, uuid Uuid, body PostTenantUuidDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostFlowCreateWithBody request with any body - PostFlowCreateWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostTenantUuidFlowCreateWithBody request with any body + PostTenantUuidFlowCreateWithBody(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostFlowCreate(ctx context.Context, body PostFlowCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + PostTenantUuidFlowCreate(ctx context.Context, uuid Uuid, body PostTenantUuidFlowCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostFlowDeleteWithBody request with any body - PostFlowDeleteWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostTenantUuidFlowDeleteWithBody request with any body + PostTenantUuidFlowDeleteWithBody(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostFlowDelete(ctx context.Context, body PostFlowDeleteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + PostTenantUuidFlowDelete(ctx context.Context, uuid Uuid, body PostTenantUuidFlowDeleteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetTopology request - GetTopology(ctx context.Context, params *GetTopologyParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetTenantUuidTopology request + GetTenantUuidTopology(ctx context.Context, uuid Uuid, reqEditors ...RequestEditorFn) (*http.Response, error) } -func (c *Client) PostDeployWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostDeployRequestWithBody(c.Server, contentType, body) +func (c *Client) PostTenantUuidDeployWithBody(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostTenantUuidDeployRequestWithBody(c.Server, uuid, contentType, body) if err != nil { return nil, err } @@ -121,8 +121,8 @@ func (c *Client) PostDeployWithBody(ctx context.Context, contentType string, bod return c.Client.Do(req) } -func (c *Client) PostDeploy(ctx context.Context, body PostDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostDeployRequest(c.Server, body) +func (c *Client) PostTenantUuidDeploy(ctx context.Context, uuid Uuid, body PostTenantUuidDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostTenantUuidDeployRequest(c.Server, uuid, body) if err != nil { return nil, err } @@ -133,8 +133,8 @@ func (c *Client) PostDeploy(ctx context.Context, body PostDeployJSONRequestBody, return c.Client.Do(req) } -func (c *Client) PostFlowCreateWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostFlowCreateRequestWithBody(c.Server, contentType, body) +func (c *Client) PostTenantUuidFlowCreateWithBody(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostTenantUuidFlowCreateRequestWithBody(c.Server, uuid, contentType, body) if err != nil { return nil, err } @@ -145,8 +145,8 @@ func (c *Client) PostFlowCreateWithBody(ctx context.Context, contentType string, return c.Client.Do(req) } -func (c *Client) PostFlowCreate(ctx context.Context, body PostFlowCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostFlowCreateRequest(c.Server, body) +func (c *Client) PostTenantUuidFlowCreate(ctx context.Context, uuid Uuid, body PostTenantUuidFlowCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostTenantUuidFlowCreateRequest(c.Server, uuid, body) if err != nil { return nil, err } @@ -157,8 +157,8 @@ func (c *Client) PostFlowCreate(ctx context.Context, body PostFlowCreateJSONRequ return c.Client.Do(req) } -func (c *Client) PostFlowDeleteWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostFlowDeleteRequestWithBody(c.Server, contentType, body) +func (c *Client) PostTenantUuidFlowDeleteWithBody(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostTenantUuidFlowDeleteRequestWithBody(c.Server, uuid, contentType, body) if err != nil { return nil, err } @@ -169,8 +169,8 @@ func (c *Client) PostFlowDeleteWithBody(ctx context.Context, contentType string, return c.Client.Do(req) } -func (c *Client) PostFlowDelete(ctx context.Context, body PostFlowDeleteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostFlowDeleteRequest(c.Server, body) +func (c *Client) PostTenantUuidFlowDelete(ctx context.Context, uuid Uuid, body PostTenantUuidFlowDeleteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostTenantUuidFlowDeleteRequest(c.Server, uuid, body) if err != nil { return nil, err } @@ -181,8 +181,8 @@ func (c *Client) PostFlowDelete(ctx context.Context, body PostFlowDeleteJSONRequ return c.Client.Do(req) } -func (c *Client) GetTopology(ctx context.Context, params *GetTopologyParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetTopologyRequest(c.Server, params) +func (c *Client) GetTenantUuidTopology(ctx context.Context, uuid Uuid, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetTenantUuidTopologyRequest(c.Server, uuid) if err != nil { return nil, err } @@ -193,27 +193,34 @@ func (c *Client) GetTopology(ctx context.Context, params *GetTopologyParams, req return c.Client.Do(req) } -// NewPostDeployRequest calls the generic PostDeploy builder with application/json body -func NewPostDeployRequest(server string, body PostDeployJSONRequestBody) (*http.Request, error) { +// NewPostTenantUuidDeployRequest calls the generic PostTenantUuidDeploy builder with application/json body +func NewPostTenantUuidDeployRequest(server string, uuid Uuid, body PostTenantUuidDeployJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostDeployRequestWithBody(server, "application/json", bodyReader) + return NewPostTenantUuidDeployRequestWithBody(server, uuid, "application/json", bodyReader) } -// NewPostDeployRequestWithBody generates requests for PostDeploy with any type of body -func NewPostDeployRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewPostTenantUuidDeployRequestWithBody generates requests for PostTenantUuidDeploy with any type of body +func NewPostTenantUuidDeployRequestWithBody(server string, uuid Uuid, contentType string, body io.Reader) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "uuid", runtime.ParamLocationPath, uuid) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/deploy") + operationPath := fmt.Sprintf("/tenant/%s/deploy", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -233,27 +240,34 @@ func NewPostDeployRequestWithBody(server string, contentType string, body io.Rea return req, nil } -// NewPostFlowCreateRequest calls the generic PostFlowCreate builder with application/json body -func NewPostFlowCreateRequest(server string, body PostFlowCreateJSONRequestBody) (*http.Request, error) { +// NewPostTenantUuidFlowCreateRequest calls the generic PostTenantUuidFlowCreate builder with application/json body +func NewPostTenantUuidFlowCreateRequest(server string, uuid Uuid, body PostTenantUuidFlowCreateJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostFlowCreateRequestWithBody(server, "application/json", bodyReader) + return NewPostTenantUuidFlowCreateRequestWithBody(server, uuid, "application/json", bodyReader) } -// NewPostFlowCreateRequestWithBody generates requests for PostFlowCreate with any type of body -func NewPostFlowCreateRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewPostTenantUuidFlowCreateRequestWithBody generates requests for PostTenantUuidFlowCreate with any type of body +func NewPostTenantUuidFlowCreateRequestWithBody(server string, uuid Uuid, contentType string, body io.Reader) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "uuid", runtime.ParamLocationPath, uuid) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/flow/create") + operationPath := fmt.Sprintf("/tenant/%s/flow/create", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -273,27 +287,34 @@ func NewPostFlowCreateRequestWithBody(server string, contentType string, body io return req, nil } -// NewPostFlowDeleteRequest calls the generic PostFlowDelete builder with application/json body -func NewPostFlowDeleteRequest(server string, body PostFlowDeleteJSONRequestBody) (*http.Request, error) { +// NewPostTenantUuidFlowDeleteRequest calls the generic PostTenantUuidFlowDelete builder with application/json body +func NewPostTenantUuidFlowDeleteRequest(server string, uuid Uuid, body PostTenantUuidFlowDeleteJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostFlowDeleteRequestWithBody(server, "application/json", bodyReader) + return NewPostTenantUuidFlowDeleteRequestWithBody(server, uuid, "application/json", bodyReader) } -// NewPostFlowDeleteRequestWithBody generates requests for PostFlowDelete with any type of body -func NewPostFlowDeleteRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewPostTenantUuidFlowDeleteRequestWithBody generates requests for PostTenantUuidFlowDelete with any type of body +func NewPostTenantUuidFlowDeleteRequestWithBody(server string, uuid Uuid, contentType string, body io.Reader) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "uuid", runtime.ParamLocationPath, uuid) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/flow/delete") + operationPath := fmt.Sprintf("/tenant/%s/flow/delete", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -313,16 +334,23 @@ func NewPostFlowDeleteRequestWithBody(server string, contentType string, body io return req, nil } -// NewGetTopologyRequest generates requests for GetTopology -func NewGetTopologyRequest(server string, params *GetTopologyParams) (*http.Request, error) { +// NewGetTenantUuidTopologyRequest generates requests for GetTenantUuidTopology +func NewGetTenantUuidTopologyRequest(server string, uuid Uuid) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "uuid", runtime.ParamLocationPath, uuid) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/topology") + operationPath := fmt.Sprintf("/tenant/%s/topology", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -332,28 +360,6 @@ func NewGetTopologyRequest(server string, params *GetTopologyParams) (*http.Requ return nil, err } - if params != nil { - queryValues := queryURL.Query() - - if params.Namespace != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "namespace", runtime.ParamLocationQuery, *params.Namespace); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - } - req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -405,33 +411,33 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { - // PostDeployWithBodyWithResponse request with any body - PostDeployWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostDeployResponse, error) + // PostTenantUuidDeployWithBodyWithResponse request with any body + PostTenantUuidDeployWithBodyWithResponse(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostTenantUuidDeployResponse, error) - PostDeployWithResponse(ctx context.Context, body PostDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*PostDeployResponse, error) + PostTenantUuidDeployWithResponse(ctx context.Context, uuid Uuid, body PostTenantUuidDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*PostTenantUuidDeployResponse, error) - // PostFlowCreateWithBodyWithResponse request with any body - PostFlowCreateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFlowCreateResponse, error) + // PostTenantUuidFlowCreateWithBodyWithResponse request with any body + PostTenantUuidFlowCreateWithBodyWithResponse(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostTenantUuidFlowCreateResponse, error) - PostFlowCreateWithResponse(ctx context.Context, body PostFlowCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFlowCreateResponse, error) + PostTenantUuidFlowCreateWithResponse(ctx context.Context, uuid Uuid, body PostTenantUuidFlowCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*PostTenantUuidFlowCreateResponse, error) - // PostFlowDeleteWithBodyWithResponse request with any body - PostFlowDeleteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFlowDeleteResponse, error) + // PostTenantUuidFlowDeleteWithBodyWithResponse request with any body + PostTenantUuidFlowDeleteWithBodyWithResponse(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostTenantUuidFlowDeleteResponse, error) - PostFlowDeleteWithResponse(ctx context.Context, body PostFlowDeleteJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFlowDeleteResponse, error) + PostTenantUuidFlowDeleteWithResponse(ctx context.Context, uuid Uuid, body PostTenantUuidFlowDeleteJSONRequestBody, reqEditors ...RequestEditorFn) (*PostTenantUuidFlowDeleteResponse, error) - // GetTopologyWithResponse request - GetTopologyWithResponse(ctx context.Context, params *GetTopologyParams, reqEditors ...RequestEditorFn) (*GetTopologyResponse, error) + // GetTenantUuidTopologyWithResponse request + GetTenantUuidTopologyWithResponse(ctx context.Context, uuid Uuid, reqEditors ...RequestEditorFn) (*GetTenantUuidTopologyResponse, error) } -type PostDeployResponse struct { +type PostTenantUuidDeployResponse struct { Body []byte HTTPResponse *http.Response JSON200 *string } // Status returns HTTPResponse.Status -func (r PostDeployResponse) Status() string { +func (r PostTenantUuidDeployResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -439,21 +445,21 @@ func (r PostDeployResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostDeployResponse) StatusCode() int { +func (r PostTenantUuidDeployResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type PostFlowCreateResponse struct { +type PostTenantUuidFlowCreateResponse struct { Body []byte HTTPResponse *http.Response JSON200 *string } // Status returns HTTPResponse.Status -func (r PostFlowCreateResponse) Status() string { +func (r PostTenantUuidFlowCreateResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -461,21 +467,21 @@ func (r PostFlowCreateResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostFlowCreateResponse) StatusCode() int { +func (r PostTenantUuidFlowCreateResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type PostFlowDeleteResponse struct { +type PostTenantUuidFlowDeleteResponse struct { Body []byte HTTPResponse *http.Response JSON200 *string } // Status returns HTTPResponse.Status -func (r PostFlowDeleteResponse) Status() string { +func (r PostTenantUuidFlowDeleteResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -483,21 +489,21 @@ func (r PostFlowDeleteResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostFlowDeleteResponse) StatusCode() int { +func (r PostTenantUuidFlowDeleteResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetTopologyResponse struct { +type GetTenantUuidTopologyResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ClusterTopology } // Status returns HTTPResponse.Status -func (r GetTopologyResponse) Status() string { +func (r GetTenantUuidTopologyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -505,82 +511,82 @@ func (r GetTopologyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetTopologyResponse) StatusCode() int { +func (r GetTenantUuidTopologyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -// PostDeployWithBodyWithResponse request with arbitrary body returning *PostDeployResponse -func (c *ClientWithResponses) PostDeployWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostDeployResponse, error) { - rsp, err := c.PostDeployWithBody(ctx, contentType, body, reqEditors...) +// PostTenantUuidDeployWithBodyWithResponse request with arbitrary body returning *PostTenantUuidDeployResponse +func (c *ClientWithResponses) PostTenantUuidDeployWithBodyWithResponse(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostTenantUuidDeployResponse, error) { + rsp, err := c.PostTenantUuidDeployWithBody(ctx, uuid, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostDeployResponse(rsp) + return ParsePostTenantUuidDeployResponse(rsp) } -func (c *ClientWithResponses) PostDeployWithResponse(ctx context.Context, body PostDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*PostDeployResponse, error) { - rsp, err := c.PostDeploy(ctx, body, reqEditors...) +func (c *ClientWithResponses) PostTenantUuidDeployWithResponse(ctx context.Context, uuid Uuid, body PostTenantUuidDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*PostTenantUuidDeployResponse, error) { + rsp, err := c.PostTenantUuidDeploy(ctx, uuid, body, reqEditors...) if err != nil { return nil, err } - return ParsePostDeployResponse(rsp) + return ParsePostTenantUuidDeployResponse(rsp) } -// PostFlowCreateWithBodyWithResponse request with arbitrary body returning *PostFlowCreateResponse -func (c *ClientWithResponses) PostFlowCreateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFlowCreateResponse, error) { - rsp, err := c.PostFlowCreateWithBody(ctx, contentType, body, reqEditors...) +// PostTenantUuidFlowCreateWithBodyWithResponse request with arbitrary body returning *PostTenantUuidFlowCreateResponse +func (c *ClientWithResponses) PostTenantUuidFlowCreateWithBodyWithResponse(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostTenantUuidFlowCreateResponse, error) { + rsp, err := c.PostTenantUuidFlowCreateWithBody(ctx, uuid, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostFlowCreateResponse(rsp) + return ParsePostTenantUuidFlowCreateResponse(rsp) } -func (c *ClientWithResponses) PostFlowCreateWithResponse(ctx context.Context, body PostFlowCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFlowCreateResponse, error) { - rsp, err := c.PostFlowCreate(ctx, body, reqEditors...) +func (c *ClientWithResponses) PostTenantUuidFlowCreateWithResponse(ctx context.Context, uuid Uuid, body PostTenantUuidFlowCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*PostTenantUuidFlowCreateResponse, error) { + rsp, err := c.PostTenantUuidFlowCreate(ctx, uuid, body, reqEditors...) if err != nil { return nil, err } - return ParsePostFlowCreateResponse(rsp) + return ParsePostTenantUuidFlowCreateResponse(rsp) } -// PostFlowDeleteWithBodyWithResponse request with arbitrary body returning *PostFlowDeleteResponse -func (c *ClientWithResponses) PostFlowDeleteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFlowDeleteResponse, error) { - rsp, err := c.PostFlowDeleteWithBody(ctx, contentType, body, reqEditors...) +// PostTenantUuidFlowDeleteWithBodyWithResponse request with arbitrary body returning *PostTenantUuidFlowDeleteResponse +func (c *ClientWithResponses) PostTenantUuidFlowDeleteWithBodyWithResponse(ctx context.Context, uuid Uuid, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostTenantUuidFlowDeleteResponse, error) { + rsp, err := c.PostTenantUuidFlowDeleteWithBody(ctx, uuid, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostFlowDeleteResponse(rsp) + return ParsePostTenantUuidFlowDeleteResponse(rsp) } -func (c *ClientWithResponses) PostFlowDeleteWithResponse(ctx context.Context, body PostFlowDeleteJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFlowDeleteResponse, error) { - rsp, err := c.PostFlowDelete(ctx, body, reqEditors...) +func (c *ClientWithResponses) PostTenantUuidFlowDeleteWithResponse(ctx context.Context, uuid Uuid, body PostTenantUuidFlowDeleteJSONRequestBody, reqEditors ...RequestEditorFn) (*PostTenantUuidFlowDeleteResponse, error) { + rsp, err := c.PostTenantUuidFlowDelete(ctx, uuid, body, reqEditors...) if err != nil { return nil, err } - return ParsePostFlowDeleteResponse(rsp) + return ParsePostTenantUuidFlowDeleteResponse(rsp) } -// GetTopologyWithResponse request returning *GetTopologyResponse -func (c *ClientWithResponses) GetTopologyWithResponse(ctx context.Context, params *GetTopologyParams, reqEditors ...RequestEditorFn) (*GetTopologyResponse, error) { - rsp, err := c.GetTopology(ctx, params, reqEditors...) +// GetTenantUuidTopologyWithResponse request returning *GetTenantUuidTopologyResponse +func (c *ClientWithResponses) GetTenantUuidTopologyWithResponse(ctx context.Context, uuid Uuid, reqEditors ...RequestEditorFn) (*GetTenantUuidTopologyResponse, error) { + rsp, err := c.GetTenantUuidTopology(ctx, uuid, reqEditors...) if err != nil { return nil, err } - return ParseGetTopologyResponse(rsp) + return ParseGetTenantUuidTopologyResponse(rsp) } -// ParsePostDeployResponse parses an HTTP response from a PostDeployWithResponse call -func ParsePostDeployResponse(rsp *http.Response) (*PostDeployResponse, error) { +// ParsePostTenantUuidDeployResponse parses an HTTP response from a PostTenantUuidDeployWithResponse call +func ParsePostTenantUuidDeployResponse(rsp *http.Response) (*PostTenantUuidDeployResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostDeployResponse{ + response := &PostTenantUuidDeployResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -598,15 +604,15 @@ func ParsePostDeployResponse(rsp *http.Response) (*PostDeployResponse, error) { return response, nil } -// ParsePostFlowCreateResponse parses an HTTP response from a PostFlowCreateWithResponse call -func ParsePostFlowCreateResponse(rsp *http.Response) (*PostFlowCreateResponse, error) { +// ParsePostTenantUuidFlowCreateResponse parses an HTTP response from a PostTenantUuidFlowCreateWithResponse call +func ParsePostTenantUuidFlowCreateResponse(rsp *http.Response) (*PostTenantUuidFlowCreateResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostFlowCreateResponse{ + response := &PostTenantUuidFlowCreateResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -624,15 +630,15 @@ func ParsePostFlowCreateResponse(rsp *http.Response) (*PostFlowCreateResponse, e return response, nil } -// ParsePostFlowDeleteResponse parses an HTTP response from a PostFlowDeleteWithResponse call -func ParsePostFlowDeleteResponse(rsp *http.Response) (*PostFlowDeleteResponse, error) { +// ParsePostTenantUuidFlowDeleteResponse parses an HTTP response from a PostTenantUuidFlowDeleteWithResponse call +func ParsePostTenantUuidFlowDeleteResponse(rsp *http.Response) (*PostTenantUuidFlowDeleteResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostFlowDeleteResponse{ + response := &PostTenantUuidFlowDeleteResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -650,15 +656,15 @@ func ParsePostFlowDeleteResponse(rsp *http.Response) (*PostFlowDeleteResponse, e return response, nil } -// ParseGetTopologyResponse parses an HTTP response from a GetTopologyWithResponse call -func ParseGetTopologyResponse(rsp *http.Response) (*GetTopologyResponse, error) { +// ParseGetTenantUuidTopologyResponse parses an HTTP response from a GetTenantUuidTopologyWithResponse call +func ParseGetTenantUuidTopologyResponse(rsp *http.Response) (*GetTenantUuidTopologyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetTopologyResponse{ + response := &GetTenantUuidTopologyResponse{ Body: bodyBytes, HTTPResponse: rsp, } 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 cf5b53f0..dbb2a65b 100644 --- a/libs/cli-kontrol-api/api/golang/server/server.gen.go +++ b/libs/cli-kontrol-api/api/golang/server/server.gen.go @@ -25,17 +25,17 @@ import ( // ServerInterface represents all server handlers. type ServerInterface interface { - // (POST /deploy) - PostDeploy(ctx echo.Context) error + // (POST /tenant/{uuid}/deploy) + PostTenantUuidDeploy(ctx echo.Context, uuid Uuid) error - // (POST /flow/create) - PostFlowCreate(ctx echo.Context) error + // (POST /tenant/{uuid}/flow/create) + PostTenantUuidFlowCreate(ctx echo.Context, uuid Uuid) error - // (POST /flow/delete) - PostFlowDelete(ctx echo.Context) error + // (POST /tenant/{uuid}/flow/delete) + PostTenantUuidFlowDelete(ctx echo.Context, uuid Uuid) error - // (GET /topology) - GetTopology(ctx echo.Context, params GetTopologyParams) error + // (GET /tenant/{uuid}/topology) + GetTenantUuidTopology(ctx echo.Context, uuid Uuid) error } // ServerInterfaceWrapper converts echo contexts to parameters. @@ -43,48 +43,67 @@ type ServerInterfaceWrapper struct { Handler ServerInterface } -// PostDeploy converts echo context to params. -func (w *ServerInterfaceWrapper) PostDeploy(ctx echo.Context) error { +// PostTenantUuidDeploy converts echo context to params. +func (w *ServerInterfaceWrapper) PostTenantUuidDeploy(ctx echo.Context) error { var err error + // ------------- Path parameter "uuid" ------------- + var uuid Uuid + + err = runtime.BindStyledParameterWithOptions("simple", "uuid", ctx.Param("uuid"), &uuid, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter uuid: %s", err)) + } // Invoke the callback with all the unmarshaled arguments - err = w.Handler.PostDeploy(ctx) + err = w.Handler.PostTenantUuidDeploy(ctx, uuid) return err } -// PostFlowCreate converts echo context to params. -func (w *ServerInterfaceWrapper) PostFlowCreate(ctx echo.Context) error { +// PostTenantUuidFlowCreate converts echo context to params. +func (w *ServerInterfaceWrapper) PostTenantUuidFlowCreate(ctx echo.Context) error { var err error + // ------------- Path parameter "uuid" ------------- + var uuid Uuid + + err = runtime.BindStyledParameterWithOptions("simple", "uuid", ctx.Param("uuid"), &uuid, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter uuid: %s", err)) + } // Invoke the callback with all the unmarshaled arguments - err = w.Handler.PostFlowCreate(ctx) + err = w.Handler.PostTenantUuidFlowCreate(ctx, uuid) return err } -// PostFlowDelete converts echo context to params. -func (w *ServerInterfaceWrapper) PostFlowDelete(ctx echo.Context) error { +// PostTenantUuidFlowDelete converts echo context to params. +func (w *ServerInterfaceWrapper) PostTenantUuidFlowDelete(ctx echo.Context) error { var err error + // ------------- Path parameter "uuid" ------------- + var uuid Uuid + + err = runtime.BindStyledParameterWithOptions("simple", "uuid", ctx.Param("uuid"), &uuid, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter uuid: %s", err)) + } // Invoke the callback with all the unmarshaled arguments - err = w.Handler.PostFlowDelete(ctx) + err = w.Handler.PostTenantUuidFlowDelete(ctx, uuid) return err } -// GetTopology converts echo context to params. -func (w *ServerInterfaceWrapper) GetTopology(ctx echo.Context) error { +// GetTenantUuidTopology converts echo context to params. +func (w *ServerInterfaceWrapper) GetTenantUuidTopology(ctx echo.Context) error { var err error + // ------------- Path parameter "uuid" ------------- + var uuid Uuid - // Parameter object where we will unmarshal all parameters from the context - var params GetTopologyParams - // ------------- Optional query parameter "namespace" ------------- - - err = runtime.BindQueryParameter("form", true, false, "namespace", ctx.QueryParams(), ¶ms.Namespace) + err = runtime.BindStyledParameterWithOptions("simple", "uuid", ctx.Param("uuid"), &uuid, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter namespace: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter uuid: %s", err)) } // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetTopology(ctx, params) + err = w.Handler.GetTenantUuidTopology(ctx, uuid) return err } @@ -116,75 +135,78 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL Handler: si, } - router.POST(baseURL+"/deploy", wrapper.PostDeploy) - router.POST(baseURL+"/flow/create", wrapper.PostFlowCreate) - router.POST(baseURL+"/flow/delete", wrapper.PostFlowDelete) - router.GET(baseURL+"/topology", wrapper.GetTopology) + router.POST(baseURL+"/tenant/:uuid/deploy", wrapper.PostTenantUuidDeploy) + router.POST(baseURL+"/tenant/:uuid/flow/create", wrapper.PostTenantUuidFlowCreate) + router.POST(baseURL+"/tenant/:uuid/flow/delete", wrapper.PostTenantUuidFlowDelete) + router.GET(baseURL+"/tenant/:uuid/topology", wrapper.GetTenantUuidTopology) } -type PostDeployRequestObject struct { - Body *PostDeployJSONRequestBody +type PostTenantUuidDeployRequestObject struct { + Uuid Uuid `json:"uuid"` + Body *PostTenantUuidDeployJSONRequestBody } -type PostDeployResponseObject interface { - VisitPostDeployResponse(w http.ResponseWriter) error +type PostTenantUuidDeployResponseObject interface { + VisitPostTenantUuidDeployResponse(w http.ResponseWriter) error } -type PostDeploy200JSONResponse string +type PostTenantUuidDeploy200JSONResponse string -func (response PostDeploy200JSONResponse) VisitPostDeployResponse(w http.ResponseWriter) error { +func (response PostTenantUuidDeploy200JSONResponse) VisitPostTenantUuidDeployResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) return json.NewEncoder(w).Encode(response) } -type PostFlowCreateRequestObject struct { - Body *PostFlowCreateJSONRequestBody +type PostTenantUuidFlowCreateRequestObject struct { + Uuid Uuid `json:"uuid"` + Body *PostTenantUuidFlowCreateJSONRequestBody } -type PostFlowCreateResponseObject interface { - VisitPostFlowCreateResponse(w http.ResponseWriter) error +type PostTenantUuidFlowCreateResponseObject interface { + VisitPostTenantUuidFlowCreateResponse(w http.ResponseWriter) error } -type PostFlowCreate200JSONResponse string +type PostTenantUuidFlowCreate200JSONResponse string -func (response PostFlowCreate200JSONResponse) VisitPostFlowCreateResponse(w http.ResponseWriter) error { +func (response PostTenantUuidFlowCreate200JSONResponse) VisitPostTenantUuidFlowCreateResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) return json.NewEncoder(w).Encode(response) } -type PostFlowDeleteRequestObject struct { - Body *PostFlowDeleteJSONRequestBody +type PostTenantUuidFlowDeleteRequestObject struct { + Uuid Uuid `json:"uuid"` + Body *PostTenantUuidFlowDeleteJSONRequestBody } -type PostFlowDeleteResponseObject interface { - VisitPostFlowDeleteResponse(w http.ResponseWriter) error +type PostTenantUuidFlowDeleteResponseObject interface { + VisitPostTenantUuidFlowDeleteResponse(w http.ResponseWriter) error } -type PostFlowDelete200JSONResponse string +type PostTenantUuidFlowDelete200JSONResponse string -func (response PostFlowDelete200JSONResponse) VisitPostFlowDeleteResponse(w http.ResponseWriter) error { +func (response PostTenantUuidFlowDelete200JSONResponse) VisitPostTenantUuidFlowDeleteResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) return json.NewEncoder(w).Encode(response) } -type GetTopologyRequestObject struct { - Params GetTopologyParams +type GetTenantUuidTopologyRequestObject struct { + Uuid Uuid `json:"uuid"` } -type GetTopologyResponseObject interface { - VisitGetTopologyResponse(w http.ResponseWriter) error +type GetTenantUuidTopologyResponseObject interface { + VisitGetTenantUuidTopologyResponse(w http.ResponseWriter) error } -type GetTopology200JSONResponse ClusterTopology +type GetTenantUuidTopology200JSONResponse ClusterTopology -func (response GetTopology200JSONResponse) VisitGetTopologyResponse(w http.ResponseWriter) error { +func (response GetTenantUuidTopology200JSONResponse) VisitGetTenantUuidTopologyResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) @@ -194,17 +216,17 @@ func (response GetTopology200JSONResponse) VisitGetTopologyResponse(w http.Respo // StrictServerInterface represents all server handlers. type StrictServerInterface interface { - // (POST /deploy) - PostDeploy(ctx context.Context, request PostDeployRequestObject) (PostDeployResponseObject, error) + // (POST /tenant/{uuid}/deploy) + PostTenantUuidDeploy(ctx context.Context, request PostTenantUuidDeployRequestObject) (PostTenantUuidDeployResponseObject, error) - // (POST /flow/create) - PostFlowCreate(ctx context.Context, request PostFlowCreateRequestObject) (PostFlowCreateResponseObject, error) + // (POST /tenant/{uuid}/flow/create) + PostTenantUuidFlowCreate(ctx context.Context, request PostTenantUuidFlowCreateRequestObject) (PostTenantUuidFlowCreateResponseObject, error) - // (POST /flow/delete) - PostFlowDelete(ctx context.Context, request PostFlowDeleteRequestObject) (PostFlowDeleteResponseObject, error) + // (POST /tenant/{uuid}/flow/delete) + PostTenantUuidFlowDelete(ctx context.Context, request PostTenantUuidFlowDeleteRequestObject) (PostTenantUuidFlowDeleteResponseObject, error) - // (GET /topology) - GetTopology(ctx context.Context, request GetTopologyRequestObject) (GetTopologyResponseObject, error) + // (GET /tenant/{uuid}/topology) + GetTenantUuidTopology(ctx context.Context, request GetTenantUuidTopologyRequestObject) (GetTenantUuidTopologyResponseObject, error) } type StrictHandlerFunc = strictecho.StrictEchoHandlerFunc @@ -219,112 +241,118 @@ type strictHandler struct { middlewares []StrictMiddlewareFunc } -// PostDeploy operation middleware -func (sh *strictHandler) PostDeploy(ctx echo.Context) error { - var request PostDeployRequestObject +// PostTenantUuidDeploy operation middleware +func (sh *strictHandler) PostTenantUuidDeploy(ctx echo.Context, uuid Uuid) error { + var request PostTenantUuidDeployRequestObject - var body PostDeployJSONRequestBody + request.Uuid = uuid + + var body PostTenantUuidDeployJSONRequestBody if err := ctx.Bind(&body); err != nil { return err } request.Body = &body handler := func(ctx echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.PostDeploy(ctx.Request().Context(), request.(PostDeployRequestObject)) + return sh.ssi.PostTenantUuidDeploy(ctx.Request().Context(), request.(PostTenantUuidDeployRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "PostDeploy") + handler = middleware(handler, "PostTenantUuidDeploy") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(PostDeployResponseObject); ok { - return validResponse.VisitPostDeployResponse(ctx.Response()) + } else if validResponse, ok := response.(PostTenantUuidDeployResponseObject); ok { + return validResponse.VisitPostTenantUuidDeployResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } return nil } -// PostFlowCreate operation middleware -func (sh *strictHandler) PostFlowCreate(ctx echo.Context) error { - var request PostFlowCreateRequestObject +// PostTenantUuidFlowCreate operation middleware +func (sh *strictHandler) PostTenantUuidFlowCreate(ctx echo.Context, uuid Uuid) error { + var request PostTenantUuidFlowCreateRequestObject + + request.Uuid = uuid - var body PostFlowCreateJSONRequestBody + var body PostTenantUuidFlowCreateJSONRequestBody if err := ctx.Bind(&body); err != nil { return err } request.Body = &body handler := func(ctx echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.PostFlowCreate(ctx.Request().Context(), request.(PostFlowCreateRequestObject)) + return sh.ssi.PostTenantUuidFlowCreate(ctx.Request().Context(), request.(PostTenantUuidFlowCreateRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "PostFlowCreate") + handler = middleware(handler, "PostTenantUuidFlowCreate") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(PostFlowCreateResponseObject); ok { - return validResponse.VisitPostFlowCreateResponse(ctx.Response()) + } else if validResponse, ok := response.(PostTenantUuidFlowCreateResponseObject); ok { + return validResponse.VisitPostTenantUuidFlowCreateResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } return nil } -// PostFlowDelete operation middleware -func (sh *strictHandler) PostFlowDelete(ctx echo.Context) error { - var request PostFlowDeleteRequestObject +// PostTenantUuidFlowDelete operation middleware +func (sh *strictHandler) PostTenantUuidFlowDelete(ctx echo.Context, uuid Uuid) error { + var request PostTenantUuidFlowDeleteRequestObject + + request.Uuid = uuid - var body PostFlowDeleteJSONRequestBody + var body PostTenantUuidFlowDeleteJSONRequestBody if err := ctx.Bind(&body); err != nil { return err } request.Body = &body handler := func(ctx echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.PostFlowDelete(ctx.Request().Context(), request.(PostFlowDeleteRequestObject)) + return sh.ssi.PostTenantUuidFlowDelete(ctx.Request().Context(), request.(PostTenantUuidFlowDeleteRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "PostFlowDelete") + handler = middleware(handler, "PostTenantUuidFlowDelete") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(PostFlowDeleteResponseObject); ok { - return validResponse.VisitPostFlowDeleteResponse(ctx.Response()) + } else if validResponse, ok := response.(PostTenantUuidFlowDeleteResponseObject); ok { + return validResponse.VisitPostTenantUuidFlowDeleteResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } return nil } -// GetTopology operation middleware -func (sh *strictHandler) GetTopology(ctx echo.Context, params GetTopologyParams) error { - var request GetTopologyRequestObject +// GetTenantUuidTopology operation middleware +func (sh *strictHandler) GetTenantUuidTopology(ctx echo.Context, uuid Uuid) error { + var request GetTenantUuidTopologyRequestObject - request.Params = params + request.Uuid = uuid handler := func(ctx echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.GetTopology(ctx.Request().Context(), request.(GetTopologyRequestObject)) + return sh.ssi.GetTenantUuidTopology(ctx.Request().Context(), request.(GetTenantUuidTopologyRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "GetTopology") + handler = middleware(handler, "GetTenantUuidTopology") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(GetTopologyResponseObject); ok { - return validResponse.VisitGetTopologyResponse(ctx.Response()) + } else if validResponse, ok := response.(GetTenantUuidTopologyResponseObject); ok { + return validResponse.VisitGetTenantUuidTopologyResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } @@ -334,19 +362,19 @@ func (sh *strictHandler) GetTopology(ctx echo.Context, params GetTopologyParams) // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/9RWTW/DNgz9K4K2wwbEcbbdfNvSbShaDAXanYoeFIlx1NqiStFpgyL/fZDkfLtdimFY", - "d7MlvkfykSb9JjW2Hh04DrJ6k0EvoFXpcdp0gYHu0GOD9SoeeUIPxBaSAZg6P1iGNj18SzCXlfym3JGW", - "PWP5q6lBrkeSVx5kJRWRWsV3h+YTLH+gGWBZjyTBc2cJjKzue8pRH+DD1hpnj6A5wi9g+VuDL7ce9Gle", - "BvUTUJG8BzgI7bWosejZ+vvxLdDSapiim9tajnY2hW09EkecU+0eRI6kV7yQlawtL7rZWGNb9ndF8KC3", - "LzWWkSmkFI+Vs62qoWhQK0ZKBXlVrW+izUzpJ3CmUFWjGALLLTowWVdHeMhxFzm2IfTGQp3C1wOipgqf", - "qNmoGTRJVgiarGeLTlbyOh6LOZLgBYhYqfFgkNiRhlP43QKENeDYzi2QwHmiydYi1n9z9C4zK6qBz2XO", - "1ucwH/Vin8DW31A3pqY+Ec6a0+D+dPa5O4hvo2CMbDDPs/R/B32UizWD4d8Qmv/713Taz/HIujlGh2w5", - "fRjT68vyqsHOFFfomLARP99cypFcAoUs6w/jyXgSRUEPTnkrK/lTOspBprRLA77BPFAxpIyiYCpW5tLI", - "St5g4ItskwsAgX9BkxAaHYNLIOV9Y3WClY8hut/M77+bogcVS5keNkd2LpTwhEaga1ZC520g9zuCqYPU", - "IsGjC7ncP04mnwrzuOMGYlmKeYMvQhMkEhFYcReLGI3LeFemO/hY0ZjwNNv9O6ruL5WBRLJvoYTpM/qi", - "Whpo4BwtL7Ldf9Wh0flWSvEdwRKIRVxdgnHXuN9/PZV574+qX0GHCv8OvP3rinODVAsMFGR1P7St4jgM", - "XmlI4/xlYfUiSkDAZGEJeX/t+GzEPXdA8aUfpVsKOfog04d/qNxHBT/+2xzQdXMn4limNnlJmq7XfwUA", - "AP//eCMynscKAAA=", + "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", + "A9rnm+rG2NQj4iaH3+hv7QW+gcGAbLLOm/h/wvuqFq0m4d85VO99msb9HF5ps8F4UWqKg7H4sCr+Q0MO", + "a/bn3YpnfAfOJ0J/m81n80AHWjDCal7yP+KrBC8WXBAYYag4hKu5KxTYGtPFij5WFogTQaGV4iW/Q0/3", + "0eOh1WqZrLOLLfFp+ro8mRRxC3Sfk5Lg6S9UMaVEQ2BiVmFtrWXMW3zxoZrD2ZZ47jq+kD5SdtllCTMT", + "zDpUDE29ZzKtldFiir3mLRqf+ub3+fxFMCeW2TWWHdvU+J1JBzEI8ySoDd0QjK+0CZZFtIRbBQpELJLH", + "mxLpfNlN8JIgM8FUT9C7kEZBDS+TZpk83tn8BMxHZdgvDnbgiIUNzQhPY/XrWxeNzj4j+717Kdi/cKbX", + "8aPzFWq9ovbnJLv+LJ5gZjhjYX+4JmaJrHTdjwAAAP//BT6DjfILAAA=", } // 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 6fc923ee..0f9d8314 100644 --- a/libs/cli-kontrol-api/api/golang/types/types.gen.go +++ b/libs/cli-kontrol-api/api/golang/types/types.gen.go @@ -46,17 +46,14 @@ type ProdFlowSpec struct { DockerCompose *[]compose.ServiceConfig `json:"docker-compose,omitempty"` } -// GetTopologyParams defines parameters for GetTopology. -type GetTopologyParams struct { - // Namespace The namespace for which to retrieve the topology - Namespace *string `form:"namespace,omitempty" json:"namespace,omitempty"` -} +// Uuid defines model for uuid. +type Uuid = string -// PostDeployJSONRequestBody defines body for PostDeploy for application/json ContentType. -type PostDeployJSONRequestBody = ProdFlowSpec +// PostTenantUuidDeployJSONRequestBody defines body for PostTenantUuidDeploy for application/json ContentType. +type PostTenantUuidDeployJSONRequestBody = ProdFlowSpec -// PostFlowCreateJSONRequestBody defines body for PostFlowCreate for application/json ContentType. -type PostFlowCreateJSONRequestBody = DevFlowSpec +// PostTenantUuidFlowCreateJSONRequestBody defines body for PostTenantUuidFlowCreate for application/json ContentType. +type PostTenantUuidFlowCreateJSONRequestBody = DevFlowSpec -// PostFlowDeleteJSONRequestBody defines body for PostFlowDelete for application/json ContentType. -type PostFlowDeleteJSONRequestBody = ProdFlowSpec +// PostTenantUuidFlowDeleteJSONRequestBody defines body for PostTenantUuidFlowDelete for application/json ContentType. +type PostTenantUuidFlowDeleteJSONRequestBody = ProdFlowSpec 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 5574c1a7..0123d294 100644 --- a/libs/cli-kontrol-api/api/typescript/client/types.d.ts +++ b/libs/cli-kontrol-api/api/typescript/client/types.d.ts @@ -5,8 +5,13 @@ export interface paths { - "/flow/create": { + "/tenant/{uuid}/flow/create": { post: { + parameters: { + path: { + uuid: components["parameters"]["uuid"]; + }; + }; /** @description Create a dev flow */ requestBody: { content: { @@ -23,8 +28,13 @@ export interface paths { }; }; }; - "/flow/delete": { + "/tenant/{uuid}/flow/delete": { post: { + parameters: { + path: { + uuid: components["parameters"]["uuid"]; + }; + }; /** @description Delete dev flow (revert back to prod only) */ requestBody: { content: { @@ -41,8 +51,13 @@ export interface paths { }; }; }; - "/deploy": { + "/tenant/{uuid}/deploy": { post: { + parameters: { + path: { + uuid: components["parameters"]["uuid"]; + }; + }; /** @description Deploy a prod only cluster */ requestBody: { content: { @@ -59,12 +74,11 @@ export interface paths { }; }; }; - "/topology": { + "/tenant/{uuid}/topology": { get: { parameters: { - query?: { - /** @description The namespace for which to retrieve the topology */ - namespace?: string; + path: { + uuid: components["parameters"]["uuid"]; }; }; responses: { @@ -113,7 +127,10 @@ export interface components { }; }; responses: never; - parameters: never; + parameters: { + /** @description UUID of the resource */ + uuid: string; + }; requestBodies: never; headers: never; pathItems: never; diff --git a/libs/cli-kontrol-api/specs/api.yaml b/libs/cli-kontrol-api/specs/api.yaml index 3658debb..0b6ef2b0 100644 --- a/libs/cli-kontrol-api/specs/api.yaml +++ b/libs/cli-kontrol-api/specs/api.yaml @@ -3,8 +3,10 @@ info: title: CLI/Kontrol API version: 1.0.0 paths: - /flow/create: + /tenant/{uuid}/flow/create: post: + parameters: + - $ref: "#/components/parameters/uuid" requestBody: description: Create a dev flow required: true @@ -19,8 +21,10 @@ paths: application/json: schema: type: string - /flow/delete: + /tenant/{uuid}/flow/delete: post: + parameters: + - $ref: "#/components/parameters/uuid" requestBody: description: Delete dev flow (revert back to prod only) required: true @@ -35,8 +39,10 @@ paths: application/json: schema: type: string - /deploy: + /tenant/{uuid}/deploy: post: + parameters: + - $ref: "#/components/parameters/uuid" requestBody: description: Deploy a prod only cluster required: true @@ -51,15 +57,10 @@ paths: application/json: schema: type: string - /topology: + /tenant/{uuid}/topology: get: parameters: - - in: query - name: namespace - schema: - type: string - required: false - description: The namespace for which to retrieve the topology + - $ref: "#/components/parameters/uuid" responses: "200": description: Topology information @@ -69,6 +70,15 @@ paths: $ref: "#/components/schemas/ClusterTopology" components: + parameters: + uuid: + name: uuid + in: path + required: true + description: UUID of the resource + schema: + type: string + schemas: ProdFlowSpec: type: object diff --git a/libs/manager-kontrol-api/api/golang/client/client.gen.go b/libs/manager-kontrol-api/api/golang/client/client.gen.go index a2833afa..ebdd1a03 100644 --- a/libs/manager-kontrol-api/api/golang/client/client.gen.go +++ b/libs/manager-kontrol-api/api/golang/client/client.gen.go @@ -89,12 +89,12 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { - // GetClusterResources request - GetClusterResources(ctx context.Context, params *GetClusterResourcesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetTenantUuidClusterResources request + GetTenantUuidClusterResources(ctx context.Context, uuid Uuid, reqEditors ...RequestEditorFn) (*http.Response, error) } -func (c *Client) GetClusterResources(ctx context.Context, params *GetClusterResourcesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetClusterResourcesRequest(c.Server, params) +func (c *Client) GetTenantUuidClusterResources(ctx context.Context, uuid Uuid, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetTenantUuidClusterResourcesRequest(c.Server, uuid) if err != nil { return nil, err } @@ -105,16 +105,23 @@ func (c *Client) GetClusterResources(ctx context.Context, params *GetClusterReso return c.Client.Do(req) } -// NewGetClusterResourcesRequest generates requests for GetClusterResources -func NewGetClusterResourcesRequest(server string, params *GetClusterResourcesParams) (*http.Request, error) { +// NewGetTenantUuidClusterResourcesRequest generates requests for GetTenantUuidClusterResources +func NewGetTenantUuidClusterResourcesRequest(server string, uuid Uuid) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "uuid", runtime.ParamLocationPath, uuid) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/cluster-resources") + operationPath := fmt.Sprintf("/tenant/%s/cluster-resources", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -124,28 +131,6 @@ func NewGetClusterResourcesRequest(server string, params *GetClusterResourcesPar return nil, err } - if params != nil { - queryValues := queryURL.Query() - - if params.Namespace != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "namespace", runtime.ParamLocationQuery, *params.Namespace); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - } - req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -197,11 +182,11 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { - // GetClusterResourcesWithResponse request - GetClusterResourcesWithResponse(ctx context.Context, params *GetClusterResourcesParams, reqEditors ...RequestEditorFn) (*GetClusterResourcesResponse, error) + // GetTenantUuidClusterResourcesWithResponse request + GetTenantUuidClusterResourcesWithResponse(ctx context.Context, uuid Uuid, reqEditors ...RequestEditorFn) (*GetTenantUuidClusterResourcesResponse, error) } -type GetClusterResourcesResponse struct { +type GetTenantUuidClusterResourcesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ClusterResources @@ -209,7 +194,7 @@ type GetClusterResourcesResponse struct { } // Status returns HTTPResponse.Status -func (r GetClusterResourcesResponse) Status() string { +func (r GetTenantUuidClusterResourcesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -217,31 +202,31 @@ func (r GetClusterResourcesResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetClusterResourcesResponse) StatusCode() int { +func (r GetTenantUuidClusterResourcesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -// GetClusterResourcesWithResponse request returning *GetClusterResourcesResponse -func (c *ClientWithResponses) GetClusterResourcesWithResponse(ctx context.Context, params *GetClusterResourcesParams, reqEditors ...RequestEditorFn) (*GetClusterResourcesResponse, error) { - rsp, err := c.GetClusterResources(ctx, params, reqEditors...) +// GetTenantUuidClusterResourcesWithResponse request returning *GetTenantUuidClusterResourcesResponse +func (c *ClientWithResponses) GetTenantUuidClusterResourcesWithResponse(ctx context.Context, uuid Uuid, reqEditors ...RequestEditorFn) (*GetTenantUuidClusterResourcesResponse, error) { + rsp, err := c.GetTenantUuidClusterResources(ctx, uuid, reqEditors...) if err != nil { return nil, err } - return ParseGetClusterResourcesResponse(rsp) + return ParseGetTenantUuidClusterResourcesResponse(rsp) } -// ParseGetClusterResourcesResponse parses an HTTP response from a GetClusterResourcesWithResponse call -func ParseGetClusterResourcesResponse(rsp *http.Response) (*GetClusterResourcesResponse, error) { +// ParseGetTenantUuidClusterResourcesResponse parses an HTTP response from a GetTenantUuidClusterResourcesWithResponse call +func ParseGetTenantUuidClusterResourcesResponse(rsp *http.Response) (*GetTenantUuidClusterResourcesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetClusterResourcesResponse{ + response := &GetTenantUuidClusterResourcesResponse{ Body: bodyBytes, HTTPResponse: rsp, } diff --git a/libs/manager-kontrol-api/api/golang/server/server.gen.go b/libs/manager-kontrol-api/api/golang/server/server.gen.go index 3f56219d..afee0dba 100644 --- a/libs/manager-kontrol-api/api/golang/server/server.gen.go +++ b/libs/manager-kontrol-api/api/golang/server/server.gen.go @@ -25,8 +25,8 @@ import ( // ServerInterface represents all server handlers. type ServerInterface interface { // Cluster resource definition - // (GET /cluster-resources) - GetClusterResources(ctx echo.Context, params GetClusterResourcesParams) error + // (GET /tenant/{uuid}/cluster-resources) + GetTenantUuidClusterResources(ctx echo.Context, uuid Uuid) error } // ServerInterfaceWrapper converts echo contexts to parameters. @@ -34,21 +34,19 @@ type ServerInterfaceWrapper struct { Handler ServerInterface } -// GetClusterResources converts echo context to params. -func (w *ServerInterfaceWrapper) GetClusterResources(ctx echo.Context) error { +// GetTenantUuidClusterResources converts echo context to params. +func (w *ServerInterfaceWrapper) GetTenantUuidClusterResources(ctx echo.Context) error { var err error + // ------------- Path parameter "uuid" ------------- + var uuid Uuid - // Parameter object where we will unmarshal all parameters from the context - var params GetClusterResourcesParams - // ------------- Optional query parameter "namespace" ------------- - - err = runtime.BindQueryParameter("form", true, false, "namespace", ctx.QueryParams(), ¶ms.Namespace) + err = runtime.BindStyledParameterWithOptions("simple", "uuid", ctx.Param("uuid"), &uuid, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter namespace: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter uuid: %s", err)) } // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetClusterResources(ctx, params) + err = w.Handler.GetTenantUuidClusterResources(ctx, uuid) return err } @@ -80,35 +78,35 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL Handler: si, } - router.GET(baseURL+"/cluster-resources", wrapper.GetClusterResources) + router.GET(baseURL+"/tenant/:uuid/cluster-resources", wrapper.GetTenantUuidClusterResources) } type NotOkJSONResponse ResponseInfo -type GetClusterResourcesRequestObject struct { - Params GetClusterResourcesParams +type GetTenantUuidClusterResourcesRequestObject struct { + Uuid Uuid `json:"uuid"` } -type GetClusterResourcesResponseObject interface { - VisitGetClusterResourcesResponse(w http.ResponseWriter) error +type GetTenantUuidClusterResourcesResponseObject interface { + VisitGetTenantUuidClusterResourcesResponse(w http.ResponseWriter) error } -type GetClusterResources200JSONResponse ClusterResources +type GetTenantUuidClusterResources200JSONResponse ClusterResources -func (response GetClusterResources200JSONResponse) VisitGetClusterResourcesResponse(w http.ResponseWriter) error { +func (response GetTenantUuidClusterResources200JSONResponse) VisitGetTenantUuidClusterResourcesResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) return json.NewEncoder(w).Encode(response) } -type GetClusterResourcesdefaultJSONResponse struct { +type GetTenantUuidClusterResourcesdefaultJSONResponse struct { Body ResponseInfo StatusCode int } -func (response GetClusterResourcesdefaultJSONResponse) VisitGetClusterResourcesResponse(w http.ResponseWriter) error { +func (response GetTenantUuidClusterResourcesdefaultJSONResponse) VisitGetTenantUuidClusterResourcesResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(response.StatusCode) @@ -118,8 +116,8 @@ func (response GetClusterResourcesdefaultJSONResponse) VisitGetClusterResourcesR // StrictServerInterface represents all server handlers. type StrictServerInterface interface { // Cluster resource definition - // (GET /cluster-resources) - GetClusterResources(ctx context.Context, request GetClusterResourcesRequestObject) (GetClusterResourcesResponseObject, error) + // (GET /tenant/{uuid}/cluster-resources) + GetTenantUuidClusterResources(ctx context.Context, request GetTenantUuidClusterResourcesRequestObject) (GetTenantUuidClusterResourcesResponseObject, error) } type StrictHandlerFunc = strictecho.StrictEchoHandlerFunc @@ -134,25 +132,25 @@ type strictHandler struct { middlewares []StrictMiddlewareFunc } -// GetClusterResources operation middleware -func (sh *strictHandler) GetClusterResources(ctx echo.Context, params GetClusterResourcesParams) error { - var request GetClusterResourcesRequestObject +// GetTenantUuidClusterResources operation middleware +func (sh *strictHandler) GetTenantUuidClusterResources(ctx echo.Context, uuid Uuid) error { + var request GetTenantUuidClusterResourcesRequestObject - request.Params = params + request.Uuid = uuid handler := func(ctx echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.GetClusterResources(ctx.Request().Context(), request.(GetClusterResourcesRequestObject)) + return sh.ssi.GetTenantUuidClusterResources(ctx.Request().Context(), request.(GetTenantUuidClusterResourcesRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "GetClusterResources") + handler = middleware(handler, "GetTenantUuidClusterResources") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(GetClusterResourcesResponseObject); ok { - return validResponse.VisitGetClusterResourcesResponse(ctx.Response()) + } else if validResponse, ok := response.(GetTenantUuidClusterResourcesResponseObject); ok { + return validResponse.VisitGetTenantUuidClusterResourcesResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } @@ -162,18 +160,18 @@ func (sh *strictHandler) GetClusterResources(ctx echo.Context, params GetCluster // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/7yVQW/bOgzHv4rB945OnLSXB9+K1/eKoFg6pN12KIpCkxlHjS2qFO02KPLdB9mOkzZN", - "1sO2UxSR+vMn0iJfQFPpyKIVD+kLMHpH1mPzZ0pytQwLTVbQSlgq5wqjlRiyyYMnG/a8XmCpwupvxjmk", - "8FeyVU1aq09mnfTEzgnW63UMGXrNxgUtSOGLxWeHWjCLkJkYgkt3OGj/W1RekGfoqWLdEjomhyym/Zeh", - "K2hVbu5iBMtm8TzIaSArh5AGfl+Ph+e9K8Rb+8CUjri5p1Xl1h1icEoWkMLyHz80lChnkmBK6nGDuRFn", - "VitobybGNlm656rAwzz1WBVuoU6H59sjs6rA41ibU1sw48VQQNOFQSuDnBK3zAOoTyzKE/HS2DzpD75H", - "nSvBJ7U6iHjR2f8AmkeujT6SN02M9Xh43fodR2p93y1iMB0qYm1YKlXc/5SlT9DX9sSHoH5HCbcb9P0B", - "tYRbvHp2e09GU4bhd05cKoEUKmPl9AR6IWMFc+SgVKL3Km/cO6MXNjaHPuzHGsBN8A2sjI+VYcwgvW0F", - "tjHiluzuyIVuupBoqzIo/DebXc0ghsn0/yuI4dvZbDqZXuxIbGhDaNNlQ4wUwfZJWZUjJ5cFVdngkqww", - "FdHZ5wnEUCP7tkWNh6PhKDCQQ6ucgRROm622hk1GE932qQHvNqocm9qH1DdPfJJBChcoe00tKLEqUZA9", - "pLcvb5rkzQKj8AF5pzRGc+LoaWH0IhKKGIUN1hjJAqMOIuIdYRMEHivk8IK7r7DXgninjb9N2F38ejCc", - "jEa/bCzsZeCd0XBdaY3ez6si2nC0XXauqkIOReiRk3aQNX2lKkvFK0g346TPUJTh3FjTRIxBVB7SD/vF", - "vFuv1+sfAQAA//+4aAzDNwcAAA==", + "H4sIAAAAAAAC/7xVTW/jNhD9K8a0R9m0k0uhW9C0gVHUKZykPQRBwFJjmbFEcodDJ4ah/76gKH8k/tgc", + "dvckSjPz5s2j+LgGZWtnDRr2kK/BSZI1MlL7FoIu4rNAr0g71tZADg8P4+uenfV4jj1CbwMphAx0jDnJ", + "c8jAyBohT/UZEH4JmrCAnClgBl7NsZYRmFcu5nkmbUpomiYme2eNx5bAxPLtIi6UNYyG41I6V2klIxnx", + "4iOj9R7ir4QzyOEXsZtLpKgX0w56bGY2NfswmME3h4qx6CGRJYgpXXHE/r0KnpGm3cxJMLIOiXV6K9BV", + "dlVv1NSMdbt465e23w0rnfPL0eB6mwrZLt7XtbPUztlpmNIhS9LmsPjND7QV0mkRQ2I5amluwInkCtJk", + "rE2r0jOFCk/zWY5k5ebycnC9K5mGCs/T2lTtiGnP2kZqqtJouF9a4RZlJOqFQX61tNCmFNvCY6xLyfgq", + "Vycp3nTxn0DNIy21OqObsoTL0eAu5Z2nlHKPbmIMndrEpSYOsnr+JpetQP+mik+R+hFbuPtg/39BxXGK", + "d8fu4MgoW2B8zizVkqNpaMOXF7AF0oaxRIpINXovSzziHJvszxnAfcxNZrNxpscEsOuRJWZPZwa671qi", + "CXVE+GM6vZ1CBuPJn7eQwX9X08l4crMHse9zulODNVcx9rc0skQSf1nDZKve1T9jyGCJ5JM5jQbDwTB2", + "tw6NdBpyuGw/pd1rtRSMRhoW62i8jVDJr/q0b1gltv9A3IL2qI8LyOEG+b4tfQi6OLC57N218Hhc412K", + "aG2/efrg5RfD4Xdz8gOKR9z8LiiF3s9C1dvwSMY4k6HiUx22lEW6e1orCHUtaQX55gbYXnu9Amfa6LZj", + "BizLqA8c6v7UNE3zNQAA//+CQLzCbAcAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/libs/manager-kontrol-api/api/golang/types/types.gen.go b/libs/manager-kontrol-api/api/golang/types/types.gen.go index d36298c6..80014059 100644 --- a/libs/manager-kontrol-api/api/golang/types/types.gen.go +++ b/libs/manager-kontrol-api/api/golang/types/types.gen.go @@ -35,11 +35,8 @@ type ResponseInfo struct { // ResponseType defines model for ResponseType. type ResponseType string +// Uuid defines model for uuid. +type Uuid = string + // NotOk defines model for NotOk. type NotOk = ResponseInfo - -// GetClusterResourcesParams defines parameters for GetClusterResources. -type GetClusterResourcesParams struct { - // Namespace The namespace for which to retrieve the cluster resources - Namespace *string `form:"namespace,omitempty" json:"namespace,omitempty"` -} diff --git a/libs/manager-kontrol-api/api/typescript/client/types.d.ts b/libs/manager-kontrol-api/api/typescript/client/types.d.ts index 25e64bae..ad2d3447 100644 --- a/libs/manager-kontrol-api/api/typescript/client/types.d.ts +++ b/libs/manager-kontrol-api/api/typescript/client/types.d.ts @@ -5,13 +5,12 @@ export interface paths { - "/cluster-resources": { + "/tenant/{uuid}/cluster-resources": { /** Cluster resource definition */ get: { parameters: { - query?: { - /** @description The namespace for which to retrieve the cluster resources */ - namespace?: string; + path: { + uuid: components["parameters"]["uuid"]; }; }; responses: { @@ -55,7 +54,10 @@ export interface components { }; }; }; - parameters: never; + parameters: { + /** @description UUID of the resource */ + uuid: string; + }; requestBodies: never; headers: never; pathItems: never; diff --git a/libs/manager-kontrol-api/specs/api.yaml b/libs/manager-kontrol-api/specs/api.yaml index 98900191..2a580275 100644 --- a/libs/manager-kontrol-api/specs/api.yaml +++ b/libs/manager-kontrol-api/specs/api.yaml @@ -3,18 +3,13 @@ info: title: Manager/Kontrol API version: 1.0.0 paths: - /cluster-resources: + /tenant/{uuid}/cluster-resources: get: tags: - cluster-resources summary: Cluster resource definition parameters: - - in: query - name: namespace - schema: - type: string - required: false - description: The namespace for which to retrieve the cluster resources + - $ref: "#/components/parameters/uuid" responses: default: $ref: "#/components/responses/NotOk" @@ -26,6 +21,15 @@ paths: $ref: "#/components/schemas/ClusterResources" components: + parameters: + uuid: + name: uuid + in: path + required: true + description: UUID of the resource + schema: + type: string + responses: NotOk: description: Unexpected error