Documentation ¶
Overview ¶
Package users provides information and interaction with the user API resource in the Rackspace Database service.
Index ¶
- func Create(client *gophercloud.ServiceClient, instanceID string, ...) os.CreateResult
- func Delete(client *gophercloud.ServiceClient, instanceID, userName string) os.DeleteResult
- func ExtractDBs(page pagination.Page) ([]db.Database, error)
- func List(client *gophercloud.ServiceClient, instanceID string) pagination.Pager
- func ListAccess(client *gophercloud.ServiceClient, instanceID, userName string) pagination.Pager
- type AccessPage
- type GetResult
- type GrantAccessResult
- type RevokeAccessResult
- type UpdateOpts
- type UpdatePasswordsResult
- type UpdateResult
- type User
- type UserPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(client *gophercloud.ServiceClient, instanceID string, opts os.CreateOptsBuilder) os.CreateResult
Create will create a new database user for the specified database instance.
func Delete ¶
func Delete(client *gophercloud.ServiceClient, instanceID, userName string) os.DeleteResult
Delete will permanently remove a user from a specified database instance.
func ExtractDBs ¶
func ExtractDBs(page pagination.Page) ([]db.Database, error)
ExtractDBs will convert a generic pagination struct into a more relevant slice of DB structs.
func List ¶
func List(client *gophercloud.ServiceClient, instanceID string) pagination.Pager
List will list all available users for a specified database instance.
func ListAccess ¶
func ListAccess(client *gophercloud.ServiceClient, instanceID, userName string) pagination.Pager
ListAccess will list all of the databases a user has access to.
Types ¶
type AccessPage ¶
type AccessPage struct {
pagination.LinkedPageBase
}
AccessPage represents a single page of a paginated user collection.
func (AccessPage) IsEmpty ¶
func (page AccessPage) IsEmpty() (bool, error)
IsEmpty checks to see whether the collection is empty.
func (AccessPage) NextPageURL ¶
func (page AccessPage) NextPageURL() (string, error)
NextPageURL will retrieve the next page URL.
type GetResult ¶
type GetResult struct {
gophercloud.Result
}
GetResult represents the result of getting a user.
func Get ¶
func Get(client *gophercloud.ServiceClient, instanceID, userName string) GetResult
Get will retrieve the details for a particular user.
type GrantAccessResult ¶
type GrantAccessResult struct {
gophercloud.ErrResult
}
GrantAccessResult represents the result of granting access to a user.
func GrantAccess ¶
func GrantAccess(client *gophercloud.ServiceClient, instanceID, userName string, opts db.CreateOptsBuilder) GrantAccessResult
GrantAccess for the specified user to one or more databases on a specified instance. For example, to add a user to multiple databases:
opts := db.BatchCreateOpts{ db.CreateOpts{Name: "database_1"}, db.CreateOpts{Name: "database_3"}, db.CreateOpts{Name: "database_19"}, } GrantAccess(client, "instance_id", "user_name", opts)
type RevokeAccessResult ¶
type RevokeAccessResult struct {
gophercloud.ErrResult
}
RevokeAccessResult represents the result of revoking access to a user.
func RevokeAccess ¶
func RevokeAccess(client *gophercloud.ServiceClient, instanceID, userName, dbName string) RevokeAccessResult
RevokeAccess will revoke access for the specified user to one or more databases on a specified instance. For example:
RevokeAccess(client, "instance_id", "user_name", "db_name")
type UpdateOpts ¶
type UpdateOpts struct { // [OPTIONAL] Specifies a name for the user. Valid names can be composed // of the following characters: letters (either case); numbers; these // characters '@', '?', '#', ' ' but NEVER beginning a name string; '_' is // permitted anywhere. Prohibited characters that are forbidden include: // single quotes, double quotes, back quotes, semicolons, commas, backslashes, // and forward slashes. Spaces at the front or end of a user name are also // not permitted. Name string // [OPTIONAL] Specifies a password for the user. Password string // [OPTIONAL] Specifies the host from which a user is allowed to connect to // the database. Possible values are a string containing an IPv4 address or // "%" to allow connecting from any host. Optional; the default is "%". Host string }
UpdateOpts is the struct responsible for updating an existing user.
func (UpdateOpts) ToMap ¶
func (opts UpdateOpts) ToMap() (map[string]interface{}, error)
ToMap is a convenience function for creating sub-maps for individual users.
type UpdatePasswordsResult ¶
type UpdatePasswordsResult struct {
gophercloud.ErrResult
}
UpdatePasswordsResult represents the result of changing a user password.
func ChangePassword ¶
func ChangePassword(client *gophercloud.ServiceClient, instanceID string, opts os.CreateOptsBuilder) UpdatePasswordsResult
ChangePassword changes the password for one or more users. For example, to change the respective passwords for two users:
opts := os.BatchCreateOpts{ os.CreateOpts{Name: "db_user_1", Password: "new_password_1"}, os.CreateOpts{Name: "db_user_2", Password: "new_password_2"}, } ChangePassword(client, "instance_id", opts)
type UpdateResult ¶
type UpdateResult struct {
gophercloud.ErrResult
}
UpdateResult represents the result of updating a user.
func Update ¶
func Update(client *gophercloud.ServiceClient, instanceID, userName string, opts UpdateOpts) UpdateResult
Update will modify the attributes of a specified user. Attributes that can be updated are: user name, password, and host.
type User ¶
type User struct { // The user name Name string // The user password Password string // Specifies the host from which a user is allowed to connect to the database. // Possible values are a string containing an IPv4 address or "%" to allow // connecting from any host. Host string // The databases associated with this user Databases []db.Database }
User represents a database user
func ExtractUsers ¶
func ExtractUsers(page pagination.Page) ([]User, error)
ExtractUsers will convert a generic pagination struct into a more relevant slice of User structs.
type UserPage ¶
type UserPage struct {
pagination.LinkedPageBase
}
UserPage represents a single page of a paginated user collection.
func (UserPage) NextPageURL ¶
NextPageURL will retrieve the next page URL.