Documentation ¶
Overview ¶
Package users manages and retrieves Users in the OpenStack Identity Service.
Example to List Users
listOpts := users.ListOpts{ DomainID: "default", } allPages, err := users.List(identityClient, listOpts).AllPages() if err != nil { panic(err) } allUsers, err := users.ExtractUsers(allPages) if err != nil { panic(err) } for _, user := range allUsers { fmt.Printf("%+v\n", user) }
Example to List Groups a User Belongs To
userID := "0fe36e73809d46aeae6705c39077b1b3" allPages, err := users.ListGroups(identityClient, userID).AllPages() if err != nil { panic(err) } allGroups, err := groups.ExtractGroups(allPages) if err != nil { panic(err) } for _, group := range allGroups { fmt.Printf("%+v\n", group) }
Example to List Projects a User Belongs To
userID := "0fe36e73809d46aeae6705c39077b1b3" allPages, err := users.ListProjects(identityClient, userID).AllPages() if err != nil { panic(err) } allProjects, err := projects.ExtractProjects(allPages) if err != nil { panic(err) } for _, project := range allProjects { fmt.Printf("%+v\n", project) }
Index ¶
- func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func ListGroups(client *golangsdk.ServiceClient, userID string) pagination.Pager
- func ListProjects(client *golangsdk.ServiceClient, userID string) pagination.Pager
- type AddMembershipResult
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type Option
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
- type User
- type UserPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager
List enumerates the Users to which the current token has access.
func ListGroups ¶
func ListGroups(client *golangsdk.ServiceClient, userID string) pagination.Pager
ListGroups enumerates groups user belongs to.
func ListProjects ¶
func ListProjects(client *golangsdk.ServiceClient, userID string) pagination.Pager
ListProjects enumerates groups user belongs to.
Types ¶
type AddMembershipResult ¶
type AddMembershipResult struct {
golangsdk.ErrResult
}
type CreateOpts ¶
type CreateOpts struct { // Name is the name of the new user. Name string `json:"name" required:"true"` // DefaultProjectID is the ID of the default project of the user. DefaultProjectID string `json:"default_project_id,omitempty"` // DomainID is the ID of the domain the user belongs to. DomainID string `json:"domain_id,omitempty"` // Enabled sets the user status to enabled or disabled. Enabled *bool `json:"enabled,omitempty"` // Password is the password of the new user. Password string `json:"password,omitempty"` // Description is a description of the user. Description string `json:"description,omitempty"` }
CreateOpts provides options used to create a user.
func (CreateOpts) ToUserCreateMap ¶
func (opts CreateOpts) ToUserCreateMap() (map[string]interface{}, error)
ToUserCreateMap formats a CreateOpts into a create request.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult is the response from a Create operation. Call its Extract method to interpret it as a User.
type DeleteResult ¶
type DeleteResult struct {
golangsdk.ErrResult
}
DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the response from a Get operation. Call its Extract method to interpret it as a User.
type ListOpts ¶
type ListOpts struct { // DomainID filters the response by a domain ID. DomainID string `q:"domain_id"` // Enabled filters the response by enabled users. Enabled *bool `q:"enabled"` // Name filters the response by username. Name string `q:"name"` }
ListOpts provides options to filter the List results.
func (ListOpts) ToUserListQuery ¶
ToUserListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request
type Option ¶
type Option string
Option is a specific option defined at the API to enable features on a user account.
const ( IgnoreChangePasswordUponFirstUse Option = "ignore_change_password_upon_first_use" IgnorePasswordExpiry Option = "ignore_password_expiry" IgnoreLockoutFailureAttempts Option = "ignore_lockout_failure_attempts" MultiFactorAuthRules Option = "multi_factor_auth_rules" MultiFactorAuthEnabled Option = "multi_factor_auth_enabled" )
type UpdateOpts ¶
type UpdateOpts struct { // Name is the name of the new user. Name string `json:"name,omitempty"` // DefaultProjectID is the ID of the default project of the user. DefaultProjectID string `json:"default_project_id,omitempty"` // DomainID is the ID of the domain the user belongs to. DomainID string `json:"domain_id,omitempty"` // Enabled sets the user status to enabled or disabled. Enabled *bool `json:"enabled,omitempty"` // Password is the password of the new user. Password string `json:"password,omitempty"` // Description is a description of the user. Description string `json:"description,omitempty"` }
UpdateOpts provides options for updating a user account.
func (UpdateOpts) ToUserUpdateMap ¶
func (opts UpdateOpts) ToUserUpdateMap() (map[string]interface{}, error)
ToUserUpdateMap formats a UpdateOpts into an update request.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult is the response from an Update operation. Call its Extract method to interpret it as a User.
type User ¶
type User struct { // ID is the unique ID of the user. ID string `json:"id"` // Name is the name of the user. Name string `json:"name"` // DomainID is the domain ID the user belongs to. DomainID string `json:"domain_id"` // Enabled is whether or not the user is enabled. Enabled bool `json:"enabled"` // Description is a description of the user. Description string `json:"description"` PasswordStatus bool `json:"pwd_status"` PasswordStrength string `json:"pwd_strength"` // PasswordExpiresAt is the timestamp when the user's password expires. PasswordExpiresAt time.Time `json:"-"` LastProjectID string `json:"last_project_id"` DefaultProjectID string `json:"default_project_id"` // Links contains referencing links to the user. Links map[string]interface{} `json:"links"` }
User represents a User in the OpenStack Identity Service.
func ExtractUsers ¶
func ExtractUsers(r pagination.Page) ([]User, error)
ExtractUsers returns a slice of Users contained in a single page of results.
func (*User) UnmarshalJSON ¶
type UserPage ¶
type UserPage struct {
pagination.LinkedPageBase
}
UserPage is a single page of User results.
func (UserPage) NextPageURL ¶
NextPageURL extracts the "next" link from the links section of the result.