Documentation ¶
Index ¶
- Constants
- func AddContextToConfig(contextName string, context Context, configPath string, set bool, ...) error
- func AddTokenToConfig(token Token, configPath string) error
- func DeleteTokenFromConfig(tokenName string, configPath string) error
- func ErrInvalidMeshConfig(err error) error
- func ErrUpdateConfig(err error) error
- func SetTokenToConfig(tokenName string, configPath string, ctxName string) error
- func UpdateContextInConfig(context *Context, name string) error
- type Context
- func (ctx *Context) GetChannel() string
- func (ctx *Context) GetComponents() []string
- func (ctx *Context) GetEndpoint() string
- func (ctx *Context) GetOperatorStatus() string
- func (ctx *Context) GetPlatform() string
- func (ctx *Context) GetProvider() string
- func (ctx *Context) GetToken() string
- func (ctx *Context) GetVersion() string
- func (ctx *Context) SetChannel(channel string)
- func (ctx *Context) SetEndpoint(endpoint string)
- func (ctx *Context) SetOperatorStatus(status string)
- func (ctx *Context) SetPlatform(platform string)
- func (ctx *Context) SetProvider(provider string)
- func (ctx *Context) SetToken(token string)
- func (ctx *Context) SetVersion(version string)
- func (ctx *Context) ValidateVersion() error
- type MesheryCtlConfig
- func (mc *MesheryCtlConfig) CheckIfCurrentContextIsValid() (*Context, error)
- func (mc *MesheryCtlConfig) CheckIfGivenContextIsValid(name string) (*Context, error)
- func (mc *MesheryCtlConfig) GetBaseMesheryURL() string
- func (mc *MesheryCtlConfig) GetContext(name string) (*Context, error)
- func (mc *MesheryCtlConfig) GetCurrentContext() (*Context, error)
- func (mc *MesheryCtlConfig) GetCurrentContextName() string
- func (mc *MesheryCtlConfig) GetTokenForContext(contextName string) (Token, error)
- func (mc *MesheryCtlConfig) GetTokens() *[]Token
- func (mc *MesheryCtlConfig) SetCurrentContext(contextName string) error
- type Token
- type Version
Constants ¶
const ( ErrInvalidMeshConfigCode = "replace_me" ErrUpdateConfigCode = "replace_me" )
Variables ¶
This section is empty.
Functions ¶
func AddContextToConfig ¶ added in v0.5.27
func AddContextToConfig(contextName string, context Context, configPath string, set bool, overwrite bool) error
AddContextToConfig adds context passed to it to mesheryctl config file. If overwrite is set to true, existing context with the contextName is overwritten
func AddTokenToConfig ¶ added in v0.5.27
AddTokenToConfig adds token passed to it to mesheryctl config file
func DeleteTokenFromConfig ¶ added in v0.5.39
DeleteTokenFromConfig deletes a token passed to it to mesheryctl config file
func ErrInvalidMeshConfig ¶ added in v0.6.132
func ErrUpdateConfig ¶ added in v0.6.137
func SetTokenToConfig ¶ added in v0.5.39
func UpdateContextInConfig ¶ added in v0.6.2
UpdateContextInConfig write the given context in meshconfig
Types ¶
type Context ¶
type Context struct { Endpoint string `yaml:"endpoint,omitempty" mapstructure:"endpoint,omitempty"` Token string `yaml:"token,omitempty" mapstructure:"token,omitempty"` Platform string `yaml:"platform" mapstructure:"platform"` Components []string `yaml:"components,omitempty" mapstructure:"components,omitempty"` Channel string `yaml:"channel,omitempty" mapstructure:"channel,omitempty"` Version string `yaml:"version,omitempty" mapstructure:"version,omitempty"` Provider string `yaml:"provider,omitempty" mapstructure:"provider,omitempty"` Operator string `yaml:"operator,omitempty" mapstructure:"operator,omitempty"` }
Context defines a meshery environment
func (*Context) GetChannel ¶ added in v0.5.38
GetChannel returns the channel of the current context
func (*Context) GetComponents ¶ added in v0.6.2
GetComponents returns the components in the current context
func (*Context) GetEndpoint ¶ added in v0.5.38
GetEndpoint returns the endpoint of the current context
func (*Context) GetOperatorStatus ¶ added in v0.6.88
GetOperatorStatus returns a string that denotes the operator status
func (*Context) GetPlatform ¶ added in v0.5.38
GetPlatform returns the platform of the current context
func (*Context) GetProvider ¶ added in v0.6.45
GetProvider returns the provider of the current context
func (*Context) GetVersion ¶ added in v0.5.38
GetVersion returns the version of the current context
func (*Context) SetChannel ¶ added in v0.5.38
SetChannel sets the channel of the current context
func (*Context) SetEndpoint ¶ added in v0.5.38
SetEndpoint sets the endpoint of the current context
func (*Context) SetOperatorStatus ¶ added in v0.6.88
SetOperatorStatus can be used to set operator status
func (*Context) SetPlatform ¶ added in v0.5.38
SetPlatform sets the platform of the current context
func (*Context) SetProvider ¶ added in v0.6.45
SetProvider sets the provider of the current context
func (*Context) SetVersion ¶ added in v0.5.38
SetVersion sets the version of the current context
func (*Context) ValidateVersion ¶ added in v0.5.2
ValidateVersion checks if the version is valid, if empty sets it to default value latest. Returns an error if the version is invalid.
type MesheryCtlConfig ¶
type MesheryCtlConfig struct { Contexts map[string]Context `yaml:"contexts" mapstructure:"contexts"` CurrentContext string `yaml:"current-context" mapstructure:"current-context"` Tokens []Token `yaml:"tokens" mapstructure:"tokens"` }
MesheryCtlConfig is configuration structure of mesheryctl with contexts
func GetMesheryCtl ¶
func GetMesheryCtl(v *viper.Viper) (*MesheryCtlConfig, error)
GetMesheryCtl returns a reference to the mesheryctl configuration object
func (*MesheryCtlConfig) CheckIfCurrentContextIsValid ¶
func (mc *MesheryCtlConfig) CheckIfCurrentContextIsValid() (*Context, error)
CheckIfCurrentContextIsValid checks if current context is valid
func (*MesheryCtlConfig) CheckIfGivenContextIsValid ¶ added in v0.5.39
func (mc *MesheryCtlConfig) CheckIfGivenContextIsValid(name string) (*Context, error)
func (*MesheryCtlConfig) GetBaseMesheryURL ¶
func (mc *MesheryCtlConfig) GetBaseMesheryURL() string
GetBaseMesheryURL returns the base meshery server URL
func (*MesheryCtlConfig) GetContext ¶ added in v0.5.39
func (mc *MesheryCtlConfig) GetContext(name string) (*Context, error)
Get any context
func (*MesheryCtlConfig) GetCurrentContext ¶
func (mc *MesheryCtlConfig) GetCurrentContext() (*Context, error)
GetCurrentContext returns contents of the current context
func (*MesheryCtlConfig) GetCurrentContextName ¶ added in v0.5.38
func (mc *MesheryCtlConfig) GetCurrentContextName() string
func (*MesheryCtlConfig) GetTokenForContext ¶ added in v0.5.32
func (mc *MesheryCtlConfig) GetTokenForContext(contextName string) (Token, error)
GetTokenForContext takes in the contextName and returns the token name and path corresponding to the given current context
func (*MesheryCtlConfig) GetTokens ¶ added in v0.5.38
func (mc *MesheryCtlConfig) GetTokens() *[]Token
GetTokens returns the tokens present in the config file
func (*MesheryCtlConfig) SetCurrentContext ¶
func (mc *MesheryCtlConfig) SetCurrentContext(contextName string) error
SetCurrentContext sets current context and returns contents of the current context
type Token ¶
type Token struct { Name string `yaml:"name" mapstructure:"name"` Location string `yaml:"location" mapstructure:"location"` }
Token defines the structure of Token stored in mesheryctl
func (*Token) GetLocation ¶ added in v0.5.32
GetLocation returns the location of the token
func (*Token) SetLocation ¶ added in v0.5.39
SetLocation sets the location of the token
type Version ¶
type Version struct { Build string `json:"build,omitempty"` CommitSHA string `json:"commitsha,omitempty"` ReleaseChannel string `json:"release_channel,omitempty"` }
Version unmarshals the json response from the server's version api
func (*Version) GetCommitSHA ¶
GetCommitSHA returns the commit sha for the binary