config

package
v0.5.38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContextToConfig added in v0.5.27

func AddContextToConfig(contextName string, context Context, configPath string, set bool) error

AddContextToConfig adds context passed to it to mesheryctl config file

func AddTokenToConfig added in v0.5.27

func AddTokenToConfig(token Token, configPath string) error

AddTokenToConfig adds token passed to it to mesheryctl config file

Types

type Context

type Context struct {
	Endpoint string   `mapstructure:"endpoint,omitempty"`
	Token    string   `mapstructure:"token,omitempty"`
	Platform string   `mapstructure:"platform"`
	Adapters []string `mapstructure:"adapters,omitempty"`
	Channel  string   `mapstructure:"channel,omitempty"`
	Version  string   `mapstructure:"version,omitempty"`
}

Context defines a meshery environment

func (*Context) GetAdapters added in v0.5.38

func (ctx *Context) GetAdapters() []string

GetAdapters returns the adapters in the current context

func (*Context) GetChannel added in v0.5.38

func (ctx *Context) GetChannel() string

GetChannel returns the channel of the current context

func (*Context) GetEndpoint added in v0.5.38

func (ctx *Context) GetEndpoint() string

GetEndpoint returns the endpoint of the current context

func (*Context) GetPlatform added in v0.5.38

func (ctx *Context) GetPlatform() string

GetPlatform returns the platform of the current context

func (*Context) GetToken added in v0.5.38

func (ctx *Context) GetToken() string

GetToken returns the token of the current context

func (*Context) GetVersion added in v0.5.38

func (ctx *Context) GetVersion() string

GetVersion returns the version of the current context

func (*Context) SetChannel added in v0.5.38

func (ctx *Context) SetChannel(channel string)

SetChannel sets the channel of the current context

func (*Context) SetEndpoint added in v0.5.38

func (ctx *Context) SetEndpoint(endpoint string)

SetEndpoint sets the endpoint of the current context

func (*Context) SetPlatform added in v0.5.38

func (ctx *Context) SetPlatform(platform string)

SetPlatform sets the platform of the current context

func (*Context) SetToken added in v0.5.38

func (ctx *Context) SetToken(token string)

SetToken sets the token of the current context

func (*Context) SetVersion added in v0.5.38

func (ctx *Context) SetVersion(version string)

SetVersion sets the version of the current context

func (*Context) ValidateVersion added in v0.5.2

func (ctx *Context) ValidateVersion() error

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 `mapstructure:"contexts"`
	CurrentContext string             `mapstructure:"current-context"`
	Tokens         []Token            `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) GetBaseMesheryURL

func (mc *MesheryCtlConfig) GetBaseMesheryURL() string

GetBaseMesheryURL returns the base meshery server URL

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 `mapstructure:"name"`
	Location string `mapstructure:"location"`
}

Token defines the structure of Token stored in mesheryctl

func (*Token) GetLocation added in v0.5.32

func (t *Token) GetLocation() string

GetLocation returns the location of the token

func (*Token) GetName added in v0.5.38

func (t *Token) GetName() string

GetName returns the token name

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) GetBuild

func (v *Version) GetBuild() string

GetBuild returns the build number for the binary

func (*Version) GetCommitSHA

func (v *Version) GetCommitSHA() string

GetCommitSHA returns the commit sha for the binary

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL