Documentation
¶
Index ¶
- func AddClusterRoleToUser(rancherClient *rancher.Client, cluster *management.Cluster, ...) error
- func AddProjectMember(rancherClient *rancher.Client, project *management.Project, ...) error
- func CreateUserWithRole(rancherClient *rancher.Client, user *management.User, roles ...string) (*management.User, error)
- func GetUserIDByName(client *rancher.Client, username string) (string, error)
- func RemoveClusterRoleFromUser(rancherClient *rancher.Client, user *management.User) error
- func RemoveProjectMember(rancherClient *rancher.Client, user *management.User) error
- func UserConfig() (user *management.User)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddClusterRoleToUser ¶
func AddClusterRoleToUser(rancherClient *rancher.Client, cluster *management.Cluster, user *management.User, clusterRole string, attrs []*authzv1.ResourceAttributes, ) error
AddClusterRoleToUser is a helper function that adds a cluster role to `user`. If a list of ResourceAttributes is given, then the function blocks until all attributes are allowed by SelfSubjectAccessReviews OR the function times out.
func AddProjectMember ¶
func AddProjectMember(rancherClient *rancher.Client, project *management.Project, user *management.User, projectRole string, attrs []*authzv1.ResourceAttributes, ) error
AddProjectMember is a helper function that adds a project role to `user`. It uses the watch.WatchWait to ensure BackingNamespaceCreated is true. If a list of ResourceAttributes is given, then the function blocks until all attributes are allowed by SelfSubjectAccessReviews OR the function times out.
func CreateUserWithRole ¶
func CreateUserWithRole(rancherClient *rancher.Client, user *management.User, roles ...string) (*management.User, error)
CreateUserWithRole is helper function that creates a user with a role or multiple roles
func GetUserIDByName ¶
GetUserIDByName is a helper function that returns the user ID by name
func RemoveClusterRoleFromUser ¶
func RemoveClusterRoleFromUser(rancherClient *rancher.Client, user *management.User) error
RemoveClusterRoleFromUser is a helper function that removes the user from cluster
func RemoveProjectMember ¶
func RemoveProjectMember(rancherClient *rancher.Client, user *management.User) error
RemoveProjectMember is a helper function that removes the project role from `user`
func UserConfig ¶
func UserConfig() (user *management.User)
UserConfig sets and returns username and password of the user
Types ¶
This section is empty.