Documentation ¶
Index ¶
- Variables
- type AuthContext
- type Config
- type ConfigImpl
- func (c *ConfigImpl) CreateContext(ctx context.Context, name, token, url, caCert string) error
- func (c *ConfigImpl) DeleteContext(name string) error
- func (c *ConfigImpl) GetAccountId(ctx context.Context) (string, error)
- func (c *ConfigImpl) GetCurrentContext() *AuthContext
- func (c *ConfigImpl) GetUser(ctx context.Context) (*cfrest.User, error)
- func (c *ConfigImpl) Load(_ *cobra.Command, _ []string) error
- func (c *ConfigImpl) NewAdHocClient(ctx context.Context, url, token, caCert string) (codefresh.Codefresh, error)
- func (c *ConfigImpl) NewClient() codefresh.Codefresh
- func (c *ConfigImpl) RequireAuthentication(cmd *cobra.Command, args []string) error
- func (c *ConfigImpl) Save() error
- func (c *ConfigImpl) UseContext(ctx context.Context, name string) error
- func (c *ConfigImpl) 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), ), ) } NewCodefresh = func(opts *codefresh.ClientOptions) codefresh.Codefresh { return codefresh.New(opts) } )
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"` DefaultRuntime string `mapstructure:"defaultRuntime" json:"defaultRuntime,omitempty"` CACert string `mapstructure:"caCert" json:"caCert,omitempty"` }
type Config ¶
type Config interface { CreateContext(ctx context.Context, name, token, url, caCert string) error DeleteContext(name string) error GetAccountId(ctx context.Context) (string, error) GetCurrentContext() *AuthContext GetUser(ctx context.Context) (*cfrest.User, error) Load(cmd *cobra.Command, args []string) error NewAdHocClient(ctx context.Context, url, token, caCert string) (codefresh.Codefresh, error) NewClient() codefresh.Codefresh RequireAuthentication(cmd *cobra.Command, args []string) error Save() error UseContext(ctx context.Context, name string) error Write(ctx context.Context, w io.Writer) error }
type ConfigImpl ¶ added in v0.1.43
type ConfigImpl struct { CurrentContext string `mapstructure:"current-context" json:"current-context"` Contexts map[string]*AuthContext `mapstructure:"contexts" json:"contexts"` // contains filtered or unexported fields }
func (*ConfigImpl) CreateContext ¶ added in v0.1.43
func (c *ConfigImpl) CreateContext(ctx context.Context, name, token, url, caCert string) error
func (*ConfigImpl) DeleteContext ¶ added in v0.1.43
func (c *ConfigImpl) DeleteContext(name string) error
Delete
func (*ConfigImpl) GetAccountId ¶ added in v0.1.43
func (c *ConfigImpl) GetAccountId(ctx context.Context) (string, error)
func (*ConfigImpl) GetCurrentContext ¶ added in v0.1.43
func (c *ConfigImpl) GetCurrentContext() *AuthContext
GetCurrentContext returns current authentication context or the one specified with --auth-context.
func (*ConfigImpl) Load ¶ added in v0.1.43
func (c *ConfigImpl) Load(_ *cobra.Command, _ []string) error
func (*ConfigImpl) NewAdHocClient ¶ added in v0.1.43
func (*ConfigImpl) NewClient ¶ added in v0.1.43
func (c *ConfigImpl) NewClient() codefresh.Codefresh
NewClient creates a new codefresh client for the current context or for override context (if specified with --auth-context).
func (*ConfigImpl) RequireAuthentication ¶ added in v0.1.43
func (c *ConfigImpl) RequireAuthentication(cmd *cobra.Command, args []string) error
RequireAuthentication is ment to be used as cobra PreRunE or PersistentPreRunE function on commands that require authentication context.
func (*ConfigImpl) Save ¶ added in v0.1.43
func (c *ConfigImpl) Save() error
Save persists the config to the file it was read from
func (*ConfigImpl) UseContext ¶ added in v0.1.43
func (c *ConfigImpl) UseContext(ctx context.Context, name string) error
Click to show internal directories.
Click to hide internal directories.