databases

package
v0.0.0-...-1fc9fbf Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(c *golangsdk.ServiceClient, dbName string) *golangsdk.ErrResult

Delete is a method to remove the exist database by database name.

Types

type CreateOpts

type CreateOpts struct {
	// Name of the created database.
	// NOTE: The default database is a built-in database. You cannot create a database named default.
	Name string `json:"database_name" required:"true"`
	// Information about the created database.
	Description string `json:"description,omitempty"`
	// Enterprise project ID. The value 0 indicates the default enterprise project.
	// NOTE: Users who have enabled Enterprise Management can set this parameter to bind a specified project.
	EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`
	// Database tag.
	Tags []tags.ResourceTag `json:"tags,omitempty"`
}

CreateOpts is a structure which allows to create a new database using given parameters.

type Database

type Database struct {
	// Name of a database.
	Name string `json:"database_name"`
	// Creator of a database.
	Owner string `json:"owner"`
	// Number of tables in a database.
	TableNumber int `json:"table_number"`
	// Information about a database.
	Description string `json:"description"`
	// Whether database is shared.
	IsShared bool `json:"is_shared"`
	// Enterprise project ID. The value 0 indicates the default enterprise project.
	// NOTE: Users who have enabled Enterprise Management can set this parameter to bind a specified project.
	EnterpriseProjectId string `json:"enterprise_project_id"`
	// Resource ID.
	ResourceId string `json:"resource_id"`
}

Database is a object that represents the database detail.

type ListOpts

type ListOpts struct {
	// Specifies whether to display the permission information. The value can be true or false.
	// The default value is false.
	IsDesplay bool `q:"with-priv"`
	// The value should be no less than 0. The default value is 0.
	Offset int `q:"offset"`
	// Number of returned data records. The value must be greater than or equal to 0.
	// By default, all data records are returned.
	Limit int `q:"limit"`
	// Database name filtering keyword. Fuzzy match is used to obtain all databases whose names contain the keyword.
	Keyword string `q:"keyword"`
	// Database tag. The format is key=value, for example:
	// GET /v1.0/{project_id}/databases?offset=0&limit=10&with-priv=true&tags=foo%3Dbar
	// In the preceding information, = needs to be escaped to %3D, foo indicates the tag key, and bar indicates the tag
	// value.
	Tags string `q:"tags"`
}

ListOpts is a structure which allows to obtain databases using given parameters.

type ListResp

type ListResp struct {
	// Indicates whether the request is successfully executed.
	// Value true indicates that the request is successfully executed.
	IsSuccess bool `json:"is_success"`
	// System prompt. If execution succeeds, the parameter setting may be left blank.
	Message string `json:"message"`
	// Total number of databases.
	DatabaseCount int `json:"database_count"`
	// Database information.
	Databases []Database `json:"databases"`
}

ListResp is a object that represents the result of List operation.

func List

func List(c *golangsdk.ServiceClient, opts ListOpts) (*ListResp, error)

List is a method to obtain a list of databases by ListOpts.

type RequestResp

type RequestResp struct {
	// Whether the request is successfully executed. Value true indicates that the request is successfully executed.
	IsSuccess bool `json:"is_success"`
	// System prompt. If execution succeeds, the parameter setting may be left blank.
	Message string `json:"message"`
}

RequestResp is a object that represents the result of Create and UpdateDBOwner operation.

func Create

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

Create is a method to create a new database by CreateOpts.

func UpdateDBOwner

func UpdateDBOwner(c *golangsdk.ServiceClient, dbName string, opts UpdateDBOwnerOpts) (*RequestResp, error)

UpdateDBOwner is a method to update database owner by UpdateDBOwnerOpts.

type UpdateDBOwnerOpts

type UpdateDBOwnerOpts struct {
	// Name of the new owner. The new user must be a sub-user of the current tenant.
	NewOwner string `json:"new_owner" required:"true"`
}

UpdateDBOwnerOpts is a structure which allows to update database owner using given name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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