...

Package backend

Overview ▾

Package backend is a generated GoMock package.

Index ▾

Constants
type AddBindingBackend
type FlagsBackend
    func NewFlagsBackend() *FlagsBackend
    func (o *FlagsBackend) AskBindAsFiles(flags map[string]string) (bool, error)
    func (o *FlagsBackend) AskBindingName(_ string, flags map[string]string) (string, error)
    func (o *FlagsBackend) AskNamingStrategy(flags map[string]string) (string, error)
    func (o *FlagsBackend) AskOutputFilePath(flags map[string]string, defaultValue string) (string, error)
    func (o *FlagsBackend) SelectCreationOptions(flags map[string]string) ([]asker.CreationOption, error)
    func (o *FlagsBackend) SelectNamespace(flags map[string]string) (string, error)
    func (o *FlagsBackend) SelectServiceInstance(serviceName string, serviceMap map[string]unstructured.Unstructured) (string, error)
    func (o *FlagsBackend) SelectWorkloadInstance(workloadName string) (string, schema.GroupVersionKind, error)
    func (o *FlagsBackend) Validate(flags map[string]string, withDevfile bool) error
type InteractiveBackend
    func NewInteractiveBackend(askerClient asker.Asker, projectClient project.Client, kubernetesClient kclient.ClientInterface) *InteractiveBackend
    func (o *InteractiveBackend) AskBindAsFiles(_ map[string]string) (bool, error)
    func (o *InteractiveBackend) AskBindingName(defaultName string, _ map[string]string) (string, error)
    func (o *InteractiveBackend) AskNamingStrategy(_ map[string]string) (string, error)
    func (o *InteractiveBackend) AskOutputFilePath(flags map[string]string, defaultValue string) (string, error)
    func (o *InteractiveBackend) SelectCreationOptions(flags map[string]string) ([]asker.CreationOption, error)
    func (o *InteractiveBackend) SelectNamespace(_ map[string]string) (string, error)
    func (o *InteractiveBackend) SelectServiceInstance(_ string, serviceMap map[string]unstructured.Unstructured) (string, error)
    func (o *InteractiveBackend) SelectWorkloadInstance(_ string) (string, schema.GroupVersionKind, error)
    func (o *InteractiveBackend) Validate(_ map[string]string, _ bool) error
type MockAddBindingBackend
    func NewMockAddBindingBackend(ctrl *gomock.Controller) *MockAddBindingBackend
    func (m *MockAddBindingBackend) AskBindAsFiles(flags map[string]string) (bool, error)
    func (m *MockAddBindingBackend) AskBindingName(defaultName string, flags map[string]string) (string, error)
    func (m *MockAddBindingBackend) AskNamingStrategy(flags map[string]string) (string, error)
    func (m *MockAddBindingBackend) AskOutputFilePath(flags map[string]string, defaultValue string) (string, error)
    func (m *MockAddBindingBackend) EXPECT() *MockAddBindingBackendMockRecorder
    func (m *MockAddBindingBackend) SelectCreationOptions(flags map[string]string) ([]asker.CreationOption, error)
    func (m *MockAddBindingBackend) SelectNamespace(flags map[string]string) (string, error)
    func (m *MockAddBindingBackend) SelectServiceInstance(serviceName string, serviceMap map[string]unstructured.Unstructured) (string, error)
    func (m *MockAddBindingBackend) SelectWorkloadInstance(workloadName string) (string, schema.GroupVersionKind, error)
    func (m *MockAddBindingBackend) Validate(flags map[string]string, withDevfile bool) error
type MockAddBindingBackendMockRecorder
    func (mr *MockAddBindingBackendMockRecorder) AskBindAsFiles(flags interface{}) *gomock.Call
    func (mr *MockAddBindingBackendMockRecorder) AskBindingName(defaultName, flags interface{}) *gomock.Call
    func (mr *MockAddBindingBackendMockRecorder) AskNamingStrategy(flags interface{}) *gomock.Call
    func (mr *MockAddBindingBackendMockRecorder) AskOutputFilePath(flags, defaultValue interface{}) *gomock.Call
    func (mr *MockAddBindingBackendMockRecorder) SelectCreationOptions(flags interface{}) *gomock.Call
    func (mr *MockAddBindingBackendMockRecorder) SelectNamespace(flags interface{}) *gomock.Call
    func (mr *MockAddBindingBackendMockRecorder) SelectServiceInstance(serviceName, serviceMap interface{}) *gomock.Call
    func (mr *MockAddBindingBackendMockRecorder) SelectWorkloadInstance(workloadName interface{}) *gomock.Call
    func (mr *MockAddBindingBackendMockRecorder) Validate(flags, withDevfile interface{}) *gomock.Call

Package files

flags.go interactive.go interface.go mock.go

Constants

const (
    FLAG_WORKLOAD          = "workload"
    FLAG_SERVICE           = "service"
    FLAG_SERVICE_NAMESPACE = "service-namespace"
    FLAG_NAME              = "name"
    FLAG_BIND_AS_FILES     = "bind-as-files"
    FLAG_NAMING_STRATEGY   = "naming-strategy"
)

type AddBindingBackend

type AddBindingBackend interface {
    // SelectNamespace returns the namespace which services instances should be listed from.
    // An empty return value means that service instances will be listed from the current namespace.
    SelectNamespace(flags map[string]string) (string, error)
    // Validate returns error if the backend failed to validate; mainly useful for flags backend
    Validate(flags map[string]string, withDevfile bool) error
    // SelectWorkloadInstance asks user to select the workload to be bind;
    // it returns the workload name in the form of '<name> (<kind>.<apigroup>)'
    SelectWorkloadInstance(workloadName string) (string, schema.GroupVersionKind, error)
    // SelectServiceInstance asks user to select the service to be bound to the component;
    // it returns the service name in the form of '<name> (<kind>.<apigroup>)'
    SelectServiceInstance(serviceName string, serviceMap map[string]unstructured.Unstructured) (string, error)
    // AskBindingName asks for the service name to be set
    AskBindingName(defaultName string, flags map[string]string) (string, error)
    // AskBindAsFiles asks if service should be binded as files
    AskBindAsFiles(flags map[string]string) (bool, error)
    // AskNamingStrategy asks for the naming strategy to be used
    AskNamingStrategy(flags map[string]string) (string, error)
    // SelectCreationOption asks to select how to output the created servicebinding
    SelectCreationOptions(flags map[string]string) ([]asker.CreationOption, error)
    // AskOutputFilePath asks for the path of the file to output service binding
    AskOutputFilePath(flags map[string]string, defaultValue string) (string, error)
}

type FlagsBackend

FlagsBackend is a backend that will extract all needed information from flags passed to the command

type FlagsBackend struct{}

func NewFlagsBackend

func NewFlagsBackend() *FlagsBackend

func (*FlagsBackend) AskBindAsFiles

func (o *FlagsBackend) AskBindAsFiles(flags map[string]string) (bool, error)

func (*FlagsBackend) AskBindingName

func (o *FlagsBackend) AskBindingName(_ string, flags map[string]string) (string, error)

func (*FlagsBackend) AskNamingStrategy

func (o *FlagsBackend) AskNamingStrategy(flags map[string]string) (string, error)

func (*FlagsBackend) AskOutputFilePath

func (o *FlagsBackend) AskOutputFilePath(flags map[string]string, defaultValue string) (string, error)

func (*FlagsBackend) SelectCreationOptions

func (o *FlagsBackend) SelectCreationOptions(flags map[string]string) ([]asker.CreationOption, error)

func (*FlagsBackend) SelectNamespace

func (o *FlagsBackend) SelectNamespace(flags map[string]string) (string, error)

func (*FlagsBackend) SelectServiceInstance

func (o *FlagsBackend) SelectServiceInstance(serviceName string, serviceMap map[string]unstructured.Unstructured) (string, error)

SelectServiceInstance parses the service's name, kind, and group from arg:serviceName, after which it checks if the service is available in arg:serviceMap, it further checks for kind, and group If a single service is found, it returns the service name in the form of '<name> (<kind>.<apigroup>)', else errors out. serviceMap: a map of bindable service name with it's unstructured.Unstructured; this map is used to stay independent of the service name format.

func (*FlagsBackend) SelectWorkloadInstance

func (o *FlagsBackend) SelectWorkloadInstance(workloadName string) (string, schema.GroupVersionKind, error)

func (*FlagsBackend) Validate

func (o *FlagsBackend) Validate(flags map[string]string, withDevfile bool) error

type InteractiveBackend

InteractiveBackend is a backend that will ask information interactively using the `asker` package

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

func NewInteractiveBackend

func NewInteractiveBackend(askerClient asker.Asker, projectClient project.Client, kubernetesClient kclient.ClientInterface) *InteractiveBackend

func (*InteractiveBackend) AskBindAsFiles

func (o *InteractiveBackend) AskBindAsFiles(_ map[string]string) (bool, error)

func (*InteractiveBackend) AskBindingName

func (o *InteractiveBackend) AskBindingName(defaultName string, _ map[string]string) (string, error)

func (*InteractiveBackend) AskNamingStrategy

func (o *InteractiveBackend) AskNamingStrategy(_ map[string]string) (string, error)

func (*InteractiveBackend) AskOutputFilePath

func (o *InteractiveBackend) AskOutputFilePath(flags map[string]string, defaultValue string) (string, error)

func (*InteractiveBackend) SelectCreationOptions

func (o *InteractiveBackend) SelectCreationOptions(flags map[string]string) ([]asker.CreationOption, error)

func (*InteractiveBackend) SelectNamespace

func (o *InteractiveBackend) SelectNamespace(_ map[string]string) (string, error)

SelectNamespace prompts users to select the namespace which services instances should be listed from. If they choose all the namespaces they have access to, it attempts to get the list of accessible namespaces in the cluster, from which the user can select one. If the list is empty (e.g. because of permission-related issues), the user is prompted to manually provide a namespace.

func (*InteractiveBackend) SelectServiceInstance

func (o *InteractiveBackend) SelectServiceInstance(_ string, serviceMap map[string]unstructured.Unstructured) (string, error)

