Documentation ¶
Overview ¶
Package client is a generated GoMock package.
Index ¶
- func GetMapKeyFromRequest(req *http.Request) string
- func SetMockClient(cli Client, err error)
- func UnsetMockClient()
- type Client
- type HTTPClient
- func (cli *HTTPClient) CreateUser(ctx context.Context, userName, password, roleName string) error
- func (cli *HTTPClient) DeleteUser(ctx context.Context, userName string) error
- func (cli *HTTPClient) DescribeUser(ctx context.Context, userName string) (map[string]any, error)
- func (cli *HTTPClient) GetRole(ctx context.Context) (string, error)
- func (cli *HTTPClient) GrantUserRole(ctx context.Context, userName, roleName string) error
- func (cli *HTTPClient) InvokeComponent(ctxWithReconcileTimeout context.Context, url, method string, body io.Reader, ...)
- func (cli *HTTPClient) InvokeComponentInRoutine(ctxWithReconcileTimeout context.Context, url, method string, body io.Reader) (*http.Response, error)
- func (cli *HTTPClient) JoinMember(ctx context.Context) error
- func (cli *HTTPClient) LeaveMember(ctx context.Context) error
- func (cli *HTTPClient) ListSystemAccounts(ctx context.Context) ([]map[string]any, error)
- func (cli *HTTPClient) ListUsers(ctx context.Context) ([]map[string]any, error)
- func (cli *HTTPClient) Request(ctx context.Context, operation, method string, req map[string]any) (map[string]any, error)
- func (cli *HTTPClient) RevokeUserRole(ctx context.Context, userName, roleName string) error
- func (cli *HTTPClient) Switchover(ctx context.Context, primary, candidate string) error
- type K8sExecClient
- func (cli *K8sExecClient) CreateUser(ctx context.Context, userName, password, roleName string) error
- func (cli *K8sExecClient) DeleteUser(ctx context.Context, userName string) error
- func (cli *K8sExecClient) DescribeUser(ctx context.Context, userName string) (map[string]any, error)
- func (cli *K8sExecClient) GetRole(ctx context.Context) (string, error)
- func (cli *K8sExecClient) GrantUserRole(ctx context.Context, userName, roleName string) error
- func (cli *K8sExecClient) JoinMember(ctx context.Context) error
- func (cli *K8sExecClient) LeaveMember(ctx context.Context) error
- func (cli *K8sExecClient) ListSystemAccounts(ctx context.Context) ([]map[string]any, error)
- func (cli *K8sExecClient) ListUsers(ctx context.Context) ([]map[string]any, error)
- func (cli *K8sExecClient) Request(ctx context.Context, operation, method string, req map[string]any) (map[string]any, error)
- func (cli *K8sExecClient) RevokeUserRole(ctx context.Context, userName, roleName string) error
- func (cli *K8sExecClient) Switchover(ctx context.Context, primary, candidate string) error
- type MockClient
- func (m *MockClient) CreateUser(arg0 context.Context, arg1, arg2, arg3 string) error
- func (m *MockClient) DeleteUser(arg0 context.Context, arg1 string) error
- func (m *MockClient) DescribeUser(arg0 context.Context, arg1 string) (map[string]interface{}, error)
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) GetRole(arg0 context.Context) (string, error)
- func (m *MockClient) GrantUserRole(arg0 context.Context, arg1, arg2 string) error
- func (m *MockClient) JoinMember(arg0 context.Context) error
- func (m *MockClient) LeaveMember(arg0 context.Context) error
- func (m *MockClient) ListSystemAccounts(arg0 context.Context) ([]map[string]interface{}, error)
- func (m *MockClient) ListUsers(arg0 context.Context) ([]map[string]interface{}, error)
- func (m *MockClient) RevokeUserRole(arg0 context.Context, arg1, arg2 string) error
- func (m *MockClient) Switchover(arg0 context.Context, arg1, arg2 string) error
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) CreateUser(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) DeleteUser(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) DescribeUser(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) GetRole(arg0 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) GrantUserRole(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) JoinMember(arg0 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) LeaveMember(arg0 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) ListSystemAccounts(arg0 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) ListUsers(arg0 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) RevokeUserRole(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) Switchover(arg0, arg1, arg2 interface{}) *gomock.Call
- type OperationResult
- type Requester
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMapKeyFromRequest ¶
func SetMockClient ¶
func UnsetMockClient ¶
func UnsetMockClient()
Types ¶
type Client ¶
type Client interface { // GetRole return the replication role(like primary/secondary) of the target replica GetRole(ctx context.Context) (string, error) // user management funcs CreateUser(ctx context.Context, userName, password, roleName string) error DeleteUser(ctx context.Context, userName string) error DescribeUser(ctx context.Context, userName string) (map[string]any, error) GrantUserRole(ctx context.Context, userName, roleName string) error RevokeUserRole(ctx context.Context, userName, roleName string) error ListUsers(ctx context.Context) ([]map[string]any, error) ListSystemAccounts(ctx context.Context) ([]map[string]any, error) // 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 Switchover(ctx context.Context, primary, candidate string) error }
func GetMockClient ¶
func GetMockClient() Client
type HTTPClient ¶
type HTTPClient struct { Client *http.Client URL string CacheTTL time.Duration ReconcileTimeout time.Duration RequestTimeout time.Duration // contains filtered or unexported fields }
func NewHTTPClientWithPod ¶
func NewHTTPClientWithPod(pod *corev1.Pod) (*HTTPClient, error)
func NewHTTPClientWithURL ¶
func NewHTTPClientWithURL(url string) (*HTTPClient, error)
func (*HTTPClient) CreateUser ¶
func (*HTTPClient) DeleteUser ¶
func (*HTTPClient) DescribeUser ¶
func (*HTTPClient) GrantUserRole ¶
func (*HTTPClient) InvokeComponent ¶
func (cli *HTTPClient) InvokeComponent(ctxWithReconcileTimeout context.Context, url, method string, body io.Reader, ch chan *OperationResult)
func (*HTTPClient) InvokeComponentInRoutine ¶
func (*HTTPClient) JoinMember ¶
JoinMember sends a join member operation request to Lorry, located on the target pod that is about to join.
func (*HTTPClient) LeaveMember ¶
LeaveMember sends a Leave member operation request to Lorry, located on the target pod that is about to leave.
func (*HTTPClient) ListSystemAccounts ¶
ListSystemAccounts lists all system accounts created
func (*HTTPClient) RevokeUserRole ¶
type K8sExecClient ¶
type K8sExecClient struct { cmdexec.StreamOptions Executor cmdexec.RemoteExecutor RequestTimeout time.Duration // contains filtered or unexported fields }
K8sExecClient is a mock client for operation, mainly used to hide curl command details.
func NewK8sExecClientWithPod ¶
NewK8sExecClientWithPod create a new OperationHTTPClient with lorry container
func (*K8sExecClient) CreateUser ¶
func (*K8sExecClient) DeleteUser ¶
func (*K8sExecClient) DescribeUser ¶
func (*K8sExecClient) GrantUserRole ¶
func (*K8sExecClient) JoinMember ¶
JoinMember sends a join member operation request to Lorry, located on the target pod that is about to join.
func (*K8sExecClient) LeaveMember ¶
LeaveMember sends a Leave member operation request to Lorry, located on the target pod that is about to leave.
func (*K8sExecClient) ListSystemAccounts ¶
ListSystemAccounts lists all system accounts created
func (*K8sExecClient) Request ¶
func (cli *K8sExecClient) Request(ctx context.Context, operation, method string, req map[string]any) (map[string]any, error)
Request execs lorry operation, this is a blocking operation and use pod EXEC subresource to send a http request to the lorry pod
func (*K8sExecClient) RevokeUserRole ¶
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) CreateUser ¶
func (m *MockClient) CreateUser(arg0 context.Context, arg1, arg2, arg3 string) error
CreateUser mocks base method.
func (*MockClient) DeleteUser ¶
func (m *MockClient) DeleteUser(arg0 context.Context, arg1 string) error
DeleteUser mocks base method.
func (*MockClient) DescribeUser ¶
func (m *MockClient) DescribeUser(arg0 context.Context, arg1 string) (map[string]interface{}, error)
DescribeUser mocks base method.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClient) GetRole ¶
func (m *MockClient) GetRole(arg0 context.Context) (string, error)
GetRole mocks base method.
func (*MockClient) GrantUserRole ¶
func (m *MockClient) GrantUserRole(arg0 context.Context, arg1, arg2 string) error
GrantUserRole mocks base method.
func (*MockClient) JoinMember ¶
func (m *MockClient) JoinMember(arg0 context.Context) error
JoinMember mocks base method.
func (*MockClient) LeaveMember ¶
func (m *MockClient) LeaveMember(arg0 context.Context) error
LeaveMember mocks base method.
func (*MockClient) ListSystemAccounts ¶
func (m *MockClient) ListSystemAccounts(arg0 context.Context) ([]map[string]interface{}, error)
ListSystemAccounts mocks base method.
func (*MockClient) ListUsers ¶
func (m *MockClient) ListUsers(arg0 context.Context) ([]map[string]interface{}, error)
ListUsers mocks base method.
func (*MockClient) RevokeUserRole ¶
func (m *MockClient) RevokeUserRole(arg0 context.Context, arg1, arg2 string) error
RevokeUserRole mocks base method.
func (*MockClient) Switchover ¶
func (m *MockClient) Switchover(arg0 context.Context, arg1, arg2 string) error
Switchover mocks base method.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) CreateUser ¶
func (mr *MockClientMockRecorder) CreateUser(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
CreateUser indicates an expected call of CreateUser.
func (*MockClientMockRecorder) DeleteUser ¶
func (mr *MockClientMockRecorder) DeleteUser(arg0, arg1 interface{}) *gomock.Call
DeleteUser indicates an expected call of DeleteUser.
func (*MockClientMockRecorder) DescribeUser ¶
func (mr *MockClientMockRecorder) DescribeUser(arg0, arg1 interface{}) *gomock.Call
DescribeUser indicates an expected call of DescribeUser.
func (*MockClientMockRecorder) GetRole ¶
func (mr *MockClientMockRecorder) GetRole(arg0 interface{}) *gomock.Call
GetRole indicates an expected call of GetRole.
func (*MockClientMockRecorder) GrantUserRole ¶
func (mr *MockClientMockRecorder) GrantUserRole(arg0, arg1, arg2 interface{}) *gomock.Call
GrantUserRole indicates an expected call of GrantUserRole.
func (*MockClientMockRecorder) JoinMember ¶
func (mr *MockClientMockRecorder) JoinMember(arg0 interface{}) *gomock.Call
JoinMember indicates an expected call of JoinMember.
func (*MockClientMockRecorder) LeaveMember ¶
func (mr *MockClientMockRecorder) LeaveMember(arg0 interface{}) *gomock.Call
LeaveMember indicates an expected call of LeaveMember.
func (*MockClientMockRecorder) ListSystemAccounts ¶
func (mr *MockClientMockRecorder) ListSystemAccounts(arg0 interface{}) *gomock.Call
ListSystemAccounts indicates an expected call of ListSystemAccounts.
func (*MockClientMockRecorder) ListUsers ¶
func (mr *MockClientMockRecorder) ListUsers(arg0 interface{}) *gomock.Call
ListUsers indicates an expected call of ListUsers.
func (*MockClientMockRecorder) RevokeUserRole ¶
func (mr *MockClientMockRecorder) RevokeUserRole(arg0, arg1, arg2 interface{}) *gomock.Call
RevokeUserRole indicates an expected call of RevokeUserRole.
func (*MockClientMockRecorder) Switchover ¶
func (mr *MockClientMockRecorder) Switchover(arg0, arg1, arg2 interface{}) *gomock.Call
Switchover indicates an expected call of Switchover.
type OperationResult ¶
type OperationResult struct {
// contains filtered or unexported fields
}