refine api docs

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2020-10-22 18:43:14 +08:00
parent 44799ae68a
commit 496db42be6
36 changed files with 1725 additions and 2399 deletions

View File

@@ -43,7 +43,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.GET("/applications").
To(handler.ListApplications).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Doc("List all applications").
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).
@@ -57,7 +57,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.GET("/workspaces/{workspace}/namespaces/{namespace}/applications").
To(handler.ListApplications).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Doc("List all applications within the specified namespace").
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).
@@ -72,7 +72,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.GET("/workspaces/{workspace}/namespaces/{namespace}/applications/{application}").
To(handler.DescribeApplication).
Returns(http.StatusOK, api.StatusOK, openpitrix2.Application{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Doc("Describe the specified application of the namespace").
Param(webservice.PathParameter("namespace", "the name of the project").Required(true)).
Param(webservice.PathParameter("application", "the id of the application").Required(true)))
@@ -80,7 +80,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.GET("/workspaces/{workspace}/clusters/{cluster}/applications").
To(handler.ListApplications).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Doc("List all applications in special cluster").
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).
@@ -95,7 +95,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.GET("/workspaces/{workspace}/clusters/{cluster}/namespaces/{namespace}/applications").
To(handler.ListApplications).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Doc("List all applications within the specified namespace").
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).
@@ -111,7 +111,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.GET("/workspaces/{workspace}/clusters/{cluster}/namespaces/{namespace}/applications/{application}").
To(handler.DescribeApplication).
Returns(http.StatusOK, api.StatusOK, openpitrix2.Application{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Doc("Describe the specified application of the namespace").
Param(webservice.PathParameter("cluster", "the name of the cluster.").Required(true)).
Param(webservice.PathParameter("namespace", "the name of the project").Required(true)).
@@ -120,7 +120,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.POST("/workspaces/{workspace}/clusters/{cluster}/namespaces/{namespace}/applications").
To(handler.CreateApplication).
Doc("Deploy a new application").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Reads(openpitrix2.CreateClusterRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("cluster", "the name of the cluster.").Required(true)).
@@ -130,7 +130,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Consumes(mimePatch...).
To(handler.ModifyApplication).
Doc("Modify application").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Reads(openpitrix2.ModifyClusterAttributesRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("cluster", "the name of the cluster.").Required(true)).
@@ -140,7 +140,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.DELETE("/workspaces/{workspace}/clusters/{cluster}/namespaces/{namespace}/applications/{application}").
To(handler.DeleteApplication).
Doc("Delete the specified application").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("cluster", "the name of the cluster.").Required(true)).
Param(webservice.PathParameter("namespace", "the name of the project").Required(true)).
@@ -150,7 +150,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Consumes(mimePatch...).
To(handler.UpgradeApplication).
Doc("Upgrade application").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppInstanceTag}).
Reads(openpitrix2.UpgradeClusterRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("cluster", "the name of the cluster.").Required(true)).
@@ -160,7 +160,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.POST("/apps/{app}/versions").
To(handler.CreateAppVersion).
Doc("Create a new app template version").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Reads(openpitrix2.CreateAppVersionRequest{}).
Param(webservice.QueryParameter("validate", "Validate format of package(pack by op tool)")).
Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateAppVersionResponse{}).
@@ -168,7 +168,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.POST("/workspaces/{workspace}/apps/{app}/versions").
To(handler.CreateAppVersion).
Doc("Create a new app template version").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Reads(openpitrix2.CreateAppVersionRequest{}).
Param(webservice.QueryParameter("validate", "Validate format of package(pack by op tool)")).
Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateAppVersionResponse{}).
@@ -176,14 +176,14 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.DELETE("/apps/{app}/versions/{version}").
To(handler.DeleteAppVersion).
Doc("Delete the specified app template version").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.DELETE("/workspaces/{workspace}/apps/{app}/versions/{version}").
To(handler.DeleteAppVersion).
Doc("Delete the specified app template version").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
@@ -191,7 +191,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Consumes(mimePatch...).
To(handler.ModifyAppVersion).
Doc("Patch the specified app template version").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Reads(openpitrix2.ModifyAppVersionRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("version", "app template version id")).
@@ -200,7 +200,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Consumes(mimePatch...).
To(handler.ModifyAppVersion).
Doc("Patch the specified app template version").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Reads(openpitrix2.ModifyAppVersionRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("version", "app template version id")).
@@ -208,7 +208,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
webservice.Route(webservice.GET("/apps/{app}/versions/{version}").
To(handler.DescribeAppVersion).
Doc("Describe the specified app template version").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersion{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
@@ -225,12 +225,12 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Param(webservice.PathParameter("app", "app template id")).
Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
webservice.Route(webservice.GET("/workspaces/{workspace}/apps/{app}/versions/{version}").
To(handler.DescribeAppVersion).
Doc("Describe the specified app template version").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersion{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
@@ -247,19 +247,19 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Param(webservice.PathParameter("app", "app template id")).
Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
webservice.Route(webservice.GET("/workspaces/{workspace}/apps/{app}/versions/{version}/audits").
To(handler.ListAppVersionAudits).
Doc("List audits information of version-specific app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionAudit{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.GET("/apps/{app}/versions/{version}/audits").
To(handler.ListAppVersionAudits).
Doc("List audits information of version-specific app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionAudit{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
@@ -267,27 +267,27 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
To(handler.GetAppVersionPackage).
Doc("Get packages of version-specific app").
Returns(http.StatusOK, api.StatusOK, openpitrix2.GetAppVersionPackageResponse{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.POST("/apps/{app}/versions/{version}/action").
To(handler.DoAppVersionAction).
Doc("Perform submit or other operations on app").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.POST("/workspaces/{workspace}/apps/{app}/versions/{version}/action").
To(handler.DoAppVersionAction).
Doc("Perform submit or other operations on app").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.GET("/apps/{app}/versions/{version}/files").
To(handler.GetAppVersionFiles).
Doc("Get app template package files").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.GetAppVersionPackageFilesResponse{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
@@ -301,45 +301,45 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Required(false).
DataFormat("limit=%d,page=%d").
DefaultValue("limit=10,page=1")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionReview{}))
webservice.Route(webservice.GET("/apps/{app}/audits").
To(handler.ListAppVersionAudits).
Doc("List audits information of the specific app template").
Param(webservice.PathParameter("app", "app template id")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionAudit{}))
webservice.Route(webservice.POST("/apps").
To(handler.CreateApp).
Doc("Create a new app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateAppResponse{}).
Reads(openpitrix2.CreateAppRequest{}).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.POST("/workspaces/{workspace}/apps").
To(handler.CreateApp).
Doc("Create a new app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateAppResponse{}).
Reads(openpitrix2.CreateAppRequest{}).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.DELETE("/apps/{app}").
To(handler.DeleteApp).
Doc("Delete the specified app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.DELETE("/workspaces/{workspace}/apps/{app}").
To(handler.DeleteApp).
Doc("Delete the specified app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.PATCH("/apps/{app}").
Consumes(mimePatch...).
To(handler.ModifyApp).
Doc("Patch the specified app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Reads(openpitrix2.ModifyAppVersionRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("app", "app template id")))
@@ -347,33 +347,33 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Consumes(mimePatch...).
To(handler.ModifyApp).
Doc("Patch the specified app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Reads(openpitrix2.ModifyAppVersionRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.GET("/workspaces/{workspace}/apps/{app}").
To(handler.DescribeApp).
Doc("Describe the specified app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersion{}).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.GET("/apps/{app}").
To(handler.DescribeApp).
Doc("Describe the specified app template").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersion{}).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.POST("/apps/{app}/action").
To(handler.DoAppAction).
Doc("Perform recover or suspend operation on app").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.POST("/workspaces/{workspace}/apps/{app}/action").
To(handler.DoAppAction).
Doc("Perform recover or suspend operation on app").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("version", "app template version id")).
Param(webservice.PathParameter("app", "app template id")))
@@ -389,7 +389,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
DefaultValue("limit=10,page=1")).
Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
webservice.Route(webservice.GET("/workspaces/{workspace}/apps").
To(handler.ListApps).
@@ -404,33 +404,33 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
DefaultValue("limit=10,page=1")).
Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAppTemplateTag}).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
webservice.Route(webservice.POST("/categories").
To(handler.CreateCategory).
Doc("Create app template category").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixCategoryTag}).
Reads(openpitrix2.CreateCategoryRequest{}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateCategoryResponse{}).
Param(webservice.PathParameter("app", "app template id")))
webservice.Route(webservice.DELETE("/categories/{category}").
To(handler.DeleteCategory).
Doc("Delete the specified category").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixCategoryTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("category", "category id")))
webservice.Route(webservice.PATCH("/categories/{category}").
Consumes(mimePatch...).
To(handler.ModifyCategory).
Doc("Patch the specified category").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixCategoryTag}).
Reads(openpitrix2.ModifyCategoryRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("category", "category id")))
webservice.Route(webservice.GET("/categories/{category}").
To(handler.DescribeCategory).
Doc("Describe the specified category").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixCategoryTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.Category{}).
Param(webservice.PathParameter("category", "category id")))
webservice.Route(webservice.GET("/categories").
@@ -445,47 +445,47 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
DefaultValue("limit=10,page=1")).
Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixCategoryTag}).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
webservice.Route(webservice.GET("/attachments/{attachment}").
To(handler.DescribeAttachment).
Doc("Get attachment by attachment id").
Param(webservice.PathParameter("attachment", "attachment id")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixAttachmentTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.Attachment{}))
webservice.Route(webservice.POST("/repos").
To(handler.CreateRepo).
Doc("Create repository in the specified workspace, repository used to store package of app").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Param(webservice.QueryParameter("validate", "Validate repository")).
Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateRepoResponse{}).
Reads(openpitrix2.CreateRepoRequest{}))
webservice.Route(webservice.POST("/workspaces/{workspace}/repos").
To(handler.CreateRepo).
Doc("Create repository in the specified workspace, repository used to store package of app").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Param(webservice.QueryParameter("validate", "Validate repository")).
Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateRepoResponse{}).
Reads(openpitrix2.CreateRepoRequest{}))
webservice.Route(webservice.DELETE("/repos/{repo}").
To(handler.DeleteRepo).
Doc("Delete the specified repository in the specified workspace").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("repo", "repo id")))
webservice.Route(webservice.DELETE("/workspaces/{workspace}/repos/{repo}").
To(handler.DeleteRepo).
Doc("Delete the specified repository in the specified workspace").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("repo", "repo id")))
webservice.Route(webservice.PATCH("/repos/{repo}").
Consumes(mimePatch...).
To(handler.ModifyRepo).
Doc("Patch the specified repository in the specified workspace").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Reads(openpitrix2.ModifyRepoRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("repo", "repo id")))
@@ -493,20 +493,20 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Consumes(mimePatch...).
To(handler.ModifyRepo).
Doc("Patch the specified repository in the specified workspace").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Reads(openpitrix2.ModifyRepoRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Param(webservice.PathParameter("repo", "repo id")))
webservice.Route(webservice.GET("/repos/{repo}").
To(handler.DescribeRepo).
Doc("Describe the specified repository in the specified workspace").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.Repo{}).
Param(webservice.PathParameter("repo", "repo id")))
webservice.Route(webservice.GET("/workspaces/{workspace}/repos/{repo}").
To(handler.DescribeRepo).
Doc("Describe the specified repository in the specified workspace").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Returns(http.StatusOK, api.StatusOK, openpitrix2.Repo{}).
Param(webservice.PathParameter("repo", "repo id")))
webservice.Route(webservice.GET("/repos").
@@ -520,7 +520,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
DataFormat("limit=%d,page=%d").
DefaultValue("limit=10,page=1")).
Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
webservice.Route(webservice.GET("/workspaces/{workspace}/repos").
@@ -535,7 +535,7 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
DefaultValue("limit=10,page=1")).
Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
webservice.Route(webservice.POST("/repos/{repo}/action").
@@ -543,26 +543,26 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, op
Doc("Start index repository event").
Reads(openpitrix2.RepoActionRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Param(webservice.PathParameter("repo", "repo id")))
webservice.Route(webservice.POST("/workspaces/{workspace}/repos/{repo}/action").
To(handler.DoRepoAction).
Doc("Start index repository event").
Reads(openpitrix2.RepoActionRequest{}).
Returns(http.StatusOK, api.StatusOK, errors.Error{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixManagementTag}).
Param(webservice.PathParameter("repo", "repo id")))
webservice.Route(webservice.GET("/repos/{repo}/events").
To(handler.ListRepoEvents).
Doc("Get repository events").
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Param(webservice.PathParameter("repo", "repo id")))
webservice.Route(webservice.GET("/workspaces/{workspace}/repos/{repo}/events").
To(handler.ListRepoEvents).
Doc("Get repository events").
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixRepositoryTag}).
Param(webservice.PathParameter("repo", "repo id")))
c.Add(webservice)