...

Source file src/github.com/redhat-developer/odo/pkg/binding/interface.go

Documentation: github.com/redhat-developer/odo/pkg/binding

     1  package binding
     2  
     3  import (
     4  	"github.com/devfile/library/v2/pkg/devfile/parser"
     5  	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
     6  	"k8s.io/apimachinery/pkg/runtime/schema"
     7  
     8  	"github.com/redhat-developer/odo/pkg/api"
     9  	"github.com/redhat-developer/odo/pkg/binding/asker"
    10  )
    11  
    12  type Client interface {
    13  	// GetFlags gets the necessary flags for binding
    14  	GetFlags(flags map[string]string) map[string]string
    15  	// GetServiceInstances returns a map of bindable instance name with its unstructured.Unstructured object from the specified namespace, and an error
    16  	GetServiceInstances(namespace string) (map[string]unstructured.Unstructured, error)
    17  	// GetBindingsFromDevfile returns the bindings defined in the devfile with the status extracted from cluster
    18  	GetBindingsFromDevfile(devfileObj parser.DevfileObj, context string) ([]api.ServiceBinding, error)
    19  	// GetBindingFromCluster returns information about a binding in the cluster (either from group binding.operators.coreos.com or servicebinding.io)
    20  	GetBindingFromCluster(name string) (api.ServiceBinding, error)
    21  
    22  	// add.go
    23  
    24  	// SelectNamespace returns the namespace which services instances should be listed from.
    25  	// An empty return value means that service instances will be listed from the current namespace.
    26  	SelectNamespace(flags map[string]string) (string, error)
    27  	// ValidateAddBinding returns error if the backend failed to validate; mainly useful for flags backend
    28  	// withDevfile indicates if a Devfile is present in the current directory
    29  	ValidateAddBinding(flags map[string]string, withDevfile bool) error
    30  	// SelectServiceInstance returns the service to bind to the component
    31  	SelectServiceInstance(flags map[string]string, serviceMap map[string]unstructured.Unstructured) (string, error)
    32  	// SelectWorkloadInstance returns the workload to bind, when a devfile is not in use
    33  	SelectWorkloadInstance(flags map[string]string) (string, schema.GroupVersionKind, error)
    34  	// AskBindingName returns the name to be set for the binding
    35  	AskBindingName(serviceName, componentName string, flags map[string]string) (string, error)
    36  	// AskBindAsFiles asks if the service should be bound as files
    37  	AskBindAsFiles(flags map[string]string) (bool, error)
    38  	// AskNamingStrategy asks the naming strategy to be used for the binding
    39  	AskNamingStrategy(flags map[string]string) (string, error)
    40  	// AddBindingToDevfile adds the ServiceBinding manifest to the devfile
    41  	AddBindingToDevfile(
    42  		componentName string,
    43  		bindingName string,
    44  		bindAsFiles bool,
    45  		serviceNs string,
    46  		namingStrategy string,
    47  		unstructuredService unstructured.Unstructured,
    48  		obj parser.DevfileObj,
    49  	) (parser.DevfileObj, error)
    50  	// AddBinding creates a binding in file and cluster (if options selected)
    51  	// and returns the selected options, the binding definition as string (if option selected)
    52  	// and the filename where definition is written (if options selected)
    53  	AddBinding(
    54  		flags map[string]string,
    55  		bindingName string,
    56  		bindAsFiles bool,
    57  		serviceNs string,
    58  		namingStrategy string,
    59  		unstructuredService unstructured.Unstructured,
    60  		workloadName string,
    61  		workloadGVK schema.GroupVersionKind,
    62  	) (selectedOptions []asker.CreationOption, bindingDef string, filename string, err error)
    63  
    64  	// list.go
    65  
    66  	// ListAllBindings returns all bindings either defined in the Devfile and/or deployed to the cluster
    67  	// inDevfile contains the names of the bindings at least defined in the devfile
    68  	ListAllBindings(devfileObj *parser.DevfileObj, context string) (bindings []api.ServiceBinding, inDevfile []string, err error)
    69  
    70  	// remove.go
    71  
    72  	// ValidateRemoveBinding validates if the command has adequate arguments/flags
    73  	ValidateRemoveBinding(flags map[string]string) error
    74  	// RemoveBinding removes the binding from devfile
    75  	RemoveBinding(bindingName string, obj parser.DevfileObj) (parser.DevfileObj, error)
    76  
    77  	// CheckServiceBindingsInjectionDone checks that all service bindings pointing to component have InjectionReady condition
    78  	CheckServiceBindingsInjectionDone(componentName string, appName string) (bool, error)
    79  }
    80  

View as plain text