1 package asker 2 3 type CreationOption int 4 5 const ( 6 CreateOnCluster CreationOption = iota 7 OutputToStdout 8 OutputToFile 9 ) 10 11 type ServiceInstancesNamespaceListOption int 12 13 const ( 14 CurrentNamespace ServiceInstancesNamespaceListOption = iota + 1 15 AllAccessibleNamespaces 16 ) 17 18 type Asker interface { 19 // SelectNamespaceListOption asks the user to select how service instances should be listed, 20 // i.e. from the current namespace or from all accessible namespaces. 21 // If user selects to list from all accessible namespaces, callers should fetch the list of namespaces 22 // and prompt users to either pick or enter one. 23 // See SelectNamespace and AskNamespace methods. 24 SelectNamespaceListOption() (ServiceInstancesNamespaceListOption, error) 25 // AskNamespace asks the user to enter a namespace 26 AskNamespace() (string, error) 27 // SelectNamespace takes a list of namespaces and asks the user to pick one of them 28 SelectNamespace(options []string) (string, error) 29 // SelectWorkloadResource takes a list of workloads resources and asks user to select one 30 SelectWorkloadResource(options []string) (int, error) 31 // SelectWorkloadResourceName takes a list of workloads resources names and asks user to select one 32 // returns back true if the user selected to go back 33 SelectWorkloadResourceName(names []string) (back bool, selected string, err error) 34 // SelectNamingStrategy asks for the naming strategy to be used from a list of options. 35 // If NamingStrategyCustom is returned, it means the user needs to be prompted for a value. See AskNamingStrategy. 36 SelectNamingStrategy() (string, error) 37 // AskWorkloadResourceName asks user to type resource name 38 AskWorkloadResourceName() (string, error) 39 // AskServiceInstance takes a list of services and asks user to select one 40 AskServiceInstance(serviceInstanceOptions []string) (string, error) 41 // AskServiceBindingName asks for service binding name to be set 42 AskServiceBindingName(defaultName string) (string, error) 43 // AskBindAsFiles asks if service should be binded as files 44 AskBindAsFiles() (bool, error) 45 // AskNamingStrategy prompts for the naming strategy to be used 46 AskNamingStrategy() (string, error) 47 // SelectCreationOptions asks to select creation options for the servicebinding 48 SelectCreationOptions() ([]CreationOption, error) 49 // AskOutputFilePath asks for the path of the file to output service binding 50 AskOutputFilePath(defaultValue string) (string, error) 51 } 52