Documentation
¶
Overview ¶
Package config contains the wmctl CLI tool configuration.
Package config contains the wmctl CLI tool configuration.
Index ¶
- Constants
- Variables
- func LeaderStreamClientInterceptor() grpc.StreamClientInterceptor
- func LeaderUnaryClientInterceptor() grpc.UnaryClientInterceptor
- func RequestTimeoutStreamClientInterceptor(timeout time.Duration) grpc.StreamClientInterceptor
- func RequestTimeoutUnaryClientInterceptor(timeout time.Duration) grpc.UnaryClientInterceptor
- type Cluster
- type ClusterConfig
- type Config
- func (c *Config) BindFlags(flags *pflag.FlagSet)
- func (c *Config) DialCurrent() (*grpc.ClientConn, error)
- func (c *Config) GetCluster(name string) *ClusterConfig
- func (c *Config) GetContext(name string) *ContextConfig
- func (c *Config) GetCurrentCluster() *ClusterConfig
- func (c *Config) GetCurrentContext() *ContextConfig
- func (c *Config) GetCurrentUser() *UserConfig
- func (c *Config) GetDialOptions() ([]grpc.DialOption, error)
- func (c *Config) GetUser(name string) *UserConfig
- func (c *Config) LoadFile(filename string) error
- func (c *Config) Marshal(w io.Writer) error
- func (c *Config) NewAdminClient() (v1.AdminClient, io.Closer, error)
- func (c *Config) NewMeshClient() (v1.MeshClient, io.Closer, error)
- func (c *Config) NewNodeClient() (v1.NodeClient, io.Closer, error)
- func (c *Config) NewWebRTCClient() (v1.WebRTCClient, io.Closer, error)
- func (c *Config) SetCurrentContext(name string)
- func (c *Config) TLSConfig() (*tls.Config, error)
- func (c *Config) Unmarshal(r io.Reader) error
- func (c *Config) WriteTo(filename string) error
- type Context
- type ContextConfig
- type Duration
- type User
- type UserConfig
Constants ¶
const ( // APIVersion is the version of the API to use. APIVersion = "webmesh.io/v1" // Kind is the kind of the configuration. It should always be "Config". Kind = "Config" // DefaultServer is the default server to connect to. DefaultServer = "localhost:8443" )
Variables ¶
var ( // DefaultConfigPath is the default path to the CLI configuration file. DefaultConfigPath = filepath.Join(".wmctl", "config.yaml") )
Functions ¶
func LeaderStreamClientInterceptor ¶
func LeaderStreamClientInterceptor() grpc.StreamClientInterceptor
LeaderStreamClientInterceptor returns a gRPC stream client interceptor that adds the prefer-leader metadata to the outgoing context.
func LeaderUnaryClientInterceptor ¶
func LeaderUnaryClientInterceptor() grpc.UnaryClientInterceptor
LeaderUnaryClientInterceptor returns a gRPC unary client interceptor that adds the prefer-leader metadata to the outgoing context.
func RequestTimeoutStreamClientInterceptor ¶
func RequestTimeoutStreamClientInterceptor(timeout time.Duration) grpc.StreamClientInterceptor
RequestTimeoutStreamClientInterceptor returns a gRPC stream client interceptor that adds a timeout to the outgoing context.
func RequestTimeoutUnaryClientInterceptor ¶
func RequestTimeoutUnaryClientInterceptor(timeout time.Duration) grpc.UnaryClientInterceptor
RequestTimeoutUnaryClientInterceptor returns a gRPC unary client interceptor that adds a timeout to the outgoing context.
Types ¶
type Cluster ¶
type Cluster struct {
// Name is the name of the Cluster.
Name string `yaml:"name" json:"name"`
// Cluster is the configuration for the cluster.
Cluster ClusterConfig `yaml:"cluster,omitempty" json:"cluster,omitempty"`
}
Cluster is the named configuration for a cluster.
type ClusterConfig ¶
type ClusterConfig struct {
// Server is the URL of a discovery node in the cluster.
Server string `yaml:"server,omitempty" json:"server,omitempty"`
// Insecure controls whether TLS should be disabled for the cluster connection.
Insecure bool `yaml:"insecure,omitempty" json:"insecure,omitempty"`
// TLSVerifyChainOnly controls whether only the cluster's TLS chain should be verified.
TLSVerifyChainOnly bool `yaml:"tls-verify-chain-only,omitempty" json:"tls-verify-chain-only,omitempty"`
// TLSSkipVerify controls whether the cluster's TLS certificate should be verified.
TLSSkipVerify bool `yaml:"tls-skip-verify,omitempty" json:"tls-skip-verify,omitempty"`
// CertificateAuthorityData is the base64-encoded certificate authority data for the cluster.
CertificateAuthorityData string `yaml:"certificate-authority-data,omitempty" json:"certificate-authority-data,omitempty"`
// PreferLeader controls whether the client should prefer to connect to the cluster leader.
PreferLeader bool `yaml:"prefer-leader,omitempty" json:"prefer-leader,omitempty"`
// ConnectTimeout is the timeout for connecting to the cluster.
ConnectTimeout Duration `yaml:"connect-timeout,omitempty" json:"connect-timeout,omitempty"`
// RequestTimeout is the timeout for requests to the cluster.
RequestTimeout Duration `yaml:"request-timeout,omitempty" json:"request-timeout,omitempty"`
}
ClusterConfig is the configuration for a cluster.
type Config ¶
type Config struct {
// APIVersion is the version of the API to use.
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
// Kind is the kind of the configuration. It should always be "Config".
Kind string `yaml:"kind" json:"kind"`
// Clusters is the list of clusters to connect to.
Clusters []Cluster `yaml:"clusters,omitempty" json:"clusters,omitempty"`
// Users is the list of users to connect as.
Users []User `yaml:"users,omitempty" json:"users,omitempty"`
// Contexts is the list of contexts to connect with.
Contexts []Context `yaml:"contexts,omitempty" json:"contexts,omitempty"`
// CurrentContext is the name of the current context.
CurrentContext string `yaml:"current-context,omitempty" json:"current-context,omitempty"`
}
Config is the wmctl CLI tool configuration.
func FromReader ¶
FromReader creates a configuration from the given reader.
func (*Config) BindFlags ¶
BindFlags binds the configuration to the given flagset. It should be called before flags are parsed.
func (*Config) DialCurrent ¶
func (c *Config) DialCurrent() (*grpc.ClientConn, error)
DialCurrent connects to the current context.
func (*Config) GetCluster ¶
func (c *Config) GetCluster(name string) *ClusterConfig
GetCluster gets a cluster by name.
func (*Config) GetContext ¶
func (c *Config) GetContext(name string) *ContextConfig
GetContext gets a context by name.
func (*Config) GetCurrentCluster ¶
func (c *Config) GetCurrentCluster() *ClusterConfig
GetCurrentCluster returns the current cluster.
func (*Config) GetCurrentContext ¶
func (c *Config) GetCurrentContext() *ContextConfig
GetCurrentContext returns the current context.
func (*Config) GetCurrentUser ¶
func (c *Config) GetCurrentUser() *UserConfig
GetCurrentUser returns the current user.
func (*Config) GetDialOptions ¶ added in v0.4.0
func (c *Config) GetDialOptions() ([]grpc.DialOption, error)
GetDialOptions gets the credentials for the current context.
func (*Config) GetUser ¶
func (c *Config) GetUser(name string) *UserConfig
GetUser gets a user by name.
func (*Config) NewAdminClient ¶
NewAdminClient creates a new Admin gRPC client for the current context.
func (*Config) NewMeshClient ¶
NewMeshClient creates a new Mesh gRPC client for the current context.
func (*Config) NewNodeClient ¶
NewNodeClient creates a new Node gRPC client for the current context.
func (*Config) NewWebRTCClient ¶
NewWebRTCClient creates a new WebRTC gRPC client for the current context.
func (*Config) SetCurrentContext ¶
SetCurrentContext sets the current context.
type Context ¶
type Context struct {
// Name is the name of the context.
Name string `yaml:"name" json:"name"`
// Context is the configuration for the context.
Context ContextConfig `yaml:"context,omitempty" json:"context,omitempty"`
}
Context is the named configuration for a context.
type ContextConfig ¶
type ContextConfig struct {
// Cluster is the name of the cluster to connect to.
Cluster string `yaml:"cluster,omitempty" json:"cluster,omitempty"`
// User is the name of the user to connect as.
User string `yaml:"user,omitempty" json:"user,omitempty"`
}
ContextConfig is the configuration for a context.
type Duration ¶
func (Duration) MarshalJSON ¶
func (Duration) MarshalYAML ¶
func (*Duration) UnmarshalJSON ¶
func (*Duration) UnmarshalYAML ¶
type User ¶
type User struct {
// Name is the name of the user.
Name string `yaml:"name" json:"name"`
// User is the configuration for the user.
User UserConfig `yaml:"user,omitempty" json:"user,omitempty"`
}
User is the named configuration for a user.
type UserConfig ¶
type UserConfig struct {
// ClientCertificateData is the base64-encoded client certificate data for the user.
ClientCertificateData string `yaml:"client-certificate-data,omitempty" json:"client-certificate-data,omitempty"`
// ClientKeyData is the base64-encoded client key data for the user.
ClientKeyData string `yaml:"client-key-data,omitempty" json:"client-key-data,omitempty"`
// BasicAuthUsername is the username for basic authentication.
BasicAuthUsername string `yaml:"basic-auth-username,omitempty" json:"basic-auth-username,omitempty"`
// BasicAuthPassword is the password for basic authentication.
BasicAuthPassword string `yaml:"basic-auth-password,omitempty" json:"basic-auth-password,omitempty"`
// LDAPUsername is the username for LDAP authentication.
LDAPUsername string `yaml:"ldap-username,omitempty" json:"ldap-username,omitempty"`
// LDAPPassword is the password for LDAP authentication.
LDAPPassword string `yaml:"ldap-password,omitempty" json:"ldap-password,omitempty"`
// IDAuthPrivateKey is the private key for ID authentication.
IDAuthPrivateKey string `yaml:"id-auth-public-key,omitempty" json:"id-auth-public-key,omitempty"`
}
UserConfig is the configuration for a user.