Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigPath() string
- func ErrInvalidArgument(argument, value string) error
- func ErrMissingArgument(argument string) error
- func ListAvailableProviders(ctx context.Context, factory Factory) ([]string, error)
- func MarkHidden(cmd *cobra.Command, name string)
- func NewTableWriter(out io.Writer) *tablewriter.Table
- func RegisterFlagCompletionFunc(cmd *cobra.Command, name string, fn AutoCompletionFunc)
- type AutoCompletionFunc
- func AutoCompleteCloudResources(factory Factory) AutoCompletionFunc
- func AutoCompleteConfigurations(factory Factory) AutoCompletionFunc
- func AutoCompleteNamespaces(factory Factory) AutoCompletionFunc
- func AutoCompleteWithList(list []string) AutoCompletionFunc
- func AutoCompletionAvailableProviders(factory Factory) AutoCompletionFunc
- func AutoCompletionStages() AutoCompletionFunc
- type Config
- type ConfigInterface
- type Factory
- type OptionFunc
Constants ¶
const ConfigPathEnvName = "TNCTL_CONFIG"
ConfigPathEnvName is the name of the environment variable that holds the config path
Variables ¶
var ( // IconHelp is the help icon IconHelp = color.GreenString("?") // IconGood indicates a successful action IconGood = color.GreenString("✓") // IconBad indicates a failed action IconBad = color.RedString("✗") )
var ErrNoConfigurationProvider = errors.New("no configuration provider defined")
ErrNoConfigurationProvider is returned when no configuration provider is defined
Functions ¶
func ErrInvalidArgument ¶ added in v0.4.0
ErrInvalidArgument is returned when an argument is invalid
func ErrMissingArgument ¶
ErrMissingArgument is returned when a required argument is missing error
func ListAvailableProviders ¶ added in v0.3.14
ListAvailableProviders returns a list of available providers in the cluster
func MarkHidden ¶
MarkHidden marks a command as hidden and panics if an error is thrown
func NewTableWriter ¶ added in v0.3.14
func NewTableWriter(out io.Writer) *tablewriter.Table
NewTableWriter returns a default table writer
func RegisterFlagCompletionFunc ¶
func RegisterFlagCompletionFunc(cmd *cobra.Command, name string, fn AutoCompletionFunc)
RegisterFlagCompletionFunc registers a completion function for a flag
Types ¶
type AutoCompletionFunc ¶
type AutoCompletionFunc func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
AutoCompletionFunc is a function that returns a list of completions
func AutoCompleteCloudResources ¶ added in v0.4.0
func AutoCompleteCloudResources(factory Factory) AutoCompletionFunc
AutoCompleteCloudResources registers a completion function for a flag
func AutoCompleteConfigurations ¶
func AutoCompleteConfigurations(factory Factory) AutoCompletionFunc
AutoCompleteConfigurations registers a completion function for a flag
func AutoCompleteNamespaces ¶
func AutoCompleteNamespaces(factory Factory) AutoCompletionFunc
AutoCompleteNamespaces registers a completion function for a flag
func AutoCompleteWithList ¶
func AutoCompleteWithList(list []string) AutoCompletionFunc
AutoCompleteWithList registers a completion function for a flag
func AutoCompletionAvailableProviders ¶ added in v0.3.14
func AutoCompletionAvailableProviders(factory Factory) AutoCompletionFunc
AutoCompletionAvailableProviders returns a list of available providers in the cluster
func AutoCompletionStages ¶ added in v0.4.0
func AutoCompletionStages() AutoCompletionFunc
AutoCompletionStages returns a completion function for stage names
type Config ¶
type Config struct { // Workflow is the location of the workflow templates. This should point // the git repository that contains the templates. It is assumed the user // consuming these templates already has access the repository setup on // the machine and able to clone. // Example: https://github.com/appvia/terranetes-workflows. Note, if a // ref=TAG is not set, we will query the repository for the latest tag // (Github only) Workflow string `json:"workflow,omitempty"` // Sources defines a list of sources which the search command should // search terraform modules from. Currently we support the public // terraform registry and any Github user or organization. Sources []string `json:"sources,omitempty" yaml:"sources,omitempty"` }
Config is the configuration for the tnctl command
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig returns a default configuration
type ConfigInterface ¶ added in v0.3.3
type ConfigInterface interface { // GetConfig returns the config for the cli if available GetConfig() (Config, error) // HasConfig return true if the config has been defined HasConfig() (bool, error) // SaveConfig saves the configuration to the file SaveConfig(Config) error }
ConfigInterface is the interface that must be implemented by the config struct
func NewFileConfiguration ¶ added in v0.3.3
func NewFileConfiguration(filename string) ConfigInterface
NewFileConfiguration creates and returns a file configuration
type Factory ¶
type Factory interface { // GetConfig returns the config for the cli if available GetConfig() (Config, bool, error) // GetClient returns the client for the kubernetes api GetClient() (client.Client, error) // GetKubeClient returns the kubernetes client GetKubeClient() (k8sclient.Interface, error) // GetStreams returns the input and output streams for the command GetStreams() genericclioptions.IOStreams // Printf prints a message to the output stream Printf(format string, a ...interface{}) // Println prints a message to the output stream Println(format string, a ...interface{}) // SaveConfig saves the configuration to the file SaveConfig(config Config) error // Stdout returns the stdout io writer Stdout() io.Writer }
Factory is the interface that wraps the CLI
func NewFactory ¶
func NewFactory(options ...OptionFunc) (Factory, error)
NewFactory creates and returns a factory for the cli
type OptionFunc ¶ added in v0.3.3
type OptionFunc func(f *factory)
OptionFunc is the function type for the option function
func WithClient ¶ added in v0.3.3
func WithClient(client client.Client) OptionFunc
WithClient sets the kubernetes client
func WithConfiguration ¶ added in v0.3.3
func WithConfiguration(config ConfigInterface) OptionFunc
WithConfiguration sets the configuration provider
func WithKubeClient ¶ added in v0.4.0
func WithKubeClient(client kubernetes.Interface) OptionFunc
WithKubeClient sets the kubernetes client
func WithStreams ¶ added in v0.3.3
func WithStreams(stream genericclioptions.IOStreams) OptionFunc
WithStreams sets the stream