From eb258fae6663b0ff4592fd4653e96a97ca64bf08 Mon Sep 17 00:00:00 2001 From: barnettZQG <576501057@qq.com> Date: Mon, 8 Nov 2021 14:13:22 +0800 Subject: [PATCH] Feat: support ui schema (#2647) * Docs: change swagger api config * Docs: change swagger api config * Docs: change swagger api config * Feat: support ui schema * Fix: distinguish between structs and arrays * Feat: support build swagger config * Feat: support update ui schema Co-authored-by: barnettZQG --- Makefile | 4 +- apis/types/capability.go | 2 + cmd/apiserver/main.go | 42 + docs/apidoc/swagger.json | 10863 ++++++++-------- pkg/apiserver/rest/apis/v1/types.go | 19 +- pkg/apiserver/rest/rest_server.go | 14 +- pkg/apiserver/rest/usecase/addon.go | 34 +- pkg/apiserver/rest/usecase/definition.go | 179 +- pkg/apiserver/rest/usecase/definition_test.go | 61 +- .../rest/usecase/testdata/api-schema.json | 386 + .../usecase/testdata/ui-custom-schema.yaml | 56 + .../usecase/testdata/ui-default-schema.yaml | 132 + .../rest/usecase/testdata/ui-schema.yaml | 428 + pkg/apiserver/rest/utils/bcode/definition.go | 29 + pkg/apiserver/rest/utils/convert.go | 24 - pkg/apiserver/rest/utils/uiswagger.go | 96 +- .../rest/webservice/addon_registry.go | 3 +- .../rest/webservice/applicationplan.go | 2 +- pkg/apiserver/rest/webservice/cluster.go | 10 +- pkg/apiserver/rest/webservice/definition.go | 2 +- pkg/apiserver/rest/webservice/namespace.go | 2 + .../rest/webservice/oam_application.go | 3 +- .../rest/webservice/policy_definition.go | 3 +- pkg/apiserver/rest/webservice/webservice.go | 3 +- pkg/apiserver/rest/webservice/workflow.go | 9 +- test/e2e-test/helm_app_test.go | 2 +- test/e2e-test/kube_app_test.go | 3 +- 27 files changed, 6825 insertions(+), 5586 deletions(-) create mode 100644 pkg/apiserver/rest/usecase/testdata/api-schema.json create mode 100755 pkg/apiserver/rest/usecase/testdata/ui-custom-schema.yaml create mode 100755 pkg/apiserver/rest/usecase/testdata/ui-default-schema.yaml create mode 100755 pkg/apiserver/rest/usecase/testdata/ui-schema.yaml create mode 100644 pkg/apiserver/rest/utils/bcode/definition.go delete mode 100644 pkg/apiserver/rest/utils/convert.go diff --git a/Makefile b/Makefile index d21c62896..55f28d3d7 100644 --- a/Makefile +++ b/Makefile @@ -172,12 +172,14 @@ e2e-setup: kubectl wait --for=condition=Ready pod -l app=source-controller -n flux-system --timeout=600s kubectl wait --for=condition=Ready pod -l app=helm-controller -n flux-system --timeout=600s +build-swagger: + go run ./cmd/apiserver/main.go build-swagger ./docs/apidoc/swagger.json e2e-api-test: # Run e2e test ginkgo -v -skipPackage capability,setup,application -r e2e ginkgo -v -r e2e/application -e2e-apiserver-test: +e2e-apiserver-test: build-swagger go test -v -coverpkg=./... -coverprofile=/tmp/e2e_apiserver_test.out ./test/e2e-apiserver-test @$(OK) tests pass diff --git a/apis/types/capability.go b/apis/types/capability.go index 375b0d72e..a2c96650c 100644 --- a/apis/types/capability.go +++ b/apis/types/capability.go @@ -79,6 +79,8 @@ const CapabilityConfigMapNamePrefix = "schema-" const ( // OpenapiV3JSONSchema is the key to store OpenAPI v3 JSON schema in ConfigMap OpenapiV3JSONSchema string = "openapi-v3-json-schema" + // UISchema is the key to store ui custom schema + UISchema string = "ui-schema" ) // CapabilityCategory defines the category of a capability diff --git a/cmd/apiserver/main.go b/cmd/apiserver/main.go index d702c0c2c..4e9714ddf 100644 --- a/cmd/apiserver/main.go +++ b/cmd/apiserver/main.go @@ -18,12 +18,16 @@ package main import ( "context" + "encoding/json" "flag" "fmt" "os" "os/signal" "syscall" + restfulspec "github.com/emicklei/go-restful-openapi/v2" + "github.com/go-openapi/spec" + "github.com/oam-dev/kubevela/pkg/apiserver/log" "github.com/oam-dev/kubevela/pkg/apiserver/rest" "github.com/oam-dev/kubevela/version" @@ -38,6 +42,34 @@ func main() { flag.StringVar(&s.restCfg.Datastore.URL, "datastore-url", "", "Metadata storage database url,takes effect when the storage driver is mongodb.") flag.Parse() + if len(os.Args) > 2 && os.Args[1] == "build-swagger" { + func() { + swagger, err := s.buildSwagger() + if err != nil { + log.Logger.Fatal(err.Error()) + } + outData, err := json.MarshalIndent(swagger, "", "\t") + if err != nil { + log.Logger.Fatal(err.Error()) + } + swaggerFile, err := os.OpenFile(os.Args[2], os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600) + if err != nil { + log.Logger.Fatal(err.Error()) + } + defer func() { + if err := swaggerFile.Close(); err != nil { + log.Logger.Errorf("close swagger file failure %s", err.Error()) + } + }() + _, err = swaggerFile.Write(outData) + if err != nil { + log.Logger.Fatal(err.Error()) + } + fmt.Println("build swagger config file success") + }() + return + } + srvc := make(chan struct{}) go func() { @@ -48,6 +80,7 @@ func main() { }() var term = make(chan os.Signal, 1) signal.Notify(term, os.Interrupt, syscall.SIGTERM) + select { case <-term: log.Logger.Infof("Received SIGTERM, exiting gracefully...") @@ -71,5 +104,14 @@ func (s *Server) run() error { if err != nil { return fmt.Errorf("create apiserver failed : %w ", err) } + return server.Run(ctx) } + +func (s *Server) buildSwagger() (*spec.Swagger, error) { + server, err := rest.New(s.restCfg) + if err != nil { + return nil, fmt.Errorf("create apiserver failed : %w ", err) + } + return restfulspec.BuildSwagger(server.RegisterServices()), nil +} diff --git a/docs/apidoc/swagger.json b/docs/apidoc/swagger.json index 212415471..bb9e23b5c 100644 --- a/docs/apidoc/swagger.json +++ b/docs/apidoc/swagger.json @@ -1,5505 +1,5362 @@ { - "swagger": "2.0", - "info": { - "description": "Kubevela api doc", - "title": "Kubevela api doc", - "contact": { - "name": "kubevela", - "url": "https://kubevela.io/", - "email": "feedback@mail.kubevela.io" - }, - "license": { - "name": "Apache License 2.0", - "url": "https://github.com/oam-dev/kubevela/blob/master/LICENSE" - }, - "version": "v1beta1" - }, - "paths": { - "/api/v1/addon_registries": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "addon_registry" - ], - "summary": "list all addon registry", - "operationId": "listAddonRegistry", - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ListAddonRegistryResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "addon_registry" - ], - "summary": "create an addon registry", - "operationId": "createAddonRegistry", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateAddonRegistryRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.AddonRegistryMeta" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/addon_registries/{name}": { - "delete": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "addon_registry" - ], - "summary": "delete an addon registry", - "operationId": "deleteAddonRegistry", - "parameters": [ - { - "type": "string", - "description": "identifier of the addon registry", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.AddonRegistryMeta" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/addons": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "addon" - ], - "summary": "list all addons", - "operationId": "listAddons", - "parameters": [ - { - "type": "string", - "description": "filter addons from given registry", - "name": "registry", - "in": "query" - }, - { - "type": "string", - "description": "Fuzzy search based on name and description.", - "name": "query", - "in": "query" - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ListAddonResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/addons/{name}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "addon" - ], - "summary": "show details of an addon", - "operationId": "detailAddon", - "parameters": [ - { - "type": "string", - "description": "addon name to query detail", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.DetailAddonResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/addons/{name}/disable": { - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "addon" - ], - "summary": "disable an addon", - "operationId": "disableAddon", - "parameters": [ - { - "type": "string", - "description": "addon name to enable", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.AddonStatusResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/addons/{name}/enable": { - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "addon" - ], - "summary": "enable an addon", - "operationId": "enableAddon", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.EnableAddonRequest" - } - }, - { - "type": "string", - "description": "addon name to enable", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.AddonStatusResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/addons/{name}/status": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "addon" - ], - "summary": "show status of an addon", - "operationId": "statusAddon", - "parameters": [ - { - "type": "string", - "description": "addon name to query status", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.AddonStatusResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "list all application plans", - "operationId": "listApplicationPlans", - "parameters": [ - { - "type": "string", - "description": "Fuzzy search based on name or description", - "name": "query", - "in": "query" - }, - { - "type": "string", - "description": "Namespace-based search", - "name": "namespace", - "in": "query" - }, - { - "type": "string", - "description": "Cluster-based search", - "name": "cluster", - "in": "query" - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ListApplicationPlanResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "create one application plan", - "operationId": "createApplicationPlan", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateApplicationPlanRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ApplicationPlanBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "detail one application plan", - "operationId": "detailApplicationPlan", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.DetailApplicationPlanResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "put": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "update one application plan", - "operationId": "updateApplicationPlan", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.UpdateApplicationPlanRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ApplicationPlanBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "delete": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "delete one application", - "operationId": "deleteApplicationPlan", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.EmptyResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}/componentplans": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "gets the componentplan topology of the application", - "operationId": "listApplicationComponents", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "list components that deployed in define env", - "name": "envName", - "in": "query" - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ComponentPlanListResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "create component plan for application plan", - "operationId": "createComponent", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateComponentPlanRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ComponentPlanBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}/componentplans/{componentName}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "detail component plan for application plan", - "operationId": "detailComponent", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.DetailComponentPlanResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}/deploy": { - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "deploy or upgrade the application", - "operationId": "deployApplication", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ApplicationDeployRequest" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}/envs": { - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "creating an application environment plan", - "operationId": "createApplicationEnv", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateApplicationEnvPlanRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.EnvBind" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}/envs/{envName}": { - "put": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "set application plan differences in the specified environment", - "operationId": "updateApplicationEnvBinding", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the application plan", - "name": "envName", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.PutApplicationPlanEnvRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.EnvBind" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "delete": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "delete an application environment plan", - "operationId": "deleteApplicationEnv", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the application plan", - "name": "envName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.EmptyResponse" - } - }, - "404": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}/policies": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "list policy for application", - "operationId": "listApplicationPolicies", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ListApplicationPolicy" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "create policy for application", - "operationId": "createApplicationPolicy", - "parameters": [ - { - "type": "string", - "description": "identifier of the application", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreatePolicyRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.PolicyBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}/policies/{policyName}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "detail policy for application", - "operationId": "detailApplicationPolicy", - "parameters": [ - { - "type": "string", - "description": "identifier of the application", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the application policy", - "name": "policyName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.DetailPolicyResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "put": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "update policy for application", - "operationId": "updateApplicationPolicy", - "parameters": [ - { - "type": "string", - "description": "identifier of the application", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the application policy", - "name": "policyName", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.UpdatePolicyRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.DetailPolicyResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "delete": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "detail policy for application", - "operationId": "deleteApplicationPolicy", - "parameters": [ - { - "type": "string", - "description": "identifier of the application", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the application policy", - "name": "policyName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.EmptyResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/applicationplans/{name}/template": { - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "application" - ], - "summary": "create one application template", - "operationId": "publishApplicationTemplate", - "parameters": [ - { - "type": "string", - "description": "identifier of the application plan", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateApplicationTemplateRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ApplicationTemplateBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/clusters": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "list all clusters", - "operationId": "listKubeClusters", - "parameters": [ - { - "type": "string", - "description": "Fuzzy search based on name or description", - "name": "query", - "in": "query" - }, - { - "type": "int", - "default": 0, - "description": "Page for paging", - "name": "page", - "in": "query" - }, - { - "type": "int", - "default": 20, - "description": "PageSize for paging", - "name": "pageSize", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - }, - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "create cluster", - "operationId": "createKubeCluster", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/*v1.CreateClusterRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ClusterBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/clusters/cloud-clusters/{provider}": { - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "list cloud clusters", - "operationId": "listCloudClusters", - "parameters": [ - { - "type": "string", - "description": "identifier of the cloud provider", - "name": "provider", - "in": "path", - "required": true - }, - { - "type": "int", - "default": 0, - "description": "Page for paging", - "name": "page", - "in": "query" - }, - { - "type": "int", - "default": 20, - "description": "PageSize for paging", - "name": "pageSize", - "in": "query" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/*v1.AccessKeyRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ListCloudClusterResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/clusters/cloud-clusters/{provider}/connect": { - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "create cluster from cloud cluster", - "operationId": "connectCloudCluster", - "parameters": [ - { - "type": "string", - "description": "identifier of the cloud provider", - "name": "provider", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/*v1.ConnectCloudClusterRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ClusterBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/clusters/cloud-clusters/{provider}/create": { - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "create cloud cluster", - "operationId": "createCloudCluster", - "parameters": [ - { - "type": "string", - "description": "identifier of the cloud provider", - "name": "provider", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/*v1.CreateCloudClusterRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.CreateCloudClusterResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/clusters/cloud-clusters/{provider}/creation": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "list cloud cluster creation", - "operationId": "listCloudClusterCreation", - "parameters": [ - { - "type": "string", - "description": "identifier of the cloud provider", - "name": "provider", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ListCloudClusterCreationResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/clusters/cloud-clusters/{provider}/creation/{cloudClusterName}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "check cloud cluster create status", - "operationId": "getCloudClusterCreationStatus", - "parameters": [ - { - "type": "string", - "description": "identifier of the cloud provider", - "name": "provider", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier for cloud cluster which is creating", - "name": "cloudClusterName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.CreateCloudClusterResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "delete": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "delete cloud cluster creation", - "operationId": "deleteCloudClusterCreation", - "parameters": [ - { - "type": "string", - "description": "identifier of the cloud provider", - "name": "provider", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier for cloud cluster which is creating", - "name": "cloudClusterName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.CreateCloudClusterResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/clusters/{clusterName}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "detail cluster info", - "operationId": "getKubeCluster", - "parameters": [ - { - "type": "string", - "description": "identifier of the cluster", - "name": "clusterName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.DetailClusterResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "put": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "modify cluster", - "operationId": "modifyKubeCluster", - "parameters": [ - { - "type": "string", - "description": "identifier of the cluster", - "name": "clusterName", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/*v1.CreateClusterRequest" - } - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ClusterBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - }, - "delete": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "delete cluster", - "operationId": "deleteKubeCluster", - "parameters": [ - { - "type": "string", - "description": "identifier of the cluster", - "name": "clusterName", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.ClusterBase" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/definitions": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "definition" - ], - "summary": "list all definitions", - "operationId": "listDefinitions", - "parameters": [ - { - "type": "string", - "description": "query the definition type", - "name": "type", - "in": "query" - }, - { - "type": "string", - "description": "if specified, query the definition supported by the env.", - "name": "envName", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - } - }, - "/api/v1/definitions/{name}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "definition" - ], - "summary": "detail definition", - "operationId": "detailDefinition", - "parameters": [ - { - "type": "string", - "description": "identifier of the definition", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "query the definition type", - "name": "type", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - } - }, - "/api/v1/namespaces": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "namespace" - ], - "summary": "list all namespaces", - "operationId": "listNamespaces", - "responses": { - "200": { - "description": "OK" - } - } - }, - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "namespace" - ], - "summary": "create namespace", - "operationId": "createNamespace", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateNamespaceRequest" - } - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/policydefinitions": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "policydefinition" - ], - "summary": "list all policydefinition", - "operationId": "noop", - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/query": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "velaQL" - ], - "summary": "use velaQL to query resource status", - "operationId": "queryView", - "parameters": [ - { - "type": "string", - "description": "velaql query statement", - "name": "velaql", - "in": "query" - } - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/v1.VelaQLViewResponse" - } - }, - "400": { - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - } - } - } - }, - "/api/v1/workflowplans": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "list application workflow", - "operationId": "listApplicationWorkflows", - "parameters": [ - { - "type": "string", - "description": "identifier of the application.", - "name": "appName", - "in": "query" - }, - { - "type": "boolean", - "description": "query based on enable status", - "name": "enable", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - }, - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "create application workflow", - "operationId": "createApplicationWorkflow", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateWorkflowPlanRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "400": { - "description": "create failure", - "schema": { - "$ref": "#/definitions/bcode.Bcode" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - } - }, - "/api/v1/workflowplans/{name}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "detail application workflow", - "operationId": "detailWorkflow", - "parameters": [ - { - "type": "string", - "description": "identifier of the workflow.", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - }, - "put": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "update application workflow config", - "operationId": "updateWorkflow", - "parameters": [ - { - "type": "string", - "description": "identifier of the workflow", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.UpdateWorkflowPlanRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - }, - "delete": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "deletet workflow", - "operationId": "deleteWorkflow", - "parameters": [ - { - "type": "string", - "description": "identifier of the workflow", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - } - }, - "/api/v1/workflowplans/{name}/records": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "query application workflow execution record", - "operationId": "listWorkflowRecords", - "parameters": [ - { - "type": "string", - "description": "identifier of the workflow", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Query the page number.", - "name": "page", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Query the page size number.", - "name": "pageSize", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - } - }, - "/api/v1/workflowplans/{name}/records/{record}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "cluster" - ], - "summary": "query application workflow execution record detail", - "operationId": "detailWorkflowRecord", - "parameters": [ - { - "type": "string", - "description": "identifier of the workflow", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the workflow record", - "name": "record", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/map[string]string" - } - }, - "500": { - "description": "Bummer, something went wrong" - } - } - } - }, - "/v1/namespaces/{namespace}/applications/{appname}": { - "get": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "oam" - ], - "summary": "get the specified oam application in the specified namespace", - "operationId": "getApplication", - "parameters": [ - { - "type": "string", - "description": "identifier of the namespace", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the oam application", - "name": "appname", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - }, - "post": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "oam" - ], - "summary": "create or update oam application in the specified namespace", - "operationId": "createOrUpdateApplication", - "parameters": [ - { - "type": "string", - "description": "identifier of the namespace", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the oam application", - "name": "appname", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.ApplicationRequest" - } - } - ], - "responses": { - "200": { - "description": "OK" - } - } - }, - "delete": { - "consumes": [ - "application/xml", - "application/json" - ], - "produces": [ - "application/json", - "application/xml" - ], - "tags": [ - "oam" - ], - "summary": "create or update oam application in the specified namespace", - "operationId": "deleteApplication", - "parameters": [ - { - "type": "string", - "description": "identifier of the namespace", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "identifier of the oam application", - "name": "appname", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - } - }, - "definitions": { - "bcode.Bcode": { - "required": [ - "BusinessCode", - "Message" - ], - "properties": { - "BusinessCode": { - "type": "integer", - "format": "int32" - }, - "Message": { - "type": "string" - } - } - }, - "cloudprovider.CloudCluster": { - "required": [ - "provider", - "id", - "name", - "type", - "zone", - "labels", - "status", - "apiServerURL", - "dashboardURL" - ], - "properties": { - "apiServerURL": { - "type": "string" - }, - "dashboardURL": { - "type": "string" - }, - "id": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "status": { - "type": "string" - }, - "type": { - "type": "string" - }, - "zone": { - "type": "string" - } - } - }, - "common.AppRolloutStatus": { - "required": [ - "rollingState", - "batchRollingState", - "currentBatch", - "upgradedReplicas", - "upgradedReadyReplicas", - "lastTargetAppRevision" - ], - "properties": { - "LastSourceAppRevision": { - "type": "string" - }, - "batchRollingState": { - "type": "string" - }, - "conditions": { - "type": "array", - "items": { - "$ref": "#/definitions/condition.Condition" - } - }, - "currentBatch": { - "type": "integer", - "format": "int32" - }, - "lastAppliedPodTemplateIdentifier": { - "type": "string" - }, - "lastTargetAppRevision": { - "type": "string" - }, - "rollingState": { - "type": "string" - }, - "rolloutOriginalSize": { - "type": "integer", - "format": "int32" - }, - "rolloutTargetSize": { - "type": "integer", - "format": "int32" - }, - "targetGeneration": { - "type": "string" - }, - "upgradedReadyReplicas": { - "type": "integer", - "format": "int32" - }, - "upgradedReplicas": { - "type": "integer", - "format": "int32" - } - } - }, - "common.AppStatus": { - "properties": { - "appliedResources": { - "type": "array", - "items": { - "$ref": "#/definitions/common.ClusterObjectReference" - } - }, - "components": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.ObjectReference" - } - }, - "conditions": { - "type": "array", - "items": { - "$ref": "#/definitions/condition.Condition" - } - }, - "latestRevision": { - "$ref": "#/definitions/common.Revision" - }, - "observedGeneration": { - "type": "integer", - "format": "int64" - }, - "resourceTracker": { - "$ref": "#/definitions/v1.ObjectReference" - }, - "rollout": { - "$ref": "#/definitions/common.AppRolloutStatus" - }, - "services": { - "type": "array", - "items": { - "$ref": "#/definitions/common.ApplicationComponentStatus" - } - }, - "status": { - "type": "string" - }, - "workflow": { - "$ref": "#/definitions/common.WorkflowStatus" - } - } - }, - "common.ApplicationComponent": { - "required": [ - "name", - "type" - ], - "properties": { - "dependsOn": { - "type": "array", - "items": { - "type": "string" - } - }, - "externalRevision": { - "type": "string" - }, - "inputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.inputItem" - } - }, - "name": { - "type": "string" - }, - "outputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.outputItem" - } - }, - "properties": { - "type": "string" - }, - "scopes": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "traits": { - "type": "array", - "items": { - "$ref": "#/definitions/common.ApplicationTrait" - } - }, - "type": { - "type": "string" - } - } - }, - "common.ApplicationComponentStatus": { - "required": [ - "name", - "healthy" - ], - "properties": { - "env": { - "type": "string" - }, - "healthy": { - "type": "boolean" - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "scopes": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.ObjectReference" - } - }, - "traits": { - "type": "array", - "items": { - "$ref": "#/definitions/common.ApplicationTraitStatus" - } - }, - "workloadDefinition": { - "$ref": "#/definitions/common.WorkloadGVK" - } - } - }, - "common.ApplicationTrait": { - "required": [ - "type" - ], - "properties": { - "properties": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "common.ApplicationTraitStatus": { - "required": [ - "type", - "healthy" - ], - "properties": { - "healthy": { - "type": "boolean" - }, - "message": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "common.ClusterObjectReference": { - "description": "ObjectReference contains enough information to let you inspect or modify the referred object.", - "properties": { - "apiVersion": { - "description": "API version of the referent.", - "type": "string" - }, - "cluster": { - "type": "string" - }, - "creator": { - "type": "string" - }, - "fieldPath": { - "description": "If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.", - "type": "string" - }, - "kind": { - "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "name": { - "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", - "type": "string" - }, - "namespace": { - "description": "Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", - "type": "string" - }, - "resourceVersion": { - "description": "Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", - "type": "string" - }, - "uid": { - "description": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids", - "type": "string" - } - } - }, - "common.Revision": { - "required": [ - "name", - "revision" - ], - "properties": { - "name": { - "type": "string" - }, - "revision": { - "type": "integer", - "format": "int64" - }, - "revisionHash": { - "type": "string" - } - } - }, - "common.SubStepsStatus": { - "properties": { - "mode": { - "type": "string" - }, - "stepIndex": { - "type": "integer", - "format": "int32" - }, - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/common.WorkflowSubStepStatus" - } - } - } - }, - "common.WorkflowStatus": { - "required": [ - "mode", - "suspend", - "terminated", - "finished" - ], - "properties": { - "appRevision": { - "type": "string" - }, - "contextBackend": { - "$ref": "#/definitions/v1.ObjectReference" - }, - "finished": { - "type": "boolean" - }, - "mode": { - "type": "string" - }, - "startTime": { - "type": "string" - }, - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/common.WorkflowStepStatus" - } - }, - "suspend": { - "type": "boolean" - }, - "terminated": { - "type": "boolean" - } - } - }, - "common.WorkflowStepStatus": { - "required": [ - "id" - ], - "properties": { - "firstExecuteTime": { - "type": "string" - }, - "id": { - "type": "string" - }, - "lastExecuteTime": { - "type": "string" - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "phase": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "subSteps": { - "$ref": "#/definitions/common.SubStepsStatus" - }, - "type": { - "type": "string" - } - } - }, - "common.WorkflowSubStepStatus": { - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string" - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "phase": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "common.WorkloadGVK": { - "required": [ - "apiVersion", - "kind" - ], - "properties": { - "apiVersion": { - "type": "string" - }, - "kind": { - "type": "string" - } - } - }, - "common.inputItem": { - "required": [ - "parameterKey", - "from" - ], - "properties": { - "from": { - "type": "string" - }, - "parameterKey": { - "type": "string" - } - } - }, - "common.outputItem": { - "required": [ - "valueFrom", - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "valueFrom": { - "type": "string" - } - } - }, - "condition.Condition": { - "required": [ - "type", - "status", - "lastTransitionTime", - "reason" - ], - "properties": { - "lastTransitionTime": { - "type": "string" - }, - "message": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "status": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "condition.ConditionedStatus": { - "properties": { - "conditions": { - "type": "array", - "items": { - "$ref": "#/definitions/condition.Condition" - } - } - } - }, - "map[string]string": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "model.ApplicationComponentPlan": { - "required": [ - "createTime", - "updateTime", - "appPrimaryKey", - "creator", - "name", - "alias", - "type" - ], - "properties": { - "alias": { - "type": "string" - }, - "appPrimaryKey": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "creator": { - "type": "string" - }, - "dependsOn": { - "type": "array", - "items": { - "type": "string" - } - }, - "description": { - "type": "string" - }, - "externalRevision": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "inputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.inputItem" - } - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "outputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.outputItem" - } - }, - "properties": { - "$ref": "#/definitions/model.JSONStruct" - }, - "scopes": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "traits": { - "type": "array", - "items": { - "$ref": "#/definitions/model.ApplicationTraitPlan" - } - }, - "type": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "model.ApplicationTraitPlan": { - "required": [ - "type" - ], - "properties": { - "properties": { - "$ref": "#/definitions/model.JSONStruct" - }, - "type": { - "type": "string" - } - } - }, - "model.Cluster": { - "required": [ - "createTime", - "updateTime", - "name", - "alias", - "description", - "icon", - "labels", - "status", - "reason", - "provider", - "apiServerURL", - "dashboardURL", - "kubeConfig", - "kubeConfigSecret" - ], - "properties": { - "alias": { - "type": "string" - }, - "apiServerURL": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "dashboardURL": { - "type": "string" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "kubeConfig": { - "type": "string" - }, - "kubeConfigSecret": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "provider": { - "$ref": "#/definitions/model.ProviderInfo" - }, - "reason": { - "type": "string" - }, - "status": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "model.GitAddonSource": { - "properties": { - "path": { - "type": "string" - }, - "token": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "model.JSONStruct": { - "type": "object" - }, - "model.Model": { - "required": [ - "createTime", - "updateTime" - ], - "properties": { - "createTime": { - "type": "string", - "format": "date-time" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "model.ProviderInfo": { - "required": [ - "provider", - "name", - "id", - "zone", - "labels" - ], - "properties": { - "id": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "zone": { - "type": "string" - } - } - }, - "regexp.Regexp": { - "required": [ - "expr", - "prog", - "onepass", - "numSubexp", - "maxBitStateLen", - "subexpNames", - "prefix", - "prefixBytes", - "prefixRune", - "prefixEnd", - "mpool", - "matchcap", - "prefixComplete", - "cond", - "minInputLen", - "longest" - ], - "properties": { - "cond": { - "type": "integer", - "format": "byte" - }, - "expr": { - "type": "string" - }, - "longest": { - "type": "boolean" - }, - "matchcap": { - "type": "integer", - "format": "int32" - }, - "maxBitStateLen": { - "type": "integer", - "format": "int32" - }, - "minInputLen": { - "type": "integer", - "format": "int32" - }, - "mpool": { - "type": "integer", - "format": "int32" - }, - "numSubexp": { - "type": "integer", - "format": "int32" - }, - "onepass": { - "$ref": "#/definitions/regexp.onePassProg" - }, - "prefix": { - "type": "string" - }, - "prefixBytes": { - "type": "string" - }, - "prefixComplete": { - "type": "boolean" - }, - "prefixEnd": { - "type": "integer", - "format": "integer" - }, - "prefixRune": { - "type": "integer", - "format": "int32" - }, - "prog": { - "$ref": "#/definitions/syntax.Prog" - }, - "subexpNames": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "regexp.onePassInst": { - "required": [ - "Op", - "Out", - "Arg", - "Rune", - "Next" - ], - "properties": { - "Arg": { - "type": "integer", - "format": "integer" - }, - "Next": { - "type": "array", - "items": { - "type": "integer" - } - }, - "Op": { - "type": "integer", - "format": "byte" - }, - "Out": { - "type": "integer", - "format": "integer" - }, - "Rune": { - "type": "array", - "items": { - "type": "integer" - } - } - } - }, - "regexp.onePassProg": { - "required": [ - "Inst", - "Start", - "NumCap" - ], - "properties": { - "Inst": { - "type": "array", - "items": { - "$ref": "#/definitions/regexp.onePassInst" - } - }, - "NumCap": { - "type": "integer", - "format": "int32" - }, - "Start": { - "type": "integer", - "format": "int32" - } - } - }, - "syntax.Inst": { - "required": [ - "Op", - "Out", - "Arg", - "Rune" - ], - "properties": { - "Arg": { - "type": "integer", - "format": "integer" - }, - "Op": { - "type": "integer", - "format": "byte" - }, - "Out": { - "type": "integer", - "format": "integer" - }, - "Rune": { - "type": "array", - "items": { - "type": "integer" - } - } - } - }, - "syntax.Prog": { - "required": [ - "Inst", - "Start", - "NumCap" - ], - "properties": { - "Inst": { - "type": "array", - "items": { - "$ref": "#/definitions/syntax.Inst" - } - }, - "NumCap": { - "type": "integer", - "format": "int32" - }, - "Start": { - "type": "integer", - "format": "int32" - } - } - }, - "types.Parameter": { - "required": [ - "name" - ], - "properties": { - "alias": { - "type": "string" - }, - "default": { - "$ref": "#/definitions/types.Parameter.default" - }, - "ignore": { - "type": "boolean" - }, - "jsonType": { - "type": "string" - }, - "name": { - "type": "string" - }, - "required": { - "type": "boolean" - }, - "short": { - "type": "string" - }, - "type": { - "type": "integer", - "format": "int32" - }, - "usage": { - "type": "string" - } - } - }, - "types.Parameter.default": {}, - "v1.AccessKeyRequest": { - "required": [ - "accessKeyID", - "accessKeySecret" - ], - "properties": { - "accessKeyID": { - "type": "string" - }, - "accessKeySecret": { - "type": "string" - } - } - }, - "v1.AddonDependency": { - "properties": { - "name": { - "type": "string" - } - } - }, - "v1.AddonDeployTo": { - "required": [ - "control_plane", - "runtime_cluster" - ], - "properties": { - "control_plane": { - "type": "boolean" - }, - "runtime_cluster": { - "type": "boolean" - } - } - }, - "v1.AddonElementFile": { - "required": [ - "Data", - "Name" - ], - "properties": { - "Data": { - "type": "string" - }, - "Name": { - "type": "string" - } - } - }, - "v1.AddonMeta": { - "required": [ - "name", - "version", - "description", - "icon" - ], - "properties": { - "dependencies": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.AddonDependency" - } - }, - "deploy_to": { - "$ref": "#/definitions/v1.AddonDeployTo" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "name": { - "type": "string" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - } - }, - "url": { - "type": "string" - }, - "version": { - "type": "string" - } - } - }, - "v1.AddonRegistryMeta": { - "required": [ - "name" - ], - "properties": { - "git": { - "$ref": "#/definitions/model.GitAddonSource" - }, - "name": { - "type": "string" - } - } - }, - "v1.AddonStatusResponse": { - "required": [ - "phase" - ], - "properties": { - "enabling_progress": { - "$ref": "#/definitions/v1.EnablingProgress" - }, - "phase": { - "type": "string" - } - } - }, - "v1.ApplicationDeployRequest": { - "required": [ - "workflowName", - "commit", - "sourceType", - "force" - ], - "properties": { - "commit": { - "type": "string" - }, - "force": { - "type": "boolean" - }, - "sourceType": { - "type": "string" - }, - "workflowName": { - "type": "string" - } - } - }, - "v1.ApplicationDeployResponse": { - "required": [ - "version", - "status", - "reason", - "deployUser", - "commit", - "sourceType" - ], - "properties": { - "commit": { - "type": "string" - }, - "deployUser": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "sourceType": { - "type": "string" - }, - "status": { - "type": "string" - }, - "version": { - "type": "string" - } - } - }, - "v1.ApplicationPlanBase": { - "required": [ - "name", - "alias", - "namespace", - "description", - "createTime", - "updateTime", - "icon", - "status", - "gatewayRule" - ], - "properties": { - "alias": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "description": { - "type": "string" - }, - "envBind": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.EnvBind" - } - }, - "gatewayRule": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.GatewayRule" - } - }, - "icon": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "status": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.ApplicationRequest": { - "required": [ - "components" - ], - "properties": { - "components": { - "type": "array", - "items": { - "$ref": "#/definitions/common.ApplicationComponent" - } - }, - "policies": { - "type": "array", - "items": { - "$ref": "#/definitions/v1beta1.AppPolicy" - } - }, - "workflow": { - "$ref": "#/definitions/v1beta1.Workflow" - } - } - }, - "v1.ApplicationResourceInfo": { - "required": [ - "componentNum" - ], - "properties": { - "componentNum": { - "type": "integer", - "format": "int32" - } - } - }, - "v1.ApplicationResponse": { - "required": [ - "apiVersion", - "kind", - "spec", - "status" - ], - "properties": { - "apiVersion": { - "type": "string" - }, - "kind": { - "type": "string" - }, - "spec": { - "$ref": "#/definitions/v1beta1.ApplicationSpec" - }, - "status": { - "$ref": "#/definitions/common.AppStatus" - } - } - }, - "v1.ApplicationTemplateBase": { - "required": [ - "templateName", - "createTime", - "updateTime" - ], - "properties": { - "createTime": { - "type": "string", - "format": "date-time" - }, - "templateName": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - }, - "versions": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.ApplicationTemplateVersion" - } - } - } - }, - "v1.ApplicationTemplateVersion": { - "required": [ - "version", - "description", - "createUser", - "createTime", - "updateTime" - ], - "properties": { - "createTime": { - "type": "string", - "format": "date-time" - }, - "createUser": { - "type": "string" - }, - "description": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - }, - "version": { - "type": "string" - } - } - }, - "v1.ClusterBase": { - "required": [ - "name", - "alias", - "description", - "icon", - "labels", - "providerInfo", - "apiServerURL", - "dashboardURL", - "status", - "reason" - ], - "properties": { - "alias": { - "type": "string" - }, - "apiServerURL": { - "type": "string" - }, - "dashboardURL": { - "type": "string" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "providerInfo": { - "$ref": "#/definitions/model.ProviderInfo" - }, - "reason": { - "type": "string" - }, - "status": { - "type": "string" - } - } - }, - "v1.ClusterResourceInfo": { - "required": [ - "workerNumber", - "masterNumber", - "memoryCapacity", - "cpuCapacity", - "podCapacity", - "memoryUsed", - "cpuUsed", - "podUsed" - ], - "properties": { - "cpuCapacity": { - "type": "integer", - "format": "int64" - }, - "cpuUsed": { - "type": "integer", - "format": "int64" - }, - "gpuCapacity": { - "type": "integer", - "format": "int64" - }, - "gpuUsed": { - "type": "integer", - "format": "int64" - }, - "masterNumber": { - "type": "integer", - "format": "int32" - }, - "memoryCapacity": { - "type": "integer", - "format": "int64" - }, - "memoryUsed": { - "type": "integer", - "format": "int64" - }, - "podCapacity": { - "type": "integer", - "format": "int64" - }, - "podUsed": { - "type": "integer", - "format": "int64" - }, - "storageClassList": { - "type": "array", - "items": { - "type": "string" - } - }, - "workerNumber": { - "type": "integer", - "format": "int32" - } - } - }, - "v1.ClusterSelector": { - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - } - } - }, - "v1.ComponentPlanBase": { - "required": [ - "name", - "alias", - "description", - "componentType", - "envNames", - "dependsOn", - "deployVersion", - "createTime", - "updateTime" - ], - "properties": { - "alias": { - "type": "string" - }, - "componentType": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "creator": { - "type": "string" - }, - "dependsOn": { - "type": "array", - "items": { - "type": "string" - } - }, - "deployVersion": { - "type": "string" - }, - "description": { - "type": "string" - }, - "envNames": { - "type": "array", - "items": { - "type": "string" - } - }, - "icon": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.ComponentPlanListResponse": { - "required": [ - "componentplans" - ], - "properties": { - "componentplans": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.ComponentPlanBase" - } - } - } - }, - "v1.ComponentSelector": { - "required": [ - "components" - ], - "properties": { - "components": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "v1.ConnectCloudClusterRequest": { - "required": [ - "accessKeyID", - "accessKeySecret", - "clusterID", - "name", - "alias", - "icon" - ], - "properties": { - "accessKeyID": { - "type": "string" - }, - "accessKeySecret": { - "type": "string" - }, - "alias": { - "type": "string" - }, - "clusterID": { - "type": "string" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - } - } - }, - "v1.CreateAddonRegistryRequest": { - "required": [ - "name" - ], - "properties": { - "git": { - "$ref": "#/definitions/model.GitAddonSource" - }, - "name": { - "type": "string" - } - } - }, - "v1.CreateApplicationEnvPlanRequest": { - "required": [ - "clusterSelector", - "componentSelector", - "name", - "alias" - ], - "properties": { - "alias": { - "type": "string" - }, - "clusterSelector": { - "$ref": "#/definitions/v1.ClusterSelector" - }, - "componentSelector": { - "$ref": "#/definitions/v1.ComponentSelector" - }, - "description": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "v1.CreateApplicationPlanRequest": { - "required": [ - "name", - "alias", - "namespace", - "description", - "icon" - ], - "properties": { - "alias": { - "type": "string" - }, - "deploy": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "envBind": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.EnvBind" - } - }, - "icon": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "yamlConfig": { - "type": "string" - } - } - }, - "v1.CreateApplicationTemplateRequest": { - "required": [ - "templateName", - "version", - "description" - ], - "properties": { - "description": { - "type": "string" - }, - "templateName": { - "type": "string" - }, - "version": { - "type": "string" - } - } - }, - "v1.CreateCloudClusterRequest": { - "required": [ - "accessKeyID", - "accessKeySecret", - "name", - "zone", - "workerNumber", - "cpuCoresPerWorker", - "memoryPerWorker" - ], - "properties": { - "accessKeyID": { - "type": "string" - }, - "accessKeySecret": { - "type": "string" - }, - "cpuCoresPerWorker": { - "type": "integer", - "format": "int64" - }, - "memoryPerWorker": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "workerNumber": { - "type": "integer", - "format": "int32" - }, - "zone": { - "type": "string" - } - } - }, - "v1.CreateCloudClusterResponse": { - "required": [ - "clusterID", - "status" - ], - "properties": { - "clusterID": { - "type": "string" - }, - "status": { - "type": "string" - } - } - }, - "v1.CreateClusterRequest": { - "required": [ - "name", - "alias", - "icon" - ], - "properties": { - "alias": { - "type": "string" - }, - "dashboardURL": { - "type": "string" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "kubeConfig": { - "type": "string" - }, - "kubeConfigSecret": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - } - } - }, - "v1.CreateComponentPlanRequest": { - "required": [ - "name", - "alias", - "description", - "icon", - "componentType", - "dependsOn" - ], - "properties": { - "alias": { - "type": "string" - }, - "componentType": { - "type": "string" - }, - "dependsOn": { - "type": "array", - "items": { - "type": "string" - } - }, - "description": { - "type": "string" - }, - "envNames": { - "type": "array", - "items": { - "type": "string" - } - }, - "icon": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "properties": { - "type": "string" - } - } - }, - "v1.CreateNamespaceRequest": { - "required": [ - "name", - "description" - ], - "properties": { - "description": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "v1.CreatePolicyRequest": { - "required": [ - "name", - "description", - "type", - "properties" - ], - "properties": { - "description": { - "type": "string" - }, - "name": { - "type": "string" - }, - "properties": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "v1.CreateWorkflowPlanRequest": { - "required": [ - "appName", - "name", - "alias", - "description", - "enable", - "default" - ], - "properties": { - "alias": { - "type": "string" - }, - "appName": { - "type": "string" - }, - "default": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "enable": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.WorkflowStep" - } - } - } - }, - "v1.Definition": { - "required": [ - "kind", - "name", - "description" - ], - "properties": { - "description": { - "type": "string" - }, - "kind": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "v1.DefinitionBase": { - "required": [ - "name", - "description", - "icon" - ], - "properties": { - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "v1.DefinitionProperties": { - "required": [ - "title", - "type", - "compiledPattern" - ], - "properties": { - "compiledPattern": { - "$ref": "#/definitions/regexp.Regexp" - }, - "default": { - "$ref": "#/definitions/v1.DefinitionProperties.default" - }, - "description": { - "type": "string" - }, - "enum": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.DefinitionProperties.enum" - } - }, - "example": { - "$ref": "#/definitions/v1.DefinitionProperties.example" - }, - "items": { - "$ref": "#/definitions/v1.DefinitionSchema" - }, - "maxLength": { - "type": "integer", - "format": "integer" - }, - "maximum": { - "type": "number", - "format": "double" - }, - "minLength": { - "type": "integer", - "format": "integer" - }, - "minimum": { - "type": "number", - "format": "double" - }, - "multipleOf": { - "type": "number", - "format": "double" - }, - "pattern": { - "type": "string" - }, - "title": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "v1.DefinitionProperties.default": {}, - "v1.DefinitionProperties.enum": {}, - "v1.DefinitionProperties.example": {}, - "v1.DefinitionSchema": { - "required": [ - "properties", - "required", - "type" - ], - "properties": { - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/v1.DefinitionProperties" - } - }, - "required": { - "type": "array", - "items": { - "type": "string" - } - }, - "type": { - "type": "string" - } - } - }, - "v1.DetailAddonResponse": { - "required": [ - "name", - "version", - "description", - "icon", - "definitions", - "parameters", - "cue_templates" - ], - "properties": { - "cue_templates": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.AddonElementFile" - } - }, - "definitions": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.Definition" - } - }, - "dependencies": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.AddonDependency" - } - }, - "deploy_to": { - "$ref": "#/definitions/v1.AddonDeployTo" - }, - "description": { - "type": "string" - }, - "detail": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "name": { - "type": "string" - }, - "parameters": { - "type": "string" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - } - }, - "url": { - "type": "string" - }, - "version": { - "type": "string" - }, - "yaml_templates": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.AddonElementFile" - } - } - } - }, - "v1.DetailApplicationPlanResponse": { - "required": [ - "createTime", - "status", - "namespace", - "alias", - "description", - "updateTime", - "icon", - "gatewayRule", - "name", - "policies", - "status", - "resourceInfo", - "workflowStatus" - ], - "properties": { - "alias": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "description": { - "type": "string" - }, - "envBind": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.EnvBind" - } - }, - "gatewayRule": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.GatewayRule" - } - }, - "icon": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "policies": { - "type": "array", - "items": { - "type": "string" - } - }, - "resourceInfo": { - "$ref": "#/definitions/v1.ApplicationResourceInfo" - }, - "status": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - }, - "workflowStatus": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.WorkflowStepStatus" - } - } - } - }, - "v1.DetailClusterResponse": { - "required": [ - "name", - "icon", - "provider", - "kubeConfigSecret", - "alias", - "status", - "labels", - "description", - "reason", - "apiServerURL", - "dashboardURL", - "kubeConfig", - "createTime", - "updateTime", - "resourceInfo" - ], - "properties": { - "alias": { - "type": "string" - }, - "apiServerURL": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "dashboardURL": { - "type": "string" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "kubeConfig": { - "type": "string" - }, - "kubeConfigSecret": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "provider": { - "$ref": "#/definitions/model.ProviderInfo" - }, - "reason": { - "type": "string" - }, - "resourceInfo": { - "$ref": "#/definitions/v1.ClusterResourceInfo" - }, - "status": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.DetailComponentPlanResponse": { - "required": [ - "creator", - "createTime", - "updateTime", - "name", - "alias", - "appPrimaryKey", - "type" - ], - "properties": { - "alias": { - "type": "string" - }, - "appPrimaryKey": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "creator": { - "type": "string" - }, - "dependsOn": { - "type": "array", - "items": { - "type": "string" - } - }, - "description": { - "type": "string" - }, - "externalRevision": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "inputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.inputItem" - } - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "outputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.outputItem" - } - }, - "properties": { - "$ref": "#/definitions/model.JSONStruct" - }, - "scopes": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "traits": { - "type": "array", - "items": { - "$ref": "#/definitions/model.ApplicationTraitPlan" - } - }, - "type": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.DetailDefinitionResponse": { - "required": [ - "schema" - ], - "properties": { - "schema": { - "$ref": "#/definitions/v1.DefinitionSchema" - } - } - }, - "v1.DetailPolicyResponse": { - "required": [ - "creator", - "properties", - "createTime", - "updateTime", - "name", - "type", - "description" - ], - "properties": { - "createTime": { - "type": "string", - "format": "date-time" - }, - "creator": { - "type": "string" - }, - "description": { - "type": "string" - }, - "name": { - "type": "string" - }, - "properties": { - "$ref": "#/definitions/model.JSONStruct" - }, - "type": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.DetailWorkflowPlanResponse": { - "required": [ - "alias", - "description", - "enable", - "default", - "createTime", - "updateTime", - "name", - "workflowRecord" - ], - "properties": { - "alias": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "default": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "enable": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.WorkflowStep" - } - }, - "updateTime": { - "type": "string", - "format": "date-time" - }, - "workflowRecord": { - "$ref": "#/definitions/v1.WorkflowRecord" - } - } - }, - "v1.DetailWorkflowRecordResponse": { - "required": [ - "name", - "namespace", - "suspend", - "terminated", - "deployTime", - "deployUser", - "commit", - "sourceType" - ], - "properties": { - "commit": { - "type": "string" - }, - "deployTime": { - "type": "string", - "format": "date-time" - }, - "deployUser": { - "type": "string" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "sourceType": { - "type": "string" - }, - "startTime": { - "type": "string", - "format": "date-time" - }, - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/common.WorkflowStepStatus" - } - }, - "suspend": { - "type": "boolean" - }, - "terminated": { - "type": "boolean" - } - } - }, - "v1.EmptyResponse": {}, - "v1.EnableAddonRequest": { - "properties": { - "args": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "v1.EnablingProgress": { - "required": [ - "enabled_components", - "total_components" - ], - "properties": { - "enabled_components": { - "type": "integer", - "format": "int32" - }, - "total_components": { - "type": "integer", - "format": "int32" - } - } - }, - "v1.EnvBind": { - "required": [ - "name", - "alias", - "clusterSelector", - "componentSelector" - ], - "properties": { - "alias": { - "type": "string" - }, - "clusterSelector": { - "$ref": "#/definitions/v1.ClusterSelector" - }, - "componentSelector": { - "$ref": "#/definitions/v1.ComponentSelector" - }, - "description": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "v1.GatewayRule": { - "required": [ - "ruleType", - "address", - "protocol", - "componentName", - "componentPort" - ], - "properties": { - "address": { - "type": "string" - }, - "componentName": { - "type": "string" - }, - "componentPort": { - "type": "integer", - "format": "int32" - }, - "protocol": { - "type": "string" - }, - "ruleType": { - "type": "string" - } - } - }, - "v1.ListAddonRegistryResponse": { - "required": [ - "registrys" - ], - "properties": { - "registrys": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.AddonRegistryMeta" - } - } - } - }, - "v1.ListAddonResponse": { - "required": [ - "addons" - ], - "properties": { - "addons": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.AddonMeta" - } - } - } - }, - "v1.ListApplicationPlanResponse": { - "required": [ - "applicationplans" - ], - "properties": { - "applicationplans": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.ApplicationPlanBase" - } - } - } - }, - "v1.ListApplicationPolicy": { - "required": [ - "policies" - ], - "properties": { - "policies": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.PolicyBase" - } - } - } - }, - "v1.ListCloudClusterCreationResponse": { - "required": [ - "creations" - ], - "properties": { - "creations": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "v1.ListCloudClusterResponse": { - "required": [ - "clusters", - "total" - ], - "properties": { - "clusters": { - "type": "array", - "items": { - "$ref": "#/definitions/cloudprovider.CloudCluster" - } - }, - "total": { - "type": "integer", - "format": "int32" - } - } - }, - "v1.ListClusterResponse": { - "required": [ - "clusters" - ], - "properties": { - "clusters": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.ClusterBase" - } - } - } - }, - "v1.ListDefinitionResponse": { - "required": [ - "definitions" - ], - "properties": { - "definitions": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.DefinitionBase" - } - } - } - }, - "v1.ListNamespaceResponse": { - "required": [ - "namespaces" - ], - "properties": { - "namespaces": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.NamespaceBase" - } - } - } - }, - "v1.ListPolicyDefinitionResponse": { - "required": [ - "policyDefinitions" - ], - "properties": { - "policyDefinitions": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.PolicyDefinition" - } - } - } - }, - "v1.ListWorkflowPlanResponse": { - "required": [ - "workflowplans" - ], - "properties": { - "workflowplans": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.WorkflowPlanBase" - } - } - } - }, - "v1.ListWorkflowRecordsResponse": { - "required": [ - "records", - "total" - ], - "properties": { - "records": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.WorkflowRecord" - } - }, - "total": { - "type": "integer", - "format": "int64" - } - } - }, - "v1.NamespaceBase": { - "required": [ - "name", - "description", - "createTime", - "updateTime" - ], - "properties": { - "createTime": { - "type": "string", - "format": "date-time" - }, - "description": { - "type": "string" - }, - "name": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.NamespaceDetailResponse": { - "required": [ - "name", - "description", - "createTime", - "updateTime" - ], - "properties": { - "createTime": { - "type": "string", - "format": "date-time" - }, - "description": { - "type": "string" - }, - "name": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.ObjectReference": { - "description": "ObjectReference contains enough information to let you inspect or modify the referred object.", - "properties": { - "apiVersion": { - "description": "API version of the referent.", - "type": "string" - }, - "fieldPath": { - "description": "If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.", - "type": "string" - }, - "kind": { - "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "name": { - "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", - "type": "string" - }, - "namespace": { - "description": "Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", - "type": "string" - }, - "resourceVersion": { - "description": "Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", - "type": "string" - }, - "uid": { - "description": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids", - "type": "string" - } - } - }, - "v1.PolicyBase": { - "required": [ - "name", - "type", - "description", - "creator", - "properties", - "createTime", - "updateTime" - ], - "properties": { - "createTime": { - "type": "string", - "format": "date-time" - }, - "creator": { - "type": "string" - }, - "description": { - "type": "string" - }, - "name": { - "type": "string" - }, - "properties": { - "$ref": "#/definitions/model.JSONStruct" - }, - "type": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.PolicyDefinition": { - "required": [ - "name", - "description", - "parameters" - ], - "properties": { - "description": { - "type": "string" - }, - "name": { - "type": "string" - }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/types.Parameter" - } - } - } - }, - "v1.PutApplicationPlanEnvRequest": { - "properties": { - "alias": { - "type": "string" - }, - "clusterSelector": { - "$ref": "#/definitions/v1.ClusterSelector" - }, - "componentSelector": { - "$ref": "#/definitions/v1.ComponentSelector" - }, - "description": { - "type": "string" - } - } - }, - "v1.UpdateApplicationPlanRequest": { - "required": [ - "alias", - "description", - "icon" - ], - "properties": { - "alias": { - "type": "string" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "v1.UpdatePolicyRequest": { - "required": [ - "description", - "type", - "properties" - ], - "properties": { - "description": { - "type": "string" - }, - "properties": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "v1.UpdateWorkflowPlanRequest": { - "required": [ - "alias", - "description", - "enable", - "default" - ], - "properties": { - "alias": { - "type": "string" - }, - "default": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "enable": { - "type": "boolean" - }, - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.WorkflowStep" - } - } - } - }, - "v1.VelaQLViewResponse": { - "type": "object" - }, - "v1.WorkflowPlanBase": { - "required": [ - "name", - "alias", - "description", - "enable", - "default", - "createTime", - "updateTime" - ], - "properties": { - "alias": { - "type": "string" - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "default": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "enable": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "updateTime": { - "type": "string", - "format": "date-time" - } - } - }, - "v1.WorkflowRecord": { - "required": [ - "name", - "namespace", - "suspend", - "terminated" - ], - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "startTime": { - "type": "string", - "format": "date-time" - }, - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/common.WorkflowStepStatus" - } - }, - "suspend": { - "type": "boolean" - }, - "terminated": { - "type": "boolean" - } - } - }, - "v1.WorkflowStep": { - "required": [ - "name", - "type", - "dependsOn" - ], - "properties": { - "dependsOn": { - "type": "array", - "items": { - "type": "string" - } - }, - "inputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.inputItem" - } - }, - "name": { - "type": "string" - }, - "outputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.outputItem" - } - }, - "properties": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "v1.WorkflowStepStatus": { - "required": [ - "name", - "status", - "takeTime" - ], - "properties": { - "name": { - "type": "string" - }, - "status": { - "type": "string" - }, - "takeTime": { - "type": "integer", - "format": "integer" - } - } - }, - "v1alpha1.CanaryMetric": { - "required": [ - "name" - ], - "properties": { - "interval": { - "type": "string" - }, - "metricsRange": { - "$ref": "#/definitions/v1alpha1.MetricsExpectedRange" - }, - "name": { - "type": "string" - }, - "templateRef": { - "$ref": "#/definitions/v1.ObjectReference" - } - } - }, - "v1alpha1.MetricsExpectedRange": { - "properties": { - "max": { - "type": "string" - }, - "min": { - "type": "string" - } - } - }, - "v1alpha1.RolloutBatch": { - "properties": { - "batchRolloutWebhooks": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.RolloutWebhook" - } - }, - "canaryMetric": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.CanaryMetric" - } - }, - "instanceInterval": { - "type": "integer", - "format": "int32" - }, - "maxUnavailable": { - "type": "string" - }, - "podList": { - "type": "array", - "items": { - "type": "string" - } - }, - "replicas": { - "type": "string" - } - } - }, - "v1alpha1.RolloutPlan": { - "properties": { - "batchPartition": { - "type": "integer", - "format": "int32" - }, - "canaryMetric": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.CanaryMetric" - } - }, - "numBatches": { - "type": "integer", - "format": "int32" - }, - "paused": { - "type": "boolean" - }, - "rolloutBatches": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.RolloutBatch" - } - }, - "rolloutStrategy": { - "type": "string" - }, - "rolloutWebhooks": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.RolloutWebhook" - } - }, - "targetSize": { - "type": "integer", - "format": "int32" - } - } - }, - "v1alpha1.RolloutStatus": { - "required": [ - "rollingState", - "batchRollingState", - "currentBatch", - "upgradedReplicas", - "upgradedReadyReplicas" - ], - "properties": { - "batchRollingState": { - "type": "string" - }, - "conditions": { - "type": "array", - "items": { - "$ref": "#/definitions/condition.Condition" - } - }, - "currentBatch": { - "type": "integer", - "format": "int32" - }, - "lastAppliedPodTemplateIdentifier": { - "type": "string" - }, - "rollingState": { - "type": "string" - }, - "rolloutOriginalSize": { - "type": "integer", - "format": "int32" - }, - "rolloutTargetSize": { - "type": "integer", - "format": "int32" - }, - "targetGeneration": { - "type": "string" - }, - "upgradedReadyReplicas": { - "type": "integer", - "format": "int32" - }, - "upgradedReplicas": { - "type": "integer", - "format": "int32" - } - } - }, - "v1alpha1.RolloutWebhook": { - "required": [ - "type", - "name", - "url" - ], - "properties": { - "expectedStatus": { - "type": "array", - "items": { - "type": "integer" - } - }, - "metadata": { - "$ref": "#/definitions/v1alpha1.RolloutWebhook.metadata" - }, - "method": { - "type": "string" - }, - "name": { - "type": "string" - }, - "type": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "v1alpha1.RolloutWebhook.metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "v1beta1.AppPolicy": { - "required": [ - "name", - "type" - ], - "properties": { - "name": { - "type": "string" - }, - "properties": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "v1beta1.ApplicationSpec": { - "required": [ - "components" - ], - "properties": { - "components": { - "type": "array", - "items": { - "$ref": "#/definitions/common.ApplicationComponent" - } - }, - "policies": { - "type": "array", - "items": { - "$ref": "#/definitions/v1beta1.AppPolicy" - } - }, - "rolloutPlan": { - "$ref": "#/definitions/v1alpha1.RolloutPlan" - }, - "workflow": { - "$ref": "#/definitions/v1beta1.Workflow" - } - } - }, - "v1beta1.Workflow": { - "properties": { - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/v1beta1.WorkflowStep" - } - } - } - }, - "v1beta1.WorkflowStep": { - "required": [ - "name", - "type" - ], - "properties": { - "dependsOn": { - "type": "array", - "items": { - "type": "string" - } - }, - "inputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.inputItem" - } - }, - "name": { - "type": "string" - }, - "outputs": { - "type": "array", - "items": { - "$ref": "#/definitions/common.outputItem" - } - }, - "properties": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - } + "swagger": "2.0", + "info": { + "description": "Kubevela api doc", + "title": "Kubevela api doc", + "contact": { + "name": "kubevela", + "url": "https://kubevela.io/", + "email": "feedback@mail.kubevela.io" + }, + "license": { + "name": "Apache License 2.0", + "url": "https://github.com/oam-dev/kubevela/blob/master/LICENSE" + }, + "version": "v1beta1" + }, + "paths": { + "/api/v1/addon_registries": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "addon_registry" + ], + "summary": "list all addon registry", + "operationId": "listAddonRegistry", + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ListAddonRegistryResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "addon_registry" + ], + "summary": "create an addon registry", + "operationId": "createAddonRegistry", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateAddonRegistryRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.AddonRegistryMeta" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/addon_registries/{name}": { + "delete": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "addon_registry" + ], + "summary": "delete an addon registry", + "operationId": "deleteAddonRegistry", + "parameters": [ + { + "type": "string", + "description": "identifier of the addon registry", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.AddonRegistryMeta" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/addons": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "addon" + ], + "summary": "list all addons", + "operationId": "listAddons", + "parameters": [ + { + "type": "string", + "description": "filter addons from given registry", + "name": "registry", + "in": "query" + }, + { + "type": "string", + "description": "Fuzzy search based on name and description.", + "name": "query", + "in": "query" + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ListAddonResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/addons/{name}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "addon" + ], + "summary": "show details of an addon", + "operationId": "detailAddon", + "parameters": [ + { + "type": "string", + "description": "addon name to query detail", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.DetailAddonResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/addons/{name}/disable": { + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "addon" + ], + "summary": "disable an addon", + "operationId": "disableAddon", + "parameters": [ + { + "type": "string", + "description": "addon name to enable", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.AddonStatusResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/addons/{name}/enable": { + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "addon" + ], + "summary": "enable an addon", + "operationId": "enableAddon", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.EnableAddonRequest" + } + }, + { + "type": "string", + "description": "addon name to enable", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.AddonStatusResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/addons/{name}/status": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "addon" + ], + "summary": "show status of an addon", + "operationId": "statusAddon", + "parameters": [ + { + "type": "string", + "description": "addon name to query status", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.AddonStatusResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "list all application plans", + "operationId": "listApplicationPlans", + "parameters": [ + { + "type": "string", + "description": "Fuzzy search based on name or description", + "name": "query", + "in": "query" + }, + { + "type": "string", + "description": "Namespace-based search", + "name": "namespace", + "in": "query" + }, + { + "type": "string", + "description": "Cluster-based search", + "name": "cluster", + "in": "query" + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ListApplicationPlanResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "create one application plan", + "operationId": "createApplicationPlan", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateApplicationPlanRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ApplicationPlanBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "detail one application plan", + "operationId": "detailApplicationPlan", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.DetailApplicationPlanResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "put": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "update one application plan", + "operationId": "updateApplicationPlan", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.UpdateApplicationPlanRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ApplicationPlanBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "delete": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "delete one application", + "operationId": "deleteApplicationPlan", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.EmptyResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}/componentplans": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "gets the componentplan topology of the application", + "operationId": "listApplicationComponents", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "list components that deployed in define env", + "name": "envName", + "in": "query" + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ComponentPlanListResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "create component plan for application plan", + "operationId": "createComponent", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateComponentPlanRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ComponentPlanBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}/componentplans/{componentName}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "detail component plan for application plan", + "operationId": "detailComponent", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.DetailComponentPlanResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}/deploy": { + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "deploy or upgrade the application", + "operationId": "deployApplication", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ApplicationDeployRequest" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}/envs": { + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "creating an application environment plan", + "operationId": "createApplicationEnv", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateApplicationEnvPlanRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.EnvBind" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}/envs/{envName}": { + "put": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "set application plan differences in the specified environment", + "operationId": "updateApplicationEnvBinding", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the application plan", + "name": "envName", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.PutApplicationPlanEnvRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.EnvBind" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "delete": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "delete an application environment plan", + "operationId": "deleteApplicationEnv", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the application plan", + "name": "envName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.EmptyResponse" + } + }, + "404": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}/policies": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "list policy for application", + "operationId": "listApplicationPolicies", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ListApplicationPolicy" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "create policy for application", + "operationId": "createApplicationPolicy", + "parameters": [ + { + "type": "string", + "description": "identifier of the application", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreatePolicyRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.PolicyBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}/policies/{policyName}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "detail policy for application", + "operationId": "detailApplicationPolicy", + "parameters": [ + { + "type": "string", + "description": "identifier of the application", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the application policy", + "name": "policyName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.DetailPolicyResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "put": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "update policy for application", + "operationId": "updateApplicationPolicy", + "parameters": [ + { + "type": "string", + "description": "identifier of the application", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the application policy", + "name": "policyName", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.UpdatePolicyRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.DetailPolicyResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "delete": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "detail policy for application", + "operationId": "deleteApplicationPolicy", + "parameters": [ + { + "type": "string", + "description": "identifier of the application", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the application policy", + "name": "policyName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.EmptyResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/applicationplans/{name}/template": { + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "applicationplan" + ], + "summary": "create one application template", + "operationId": "publishApplicationTemplate", + "parameters": [ + { + "type": "string", + "description": "identifier of the application plan", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateApplicationTemplateRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ApplicationTemplateBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/clusters": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "list all clusters", + "operationId": "listKubeClusters", + "parameters": [ + { + "type": "string", + "description": "Fuzzy search based on name or description", + "name": "query", + "in": "query" + }, + { + "type": "int", + "default": 0, + "description": "Page for paging", + "name": "page", + "in": "query" + }, + { + "type": "int", + "default": 20, + "description": "PageSize for paging", + "name": "pageSize", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + }, + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "create cluster", + "operationId": "createKubeCluster", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/*v1.CreateClusterRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ClusterBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/clusters/cloud-clusters/{provider}": { + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "list cloud clusters", + "operationId": "listCloudClusters", + "parameters": [ + { + "type": "string", + "description": "identifier of the cloud provider", + "name": "provider", + "in": "path", + "required": true + }, + { + "type": "int", + "default": 0, + "description": "Page for paging", + "name": "page", + "in": "query" + }, + { + "type": "int", + "default": 20, + "description": "PageSize for paging", + "name": "pageSize", + "in": "query" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.AccessKeyRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ListCloudClusterResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/clusters/cloud-clusters/{provider}/connect": { + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "create cluster from cloud cluster", + "operationId": "connectCloudCluster", + "parameters": [ + { + "type": "string", + "description": "identifier of the cloud provider", + "name": "provider", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.ConnectCloudClusterRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ClusterBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/clusters/cloud-clusters/{provider}/create": { + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "create cloud cluster", + "operationId": "createCloudCluster", + "parameters": [ + { + "type": "string", + "description": "identifier of the cloud provider", + "name": "provider", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateCloudClusterRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.CreateCloudClusterResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/clusters/cloud-clusters/{provider}/creation": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "list cloud cluster creation", + "operationId": "listCloudClusterCreation", + "parameters": [ + { + "type": "string", + "description": "identifier of the cloud provider", + "name": "provider", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ListCloudClusterCreationResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/clusters/cloud-clusters/{provider}/creation/{cloudClusterName}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "check cloud cluster create status", + "operationId": "getCloudClusterCreationStatus", + "parameters": [ + { + "type": "string", + "description": "identifier of the cloud provider", + "name": "provider", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier for cloud cluster which is creating", + "name": "cloudClusterName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.CreateCloudClusterResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "delete": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "delete cloud cluster creation", + "operationId": "deleteCloudClusterCreation", + "parameters": [ + { + "type": "string", + "description": "identifier of the cloud provider", + "name": "provider", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier for cloud cluster which is creating", + "name": "cloudClusterName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.CreateCloudClusterResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/clusters/{clusterName}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "detail cluster info", + "operationId": "getKubeCluster", + "parameters": [ + { + "type": "string", + "description": "identifier of the cluster", + "name": "clusterName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.DetailClusterResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "put": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "modify cluster", + "operationId": "modifyKubeCluster", + "parameters": [ + { + "type": "string", + "description": "identifier of the cluster", + "name": "clusterName", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateClusterRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ClusterBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + }, + "delete": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "cluster" + ], + "summary": "delete cluster", + "operationId": "deleteKubeCluster", + "parameters": [ + { + "type": "string", + "description": "identifier of the cluster", + "name": "clusterName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ClusterBase" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/definitions": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "definition" + ], + "summary": "list all definitions", + "operationId": "listDefinitions", + "parameters": [ + { + "enum": [ + "component", + "trait", + "workflowstep" + ], + "type": "string", + "description": "query the definition type", + "name": "type", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "if specified, query the definition supported by the env.", + "name": "envName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + } + }, + "/api/v1/definitions/{name}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "definition" + ], + "summary": "detail definition", + "operationId": "detailDefinition", + "parameters": [ + { + "type": "string", + "description": "identifier of the definition", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "query the definition type", + "name": "type", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + } + }, + "/api/v1/namespaces": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "namespace" + ], + "summary": "list all namespaces", + "operationId": "listNamespaces", + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ListNamespaceResponse" + } + } + } + }, + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "namespace" + ], + "summary": "create namespace", + "operationId": "createNamespace", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateNamespaceRequest" + } + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.NamespaceDetailResponse" + } + } + } + } + }, + "/api/v1/policydefinitions": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "definition" + ], + "summary": "list all policydefinition", + "operationId": "noop", + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ListPolicyDefinitionResponse" + } + } + } + } + }, + "/api/v1/query": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "velaQL" + ], + "summary": "use velaQL to query resource status", + "operationId": "queryView", + "parameters": [ + { + "type": "string", + "description": "velaql query statement", + "name": "velaql", + "in": "query" + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.VelaQLViewResponse" + } + }, + "400": { + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + } + } + } + }, + "/api/v1/workflowplans": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "workflowplan" + ], + "summary": "list application workflow", + "operationId": "listApplicationWorkflows", + "parameters": [ + { + "type": "string", + "description": "identifier of the application.", + "name": "appName", + "in": "query", + "required": true + }, + { + "type": "boolean", + "description": "query based on enable status", + "name": "enable", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + }, + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "workflowplan" + ], + "summary": "create application workflow", + "operationId": "createApplicationWorkflow", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateWorkflowPlanRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "400": { + "description": "create failure", + "schema": { + "$ref": "#/definitions/bcode.Bcode" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + } + }, + "/api/v1/workflowplans/{name}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "workflowplan" + ], + "summary": "detail application workflow", + "operationId": "detailWorkflow", + "parameters": [ + { + "type": "string", + "description": "identifier of the workflow.", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + }, + "put": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "workflowplan" + ], + "summary": "update application workflow config", + "operationId": "updateWorkflow", + "parameters": [ + { + "type": "string", + "description": "identifier of the workflow", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.UpdateWorkflowPlanRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + }, + "delete": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "workflowplan" + ], + "summary": "deletet workflow", + "operationId": "deleteWorkflow", + "parameters": [ + { + "type": "string", + "description": "identifier of the workflow", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + } + }, + "/api/v1/workflowplans/{name}/records": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "workflowplan" + ], + "summary": "query application workflow execution record", + "operationId": "listWorkflowRecords", + "parameters": [ + { + "type": "string", + "description": "identifier of the workflow", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Query the page number.", + "name": "page", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Query the page size number.", + "name": "pageSize", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + } + }, + "/api/v1/workflowplans/{name}/records/{record}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "workflowplan" + ], + "summary": "query application workflow execution record detail", + "operationId": "detailWorkflowRecord", + "parameters": [ + { + "type": "string", + "description": "identifier of the workflow", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the workflow record", + "name": "record", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/map[string]string" + } + }, + "500": { + "description": "Bummer, something went wrong" + } + } + } + }, + "/v1/namespaces/{namespace}/applications/{appname}": { + "get": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "oam-application" + ], + "summary": "get the specified oam application in the specified namespace", + "operationId": "getApplication", + "parameters": [ + { + "type": "string", + "description": "identifier of the namespace", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the oam application", + "name": "appname", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "schema": { + "$ref": "#/definitions/v1.ApplicationResponse" + } + } + } + }, + "post": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "oam-application" + ], + "summary": "create or update oam application in the specified namespace", + "operationId": "createOrUpdateApplication", + "parameters": [ + { + "type": "string", + "description": "identifier of the namespace", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the oam application", + "name": "appname", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.ApplicationRequest" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + }, + "delete": { + "consumes": [ + "application/xml", + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "tags": [ + "oam-application" + ], + "summary": "create or update oam application in the specified namespace", + "operationId": "deleteApplication", + "parameters": [ + { + "type": "string", + "description": "identifier of the namespace", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "identifier of the oam application", + "name": "appname", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + } + }, + "definitions": { + "bcode.Bcode": { + "required": [ + "BusinessCode", + "Message" + ], + "properties": { + "BusinessCode": { + "type": "integer", + "format": "int32" + }, + "Message": { + "type": "string" + } + } + }, + "cloudprovider.CloudCluster": { + "required": [ + "provider", + "id", + "name", + "type", + "zone", + "labels", + "status", + "apiServerURL", + "dashboardURL" + ], + "properties": { + "apiServerURL": { + "type": "string" + }, + "dashboardURL": { + "type": "string" + }, + "id": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "status": { + "type": "string" + }, + "type": { + "type": "string" + }, + "zone": { + "type": "string" + } + } + }, + "common.AppRolloutStatus": { + "required": [ + "rollingState", + "batchRollingState", + "currentBatch", + "upgradedReadyReplicas", + "upgradedReplicas", + "lastTargetAppRevision" + ], + "properties": { + "LastSourceAppRevision": { + "type": "string" + }, + "batchRollingState": { + "type": "string" + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/condition.Condition" + } + }, + "currentBatch": { + "type": "integer", + "format": "int32" + }, + "lastAppliedPodTemplateIdentifier": { + "type": "string" + }, + "lastTargetAppRevision": { + "type": "string" + }, + "rollingState": { + "type": "string" + }, + "rolloutOriginalSize": { + "type": "integer", + "format": "int32" + }, + "rolloutTargetSize": { + "type": "integer", + "format": "int32" + }, + "targetGeneration": { + "type": "string" + }, + "upgradedReadyReplicas": { + "type": "integer", + "format": "int32" + }, + "upgradedReplicas": { + "type": "integer", + "format": "int32" + } + } + }, + "common.AppStatus": { + "properties": { + "appliedResources": { + "type": "array", + "items": { + "$ref": "#/definitions/common.ClusterObjectReference" + } + }, + "components": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.ObjectReference" + } + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/condition.Condition" + } + }, + "latestRevision": { + "$ref": "#/definitions/common.Revision" + }, + "observedGeneration": { + "type": "integer", + "format": "int64" + }, + "resourceTracker": { + "$ref": "#/definitions/v1.ObjectReference" + }, + "rollout": { + "$ref": "#/definitions/common.AppRolloutStatus" + }, + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/common.ApplicationComponentStatus" + } + }, + "status": { + "type": "string" + }, + "workflow": { + "$ref": "#/definitions/common.WorkflowStatus" + } + } + }, + "common.ApplicationComponent": { + "required": [ + "name", + "type" + ], + "properties": { + "dependsOn": { + "type": "array", + "items": { + "type": "string" + } + }, + "externalRevision": { + "type": "string" + }, + "inputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.inputItem" + } + }, + "name": { + "type": "string" + }, + "outputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.outputItem" + } + }, + "properties": { + "type": "string" + }, + "scopes": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "traits": { + "type": "array", + "items": { + "$ref": "#/definitions/common.ApplicationTrait" + } + }, + "type": { + "type": "string" + } + } + }, + "common.ApplicationComponentStatus": { + "required": [ + "name", + "healthy" + ], + "properties": { + "env": { + "type": "string" + }, + "healthy": { + "type": "boolean" + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "scopes": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.ObjectReference" + } + }, + "traits": { + "type": "array", + "items": { + "$ref": "#/definitions/common.ApplicationTraitStatus" + } + }, + "workloadDefinition": { + "$ref": "#/definitions/common.WorkloadGVK" + } + } + }, + "common.ApplicationTrait": { + "required": [ + "type" + ], + "properties": { + "properties": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "common.ApplicationTraitStatus": { + "required": [ + "type", + "healthy" + ], + "properties": { + "healthy": { + "type": "boolean" + }, + "message": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "common.ClusterObjectReference": { + "description": "ObjectReference contains enough information to let you inspect or modify the referred object.", + "properties": { + "apiVersion": { + "description": "API version of the referent.", + "type": "string" + }, + "cluster": { + "type": "string" + }, + "creator": { + "type": "string" + }, + "fieldPath": { + "description": "If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.", + "type": "string" + }, + "kind": { + "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "namespace": { + "description": "Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", + "type": "string" + }, + "resourceVersion": { + "description": "Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", + "type": "string" + }, + "uid": { + "description": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids", + "type": "string" + } + } + }, + "common.Revision": { + "required": [ + "name", + "revision" + ], + "properties": { + "name": { + "type": "string" + }, + "revision": { + "type": "integer", + "format": "int64" + }, + "revisionHash": { + "type": "string" + } + } + }, + "common.SubStepsStatus": { + "properties": { + "mode": { + "type": "string" + }, + "stepIndex": { + "type": "integer", + "format": "int32" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/common.WorkflowSubStepStatus" + } + } + } + }, + "common.WorkflowStatus": { + "required": [ + "mode", + "suspend", + "terminated", + "finished" + ], + "properties": { + "appRevision": { + "type": "string" + }, + "contextBackend": { + "$ref": "#/definitions/v1.ObjectReference" + }, + "finished": { + "type": "boolean" + }, + "mode": { + "type": "string" + }, + "startTime": { + "type": "string" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/common.WorkflowStepStatus" + } + }, + "suspend": { + "type": "boolean" + }, + "terminated": { + "type": "boolean" + } + } + }, + "common.WorkflowStepStatus": { + "required": [ + "id" + ], + "properties": { + "firstExecuteTime": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastExecuteTime": { + "type": "string" + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "phase": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "subSteps": { + "$ref": "#/definitions/common.SubStepsStatus" + }, + "type": { + "type": "string" + } + } + }, + "common.WorkflowSubStepStatus": { + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "phase": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "common.WorkloadGVK": { + "required": [ + "apiVersion", + "kind" + ], + "properties": { + "apiVersion": { + "type": "string" + }, + "kind": { + "type": "string" + } + } + }, + "common.inputItem": { + "required": [ + "parameterKey", + "from" + ], + "properties": { + "from": { + "type": "string" + }, + "parameterKey": { + "type": "string" + } + } + }, + "common.outputItem": { + "required": [ + "valueFrom", + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "valueFrom": { + "type": "string" + } + } + }, + "condition.Condition": { + "required": [ + "type", + "status", + "lastTransitionTime", + "reason" + ], + "properties": { + "lastTransitionTime": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "status": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "condition.ConditionedStatus": { + "properties": { + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/condition.Condition" + } + } + } + }, + "map[string]string": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "model.ApplicationComponentPlan": { + "required": [ + "createTime", + "updateTime", + "appPrimaryKey", + "creator", + "name", + "alias", + "type" + ], + "properties": { + "alias": { + "type": "string" + }, + "appPrimaryKey": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "creator": { + "type": "string" + }, + "dependsOn": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "externalRevision": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "inputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.inputItem" + } + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "outputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.outputItem" + } + }, + "properties": { + "$ref": "#/definitions/model.JSONStruct" + }, + "scopes": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "traits": { + "type": "array", + "items": { + "$ref": "#/definitions/model.ApplicationTraitPlan" + } + }, + "type": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "model.ApplicationTraitPlan": { + "required": [ + "type" + ], + "properties": { + "properties": { + "$ref": "#/definitions/model.JSONStruct" + }, + "type": { + "type": "string" + } + } + }, + "model.Cluster": { + "required": [ + "createTime", + "updateTime", + "name", + "alias", + "description", + "icon", + "labels", + "status", + "reason", + "provider", + "apiServerURL", + "dashboardURL", + "kubeConfig", + "kubeConfigSecret" + ], + "properties": { + "alias": { + "type": "string" + }, + "apiServerURL": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "dashboardURL": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "kubeConfig": { + "type": "string" + }, + "kubeConfigSecret": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "provider": { + "$ref": "#/definitions/model.ProviderInfo" + }, + "reason": { + "type": "string" + }, + "status": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "model.GitAddonSource": { + "properties": { + "path": { + "type": "string" + }, + "token": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "model.JSONStruct": { + "type": "object" + }, + "model.Model": { + "required": [ + "createTime", + "updateTime" + ], + "properties": { + "createTime": { + "type": "string", + "format": "date-time" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "model.ProviderInfo": { + "required": [ + "provider", + "name", + "id", + "zone", + "labels" + ], + "properties": { + "id": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "zone": { + "type": "string" + } + } + }, + "types.Parameter": { + "required": [ + "name" + ], + "properties": { + "alias": { + "type": "string" + }, + "default": { + "$ref": "#/definitions/types.Parameter.default" + }, + "ignore": { + "type": "boolean" + }, + "jsonType": { + "type": "string" + }, + "name": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "short": { + "type": "string" + }, + "type": { + "type": "integer", + "format": "int32" + }, + "usage": { + "type": "string" + } + } + }, + "types.Parameter.default": {}, + "utils.Option": { + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/utils.Option.value" + } + } + }, + "utils.Option.value": {}, + "utils.UIParameter": { + "required": [ + "sort", + "label", + "description", + "jsonKey", + "uiType" + ], + "properties": { + "description": { + "type": "string" + }, + "disable": { + "type": "boolean" + }, + "jsonKey": { + "type": "string" + }, + "label": { + "type": "string" + }, + "sort": { + "type": "integer", + "format": "integer" + }, + "subParameterGroupOption": { + "type": "array", + "items": { + "$ref": "#/definitions/utils.UIParameter.subParameterGroupOption" + } + }, + "subParameters": { + "type": "array", + "items": { + "$ref": "#/definitions/utils.UIParameter" + } + }, + "uiType": { + "type": "string" + }, + "validate": { + "$ref": "#/definitions/utils.Validate" + } + } + }, + "utils.Validate": { + "properties": { + "defaultValue": { + "$ref": "#/definitions/utils.Validate.defaultValue" + }, + "max": { + "type": "number", + "format": "double" + }, + "maxLength": { + "type": "integer", + "format": "integer" + }, + "min": { + "type": "number", + "format": "double" + }, + "minLength": { + "type": "integer", + "format": "integer" + }, + "options": { + "type": "array", + "items": { + "$ref": "#/definitions/utils.Option" + } + }, + "pattern": { + "type": "string" + }, + "required": { + "type": "boolean" + } + } + }, + "utils.Validate.defaultValue": {}, + "v1.AccessKeyRequest": { + "required": [ + "accessKeyID", + "accessKeySecret" + ], + "properties": { + "accessKeyID": { + "type": "string" + }, + "accessKeySecret": { + "type": "string" + } + } + }, + "v1.AddonDependency": { + "properties": { + "name": { + "type": "string" + } + } + }, + "v1.AddonDeployTo": { + "required": [ + "control_plane", + "runtime_cluster" + ], + "properties": { + "control_plane": { + "type": "boolean" + }, + "runtime_cluster": { + "type": "boolean" + } + } + }, + "v1.AddonElementFile": { + "required": [ + "Data", + "Name", + "Path" + ], + "properties": { + "Data": { + "type": "string" + }, + "Name": { + "type": "string" + }, + "Path": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "v1.AddonMeta": { + "required": [ + "name", + "version", + "description", + "icon" + ], + "properties": { + "dependencies": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.AddonDependency" + } + }, + "deploy_to": { + "$ref": "#/definitions/v1.AddonDeployTo" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "v1.AddonRegistryMeta": { + "required": [ + "name" + ], + "properties": { + "git": { + "$ref": "#/definitions/model.GitAddonSource" + }, + "name": { + "type": "string" + } + } + }, + "v1.AddonStatusResponse": { + "required": [ + "phase" + ], + "properties": { + "enabling_progress": { + "$ref": "#/definitions/v1.EnablingProgress" + }, + "phase": { + "type": "string" + } + } + }, + "v1.ApplicationDeployRequest": { + "required": [ + "workflowName", + "commit", + "sourceType", + "force" + ], + "properties": { + "commit": { + "type": "string" + }, + "force": { + "type": "boolean" + }, + "sourceType": { + "type": "string" + }, + "workflowName": { + "type": "string" + } + } + }, + "v1.ApplicationDeployResponse": { + "required": [ + "version", + "status", + "reason", + "deployUser", + "commit", + "sourceType" + ], + "properties": { + "commit": { + "type": "string" + }, + "deployUser": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "sourceType": { + "type": "string" + }, + "status": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "v1.ApplicationPlanBase": { + "required": [ + "name", + "alias", + "namespace", + "description", + "createTime", + "updateTime", + "icon", + "status", + "gatewayRule" + ], + "properties": { + "alias": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + }, + "envBind": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.EnvBind" + } + }, + "gatewayRule": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.GatewayRule" + } + }, + "icon": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "status": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.ApplicationRequest": { + "required": [ + "components" + ], + "properties": { + "components": { + "type": "array", + "items": { + "$ref": "#/definitions/common.ApplicationComponent" + } + }, + "policies": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1.AppPolicy" + } + }, + "workflow": { + "$ref": "#/definitions/v1beta1.Workflow" + } + } + }, + "v1.ApplicationResourceInfo": { + "required": [ + "componentNum" + ], + "properties": { + "componentNum": { + "type": "integer", + "format": "int32" + } + } + }, + "v1.ApplicationResponse": { + "required": [ + "apiVersion", + "kind", + "spec", + "status" + ], + "properties": { + "apiVersion": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "spec": { + "$ref": "#/definitions/v1beta1.ApplicationSpec" + }, + "status": { + "$ref": "#/definitions/common.AppStatus" + } + } + }, + "v1.ApplicationTemplateBase": { + "required": [ + "templateName", + "createTime", + "updateTime" + ], + "properties": { + "createTime": { + "type": "string", + "format": "date-time" + }, + "templateName": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + }, + "versions": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.ApplicationTemplateVersion" + } + } + } + }, + "v1.ApplicationTemplateVersion": { + "required": [ + "version", + "description", + "createUser", + "createTime", + "updateTime" + ], + "properties": { + "createTime": { + "type": "string", + "format": "date-time" + }, + "createUser": { + "type": "string" + }, + "description": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "string" + } + } + }, + "v1.ClusterBase": { + "required": [ + "name", + "alias", + "description", + "icon", + "labels", + "providerInfo", + "apiServerURL", + "dashboardURL", + "status", + "reason" + ], + "properties": { + "alias": { + "type": "string" + }, + "apiServerURL": { + "type": "string" + }, + "dashboardURL": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "providerInfo": { + "$ref": "#/definitions/model.ProviderInfo" + }, + "reason": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "v1.ClusterResourceInfo": { + "required": [ + "workerNumber", + "masterNumber", + "memoryCapacity", + "cpuCapacity", + "podCapacity", + "memoryUsed", + "cpuUsed", + "podUsed" + ], + "properties": { + "cpuCapacity": { + "type": "integer", + "format": "int64" + }, + "cpuUsed": { + "type": "integer", + "format": "int64" + }, + "gpuCapacity": { + "type": "integer", + "format": "int64" + }, + "gpuUsed": { + "type": "integer", + "format": "int64" + }, + "masterNumber": { + "type": "integer", + "format": "int32" + }, + "memoryCapacity": { + "type": "integer", + "format": "int64" + }, + "memoryUsed": { + "type": "integer", + "format": "int64" + }, + "podCapacity": { + "type": "integer", + "format": "int64" + }, + "podUsed": { + "type": "integer", + "format": "int64" + }, + "storageClassList": { + "type": "array", + "items": { + "type": "string" + } + }, + "workerNumber": { + "type": "integer", + "format": "int32" + } + } + }, + "v1.ClusterSelector": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + } + } + }, + "v1.ComponentPlanBase": { + "required": [ + "name", + "alias", + "description", + "componentType", + "envNames", + "dependsOn", + "deployVersion", + "createTime", + "updateTime" + ], + "properties": { + "alias": { + "type": "string" + }, + "componentType": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "creator": { + "type": "string" + }, + "dependsOn": { + "type": "array", + "items": { + "type": "string" + } + }, + "deployVersion": { + "type": "string" + }, + "description": { + "type": "string" + }, + "envNames": { + "type": "array", + "items": { + "type": "string" + } + }, + "icon": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.ComponentPlanListResponse": { + "required": [ + "componentplans" + ], + "properties": { + "componentplans": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.ComponentPlanBase" + } + } + } + }, + "v1.ComponentSelector": { + "required": [ + "components" + ], + "properties": { + "components": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "v1.ConnectCloudClusterRequest": { + "required": [ + "accessKeyID", + "accessKeySecret", + "clusterID", + "name", + "alias", + "icon" + ], + "properties": { + "accessKeyID": { + "type": "string" + }, + "accessKeySecret": { + "type": "string" + }, + "alias": { + "type": "string" + }, + "clusterID": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + } + } + }, + "v1.CreateAddonRegistryRequest": { + "required": [ + "name" + ], + "properties": { + "git": { + "$ref": "#/definitions/model.GitAddonSource" + }, + "name": { + "type": "string" + } + } + }, + "v1.CreateApplicationEnvPlanRequest": { + "required": [ + "name", + "alias", + "clusterSelector", + "componentSelector" + ], + "properties": { + "alias": { + "type": "string" + }, + "clusterSelector": { + "$ref": "#/definitions/v1.ClusterSelector" + }, + "componentSelector": { + "$ref": "#/definitions/v1.ComponentSelector" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "v1.CreateApplicationPlanRequest": { + "required": [ + "name", + "alias", + "namespace", + "description", + "icon" + ], + "properties": { + "alias": { + "type": "string" + }, + "deploy": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "envBind": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.EnvBind" + } + }, + "icon": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "yamlConfig": { + "type": "string" + } + } + }, + "v1.CreateApplicationTemplateRequest": { + "required": [ + "templateName", + "version", + "description" + ], + "properties": { + "description": { + "type": "string" + }, + "templateName": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "v1.CreateCloudClusterRequest": { + "required": [ + "accessKeyID", + "accessKeySecret", + "name", + "zone", + "workerNumber", + "cpuCoresPerWorker", + "memoryPerWorker" + ], + "properties": { + "accessKeyID": { + "type": "string" + }, + "accessKeySecret": { + "type": "string" + }, + "cpuCoresPerWorker": { + "type": "integer", + "format": "int64" + }, + "memoryPerWorker": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "workerNumber": { + "type": "integer", + "format": "int32" + }, + "zone": { + "type": "string" + } + } + }, + "v1.CreateCloudClusterResponse": { + "required": [ + "clusterID", + "status" + ], + "properties": { + "clusterID": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "v1.CreateClusterRequest": { + "required": [ + "name", + "alias", + "icon" + ], + "properties": { + "alias": { + "type": "string" + }, + "dashboardURL": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "kubeConfig": { + "type": "string" + }, + "kubeConfigSecret": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + } + } + }, + "v1.CreateComponentPlanRequest": { + "required": [ + "name", + "alias", + "description", + "icon", + "componentType", + "dependsOn" + ], + "properties": { + "alias": { + "type": "string" + }, + "componentType": { + "type": "string" + }, + "dependsOn": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "envNames": { + "type": "array", + "items": { + "type": "string" + } + }, + "icon": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "properties": { + "type": "string" + } + } + }, + "v1.CreateNamespaceRequest": { + "required": [ + "name", + "description" + ], + "properties": { + "description": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "v1.CreatePolicyRequest": { + "required": [ + "name", + "description", + "type", + "properties" + ], + "properties": { + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "properties": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "v1.CreateWorkflowPlanRequest": { + "required": [ + "appName", + "name", + "alias", + "description", + "enable", + "default" + ], + "properties": { + "alias": { + "type": "string" + }, + "appName": { + "type": "string" + }, + "default": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "enable": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.WorkflowStep" + } + } + } + }, + "v1.Definition": { + "required": [ + "kind", + "name", + "description" + ], + "properties": { + "description": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "v1.DefinitionBase": { + "required": [ + "name", + "description", + "icon" + ], + "properties": { + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "v1.DetailAddonResponse": { + "required": [ + "icon", + "name", + "version", + "description", + "definitions", + "parameters", + "cue_templates" + ], + "properties": { + "cue_templates": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.AddonElementFile" + } + }, + "definitions": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.Definition" + } + }, + "dependencies": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.AddonDependency" + } + }, + "deploy_to": { + "$ref": "#/definitions/v1.AddonDeployTo" + }, + "description": { + "type": "string" + }, + "detail": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parameters": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string" + }, + "version": { + "type": "string" + }, + "yaml_templates": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.AddonElementFile" + } + } + } + }, + "v1.DetailApplicationPlanResponse": { + "required": [ + "updateTime", + "icon", + "status", + "name", + "alias", + "description", + "createTime", + "namespace", + "gatewayRule", + "policies", + "status", + "resourceInfo", + "workflowStatus" + ], + "properties": { + "alias": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + }, + "envBind": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.EnvBind" + } + }, + "gatewayRule": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.GatewayRule" + } + }, + "icon": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "policies": { + "type": "array", + "items": { + "type": "string" + } + }, + "resourceInfo": { + "$ref": "#/definitions/v1.ApplicationResourceInfo" + }, + "status": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + }, + "workflowStatus": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.WorkflowStepStatus" + } + } + } + }, + "v1.DetailClusterResponse": { + "required": [ + "createTime", + "icon", + "labels", + "reason", + "description", + "status", + "dashboardURL", + "name", + "apiServerURL", + "kubeConfigSecret", + "updateTime", + "alias", + "provider", + "kubeConfig", + "resourceInfo" + ], + "properties": { + "alias": { + "type": "string" + }, + "apiServerURL": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "dashboardURL": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "kubeConfig": { + "type": "string" + }, + "kubeConfigSecret": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "provider": { + "$ref": "#/definitions/model.ProviderInfo" + }, + "reason": { + "type": "string" + }, + "resourceInfo": { + "$ref": "#/definitions/v1.ClusterResourceInfo" + }, + "status": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.DetailComponentPlanResponse": { + "required": [ + "appPrimaryKey", + "updateTime", + "name", + "creator", + "type", + "createTime", + "alias" + ], + "properties": { + "alias": { + "type": "string" + }, + "appPrimaryKey": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "creator": { + "type": "string" + }, + "dependsOn": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "externalRevision": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "inputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.inputItem" + } + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "outputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.outputItem" + } + }, + "properties": { + "$ref": "#/definitions/model.JSONStruct" + }, + "scopes": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "traits": { + "type": "array", + "items": { + "$ref": "#/definitions/model.ApplicationTraitPlan" + } + }, + "type": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.DetailDefinitionResponse": { + "required": [ + "schema", + "uiSchema" + ], + "properties": { + "schema": { + "type": "string" + }, + "uiSchema": { + "type": "array", + "items": { + "$ref": "#/definitions/utils.UIParameter" + } + } + } + }, + "v1.DetailPolicyResponse": { + "required": [ + "name", + "type", + "description", + "creator", + "properties", + "createTime", + "updateTime" + ], + "properties": { + "createTime": { + "type": "string", + "format": "date-time" + }, + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "properties": { + "$ref": "#/definitions/model.JSONStruct" + }, + "type": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.DetailWorkflowPlanResponse": { + "required": [ + "description", + "enable", + "default", + "createTime", + "updateTime", + "name", + "alias", + "workflowRecord" + ], + "properties": { + "alias": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "default": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "enable": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.WorkflowStep" + } + }, + "updateTime": { + "type": "string", + "format": "date-time" + }, + "workflowRecord": { + "$ref": "#/definitions/v1.WorkflowRecord" + } + } + }, + "v1.DetailWorkflowRecordResponse": { + "required": [ + "name", + "namespace", + "suspend", + "terminated", + "deployTime", + "deployUser", + "commit", + "sourceType" + ], + "properties": { + "commit": { + "type": "string" + }, + "deployTime": { + "type": "string", + "format": "date-time" + }, + "deployUser": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "sourceType": { + "type": "string" + }, + "startTime": { + "type": "string", + "format": "date-time" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/common.WorkflowStepStatus" + } + }, + "suspend": { + "type": "boolean" + }, + "terminated": { + "type": "boolean" + } + } + }, + "v1.EmptyResponse": {}, + "v1.EnableAddonRequest": { + "properties": { + "args": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "v1.EnablingProgress": { + "required": [ + "enabled_components", + "total_components" + ], + "properties": { + "enabled_components": { + "type": "integer", + "format": "int32" + }, + "total_components": { + "type": "integer", + "format": "int32" + } + } + }, + "v1.EnvBind": { + "required": [ + "name", + "alias", + "clusterSelector", + "componentSelector" + ], + "properties": { + "alias": { + "type": "string" + }, + "clusterSelector": { + "$ref": "#/definitions/v1.ClusterSelector" + }, + "componentSelector": { + "$ref": "#/definitions/v1.ComponentSelector" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "v1.GatewayRule": { + "required": [ + "ruleType", + "address", + "protocol", + "componentName", + "componentPort" + ], + "properties": { + "address": { + "type": "string" + }, + "componentName": { + "type": "string" + }, + "componentPort": { + "type": "integer", + "format": "int32" + }, + "protocol": { + "type": "string" + }, + "ruleType": { + "type": "string" + } + } + }, + "v1.ListAddonRegistryResponse": { + "required": [ + "registrys" + ], + "properties": { + "registrys": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.AddonRegistryMeta" + } + } + } + }, + "v1.ListAddonResponse": { + "required": [ + "addons" + ], + "properties": { + "addons": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.AddonMeta" + } + } + } + }, + "v1.ListApplicationPlanResponse": { + "required": [ + "applicationplans" + ], + "properties": { + "applicationplans": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.ApplicationPlanBase" + } + } + } + }, + "v1.ListApplicationPolicy": { + "required": [ + "policies" + ], + "properties": { + "policies": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.PolicyBase" + } + } + } + }, + "v1.ListCloudClusterCreationResponse": { + "required": [ + "creations" + ], + "properties": { + "creations": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "v1.ListCloudClusterResponse": { + "required": [ + "clusters", + "total" + ], + "properties": { + "clusters": { + "type": "array", + "items": { + "$ref": "#/definitions/cloudprovider.CloudCluster" + } + }, + "total": { + "type": "integer", + "format": "int32" + } + } + }, + "v1.ListClusterResponse": { + "required": [ + "clusters" + ], + "properties": { + "clusters": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.ClusterBase" + } + } + } + }, + "v1.ListDefinitionResponse": { + "required": [ + "definitions" + ], + "properties": { + "definitions": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.DefinitionBase" + } + } + } + }, + "v1.ListNamespaceResponse": { + "required": [ + "namespaces" + ], + "properties": { + "namespaces": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.NamespaceBase" + } + } + } + }, + "v1.ListPolicyDefinitionResponse": { + "required": [ + "policyDefinitions" + ], + "properties": { + "policyDefinitions": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.PolicyDefinition" + } + } + } + }, + "v1.ListWorkflowPlanResponse": { + "required": [ + "workflowplans" + ], + "properties": { + "workflowplans": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.WorkflowPlanBase" + } + } + } + }, + "v1.ListWorkflowRecordsResponse": { + "required": [ + "records", + "total" + ], + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.WorkflowRecord" + } + }, + "total": { + "type": "integer", + "format": "int64" + } + } + }, + "v1.NamespaceBase": { + "required": [ + "name", + "description", + "createTime", + "updateTime" + ], + "properties": { + "createTime": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.NamespaceDetailResponse": { + "required": [ + "updateTime", + "name", + "description", + "createTime" + ], + "properties": { + "createTime": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.ObjectReference": { + "description": "ObjectReference contains enough information to let you inspect or modify the referred object.", + "properties": { + "apiVersion": { + "description": "API version of the referent.", + "type": "string" + }, + "fieldPath": { + "description": "If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.", + "type": "string" + }, + "kind": { + "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + }, + "namespace": { + "description": "Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", + "type": "string" + }, + "resourceVersion": { + "description": "Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", + "type": "string" + }, + "uid": { + "description": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids", + "type": "string" + } + } + }, + "v1.PolicyBase": { + "required": [ + "name", + "type", + "description", + "creator", + "properties", + "createTime", + "updateTime" + ], + "properties": { + "createTime": { + "type": "string", + "format": "date-time" + }, + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "properties": { + "$ref": "#/definitions/model.JSONStruct" + }, + "type": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.PolicyDefinition": { + "required": [ + "name", + "description", + "parameters" + ], + "properties": { + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parameters": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Parameter" + } + } + } + }, + "v1.PutApplicationPlanEnvRequest": { + "properties": { + "alias": { + "type": "string" + }, + "clusterSelector": { + "$ref": "#/definitions/v1.ClusterSelector" + }, + "componentSelector": { + "$ref": "#/definitions/v1.ComponentSelector" + }, + "description": { + "type": "string" + } + } + }, + "v1.UpdateApplicationPlanRequest": { + "required": [ + "alias", + "description", + "icon" + ], + "properties": { + "alias": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "v1.UpdatePolicyRequest": { + "required": [ + "description", + "type", + "properties" + ], + "properties": { + "description": { + "type": "string" + }, + "properties": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "v1.UpdateWorkflowPlanRequest": { + "required": [ + "alias", + "description", + "enable", + "default" + ], + "properties": { + "alias": { + "type": "string" + }, + "default": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "enable": { + "type": "boolean" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.WorkflowStep" + } + } + } + }, + "v1.VelaQLViewResponse": { + "type": "object" + }, + "v1.WorkflowPlanBase": { + "required": [ + "name", + "alias", + "description", + "enable", + "default", + "createTime", + "updateTime" + ], + "properties": { + "alias": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "default": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "enable": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "updateTime": { + "type": "string", + "format": "date-time" + } + } + }, + "v1.WorkflowRecord": { + "required": [ + "name", + "namespace", + "suspend", + "terminated" + ], + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "startTime": { + "type": "string", + "format": "date-time" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/common.WorkflowStepStatus" + } + }, + "suspend": { + "type": "boolean" + }, + "terminated": { + "type": "boolean" + } + } + }, + "v1.WorkflowStep": { + "required": [ + "name", + "alias", + "type", + "description", + "dependsOn" + ], + "properties": { + "alias": { + "type": "string" + }, + "dependsOn": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "inputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.inputItem" + } + }, + "name": { + "type": "string" + }, + "outputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.outputItem" + } + }, + "properties": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "v1.WorkflowStepStatus": { + "required": [ + "name", + "status", + "takeTime" + ], + "properties": { + "name": { + "type": "string" + }, + "status": { + "type": "string" + }, + "takeTime": { + "type": "integer", + "format": "integer" + } + } + }, + "v1alpha1.CanaryMetric": { + "required": [ + "name" + ], + "properties": { + "interval": { + "type": "string" + }, + "metricsRange": { + "$ref": "#/definitions/v1alpha1.MetricsExpectedRange" + }, + "name": { + "type": "string" + }, + "templateRef": { + "$ref": "#/definitions/v1.ObjectReference" + } + } + }, + "v1alpha1.MetricsExpectedRange": { + "properties": { + "max": { + "type": "string" + }, + "min": { + "type": "string" + } + } + }, + "v1alpha1.RolloutBatch": { + "properties": { + "batchRolloutWebhooks": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha1.RolloutWebhook" + } + }, + "canaryMetric": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha1.CanaryMetric" + } + }, + "instanceInterval": { + "type": "integer", + "format": "int32" + }, + "maxUnavailable": { + "type": "string" + }, + "podList": { + "type": "array", + "items": { + "type": "string" + } + }, + "replicas": { + "type": "string" + } + } + }, + "v1alpha1.RolloutPlan": { + "properties": { + "batchPartition": { + "type": "integer", + "format": "int32" + }, + "canaryMetric": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha1.CanaryMetric" + } + }, + "numBatches": { + "type": "integer", + "format": "int32" + }, + "paused": { + "type": "boolean" + }, + "rolloutBatches": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha1.RolloutBatch" + } + }, + "rolloutStrategy": { + "type": "string" + }, + "rolloutWebhooks": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha1.RolloutWebhook" + } + }, + "targetSize": { + "type": "integer", + "format": "int32" + } + } + }, + "v1alpha1.RolloutStatus": { + "required": [ + "rollingState", + "batchRollingState", + "currentBatch", + "upgradedReplicas", + "upgradedReadyReplicas" + ], + "properties": { + "batchRollingState": { + "type": "string" + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/condition.Condition" + } + }, + "currentBatch": { + "type": "integer", + "format": "int32" + }, + "lastAppliedPodTemplateIdentifier": { + "type": "string" + }, + "rollingState": { + "type": "string" + }, + "rolloutOriginalSize": { + "type": "integer", + "format": "int32" + }, + "rolloutTargetSize": { + "type": "integer", + "format": "int32" + }, + "targetGeneration": { + "type": "string" + }, + "upgradedReadyReplicas": { + "type": "integer", + "format": "int32" + }, + "upgradedReplicas": { + "type": "integer", + "format": "int32" + } + } + }, + "v1alpha1.RolloutWebhook": { + "required": [ + "type", + "name", + "url" + ], + "properties": { + "expectedStatus": { + "type": "array", + "items": { + "type": "integer" + } + }, + "metadata": { + "$ref": "#/definitions/v1alpha1.RolloutWebhook.metadata" + }, + "method": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "v1alpha1.RolloutWebhook.metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "v1beta1.AppPolicy": { + "required": [ + "name", + "type" + ], + "properties": { + "name": { + "type": "string" + }, + "properties": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "v1beta1.ApplicationSpec": { + "required": [ + "components" + ], + "properties": { + "components": { + "type": "array", + "items": { + "$ref": "#/definitions/common.ApplicationComponent" + } + }, + "policies": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1.AppPolicy" + } + }, + "rolloutPlan": { + "$ref": "#/definitions/v1alpha1.RolloutPlan" + }, + "workflow": { + "$ref": "#/definitions/v1beta1.Workflow" + } + } + }, + "v1beta1.Workflow": { + "properties": { + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1.WorkflowStep" + } + } + } + }, + "v1beta1.WorkflowStep": { + "required": [ + "name", + "type" + ], + "properties": { + "dependsOn": { + "type": "array", + "items": { + "type": "string" + } + }, + "inputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.inputItem" + } + }, + "name": { + "type": "string" + }, + "outputs": { + "type": "array", + "items": { + "$ref": "#/definitions/common.outputItem" + } + }, + "properties": { + "type": "string" + }, + "type": { + "type": "string" + } + } + } + } } \ No newline at end of file diff --git a/pkg/apiserver/rest/apis/v1/types.go b/pkg/apiserver/rest/apis/v1/types.go index 96a895c5f..f14a4acb7 100644 --- a/pkg/apiserver/rest/apis/v1/types.go +++ b/pkg/apiserver/rest/apis/v1/types.go @@ -20,9 +20,11 @@ import ( "time" "github.com/getkin/kin-openapi/openapi3" + "github.com/oam-dev/kubevela/apis/core.oam.dev/common" "github.com/oam-dev/kubevela/apis/types" "github.com/oam-dev/kubevela/pkg/apiserver/model" + "github.com/oam-dev/kubevela/pkg/apiserver/rest/utils" "github.com/oam-dev/kubevela/pkg/cloudprovider" ) @@ -467,7 +469,8 @@ type ListDefinitionResponse struct { // DetailDefinitionResponse get definition detail type DetailDefinitionResponse struct { - Schema *openapi3.Schema `json:"schema"` + APISchema *openapi3.Schema `json:"schema"` + UISchema []*utils.UIParameter `json:"uiSchema"` } // DefinitionBase is the definition base model @@ -556,12 +559,14 @@ type UpdateWorkflowPlanRequest struct { // WorkflowStep workflow step config type WorkflowStep struct { // Name is the unique name of the workflow step. - Name string `json:"name" validate:"checkname"` - Type string `json:"type" validate:"checkname"` - DependsOn []string `json:"dependsOn"` - Properties string `json:"properties,omitempty"` - Inputs common.StepInputs `json:"inputs,omitempty"` - Outputs common.StepOutputs `json:"outputs,omitempty"` + Name string `json:"name" validate:"checkname"` + Alias string `json:"alias" validate:"checkalias"` + Type string `json:"type" validate:"checkname"` + Description string `json:"description"` + DependsOn []string `json:"dependsOn"` + Properties string `json:"properties,omitempty"` + Inputs common.StepInputs `json:"inputs,omitempty"` + Outputs common.StepOutputs `json:"outputs,omitempty"` } // DetailWorkflowPlanResponse detail workflow response diff --git a/pkg/apiserver/rest/rest_server.go b/pkg/apiserver/rest/rest_server.go index 0203fb7b1..8ee324af0 100644 --- a/pkg/apiserver/rest/rest_server.go +++ b/pkg/apiserver/rest/rest_server.go @@ -48,6 +48,7 @@ type Config struct { // APIServer interface for call api server type APIServer interface { Run(context.Context) error + RegisterServices() restfulspec.Config } type restServer struct { @@ -83,16 +84,13 @@ func New(cfg Config) (a APIServer, err error) { } func (s *restServer) Run(ctx context.Context) error { - webservice.Init(ctx, s.dataStore) - err := s.registerServices() - if err != nil { - return err - } + s.RegisterServices() return s.startHTTP(ctx) } -func (s *restServer) registerServices() error { - +// RegisterServices register web service +func (s *restServer) RegisterServices() restfulspec.Config { + webservice.Init(s.dataStore) /* ************************************************************** */ /* ************* Open API Route Group ***************** */ /* ************************************************************** */ @@ -119,7 +117,7 @@ func (s *restServer) registerServices() error { APIPath: "/apidocs.json", PostBuildSwaggerObjectHandler: enrichSwaggerObject} s.webContainer.Add(restfulspec.NewOpenAPIService(config)) - return nil + return config } func enrichSwaggerObject(swo *spec.Swagger) { diff --git a/pkg/apiserver/rest/usecase/addon.go b/pkg/apiserver/rest/usecase/addon.go index 64ad60db1..d12682a11 100644 --- a/pkg/apiserver/rest/usecase/addon.go +++ b/pkg/apiserver/rest/usecase/addon.go @@ -30,8 +30,6 @@ import ( "github.com/oam-dev/kubevela/pkg/apiserver/log" "github.com/oam-dev/kubevela/pkg/apiserver/model" apis "github.com/oam-dev/kubevela/pkg/apiserver/rest/apis/v1" - restapis "github.com/oam-dev/kubevela/pkg/apiserver/rest/apis/v1" - restutils "github.com/oam-dev/kubevela/pkg/apiserver/rest/utils" "github.com/oam-dev/kubevela/pkg/apiserver/rest/utils/bcode" cuemodel "github.com/oam-dev/kubevela/pkg/cue/model" "github.com/oam-dev/kubevela/pkg/cue/model/value" @@ -107,7 +105,7 @@ func (u *addonUsecaseImpl) StatusAddon(name string) (*apis.AddonStatusResponse, var app v1beta1.Application err := u.kubeClient.Get(context.Background(), client.ObjectKey{ Namespace: types.DefaultKubeVelaNS, - Name: restutils.AddonName2AppName(name), + Name: AddonName2AppName(name), }, &app) if err != nil { if errors2.IsNotFound(err) { @@ -206,19 +204,19 @@ func (u *addonUsecaseImpl) ListAddonRegistries(ctx context.Context) ([]*apis.Add } var list []*apis.AddonRegistryMeta for _, entity := range entities { - list = append(list, restutils.ConvertAddonRegistryModel2AddonRegistryMeta(entity.(*model.AddonRegistry))) + list = append(list, ConvertAddonRegistryModel2AddonRegistryMeta(entity.(*model.AddonRegistry))) } return list, nil } -func renderApplication(addon *restapis.DetailAddonResponse, args *apis.EnableAddonRequest) (*v1beta1.Application, error) { +func renderApplication(addon *apis.DetailAddonResponse, args *apis.EnableAddonRequest) (*v1beta1.Application, error) { if args == nil { args = &apis.EnableAddonRequest{Args: map[string]string{}} } app := &v1beta1.Application{ TypeMeta: metav1.TypeMeta{APIVersion: "core.oam.dev/v1beta1", Kind: "Application"}, ObjectMeta: metav1.ObjectMeta{ - Name: restutils.AddonName2AppName(addon.Name), + Name: AddonName2AppName(addon.Name), Namespace: types.DefaultKubeVelaNS, Labels: map[string]string{ oam.LabelAddonName: addon.Name, @@ -294,7 +292,7 @@ func (u *addonUsecaseImpl) DisableAddon(ctx context.Context, name string) error app := &v1beta1.Application{ TypeMeta: metav1.TypeMeta{APIVersion: "core.oam.dev/v1beta1", Kind: "Application"}, ObjectMeta: metav1.ObjectMeta{ - Name: restutils.AddonName2AppName(name), + Name: AddonName2AppName(name), Namespace: types.DefaultKubeVelaNS, }, } @@ -316,7 +314,7 @@ func renderRawComponent(elem apis.AddonElementFile) (*common2.ApplicationCompone dec := k8syaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme) _, _, err := dec.Decode([]byte(elem.Data), nil, obj) if err != nil { - fmt.Println(err) + return nil, err } baseRawComponent.Properties = util.Object2RawExtension(obj) return &baseRawComponent, nil @@ -559,3 +557,23 @@ func readRepo(h *gitHelper) ([]*github.RepositoryContent, error) { } return dirs, nil } + +// ConvertAddonRegistryModel2AddonRegistryMeta will convert from model to AddonRegistryMeta +func ConvertAddonRegistryModel2AddonRegistryMeta(r *model.AddonRegistry) *apis.AddonRegistryMeta { + return &apis.AddonRegistryMeta{ + Name: r.Name, + Git: r.Git, + } +} + +const addonAppPrefix = "addon-" + +// AddonName2AppName - +func AddonName2AppName(name string) string { + return addonAppPrefix + name +} + +// AppName2addonName - +func AppName2addonName(name string) string { + return strings.TrimPrefix(name, addonAppPrefix) +} diff --git a/pkg/apiserver/rest/usecase/definition.go b/pkg/apiserver/rest/usecase/definition.go index 9b1c1707d..bd32c48eb 100644 --- a/pkg/apiserver/rest/usecase/definition.go +++ b/pkg/apiserver/rest/usecase/definition.go @@ -18,20 +18,26 @@ package usecase import ( "context" + "encoding/json" "fmt" + "sort" "time" + "github.com/getkin/kin-openapi/openapi3" v1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" k8stypes "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/yaml" - "github.com/getkin/kin-openapi/openapi3" "github.com/oam-dev/kubevela/apis/types" "github.com/oam-dev/kubevela/pkg/apiserver/clients" "github.com/oam-dev/kubevela/pkg/apiserver/log" apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/rest/apis/v1" "github.com/oam-dev/kubevela/pkg/apiserver/rest/utils" + "github.com/oam-dev/kubevela/pkg/apiserver/rest/utils/bcode" ) // DefinitionUsecase definition usecase, Implement the management of ComponentDefinition、TraitDefinition and WorkflowStepDefinition. @@ -40,6 +46,8 @@ type DefinitionUsecase interface { ListDefinitions(ctx context.Context, envName, defType string) ([]*apisv1.DefinitionBase, error) // DetailDefinition get definition detail DetailDefinition(ctx context.Context, name, defType string) (*apisv1.DetailDefinitionResponse, error) + // AddDefinitionUISchema add or update custom definition ui schema + AddDefinitionUISchema(ctx context.Context, name, defType, configRaw string) ([]*utils.UIParameter, error) } type definitionUsecaseImpl struct { @@ -82,7 +90,7 @@ func (d *definitionUsecaseImpl) ListDefinitions(ctx context.Context, envName, de return d.listDefinitions(ctx, defs, kindWorkflowStepDefinition) default: - return nil, fmt.Errorf("invalid definition type") + return nil, bcode.ErrDefinitionTypeNotSupport } } @@ -108,23 +116,184 @@ func (d *definitionUsecaseImpl) listDefinitions(ctx context.Context, list *unstr // DetailDefinition get definition detail func (d *definitionUsecaseImpl) DetailDefinition(ctx context.Context, name, defType string) (*apisv1.DetailDefinitionResponse, error) { + if !utils.StringsContain([]string{"component", "trait", "workflowstep"}, defType) { + return nil, bcode.ErrDefinitionTypeNotSupport + } var cm v1.ConfigMap if err := d.kubeClient.Get(ctx, k8stypes.NamespacedName{ Namespace: types.DefaultKubeVelaNS, Name: fmt.Sprintf("%s-schema-%s", defType, name), }, &cm); err != nil { + if apierrors.IsNotFound(err) { + return nil, bcode.ErrDefinitionNoSchema + } return nil, err } - data, ok := cm.Data["openapi-v3-json-schema"] + data, ok := cm.Data[types.OpenapiV3JSONSchema] if !ok { - return nil, fmt.Errorf("failed to get definition schema") + return nil, bcode.ErrDefinitionNoSchema } schema := &openapi3.Schema{} if err := schema.UnmarshalJSON([]byte(data)); err != nil { return nil, err } + // render default ui schema + defaultUISchema := renderDefaultUISchema(schema) + // patch from custom ui schema + customUISchema := d.renderCustomUISchema(ctx, name, defType, defaultUISchema) return &apisv1.DetailDefinitionResponse{ - Schema: schema, + APISchema: schema, + UISchema: customUISchema, }, nil } + +func (d *definitionUsecaseImpl) renderCustomUISchema(ctx context.Context, name, defType string, defaultSchema []*utils.UIParameter) []*utils.UIParameter { + var cm v1.ConfigMap + if err := d.kubeClient.Get(ctx, k8stypes.NamespacedName{ + Namespace: types.DefaultKubeVelaNS, + Name: fmt.Sprintf("%s-uischema-%s", defType, name), + }, &cm); err != nil { + if !apierrors.IsNotFound(err) { + log.Logger.Errorf("find uischema configmap from cluster failure %s", err.Error()) + } + return defaultSchema + } + data, ok := cm.Data[types.UISchema] + if !ok { + return defaultSchema + } + schema := []*utils.UIParameter{} + if err := json.Unmarshal([]byte(data), &schema); err != nil { + log.Logger.Errorf("unmarshal ui schema failure %s", err.Error()) + return defaultSchema + } + return patchSchema(defaultSchema, schema) +} + +// AddDefinitionUISchema add definition custom ui schema config +func (d *definitionUsecaseImpl) AddDefinitionUISchema(ctx context.Context, name, defType, configRaw string) ([]*utils.UIParameter, error) { + var uiParameters []*utils.UIParameter + err := yaml.Unmarshal([]byte(configRaw), &uiParameters) + if err != nil { + log.Logger.Errorf("yaml unmarshal failure %s", err.Error()) + return nil, bcode.ErrInvalidDefinitionUISchema + } + dataBate, err := json.Marshal(uiParameters) + if err != nil { + log.Logger.Errorf("json marshal failure %s", err.Error()) + return nil, bcode.ErrInvalidDefinitionUISchema + } + var cm v1.ConfigMap + if err := d.kubeClient.Get(ctx, k8stypes.NamespacedName{ + Namespace: types.DefaultKubeVelaNS, + Name: fmt.Sprintf("%s-uischema-%s", defType, name), + }, &cm); err != nil { + if apierrors.IsNotFound(err) { + err = d.kubeClient.Create(ctx, &v1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: types.DefaultKubeVelaNS, + Name: fmt.Sprintf("%s-uischema-%s", defType, name), + }, + Data: map[string]string{ + types.UISchema: string(dataBate), + }, + }) + } + if err != nil { + return nil, err + } + } else { + cm.Data[types.UISchema] = string(dataBate) + err := d.kubeClient.Update(ctx, &cm) + if err != nil { + return nil, err + } + } + return uiParameters, nil +} + +func patchSchema(defaultSchema, customSchema []*utils.UIParameter) []*utils.UIParameter { + var customSchemaMap = make(map[string]*utils.UIParameter, len(customSchema)) + for i, custom := range customSchema { + customSchemaMap[custom.JSONKey] = customSchema[i] + } + for i := range defaultSchema { + dSchema := defaultSchema[i] + if cusSchema, exist := customSchemaMap[dSchema.JSONKey]; exist { + if cusSchema.Description != "" { + dSchema.Description = cusSchema.Description + } + if cusSchema.Label != "" { + dSchema.Label = cusSchema.Label + } + if cusSchema.SubParameterGroupOption != nil { + dSchema.SubParameterGroupOption = cusSchema.SubParameterGroupOption + } + if cusSchema.Validate != nil { + dSchema.Validate = cusSchema.Validate + } + if cusSchema.UIType != "" { + dSchema.UIType = cusSchema.UIType + } + if cusSchema.Disable != nil { + dSchema.Disable = cusSchema.Disable + } + if cusSchema.SubParameters != nil { + dSchema.SubParameters = patchSchema(dSchema.SubParameters, cusSchema.SubParameters) + } + if cusSchema.Sort != 0 { + dSchema.Sort = cusSchema.Sort + } + } + } + sort.Slice(defaultSchema, func(i, j int) bool { + return defaultSchema[i].Sort < defaultSchema[j].Sort + }) + return defaultSchema +} + +func renderDefaultUISchema(apiSchema *openapi3.Schema) []*utils.UIParameter { + if apiSchema == nil { + return nil + } + var params []*utils.UIParameter + for key, property := range apiSchema.Properties { + if property.Value != nil { + param := renderUIParameter(key, utils.FirstUpper(key), property, apiSchema.Required) + params = append(params, param) + } + } + return params +} + +func renderUIParameter(key, label string, property *openapi3.SchemaRef, required []string) *utils.UIParameter { + var parameter utils.UIParameter + subType := "" + if property.Value.Items != nil { + if property.Value.Items.Value != nil { + subType = property.Value.Items.Value.Type + } + parameter.SubParameters = renderDefaultUISchema(property.Value.Items.Value) + } + if property.Value.Properties != nil { + parameter.SubParameters = renderDefaultUISchema(property.Value) + } + parameter.Validate = &utils.Validate{} + parameter.Validate.DefaultValue = property.Value.Default + for _, enum := range property.Value.Enum { + parameter.Validate.Options = append(parameter.Validate.Options, utils.Option{Label: utils.RenderLabel(enum), Value: enum}) + } + parameter.JSONKey = key + parameter.Description = property.Value.Description + parameter.Label = label + parameter.UIType = utils.GetDefaultUIType(property.Value.Type, len(parameter.Validate.Options) != 0, subType) + parameter.Validate.Max = property.Value.Max + parameter.Validate.MaxLength = property.Value.MaxLength + parameter.Validate.Min = property.Value.Min + parameter.Validate.MinLength = property.Value.MinLength + parameter.Validate.Pattern = property.Value.Pattern + parameter.Validate.Required = utils.StringsContain(required, property.Value.Title) + parameter.Sort = 100 + return ¶meter +} diff --git a/pkg/apiserver/rest/usecase/definition_test.go b/pkg/apiserver/rest/usecase/definition_test.go index 4923cabb1..c640ca42b 100644 --- a/pkg/apiserver/rest/usecase/definition_test.go +++ b/pkg/apiserver/rest/usecase/definition_test.go @@ -18,7 +18,10 @@ package usecase import ( "context" + "encoding/json" + "fmt" "io/ioutil" + "testing" "github.com/getkin/kin-openapi/openapi3" "github.com/google/go-cmp/cmp" @@ -29,6 +32,8 @@ import ( "sigs.k8s.io/yaml" "github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1" + "github.com/oam-dev/kubevela/apis/types" + v1 "github.com/oam-dev/kubevela/pkg/apiserver/rest/apis/v1" "github.com/oam-dev/kubevela/pkg/apiserver/rest/utils" "github.com/oam-dev/kubevela/pkg/oam/util" ) @@ -98,7 +103,7 @@ var _ = Describe("Test namespace usecase functions", func() { Namespace: "vela-system", }, Data: map[string]string{ - "openapi-v3-json-schema": `{"properties":{"batchPartition":{"title":"batchPartition","type":"integer"},"volumes":{"description":"Specify volume type, options: pvc, configMap, secret, emptyDir","enum":["pvc","configMap","secret","emptyDir"],"title":"volumes","type":"string"}, "rolloutBatches":{"items":{"properties":{"replicas":{"title":"replicas","type":"integer"}},"required":["replicas"],"type":"object"},"title":"rolloutBatches","type":"array"},"targetRevision":{"title":"targetRevision","type":"string"},"targetSize":{"title":"targetSize","type":"integer"}},"required":["targetRevision","targetSize"],"type":"object"}`, + types.OpenapiV3JSONSchema: `{"properties":{"batchPartition":{"title":"batchPartition","type":"integer"},"volumes": {"description":"Specify volume type, options: pvc, configMap, secret, emptyDir","enum":["pvc","configMap","secret","emptyDir"],"title":"volumes","type":"string"}, "rolloutBatches":{"items":{"properties":{"replicas":{"title":"replicas","type":"integer"}},"required":["replicas"],"type":"object"},"title":"rolloutBatches","type":"array"},"targetRevision":{"title":"targetRevision","type":"string"},"targetSize":{"title":"targetSize","type":"integer"}},"required":["targetRevision","targetSize"],"type":"object"}`, }, } err := k8sClient.Create(context.Background(), cm) @@ -110,6 +115,58 @@ var _ = Describe("Test namespace usecase functions", func() { err = schemaFromCM.UnmarshalJSON([]byte(cm.Data["openapi-v3-json-schema"])) Expect(err).Should(Succeed()) - Expect(schema.Schema).Should(Equal(schemaFromCM)) + Expect(schema.APISchema).Should(Equal(schemaFromCM)) + }) + + It("Test renderDefaultUISchema", func() { + schema := &v1.DetailDefinitionResponse{} + data, err := ioutil.ReadFile("./testdata/api-schema.json") + Expect(err).Should(Succeed()) + err = json.Unmarshal(data, schema) + Expect(err).Should(Succeed()) + Expect(cmp.Diff(len(schema.APISchema.Required), 3)).Should(BeEmpty()) + uiSchema := renderDefaultUISchema(schema.APISchema) + Expect(cmp.Diff(len(uiSchema), 12)).Should(BeEmpty()) + }) + + It("Test patchSchema", func() { + ddr := &v1.DetailDefinitionResponse{} + data, err := ioutil.ReadFile("./testdata/api-schema.json") + Expect(err).Should(Succeed()) + err = json.Unmarshal(data, ddr) + Expect(err).Should(Succeed()) + Expect(cmp.Diff(len(ddr.APISchema.Required), 3)).Should(BeEmpty()) + defaultschema := renderDefaultUISchema(ddr.APISchema) + + customschema := []*utils.UIParameter{} + cdata, err := ioutil.ReadFile("./testdata/ui-custom-schema.yaml") + Expect(err).Should(Succeed()) + err = yaml.Unmarshal(cdata, &customschema) + Expect(err).Should(Succeed()) + + uiSchema := patchSchema(defaultschema, customschema) + for _, schema := range uiSchema { + fmt.Printf("%s=> %d", schema.JSONKey, schema.Sort) + } + Expect(cmp.Diff(len(uiSchema), 12)).Should(BeEmpty()) + Expect(cmp.Diff(uiSchema[3].JSONKey, "readinessProbe")).Should(BeEmpty()) + Expect(cmp.Diff(len(uiSchema[3].SubParameters), 8)).Should(BeEmpty()) + + outdata, err := yaml.Marshal(uiSchema) + Expect(err).Should(Succeed()) + err = ioutil.WriteFile("./testdata/ui-schema.yaml", outdata, 0755) + Expect(err).Should(Succeed()) }) }) + +func TestAddDefinitionUISchema(t *testing.T) { + du := NewDefinitionUsecase() + cdata, err := ioutil.ReadFile("./testdata/ui-custom-schema.yaml") + if err != nil { + t.Fatal(err) + } + _, err = du.AddDefinitionUISchema(context.TODO(), "webservice", "component", string(cdata)) + if err != nil { + t.Fatal(err) + } +} diff --git a/pkg/apiserver/rest/usecase/testdata/api-schema.json b/pkg/apiserver/rest/usecase/testdata/api-schema.json new file mode 100644 index 000000000..0ba443081 --- /dev/null +++ b/pkg/apiserver/rest/usecase/testdata/api-schema.json @@ -0,0 +1,386 @@ +{ + "schema": { + "properties": { + "addRevisionLabel": { + "type": "boolean", + "default": false, + "description": "If addRevisionLabel is true, the appRevision label will be added to the underlying pods", + "title": "addRevisionLabel" + }, + "cmd": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Commands to run in the container", + "title": "cmd" + }, + "cpu": { + "type": "string", + "description": "Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core)", + "title": "cpu" + }, + "env": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string", + "description": "Environment variable name", + "title": "name" + }, + "value": { + "type": "string", + "description": "The value of the environment variable", + "title": "value" + }, + "valueFrom": { + "properties": { + "secretKeyRef": { + "properties": { + "key": { + "type": "string", + "description": "The key of the secret to select from. Must be a valid secret key", + "title": "key" + }, + "name": { + "type": "string", + "description": "The name of the secret in the pod's namespace to select from", + "title": "name" + } + }, + "required": [ + "name", + "key" + ], + "type": "object", + "description": "Selects a key of a secret in the pod's namespace", + "title": "secretKeyRef" + } + }, + "required": [ + "secretKeyRef" + ], + "type": "object", + "description": "Specifies a source the value of this var should come from", + "title": "valueFrom" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "description": "Define arguments by using environment variables", + "title": "env" + }, + "image": { + "type": "string", + "description": "Which image would you like to use for your service", + "title": "image" + }, + "imagePullPolicy": { + "type": "string", + "description": "Specify image pull policy for your service", + "title": "imagePullPolicy" + }, + "imagePullSecrets": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Specify image pull secrets for your service", + "title": "imagePullSecrets" + }, + "livenessProbe": { + "properties": { + "exec": { + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A command to be executed inside the container to assess its health. Each space delimited token of the command is a separate array element. Commands exiting 0 are considered to be successful probes, whilst all other exit codes are considered failures.", + "title": "command" + } + }, + "required": [ + "command" + ], + "type": "object", + "description": "Instructions for assessing container health by executing a command. Either this attribute or the httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the httpGet attribute and the tcpSocket attribute.", + "title": "exec" + }, + "failureThreshold": { + "type": "integer", + "default": 3, + "description": "Number of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe).", + "title": "failureThreshold" + }, + "httpGet": { + "properties": { + "httpHeaders": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string", + "title": "name" + }, + "value": { + "type": "string", + "title": "value" + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "title": "httpHeaders" + }, + "path": { + "type": "string", + "description": "The endpoint, relative to the port, to which the HTTP GET request should be directed.", + "title": "path" + }, + "port": { + "type": "integer", + "description": "The TCP socket within the container to which the HTTP GET request should be directed.", + "title": "port" + } + }, + "required": [ + "path", + "port" + ], + "type": "object", + "description": "Instructions for assessing container health by executing an HTTP GET request. Either this attribute or the exec attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the tcpSocket attribute.", + "title": "httpGet" + }, + "initialDelaySeconds": { + "type": "integer", + "default": 0, + "description": "Number of seconds after the container is started before the first probe is initiated.", + "title": "initialDelaySeconds" + }, + "periodSeconds": { + "type": "integer", + "default": 10, + "description": "How often, in seconds, to execute the probe.", + "title": "periodSeconds" + }, + "successThreshold": { + "type": "integer", + "default": 1, + "description": "Minimum consecutive successes for the probe to be considered successful after having failed.", + "title": "successThreshold" + }, + "tcpSocket": { + "properties": { + "port": { + "type": "integer", + "description": "The TCP socket within the container that should be probed to assess container health.", + "title": "port" + } + }, + "required": [ + "port" + ], + "type": "object", + "description": "Instructions for assessing container health by probing a TCP socket. Either this attribute or the exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the httpGet attribute.", + "title": "tcpSocket" + }, + "timeoutSeconds": { + "type": "integer", + "default": 1, + "description": "Number of seconds after which the probe times out.", + "title": "timeoutSeconds" + } + }, + "required": [ + "initialDelaySeconds", + "periodSeconds", + "timeoutSeconds", + "successThreshold", + "failureThreshold" + ], + "type": "object", + "description": "Instructions for assessing whether the container is alive.", + "title": "livenessProbe" + }, + "memory": { + "type": "string", + "description": "Specifies the attributes of the memory resource required for the container.", + "title": "memory" + }, + "port": { + "type": "integer", + "default": 80, + "description": "Which port do you want customer traffic sent to", + "title": "port" + }, + "readinessProbe": { + "properties": { + "exec": { + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A command to be executed inside the container to assess its health. Each space delimited token of the command is a separate array element. Commands exiting 0 are considered to be successful probes, whilst all other exit codes are considered failures.", + "title": "command" + } + }, + "required": [ + "command" + ], + "type": "object", + "description": "Instructions for assessing container health by executing a command. Either this attribute or the httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the httpGet attribute and the tcpSocket attribute.", + "title": "exec" + }, + "failureThreshold": { + "type": "integer", + "default": 3, + "description": "Number of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe).", + "title": "failureThreshold" + }, + "httpGet": { + "properties": { + "httpHeaders": { + "type": "array", + "items": { + "properties": { + "name": { + "type": "string", + "title": "name" + }, + "value": { + "type": "string", + "title": "value" + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "title": "httpHeaders" + }, + "path": { + "type": "string", + "description": "The endpoint, relative to the port, to which the HTTP GET request should be directed.", + "title": "path" + }, + "port": { + "type": "integer", + "description": "The TCP socket within the container to which the HTTP GET request should be directed.", + "title": "port" + } + }, + "required": [ + "path", + "port" + ], + "type": "object", + "description": "Instructions for assessing container health by executing an HTTP GET request. Either this attribute or the exec attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the tcpSocket attribute.", + "title": "httpGet" + }, + "initialDelaySeconds": { + "type": "integer", + "default": 0, + "description": "Number of seconds after the container is started before the first probe is initiated.", + "title": "initialDelaySeconds" + }, + "periodSeconds": { + "type": "integer", + "default": 10, + "description": "How often, in seconds, to execute the probe.", + "title": "periodSeconds" + }, + "successThreshold": { + "type": "integer", + "default": 1, + "description": "Minimum consecutive successes for the probe to be considered successful after having failed.", + "title": "successThreshold" + }, + "tcpSocket": { + "properties": { + "port": { + "type": "integer", + "description": "The TCP socket within the container that should be probed to assess container health.", + "title": "port" + } + }, + "required": [ + "port" + ], + "type": "object", + "description": "Instructions for assessing container health by probing a TCP socket. Either this attribute or the exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the httpGet attribute.", + "title": "tcpSocket" + }, + "timeoutSeconds": { + "type": "integer", + "default": 1, + "description": "Number of seconds after which the probe times out.", + "title": "timeoutSeconds" + } + }, + "required": [ + "initialDelaySeconds", + "periodSeconds", + "timeoutSeconds", + "successThreshold", + "failureThreshold" + ], + "type": "object", + "description": "Instructions for assessing whether the container is in a suitable state to serve traffic.", + "title": "readinessProbe" + }, + "volumes": { + "type": "array", + "items": { + "properties": { + "mountPath": { + "type": "string", + "title": "mountPath" + }, + "name": { + "type": "string", + "title": "name" + }, + "type": { + "type": "string", + "enum": [ + "pvc", + "configMap", + "secret", + "emptyDir" + ], + "description": "Specify volume type, options: \"pvc\",\"configMap\",\"secret\",\"emptyDir\"", + "title": "type" + } + }, + "required": [ + "name", + "mountPath", + "type" + ], + "type": "object" + }, + "description": "Declare volumes and volumeMounts", + "title": "volumes" + } + }, + "required": [ + "addRevisionLabel", + "image", + "port" + ], + "type": "object" + } +} \ No newline at end of file diff --git a/pkg/apiserver/rest/usecase/testdata/ui-custom-schema.yaml b/pkg/apiserver/rest/usecase/testdata/ui-custom-schema.yaml new file mode 100755 index 000000000..cc65ecbdf --- /dev/null +++ b/pkg/apiserver/rest/usecase/testdata/ui-custom-schema.yaml @@ -0,0 +1,56 @@ +- description: Specify image pull policy for your service + disable: false + jsonKey: imagePullPolicy + label: 镜像更新策略 + uiType: Select + validate: + options: + - label: 镜像不存在时更新 + value: IfNotPresent + - label: 总是更新 + value: Always + - label: 永不更新 + value: Never + sort: 2 +- description: Specifies the attributes of the memory resource required for the container. + disable: false + jsonKey: memory + label: Memory + uiType: MemoryNumber + sort: 3 +- uiType: CPUNumber + jsonKey: cpu +- description: Define arguments by using environment variables + disable: false + jsonKey: env + label: Env + subParameterGroupOption: + - - name + - value + - - name + - valueFrom + subParameters: + - description: Specifies a source the value of this var should come from + disable: false + jsonKey: valueFrom + label: Secret选择器 + uiType: InnerGroup + subParameters: + - jsonKey: secretKeyRef + uiType: Ignore + subParameters: + - jsonKey: name + label: Secret选择 + uiType: SecretSelect + - jsonKey: key + label: SecretKey选择 + uiType: SecretKeySelect + uiType: Structs + validate: {} +- uiType: ImageInput + jsonKey: image + sort: 1 +- jsonKey: readinessProbe + uiType: Group + label: ReadinessProbe检测 + sort: 4 \ No newline at end of file diff --git a/pkg/apiserver/rest/usecase/testdata/ui-default-schema.yaml b/pkg/apiserver/rest/usecase/testdata/ui-default-schema.yaml new file mode 100755 index 000000000..ef7d72dd8 --- /dev/null +++ b/pkg/apiserver/rest/usecase/testdata/ui-default-schema.yaml @@ -0,0 +1,132 @@ +- description: Which image would you like to use for your service + jsonKey: image + label: Image + uiType: Input + validete: + required: true +- description: Specify image pull policy for your service + jsonKey: imagePullPolicy + label: ImagePullPolicy + uiType: Input + validete: {} +- description: Instructions for assessing whether the container is alive. + jsonKey: livenessProbe + label: LivenessProbe + uiType: KV + validete: {} +- description: If addRevisionLabel is true, the appRevision label will be added to + the underlying pods + jsonKey: addRevisionLabel + label: AddRevisionLabel + uiType: Switch + validete: + defaultValue: false + required: true +- description: Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` + (1 CPU core) + jsonKey: cpu + label: Cpu + uiType: Input + validete: {} +- description: Specify image pull secrets for your service + jsonKey: imagePullSecrets + label: ImagePullSecrets + uiType: Structs + validete: {} +- description: Specifies the attributes of the memory resource required for the container. + jsonKey: memory + label: Memory + uiType: Input + validete: {} +- description: Which port do you want customer traffic sent to + jsonKey: port + label: Port + uiType: Number + validete: + defaultValue: 80 + required: true +- description: Instructions for assessing whether the container is in a suitable state + to serve traffic. + jsonKey: readinessProbe + label: ReadinessProbe + uiType: KV + validete: {} +- description: Declare volumes and volumeMounts + jsonKey: volumes + label: Volumes + subParameters: + - description: "" + jsonKey: volumes.mountPath + label: MountPath + uiType: Input + validete: + required: true + - description: "" + jsonKey: volumes.name + label: Name + uiType: Input + validete: + required: true + - description: 'Specify volume type, options: "pvc","configMap","secret","emptyDir"' + jsonKey: volumes.type + label: Type + uiType: Select + validete: + options: + - label: Pvc + value: pvc + - label: ConfigMap + value: configMap + - label: Secret + value: secret + - label: EmptyDir + value: emptyDir + required: true + uiType: Structs + validete: {} +- description: Commands to run in the container + jsonKey: cmd + label: Cmd + uiType: Structs + validete: {} +- description: Define arguments by using environment variables + jsonKey: env + label: Env + subParameters: + - description: The value of the environment variable + jsonKey: env.value + label: Value + uiType: Input + validete: {} + - description: Specifies a source the value of this var should come from + jsonKey: env.valueFrom + label: ValueFrom + subParameters: + - description: "" + jsonKey: env.valueFrom.secretKeyRef + label: SecretKeyRef + subParameters: + - description: secret name + jsonKey: env.valueFrom.secretKeyRef.name + label: Name + uiType: Input + validete: + required: true + - description: secret key + jsonKey: env.valueFrom.secretKeyRef.key + label: Key + uiType: Input + validete: + required: true + uiType: KV + validete: {} + uiType: KV + validete: {} + - description: Environment variable name + jsonKey: env.name + label: Name + uiType: Input + validete: + required: true + uiType: Structs + validete: {} diff --git a/pkg/apiserver/rest/usecase/testdata/ui-schema.yaml b/pkg/apiserver/rest/usecase/testdata/ui-schema.yaml new file mode 100755 index 000000000..d026df893 --- /dev/null +++ b/pkg/apiserver/rest/usecase/testdata/ui-schema.yaml @@ -0,0 +1,428 @@ +- description: Instructions for assessing whether the container is in a suitable state + to serve traffic. + jsonKey: readinessProbe + label: ReadinessProbe检测 + sort: 1 + subParameters: + - description: Number of seconds after the container is started before the first + probe is initiated. + jsonKey: readinessProbe.initialDelaySeconds + label: InitialDelaySeconds + sort: 100 + uiType: Number + validete: + defaultValue: 0 + required: true + - description: How often, in seconds, to execute the probe. + jsonKey: readinessProbe.periodSeconds + label: PeriodSeconds + sort: 100 + uiType: Number + validete: + defaultValue: 10 + required: true + - description: Minimum consecutive successes for the probe to be considered successful + after having failed. + jsonKey: readinessProbe.successThreshold + label: SuccessThreshold + sort: 100 + uiType: Number + validete: + defaultValue: 1 + required: true + - description: Instructions for assessing container health by probing a TCP socket. + Either this attribute or the exec attribute or the httpGet attribute MUST be + specified. This attribute is mutually exclusive with both the exec attribute + and the httpGet attribute. + jsonKey: readinessProbe.tcpSocket + label: TcpSocket + sort: 100 + subParameters: + - description: The TCP socket within the container that should be probed to assess + container health. + jsonKey: readinessProbe.tcpSocket.port + label: Port + sort: 100 + uiType: Number + validete: + required: true + uiType: KV + validete: {} + - description: Number of seconds after which the probe times out. + jsonKey: readinessProbe.timeoutSeconds + label: TimeoutSeconds + sort: 100 + uiType: Number + validete: + defaultValue: 1 + required: true + - description: Instructions for assessing container health by executing a command. + Either this attribute or the httpGet attribute or the tcpSocket attribute MUST + be specified. This attribute is mutually exclusive with both the httpGet attribute + and the tcpSocket attribute. + jsonKey: readinessProbe.exec + label: Exec + sort: 100 + subParameters: + - description: A command to be executed inside the container to assess its health. + Each space delimited token of the command is a separate array element. Commands + exiting 0 are considered to be successful probes, whilst all other exit codes + are considered failures. + jsonKey: readinessProbe.exec.command + label: Command + sort: 100 + uiType: Strings + validete: + required: true + uiType: KV + validete: {} + - description: Number of consecutive failures required to determine the container + is not alive (liveness probe) or not ready (readiness probe). + jsonKey: readinessProbe.failureThreshold + label: FailureThreshold + sort: 100 + uiType: Number + validete: + defaultValue: 3 + required: true + - description: Instructions for assessing container health by executing an HTTP + GET request. Either this attribute or the exec attribute or the tcpSocket attribute + MUST be specified. This attribute is mutually exclusive with both the exec attribute + and the tcpSocket attribute. + jsonKey: readinessProbe.httpGet + label: HttpGet + sort: 100 + subParameters: + - description: "" + jsonKey: readinessProbe.httpGet.httpHeaders + label: HttpHeaders + sort: 100 + subParameters: + - description: "" + jsonKey: readinessProbe.httpGet.httpHeaders.[].name + label: Name + sort: 100 + uiType: Input + validete: + required: true + - description: "" + jsonKey: readinessProbe.httpGet.httpHeaders.[].value + label: Value + sort: 100 + uiType: Input + validete: + required: true + uiType: Structs + validete: {} + - description: The endpoint, relative to the port, to which the HTTP GET request + should be directed. + jsonKey: readinessProbe.httpGet.path + label: Path + sort: 100 + uiType: Input + validete: + required: true + - description: The TCP socket within the container to which the HTTP GET request + should be directed. + jsonKey: readinessProbe.httpGet.port + label: Port + sort: 100 + uiType: Number + validete: + required: true + uiType: KV + validete: {} + uiType: Group + validete: {} +- description: Which image would you like to use for your service + jsonKey: image + label: Image + sort: 2 + uiType: ImageInput + validete: + required: true +- description: Specify image pull policy for your service + disable: false + jsonKey: imagePullPolicy + label: 镜像更新策略 + sort: 2 + uiType: Select + validete: + options: + - label: 镜像不存在时更新 + value: IfNotPresent + - label: 总是更新 + value: Always + - label: 永不更新 + value: Never +- description: Specifies the attributes of the memory resource required for the container. + disable: false + jsonKey: memory + label: Memory + sort: 3 + uiType: MemoryNumber + validete: {} +- description: Commands to run in the container + jsonKey: cmd + label: Cmd + sort: 100 + uiType: Strings + validete: {} +- description: Which port do you want customer traffic sent to + jsonKey: port + label: Port + sort: 100 + uiType: Number + validete: + defaultValue: 80 + required: true +- description: Specify image pull secrets for your service + jsonKey: imagePullSecrets + label: ImagePullSecrets + sort: 100 + uiType: Strings + validete: {} +- description: Instructions for assessing whether the container is alive. + jsonKey: livenessProbe + label: LivenessProbe + sort: 100 + subParameters: + - description: Number of seconds after which the probe times out. + jsonKey: livenessProbe.timeoutSeconds + label: TimeoutSeconds + sort: 100 + uiType: Number + validete: + defaultValue: 1 + required: true + - description: Instructions for assessing container health by executing a command. + Either this attribute or the httpGet attribute or the tcpSocket attribute MUST + be specified. This attribute is mutually exclusive with both the httpGet attribute + and the tcpSocket attribute. + jsonKey: livenessProbe.exec + label: Exec + sort: 100 + subParameters: + - description: A command to be executed inside the container to assess its health. + Each space delimited token of the command is a separate array element. Commands + exiting 0 are considered to be successful probes, whilst all other exit codes + are considered failures. + jsonKey: livenessProbe.exec.command + label: Command + sort: 100 + uiType: Strings + validete: + required: true + uiType: KV + validete: {} + - description: Number of consecutive failures required to determine the container + is not alive (liveness probe) or not ready (readiness probe). + jsonKey: livenessProbe.failureThreshold + label: FailureThreshold + sort: 100 + uiType: Number + validete: + defaultValue: 3 + required: true + - description: Instructions for assessing container health by executing an HTTP + GET request. Either this attribute or the exec attribute or the tcpSocket attribute + MUST be specified. This attribute is mutually exclusive with both the exec attribute + and the tcpSocket attribute. + jsonKey: livenessProbe.httpGet + label: HttpGet + sort: 100 + subParameters: + - description: The TCP socket within the container to which the HTTP GET request + should be directed. + jsonKey: livenessProbe.httpGet.port + label: Port + sort: 100 + uiType: Number + validete: + required: true + - description: "" + jsonKey: livenessProbe.httpGet.httpHeaders + label: HttpHeaders + sort: 100 + subParameters: + - description: "" + jsonKey: livenessProbe.httpGet.httpHeaders.[].name + label: Name + sort: 100 + uiType: Input + validete: + required: true + - description: "" + jsonKey: livenessProbe.httpGet.httpHeaders.[].value + label: Value + sort: 100 + uiType: Input + validete: + required: true + uiType: Structs + validete: {} + - description: The endpoint, relative to the port, to which the HTTP GET request + should be directed. + jsonKey: livenessProbe.httpGet.path + label: Path + sort: 100 + uiType: Input + validete: + required: true + uiType: KV + validete: {} + - description: Number of seconds after the container is started before the first + probe is initiated. + jsonKey: livenessProbe.initialDelaySeconds + label: InitialDelaySeconds + sort: 100 + uiType: Number + validete: + defaultValue: 0 + required: true + - description: How often, in seconds, to execute the probe. + jsonKey: livenessProbe.periodSeconds + label: PeriodSeconds + sort: 100 + uiType: Number + validete: + defaultValue: 10 + required: true + - description: Minimum consecutive successes for the probe to be considered successful + after having failed. + jsonKey: livenessProbe.successThreshold + label: SuccessThreshold + sort: 100 + uiType: Number + validete: + defaultValue: 1 + required: true + - description: Instructions for assessing container health by probing a TCP socket. + Either this attribute or the exec attribute or the httpGet attribute MUST be + specified. This attribute is mutually exclusive with both the exec attribute + and the httpGet attribute. + jsonKey: livenessProbe.tcpSocket + label: TcpSocket + sort: 100 + subParameters: + - description: The TCP socket within the container that should be probed to assess + container health. + jsonKey: livenessProbe.tcpSocket.port + label: Port + sort: 100 + uiType: Number + validete: + required: true + uiType: KV + validete: {} + uiType: KV + validete: {} +- description: Declare volumes and volumeMounts + jsonKey: volumes + label: Volumes + sort: 100 + subParameters: + - description: "" + jsonKey: volumes.[].mountPath + label: MountPath + sort: 100 + uiType: Input + validete: + required: true + - description: "" + jsonKey: volumes.[].name + label: Name + sort: 100 + uiType: Input + validete: + required: true + - description: 'Specify volume type, options: "pvc","configMap","secret","emptyDir"' + jsonKey: volumes.[].type + label: Type + sort: 100 + uiType: Select + validete: + options: + - label: Pvc + value: pvc + - label: ConfigMap + value: configMap + - label: Secret + value: secret + - label: EmptyDir + value: emptyDir + required: true + uiType: Structs + validete: {} +- description: If addRevisionLabel is true, the appRevision label will be added to + the underlying pods + jsonKey: addRevisionLabel + label: AddRevisionLabel + sort: 100 + uiType: Switch + validete: + defaultValue: false + required: true +- description: Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` + (1 CPU core) + jsonKey: cpu + label: Cpu + sort: 100 + uiType: CPUNumber + validete: {} +- description: Define arguments by using environment variables + disable: false + jsonKey: env + label: Env + sort: 100 + subParameterGroupOption: + - - env.name + - env.value + - - env.name + - env.valueFrom + subParameters: + - description: The value of the environment variable + jsonKey: env.[].value + label: Value + sort: 100 + uiType: Input + validete: {} + - description: Specifies a source the value of this var should come from + jsonKey: env.[].valueFrom + label: ValueFrom + sort: 100 + subParameters: + - description: Selects a key of a secret in the pod's namespace + jsonKey: env.[].valueFrom.secretKeyRef + label: SecretKeyRef + sort: 100 + subParameters: + - description: The key of the secret to select from. Must be a valid secret + key + jsonKey: env.[].valueFrom.secretKeyRef.key + label: Key + sort: 100 + uiType: Input + validete: + required: true + - description: The name of the secret in the pod's namespace to select from + jsonKey: env.[].valueFrom.secretKeyRef.name + label: Name + sort: 100 + uiType: Input + validete: + required: true + uiType: KV + validete: + required: true + uiType: KV + validete: {} + - description: Environment variable name + jsonKey: env.[].name + label: Name + sort: 100 + uiType: Input + validete: + required: true + uiType: Structs + validete: {} diff --git a/pkg/apiserver/rest/utils/bcode/definition.go b/pkg/apiserver/rest/utils/bcode/definition.go new file mode 100644 index 000000000..3a89f6b5f --- /dev/null +++ b/pkg/apiserver/rest/utils/bcode/definition.go @@ -0,0 +1,29 @@ +/* +Copyright 2021 The KubeVela Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package bcode + +// ErrDefinitionNotFound definition is not exist +var ErrDefinitionNotFound = NewBcode(404, 70001, "definition is not exist") + +// ErrDefinitionNoSchema definition not have schema +var ErrDefinitionNoSchema = NewBcode(400, 70002, "definition not have schema") + +// ErrDefinitionTypeNotSupport definition type not support +var ErrDefinitionTypeNotSupport = NewBcode(400, 70003, "definition type not support") + +// ErrInvalidDefinitionUISchema invalid custom definition ui schema +var ErrInvalidDefinitionUISchema = NewBcode(400, 70004, "invalid custom defnition ui schema") diff --git a/pkg/apiserver/rest/utils/convert.go b/pkg/apiserver/rest/utils/convert.go deleted file mode 100644 index 09c3f2b64..000000000 --- a/pkg/apiserver/rest/utils/convert.go +++ /dev/null @@ -1,24 +0,0 @@ -package utils - -import ( - "github.com/oam-dev/kubevela/pkg/apiserver/model" - apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/rest/apis/v1" - "strings" -) - -// ConvertAddonRegistryModel2AddonRegistryMeta will convert from model to AddonRegistryMeta -func ConvertAddonRegistryModel2AddonRegistryMeta(r *model.AddonRegistry) *apisv1.AddonRegistryMeta { - return &apisv1.AddonRegistryMeta{ - Name: r.Name, - Git: r.Git, - } -} - -const addonAppPrefix = "addon-" - -func AddonName2AppName(name string) string { - return addonAppPrefix + name -} -func AppName2addonName(name string) string { - return strings.TrimPrefix(name, addonAppPrefix) -} diff --git a/pkg/apiserver/rest/utils/uiswagger.go b/pkg/apiserver/rest/utils/uiswagger.go index fca084eaf..b58b5622d 100644 --- a/pkg/apiserver/rest/utils/uiswagger.go +++ b/pkg/apiserver/rest/utils/uiswagger.go @@ -16,32 +16,41 @@ limitations under the License. package utils +import ( + "fmt" + "strings" +) + // UIParameter Structured import table simple UI model type UIParameter struct { + Sort uint `json:"sort"` Label string `json:"label"` Description string `json:"description"` - Validate *Validate `json:"validete,omitempty"` + Validate *Validate `json:"validate,omitempty"` JSONKey string `json:"jsonKey"` UIType string `json:"uiType"` // means only can be read. - Disable bool `json:"disable"` - SubParameters []*UIParameter `json:"subParameters,omitempty"` + Disable *bool `json:"disable,omitempty"` + SubParameterGroupOption [][]string `json:"subParameterGroupOption,omitempty"` + SubParameters []*UIParameter `json:"subParameters,omitempty"` } // Validate parameter validate rule type Validate struct { Required bool `json:"required,omitempty"` - Max int `json:"max,omitempty"` - Min int `json:"min,omitempty"` - Regular string `json:"regular,omitempty"` - Options []*Options `json:"options,omitempty"` + Max *float64 `json:"max,omitempty"` + MaxLength *uint64 `json:"maxLength,omitempty"` + Min *float64 `json:"min,omitempty"` + MinLength uint64 `json:"minLength,omitempty"` + Pattern string `json:"pattern,omitempty"` + Options []Option `json:"options,omitempty"` DefaultValue interface{} `json:"defaultValue,omitempty"` } -// Options select option -type Options struct { - Label string `json:"label"` - Value string `json:"value"` +// Option select option +type Option struct { + Label string `json:"label"` + Value interface{} `json:"value"` } // ParseUIParameterFromDefinition cue of parameter in Definitions was analyzed to obtain the form description model. @@ -50,3 +59,68 @@ func ParseUIParameterFromDefinition(definition []byte) ([]*UIParameter, error) { return params, nil } + +// FirstUpper Sets the first letter of the string to upper. +func FirstUpper(s string) string { + if s == "" { + return "" + } + return strings.ToUpper(s[:1]) + s[1:] +} + +// FirstLower Sets the first letter of the string to lowercase. +func FirstLower(s string) string { + if s == "" { + return "" + } + return strings.ToLower(s[:1]) + s[1:] +} + +// GetDefaultUIType Set the default mapping for API Schema Type +func GetDefaultUIType(apiType string, haveOptions bool, subType string) string { + switch apiType { + case "string": + if haveOptions { + return "Select" + } + return "Input" + case "number", "integer": + return "Number" + case "boolean": + return "Switch" + case "array": + if subType == "string" { + return "Strings" + } + if subType == "number" || subType == "integer" { + return "Numbers" + } + return "Structs" + case "object": + return "KV" + default: + return "Input" + } +} + +// RenderLabel render option label +func RenderLabel(source interface{}) string { + switch v := source.(type) { + case int: + return fmt.Sprintf("%d", v) + case string: + return FirstUpper(v) + default: + return FirstUpper(fmt.Sprintf("%v", v)) + } +} + +// StringsContain strings contain +func StringsContain(items []string, source string) bool { + for _, item := range items { + if item == source { + return true + } + } + return false +} diff --git a/pkg/apiserver/rest/webservice/addon_registry.go b/pkg/apiserver/rest/webservice/addon_registry.go index 1ba902dc7..2b44d9690 100644 --- a/pkg/apiserver/rest/webservice/addon_registry.go +++ b/pkg/apiserver/rest/webservice/addon_registry.go @@ -22,7 +22,6 @@ import ( apis "github.com/oam-dev/kubevela/pkg/apiserver/rest/apis/v1" "github.com/oam-dev/kubevela/pkg/apiserver/rest/usecase" - "github.com/oam-dev/kubevela/pkg/apiserver/rest/utils" "github.com/oam-dev/kubevela/pkg/apiserver/rest/utils/bcode" ) @@ -112,7 +111,7 @@ func (s *addonRegistryWebService) deleteAddonRegistry(req *restful.Request, res return } - if err := res.WriteEntity(*utils.ConvertAddonRegistryModel2AddonRegistryMeta(r)); err != nil { + if err := res.WriteEntity(*usecase.ConvertAddonRegistryModel2AddonRegistryMeta(r)); err != nil { bcode.ReturnError(req, res, err) return } diff --git a/pkg/apiserver/rest/webservice/applicationplan.go b/pkg/apiserver/rest/webservice/applicationplan.go index f7e4268d9..709faca8c 100644 --- a/pkg/apiserver/rest/webservice/applicationplan.go +++ b/pkg/apiserver/rest/webservice/applicationplan.go @@ -47,7 +47,7 @@ func (c *applicationPlanWebService) GetWebService() *restful.WebService { Produces(restful.MIME_JSON, restful.MIME_XML). Doc("api for application manage") - tags := []string{"application"} + tags := []string{"applicationplan"} ws.Route(ws.GET("/").To(c.listApplicationPlans). Doc("list all application plans"). diff --git a/pkg/apiserver/rest/webservice/cluster.go b/pkg/apiserver/rest/webservice/cluster.go index b3f2e2648..42dc3f3db 100644 --- a/pkg/apiserver/rest/webservice/cluster.go +++ b/pkg/apiserver/rest/webservice/cluster.go @@ -76,7 +76,7 @@ func (c *ClusterWebService) GetWebService() *restful.WebService { Doc("modify cluster"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(ws.PathParameter("clusterName", "identifier of the cluster").DataType("string")). - Reads(&apis.CreateClusterRequest{}). + Reads(apis.CreateClusterRequest{}). Returns(200, "", apis.ClusterBase{}). Returns(400, "", bcode.Bcode{}). Writes(apis.ClusterBase{})) @@ -95,7 +95,7 @@ func (c *ClusterWebService) GetWebService() *restful.WebService { Param(ws.PathParameter("provider", "identifier of the cloud provider").DataType("string")). Param(ws.QueryParameter("page", "Page for paging").DataType("int").DefaultValue("0")). Param(ws.QueryParameter("pageSize", "PageSize for paging").DataType("int").DefaultValue("20")). - Reads(&apis.AccessKeyRequest{}). + Reads(apis.AccessKeyRequest{}). Returns(200, "", apis.ListCloudClusterResponse{}). Returns(400, "", bcode.Bcode{}). Writes(apis.ListCloudClusterResponse{})) @@ -104,7 +104,7 @@ func (c *ClusterWebService) GetWebService() *restful.WebService { Doc("create cluster from cloud cluster"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(ws.PathParameter("provider", "identifier of the cloud provider").DataType("string")). - Reads(&apis.ConnectCloudClusterRequest{}). + Reads(apis.ConnectCloudClusterRequest{}). Returns(200, "", apis.ClusterBase{}). Returns(400, "", bcode.Bcode{}). Writes(apis.ClusterBase{})) @@ -112,8 +112,8 @@ func (c *ClusterWebService) GetWebService() *restful.WebService { ws.Route(ws.POST("/cloud-clusters/{provider}/create").To(c.createCloudCluster). Doc("create cloud cluster"). Metadata(restfulspec.KeyOpenAPITags, tags). - Param(ws.PathParameter("provider", "identifier of the cloud provider").DataType("string")). - Reads(&apis.CreateCloudClusterRequest{}). + Param(ws.PathParameter("provider", "identifier of the cloud provider").DataType("string").Required(true)). + Reads(apis.CreateCloudClusterRequest{}). Returns(200, "", apis.CreateCloudClusterResponse{}). Returns(400, "", bcode.Bcode{}). Writes(apis.CreateCloudClusterResponse{})) diff --git a/pkg/apiserver/rest/webservice/definition.go b/pkg/apiserver/rest/webservice/definition.go index 8eee097fa..d5e508045 100644 --- a/pkg/apiserver/rest/webservice/definition.go +++ b/pkg/apiserver/rest/webservice/definition.go @@ -41,7 +41,7 @@ func (d *definitionWebservice) GetWebService() *restful.WebService { ws.Route(ws.GET("/").To(d.listDefinitions). Doc("list all definitions"). Metadata(restfulspec.KeyOpenAPITags, tags). - Param(ws.QueryParameter("type", "query the definition type").DataType("string")). + Param(ws.QueryParameter("type", "query the definition type").DataType("string").Required(true).AllowableValues(map[string]string{"component": "", "trait": "", "workflowstep": ""})). Param(ws.QueryParameter("envName", "if specified, query the definition supported by the env.").DataType("string")). Returns(200, "", apis.ListDefinitionResponse{}). Writes(apis.ListDefinitionResponse{}).Do(returns200, returns500)) diff --git a/pkg/apiserver/rest/webservice/namespace.go b/pkg/apiserver/rest/webservice/namespace.go index 46a5ccf2b..013d0d2a1 100644 --- a/pkg/apiserver/rest/webservice/namespace.go +++ b/pkg/apiserver/rest/webservice/namespace.go @@ -47,12 +47,14 @@ func (n *namespaceWebService) GetWebService() *restful.WebService { ws.Route(ws.GET("/").To(n.listNamespaces). Doc("list all namespaces"). Metadata(restfulspec.KeyOpenAPITags, tags). + Returns(200, "", apis.ListNamespaceResponse{}). Writes(apis.ListNamespaceResponse{})) ws.Route(ws.POST("/").To(n.createNamespace). Doc("create namespace"). Metadata(restfulspec.KeyOpenAPITags, tags). Reads(apis.CreateNamespaceRequest{}). + Returns(200, "", apis.NamespaceDetailResponse{}). Writes(apis.NamespaceDetailResponse{})) return ws } diff --git a/pkg/apiserver/rest/webservice/oam_application.go b/pkg/apiserver/rest/webservice/oam_application.go index 55725ae3a..c842868de 100644 --- a/pkg/apiserver/rest/webservice/oam_application.go +++ b/pkg/apiserver/rest/webservice/oam_application.go @@ -44,13 +44,14 @@ func (c *oamApplicationWebService) GetWebService() *restful.WebService { Produces(restful.MIME_JSON, restful.MIME_XML). Doc("api for oam application manage") - tags := []string{"oam"} + tags := []string{"oam-application"} ws.Route(ws.GET("/namespaces/{namespace}/applications/{appname}").To(c.getApplication). Doc("get the specified oam application in the specified namespace"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(ws.PathParameter("namespace", "identifier of the namespace").DataType("string")). Param(ws.PathParameter("appname", "identifier of the oam application").DataType("string")). + Returns(200, "", apis.ApplicationResponse{}). Writes(apis.ApplicationResponse{})) ws.Route(ws.POST("/namespaces/{namespace}/applications/{appname}").To(c.createOrUpdateApplication). diff --git a/pkg/apiserver/rest/webservice/policy_definition.go b/pkg/apiserver/rest/webservice/policy_definition.go index 01f54ca17..e389abc03 100644 --- a/pkg/apiserver/rest/webservice/policy_definition.go +++ b/pkg/apiserver/rest/webservice/policy_definition.go @@ -33,11 +33,12 @@ func (c *policyDefinitionWebservice) GetWebService() *restful.WebService { Produces(restful.MIME_JSON, restful.MIME_XML). Doc("api for policydefinition manage") - tags := []string{"policydefinition"} + tags := []string{"definition"} ws.Route(ws.GET("/").To(noop). Doc("list all policydefinition"). Metadata(restfulspec.KeyOpenAPITags, tags). + Returns(200, "", apis.ListPolicyDefinitionResponse{}). Writes(apis.ListPolicyDefinitionResponse{})) return ws } diff --git a/pkg/apiserver/rest/webservice/webservice.go b/pkg/apiserver/rest/webservice/webservice.go index f7c93553e..1f06da88f 100644 --- a/pkg/apiserver/rest/webservice/webservice.go +++ b/pkg/apiserver/rest/webservice/webservice.go @@ -17,7 +17,6 @@ limitations under the License. package webservice import ( - "context" "net/http" "github.com/emicklei/go-restful/v3" @@ -58,7 +57,7 @@ func returns500(b *restful.RouteBuilder) { // Init init all webservice, pass in the required parameter object. // It can be implemented using the idea of dependency injection. -func Init(ctx context.Context, ds datastore.DataStore) { +func Init(ds datastore.DataStore) { clusterUsecase := usecase.NewClusterUsecase(ds) workflowUsecase := usecase.NewWorkflowUsecase(ds) applicationUsecase := usecase.NewApplicationUsecase(ds, workflowUsecase) diff --git a/pkg/apiserver/rest/webservice/workflow.go b/pkg/apiserver/rest/webservice/workflow.go index 4ee1cf41e..e831e956a 100644 --- a/pkg/apiserver/rest/webservice/workflow.go +++ b/pkg/apiserver/rest/webservice/workflow.go @@ -51,13 +51,14 @@ func (w *workflowWebService) GetWebService() *restful.WebService { Produces(restful.MIME_JSON, restful.MIME_XML). Doc("api for cluster manage") - tags := []string{"cluster"} + tags := []string{"workflowplan"} ws.Route(ws.GET("/").To(w.listApplicationWorkflows). Doc("list application workflow"). - Param(ws.QueryParameter("appName", "identifier of the application.").DataType("string")). + Param(ws.QueryParameter("appName", "identifier of the application.").DataType("string").Required(true)). Param(ws.QueryParameter("enable", "query based on enable status").DataType("boolean")). Metadata(restfulspec.KeyOpenAPITags, tags). + Returns(200, "", apis.ListWorkflowPlanResponse{}). Writes(apis.ListWorkflowPlanResponse{}).Do(returns200, returns500)) ws.Route(ws.POST("/").To(w.createApplicationWorkflow). @@ -82,6 +83,7 @@ func (w *workflowWebService) GetWebService() *restful.WebService { Filter(w.workflowCheckFilter). Param(ws.PathParameter("name", "identifier of the workflow").DataType("string")). Reads(apis.UpdateWorkflowPlanRequest{}). + Returns(200, "", apis.DetailWorkflowPlanResponse{}). Writes(apis.DetailWorkflowPlanResponse{}).Do(returns200, returns500)) ws.Route(ws.DELETE("/{name}").To(w.deleteWorkflow). @@ -89,6 +91,7 @@ func (w *workflowWebService) GetWebService() *restful.WebService { Metadata(restfulspec.KeyOpenAPITags, tags). Filter(w.workflowCheckFilter). Param(ws.PathParameter("name", "identifier of the workflow").DataType("string")). + Returns(200, "", apis.EmptyResponse{}). Writes(apis.EmptyResponse{}).Do(returns200, returns500)) ws.Route(ws.GET("/{name}/records").To(w.listWorkflowRecords). @@ -98,6 +101,7 @@ func (w *workflowWebService) GetWebService() *restful.WebService { Filter(w.workflowCheckFilter). Param(ws.PathParameter("page", "Query the page number.").DataType("integer")). Param(ws.PathParameter("pageSize", "Query the page size number.").DataType("integer")). + Returns(200, "", apis.ListWorkflowRecordsResponse{}). Writes(apis.ListWorkflowRecordsResponse{}).Do(returns200, returns500)) ws.Route(ws.GET("/{name}/records/{record}").To(w.detailWorkflowRecord). @@ -105,6 +109,7 @@ func (w *workflowWebService) GetWebService() *restful.WebService { Param(ws.PathParameter("name", "identifier of the workflow").DataType("string")). Param(ws.PathParameter("record", "identifier of the workflow record").DataType("string")). Metadata(restfulspec.KeyOpenAPITags, tags). + Returns(200, "", apis.DetailWorkflowRecordResponse{}). Writes(apis.DetailWorkflowRecordResponse{}).Do(returns200, returns500)) return ws diff --git a/test/e2e-test/helm_app_test.go b/test/e2e-test/helm_app_test.go index 527bf87ff..3792f3df9 100644 --- a/test/e2e-test/helm_app_test.go +++ b/test/e2e-test/helm_app_test.go @@ -378,7 +378,7 @@ var _ = Describe("Test application containing helm module", func() { if err := k8sClient.Get(ctx, client.ObjectKey{Name: cmName, Namespace: namespace}, cm); err != nil { return err } - if cm.Data["openapi-v3-json-schema"] == "" { + if cm.Data[types.OpenapiV3JSONSchema] == "" { return errors.New("json schema is not found in the ConfigMap") } return nil diff --git a/test/e2e-test/kube_app_test.go b/test/e2e-test/kube_app_test.go index adf115ece..4c18a22ab 100644 --- a/test/e2e-test/kube_app_test.go +++ b/test/e2e-test/kube_app_test.go @@ -32,6 +32,7 @@ import ( "github.com/oam-dev/kubevela/apis/core.oam.dev/common" "github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1" + "github.com/oam-dev/kubevela/apis/types" "github.com/oam-dev/kubevela/pkg/oam/util" . "github.com/onsi/ginkgo" @@ -347,7 +348,7 @@ spec: if err := k8sClient.Get(ctx, client.ObjectKey{Name: cmName, Namespace: namespace}, cm); err != nil { return err } - if cm.Data["openapi-v3-json-schema"] == "" { + if cm.Data[types.OpenapiV3JSONSchema] == "" { return errors.New("json schema is not found in the ConfigMap") } return nil