framework

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package framework is a generated GoMock package.

Package framework is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFromContext

func ConfigFromContext(ctx context.Context) *viper.Viper

The ConfigFromContext function retrieves a viper.Viper configuration from a context.Context, and returns nil if the configuration is not found.

func NewContextKey

func NewContextKey(purpose string) contextKey

NewContextKey creates a new context key based on the given purpose string.

func RunCommand

func RunCommand(runner Runner) func(cmd *cobra.Command, args []string) error

RunCommand is a function that takes in a Runner interface and returns a function that takes in a cobra command and a slice of strings, and returns an error if one occurs during validation or running.

Types

type ConfigFileInterface

type ConfigFileInterface interface {
	ConfigFromContext(ctx context.Context) *viper.Viper
	SetDefaultWorkspace(ctx context.Context, config *viper.Viper, name string) error
	DeleteWorkspace(ctx context.Context, config *viper.Viper, name string) error
	EditWorkspaces(ctx context.Context, config *viper.Viper, workspace *workspaces.Workspace) error
}

type ConfigFileInterfaceImpl

type ConfigFileInterfaceImpl struct {
}

func (*ConfigFileInterfaceImpl) ConfigFromContext

func (i *ConfigFileInterfaceImpl) ConfigFromContext(ctx context.Context) *viper.Viper

ConfigFromContext takes in a context object and returns a viper object, or an error if the context object is invalid.

func (*ConfigFileInterfaceImpl) DeleteWorkspace

func (i *ConfigFileInterfaceImpl) DeleteWorkspace(ctx context.Context, config *viper.Viper, name string) error

DeleteWorkspace deletes a workspace from the configuration file and sets the default workspace to an empty string if the deleted workspace was the default workspace. It returns an error if the workspace could not be deleted.

func (*ConfigFileInterfaceImpl) EditWorkspaces

func (i *ConfigFileInterfaceImpl) EditWorkspaces(ctx context.Context, config *viper.Viper, workspace *workspaces.Workspace) error

EditWorkspaces adds a workspace to a configuration file, ensuring that the workspace name is lowercase and that there are no duplicate workspace names.

func (*ConfigFileInterfaceImpl) SetDefaultWorkspace

func (i *ConfigFileInterfaceImpl) SetDefaultWorkspace(ctx context.Context, config *viper.Viper, name string) error

SetDefaultWorkspace edits the configuration file to set the default workspace to the given name, and returns an error if the operation fails.

type ConfigHolder

type ConfigHolder struct {
	ConfigFilePath  string
	Config          *viper.Viper
	DirectoryConfig *config.DirectoryConfig
}

type Factory

type Factory interface {
	GetBicep() bicep.Interface
	GetConnectionFactory() connections.Factory
	GetConfigHolder() *ConfigHolder
	GetDeploy() deploy.Interface
	GetLogstream() logstream.Interface
	GetOutput() output.Interface

	// GetPortforward fetches the portforward interface.
	GetPortforward() portforward.Interface
	GetPrompter() prompt.Interface
	GetConfigFileInterface() ConfigFileInterface
	GetKubernetesInterface() kubernetes.Interface
	GetHelmInterface() helm.Interface
	GetNamespaceInterface() namespace.Interface

	// GetAWSClient returns the AWS Client.
	GetAWSClient() aws.Client

	// GetAzureClient returns the Azure Client.
	GetAzureClient() azure.Client
}

Factory interface handles resources for interfacing with corerp and configs

type Impl

type Impl struct {
	Bicep               bicep.Interface
	ConnectionFactory   connections.Factory
	ConfigHolder        *ConfigHolder
	Deploy              deploy.Interface
	Logstream           logstream.Interface
	Output              output.Interface
	Portforward         portforward.Interface
	Prompter            prompt.Interface
	ConfigFileInterface ConfigFileInterface
	KubernetesInterface kubernetes.Interface
	HelmInterface       helm.Interface
	NamespaceInterface  namespace.Interface

	// AWSClient is the client for AWS.
	AWSClient aws.Client

	// AzureClient is the client for Azure.
	AzureClient azure.Client
}

func (*Impl) GetAWSClient

func (i *Impl) GetAWSClient() aws.Client

GetAWSClient returns the AWSClient stored in the Impl struct.

func (*Impl) GetAzureClient

func (i *Impl) GetAzureClient() azure.Client

GetAzureClient returns an azure.Client from the Impl struct.

func (*Impl) GetBicep

func (i *Impl) GetBicep() bicep.Interface

GetBicep() returns the Bicep interface stored in the Impl struct.

func (*Impl) GetConfigFileInterface

func (i *Impl) GetConfigFileInterface() ConfigFileInterface

GetConfigFileInterface returns the ConfigFileInterface stored in the Impl struct.

func (*Impl) GetConfigHolder

func (i *Impl) GetConfigHolder() *ConfigHolder

GetConfigHolder() returns a pointer to the ConfigHolder struct stored in the Impl struct.

func (*Impl) GetConnectionFactory

func (i *Impl) GetConnectionFactory() connections.Factory

GetConnectionFactory returns the ConnectionFactory stored in the Impl struct.

func (*Impl) GetDeploy

func (i *Impl) GetDeploy() deploy.Interface

GetDeploy() returns the Deploy interface stored in the Impl struct.

func (*Impl) GetHelmInterface

func (i *Impl) GetHelmInterface() helm.Interface

GetHelmInterface returns the helm.Interface stored in the Impl struct.

func (*Impl) GetKubernetesInterface

func (i *Impl) GetKubernetesInterface() kubernetes.Interface

GetKubernetesInterface returns the KubernetesInterface stored in the Impl struct.

func (*Impl) GetLogstream

