提交 ae8ee99d 编写于 作者: R runzexia 提交者: zryfish

update api docs

Signed-off-by: Nrunzexia <runzexia@yunify.com>
上级 aec4146c
......@@ -50,34 +50,34 @@ func addWebService(c *restful.Container) error {
webservice.Route(webservice.GET("/devops/{devops}").
To(devopsapi.GetDevOpsProjectHandler).
Doc("Get devops project").
Doc("Get a DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Returns(http.StatusOK, RespOK, devops.DevOpsProject{}).
Writes(devops.DevOpsProject{}))
webservice.Route(webservice.PATCH("/devops/{devops}").
To(devopsapi.UpdateProjectHandler).
Doc("Update devops project").
Doc("Update a DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Reads(devops.DevOpsProject{}).
Returns(http.StatusOK, RespOK, devops.DevOpsProject{}).
Writes(devops.DevOpsProject{}))
webservice.Route(webservice.GET("/devops/{devops}/defaultroles").
To(devopsapi.GetDevOpsProjectDefaultRoles).
Doc("Get devops project default roles").
Doc("Get DevOps Project Build-in Roles Info").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Returns(http.StatusOK, RespOK, []devops.Role{}).
Writes([]devops.Role{}))
webservice.Route(webservice.GET("/devops/{devops}/members").
To(devopsapi.GetDevOpsProjectMembersHandler).
Doc("Get devops project members").
Doc("Get members of the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.QueryParameter(params.PagingParam, "page").
Required(false).
DataFormat("limit=%d,page=%d").
......@@ -88,131 +88,131 @@ func addWebService(c *restful.Container) error {
Returns(http.StatusOK, RespOK, []devops.DevOpsProjectMembership{}).
Writes([]devops.DevOpsProjectMembership{}))
webservice.Route(webservice.GET("/devops/{devops}/members/{members}").
webservice.Route(webservice.GET("/devops/{devops}/members/{member}").
To(devopsapi.GetDevOpsProjectMemberHandler).
Doc("Get devops project member").
Doc("Get a Member of the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("members", "member's username")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("member", "Member's username, e.g. admin")).
Returns(http.StatusOK, RespOK, devops.DevOpsProjectMembership{}).
Writes(devops.DevOpsProjectMembership{}))
webservice.Route(webservice.POST("/devops/{devops}/members").
To(devopsapi.AddDevOpsProjectMemberHandler).
Doc("Add devops project members").
Doc("Add a member of the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Returns(http.StatusOK, RespOK, devops.DevOpsProjectMembership{}).
Writes(devops.DevOpsProjectMembership{}))
webservice.Route(webservice.PATCH("/devops/{devops}/members/{members}").
webservice.Route(webservice.PATCH("/devops/{devops}/members/{member}").
To(devopsapi.UpdateDevOpsProjectMemberHandler).
Doc("Update devops project members").
Doc("Update a member of the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("members", "member's username")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("member", "Member's username, e.g. admin")).
Reads(devops.DevOpsProjectMembership{}).
Writes(devops.DevOpsProjectMembership{}))
webservice.Route(webservice.DELETE("/devops/{devops}/members/{members}").
webservice.Route(webservice.DELETE("/devops/{devops}/members/{member}").
To(devopsapi.DeleteDevOpsProjectMemberHandler).
Doc("Delete devops project members").
Doc("Delete a member of the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("members", "member's username")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("member", "Member's username, e.g. admin")).
Writes(devops.DevOpsProjectMembership{}))
webservice.Route(webservice.POST("/devops/{devops}/pipelines").
To(devopsapi.CreateDevOpsProjectPipelineHandler).
Doc("Add devops project pipeline").
Param(webservice.PathParameter("devops", "devops project's Id")).
Doc("Add DevOps Project pipeline").
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Metadata(restfulspec.KeyOpenAPITags, tags).
Returns(http.StatusOK, RespOK, devops.ProjectPipeline{}).
Writes(devops.ProjectPipeline{}).
Reads(devops.ProjectPipeline{}))
webservice.Route(webservice.PUT("/devops/{devops}/pipelines/{pipelines}").
webservice.Route(webservice.PUT("/devops/{devops}/pipelines/{pipeline}").
To(devopsapi.UpdateDevOpsProjectPipelineHandler).
Doc("Update devops project pipeline").
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")).
Doc("Update DevOps Project pipeline").
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("pipeline", "The name of pipeline, e.g. sample-pipeline")).
Metadata(restfulspec.KeyOpenAPITags, tags).
Returns(http.StatusOK, RespOK, devops.ProjectPipeline{}).
Writes(devops.ProjectPipeline{}).
Reads(devops.ProjectPipeline{}))
webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipelines}/config").
webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/config").
To(devopsapi.GetDevOpsProjectPipelineHandler).
Doc("Get devops project pipeline config").
Doc("Get the configuration information of a pipeline under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("pipeline", "The name of pipeline, e.g. sample-pipeline")).
Returns(http.StatusOK, RespOK, devops.ProjectPipeline{}).
Writes(devops.ProjectPipeline{}))
webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipelines}/sonarStatus").
webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/sonarStatus").
To(devopsapi.GetPipelineSonarStatusHandler).
Doc("Get devops project pipeline sonarStatus").
Doc("Get the sonar quality information of a pipeline under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("pipeline", "the name of pipeline, e.g. sample-pipeline")).
Returns(http.StatusOK, RespOK, []devops.SonarStatus{}).
Writes([]devops.SonarStatus{}))
webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipelines}/branches/{branches}/sonarStatus").
webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipelines}/branches/{branch}/sonarStatus").
To(devopsapi.GetMultiBranchesPipelineSonarStatusHandler).
Doc("Get devops project pipeline sonarStatus").
Doc("Get the sonar quality check information for a pipeline branch under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")).
Param(webservice.PathParameter("branches", "branch name")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("pipelines", "the name of pipeline, e.g. sample-pipeline")).
Param(webservice.PathParameter("branch", "branch name, e.g. master")).
Returns(http.StatusOK, RespOK, []devops.SonarStatus{}).
Writes([]devops.SonarStatus{}))
webservice.Route(webservice.DELETE("/devops/{devops}/pipelines/{pipelines}").
webservice.Route(webservice.DELETE("/devops/{devops}/pipelines/{pipeline}").
To(devopsapi.DeleteDevOpsProjectPipelineHandler).
Doc("Delete devops project pipeline").
Doc("Delete a pipeline under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")))
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("pipeline", "The name of pipeline, e.g. sample-pipeline")))
webservice.Route(webservice.POST("/devops/{devops}/credentials").
To(devopsapi.CreateDevOpsProjectCredentialHandler).
Doc("Add project credential pipeline").
Doc("Create a Credential under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Reads(devops.JenkinsCredential{}))
webservice.Route(webservice.PUT("/devops/{devops}/credentials/{credentials}").
webservice.Route(webservice.PUT("/devops/{devops}/credentials/{credential}").
To(devopsapi.UpdateDevOpsProjectCredentialHandler).
Doc("Update project credential pipeline").
Doc("Update a Credential under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("credentials", "credential's Id")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("credentials", "Credential's Id, e.g. dockerhub-id")).
Reads(devops.JenkinsCredential{}))
webservice.Route(webservice.DELETE("/devops/{devops}/credentials/{credentials}").
webservice.Route(webservice.DELETE("/devops/{devops}/credentials/{credential}").
To(devopsapi.DeleteDevOpsProjectCredentialHandler).
Doc("delete project credential pipeline").
Doc("Delete a Credential under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("credentials", "credential's Id")))
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("credential", "credential's Id, e.g. dockerhub-id")))
webservice.Route(webservice.GET("/devops/{devops}/credentials/{credentials}").
webservice.Route(webservice.GET("/devops/{devops}/credentials/{credential}").
To(devopsapi.GetDevOpsProjectCredentialHandler).
Doc("Get project credential pipeline").
Doc("Get a Credential under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("credentials", "credential's Id")).
Param(webservice.QueryParameter("content", "get additional content")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Param(webservice.PathParameter("credential", "Credential's Id, e.g. dockerhub-id")).
Param(webservice.QueryParameter("content", "Get extra content, if not none will get credential's content")).
Returns(http.StatusOK, RespOK, devops.JenkinsCredential{}).
Reads(devops.JenkinsCredential{}))
webservice.Route(webservice.GET("/devops/{devops}/credentials").
To(devopsapi.GetDevOpsProjectCredentialsHandler).
Doc("Get project credential pipeline").
Doc("Get Credentials under the DevOps Project").
Metadata(restfulspec.KeyOpenAPITags, tags).
Param(webservice.PathParameter("devops", "devops project's Id")).
Param(webservice.PathParameter("devops", "DevOps Project's Id, e.g. project-RRRRAzLBlLEm")).
Returns(http.StatusOK, RespOK, []devops.JenkinsCredential{}).
Reads([]devops.JenkinsCredential{}))
......
......@@ -58,7 +58,7 @@ func GetDevOpsProjectMemberHandler(request *restful.Request, resp *restful.Respo
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
member := request.PathParameter("members")
member := request.PathParameter("member")
err := devops.CheckProjectUserInRole(username, projectId, devops.AllRoleSlice)
if err != nil {
......@@ -132,7 +132,7 @@ func UpdateDevOpsProjectMemberHandler(request *restful.Request, resp *restful.Re
errors.ParseSvcErr(restful.NewError(http.StatusBadRequest, err.Error()), resp)
return
}
member.Username = request.PathParameter("members")
member.Username = request.PathParameter("member")
if govalidator.IsNull(member.Username) {
err := fmt.Errorf("error need username")
glog.Errorf("%+v", err)
......@@ -175,7 +175,7 @@ func DeleteDevOpsProjectMemberHandler(request *restful.Request, resp *restful.Re
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
member := request.PathParameter("members")
member := request.PathParameter("member")
err := devops.CheckProjectUserInRole(username, projectId, []string{devops.ProjectOwner})
if err != nil {
......
......@@ -57,7 +57,7 @@ func UpdateDevOpsProjectCredentialHandler(request *restful.Request, resp *restfu
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
credentialId := request.PathParameter("credentials")
credentialId := request.PathParameter("credential")
var credential *devops.JenkinsCredential
err := request.ReadEntity(&credential)
if err != nil {
......@@ -89,7 +89,7 @@ func DeleteDevOpsProjectCredentialHandler(request *restful.Request, resp *restfu
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
credentialId := request.PathParameter("credentials")
credentialId := request.PathParameter("credential")
var credential *devops.JenkinsCredential
err := request.ReadEntity(&credential)
if err != nil {
......@@ -121,7 +121,7 @@ func GetDevOpsProjectCredentialHandler(request *restful.Request, resp *restful.R
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
credentialId := request.PathParameter("credentials")
credentialId := request.PathParameter("credential")
getContent := request.QueryParameter("content")
domain := request.QueryParameter("domain")
......
......@@ -56,7 +56,7 @@ func CreateDevOpsProjectPipelineHandler(request *restful.Request, resp *restful.
func DeleteDevOpsProjectPipelineHandler(request *restful.Request, resp *restful.Response) {
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
pipelineId := request.PathParameter("pipelines")
pipelineId := request.PathParameter("pipeline")
err := devops.CheckProjectUserInRole(username, projectId, []string{devops.ProjectOwner, devops.ProjectMaintainer})
if err != nil {
......@@ -82,7 +82,7 @@ func UpdateDevOpsProjectPipelineHandler(request *restful.Request, resp *restful.
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
pipelineId := request.PathParameter("pipelines")
pipelineId := request.PathParameter("pipeline")
var pipeline *devops.ProjectPipeline
err := request.ReadEntity(&pipeline)
if err != nil {
......@@ -114,7 +114,7 @@ func GetDevOpsProjectPipelineHandler(request *restful.Request, resp *restful.Res
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
pipelineId := request.PathParameter("pipelines")
pipelineId := request.PathParameter("pipeline")
err := devops.CheckProjectUserInRole(username, projectId, []string{devops.ProjectOwner, devops.ProjectMaintainer})
if err != nil {
......@@ -137,7 +137,7 @@ func GetDevOpsProjectPipelineHandler(request *restful.Request, resp *restful.Res
func GetPipelineSonarStatusHandler(request *restful.Request, resp *restful.Response) {
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
pipelineId := request.PathParameter("pipelines")
pipelineId := request.PathParameter("pipeline")
err := devops.CheckProjectUserInRole(username, projectId, devops.AllRoleSlice)
if err != nil {
glog.Errorf("%+v", err)
......@@ -157,7 +157,7 @@ func GetMultiBranchesPipelineSonarStatusHandler(request *restful.Request, resp *
projectId := request.PathParameter("devops")
username := request.HeaderParameter(constants.UserNameHeader)
pipelineId := request.PathParameter("pipelines")
branchId := request.PathParameter("branches")
branchId := request.PathParameter("branch")
err := devops.CheckProjectUserInRole(username, projectId, devops.AllRoleSlice)
if err != nil {
glog.Errorf("%+v", err)
......
......@@ -21,10 +21,10 @@ const (
)
type DevOpsProjectMembership struct {
Username string `json:"username" description:"member's username,username can uniquely identify a user"`
ProjectId string `json:"project_id" db:"project_id" description:"the devops projects which project membership belongs to"`
Role string `json:"role" description:"devops project membership's role type. e.g. owner '"`
Status string `json:"status" description:"Desperated, status of project membership. e.g. active "`
Username string `json:"username" description:"Member's username,username can uniquely identify a user"`
ProjectId string `json:"project_id" db:"project_id" description:"the DevOps Projects which project membership belongs to"`
Role string `json:"role" description:"DevOps Project membership's role type. e.g. owner '"`
Status string `json:"status" description:"Desperated, Status of project membership. e.g. active "`
GrantBy string `json:"grand_by,omitempty" description:"Username of the user who assigned the role"`
}
......
......@@ -37,11 +37,11 @@ type PageableDevOpsProject struct {
}
type DevOpsProject struct {
ProjectId string `json:"project_id" db:"project_id" description:"ProjectId must be unique within a namespace, it is generated by kubesphere."`
ProjectId string `json:"project_id" db:"project_id" description:"ProjectId must be unique within a workspace, it is generated by kubesphere."`
Name string `json:"name" description:"DevOps Projects's Name'"`
Name string `json:"name" description:"DevOps Projects's Name"`
Description string `json:"description,omitempty" description:"DevOps Projets's Description, used to describe the DevOps Project'"`
Description string `json:"description,omitempty" description:"DevOps Projects's Description, used to describe the DevOps Project'"`
Creator string `json:"creator" description:"Creator's username'"`
......
......@@ -26,30 +26,30 @@ const (
)
type JenkinsCredential struct {
Id string `json:"id" description:"id of credential"`
Type string `json:"type" description:"type of credential,such as ssh/kubeconfig"`
DisplayName string `json:"display_name,omitempty" description:"credential's display name'"`
Id string `json:"id" description:"Id of Credential, e.g. dockerhub-id"`
Type string `json:"type" description:"Type of Credential, e.g. ssh/kubeconfig"`
DisplayName string `json:"display_name,omitempty" description:"Credential's display name'"`
Fingerprint *struct {
FileName string `json:"file_name,omitempty" description:"credential's display name and description"`
Hash string `json:"hash,omitempty" description:"credential's hash'"`
FileName string `json:"file_name,omitempty" description:"Credential's display name and description"`
Hash string `json:"hash,omitempty" description:"Credential's hash"`
Usage []*struct {
Name string `json:"name,omitempty" description:"jenkins pipeline full name"`
Name string `json:"name,omitempty" description:"Jenkins pipeline full name"`
Ranges struct {
Ranges []*struct {
Start int `json:"start,omitempty" description:"start build number"`
End int `json:"end,omitempty" description:"end build number"`
Start int `json:"start,omitempty" description:"Start build number"`
End int `json:"end,omitempty" description:"End build number"`
} `json:"ranges,omitempty"`
} `json:"ranges,omitempty" description:"all build num using credential"`
} `json:"usage,omitempty" description:"all usage of credential"`
} `json:"fingerprint,omitempty" description:"usage of credential"`
Description string `json:"description,omitempty" description:"credential's description'"`
Domain string `json:"domain,omitempty" description:"credential's domain,In ks we only use the default domain, default '_''"`
CreateTime *time.Time `json:"create_time,omitempty" description:"credential's create_time'"`
Creator string `json:"creator,omitempty" description:"creator's username"`
UsernamePasswordCredential *UsernamePasswordCredential `json:"username_password,omitempty" description:"username password credential struct"`
SshCredential *SshCredential `json:"ssh,omitempty" description:"ssh credential struct"`
SecretTextCredential *SecretTextCredential `json:"secret_text,omitempty" description:"secret_text credential struct"`
KubeconfigCredential *KubeconfigCredential `json:"kubeconfig,omitempty" description:"kubeconfig credential struct"`
} `json:"ranges,omitempty" description:"The build number of all pipelines that use this credential"`
} `json:"usage,omitempty" description:"all usage of Credential"`
} `json:"fingerprint,omitempty" description:"usage of the Credential"`
Description string `json:"description,omitempty" description:"Credential's description'"`
Domain string `json:"domain,omitempty" description:"Credential's domain,In ks we only use the default domain, default '_''"`
CreateTime *time.Time `json:"create_time,omitempty" description:"Credential's create_time'"`
Creator string `json:"creator,omitempty" description:"Creator's username"`
UsernamePasswordCredential *UsernamePasswordCredential `json:"username_password,omitempty" description:"username password Credential struct"`
SshCredential *SshCredential `json:"ssh,omitempty" description:"ssh Credential struct"`
SecretTextCredential *SecretTextCredential `json:"secret_text,omitempty" description:"secret_text Credential struct"`
KubeconfigCredential *KubeconfigCredential `json:"kubeconfig,omitempty" description:"kubeconfig Credential struct"`
}
type UsernamePasswordCredential struct {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册