Documentation
¶
Index ¶
- type CLI
- func (c *CLI) AddClient(ctx context.Context, name, clientID, clientSecret, tokenURL, scopesStr string) error
- func (c *CLI) DeleteClient(ctx context.Context, clientName string, force bool) error
- func (c *CLI) IssueToken(ctx context.Context, clientName string) error
- func (c *CLI) ListClients(ctx context.Context) error
- func (c *CLI) PromptMasterPassword(isNewVault bool) (string, error)
- type CoreService
- type MockCoreService
- func (_m *MockCoreService) AddClient(ctx context.Context, client core.Client) error
- func (_m *MockCoreService) CheckPassword(ctx context.Context, password string) error
- func (_m *MockCoreService) DeleteClient(ctx context.Context, name string) error
- func (_m *MockCoreService) EXPECT() *MockCoreService_Expecter
- func (_m *MockCoreService) GetAllClients(ctx context.Context) ([]core.Client, error)
- func (_m *MockCoreService) GetClient(ctx context.Context, name string) (*core.Client, error)
- func (_m *MockCoreService) IsRepositoryInitialized() bool
- func (_m *MockCoreService) IssueToken(ctx context.Context, clientName string) (*core.Token, error)
- func (_m *MockCoreService) ListClients(ctx context.Context) ([]string, error)
- type MockCoreService_AddClient_Call
- func (_c *MockCoreService_AddClient_Call) Return(_a0 error) *MockCoreService_AddClient_Call
- func (_c *MockCoreService_AddClient_Call) Run(run func(ctx context.Context, client core.Client)) *MockCoreService_AddClient_Call
- func (_c *MockCoreService_AddClient_Call) RunAndReturn(run func(context.Context, core.Client) error) *MockCoreService_AddClient_Call
- type MockCoreService_CheckPassword_Call
- func (_c *MockCoreService_CheckPassword_Call) Return(_a0 error) *MockCoreService_CheckPassword_Call
- func (_c *MockCoreService_CheckPassword_Call) Run(run func(ctx context.Context, password string)) *MockCoreService_CheckPassword_Call
- func (_c *MockCoreService_CheckPassword_Call) RunAndReturn(run func(context.Context, string) error) *MockCoreService_CheckPassword_Call
- type MockCoreService_DeleteClient_Call
- func (_c *MockCoreService_DeleteClient_Call) Return(_a0 error) *MockCoreService_DeleteClient_Call
- func (_c *MockCoreService_DeleteClient_Call) Run(run func(ctx context.Context, name string)) *MockCoreService_DeleteClient_Call
- func (_c *MockCoreService_DeleteClient_Call) RunAndReturn(run func(context.Context, string) error) *MockCoreService_DeleteClient_Call
- type MockCoreService_Expecter
- func (_e *MockCoreService_Expecter) AddClient(ctx interface{}, client interface{}) *MockCoreService_AddClient_Call
- func (_e *MockCoreService_Expecter) CheckPassword(ctx interface{}, password interface{}) *MockCoreService_CheckPassword_Call
- func (_e *MockCoreService_Expecter) DeleteClient(ctx interface{}, name interface{}) *MockCoreService_DeleteClient_Call
- func (_e *MockCoreService_Expecter) GetAllClients(ctx interface{}) *MockCoreService_GetAllClients_Call
- func (_e *MockCoreService_Expecter) GetClient(ctx interface{}, name interface{}) *MockCoreService_GetClient_Call
- func (_e *MockCoreService_Expecter) IsRepositoryInitialized() *MockCoreService_IsRepositoryInitialized_Call
- func (_e *MockCoreService_Expecter) IssueToken(ctx interface{}, clientName interface{}) *MockCoreService_IssueToken_Call
- func (_e *MockCoreService_Expecter) ListClients(ctx interface{}) *MockCoreService_ListClients_Call
- type MockCoreService_GetAllClients_Call
- func (_c *MockCoreService_GetAllClients_Call) Return(_a0 []core.Client, _a1 error) *MockCoreService_GetAllClients_Call
- func (_c *MockCoreService_GetAllClients_Call) Run(run func(ctx context.Context)) *MockCoreService_GetAllClients_Call
- func (_c *MockCoreService_GetAllClients_Call) RunAndReturn(run func(context.Context) ([]core.Client, error)) *MockCoreService_GetAllClients_Call
- type MockCoreService_GetClient_Call
- func (_c *MockCoreService_GetClient_Call) Return(_a0 *core.Client, _a1 error) *MockCoreService_GetClient_Call
- func (_c *MockCoreService_GetClient_Call) Run(run func(ctx context.Context, name string)) *MockCoreService_GetClient_Call
- func (_c *MockCoreService_GetClient_Call) RunAndReturn(run func(context.Context, string) (*core.Client, error)) *MockCoreService_GetClient_Call
- type MockCoreService_IsRepositoryInitialized_Call
- func (_c *MockCoreService_IsRepositoryInitialized_Call) Return(_a0 bool) *MockCoreService_IsRepositoryInitialized_Call
- func (_c *MockCoreService_IsRepositoryInitialized_Call) Run(run func()) *MockCoreService_IsRepositoryInitialized_Call
- func (_c *MockCoreService_IsRepositoryInitialized_Call) RunAndReturn(run func() bool) *MockCoreService_IsRepositoryInitialized_Call
- type MockCoreService_IssueToken_Call
- func (_c *MockCoreService_IssueToken_Call) Return(_a0 *core.Token, _a1 error) *MockCoreService_IssueToken_Call
- func (_c *MockCoreService_IssueToken_Call) Run(run func(ctx context.Context, clientName string)) *MockCoreService_IssueToken_Call
- func (_c *MockCoreService_IssueToken_Call) RunAndReturn(run func(context.Context, string) (*core.Token, error)) *MockCoreService_IssueToken_Call
- type MockCoreService_ListClients_Call
- func (_c *MockCoreService_ListClients_Call) Return(_a0 []string, _a1 error) *MockCoreService_ListClients_Call
- func (_c *MockCoreService_ListClients_Call) Run(run func(ctx context.Context)) *MockCoreService_ListClients_Call
- func (_c *MockCoreService_ListClients_Call) RunAndReturn(run func(context.Context) ([]string, error)) *MockCoreService_ListClients_Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
CLI implements the command-line interface
func (*CLI) AddClient ¶
func (c *CLI) AddClient(ctx context.Context, name, clientID, clientSecret, tokenURL, scopesStr string) error
AddClient handles the add client flow
func (*CLI) DeleteClient ¶
DeleteClient handles the delete client flow
func (*CLI) IssueToken ¶
IssueToken handles the token issuance flow
func (*CLI) ListClients ¶
ListClients handles the list clients flow
type CoreService ¶
type CoreService interface {
AddClient(ctx context.Context, client core.Client) error
GetClient(ctx context.Context, name string) (*core.Client, error)
ListClients(ctx context.Context) ([]string, error)
GetAllClients(ctx context.Context) ([]core.Client, error)
DeleteClient(ctx context.Context, name string) error
IssueToken(ctx context.Context, clientName string) (*core.Token, error)
IsRepositoryInitialized() bool
CheckPassword(ctx context.Context, password string) error
}
CoreService defines what UI needs from core (interface on consumer side)
type MockCoreService ¶
MockCoreService is an autogenerated mock type for the CoreService type
func NewMockCoreService ¶
func NewMockCoreService(t interface {
mock.TestingT
Cleanup(func())
}) *MockCoreService
NewMockCoreService creates a new instance of MockCoreService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockCoreService) AddClient ¶
AddClient provides a mock function with given fields: ctx, client
func (*MockCoreService) CheckPassword ¶ added in v0.0.2
func (_m *MockCoreService) CheckPassword(ctx context.Context, password string) error
CheckPassword provides a mock function with given fields: ctx, password
func (*MockCoreService) DeleteClient ¶
func (_m *MockCoreService) DeleteClient(ctx context.Context, name string) error
DeleteClient provides a mock function with given fields: ctx, name
func (*MockCoreService) EXPECT ¶
func (_m *MockCoreService) EXPECT() *MockCoreService_Expecter
func (*MockCoreService) GetAllClients ¶
GetAllClients provides a mock function with given fields: ctx
func (*MockCoreService) IsRepositoryInitialized ¶
func (_m *MockCoreService) IsRepositoryInitialized() bool
IsRepositoryInitialized provides a mock function with no fields
func (*MockCoreService) IssueToken ¶
IssueToken provides a mock function with given fields: ctx, clientName
func (*MockCoreService) ListClients ¶
func (_m *MockCoreService) ListClients(ctx context.Context) ([]string, error)
ListClients provides a mock function with given fields: ctx
type MockCoreService_AddClient_Call ¶
MockCoreService_AddClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddClient'
func (*MockCoreService_AddClient_Call) Return ¶
func (_c *MockCoreService_AddClient_Call) Return(_a0 error) *MockCoreService_AddClient_Call
func (*MockCoreService_AddClient_Call) Run ¶
func (_c *MockCoreService_AddClient_Call) Run(run func(ctx context.Context, client core.Client)) *MockCoreService_AddClient_Call
func (*MockCoreService_AddClient_Call) RunAndReturn ¶
func (_c *MockCoreService_AddClient_Call) RunAndReturn(run func(context.Context, core.Client) error) *MockCoreService_AddClient_Call
type MockCoreService_CheckPassword_Call ¶ added in v0.0.2
MockCoreService_CheckPassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckPassword'
func (*MockCoreService_CheckPassword_Call) Return ¶ added in v0.0.2
func (_c *MockCoreService_CheckPassword_Call) Return(_a0 error) *MockCoreService_CheckPassword_Call
func (*MockCoreService_CheckPassword_Call) Run ¶ added in v0.0.2
func (_c *MockCoreService_CheckPassword_Call) Run(run func(ctx context.Context, password string)) *MockCoreService_CheckPassword_Call
func (*MockCoreService_CheckPassword_Call) RunAndReturn ¶ added in v0.0.2
func (_c *MockCoreService_CheckPassword_Call) RunAndReturn(run func(context.Context, string) error) *MockCoreService_CheckPassword_Call
type MockCoreService_DeleteClient_Call ¶
MockCoreService_DeleteClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteClient'
func (*MockCoreService_DeleteClient_Call) Return ¶
func (_c *MockCoreService_DeleteClient_Call) Return(_a0 error) *MockCoreService_DeleteClient_Call
func (*MockCoreService_DeleteClient_Call) Run ¶
func (_c *MockCoreService_DeleteClient_Call) Run(run func(ctx context.Context, name string)) *MockCoreService_DeleteClient_Call
func (*MockCoreService_DeleteClient_Call) RunAndReturn ¶
func (_c *MockCoreService_DeleteClient_Call) RunAndReturn(run func(context.Context, string) error) *MockCoreService_DeleteClient_Call
type MockCoreService_Expecter ¶
type MockCoreService_Expecter struct {
// contains filtered or unexported fields
}
func (*MockCoreService_Expecter) AddClient ¶
func (_e *MockCoreService_Expecter) AddClient(ctx interface{}, client interface{}) *MockCoreService_AddClient_Call
AddClient is a helper method to define mock.On call
- ctx context.Context
- client core.Client
func (*MockCoreService_Expecter) CheckPassword ¶ added in v0.0.2
func (_e *MockCoreService_Expecter) CheckPassword(ctx interface{}, password interface{}) *MockCoreService_CheckPassword_Call
CheckPassword is a helper method to define mock.On call
- ctx context.Context
- password string
func (*MockCoreService_Expecter) DeleteClient ¶
func (_e *MockCoreService_Expecter) DeleteClient(ctx interface{}, name interface{}) *MockCoreService_DeleteClient_Call
DeleteClient is a helper method to define mock.On call
- ctx context.Context
- name string
func (*MockCoreService_Expecter) GetAllClients ¶
func (_e *MockCoreService_Expecter) GetAllClients(ctx interface{}) *MockCoreService_GetAllClients_Call
GetAllClients is a helper method to define mock.On call
- ctx context.Context
func (*MockCoreService_Expecter) GetClient ¶
func (_e *MockCoreService_Expecter) GetClient(ctx interface{}, name interface{}) *MockCoreService_GetClient_Call
GetClient is a helper method to define mock.On call
- ctx context.Context
- name string
func (*MockCoreService_Expecter) IsRepositoryInitialized ¶
func (_e *MockCoreService_Expecter) IsRepositoryInitialized() *MockCoreService_IsRepositoryInitialized_Call
IsRepositoryInitialized is a helper method to define mock.On call
func (*MockCoreService_Expecter) IssueToken ¶
func (_e *MockCoreService_Expecter) IssueToken(ctx interface{}, clientName interface{}) *MockCoreService_IssueToken_Call
IssueToken is a helper method to define mock.On call
- ctx context.Context
- clientName string
func (*MockCoreService_Expecter) ListClients ¶
func (_e *MockCoreService_Expecter) ListClients(ctx interface{}) *MockCoreService_ListClients_Call
ListClients is a helper method to define mock.On call
- ctx context.Context
type MockCoreService_GetAllClients_Call ¶
MockCoreService_GetAllClients_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllClients'
func (*MockCoreService_GetAllClients_Call) Return ¶
func (_c *MockCoreService_GetAllClients_Call) Return(_a0 []core.Client, _a1 error) *MockCoreService_GetAllClients_Call
func (*MockCoreService_GetAllClients_Call) Run ¶
func (_c *MockCoreService_GetAllClients_Call) Run(run func(ctx context.Context)) *MockCoreService_GetAllClients_Call
func (*MockCoreService_GetAllClients_Call) RunAndReturn ¶
func (_c *MockCoreService_GetAllClients_Call) RunAndReturn(run func(context.Context) ([]core.Client, error)) *MockCoreService_GetAllClients_Call
type MockCoreService_GetClient_Call ¶
MockCoreService_GetClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClient'
func (*MockCoreService_GetClient_Call) Return ¶
func (_c *MockCoreService_GetClient_Call) Return(_a0 *core.Client, _a1 error) *MockCoreService_GetClient_Call
func (*MockCoreService_GetClient_Call) Run ¶
func (_c *MockCoreService_GetClient_Call) Run(run func(ctx context.Context, name string)) *MockCoreService_GetClient_Call
func (*MockCoreService_GetClient_Call) RunAndReturn ¶
func (_c *MockCoreService_GetClient_Call) RunAndReturn(run func(context.Context, string) (*core.Client, error)) *MockCoreService_GetClient_Call
type MockCoreService_IsRepositoryInitialized_Call ¶
MockCoreService_IsRepositoryInitialized_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsRepositoryInitialized'
func (*MockCoreService_IsRepositoryInitialized_Call) Return ¶
func (_c *MockCoreService_IsRepositoryInitialized_Call) Return(_a0 bool) *MockCoreService_IsRepositoryInitialized_Call
func (*MockCoreService_IsRepositoryInitialized_Call) Run ¶
func (_c *MockCoreService_IsRepositoryInitialized_Call) Run(run func()) *MockCoreService_IsRepositoryInitialized_Call
func (*MockCoreService_IsRepositoryInitialized_Call) RunAndReturn ¶
func (_c *MockCoreService_IsRepositoryInitialized_Call) RunAndReturn(run func() bool) *MockCoreService_IsRepositoryInitialized_Call
type MockCoreService_IssueToken_Call ¶
MockCoreService_IssueToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IssueToken'
func (*MockCoreService_IssueToken_Call) Return ¶
func (_c *MockCoreService_IssueToken_Call) Return(_a0 *core.Token, _a1 error) *MockCoreService_IssueToken_Call
func (*MockCoreService_IssueToken_Call) Run ¶
func (_c *MockCoreService_IssueToken_Call) Run(run func(ctx context.Context, clientName string)) *MockCoreService_IssueToken_Call
func (*MockCoreService_IssueToken_Call) RunAndReturn ¶
func (_c *MockCoreService_IssueToken_Call) RunAndReturn(run func(context.Context, string) (*core.Token, error)) *MockCoreService_IssueToken_Call
type MockCoreService_ListClients_Call ¶
MockCoreService_ListClients_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListClients'
func (*MockCoreService_ListClients_Call) Return ¶
func (_c *MockCoreService_ListClients_Call) Return(_a0 []string, _a1 error) *MockCoreService_ListClients_Call
func (*MockCoreService_ListClients_Call) Run ¶
func (_c *MockCoreService_ListClients_Call) Run(run func(ctx context.Context)) *MockCoreService_ListClients_Call
func (*MockCoreService_ListClients_Call) RunAndReturn ¶
func (_c *MockCoreService_ListClients_Call) RunAndReturn(run func(context.Context) ([]string, error)) *MockCoreService_ListClients_Call