未验证 提交 8d15ef08 编写于 作者: R Ray Zhou

Update resource API docs

上级 97195547
...@@ -64,7 +64,7 @@ func addWebService(c *restful.Container) error { ...@@ -64,7 +64,7 @@ func addWebService(c *restful.Container) error {
To(resources.ListNamespacedResources). To(resources.ListNamespacedResources).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Doc("Namespace level resource query"). Doc("Namespace level resource query").
Param(webservice.PathParameter("namespace", "which namespace")). Param(webservice.PathParameter("namespace", "the name of the project")).
Param(webservice.PathParameter("resources", "namespace level resource type, e.g. pods,jobs,configmaps,services.")). Param(webservice.PathParameter("resources", "namespace level resource type, e.g. pods,jobs,configmaps,services.")).
Param(webservice.QueryParameter(params.ConditionsParam, "query conditions,connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a"). Param(webservice.QueryParameter(params.ConditionsParam, "query conditions,connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
Required(false). Required(false).
...@@ -82,7 +82,7 @@ func addWebService(c *restful.Container) error { ...@@ -82,7 +82,7 @@ func addWebService(c *restful.Container) error {
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Doc("Rerun job whether the job is complete or not"). Doc("Rerun job whether the job is complete or not").
Param(webservice.PathParameter("job", "job name")). Param(webservice.PathParameter("job", "job name")).
Param(webservice.PathParameter("namespace", "job's namespace")). Param(webservice.PathParameter("namespace", "the namespace where the job runs in")).
Param(webservice.QueryParameter("a", "action")). Param(webservice.QueryParameter("a", "action")).
Returns(http.StatusOK, ok, errors.Error{})) Returns(http.StatusOK, ok, errors.Error{}))
...@@ -135,7 +135,7 @@ func addWebService(c *restful.Container) error { ...@@ -135,7 +135,7 @@ func addWebService(c *restful.Container) error {
Required(false). Required(false).
DataFormat("key=value,key~value"). DataFormat("key=value,key~value").
DefaultValue("")). DefaultValue("")).
Param(webservice.PathParameter("namespace", "namespace")). Param(webservice.PathParameter("namespace", "the name of the project")).
Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1"). Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
Required(false). Required(false).
DataFormat("limit=%d,page=%d"). DataFormat("limit=%d,page=%d").
...@@ -146,7 +146,7 @@ func addWebService(c *restful.Container) error { ...@@ -146,7 +146,7 @@ func addWebService(c *restful.Container) error {
Returns(http.StatusOK, ok, applications.Application{}). Returns(http.StatusOK, ok, applications.Application{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Doc("Describe the specified application of the namespace"). Doc("Describe the specified application of the namespace").
Param(webservice.PathParameter("namespace", "namespace name")). Param(webservice.PathParameter("namespace", "the name of the project")).
Param(webservice.PathParameter("application", "application ID"))) Param(webservice.PathParameter("application", "application ID")))
webservice.Route(webservice.POST("/namespaces/{namespace}/applications"). webservice.Route(webservice.POST("/namespaces/{namespace}/applications").
...@@ -155,14 +155,14 @@ func addWebService(c *restful.Container) error { ...@@ -155,14 +155,14 @@ func addWebService(c *restful.Container) error {
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Reads(openpitrix.CreateClusterRequest{}). Reads(openpitrix.CreateClusterRequest{}).
Returns(http.StatusOK, ok, errors.Error{}). Returns(http.StatusOK, ok, errors.Error{}).
Param(webservice.PathParameter("namespace", "namespace name"))) Param(webservice.PathParameter("namespace", "the name of the project")))
webservice.Route(webservice.DELETE("/namespaces/{namespace}/applications/{application}"). webservice.Route(webservice.DELETE("/namespaces/{namespace}/applications/{application}").
To(resources.DeleteApplication). To(resources.DeleteApplication).
Doc("Delete the specified application"). Doc("Delete the specified application").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Returns(http.StatusOK, ok, errors.Error{}). Returns(http.StatusOK, ok, errors.Error{}).
Param(webservice.PathParameter("namespace", "namespace name")). Param(webservice.PathParameter("namespace", "the name of the project")).
Param(webservice.PathParameter("application", "application ID"))) Param(webservice.PathParameter("application", "application ID")))
webservice.Route(webservice.GET("/users/{user}/kubectl"). webservice.Route(webservice.GET("/users/{user}/kubectl").
...@@ -205,7 +205,7 @@ func addWebService(c *restful.Container) error { ...@@ -205,7 +205,7 @@ func addWebService(c *restful.Container) error {
webservice.Route(webservice.GET("/namespaces/{namespace}/quotas"). webservice.Route(webservice.GET("/namespaces/{namespace}/quotas").
Doc("get specified namespace's resource quota and usage"). Doc("get specified namespace's resource quota and usage").
Param(webservice.PathParameter("namespace", "namespace's name")). Param(webservice.PathParameter("namespace", "the name of the project")).
Returns(http.StatusOK, ok, models.ResourceQuota{}). Returns(http.StatusOK, ok, models.ResourceQuota{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
To(quotas.GetNamespaceQuotas)) To(quotas.GetNamespaceQuotas))
...@@ -213,14 +213,14 @@ func addWebService(c *restful.Container) error { ...@@ -213,14 +213,14 @@ func addWebService(c *restful.Container) error {
webservice.Route(webservice.POST("registry/verify"). webservice.Route(webservice.POST("registry/verify").
To(registries.RegistryVerify). To(registries.RegistryVerify).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.VerificationTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.VerificationTag}).
Doc("docker registry verify"). Doc("verify if a user has access to the docker registry").
Reads(registriesmodel.AuthInfo{}). Reads(registriesmodel.AuthInfo{}).
Returns(http.StatusOK, ok, errors.Error{})) Returns(http.StatusOK, ok, errors.Error{}))
webservice.Route(webservice.POST("git/verify"). webservice.Route(webservice.POST("git/verify").
To(git.GitReadVerify). To(git.GitReadVerify).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.VerificationTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.VerificationTag}).
Doc("Verify that the kubernetes secret has read access to the git repository"). Doc("Verify if the kubernetes secret has read access to the git repository").
Reads(gitmodel.AuthInfo{}). Reads(gitmodel.AuthInfo{}).
Returns(http.StatusOK, ok, errors.Error{}), Returns(http.StatusOK, ok, errors.Error{}),
) )
...@@ -228,26 +228,26 @@ func addWebService(c *restful.Container) error { ...@@ -228,26 +228,26 @@ func addWebService(c *restful.Container) error {
webservice.Route(webservice.GET("/namespaces/{namespace}/daemonsets/{daemonset}/revisions/{revision}"). webservice.Route(webservice.GET("/namespaces/{namespace}/daemonsets/{daemonset}/revisions/{revision}").
To(revisions.GetDaemonSetRevision). To(revisions.GetDaemonSetRevision).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Doc("Handle daemonset operation"). Doc("Get the specified daemonset revision").
Param(webservice.PathParameter("daemonset", "daemonset's name")). Param(webservice.PathParameter("daemonset", "the name of the daemonset")).
Param(webservice.PathParameter("namespace", "daemonset's namespace")). Param(webservice.PathParameter("namespace", "the namespace of the daemonset")).
Param(webservice.PathParameter("revision", "daemonset's revision")). Param(webservice.PathParameter("revision", "the revision of the daemonset")).
Returns(http.StatusOK, ok, appsv1.DaemonSet{})) Returns(http.StatusOK, ok, appsv1.DaemonSet{}))
webservice.Route(webservice.GET("/namespaces/{namespace}/deployments/{deployment}/revisions/{revision}"). webservice.Route(webservice.GET("/namespaces/{namespace}/deployments/{deployment}/revisions/{revision}").
To(revisions.GetDeployRevision). To(revisions.GetDeployRevision).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Doc("Handle deployment operation"). Doc("Get the specified deployment revision").
Param(webservice.PathParameter("deployment", "deployment's name")). Param(webservice.PathParameter("deployment", "the name of deployment")).
Param(webservice.PathParameter("namespace", "deployment's namespace")). Param(webservice.PathParameter("namespace", "the namespace of the deployment")).
Param(webservice.PathParameter("revision", "deployment's revision")). Param(webservice.PathParameter("revision", "the revision of the deployment")).
Returns(http.StatusOK, ok, appsv1.ReplicaSet{})) Returns(http.StatusOK, ok, appsv1.ReplicaSet{}))
webservice.Route(webservice.GET("/namespaces/{namespace}/statefulsets/{statefulset}/revisions/{revision}"). webservice.Route(webservice.GET("/namespaces/{namespace}/statefulsets/{statefulset}/revisions/{revision}").
To(revisions.GetStatefulSetRevision). To(revisions.GetStatefulSetRevision).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Doc("Handle statefulset operation"). Doc("Get the specified statefulset revision").
Param(webservice.PathParameter("statefulset", "statefulset's name")). Param(webservice.PathParameter("statefulset", "the name of the statefulset")).
Param(webservice.PathParameter("namespace", "statefulset's namespace")). Param(webservice.PathParameter("namespace", "the namespace of the statefulset")).
Param(webservice.PathParameter("revision", "statefulset's revision")). Param(webservice.PathParameter("revision", "the revision of the statefulset")).
Returns(http.StatusOK, ok, appsv1.StatefulSet{})) Returns(http.StatusOK, ok, appsv1.StatefulSet{}))
webservice.Route(webservice.GET("/routers"). webservice.Route(webservice.GET("/routers").
...@@ -260,25 +260,25 @@ func addWebService(c *restful.Container) error { ...@@ -260,25 +260,25 @@ func addWebService(c *restful.Container) error {
To(routers.GetRouter). To(routers.GetRouter).
Doc("List router of a specified project"). Doc("List router of a specified project").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Param(webservice.PathParameter("namespace", "name of the project"))) Param(webservice.PathParameter("namespace", "the name of the project")))
webservice.Route(webservice.DELETE("/namespaces/{namespace}/router"). webservice.Route(webservice.DELETE("/namespaces/{namespace}/router").
To(routers.DeleteRouter). To(routers.DeleteRouter).
Doc("List router of a specified project"). Doc("List router of a specified project").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Param(webservice.PathParameter("namespace", "name of the project"))) Param(webservice.PathParameter("namespace", "the name of the project")))
webservice.Route(webservice.POST("/namespaces/{namespace}/router"). webservice.Route(webservice.POST("/namespaces/{namespace}/router").
To(routers.CreateRouter). To(routers.CreateRouter).
Doc("Create a router for a specified project"). Doc("Create a router for a specified project").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Param(webservice.PathParameter("namespace", "name of the project"))) Param(webservice.PathParameter("namespace", "the name of the project")))
webservice.Route(webservice.PUT("/namespaces/{namespace}/router"). webservice.Route(webservice.PUT("/namespaces/{namespace}/router").
To(routers.UpdateRouter). To(routers.UpdateRouter).
Doc("Update a router for a specified project"). Doc("Update a router for a specified project").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Param(webservice.PathParameter("namespace", "name of the project"))) Param(webservice.PathParameter("namespace", "the name of the project")))
webservice.Route(webservice.GET("/abnormalworkloads"). webservice.Route(webservice.GET("/abnormalworkloads").
Doc("get abnormal workloads' count of whole cluster"). Doc("get abnormal workloads' count of whole cluster").
...@@ -287,7 +287,7 @@ func addWebService(c *restful.Container) error { ...@@ -287,7 +287,7 @@ func addWebService(c *restful.Container) error {
To(workloadstatuses.GetClusterAbnormalWorkloads)) To(workloadstatuses.GetClusterAbnormalWorkloads))
webservice.Route(webservice.GET("/namespaces/{namespace}/abnormalworkloads"). webservice.Route(webservice.GET("/namespaces/{namespace}/abnormalworkloads").
Doc("get abnormal workloads' count of specified namespace"). Doc("get abnormal workloads' count of specified namespace").
Param(webservice.PathParameter("namespace", "the name of namespace")). Param(webservice.PathParameter("namespace", "the name of the project")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}). Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
Returns(http.StatusOK, ok, status.WorkLoadStatus{}). Returns(http.StatusOK, ok, status.WorkLoadStatus{}).
To(workloadstatuses.GetNamespacedAbnormalWorkloads)) To(workloadstatuses.GetNamespacedAbnormalWorkloads))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册