roles

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: 3 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 role using given parameters.

func Delete

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

Delete is a method to remove an existing database role.

Types

type CreateOpts

type CreateOpts struct {
	// Role name.
	// The length is 1~64 bits and can contain letters, numbers, hyphens, underscores and dots.
	Name string `json:"role_name" required:"true"`
	// The name of the database where the role is located.
	// The length is 1~64 bits and can contain letters, numbers and underscores.
	DbName string `json:"db_name,omitempty"`
	// List of roles inherited by the newly created role.
	Roles []Role `json:"roles,omitempty"`
}

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

type DeleteOpts

type DeleteOpts struct {
	// Role name.
	// The length is 1~64 bits and can contain letters, numbers, hyphens, underscores and dots.
	Name string `json:"role_name" required:"true"`
	// The name of the database where the role 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 role.

type ListOpts

type ListOpts struct {
	// Role name.
	// The length is 1~64 bits and can contain letters, numbers, hyphens, underscores and dots.
	Name string `q:"role_name"`
	// The name of the database where the role 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 roles to query.
	Roles string `json:"roles"`
}

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

type Privilege

type Privilege struct {
	// The details of the resource to which the privilege belongs.
	Resource Resource `json:"resource"`
	// The operation permission list.
	Actions []string `json:"actions"`
}

Privilege is the structure that represents the privilege detail for database.

type Resource

type Resource struct {
	// The database to which the privilege belongs.
	Collection string `json:"collection"`
	// The database name.
	DbName string `json:"db"`
}

Resource is the structure that represents the database details to which the role and user belongs.

type Role

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

Role is the object that represent the role details.

type RoleDetail

type RoleDetail struct {
	// Role name.
	Name string `json:"role"`
	// The database name to which the role belongs.
	DbName string `json:"db"`
}

RoleDetail is the structure that represents the inherited role details.

type RolePage

type RolePage struct {
	pagination.OffsetPageBase
}

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

func (RolePage) IsEmpty

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

IsEmpty checks whether a RolePage struct is empty.

type RoleResp

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

RoleResp is the structure that represents the detail of the database role.

func ExtractRoles

func ExtractRoles(p pagination.Page) ([]RoleResp, error)

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

func List

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

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

Jump to

Keyboard shortcuts

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