users

package
v1.0.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

List will list all the users associated with a specified database instance, along with their associated databases. This operation will not return any system users or administrators for a database.

Types

type BatchCreateOpts

type BatchCreateOpts []CreateOpts

BatchCreateOpts allows multiple users to be created at once.

func (BatchCreateOpts) ToUserCreateMap

func (opts BatchCreateOpts) ToUserCreateMap() (map[string]interface{}, error)

ToUserCreateMap will generate a JSON map.

type CreateOpts

type CreateOpts struct {
	// 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 `json:"name" required:"true"`
	// Specifies a password for the user.
	Password string `json:"password" required:"true"`
	// An array of databases that this user will connect to. The
	// "name" field is the only requirement for each option.
	Databases db.BatchCreateOpts `json:"databases,omitempty"`
	// 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 `json:"host,omitempty"`
}

CreateOpts is the struct responsible for configuring a new user; often in the context of an instance.

func (CreateOpts) ToMap

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

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

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToUserCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder is the top-level interface for creating JSON maps.

type CreateResult

type CreateResult struct {
	gophercloud.ErrResult
}

CreateResult represents the result of a create operation.

func Create

func Create(client *gophercloud.ServiceClient, instanceID string, opts CreateOptsBuilder) (r CreateResult)

Create asynchronously provisions a new user for the specified database instance based on the configuration defined in CreateOpts. If databases are assigned for a particular user, the user will be granted all privileges for those specified databases. "root" is a reserved name and cannot be used.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation.

func Delete

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

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

type User

type User struct {
	// The user name
	Name string

	// The user password
	Password string

	// The databases associated with this user
	Databases []db.Database
}

User represents a database user

func ExtractUsers

func ExtractUsers(r 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) IsEmpty

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

IsEmpty checks to see whether the collection is empty.

func (UserPage) NextPageURL

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

NextPageURL will retrieve the next page URL.

Directories

Path Synopsis
db_users_v1
db_users_v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL