Files
kubevela/pkg/server/docs/docs.go
majian cf2a57c96a Integrate swagger and add env api (#764)
* 1.swagger integrate
2.add env swagger comment

Signed-off-by: majian <majian159@live.com>

* use swagger.json

Signed-off-by: majian <majian159@live.com>
2020-12-12 08:54:33 -08:00

493 lines
17 KiB
Go

// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/envs/": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"environments"
],
"operationId": "listEnvironments",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/apis.Environment"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
}
}
},
"post": {
"tags": [
"environments"
],
"operationId": "createEnvironment",
"parameters": [
{
"description": "body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/apis.Environment"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
}
}
}
},
"/envs/{envName}": {
"get": {
"tags": [
"environments"
],
"operationId": "getEnvironment",
"parameters": [
{
"type": "string",
"description": "envName",
"name": "envName",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/apis.Environment"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
}
}
},
"put": {
"tags": [
"environments"
],
"operationId": "updateEnvironment",
"parameters": [
{
"type": "string",
"description": "envName",
"name": "envName",
"in": "path",
"required": true
},
{
"description": "envName",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/apis.EnvironmentBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
}
}
},
"delete": {
"tags": [
"environments"
],
"operationId": "deleteEnvironment",
"parameters": [
{
"type": "string",
"description": "envName",
"name": "envName",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
}
}
},
"patch": {
"tags": [
"environments"
],
"operationId": "setEnvironment",
"parameters": [
{
"type": "string",
"description": "envName",
"name": "envName",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/apis.Response"
},
{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "string"
}
}
}
]
}
}
}
}
}
},
"definitions": {
"apis.Environment": {
"type": "object",
"required": [
"envName",
"namespace"
],
"properties": {
"current": {
"type": "string"
},
"domain": {
"type": "string"
},
"email": {
"type": "string"
},
"envName": {
"type": "string"
},
"namespace": {
"type": "string"
}
}
},
"apis.EnvironmentBody": {
"type": "object",
"required": [
"namespace"
],
"properties": {
"namespace": {
"type": "string"
}
}
},
"apis.Response": {
"type": "object",
"properties": {
"code": {
"type": "integer"
}
}
}
}
}`
type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
Version: "0.0.1",
Host: "",
BasePath: "/api",
Schemes: []string{},
Title: "KubeVela API",
Description: "An KubeVela API.",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
return tpl.String()
}
func init() {
swag.Register(swag.Name, &s{})
}