Documentation ¶
Overview ¶
Package users manages and retrieves users in the Enterprise Cloud Remote Console Access Service.
Example to List users
allPages, err := users.List(rcaClient).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
username := "02471b45-3de0-4fc8-8469-a7cc52c378df" user, err := users.Get(rcaClient, username).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", user)
Example to Create a user
createOpts := users.CreateOpts{ Password: "dummy_passw@rd", } result := users.Create(rcaClient, createOpts) if result.Err != nil { panic(result.Err) }
Example to Update a user
username := "02471b45-3de0-4fc8-8469-a7cc52c378df" updateOpts := users.UpdateOpts{ Password: "dummy_passw@rd", } result := users.Update(rcaClient, username, updateOpts) if result.Err != nil { panic(result.Err) }
Example to Delete a user
username := "02471b45-3de0-4fc8-8469-a7cc52c378df" result := users.Delete(rcaClient, username) if result.Err != nil { panic(result.Err) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *eclcloud.ServiceClient) pagination.Pager
List retrieves a list of users.
Types ¶
type CreateOpts ¶
type CreateOpts struct {
Password string `json:"password"`
}
CreateOpts provides options used to create a user.
func (CreateOpts) ToResourceCreateMap ¶
func (opts CreateOpts) ToResourceCreateMap() (map[string]interface{}, error)
ToResourceCreateMap 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.
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 response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.
func Delete ¶
func Delete(client *eclcloud.ServiceClient, name string) (r DeleteResult)
Delete deletes a user.
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 UpdateOpts ¶
type UpdateOpts struct {
Password string `json:"password"`
}
UpdateOpts represents parameters to update a user.
func (UpdateOpts) ToResourceUpdateMap ¶
func (opts UpdateOpts) ToResourceUpdateMap() (map[string]interface{}, error)
ToResourceUpdateCreateMap 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, name string, opts UpdateOptsBuilder) (r UpdateResult)
Update modifies the attributes of a user.
type User ¶
type User struct { Name string `json:"name"` Password string `json:"password"` VPNEndpoints []VPNEndpoint `json:"vpn_endpoints"` }
User represents VPN user.
func ExtractUsers ¶
func ExtractUsers(r pagination.Page) ([]User, error)
ExtractUsers returns a slice of users contained in a single page of results.
type UserPage ¶
type UserPage struct {
pagination.LinkedPageBase
}
UserPage is a single page of user results.
type VPNEndpoint ¶
VPNEndpoint represents VPN Endpoint.