Doc("TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.").
Reads(iam.TokenReview{}).
Writes(iam.TokenReview{}).
Doc("k8s token review").
Returns(http.StatusOK,ok,iam.TokenReview{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.POST("/login").
To(iam.LoginHandler).
Doc("User login").
Doc("KubeSphere APIs support token-based authentication via the Authtoken request header. The POST Login API is used to retrieve the authentication token. After the authentication token is obtained, it must be inserted into the Authtoken header for all requests.").
Reads(iam.LoginRequest{}).
Writes(models.Token{}).
Returns(http.StatusOK,ok,models.Token{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.GET("/users/{username}").
To(iam.DescribeUser).
Doc("User detail").
Doc("Describes the specified user.").
Param(ws.PathParameter("username","username")).
Writes(models.User{}).
Returns(http.StatusOK,ok,models.User{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.POST("/users").
To(iam.CreateUser).
Doc("Create a user account.").
Reads(models.User{}).
Writes(errors.Error{}).
Doc("Create user").
Returns(http.StatusOK,ok,errors.Error{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.DELETE("/users/{name}").
To(iam.DeleteUser).
Doc("Remove a specified user.").
Param(ws.PathParameter("name","username")).
Doc("Delete user").
Writes(errors.Error{}).
Returns(http.StatusOK,ok,errors.Error{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.PUT("/users/{name}").
To(iam.UpdateUser).
Doc("Updates information about the specified user.").
Param(ws.PathParameter("name","username")).
Reads(models.User{}).
Writes(errors.Error{}).
Doc("Update user").
Returns(http.StatusOK,ok,errors.Error{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.GET("/users/{name}/log").
To(iam.UserLoginLog).
Doc("This method is used to retrieve the \"login logs\" for the specified user.").
Param(ws.PathParameter("name","username")).
Doc("User login log").
Writes([]map[string]string{}).
Returns(http.StatusOK,ok,struct{
LoginTimestring`json:"login_time"`
LoginIPstring`json:"login_ip"`
}{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.GET("/users").
To(iam.ListUsers).
Doc("User list").
Writes(models.PageableResponse{}).
Doc("List all users.").
Returns(http.StatusOK,ok,pageableUserList).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.GET("/groups").
To(iam.ListGroups).
Writes([]models.Group{}).
Doc("User group list").
Doc("List all user groups.").
Returns(http.StatusOK,ok,[]models.Group{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.GET("/groups/{path}").
To(iam.DescribeGroup).
Param(ws.PathParameter("path","group path")).
Doc("User group detail").
Doc("Describes the specified user group.").
Param(ws.PathParameter("path","user group path separated by colon.")).
Returns(http.StatusOK,ok,models.Group{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.GET("/groups/{path}/users").
To(iam.ListGroupUsers).
Param(ws.PathParameter("path","group path")).
Doc("Group user list").
Doc("List all users in the specified user group.").
Param(ws.PathParameter("path","user group path separated by colon.")).
Returns(http.StatusOK,ok,[]models.User{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.POST("/groups").
To(iam.CreateGroup).
Doc("Create a user group.").
Reads(models.Group{}).
Doc("Create user group").
Returns(http.StatusOK,ok,models.Group{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.DELETE("/groups/{path}").
To(iam.DeleteGroup).
Param(ws.PathParameter("path","group path")).
Doc("Delete user group").
Doc("Delete a user group.").
Param(ws.PathParameter("path","user group path separated by colon.")).
Returns(http.StatusOK,ok,errors.Error{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.PUT("/groups/{path}").
To(iam.UpdateGroup).
Param(ws.PathParameter("path","group path")).
Doc("Update user group").
Doc("Updates information about the user group.").
Param(ws.PathParameter("path","user group path separated by colon.")).
Reads(models.Group{}).
Returns(http.StatusOK,ok,models.Group{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.GET("/users/{username}/roles").
To(iam.ListUserRoles).
Doc("This method is used to retrieve all the roles that are assigned to the user.").
Param(ws.PathParameter("username","username")).
Doc("Get user role list").
Returns(http.StatusOK,ok,iam.RoleList{}).
Metadata(restfulspec.KeyOpenAPITags,tags))
ws.Route(ws.GET("/namespaces/{namespace}/roles").
To(iam.ListRoles).
Param(ws.PathParameter("namespace","namespace")).
Doc("Get role list").
Doc("This method is used to retrieve the roles that are assigned to the user in the specified namespace.").