users

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(c *golangsdk.ServiceClient, instanceId string, opts CreateOpts) error

Create is a method to create a new database user using given parameters.

func Delete

func Delete(c *golangsdk.ServiceClient, instanceId string, opts DeleteOpts) error

Delete is a method to remove an existing database user.

func ResetPassword

func ResetPassword(c *golangsdk.ServiceClient, instanceId string, opts PwdResetOpts) error

ResetPassword is a method to reset the database user password.

Types

type CreateOpts

type CreateOpts struct {
	// User name.
	// The length is 1~64 bits and can contain letters, numbers, hyphens, underscores and dots.
	Name string `json:"user_name" required:"true"`
	// Database user password.
	// The length is 8~32 digits, and must be uppercase letters (A~Z), lowercase letters (a~z), numbers (0~9), special
	// characters ~!@#%^*-_=+? The combination.
	// It is recommended that you enter a strong password to improve security and prevent security risks such as
	// password cracking by brute force.
	Password string `json:"user_pwd" required:"true"`
	// List of roles inherited by the newly created role.
	Roles []roles.Role `json:"roles" required:"true"`
	// The name of the database where the user is located.
	// The length is 1~64 bits and can contain letters, numbers and underscores.
	DbName string `json:"db_name,omitempty"`
}

CreateOpts is the structure required by the Create method to create a new database user.

type DeleteOpts

type DeleteOpts struct {
	// User name.
	// The length is 1~64 bits and can contain letters, numbers, hyphens, underscores and dots.
	Name string `json:"user_name" required:"true"`
	// The name of the database where the user is located.
	// The length is 1~64 bits and can contain letters, numbers and underscores.
	DbName string `json:"db_name" required:"true"`
}

DeleteOpts is the structure required by the Delete method to remove an existing database user.

type ListOpts

type ListOpts struct {
	// User name.
	// The length is 1~64 bits and can contain letters, numbers, hyphens, underscores and dots.
	Name string `q:"user_name"`
	// The name of the database where the user is located.
	// The length is 1~64 bits and can contain letters, numbers and underscores.
	DbName string `q:"db_name"`
	// The offset number.
	// Default value: 0.
	Offset int `q:"offset"`
	// Number of records to be queried.
	// Value range: 0–100.
	// Default value: 100, indicating that a maximum of 1000 records can be queried and all records are displayed on
	// the same page.
	Limit int `q:"limit"`
}

ListOpts allows to filter list data using given parameters.

type ListResp

type ListResp struct {
	// Total number of query results.
	TotalCount int `json:"total_count"`
	// List of users to query.
	Users string `json:"users"`
}

ListResp is the structure that represents the API response of 'List' method.

type PwdResetOpts

type PwdResetOpts struct {
	// New user password for reset.
	// The length is 8~32 digits, and must be uppercase letters (A~Z), lowercase letters (a~z), numbers (0~9), special
	// characters ~!@#%^*-_=+? The combination.
	// It is recommended that you enter a strong password to improve security and prevent security risks such as
	// password cracking by brute force.
	Password string `json:"user_pwd" required:"true"`
	// User name. Defaults to "rwuser".
	// The length is 1~64 bits and can contain letters, numbers, hyphens, underscores and dots.
	Name string `json:"user_name,omitempty"`
	// The name of the database where the user is located.
	// The length is 1~64 bits and can contain letters, numbers and underscores.
	DbName string `json:"db_name,omitempty"`
}

PwdResetOpts is the structure required by the ResetPassword method to reset the database user password.

type UserPage

type UserPage struct {
	pagination.OffsetPageBase
}

UserPage is a single page maximum result representing a query by offset page.

func (UserPage) IsEmpty

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

IsEmpty checks whether a RolePage struct is empty.

type UserResp

type UserResp struct {
	// Whether role is built-in.
	IsBuiltin bool `json:"isBuiltin"`
	// Role name.
	Name string `json:"user"`
	// Database name.
	DbName string `json:"db"`
	// The list of privileges inherited by the newly created role.
	Privileges []roles.Privilege `json:"privileges"`
	// The list of privileges inherited by the newly created role, includes all privileges inherited by inherited roles.
	InheritedPrivileges []roles.Privilege `json:"inheritedPrivileges"`
	// The list of roles inherited by the newly created role.
	Roles []roles.RoleDetail `json:"roles"`
	// The list of roles inherited by the newly created role, includes all roles inherited by inherited roles.
	InheritedRoles []roles.RoleDetail `json:"inheritedRoles"`
}

UserResp is the structure that represents the detail of the database user.

func ExtractUsers

func ExtractUsers(p pagination.Page) ([]UserResp, error)

ExtractUsers is a method to extract the list of database role for DDS service.

func List

func List(c *golangsdk.ServiceClient, instanceId string, opts ListOpts) ([]UserResp, error)

List is a method to query the list of the users using given opts.

Jump to

Keyboard shortcuts

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