func (i *Impl) GetLogstream() logstream.Interface

GetLogstream returns the logstream.Interface stored in the Impl struct.

func (*Impl) GetNamespaceInterface

func (i *Impl) GetNamespaceInterface() namespace.Interface

GetNamespaceInterface returns the namespace interface stored in the Impl struct.

func (*Impl) GetOutput

func (i *Impl) GetOutput() output.Interface

GetOutput() returns the Output interface stored in the Impl struct.

func (*Impl) GetPortforward

func (i *Impl) GetPortforward() portforward.Interface

GetPortforward() returns the portforward.Interface stored in the Impl struct.

func (*Impl) GetPrompter

func (i *Impl) GetPrompter() prompt.Interface

GetPrompter() returns the Prompter field of the Impl struct, which is of type prompt.Interface.

type MockConfigFileInterface

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

MockConfigFileInterface is a mock of ConfigFileInterface interface.

func NewMockConfigFileInterface

func NewMockConfigFileInterface(ctrl *gomock.Controller) *MockConfigFileInterface

NewMockConfigFileInterface creates a new mock instance.

func (*MockConfigFileInterface) ConfigFromContext

func (m *MockConfigFileInterface) ConfigFromContext(arg0 context.Context) *viper.Viper

ConfigFromContext mocks base method.

func (*MockConfigFileInterface) DeleteWorkspace

func (m *MockConfigFileInterface) DeleteWorkspace(arg0 context.Context, arg1 *viper.Viper, arg2 string) error

DeleteWorkspace mocks base method.

func (*MockConfigFileInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockConfigFileInterface) EditWorkspaces

func (m *MockConfigFileInterface) EditWorkspaces(arg0 context.Context, arg1 *viper.Viper, arg2 *workspaces.Workspace) error

EditWorkspaces mocks base method.

func (*MockConfigFileInterface) SetDefaultWorkspace

func (m *MockConfigFileInterface) SetDefaultWorkspace(arg0 context.Context, arg1 *viper.Viper, arg2 string) error

SetDefaultWorkspace mocks base method.

type MockConfigFileInterfaceConfigFromContextCall added in v0.35.0

type MockConfigFileInterfaceConfigFromContextCall struct {
	*gomock.Call
}

MockConfigFileInterfaceConfigFromContextCall wrap *gomock.Call

func (*MockConfigFileInterfaceConfigFromContextCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockConfigFileInterfaceConfigFromContextCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockConfigFileInterfaceConfigFromContextCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockConfigFileInterfaceDeleteWorkspaceCall added in v0.35.0

type MockConfigFileInterfaceDeleteWorkspaceCall struct {
	*gomock.Call
}

MockConfigFileInterfaceDeleteWorkspaceCall wrap *gomock.Call

func (*MockConfigFileInterfaceDeleteWorkspaceCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockConfigFileInterfaceDeleteWorkspaceCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockConfigFileInterfaceDeleteWorkspaceCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockConfigFileInterfaceEditWorkspacesCall added in v0.35.0

type MockConfigFileInterfaceEditWorkspacesCall struct {
	*gomock.Call
}

MockConfigFileInterfaceEditWorkspacesCall wrap *gomock.Call

func (*MockConfigFileInterfaceEditWorkspacesCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockConfigFileInterfaceEditWorkspacesCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockConfigFileInterfaceEditWorkspacesCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockConfigFileInterfaceMockRecorder

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

MockConfigFileInterfaceMockRecorder is the mock recorder for MockConfigFileInterface.

func (*MockConfigFileInterfaceMockRecorder) ConfigFromContext

ConfigFromContext indicates an expected call of ConfigFromContext.

func (*MockConfigFileInterfaceMockRecorder) DeleteWorkspace

DeleteWorkspace indicates an expected call of DeleteWorkspace.

func (*MockConfigFileInterfaceMockRecorder) EditWorkspaces

EditWorkspaces indicates an expected call of EditWorkspaces.

func (*MockConfigFileInterfaceMockRecorder) SetDefaultWorkspace

SetDefaultWorkspace indicates an expected call of SetDefaultWorkspace.

type MockConfigFileInterfaceSetDefaultWorkspaceCall added in v0.35.0

type MockConfigFileInterfaceSetDefaultWorkspaceCall struct {
	*gomock.Call
}

MockConfigFileInterfaceSetDefaultWorkspaceCall wrap *gomock.Call

func (*MockConfigFileInterfaceSetDefaultWorkspaceCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockConfigFileInterfaceSetDefaultWorkspaceCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockConfigFileInterfaceSetDefaultWorkspaceCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockRunner

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

MockRunner is a mock of Runner interface.

func NewMockRunner

func NewMockRunner(ctrl *gomock.Controller) *MockRunner

NewMockRunner creates a new mock instance.

func (*MockRunner) EXPECT

func (m *MockRunner) EXPECT() *MockRunnerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRunner) Run

func (m *MockRunner) Run(arg0 context.Context) error

Run mocks base method.

func (*MockRunner) Validate

func (m *MockRunner) Validate(arg0 *cobra.Command, arg1 []string) error

Validate mocks base method.

type MockRunnerMockRecorder

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

MockRunnerMockRecorder is the mock recorder for MockRunner.

func (*MockRunnerMockRecorder) Run

func (mr *MockRunnerMockRecorder) Run(arg0 interface{}) *gomock.Call

Run indicates an expected call of Run.

func (*MockRunnerMockRecorder) Validate

func (mr *MockRunnerMockRecorder) Validate(arg0, arg1 interface{}) *gomock.Call

Validate indicates an expected call of Validate.

type Runner

type Runner interface {
	Validate(cmd *cobra.Command, args []string) error
	Run(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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