Documentation ¶
Index ¶
- type Factory
- type UtilityFactory
- func (f *UtilityFactory) GetAWSClient() (bbAws.Client, error)
- func (f *UtilityFactory) GetCommandExecutor(cmd *cobra.Command, pod *coreV1.Pod, container string, command []string, ...) (remoteCommand.Executor, error)
- func (f *UtilityFactory) GetCommandWrapper(name string, args ...string) (*bbUtilApiWrappers.Command, error)
- func (f *UtilityFactory) GetConfigClient(command *cobra.Command) (*bbConfig.ConfigClient, error)
- func (f *UtilityFactory) GetCredentialHelper() (credentialhelper.CredentialHelper, error)
- func (f *UtilityFactory) GetGitLabClient() (bbGitLab.Client, error)
- func (f *UtilityFactory) GetHelmClient(cmd *cobra.Command, namespace string) (helm.Client, error)
- func (f *UtilityFactory) GetIOStream() (*genericIOOptions.IOStreams, error)
- func (f *UtilityFactory) GetIronBankClient() (ironbank.Client, error)
- func (f *UtilityFactory) GetIstioClientSet(cfg *rest.Config) (bbUtilApiWrappers.IstioClientset, error)
- func (f *UtilityFactory) GetK8sClientset(cmd *cobra.Command) (kubernetes.Interface, error)
- func (f *UtilityFactory) GetK8sDynamicClient(cmd *cobra.Command) (dynamic.Interface, error)
- func (f *UtilityFactory) GetLoggingClient() (bbLog.Client, error)
- func (f *UtilityFactory) GetLoggingClientWithLogger(logger *slog.Logger) (bbLog.Client, error)
- func (f *UtilityFactory) GetOutputClient(cmd *cobra.Command) (bbOutput.Client, error)
- func (f *UtilityFactory) GetPipe() (commonInterfaces.FileLike, commonInterfaces.FileLike, error)
- func (f *UtilityFactory) GetRestConfig(cmd *cobra.Command) (*rest.Config, error)
- func (f *UtilityFactory) GetRuntimeClient(scheme *runtime.Scheme) (runtimeClient.Client, error)
- func (f *UtilityFactory) GetViper() (*viper.Viper, error)
- func (f *UtilityFactory) ReadCredentialsFile(component string, uri string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory interface { GetAWSClient() (bbAws.Client, error) GetGitLabClient() (bbGitLab.Client, error) GetHelmClient(cmd *cobra.Command, namespace string) (helm.Client, error) GetK8sClientset(cmd *cobra.Command) (kubernetes.Interface, error) GetLoggingClient() (bbLog.Client, error) GetLoggingClientWithLogger(logger *slog.Logger) (bbLog.Client, error) GetRuntimeClient(scheme *runtime.Scheme) (runtimeClient.Client, error) GetK8sDynamicClient(cmd *cobra.Command) (dynamic.Interface, error) GetOutputClient(cmd *cobra.Command) (bbOutput.Client, error) GetIronBankClient() (ironbank.Client, error) GetRestConfig(cmd *cobra.Command) (*rest.Config, error) GetCommandExecutor( cmd *cobra.Command, pod *coreV1.Pod, container string, command []string, stdout io.Writer, stderr io.Writer, ) (remoteCommand.Executor, error) GetCredentialHelper() (credentialhelper.CredentialHelper, error) GetCommandWrapper(name string, args ...string) (*bbUtilApiWrappers.Command, error) GetIstioClientSet(cfg *rest.Config) (bbUtilApiWrappers.IstioClientset, error) GetConfigClient(command *cobra.Command) (*bbConfig.ConfigClient, error) GetViper() (*viper.Viper, error) GetIOStream() (*genericIOOptions.IOStreams, error) GetPipe() (commonInterfaces.FileLike, commonInterfaces.FileLike, error) }
Factory is an interface providing initialization methods for various external clients
type UtilityFactory ¶
type UtilityFactory struct {
// contains filtered or unexported fields
}
UtilityFactory is a concrete implementation of the Factory interface containing a pre-initialized Viper instance
func NewFactory ¶
func NewFactory(referenceFactory Factory) *UtilityFactory
NewFactory initializes and returns a new instance of UtilityFactory
func (*UtilityFactory) GetAWSClient ¶
func (f *UtilityFactory) GetAWSClient() (bbAws.Client, error)
GetAWSClient initializes and returns a new AWS API client
func (*UtilityFactory) GetCommandExecutor ¶
func (f *UtilityFactory) GetCommandExecutor( cmd *cobra.Command, pod *coreV1.Pod, container string, command []string, stdout io.Writer, stderr io.Writer, ) (remoteCommand.Executor, error)
GetCommandExecutor initializes and returns a new SPDY executor that can run the given command in a Pod in the k8s cluster
Returns a nil executor and an error if there are any issues with the intialization ¶
func (*UtilityFactory) GetCommandWrapper ¶
func (f *UtilityFactory) GetCommandWrapper( name string, args ...string, ) (*bbUtilApiWrappers.Command, error)
GetCommandWrapper initializes and returns a new Command instance which encapsulates the functionality needed to run a CLI command `name` is the command to execute i.e. kubectl `args` string values are all passed to the command as CLI arguments
func (*UtilityFactory) GetConfigClient ¶
func (f *UtilityFactory) GetConfigClient(command *cobra.Command) (*bbConfig.ConfigClient, error)
GetConfigClient initializes and returns a new bbctl config client
Returns a nil client and an error if there are any issues with the intialization ¶
func (*UtilityFactory) GetCredentialHelper ¶
func (f *UtilityFactory) GetCredentialHelper() (credentialhelper.CredentialHelper, error)
GetCredentialHelper returns a function reference to the configured credential helper function that can be called to fetch credential values. A custom credential helper function is any CLI executable script which can be passed into this function via the bbctl config settings as a file path.
Errors when no credential helper is defined, there is an issue reading credentials from a file, there is an issue running a custom credential helper script, and when an empty value is returned for a requested credential component
func (*UtilityFactory) GetGitLabClient ¶
func (f *UtilityFactory) GetGitLabClient() (bbGitLab.Client, error)
GetGitLabClient initializes and returns a new GitLab API client
func (*UtilityFactory) GetHelmClient ¶
GetHelmClient initializes and returns a new Helm client that can perform operations in the given namespace
Returns a nil client and an error if there are any issues with the intialization ¶
Errors when there are issues with the bbctl configurations
func (*UtilityFactory) GetIOStream ¶
func (f *UtilityFactory) GetIOStream() (*genericIOOptions.IOStreams, error)
GetIOStream initializes and returns a new IOStreams object used to interact with console input, output, and error output
func (*UtilityFactory) GetIronBankClient ¶
func (f *UtilityFactory) GetIronBankClient() (ironbank.Client, error)
GetIronBankClient initializes and returns a new ironbank client
func (*UtilityFactory) GetIstioClientSet ¶
func (f *UtilityFactory) GetIstioClientSet( cfg *rest.Config, ) (bbUtilApiWrappers.IstioClientset, error)
GetIstioClientSet initializes and returns a new istio client set by calling versioned.NewForConfig() with the provided REST config settings
Returns a nil client and an error if there are any issues with the intialization ¶
func (*UtilityFactory) GetK8sClientset ¶
func (f *UtilityFactory) GetK8sClientset(cmd *cobra.Command) (kubernetes.Interface, error)
GetK8sClientset initializes and returns a new k8s client by calling the kubernetes.NewForConfig() function with the REST configuration defined in the bbctl config layered together with any existing KUBECONFIG settings and k8s config CLI parameters
Returns a nil client and an error if there are any issues with the intialization ¶
Errors when there are issues with the bbctl configurations
func (*UtilityFactory) GetK8sDynamicClient ¶
GetK8sDynamicClient initializes and returns a new dynamic k8s client by calling the dynamic.NewForConfig() function with the configuration defined in the bbctl config layered together with any existing KUBECONFIG settings and k8s config CLI parameters
Returns a nil client and an error if there are any issues with the intialization ¶
Errors when there are issues with the bbctl configurations
func (*UtilityFactory) GetLoggingClient ¶
func (f *UtilityFactory) GetLoggingClient() (bbLog.Client, error)
GetLoggingClient initializes and returns a new logging client using the default slog logger implementation
Errors when there are issues initializing the logger
func (*UtilityFactory) GetLoggingClientWithLogger ¶
GetLoggingClientWithLogger initializes and returns a new logging client using the given logger implementation
Errors when there are issues initializing the logger
func (*UtilityFactory) GetOutputClient ¶
GetOutputClient initializes and returns an output client based on the specified format flag and I/O streams. It retrieves the "format" flag from the provided command, initializes an output client getter, and obtains the appropriate output client using the specified format and streams. Default format is "text"
Errors when issues occur using the clients Output method.
func (*UtilityFactory) GetPipe ¶
func (f *UtilityFactory) GetPipe() (commonInterfaces.FileLike, commonInterfaces.FileLike, error)
GetPipe returns the currently set pipe reader and writer
func (*UtilityFactory) GetRestConfig ¶
GetRestConfig returns the k8s REST configuration defined in the bbctl config layered together with any existing KUBECONFIG settings and k8s config CLI parameters
Returns a nil client and an error if there are any issues with the intialization ¶
func (*UtilityFactory) GetRuntimeClient ¶
func (f *UtilityFactory) GetRuntimeClient(scheme *runtime.Scheme) (runtimeClient.Client, error)
GetRuntimeClient initializes and returns a new k8s runtime client by calling the client.New() function
Returns a nil client and an error if there are any issues with the intialization ¶
Errors when there are issues creating the k8s REST config
func (*UtilityFactory) GetViper ¶
func (f *UtilityFactory) GetViper() (*viper.Viper, error)
GetViper returns the viper instance
func (*UtilityFactory) ReadCredentialsFile ¶
func (f *UtilityFactory) ReadCredentialsFile(component string, uri string) (string, error)
ReadCredentialsFile reads the credentials file for the requested uri and attempts to return the string value for the requested component Multiple credentials can be present in the file and are identified by their `uri` field
Credentials file path is pulled from the bbctl config and will default to ~/.bbctl/credentials.yaml when not set
Valid component values are `username` and `password`, any other value will return an error ¶
Errors when the credentials file cannot be accessed or parsed, component value is invalid, and when uri is not found in credentials list
Directories ¶
Path | Synopsis |
---|---|
Package output provides utilities for outputting data in different formats such as JSON, YAML, and text.
|
Package output provides utilities for outputting data in different formats such as JSON, YAML, and text. |