util

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RespTypEve  = "event"
	RespTypMsg  = "message"
	RespTypMeta = "metadata"
	RespEveSucc = "Success"
	RespEveFail = "Failed"

	CheckRunningOperation bindings.OperationKind = "checkRunning"
	CheckStatusOperation  bindings.OperationKind = "checkStatus"
	CheckRoleOperation    bindings.OperationKind = "checkRole"
	GetRoleOperation      bindings.OperationKind = "getRole"
	GetLagOperation       bindings.OperationKind = "getLag"
	SwitchoverOperation   bindings.OperationKind = "switchover"
	ExecOperation         bindings.OperationKind = "exec"
	QueryOperation        bindings.OperationKind = "query"
	CloseOperation        bindings.OperationKind = "close"

	LockOperation    bindings.OperationKind = "lockInstance"
	UnlockOperation  bindings.OperationKind = "unlockInstance"
	VolumeProtection bindings.OperationKind = "volumeProtection"

	// actions for cluster accounts management
	ListUsersOp          bindings.OperationKind = "listUsers"
	CreateUserOp         bindings.OperationKind = "createUser"
	DeleteUserOp         bindings.OperationKind = "deleteUser"
	DescribeUserOp       bindings.OperationKind = "describeUser"
	GrantUserRoleOp      bindings.OperationKind = "grantUserRole"
	RevokeUserRoleOp     bindings.OperationKind = "revokeUserRole"
	ListSystemAccountsOp bindings.OperationKind = "listSystemAccounts"

	OperationNotImplemented = "NotImplemented"
	OperationInvalid        = "Invalid"
	OperationSuccess        = "Success"
	OperationFailed         = "Failed"

	HTTPRequestPrefx string = "curl -X POST -H 'Content-Type: application/json' http://localhost:%d/v1.0/bindings/%s"

	// this is a general script template, which can be used for all kinds of exec request to databases.
	DataScriptRequestTpl string = `` /* 305-byte string literal not displayed */

)
View Source
const (
	UnsupportedOps errorReason = "unsupported operation"
)

Variables

This section is empty.

Functions

func IsUnSupportedError added in v0.6.0

func IsUnSupportedError(err error) bool

IsUnSupportedError checks if the error is unsupported operation error

Types

type RoleType

type RoleType string
const (
	SuperUserRole  RoleType = "superuser"
	ReadWriteRole  RoleType = "readwrite"
	ReadOnlyRole   RoleType = "readonly"
	NoPrivileges   RoleType = ""
	CustomizedRole RoleType = "customized"
	InvalidRole    RoleType = "invalid"
)

func (RoleType) EqualTo

func (r RoleType) EqualTo(role string) bool

func (RoleType) GetWeight

func (r RoleType) GetWeight() int32

type SQLChannelError added in v0.6.0

type SQLChannelError struct {
	Reason errorReason
}

SQLChannelError is the error for sqlchannel, it implements error interface

func (SQLChannelError) Error added in v0.6.0

func (e SQLChannelError) Error() string

type SQLChannelMeta

type SQLChannelMeta struct {
	Operation string    `json:"operation,omitempty"`
	StartTime time.Time `json:"startTime,omitempty"`
	EndTime   time.Time `json:"endTime,omitempty"`
	Extra     string    `json:"extra,omitempty"`
}

SQLChannelMeta is the metadata for sqlchannel

type SQLChannelRequest

type SQLChannelRequest struct {
	Operation string                 `json:"operation"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

SQLChannelRequest is the request for sqlchannel

type SQLChannelResponse

type SQLChannelResponse struct {
	Event    string         `json:"event,omitempty"`
	Message  string         `json:"message,omitempty"`
	Metadata SQLChannelMeta `json:"metadata,omitempty"`
}

SQLChannelResponse is the response for sqlchannel

type UserInfo

type UserInfo struct {
	UserName string        `json:"userName"`
	Password string        `json:"password,omitempty"`
	Expired  string        `json:"expired,omitempty"`
	ExpireAt time.Duration `json:"expireAt,omitempty"`
	RoleName string        `json:"roleName,omitempty"`
}

UserInfo is the user information for account management

Jump to

Keyboard shortcuts

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