type BindingClient struct {
// contains filtered or unexported fields
}
func NewBindingClient(projectClient project.Client, kubernetesClient kclient.ClientInterface) *BindingClient
func (o *BindingClient) AddBinding( flags map[string]string, bindingName string, bindAsFiles bool, serviceNs string, namingStrategy string, unstructuredService unstructured.Unstructured, workloadName string, workloadGVK schema.GroupVersionKind, ) ([]asker.CreationOption, string, string, error)
func (o *BindingClient) AddBindingToDevfile( componentName string, bindingName string, bindAsFiles bool, serviceNs string, namingStrategy string, unstructuredService unstructured.Unstructured, obj parser.DevfileObj, ) (parser.DevfileObj, error)
func (o *BindingClient) AskBindAsFiles(flags map[string]string) (bool, error)
func (o *BindingClient) AskBindingName(serviceName, componentName string, flags map[string]string) (string, error)
func (o *BindingClient) AskNamingStrategy(flags map[string]string) (string, error)
func (o *BindingClient) CheckServiceBindingsInjectionDone(componentName string, appName string) (bool, error)
func (o *BindingClient) GetBindingFromCluster(name string) (api.ServiceBinding, error)
GetBindingFromCluster returns the ServiceBinding resource with the given name from the cluster, from group binding.operators.coreos.com/v1alpha1 or servicebinding.io/v1alpha3
func (o *BindingClient) GetBindingsFromDevfile(devfileObj parser.DevfileObj, context string) ([]api.ServiceBinding, error)
GetBindingsFromDevfile returns all ServiceBinding resources declared as Kubernertes component from a Devfile from group binding.operators.coreos.com/v1alpha1 or servicebinding.io/v1alpha3 The function also returns status information of the binding in the cluster, if accessible, or a warning if the cluster is not accessible
func (o *BindingClient) GetFlags(flags map[string]string) map[string]string
GetFlags gets the flag specific to add binding operation so that it can correctly decide on the backend to be used It ignores all the flags except the ones specific to add binding operation, for e.g. verbosity flag
func (o *BindingClient) GetServiceInstances(namespace string) (map[string]unstructured.Unstructured, error)
func (o *BindingClient) ListAllBindings(devfileObj *parser.DevfileObj, context string) ([]api.ServiceBinding, []string, error)
ListAllBindings returns the list of Service Binding resources either defined in local Devfile or deployed in the current namespace
func (o *BindingClient) RemoveBinding(servicebindingName string, obj parser.DevfileObj) (parser.DevfileObj, error)
RemoveBinding removes the binding from devfile
func (o *BindingClient) SelectNamespace(flags map[string]string) (string, error)
func (o *BindingClient) SelectServiceInstance(flags map[string]string, serviceMap map[string]unstructured.Unstructured) (string, error)
func (o *BindingClient) SelectWorkloadInstance(flags map[string]string) (string, schema.GroupVersionKind, error)
func (o *BindingClient) ValidateAddBinding(flags map[string]string, withDevfile bool) error
ValidateAddBinding calls Validate method of the adequate backend and then checks if the ServiceBinding Operator is installed in the cluster.
func (o *BindingClient) ValidateRemoveBinding(flags map[string]string) error
ValidateRemoveBinding validates if the command has adequate arguments/flags
BindingSet represents a Set of Bindings, indexed by their names
type BindingSet struct {
// contains filtered or unexported fields
}
type Client interface { // GetFlags gets the necessary flags for binding GetFlags(flags map[string]string) map[string]string // GetServiceInstances returns a map of bindable instance name with its unstructured.Unstructured object from the specified namespace, and an error GetServiceInstances(namespace string) (map[string]unstructured.Unstructured, error) // GetBindingsFromDevfile returns the bindings defined in the devfile with the status extracted from cluster GetBindingsFromDevfile(devfileObj parser.DevfileObj, context string) ([]api.ServiceBinding, error) // GetBindingFromCluster returns information about a binding in the cluster (either from group binding.operators.coreos.com or servicebinding.io) GetBindingFromCluster(name string) (api.ServiceBinding, error) // 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) // ValidateAddBinding returns error if the backend failed to validate; mainly useful for flags backend // withDevfile indicates if a Devfile is present in the current directory ValidateAddBinding(flags map[string]string, withDevfile bool) error // SelectServiceInstance returns the service to bind to the component SelectServiceInstance(flags map[string]string, serviceMap map[string]unstructured.Unstructured) (string, error) // SelectWorkloadInstance returns the workload to bind, when a devfile is not in use SelectWorkloadInstance(flags map[string]string) (string, schema.GroupVersionKind, error) // AskBindingName returns the name to be set for the binding AskBindingName(serviceName, componentName string, flags map[string]string) (string, error) // AskBindAsFiles asks if the service should be bound as files AskBindAsFiles(flags map[string]string) (bool, error) // AskNamingStrategy asks the naming strategy to be used for the binding AskNamingStrategy(flags map[string]string) (string, error) // AddBindingToDevfile adds the ServiceBinding manifest to the devfile AddBindingToDevfile( componentName string, bindingName string, bindAsFiles bool, serviceNs string, namingStrategy string, unstructuredService unstructured.Unstructured, obj parser.DevfileObj, ) (parser.DevfileObj, error) // AddBinding creates a binding in file and cluster (if options selected) // and returns the selected options, the binding definition as string (if option selected) // and the filename where definition is written (if options selected) AddBinding( flags map[string]string, bindingName string, bindAsFiles bool, serviceNs string, namingStrategy string, unstructuredService unstructured.Unstructured, workloadName string, workloadGVK schema.GroupVersionKind, ) (selectedOptions []asker.CreationOption, bindingDef string, filename string, err error) // ListAllBindings returns all bindings either defined in the Devfile and/or deployed to the cluster // inDevfile contains the names of the bindings at least defined in the devfile ListAllBindings(devfileObj *parser.DevfileObj, context string) (bindings []api.ServiceBinding, inDevfile []string, err error) // ValidateRemoveBinding validates if the command has adequate arguments/flags ValidateRemoveBinding(flags map[string]string) error // RemoveBinding removes the binding from devfile RemoveBinding(bindingName string, obj parser.DevfileObj) (parser.DevfileObj, error) // CheckServiceBindingsInjectionDone checks that all service bindings pointing to component have InjectionReady condition CheckServiceBindingsInjectionDone(componentName string, appName string) (bool, error) }
MockClient is a mock of Client interface.
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (m *MockClient) AddBinding(flags map[string]string, bindingName string, bindAsFiles bool, serviceNs, namingStrategy string, unstructuredService unstructured.Unstructured, workloadName string, workloadGVK schema.GroupVersionKind) ([]asker.CreationOption, string, string, error)
AddBinding mocks base method.
func (m *MockClient) AddBindingToDevfile(componentName, bindingName string, bindAsFiles bool, serviceNs, namingStrategy string, unstructuredService unstructured.Unstructured, obj parser.DevfileObj) (parser.DevfileObj, error)
AddBindingToDevfile mocks base method.
func (m *MockClient) AskBindAsFiles(flags map[string]string) (bool, error)
AskBindAsFiles mocks base method.
func (m *MockClient) AskBindingName(serviceName, componentName string, flags map[string]string) (string, error)
AskBindingName mocks base method.
func (m *MockClient) AskNamingStrategy(flags map[string]string) (string, error)
AskNamingStrategy mocks base method.
func (m *MockClient) CheckServiceBindingsInjectionDone(componentName, appName string) (bool, error)
CheckServiceBindingsInjectionDone mocks base method.
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockClient) GetBindingFromCluster(name string) (api.ServiceBinding, error)
GetBindingFromCluster mocks base method.
func (m *MockClient) GetBindingsFromDevfile(devfileObj parser.DevfileObj, context string) ([]api.ServiceBinding, error)
GetBindingsFromDevfile mocks base method.
func (m *MockClient) GetFlags(flags map[string]string) map[string]string
GetFlags mocks base method.
func (m *MockClient) GetServiceInstances(namespace string) (map[string]unstructured.Unstructured, error)
GetServiceInstances mocks base method.
func (m *MockClient) ListAllBindings(devfileObj *parser.DevfileObj, context string) ([]api.ServiceBinding, []string, error)
ListAllBindings mocks base method.
func (m *MockClient) RemoveBinding(bindingName string, obj parser.DevfileObj) (parser.DevfileObj, error)
RemoveBinding mocks base method.
func (m *MockClient) SelectNamespace(flags map[string]string) (string, error)
SelectNamespace mocks base method.
func (m *MockClient) SelectServiceInstance(flags map[string]string, serviceMap map[string]unstructured.Unstructured) (string, error)
SelectServiceInstance mocks base method.
func (m *MockClient) SelectWorkloadInstance(flags map[string]string) (string, schema.GroupVersionKind, error)
SelectWorkloadInstance mocks base method.
func (m *MockClient) ValidateAddBinding(flags map[string]string, withDevfile bool) error
ValidateAddBinding mocks base method.
func (m *MockClient) ValidateRemoveBinding(flags map[string]string) error
ValidateRemoveBinding mocks base method.
MockClientMockRecorder is the mock recorder for MockClient.
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockClientMockRecorder) AddBinding(flags, bindingName, bindAsFiles, serviceNs, namingStrategy, unstructuredService, workloadName, workloadGVK interface{}) *gomock.Call
AddBinding indicates an expected call of AddBinding.
func (mr *MockClientMockRecorder) AddBindingToDevfile(componentName, bindingName, bindAsFiles, serviceNs, namingStrategy, unstructuredService, obj interface{}) *gomock.Call
AddBindingToDevfile indicates an expected call of AddBindingToDevfile.
func (mr *MockClientMockRecorder) AskBindAsFiles(flags interface{}) *gomock.Call
AskBindAsFiles indicates an expected call of AskBindAsFiles.
func (mr *MockClientMockRecorder) AskBindingName(serviceName, componentName, flags interface{}) *gomock.Call
AskBindingName indicates an expected call of AskBindingName.
func (mr *MockClientMockRecorder) AskNamingStrategy(flags interface{}) *gomock.Call
AskNamingStrategy indicates an expected call of AskNamingStrategy.
func (mr *MockClientMockRecorder) CheckServiceBindingsInjectionDone(componentName, appName interface{}) *gomock.Call
CheckServiceBindingsInjectionDone indicates an expected call of CheckServiceBindingsInjectionDone.
func (mr *MockClientMockRecorder) GetBindingFromCluster(name interface{}) *gomock.Call
GetBindingFromCluster indicates an expected call of GetBindingFromCluster.
func (mr *MockClientMockRecorder) GetBindingsFromDevfile(devfileObj, context interface{}) *gomock.Call
GetBindingsFromDevfile indicates an expected call of GetBindingsFromDevfile.
func (mr *MockClientMockRecorder) GetFlags(flags interface{}) *gomock.Call
GetFlags indicates an expected call of GetFlags.
func (mr *MockClientMockRecorder) GetServiceInstances(namespace interface{}) *gomock.Call
GetServiceInstances indicates an expected call of GetServiceInstances.
func (mr *MockClientMockRecorder) ListAllBindings(devfileObj, context interface{}) *gomock.Call
ListAllBindings indicates an expected call of ListAllBindings.
func (mr *MockClientMockRecorder) RemoveBinding(bindingName, obj interface{}) *gomock.Call
RemoveBinding indicates an expected call of RemoveBinding.
func (mr *MockClientMockRecorder) SelectNamespace(flags interface{}) *gomock.Call
SelectNamespace indicates an expected call of SelectNamespace.
func (mr *MockClientMockRecorder) SelectServiceInstance(flags, serviceMap interface{}) *gomock.Call
SelectServiceInstance indicates an expected call of SelectServiceInstance.
func (mr *MockClientMockRecorder) SelectWorkloadInstance(flags interface{}) *gomock.Call
SelectWorkloadInstance indicates an expected call of SelectWorkloadInstance.
func (mr *MockClientMockRecorder) ValidateAddBinding(flags, withDevfile interface{}) *gomock.Call
ValidateAddBinding indicates an expected call of ValidateAddBinding.
func (mr *MockClientMockRecorder) ValidateRemoveBinding(flags interface{}) *gomock.Call
ValidateRemoveBinding indicates an expected call of ValidateRemoveBinding.