Documentation ¶
Index ¶
- Variables
- type AuthContext
- type Config
- func (c *Config) CreateContext(ctx context.Context, name, token, url string) error
- func (c *Config) DeleteContext(name string) error
- func (c *Config) GetCurrentContext() *AuthContext
- func (c *Config) Load(cmd *cobra.Command, args []string) error
- func (c *Config) NewClient() codefresh.Codefresh
- func (c *Config) RequireAuthentication(cmd *cobra.Command, args []string) error
- func (c *Config) Save() error
- func (c *Config) UseContext(ctx context.Context, name string) error
- func (c *Config) Write(ctx context.Context, w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidConfig = errors.New("invalid config") ErrContextDoesNotExist = func(context string) error { return fmt.Errorf( util.Doc( fmt.Sprintf("%s: current context \"%s\" does not exist in config file. run '<BIN> config create-context' to create one.", ErrInvalidConfig, context), ), ) } )
Errors
Functions ¶
This section is empty.
Types ¶
type AuthContext ¶
type AuthContext struct { Type string `mapstructure:"type" json:"type"` Name string `mapstructure:"name" json:"name"` URL string `mapstructure:"url" json:"url"` Token string `mapstructure:"token" json:"token"` Beta bool `mapstructure:"beta" json:"beta"` OnPrem bool `mapstructure:"onPrem" json:"onPrem"` DefaultRuntime string `mapstructure:"defaultRuntime" json:"defaultRuntime"` // contains filtered or unexported fields }
type Config ¶
type Config struct { CurrentContext string `mapstructure:"current-context" json:"current-context"` Contexts map[string]*AuthContext `mapstructure:"contexts" json:"contexts"` // contains filtered or unexported fields }
func (*Config) CreateContext ¶
func (*Config) GetCurrentContext ¶
func (c *Config) GetCurrentContext() *AuthContext
GetCurrentContext returns current authentication context or the one specified with --auth-context.
func (*Config) NewClient ¶
NewClient creates a new codefresh client for the current context or for override context (if specified with --auth-context).
func (*Config) RequireAuthentication ¶
RequireAuthentication is ment to be used as cobra PreRunE or PersistentPreRunE function on commands that require authentication context.
Click to show internal directories.
Click to hide internal directories.