func (*InteractiveBackend) SelectWorkloadInstance

func (o *InteractiveBackend) SelectWorkloadInstance(_ string) (string, schema.GroupVersionKind, error)

func (*InteractiveBackend) Validate

func (o *InteractiveBackend) Validate(_ map[string]string, _ bool) error

type MockAddBindingBackend

MockAddBindingBackend is a mock of AddBindingBackend interface.

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

func NewMockAddBindingBackend

func NewMockAddBindingBackend(ctrl *gomock.Controller) *MockAddBindingBackend

NewMockAddBindingBackend creates a new mock instance.

func (*MockAddBindingBackend) AskBindAsFiles

func (m *MockAddBindingBackend) AskBindAsFiles(flags map[string]string) (bool, error)

AskBindAsFiles mocks base method.

func (*MockAddBindingBackend) AskBindingName

func (m *MockAddBindingBackend) AskBindingName(defaultName string, flags map[string]string) (string, error)

AskBindingName mocks base method.

func (*MockAddBindingBackend) AskNamingStrategy

func (m *MockAddBindingBackend) AskNamingStrategy(flags map[string]string) (string, error)

AskNamingStrategy mocks base method.

func (*MockAddBindingBackend) AskOutputFilePath

func (m *MockAddBindingBackend) AskOutputFilePath(flags map[string]string, defaultValue string) (string, error)

AskOutputFilePath mocks base method.

func (*MockAddBindingBackend) EXPECT

func (m *MockAddBindingBackend) EXPECT() *MockAddBindingBackendMockRecorder

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

func (*MockAddBindingBackend) SelectCreationOptions

func (m *MockAddBindingBackend) SelectCreationOptions(flags map[string]string) ([]asker.CreationOption, error)

SelectCreationOptions mocks base method.

func (*MockAddBindingBackend) SelectNamespace

func (m *MockAddBindingBackend) SelectNamespace(flags map[string]string) (string, error)

SelectNamespace mocks base method.

func (*MockAddBindingBackend) SelectServiceInstance

func (m *MockAddBindingBackend) SelectServiceInstance(serviceName string, serviceMap map[string]unstructured.Unstructured) (string, error)

SelectServiceInstance mocks base method.

func (*MockAddBindingBackend) SelectWorkloadInstance

func (m *MockAddBindingBackend) SelectWorkloadInstance(workloadName string) (string, schema.GroupVersionKind, error)

SelectWorkloadInstance mocks base method.

func (*MockAddBindingBackend) Validate

func (m *MockAddBindingBackend) Validate(flags map[string]string, withDevfile bool) error

Validate mocks base method.

type MockAddBindingBackendMockRecorder

MockAddBindingBackendMockRecorder is the mock recorder for MockAddBindingBackend.

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

func (*MockAddBindingBackendMockRecorder) AskBindAsFiles

func (mr *MockAddBindingBackendMockRecorder) AskBindAsFiles(flags interface{}) *gomock.Call

AskBindAsFiles indicates an expected call of AskBindAsFiles.

func (*MockAddBindingBackendMockRecorder) AskBindingName

func (mr *MockAddBindingBackendMockRecorder) AskBindingName(defaultName, flags interface{}) *gomock.Call

AskBindingName indicates an expected call of AskBindingName.

func (*MockAddBindingBackendMockRecorder) AskNamingStrategy

func (mr *MockAddBindingBackendMockRecorder) AskNamingStrategy(flags interface{}) *gomock.Call

AskNamingStrategy indicates an expected call of AskNamingStrategy.

func (*MockAddBindingBackendMockRecorder) AskOutputFilePath

func (mr *MockAddBindingBackendMockRecorder) AskOutputFilePath(flags, defaultValue interface{}) *gomock.Call

AskOutputFilePath indicates an expected call of AskOutputFilePath.

func (*MockAddBindingBackendMockRecorder) SelectCreationOptions

func (mr *MockAddBindingBackendMockRecorder) SelectCreationOptions(flags interface{}) *gomock.Call

SelectCreationOptions indicates an expected call of SelectCreationOptions.

func (*MockAddBindingBackendMockRecorder) SelectNamespace

func (mr *MockAddBindingBackendMockRecorder) SelectNamespace(flags interface{}) *gomock.Call

SelectNamespace indicates an expected call of SelectNamespace.

func (*MockAddBindingBackendMockRecorder) SelectServiceInstance

func (mr *MockAddBindingBackendMockRecorder) SelectServiceInstance(serviceName, serviceMap interface{}) *gomock.Call

SelectServiceInstance indicates an expected call of SelectServiceInstance.

func (*MockAddBindingBackendMockRecorder) SelectWorkloadInstance

func (mr *MockAddBindingBackendMockRecorder) SelectWorkloadInstance(workloadName interface{}) *gomock.Call

SelectWorkloadInstance indicates an expected call of SelectWorkloadInstance.

func (*MockAddBindingBackendMockRecorder) Validate

func (mr *MockAddBindingBackendMockRecorder) Validate(flags, withDevfile interface{}) *gomock.Call

Validate indicates an expected call of Validate.