sqlchannel

package
v0.6.0-alpha.7 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

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

	SuperUserRole string = "superuser"
	ReadWriteRole string = "readwrite"
	ReadOnlyRole  string = "readonly"
	InvalidRole   string = "invalid"

	// 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"

	HTTPRequestPrefx string = "curl -X POST -H 'Content-Type: application/json' http://localhost:%d/v1.0/bindings/%s"
)
View Source
const (
	UnsupportedOps errorReason = "unsupported operation"
)

Variables

This section is empty.

Functions

func GetMapKeyFromRequest

func GetMapKeyFromRequest(req *dapr.InvokeBindingRequest) string

func IsUnSupportedError

func IsUnSupportedError(err error) bool

IsUnSupportedError checks if the error is unsupported operation error

Types

type OperationClient

type OperationClient struct {
	dapr.Client
	CharacterType string

	CacheTTL         time.Duration
	ReconcileTimeout time.Duration
	RequestTimeout   time.Duration
	// contains filtered or unexported fields
}

func NewClientWithPod

func NewClientWithPod(pod *corev1.Pod, characterType string) (*OperationClient, error)

func (*OperationClient) GetRole

func (cli *OperationClient) GetRole() (string, error)

func (*OperationClient) GetSystemAccounts added in v0.6.0

func (cli *OperationClient) GetSystemAccounts() ([]string, error)

GetSystemAccounts list all system accounts created

func (*OperationClient) InvokeComponent

func (cli *OperationClient) InvokeComponent(ctxWithReconcileTimeout context.Context, req *dapr.InvokeBindingRequest, ch chan *OperationResult)

func (*OperationClient) InvokeComponentInRoutine

func (cli *OperationClient) InvokeComponentInRoutine(ctxWithReconcileTimeout context.Context, req *dapr.InvokeBindingRequest) (*dapr.BindingEvent, error)

type OperationHTTPClient

type OperationHTTPClient struct {
	RequestTimeout time.Duration
	// contains filtered or unexported fields
}

OperationHTTPClient is a mock client for operation, mainly used to hide curl command details.

func NewHTTPClientWithChannelPod

func NewHTTPClientWithChannelPod(pod *corev1.Pod, characterType string) (*OperationHTTPClient, error)

NewHTTPClientWithChannelPod create a new OperationHTTPClient with sqlchannel container

func (*OperationHTTPClient) SendRequest

func (cli *OperationHTTPClient) SendRequest(exec *exec.ExecOptions, request SQLChannelRequest) (SQLChannelResponse, error)

SendRequest exec sql operation, this is a blocking operation and it will use pod EXEC subresource to send an http request to the probe pod

type OperationResult

type OperationResult struct {
	// contains filtered or unexported fields
}

type SQLChannelError

type SQLChannelError struct {
	Reason errorReason
}

SQLChannelError is the error for sqlchannel, it implements error interface

func (SQLChannelError) Error

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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