client

package
v0.7.0-beta.17 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMapKeyFromRequest

func GetMapKeyFromRequest(req *http.Request, body []byte) string

func SetMockClient

func SetMockClient(cli Client, err error)

func UnsetMockClient

func UnsetMockClient()

Types

type Client

type Client interface {
	// JoinMember sends a join member operation request to Lorry, located on the target pod that is about to join.
	JoinMember(ctx context.Context) error

	// LeaveMember sends a Leave member operation request to Lorry, located on the target pod that is about to leave.
	LeaveMember(ctx context.Context) error
}

func NewClient

func NewClient(characterType string, pod corev1.Pod) (Client, error)

type OperationClient

type OperationClient struct {
	Client        *http.Client
	Port          int32
	CharacterType string
	URL           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

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

GetSystemAccounts lists all system accounts created

func (*OperationClient) InvokeComponent

func (cli *OperationClient) InvokeComponent(ctxWithReconcileTimeout context.Context, url, method string, body []byte, ch chan *OperationResult)

func (*OperationClient) InvokeComponentInRoutine

func (cli *OperationClient) InvokeComponentInRoutine(ctxWithReconcileTimeout context.Context, url, method string, body []byte) (*http.Response, error)

func (*OperationClient) JoinMember

func (cli *OperationClient) JoinMember(ctx context.Context) error

JoinMember sends a join member operation request to Lorry, located on the target pod that is about to join.

func (*OperationClient) LeaveMember

func (cli *OperationClient) LeaveMember(ctx context.Context) error

LeaveMember sends a Leave member operation request to Lorry, located on the target pod that is about to leave.

func (*OperationClient) Request

func (cli *OperationClient) Request(ctx context.Context, operation string) (map[string]any, 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 execs sql operation, this is a blocking operation and use pod EXEC subresource to send a http request to the probed pod

type OperationResult

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

Jump to

Keyboard shortcuts

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