gophercloud: github.com/rackspace/gophercloud/rackspace/db/v1/users Index | Files

package users

import "github.com/rackspace/gophercloud/rackspace/db/v1/users"

Package users provides information and interaction with the user API resource in the Rackspace Database service.

Index

Package Files

delegate.go doc.go requests.go results.go urls.go

func Create Uses

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 Uses

func Delete(client *gophercloud.ServiceClient, instanceID, userName string) os.DeleteResult

Delete will permanently remove a user from a specified database instance.

func ExtractDBs Uses

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 Uses

func List(client *gophercloud.ServiceClient, instanceID string) pagination.Pager

List will list all available users for a specified database instance.

func ListAccess Uses

func ListAccess(client *gophercloud.ServiceClient, instanceID, userName string) pagination.Pager

ListAccess will list all of the databases a user has access to.

type AccessPage Uses

type AccessPage struct {
    pagination.LinkedPageBase
}

AccessPage represents a single page of a paginated user collection.

func (AccessPage) IsEmpty Uses

func (page AccessPage) IsEmpty() (bool, error)

IsEmpty checks to see whether the collection is empty.

func (AccessPage) NextPageURL Uses

func (page AccessPage) NextPageURL() (string, error)

NextPageURL will retrieve the next page URL.

type GetResult Uses

type GetResult struct {
    gophercloud.Result
}

GetResult represents the result of getting a user.

func Get Uses

func Get(client *gophercloud.ServiceClient, instanceID, userName string) GetResult

Get will retrieve the details for a particular user.

func (GetResult) Extract Uses

func (r GetResult) Extract() (*User, error)

Extract will retrieve a User struct from a getresult.

type GrantAccessResult Uses

type GrantAccessResult struct {
    gophercloud.ErrResult
}

GrantAccessResult represents the result of granting access to a user.

func GrantAccess Uses

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 Uses

type RevokeAccessResult struct {
    gophercloud.ErrResult
}

RevokeAccessResult represents the result of revoking access to a user.

func RevokeAccess Uses

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 Uses

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 Uses

func (opts UpdateOpts) ToMap() (map[string]interface{}, error)

ToMap is a convenience function for creating sub-maps for individual users.

type UpdatePasswordsResult Uses

type UpdatePasswordsResult struct {
    gophercloud.ErrResult
}

UpdatePasswordsResult represents the result of changing a user password.

func ChangePassword Uses

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 Uses

type UpdateResult struct {
    gophercloud.ErrResult
}

UpdateResult represents the result of updating a user.

func Update Uses

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 Uses

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 Uses

func ExtractUsers(page pagination.Page) ([]User, error)

ExtractUsers will convert a generic pagination struct into a more relevant slice of User structs.

type UserPage Uses

type UserPage struct {
    pagination.LinkedPageBase
}

UserPage represents a single page of a paginated user collection.

func (UserPage) IsEmpty Uses

func (page UserPage) IsEmpty() (bool, error)

IsEmpty checks to see whether the collection is empty.

func (UserPage) NextPageURL Uses

func (page UserPage) NextPageURL() (string, error)

NextPageURL will retrieve the next page URL.

Package users imports 6 packages (graph). Updated 2018-07-26. Refresh now. Tools for package owners.