refactor application controller
Signed-off-by: zackzhang <zackzhang@yunify.com>
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/emicklei/go-restful-openapi"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/runtime"
|
||||
_ "net/http"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
const groupName = "servicemesh.kubesphere.io"
|
||||
@@ -125,6 +125,8 @@ func AddToContainer(c *restful.Container) error {
|
||||
Param(webservice.QueryParameter("groupBy", "app box grouping characteristic. Available groupings: [app, none, version].").DefaultValue("none")).
|
||||
Param(webservice.QueryParameter("queryTime", "from which time point in UNIX timestamp, default now")).
|
||||
Param(webservice.QueryParameter("injectServiceNodes", "flag for injecting the requested service node between source and destination nodes.").DefaultValue("false")).
|
||||
Returns(http.StatusBadRequest, "bad request", BadRequestError{}).
|
||||
Returns(http.StatusNotFound, "not found", NotFoundError{}).
|
||||
Produces(restful.MIME_JSON))
|
||||
|
||||
// Get namespace health
|
||||
@@ -135,6 +137,8 @@ func AddToContainer(c *restful.Container) error {
|
||||
Param(webservice.PathParameter("namespace", "name of a namespace").Required(true)).
|
||||
Param(webservice.QueryParameter("rateInterval", "the rate interval used for fetching error rate").DefaultValue("10m").Required(true)).
|
||||
Param(webservice.QueryParameter("queryTime", "the time to use for query")).
|
||||
Returns(http.StatusBadRequest, "bad request", BadRequestError{}).
|
||||
Returns(http.StatusNotFound, "not found", NotFoundError{}).
|
||||
Produces(restful.MIME_JSON))
|
||||
|
||||
// Get workloads health
|
||||
|
||||
40
pkg/kapis/servicemesh/metrics/v1alpha2/swagger-doc.go
Normal file
40
pkg/kapis/servicemesh/metrics/v1alpha2/swagger-doc.go
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright 2020 KubeSphere 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 v1alpha2
|
||||
|
||||
/////////////////////
|
||||
// SWAGGER RESPONSES
|
||||
/////////////////////
|
||||
|
||||
// NoContent: the response is empty
|
||||
type NoContent struct {
|
||||
Status int32 `json:"status"`
|
||||
Reason error `json:"reason"`
|
||||
}
|
||||
|
||||
// BadRequestError: the client request is incorrect
|
||||
type BadRequestError struct {
|
||||
Status int32 `json:"status"`
|
||||
Reason error `json:"reason"`
|
||||
}
|
||||
|
||||
// NotFoundError is the error message that is generated when server could not find
|
||||
// what was requested
|
||||
type NotFoundError struct {
|
||||
Status int32 `json:"status"`
|
||||
Reason error `json:"reason"`
|
||||
}
|
||||
Reference in New Issue
Block a user