Documentation ¶
Overview ¶
Package users contains user management functionality on SSS.
Example to List users
listOpts := users.ListOpts{} allPages, err := users.List(client, 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 Get a user
id := "ecid0000000001" user, err := users.Get(client, id).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", user)
Example to Create a user
createOpts := users.CreateOpts{ LoginID: "sample", MailAddress: "example@example.com", Password: "Passw0rd", NotifyPassword: "true", } user, err := users.Create(client, createOpts).Extract() if err != nil { panic(err) }
Example to Update a user
userID := "ecid0000000001" loginID := "login-id-update" mailAddress := "update@example.com" newPassword := "NewPassw0rd" updateOpts := users.UpdateOpts{ LoginID: &loginID, MailAddress: &mailAddress, NewPassword: &newPassword, } result := users.Update(client, userID, updateOpts) if result.Err != nil { panic(result.Err) }
Example to Delete a user
userID := "ecid0000000001" res := users.Delete(client, userID) if res.Err != nil { panic(res.Err) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List enumerates the Users to which the current token has access.
Types ¶
type CreateOpts ¶
type CreateOpts struct { // Login id of new user. LoginID string `json:"login_id" required:"true"` // Mail address of new user. MailAddress string `json:"mail_address" required:"true"` // Initial password of new user. // If this parameter is not designated, // random initial password is generated and applied to new user. Password string `json:"password,omitempty"` // If this flag is set 'true', notification e-mail will be sent to new user's email. NotifyPassword string `json:"notify_password" required:"true"` }
CreateOpts represents parameters 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 result of a Create request. Call its Extract method to interpret it as a User.
func Create ¶
func Create(client *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create creates a new user.
type DeleteResult ¶
type DeleteResult struct {
eclcloud.ErrResult
}
DeleteResult is the result of a Delete request. Call its ExtractErr method to determine if the request succeeded or failed.
func Delete ¶
func Delete(client *eclcloud.ServiceClient, userID string) (r DeleteResult)
Delete deletes a user.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the result of a Get request. Call its Extract method to interpret it as a User.
type ListOpts ¶
type ListOpts struct { }
ListOpts enables filtering of a list request. Currently SSS User API does not support any of query parameters.
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 UpdateOpts ¶
type UpdateOpts struct { // New login id of the user. LoginID *string `json:"login_id" required:"true"` // New email address of the user MailAddress *string `json:"mail_address" required:"true"` // New password of the user NewPassword *string `json:"new_password" required:"true"` }
UpdateOpts represents parameters to update a user.
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 result of an Update request. Call its Extract method to interpret it as a User.
func Update ¶
func Update(client *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update modifies the attributes of a user. SSS User PUT API does not have response body, so set JSONResponse option as nil.
type User ¶
type User struct { LoginID string `json:"login_id"` MailAddress string `json:"mail_address"` UserID string `json:"user_id"` ContractOwner bool `json:"contract_owner"` Superuser bool `json:"super_user"` ApiAvailability bool `json:"api_availability"` KeystoneName string `json:"keystone_name"` KeystoneEndpoint string `json:"keystone_endpoint"` SSSEndpoint string `json:"sss_endpoint"` ContractID string `json:"contract_id"` LoginIntegration string `json:"login_integration"` ExternalReferenceID string `json:"external_reference_id"` BrandID string `json:"brand_id"` OtpActivation bool `json:"otp_activation"` StartTime time.Time `json:"-"` }
User represents an ECL SSS User.
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 ¶
UnmarshalJSON creates JSON format of user
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.