[FIX] Fix a url set bug in swagger.json production

[REV]Update swagger json
This commit is contained in:
崔斌 2017-11-15 19:19:59 +08:00
parent 3757599e5c
commit b0f9b09025
4 changed files with 30 additions and 46 deletions

View File

@ -1678,6 +1678,30 @@
}
},
"/v2/tenants/{tenant_name}/plugin/{plugin_id}/default-env": {
"get": {
"description": "get plugin env",
"consumes": [
"application/json",
"application/x-protobuf"
],
"produces": [
"application/json",
"application/xml"
],
"tags": [
"v2"
],
"summary": "获取插件默认设定的env",
"operationId": "getPluginDefaultEnv",
"responses": {
"default": {
"description": "统一返回格式",
"schema": {
"$ref": "#/responses/commandResponse"
}
}
}
},
"put": {
"description": "update default env",
"consumes": [
@ -1847,48 +1871,6 @@
}
}
},
"/v2/tenants/{tenant_name}/plugin/{plugin_id}/envs": {
"get": {
"description": "get plugin env",
"consumes": [
"application/json",
"application/x-protobuf"
],
"produces": [
"application/json",
"application/xml"
],
"tags": [
"v2"
],
"summary": "获取插件设定的env",
"operationId": "getPluginEnv",
"parameters": [
{
"type": "string",
"x-go-name": "TenantName",
"name": "tenant_name",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "PluginID",
"name": "plugin_id",
"in": "path",
"required": true
}
],
"responses": {
"default": {
"description": "统一返回格式",
"schema": {
"$ref": "#/responses/commandResponse"
}
}
}
}
},
"/v2/tenants/{tenant_name}/resources": {
"get": {
"description": "get tenant resources",

View File

@ -21,6 +21,7 @@ package controller
import (
"net/http"
"github.com/Sirupsen/logrus"
"github.com/goodrain/rainbond/pkg/api/handler"
"github.com/goodrain/rainbond/pkg/api/middleware"
@ -566,9 +567,9 @@ func (t *TenantStruct) DeletePluginRelation(w http.ResponseWriter, r *http.Reque
//GetPluginDefaultEnvs GetPluginDefaultEnvs
func (t *TenantStruct) GetPluginDefaultEnvs(w http.ResponseWriter, r *http.Request) {
// swagger:operation GET /v2/tenants/{tenant_name}/plugin/{plugin_id}/envs v2 getPluginEnv
// swagger:operation GET /v2/tenants/{tenant_name}/plugin/{plugin_id}/default-env v2 getPluginDefaultEnv
//
// 获取插件设定的env
// 获取插件默认设定的env
//
// get plugin env
//
@ -619,6 +620,7 @@ func (t *TenantStruct) GePluginEnvWhichCanBeSet(w http.ResponseWriter, r *http.R
// description: 统一返回格式
serviceID := r.Context().Value(middleware.ContextKey("service_id")).(string)
pluginID := chi.URLParam(r, "plugin_id")
logrus.Debugf("plugin_Id is %s", pluginID)
envs, err := handler.GetPluginManager().GetEnvsWhichCanBeSet(serviceID, pluginID)
if err != nil {
err.Handle(r, w)

View File

@ -234,7 +234,7 @@ func (p *PluginAction) GetEnvsWhichCanBeSet(serviceID, pluginID string) (interfa
if len(envs) > 0 {
return envs, nil
}
envD, errD := db.GetManager().TenantPluginDefaultENVDao().GetDefaultENVSByPluginIDCantBeSet(pluginID)
envD, errD := db.GetManager().TenantPluginDefaultENVDao().GetDefaultEnvWhichCanBeSetByPluginID(pluginID)
if errD != nil {
return nil, util.CreateAPIHandleErrorFromDBError("get envs which can be set", errD)
}

View File

@ -330,7 +330,7 @@ type DeletePluginSetStruct struct {
}
//GetPluginEnvStruct GetPluginEnvStruct
//swagger:parameters getPluginEnv
//swagger:parameters getPluginEnv, getPluginDefaultEnv
type GetPluginEnvStruct struct {
// in: path
// required: true