Documentation ¶
Overview ¶
Package secret is a generated GoMock package.
Index ¶
- func GetSecret[T any](ctx context.Context, client Client, name string) (T, error)
- func SaveSecret[T any](ctx context.Context, client Client, name string, value T) error
- type Client
- type ErrInvalid
- type ErrNotFound
- type MockClient
- type MockClientDeleteCall
- type MockClientGetCall
- type MockClientMockRecorder
- type MockClientSaveCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client interface { // Save creates or updates secret. // Returns ErrInvalid in case of invalid input. Save(ctx context.Context, name string, value []byte) error // Delete deletes the secret with the given name. Delete(ctx context.Context, name string) error // Get gets secret name if present else returns an error. // Returns ErrNotFound in case of invalid input. Get(ctx context.Context, name string) ([]byte, error) }
Client is an interface to implement secret operations.
type ErrInvalid ¶
type ErrInvalid struct {
Message string
}
ErrInvalid represents error when resource inputs are invalid.
func (*ErrInvalid) Error ¶
func (e *ErrInvalid) Error() string
Error returns a string representation of the error.
func (*ErrInvalid) Is ¶
func (e *ErrInvalid) Is(target error) bool
Is checks if the target error is of type ErrInvalid and if the message of the target error is equal to the message of the current error or if the message of the target error is empty.
type ErrNotFound ¶
type ErrNotFound struct { }
ErrNotFound represents error when resource is missing.
func (*ErrNotFound) Is ¶
func (e *ErrNotFound) Is(target error) bool
Is checks if the error is of type ErrNotFound.
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) Delete ¶
func (m *MockClient) Delete(arg0 context.Context, arg1 string) error
Delete mocks base method.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockClientDeleteCall ¶ added in v0.35.0
MockClientDeleteCall wrap *gomock.Call
func (*MockClientDeleteCall) Do ¶ added in v0.35.0
func (c *MockClientDeleteCall) Do(f func(context.Context, string) error) *MockClientDeleteCall
Do rewrite *gomock.Call.Do
func (*MockClientDeleteCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientDeleteCall) DoAndReturn(f func(context.Context, string) error) *MockClientDeleteCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientDeleteCall) Return ¶ added in v0.35.0
func (c *MockClientDeleteCall) Return(arg0 error) *MockClientDeleteCall
Return rewrite *gomock.Call.Return
type MockClientGetCall ¶ added in v0.35.0
MockClientGetCall wrap *gomock.Call
func (*MockClientGetCall) Do ¶ added in v0.35.0
func (c *MockClientGetCall) Do(f func(context.Context, string) ([]byte, error)) *MockClientGetCall
Do rewrite *gomock.Call.Do
func (*MockClientGetCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientGetCall) DoAndReturn(f func(context.Context, string) ([]byte, error)) *MockClientGetCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientGetCall) Return ¶ added in v0.35.0
func (c *MockClientGetCall) Return(arg0 []byte, arg1 error) *MockClientGetCall
Return rewrite *gomock.Call.Return
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) Delete ¶
func (mr *MockClientMockRecorder) Delete(arg0, arg1 any) *MockClientDeleteCall
Delete indicates an expected call of Delete.
func (*MockClientMockRecorder) Get ¶
func (mr *MockClientMockRecorder) Get(arg0, arg1 any) *MockClientGetCall
Get indicates an expected call of Get.
func (*MockClientMockRecorder) Save ¶
func (mr *MockClientMockRecorder) Save(arg0, arg1, arg2 any) *MockClientSaveCall
Save indicates an expected call of Save.
type MockClientSaveCall ¶ added in v0.35.0
MockClientSaveCall wrap *gomock.Call
func (*MockClientSaveCall) Do ¶ added in v0.35.0
func (c *MockClientSaveCall) Do(f func(context.Context, string, []byte) error) *MockClientSaveCall
Do rewrite *gomock.Call.Do
func (*MockClientSaveCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientSaveCall) DoAndReturn(f func(context.Context, string, []byte) error) *MockClientSaveCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientSaveCall) Return ¶ added in v0.35.0
func (c *MockClientSaveCall) Return(arg0 error) *MockClientSaveCall
Return rewrite *gomock.Call.Return