Documentation ¶
Overview ¶
Package users provides information and interaction with the user API resource in the Enterprise Cloud Database service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *eclcloud.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 ¶
CreateOptsBuilder is the top-level interface for creating JSON maps.
type CreateResult ¶
CreateResult represents the result of a create operation.
func Create ¶
func Create(client *eclcloud.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 ¶
DeleteResult represents the result of a delete operation.
func Delete ¶
func Delete(client *eclcloud.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) NextPageURL ¶
NextPageURL will retrieve the next page URL.