fix some swagger json errors (#2869)
Signed-off-by: Jeff <zw0948@gmail.com>
This commit is contained in:
@@ -280,7 +280,6 @@ func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops
|
||||
Doc("Get steps details inside a activity node. For a node, the steps which defined inside the node.").
|
||||
Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")).
|
||||
Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")).
|
||||
Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")).
|
||||
Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")).
|
||||
Returns(http.StatusOK, RespOK, []devops.NodesDetail{}).
|
||||
Writes(devops.NodesDetail{}))
|
||||
@@ -484,9 +483,7 @@ func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops
|
||||
Produces("text/html; charset=utf-8").
|
||||
Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")).
|
||||
Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")).
|
||||
Param(webservice.QueryParameter("delay", "the delay time to scan").
|
||||
Required(false).
|
||||
DataFormat("delay=%d")))
|
||||
Param(webservice.QueryParameter("delay", "the delay time to scan").Required(false).DataFormat("delay=%d")))
|
||||
|
||||
// match /job/project-8QnvykoJw4wZ/job/test-1/indexing/consoleText
|
||||
webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/consolelog").
|
||||
@@ -520,9 +517,7 @@ func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsScmTag}).
|
||||
Doc("List all organizations of the specified source configuration management (SCM) such as Github.").
|
||||
Param(webservice.PathParameter("scm", "the ID of the source configuration management (SCM).")).
|
||||
Param(webservice.QueryParameter("credentialId", "credential ID for source configuration management (SCM).").
|
||||
Required(true).
|
||||
DataFormat("credentialId=%s")).
|
||||
Param(webservice.QueryParameter("credentialId", "credential ID for source configuration management (SCM).").Required(true).DataFormat("credentialId=%s")).
|
||||
Returns(http.StatusOK, RespOK, []devops.SCMOrg{}).
|
||||
Writes([]devops.SCMOrg{}))
|
||||
|
||||
@@ -533,15 +528,9 @@ func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops
|
||||
Doc("List all repositories in the specified organization.").
|
||||
Param(webservice.PathParameter("scm", "The ID of the source configuration management (SCM).")).
|
||||
Param(webservice.PathParameter("organization", "organization ID, such as github username.")).
|
||||
Param(webservice.QueryParameter("credentialId", "credential ID for SCM.").
|
||||
Required(true).
|
||||
DataFormat("credentialId=%s")).
|
||||
Param(webservice.QueryParameter("pageNumber", "page number.").
|
||||
Required(true).
|
||||
DataFormat("pageNumber=%d")).
|
||||
Param(webservice.QueryParameter("pageSize", "the item count of one page.").
|
||||
Required(true).
|
||||
DataFormat("pageSize=%d")).
|
||||
Param(webservice.QueryParameter("credentialId", "credential ID for SCM.").Required(true).DataFormat("credentialId=%s")).
|
||||
Param(webservice.QueryParameter("pageNumber", "page number.").Required(true).DataFormat("pageNumber=%d")).
|
||||
Param(webservice.QueryParameter("pageSize", "the item count of one page.").Required(true).DataFormat("pageSize=%d")).
|
||||
Returns(http.StatusOK, RespOK, devops.OrgRepo{}).
|
||||
Writes(devops.OrgRepo{}))
|
||||
|
||||
@@ -570,9 +559,7 @@ func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsWebhookTag}).
|
||||
Doc("Get commit notification by HTTP GET method. Git webhook will request here.").
|
||||
Produces("text/plain; charset=utf-8").
|
||||
Param(webservice.QueryParameter("url", "Git url").
|
||||
Required(true).
|
||||
DataFormat("url=%s")))
|
||||
Param(webservice.QueryParameter("url", "Git url").Required(true).DataFormat("url=%s")))
|
||||
|
||||
// Gitlab or some other scm managers can only use HTTP method. match /git/notifyCommit/?url=
|
||||
webservice.Route(webservice.POST("/webhook/git").
|
||||
@@ -581,9 +568,7 @@ func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops
|
||||
Doc("Get commit notification by HTTP POST method. Git webhook will request here.").
|
||||
Consumes("application/json").
|
||||
Produces("text/plain; charset=utf-8").
|
||||
Param(webservice.QueryParameter("url", "Git url").
|
||||
Required(true).
|
||||
DataFormat("url=%s")))
|
||||
Param(webservice.QueryParameter("url", "Git url").Required(true).DataFormat("url=%s")))
|
||||
|
||||
webservice.Route(webservice.POST("/webhook/github").
|
||||
To(projectPipelineHandler.GithubWebhook).
|
||||
@@ -595,9 +580,7 @@ func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops
|
||||
To(projectPipelineHandler.CheckScriptCompile).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}).
|
||||
Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")).
|
||||
Param(webservice.QueryParameter("pipeline", "the name of the CI/CD pipeline").
|
||||
Required(false).
|
||||
DataFormat("pipeline=%s")).
|
||||
Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline").DataFormat("pipeline=%s")).
|
||||
Consumes("application/x-www-form-urlencoded", "charset=utf-8").
|
||||
Produces("application/json", "charset=utf-8").
|
||||
Doc("Check pipeline script compile.").
|
||||
@@ -609,7 +592,6 @@ func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops
|
||||
To(projectPipelineHandler.CheckCron).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}).
|
||||
Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")).
|
||||
Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")).
|
||||
Produces("application/json", "charset=utf-8").
|
||||
Doc("Check cron script compile.").
|
||||
Reads(devops.CronData{}).
|
||||
@@ -705,7 +687,8 @@ func AddJenkinsToContainer(webservice *restful.WebService, devopsClient devops.I
|
||||
return err
|
||||
}
|
||||
parse.Path = strings.Trim(parse.Path, "/")
|
||||
webservice.Route(webservice.GET("/jenkins/{path:*}").
|
||||
webservice.Route(webservice.GET("/jenkins/{path:[*]}").
|
||||
Param(webservice.PathParameter("path", "Path stands for any suffix path.")).
|
||||
To(func(request *restful.Request, response *restful.Response) {
|
||||
u := request.Request.URL
|
||||
u.Host = parse.Host
|
||||
|
||||
@@ -74,7 +74,6 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
|
||||
ws.Route(ws.GET("/devops/{devops}/credentials/{credential}").
|
||||
To(handler.GetCredential).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("devops", "project name")).
|
||||
Param(ws.PathParameter("credential", "pipeline name")).
|
||||
Doc("get the credential of the specified devops for the current user").
|
||||
@@ -83,7 +82,6 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
|
||||
ws.Route(ws.PUT("/devops/{devops}/credentials/{credential}").
|
||||
To(handler.UpdateCredential).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("devops", "project name")).
|
||||
Param(ws.PathParameter("credential", "credential name")).
|
||||
Doc("put the credential of the specified devops for the current user").
|
||||
@@ -119,6 +117,7 @@ func AddToContainer(container *restful.Container, devopsClient devopsClient.Inte
|
||||
|
||||
ws.Route(ws.GET("/devops/{devops}/pipelines/{pipeline}").
|
||||
To(handler.GetPipeline).
|
||||
Operation("getPipelineByName").
|
||||
Param(ws.PathParameter("devops", "project name")).
|
||||
Param(ws.PathParameter("pipeline", "pipeline name")).
|
||||
Doc("get the pipeline of the specified devops for the current user").
|
||||
|
||||
@@ -76,13 +76,16 @@ func AddToContainer(container *restful.Container, im im.IdentityManagementInterf
|
||||
Param(ws.PathParameter("user", "username")).
|
||||
Returns(http.StatusOK, api.StatusOK, iamv1alpha2.User{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AccessManagementTag}))
|
||||
|
||||
ws.Route(ws.GET("/users").
|
||||
To(handler.ListUsers).
|
||||
Doc("List all users in global scope.").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{iamv1alpha2.User{}}}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AccessManagementTag}))
|
||||
|
||||
ws.Route(ws.GET("/users/{user}/loginrecords").
|
||||
To(handler.ListUserLoginRecords).
|
||||
Param(ws.PathParameter("user", "username of the user")).
|
||||
Doc("List user's login records.").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{iamv1alpha2.LoginRecord{}}}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AccessManagementTag}))
|
||||
@@ -261,6 +264,7 @@ func AddToContainer(container *restful.Container, im im.IdentityManagementInterf
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AccessManagementTag}))
|
||||
ws.Route(ws.GET("/globalroles/{globalrole}").
|
||||
To(handler.DescribeGlobalRole).
|
||||
Param(ws.PathParameter("globalrole", "global role name")).
|
||||
Doc("Retrieve global role details.").
|
||||
Returns(http.StatusOK, api.StatusOK, iamv1alpha2.GlobalRole{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AccessManagementTag}))
|
||||
@@ -299,6 +303,7 @@ func AddToContainer(container *restful.Container, im im.IdentityManagementInterf
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AccessManagementTag}))
|
||||
ws.Route(ws.GET("/clusterroles/{clusterrole}").
|
||||
To(handler.DescribeClusterRole).
|
||||
Param(ws.PathParameter("clusterrole", "cluster role name")).
|
||||
Doc("Retrieve cluster role details.").
|
||||
Returns(http.StatusOK, api.StatusOK, rbacv1.ClusterRole{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AccessManagementTag}))
|
||||
|
||||
@@ -32,11 +32,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
GroupName = "monitoring.kubesphere.io"
|
||||
RespOK = "ok"
|
||||
groupName = "monitoring.kubesphere.io"
|
||||
respOK = "ok"
|
||||
)
|
||||
|
||||
var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha3"}
|
||||
var GroupVersion = schema.GroupVersion{Group: groupName, Version: "v1alpha3"}
|
||||
|
||||
func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monitoringClient monitoring.Interface, factory informers.InformerFactory, opClient openpitrix.Client) error {
|
||||
ws := runtime.NewWebService(GroupVersion)
|
||||
@@ -48,7 +48,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Doc("Get platform-level metric data.").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.KubeSphereMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/cluster").
|
||||
@@ -61,7 +61,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.ClusterMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/nodes").
|
||||
@@ -79,7 +79,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NodeMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/nodes/{node}").
|
||||
@@ -93,7 +93,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NodeMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/workspaces").
|
||||
@@ -111,7 +111,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.WorkspaceMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}").
|
||||
@@ -126,7 +126,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("type", "Additional operations. Currently available types is statistics. It retrieves the total number of namespaces, devops projects, members and roles in this workspace at the moment.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.WorkspaceMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/namespaces").
|
||||
@@ -145,7 +145,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces").
|
||||
@@ -163,7 +163,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}").
|
||||
@@ -177,7 +177,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/workloads").
|
||||
@@ -196,7 +196,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.WorkloadMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/workloads/{kind}").
|
||||
@@ -216,7 +216,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.WorkloadMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/pods").
|
||||
@@ -235,7 +235,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.PodMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}").
|
||||
@@ -250,7 +250,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.PodMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/workloads/{kind}/{workload}/pods").
|
||||
@@ -271,7 +271,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.PodMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/nodes/{node}/pods").
|
||||
@@ -290,7 +290,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.PodMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/nodes/{node}/pods/{pod}").
|
||||
@@ -305,7 +305,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.PodMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}/containers").
|
||||
@@ -325,7 +325,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.ContainerMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/pods/{pod}/containers/{container}").
|
||||
@@ -341,14 +341,14 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.ContainerMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/storageclasses/{storageclass}/persistentvolumeclaims").
|
||||
To(h.handlePVCMetricsQuery).
|
||||
Doc("Get PVC-level metric data of the specific storageclass's PVCs.").
|
||||
Param(ws.PathParameter("storageclass", "The name of the storageclass.").DataType("string").Required(true)).
|
||||
Param(ws.PathParameter("metrics_filter", "The metric name filter consists of a regexp pattern. It specifies which metric data to return. For example, the following filter matches both PVC available and used inodes: `pvc_inodes_available|pvc_inodes_used`. View available metrics at [kubesphere.io](https://docs.kubesphere.io/advanced-v2.0/zh-CN/api-reference/monitoring-metrics/).").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("metrics_filter", "The metric name filter consists of a regexp pattern. It specifies which metric data to return. For example, the following filter matches both PVC available and used inodes: `pvc_inodes_available|pvc_inodes_used`. View available metrics at [kubesphere.io](https://docs.kubesphere.io/advanced-v2.0/zh-CN/api-reference/monitoring-metrics/).").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("resources_filter", "The PVC filter consists of a regexp pattern. It specifies which PVC data to return. For example, the following filter matches any pod whose name begins with redis: `redis.*`.").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("start", "Start time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1559347200. ").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("end", "End time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1561939200. ").DataType("string").Required(false)).
|
||||
@@ -360,14 +360,14 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.PVCMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/persistentvolumeclaims").
|
||||
To(h.handlePVCMetricsQuery).
|
||||
Doc("Get PVC-level metric data of the specific namespace's PVCs.").
|
||||
Param(ws.PathParameter("namespace", "The name of the namespace.").DataType("string").Required(true)).
|
||||
Param(ws.PathParameter("metrics_filter", "The metric name filter consists of a regexp pattern. It specifies which metric data to return. For example, the following filter matches both PVC available and used inodes: `pvc_inodes_available|pvc_inodes_used`. View available metrics at [kubesphere.io](https://docs.kubesphere.io/advanced-v2.0/zh-CN/api-reference/monitoring-metrics/).").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("metrics_filter", "The metric name filter consists of a regexp pattern. It specifies which metric data to return. For example, the following filter matches both PVC available and used inodes: `pvc_inodes_available|pvc_inodes_used`. View available metrics at [kubesphere.io](https://docs.kubesphere.io/advanced-v2.0/zh-CN/api-reference/monitoring-metrics/).").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("resources_filter", "The PVC filter consists of a regexp pattern. It specifies which PVC data to return. For example, the following filter matches any pod whose name begins with redis: `redis.*`.").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("start", "Start time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1559347200. ").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("end", "End time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1561939200. ").DataType("string").Required(false)).
|
||||
@@ -379,7 +379,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("limit", "Page size, the maximum number of results in a single page. Defaults to 5.").DataType("integer").Required(false).DefaultValue("5")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.PVCMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/persistentvolumeclaims/{pvc}").
|
||||
@@ -387,14 +387,14 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Doc("Get PVC-level metric data of a specific PVC. Navigate to the PVC by the PVC's namespace.").
|
||||
Param(ws.PathParameter("namespace", "The name of the namespace.").DataType("string").Required(true)).
|
||||
Param(ws.PathParameter("pvc", "PVC name.").DataType("string").Required(true)).
|
||||
Param(ws.PathParameter("metrics_filter", "The metric name filter consists of a regexp pattern. It specifies which metric data to return. For example, the following filter matches both PVC available and used inodes: `pvc_inodes_available|pvc_inodes_used`. View available metrics at [kubesphere.io](https://docs.kubesphere.io/advanced-v2.0/zh-CN/api-reference/monitoring-metrics/).").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("metrics_filter", "The metric name filter consists of a regexp pattern. It specifies which metric data to return. For example, the following filter matches both PVC available and used inodes: `pvc_inodes_available|pvc_inodes_used`. View available metrics at [kubesphere.io](https://docs.kubesphere.io/advanced-v2.0/zh-CN/api-reference/monitoring-metrics/).").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("start", "Start time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1559347200. ").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("end", "End time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1561939200. ").DataType("string").Required(false)).
|
||||
Param(ws.QueryParameter("step", "Time interval. Retrieve metric data at a fixed interval within the time range of start and end. It requires both **start** and **end** are provided. The format is [0-9]+[smhdwy]. Defaults to 10m (i.e. 10 min).").DataType("string").DefaultValue("10m").Required(false)).
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.PVCMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/components/{component}").
|
||||
@@ -408,7 +408,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.ComponentMetricsTag}).
|
||||
Writes(model.Metrics{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metrics{})).
|
||||
Returns(http.StatusOK, respOK, model.Metrics{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/targets/metadata").
|
||||
@@ -417,7 +417,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.PathParameter("namespace", "The name of the namespace.").DataType("string").Required(true)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomMetricsTag}).
|
||||
Writes(model.Metadata{}).
|
||||
Returns(http.StatusOK, RespOK, model.Metadata{})).
|
||||
Returns(http.StatusOK, respOK, model.Metadata{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/targets/labelsets").
|
||||
@@ -429,7 +429,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("end", "End time of query. It is a string with Unix time format, eg. 1561939200. ").DataType("string").Required(true)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomMetricsTag}).
|
||||
Writes(model.MetricLabelSet{}).
|
||||
Returns(http.StatusOK, RespOK, model.MetricLabelSet{})).
|
||||
Returns(http.StatusOK, respOK, model.MetricLabelSet{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/targets/query").
|
||||
@@ -443,7 +443,7 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
|
||||
Param(ws.QueryParameter("time", "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.").DataType("string").Required(false)).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomMetricsTag}).
|
||||
Writes(monitoring.Metric{}).
|
||||
Returns(http.StatusOK, RespOK, monitoring.Metric{})).
|
||||
Returns(http.StatusOK, respOK, monitoring.Metric{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
c.Add(ws)
|
||||
|
||||
@@ -24,9 +24,9 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
const GroupName = "servicemesh.kubesphere.io"
|
||||
const groupName = "servicemesh.kubesphere.io"
|
||||
|
||||
var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"}
|
||||
var GroupVersion = schema.GroupVersion{Group: groupName, Version: "v1alpha2"}
|
||||
|
||||
func AddToContainer(c *restful.Container) error {
|
||||
|
||||
@@ -52,8 +52,8 @@ func AddToContainer(c *restful.Container) error {
|
||||
Param(webservice.QueryParameter("byLabels[]", "list of labels to use for grouping metrics(via Prometheus 'by' clause), e.g. source_workload, destination_service_name").DefaultValue("[]")).
|
||||
Param(webservice.QueryParameter("requestProtocol", "request protocol for the telemetry, e.g. http/tcp/grpc").DefaultValue("all protocols")).
|
||||
Param(webservice.QueryParameter("reporter", "istio telemetry reporter, 'source' or 'destination'").DefaultValue("source")).
|
||||
Returns(http.StatusOK, "ok", MetricsResponse{}).
|
||||
Writes(MetricsResponse{})).Produces(restful.MIME_JSON)
|
||||
Returns(http.StatusOK, "ok", metricsResponse{}).
|
||||
Writes(metricsResponse{})).Produces(restful.MIME_JSON)
|
||||
|
||||
// Get app metrics
|
||||
// Get /namespaces/{namespace}/apps/{app}/metrics
|
||||
@@ -73,8 +73,8 @@ func AddToContainer(c *restful.Container) error {
|
||||
Param(webservice.QueryParameter("byLabels[]", "list of labels to use for grouping metrics(via Prometheus 'by' clause), e.g. source_workload, destination_service_name").DefaultValue("[]")).
|
||||
Param(webservice.QueryParameter("requestProtocol", "request protocol for the telemetry, e.g. http/tcp/grpc").DefaultValue("all protocols")).
|
||||
Param(webservice.QueryParameter("reporter", "istio telemetry reporter, 'source' or 'destination'").DefaultValue("source")).
|
||||
Returns(http.StatusOK, "ok", MetricsResponse{}).
|
||||
Writes(MetricsResponse{})).
|
||||
Returns(http.StatusOK, "ok", metricsResponse{}).
|
||||
Writes(metricsResponse{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
// Get workload metrics
|
||||
@@ -85,7 +85,6 @@ func AddToContainer(c *restful.Container) error {
|
||||
Doc("Get workload metrics from a specific namespace").
|
||||
Param(webservice.PathParameter("namespace", "name of the namespace").Required(true)).
|
||||
Param(webservice.PathParameter("workload", "name of the workload").Required(true)).
|
||||
Param(webservice.PathParameter("service", "name of the service")).
|
||||
Param(webservice.QueryParameter("filters[]", "type of metrics type, fetch all metrics when empty, e.g. request_count, request_duration, request_error_count").DefaultValue("[]")).
|
||||
Param(webservice.QueryParameter("queryTime", "from which UNIX time to extract metrics")).
|
||||
Param(webservice.QueryParameter("duration", "duration of the query period, in seconds").DefaultValue("1800")).
|
||||
@@ -96,8 +95,8 @@ func AddToContainer(c *restful.Container) error {
|
||||
Param(webservice.QueryParameter("byLabels[]", "list of labels to use for grouping metrics(via Prometheus 'by' clause), e.g. source_workload, destination_service_name").DefaultValue("[]")).
|
||||
Param(webservice.QueryParameter("requestProtocol", "request protocol for the telemetry, e.g. http/tcp/grpc").DefaultValue("all protocols")).
|
||||
Param(webservice.QueryParameter("reporter", "istio telemetry reporter, 'source' or 'destination'").DefaultValue("source")).
|
||||
Returns(http.StatusOK, "ok", MetricsResponse{}).
|
||||
Writes(MetricsResponse{})).
|
||||
Returns(http.StatusOK, "ok", metricsResponse{}).
|
||||
Writes(metricsResponse{})).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
// Get namespace metrics
|
||||
@@ -107,7 +106,6 @@ func AddToContainer(c *restful.Container) error {
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Doc("Get metrics from a specific namespace").
|
||||
Param(webservice.PathParameter("namespace", "name of the namespace").Required(true)).
|
||||
Param(webservice.PathParameter("service", "name of the service")).
|
||||
Param(webservice.QueryParameter("filters[]", "type of metrics type, fetch all metrics when empty, e.g. request_count, request_duration, request_error_count").DefaultValue("[]")).
|
||||
Param(webservice.QueryParameter("queryTime", "from which UNIX time to extract metrics")).
|
||||
Param(webservice.QueryParameter("duration", "duration of the query period, in seconds").DefaultValue("1800")).
|
||||
@@ -118,8 +116,8 @@ func AddToContainer(c *restful.Container) error {
|
||||
Param(webservice.QueryParameter("byLabels[]", "list of labels to use for grouping metrics(via Prometheus 'by' clause), e.g. source_workload, destination_service_name").DefaultValue("[]")).
|
||||
Param(webservice.QueryParameter("requestProtocol", "request protocol for the telemetry, e.g. http/tcp/grpc").DefaultValue("all protocols")).
|
||||
Param(webservice.QueryParameter("reporter", "istio telemetry reporter, 'source' or 'destination'").DefaultValue("source")).
|
||||
Returns(http.StatusOK, "ok", MetricsResponse{}).
|
||||
Writes(MetricsResponse{})).Produces(restful.MIME_JSON)
|
||||
Returns(http.StatusOK, "ok", metricsResponse{}).
|
||||
Writes(metricsResponse{})).Produces(restful.MIME_JSON)
|
||||
|
||||
// Get namespace graph
|
||||
// Get /namespaces/{namespace}/graph
|
||||
@@ -135,8 +133,8 @@ func AddToContainer(c *restful.Container) error {
|
||||
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{}).
|
||||
Returns(http.StatusOK, "ok", GraphResponse{}).
|
||||
Writes(GraphResponse{})).Produces(restful.MIME_JSON)
|
||||
Returns(http.StatusOK, "ok", graphResponse{}).
|
||||
Writes(graphResponse{})).Produces(restful.MIME_JSON)
|
||||
|
||||
// Get namespaces graph, for multiple namespaces
|
||||
// Get /namespaces/graph
|
||||
@@ -151,8 +149,8 @@ func AddToContainer(c *restful.Container) error {
|
||||
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{}).
|
||||
Returns(http.StatusOK, "ok", GraphResponse{}).
|
||||
Writes(GraphResponse{})).Produces(restful.MIME_JSON)
|
||||
Returns(http.StatusOK, "ok", graphResponse{}).
|
||||
Writes(graphResponse{})).Produces(restful.MIME_JSON)
|
||||
|
||||
// Get namespace health
|
||||
webservice.Route(webservice.GET("/namespaces/{namespace}/health").
|
||||
@@ -160,7 +158,6 @@ func AddToContainer(c *restful.Container) error {
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Doc("Get app/service/workload health of a namespace").
|
||||
Param(webservice.PathParameter("namespace", "name of a namespace").Required(true)).
|
||||
Param(webservice.PathParameter("type", "the type of health, app/service/workload, default app").DefaultValue("app")).
|
||||
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{}).
|
||||
|
||||
@@ -45,7 +45,7 @@ type NotFoundError struct {
|
||||
Reason error `json:"reason"`
|
||||
}
|
||||
|
||||
type GraphResponse struct {
|
||||
type graphResponse struct {
|
||||
cytoscape.Config
|
||||
}
|
||||
|
||||
@@ -65,6 +65,6 @@ type appHealthResponse struct {
|
||||
models.AppHealth
|
||||
}
|
||||
|
||||
type MetricsResponse struct {
|
||||
type metricsResponse struct {
|
||||
prometheus.Metrics
|
||||
}
|
||||
|
||||
@@ -60,76 +60,91 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, k8s
|
||||
Doc("List clusters available to users").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.POST("/workspaces").
|
||||
To(handler.CreateWorkspace).
|
||||
Reads(tenantv1alpha2.WorkspaceTemplate{}).
|
||||
Returns(http.StatusOK, api.StatusOK, tenantv1alpha2.WorkspaceTemplate{}).
|
||||
Doc("Create workspace.").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.DELETE("/workspaces/{workspace}").
|
||||
To(handler.DeleteWorkspace).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Returns(http.StatusOK, api.StatusOK, errors.None).
|
||||
Doc("Delete workspace.").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.PUT("/workspaces/{workspace}").
|
||||
To(handler.UpdateWorkspace).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Reads(tenantv1alpha2.WorkspaceTemplate{}).
|
||||
Returns(http.StatusOK, api.StatusOK, tenantv1alpha2.WorkspaceTemplate{}).
|
||||
Doc("Update workspace.").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.PATCH("/workspaces/{workspace}").
|
||||
To(handler.PatchWorkspace).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Consumes(mimePatch...).
|
||||
Reads(tenantv1alpha2.WorkspaceTemplate{}).
|
||||
Returns(http.StatusOK, api.StatusOK, tenantv1alpha2.WorkspaceTemplate{}).
|
||||
Doc("Update workspace.").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces").
|
||||
To(handler.ListWorkspaces).
|
||||
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
|
||||
Doc("List all workspaces that belongs to the current user").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}").
|
||||
To(handler.DescribeWorkspace).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Returns(http.StatusOK, api.StatusOK, tenantv1alpha2.WorkspaceTemplate{}).
|
||||
Doc("Describe workspace.").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/clusters").
|
||||
To(handler.ListWorkspaceClusters).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Doc("List clusters authorized to the specified workspace.").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/namespaces").
|
||||
To(handler.ListNamespaces).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Doc("List the namespaces for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/federatednamespaces").
|
||||
To(handler.ListFederatedNamespaces).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Doc("List the federated namespaces for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/federatednamespaces").
|
||||
To(handler.ListFederatedNamespaces).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Doc("List the federated namespaces of the specified workspace for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/namespaces").
|
||||
To(handler.ListNamespaces).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Doc("List the namespaces of the specified workspace for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/devops").
|
||||
To(handler.ListDevOpsProjects).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Doc("List the devops projects of the specified workspace for the current user").
|
||||
Returns(http.StatusOK, api.StatusOK, api.ListResult{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/workspacemembers/{workspacemember}/devops").
|
||||
To(handler.ListDevOpsProjects).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
@@ -138,18 +153,23 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, k8s
|
||||
Reads(corev1.Namespace{}).
|
||||
Returns(http.StatusOK, api.StatusOK, corev1.Namespace{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/namespaces/{namespace}").
|
||||
To(handler.DescribeNamespace).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("namespace", "project name")).
|
||||
Doc("Retrieve namespace details.").
|
||||
Returns(http.StatusOK, api.StatusOK, corev1.Namespace{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.DELETE("/workspaces/{workspace}/namespaces/{namespace}").
|
||||
To(handler.DeleteNamespace).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("namespace", "project name")).
|
||||
Doc("Delete namespace.").
|
||||
Returns(http.StatusOK, api.StatusOK, errors.None).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.POST("/workspaces/{workspace}/namespaces").
|
||||
To(handler.CreateNamespace).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
@@ -157,6 +177,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, k8s
|
||||
Reads(corev1.Namespace{}).
|
||||
Returns(http.StatusOK, api.StatusOK, corev1.Namespace{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/workspacemembers/{workspacemember}/namespaces").
|
||||
To(handler.ListNamespaces).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
@@ -165,16 +186,20 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, k8s
|
||||
Reads(corev1.Namespace{}).
|
||||
Returns(http.StatusOK, api.StatusOK, corev1.Namespace{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.PUT("/workspaces/{workspace}/namespaces/{namespace}").
|
||||
To(handler.UpdateNamespace).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("namespace", "project name")).
|
||||
Reads(corev1.Namespace{}).
|
||||
Returns(http.StatusOK, api.StatusOK, corev1.Namespace{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
ws.Route(ws.PATCH("/workspaces/{workspace}/namespaces/{namespace}").
|
||||
To(handler.PatchNamespace).
|
||||
Consumes(mimePatch...).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("namespace", "project name")).
|
||||
Reads(corev1.Namespace{}).
|
||||
Returns(http.StatusOK, api.StatusOK, corev1.Namespace{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TenantResourcesTag}))
|
||||
|
||||
@@ -41,6 +41,8 @@ func AddToContainer(c *restful.Container, client kubernetes.Interface, config *r
|
||||
|
||||
webservice.Route(webservice.GET("/namespaces/{namespace}/pods/{pod}").
|
||||
To(handler.handleTerminalSession).
|
||||
Param(webservice.PathParameter("namespace", "namespace of which the pod located in")).
|
||||
Param(webservice.PathParameter("pod", "name of the pod")).
|
||||
Doc("create terminal session").
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.TerminalTag}).
|
||||
Writes(models.PodInfo{}))
|
||||
|
||||
Reference in New Issue
Block a user