Documentation
¶
Index ¶
- func TryConvertErrorToAttrs(err error) []interface{}
- type CommandHelper
- func (r *CommandHelper) GetArgs() []string
- func (r *CommandHelper) GetBuildInfo() (*build.Info, error)
- func (r *CommandHelper) GetCmd() *cobra.Command
- func (r *CommandHelper) GetConfig() (config.Hook, error)
- func (r *CommandHelper) GetContext() context.Context
- func (r *CommandHelper) GetKonnectSDKFactory() helpers.SDKFactory
- func (r *CommandHelper) GetLogger() (*slog.Logger, error)
- func (r *CommandHelper) GetOutputFormat() (common.OutputFormat, error)
- func (r *CommandHelper) GetProduct() (products.ProductValue, error)
- func (r *CommandHelper) GetStreams() *iostreams.IOStreams
- func (r *CommandHelper) GetVerb() (verbs.VerbValue, error)
- type Common
- type ConfigurationError
- type ExecutionError
- type FlagEnum
- type Helper
- type MockHelper
- func (_m *MockHelper) EXPECT() *MockHelper_Expecter
- func (_m *MockHelper) GetArgs() []string
- func (_m *MockHelper) GetBuildInfo() (*build.Info, error)
- func (_m *MockHelper) GetCmd() *cobra.Command
- func (_m *MockHelper) GetConfig() (config.Hook, error)
- func (_m *MockHelper) GetContext() context.Context
- func (_m *MockHelper) GetKonnectSDKFactory() helpers.SDKFactory
- func (_m *MockHelper) GetLogger() (*slog.Logger, error)
- func (_m *MockHelper) GetOutputFormat() (common.OutputFormat, error)
- func (_m *MockHelper) GetProduct() (products.ProductValue, error)
- func (_m *MockHelper) GetStreams() *iostreams.IOStreams
- func (_m *MockHelper) GetVerb() (verbs.VerbValue, error)
- type MockHelper_Expecter
- func (_e *MockHelper_Expecter) GetArgs() *MockHelper_GetArgs_Call
- func (_e *MockHelper_Expecter) GetBuildInfo() *MockHelper_GetBuildInfo_Call
- func (_e *MockHelper_Expecter) GetCmd() *MockHelper_GetCmd_Call
- func (_e *MockHelper_Expecter) GetConfig() *MockHelper_GetConfig_Call
- func (_e *MockHelper_Expecter) GetContext() *MockHelper_GetContext_Call
- func (_e *MockHelper_Expecter) GetKonnectSDKFactory() *MockHelper_GetKonnectSDKFactory_Call
- func (_e *MockHelper_Expecter) GetLogger() *MockHelper_GetLogger_Call
- func (_e *MockHelper_Expecter) GetOutputFormat() *MockHelper_GetOutputFormat_Call
- func (_e *MockHelper_Expecter) GetProduct() *MockHelper_GetProduct_Call
- func (_e *MockHelper_Expecter) GetStreams() *MockHelper_GetStreams_Call
- func (_e *MockHelper_Expecter) GetVerb() *MockHelper_GetVerb_Call
- type MockHelper_GetArgs_Call
- type MockHelper_GetBuildInfo_Call
- func (_c *MockHelper_GetBuildInfo_Call) Return(_a0 *build.Info, _a1 error) *MockHelper_GetBuildInfo_Call
- func (_c *MockHelper_GetBuildInfo_Call) Run(run func()) *MockHelper_GetBuildInfo_Call
- func (_c *MockHelper_GetBuildInfo_Call) RunAndReturn(run func() (*build.Info, error)) *MockHelper_GetBuildInfo_Call
- type MockHelper_GetCmd_Call
- type MockHelper_GetConfig_Call
- type MockHelper_GetContext_Call
- type MockHelper_GetKonnectSDKFactory_Call
- func (_c *MockHelper_GetKonnectSDKFactory_Call) Return(_a0 helpers.SDKFactory) *MockHelper_GetKonnectSDKFactory_Call
- func (_c *MockHelper_GetKonnectSDKFactory_Call) Run(run func()) *MockHelper_GetKonnectSDKFactory_Call
- func (_c *MockHelper_GetKonnectSDKFactory_Call) RunAndReturn(run func() helpers.SDKFactory) *MockHelper_GetKonnectSDKFactory_Call
- type MockHelper_GetLogger_Call
- type MockHelper_GetOutputFormat_Call
- func (_c *MockHelper_GetOutputFormat_Call) Return(_a0 common.OutputFormat, _a1 error) *MockHelper_GetOutputFormat_Call
- func (_c *MockHelper_GetOutputFormat_Call) Run(run func()) *MockHelper_GetOutputFormat_Call
- func (_c *MockHelper_GetOutputFormat_Call) RunAndReturn(run func() (common.OutputFormat, error)) *MockHelper_GetOutputFormat_Call
- type MockHelper_GetProduct_Call
- func (_c *MockHelper_GetProduct_Call) Return(_a0 products.ProductValue, _a1 error) *MockHelper_GetProduct_Call
- func (_c *MockHelper_GetProduct_Call) Run(run func()) *MockHelper_GetProduct_Call
- func (_c *MockHelper_GetProduct_Call) RunAndReturn(run func() (products.ProductValue, error)) *MockHelper_GetProduct_Call
- type MockHelper_GetStreams_Call
- type MockHelper_GetVerb_Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TryConvertErrorToAttrs ¶
func TryConvertErrorToAttrs(err error) []interface{}
Will try and json unmarshal an error string into a slice of interfaces that match the slog algorithm for varadic parameters (alternating key value pairs)
Types ¶
type CommandHelper ¶
type CommandHelper struct { // Cmd is a pointer to the command that is being executed Cmd *cobra.Command // Args are the arguments (not flags) passed to the command Args []string }
func (*CommandHelper) GetArgs ¶
func (r *CommandHelper) GetArgs() []string
func (*CommandHelper) GetBuildInfo ¶
func (r *CommandHelper) GetBuildInfo() (*build.Info, error)
func (*CommandHelper) GetCmd ¶
func (r *CommandHelper) GetCmd() *cobra.Command
func (*CommandHelper) GetContext ¶
func (r *CommandHelper) GetContext() context.Context
func (*CommandHelper) GetKonnectSDKFactory ¶
func (r *CommandHelper) GetKonnectSDKFactory() helpers.SDKFactory
func (*CommandHelper) GetOutputFormat ¶
func (r *CommandHelper) GetOutputFormat() (common.OutputFormat, error)
func (*CommandHelper) GetProduct ¶
func (r *CommandHelper) GetProduct() (products.ProductValue, error)
func (*CommandHelper) GetStreams ¶
func (r *CommandHelper) GetStreams() *iostreams.IOStreams
type ConfigurationError ¶
type ConfigurationError struct {
Err error
}
ConfigurationError represents errors that are a result of bad flags, combinations of flags, configuration settings, environment values, or other command usage issues.
func (*ConfigurationError) Error ¶
func (e *ConfigurationError) Error() string
type ExecutionError ¶
type ExecutionError struct { // friendly error message to display to the user Msg string // Err is the error that occurred during execution Err error // Optional attributes that can be used to provide additional context to the error Attrs []interface{} }
ExecutionError represents errors that occur after a command has been validated and an unsuccessful result occurs. Network errors, server side errors, invalid credentials or responses are examples of RunttimeError types.
func PrepareExecutionError ¶
This will construct an execution error AND turn off error and usage output for the command
func (*ExecutionError) Error ¶
func (e *ExecutionError) Error() string
type Helper ¶
type Helper interface { GetCmd() *cobra.Command GetArgs() []string GetVerb() (verbs.VerbValue, error) GetProduct() (products.ProductValue, error) GetStreams() *iostreams.IOStreams GetConfig() (config.Hook, error) GetOutputFormat() (common.OutputFormat, error) GetLogger() (*slog.Logger, error) GetBuildInfo() (*build.Info, error) GetContext() context.Context GetKonnectSDKFactory() helpers.SDKFactory }
type MockHelper ¶
MockHelper is an autogenerated mock type for the Helper type
func NewMockHelper ¶
func NewMockHelper(t interface { mock.TestingT Cleanup(func()) }) *MockHelper
NewMockHelper creates a new instance of MockHelper. 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 (*MockHelper) EXPECT ¶
func (_m *MockHelper) EXPECT() *MockHelper_Expecter
func (*MockHelper) GetArgs ¶
func (_m *MockHelper) GetArgs() []string
GetArgs provides a mock function with given fields:
func (*MockHelper) GetBuildInfo ¶
func (_m *MockHelper) GetBuildInfo() (*build.Info, error)
GetBuildInfo provides a mock function with given fields:
func (*MockHelper) GetCmd ¶
func (_m *MockHelper) GetCmd() *cobra.Command
GetCmd provides a mock function with given fields:
func (*MockHelper) GetConfig ¶
func (_m *MockHelper) GetConfig() (config.Hook, error)
GetConfig provides a mock function with given fields:
func (*MockHelper) GetContext ¶
func (_m *MockHelper) GetContext() context.Context
GetContext provides a mock function with given fields:
func (*MockHelper) GetKonnectSDKFactory ¶
func (_m *MockHelper) GetKonnectSDKFactory() helpers.SDKFactory
GetKonnectSDKFactory provides a mock function with given fields:
func (*MockHelper) GetLogger ¶
func (_m *MockHelper) GetLogger() (*slog.Logger, error)
GetLogger provides a mock function with given fields:
func (*MockHelper) GetOutputFormat ¶
func (_m *MockHelper) GetOutputFormat() (common.OutputFormat, error)
GetOutputFormat provides a mock function with given fields:
func (*MockHelper) GetProduct ¶
func (_m *MockHelper) GetProduct() (products.ProductValue, error)
GetProduct provides a mock function with given fields:
func (*MockHelper) GetStreams ¶
func (_m *MockHelper) GetStreams() *iostreams.IOStreams
GetStreams provides a mock function with given fields:
type MockHelper_Expecter ¶
type MockHelper_Expecter struct {
// contains filtered or unexported fields
}
func (*MockHelper_Expecter) GetArgs ¶
func (_e *MockHelper_Expecter) GetArgs() *MockHelper_GetArgs_Call
GetArgs is a helper method to define mock.On call
func (*MockHelper_Expecter) GetBuildInfo ¶
func (_e *MockHelper_Expecter) GetBuildInfo() *MockHelper_GetBuildInfo_Call
GetBuildInfo is a helper method to define mock.On call
func (*MockHelper_Expecter) GetCmd ¶
func (_e *MockHelper_Expecter) GetCmd() *MockHelper_GetCmd_Call
GetCmd is a helper method to define mock.On call
func (*MockHelper_Expecter) GetConfig ¶
func (_e *MockHelper_Expecter) GetConfig() *MockHelper_GetConfig_Call
GetConfig is a helper method to define mock.On call
func (*MockHelper_Expecter) GetContext ¶
func (_e *MockHelper_Expecter) GetContext() *MockHelper_GetContext_Call
GetContext is a helper method to define mock.On call
func (*MockHelper_Expecter) GetKonnectSDKFactory ¶
func (_e *MockHelper_Expecter) GetKonnectSDKFactory() *MockHelper_GetKonnectSDKFactory_Call
GetKonnectSDKFactory is a helper method to define mock.On call
func (*MockHelper_Expecter) GetLogger ¶
func (_e *MockHelper_Expecter) GetLogger() *MockHelper_GetLogger_Call
GetLogger is a helper method to define mock.On call
func (*MockHelper_Expecter) GetOutputFormat ¶
func (_e *MockHelper_Expecter) GetOutputFormat() *MockHelper_GetOutputFormat_Call
GetOutputFormat is a helper method to define mock.On call
func (*MockHelper_Expecter) GetProduct ¶
func (_e *MockHelper_Expecter) GetProduct() *MockHelper_GetProduct_Call
GetProduct is a helper method to define mock.On call
func (*MockHelper_Expecter) GetStreams ¶
func (_e *MockHelper_Expecter) GetStreams() *MockHelper_GetStreams_Call
GetStreams is a helper method to define mock.On call
func (*MockHelper_Expecter) GetVerb ¶
func (_e *MockHelper_Expecter) GetVerb() *MockHelper_GetVerb_Call
GetVerb is a helper method to define mock.On call
type MockHelper_GetArgs_Call ¶
MockHelper_GetArgs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetArgs'
func (*MockHelper_GetArgs_Call) Return ¶
func (_c *MockHelper_GetArgs_Call) Return(_a0 []string) *MockHelper_GetArgs_Call
func (*MockHelper_GetArgs_Call) Run ¶
func (_c *MockHelper_GetArgs_Call) Run(run func()) *MockHelper_GetArgs_Call
func (*MockHelper_GetArgs_Call) RunAndReturn ¶
func (_c *MockHelper_GetArgs_Call) RunAndReturn(run func() []string) *MockHelper_GetArgs_Call
type MockHelper_GetBuildInfo_Call ¶
MockHelper_GetBuildInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBuildInfo'
func (*MockHelper_GetBuildInfo_Call) Return ¶
func (_c *MockHelper_GetBuildInfo_Call) Return(_a0 *build.Info, _a1 error) *MockHelper_GetBuildInfo_Call
func (*MockHelper_GetBuildInfo_Call) Run ¶
func (_c *MockHelper_GetBuildInfo_Call) Run(run func()) *MockHelper_GetBuildInfo_Call
func (*MockHelper_GetBuildInfo_Call) RunAndReturn ¶
func (_c *MockHelper_GetBuildInfo_Call) RunAndReturn(run func() (*build.Info, error)) *MockHelper_GetBuildInfo_Call
type MockHelper_GetCmd_Call ¶
MockHelper_GetCmd_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCmd'
func (*MockHelper_GetCmd_Call) Return ¶
func (_c *MockHelper_GetCmd_Call) Return(_a0 *cobra.Command) *MockHelper_GetCmd_Call
func (*MockHelper_GetCmd_Call) Run ¶
func (_c *MockHelper_GetCmd_Call) Run(run func()) *MockHelper_GetCmd_Call
func (*MockHelper_GetCmd_Call) RunAndReturn ¶
func (_c *MockHelper_GetCmd_Call) RunAndReturn(run func() *cobra.Command) *MockHelper_GetCmd_Call
type MockHelper_GetConfig_Call ¶
MockHelper_GetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConfig'
func (*MockHelper_GetConfig_Call) Return ¶
func (_c *MockHelper_GetConfig_Call) Return(_a0 config.Hook, _a1 error) *MockHelper_GetConfig_Call
func (*MockHelper_GetConfig_Call) Run ¶
func (_c *MockHelper_GetConfig_Call) Run(run func()) *MockHelper_GetConfig_Call
func (*MockHelper_GetConfig_Call) RunAndReturn ¶
func (_c *MockHelper_GetConfig_Call) RunAndReturn(run func() (config.Hook, error)) *MockHelper_GetConfig_Call
type MockHelper_GetContext_Call ¶
MockHelper_GetContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetContext'
func (*MockHelper_GetContext_Call) Return ¶
func (_c *MockHelper_GetContext_Call) Return(_a0 context.Context) *MockHelper_GetContext_Call
func (*MockHelper_GetContext_Call) Run ¶
func (_c *MockHelper_GetContext_Call) Run(run func()) *MockHelper_GetContext_Call
func (*MockHelper_GetContext_Call) RunAndReturn ¶
func (_c *MockHelper_GetContext_Call) RunAndReturn(run func() context.Context) *MockHelper_GetContext_Call
type MockHelper_GetKonnectSDKFactory_Call ¶
MockHelper_GetKonnectSDKFactory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKonnectSDKFactory'
func (*MockHelper_GetKonnectSDKFactory_Call) Return ¶
func (_c *MockHelper_GetKonnectSDKFactory_Call) Return(_a0 helpers.SDKFactory) *MockHelper_GetKonnectSDKFactory_Call
func (*MockHelper_GetKonnectSDKFactory_Call) Run ¶
func (_c *MockHelper_GetKonnectSDKFactory_Call) Run(run func()) *MockHelper_GetKonnectSDKFactory_Call
func (*MockHelper_GetKonnectSDKFactory_Call) RunAndReturn ¶
func (_c *MockHelper_GetKonnectSDKFactory_Call) RunAndReturn(run func() helpers.SDKFactory) *MockHelper_GetKonnectSDKFactory_Call
type MockHelper_GetLogger_Call ¶
MockHelper_GetLogger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLogger'
func (*MockHelper_GetLogger_Call) Return ¶
func (_c *MockHelper_GetLogger_Call) Return(_a0 *slog.Logger, _a1 error) *MockHelper_GetLogger_Call
func (*MockHelper_GetLogger_Call) Run ¶
func (_c *MockHelper_GetLogger_Call) Run(run func()) *MockHelper_GetLogger_Call
func (*MockHelper_GetLogger_Call) RunAndReturn ¶
func (_c *MockHelper_GetLogger_Call) RunAndReturn(run func() (*slog.Logger, error)) *MockHelper_GetLogger_Call
type MockHelper_GetOutputFormat_Call ¶
MockHelper_GetOutputFormat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOutputFormat'
func (*MockHelper_GetOutputFormat_Call) Return ¶
func (_c *MockHelper_GetOutputFormat_Call) Return(_a0 common.OutputFormat, _a1 error) *MockHelper_GetOutputFormat_Call
func (*MockHelper_GetOutputFormat_Call) Run ¶
func (_c *MockHelper_GetOutputFormat_Call) Run(run func()) *MockHelper_GetOutputFormat_Call
func (*MockHelper_GetOutputFormat_Call) RunAndReturn ¶
func (_c *MockHelper_GetOutputFormat_Call) RunAndReturn(run func() (common.OutputFormat, error)) *MockHelper_GetOutputFormat_Call
type MockHelper_GetProduct_Call ¶
MockHelper_GetProduct_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProduct'
func (*MockHelper_GetProduct_Call) Return ¶
func (_c *MockHelper_GetProduct_Call) Return(_a0 products.ProductValue, _a1 error) *MockHelper_GetProduct_Call
func (*MockHelper_GetProduct_Call) Run ¶
func (_c *MockHelper_GetProduct_Call) Run(run func()) *MockHelper_GetProduct_Call
func (*MockHelper_GetProduct_Call) RunAndReturn ¶
func (_c *MockHelper_GetProduct_Call) RunAndReturn(run func() (products.ProductValue, error)) *MockHelper_GetProduct_Call
type MockHelper_GetStreams_Call ¶
MockHelper_GetStreams_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStreams'
func (*MockHelper_GetStreams_Call) Return ¶
func (_c *MockHelper_GetStreams_Call) Return(_a0 *iostreams.IOStreams) *MockHelper_GetStreams_Call
func (*MockHelper_GetStreams_Call) Run ¶
func (_c *MockHelper_GetStreams_Call) Run(run func()) *MockHelper_GetStreams_Call
func (*MockHelper_GetStreams_Call) RunAndReturn ¶
func (_c *MockHelper_GetStreams_Call) RunAndReturn(run func() *iostreams.IOStreams) *MockHelper_GetStreams_Call
type MockHelper_GetVerb_Call ¶
MockHelper_GetVerb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetVerb'
func (*MockHelper_GetVerb_Call) Return ¶
func (_c *MockHelper_GetVerb_Call) Return(_a0 verbs.VerbValue, _a1 error) *MockHelper_GetVerb_Call
func (*MockHelper_GetVerb_Call) Run ¶
func (_c *MockHelper_GetVerb_Call) Run(run func()) *MockHelper_GetVerb_Call
func (*MockHelper_GetVerb_Call) RunAndReturn ¶
func (_c *MockHelper_GetVerb_Call) RunAndReturn(run func() (verbs.VerbValue, error)) *MockHelper_GetVerb_Call