Documentation
¶
Overview ¶
* Copyright The Microcks Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Variables
- func CreateTLSConfig() *tls.Config
- func DefaultConfigDir() (string, error)
- func DefaultLocalConfigPath() (string, error)
- func DumpRequestIfRequired(name string, req *http.Request, body bool)
- func DumpResponseIfRequired(name string, resp *http.Response, body bool)
- func SaveConfig(path string, cfg *Config) error
- func ValidateLocalConfig(config LocalConfig) error
- func WriteLocalConfig(config LocalConfig, configPath string) error
- type Auth
- type Config
- type Context
- type ContextRef
- type Instance
- type LocalConfig
- func (l *LocalConfig) DeleteLocalConfig(configPath string) error
- func (l *LocalConfig) GetAuth(server string) (*Auth, error)
- func (l *LocalConfig) GetInstance(name string) (*Instance, error)
- func (l *LocalConfig) GetServer(name string) (*Server, error)
- func (l *LocalConfig) GetUser(name string) (*User, error)
- func (l *LocalConfig) IsEmpty() bool
- func (l *LocalConfig) RemoveAuth(server string) bool
- func (l *LocalConfig) RemoveContext(serverName string) (string, bool)
- func (l *LocalConfig) RemoveInstance(instanceName string) bool
- func (l *LocalConfig) RemoveServer(serverName string) bool
- func (l *LocalConfig) RemoveUser(serverName string) bool
- func (l *LocalConfig) ResolveContext(name string) (*Context, error)
- func (l *LocalConfig) UpserAuth(auth Auth)
- func (l *LocalConfig) UpserContext(context ContextRef)
- func (l *LocalConfig) UpsertInstance(instance Instance)
- func (l *LocalConfig) UpsertServer(server Server)
- func (l *LocalConfig) UpsertUser(user User)
- type Server
- type User
Constants ¶
This section is empty.
Variables ¶
var ( // InsecureTLS defines if TLS transport should accept insecure certs. InsecureTLS bool = false // CaCertPaths defines extra paths (comma-separated) of CRT files to add to system CA Roots. CaCertPaths string // Verbose represents a debug flag for HTTP Exchanges Verbose bool = false ConfigPath = filepath.Join(os.Getenv("HOME"), ".microcks-cli", "config.yaml") )
Functions ¶
func CreateTLSConfig ¶
CreateTLSConfig wraps the creation of tls.Config object for use with HTTP Client for example.
func DefaultConfigDir ¶
DefaultConfigDir returns the local configuration path for settings such as cached authentication tokens.
func DefaultLocalConfigPath ¶
DefaultLocalConfigPath returns the local configuration path for settings such as cached authentication tokens.
func DumpRequestIfRequired ¶
DumpRequestIfRequired takes care of dumping request if configured that way
func DumpResponseIfRequired ¶
DumpResponseIfRequired takes care of dumping request if configured that way
func SaveConfig ¶
func ValidateLocalConfig ¶
func ValidateLocalConfig(config LocalConfig) error
func WriteLocalConfig ¶
func WriteLocalConfig(config LocalConfig, configPath string) error
WriteLocalConfig writes a new local configuration file.
Types ¶
type Config ¶
type Config struct {
Instance struct {
Name string `yaml:"name"`
Image string `yaml:"image"`
Status string `yaml:"status"`
Port string `yaml:"port"`
ContainerID string `yaml:"containerID"`
AutoRemove bool `yaml:"autoRemove"`
Driver string `yaml:"driver"`
} `yaml:"instance"`
}
func EnsureConfig ¶
func LoadConfig ¶
type ContextRef ¶
type LocalConfig ¶
type LocalConfig struct {
CurrentContext string `yaml:"current-context"`
Contexts []ContextRef `yaml:"contexts"`
Servers []Server `yaml:"servers"`
Users []User `yaml:"users"`
Instances []Instance `yaml:"instances"`
Auths []Auth `yaml:"auths"`
}
func ReadLocalConfig ¶
func ReadLocalConfig(path string) (*LocalConfig, error)
ReadLocalConfig loads up the local configuration file. Returns nil if config does not exist
func (*LocalConfig) DeleteLocalConfig ¶
func (l *LocalConfig) DeleteLocalConfig(configPath string) error
func (*LocalConfig) GetInstance ¶
func (l *LocalConfig) GetInstance(name string) (*Instance, error)
func (*LocalConfig) IsEmpty ¶
func (l *LocalConfig) IsEmpty() bool
func (*LocalConfig) RemoveAuth ¶
func (l *LocalConfig) RemoveAuth(server string) bool
func (*LocalConfig) RemoveContext ¶
func (l *LocalConfig) RemoveContext(serverName string) (string, bool)
func (*LocalConfig) RemoveInstance ¶
func (l *LocalConfig) RemoveInstance(instanceName string) bool
Returns true if server was removed successfully
func (*LocalConfig) RemoveServer ¶
func (l *LocalConfig) RemoveServer(serverName string) bool
Returns true if server was removed successfully
func (*LocalConfig) RemoveUser ¶
func (l *LocalConfig) RemoveUser(serverName string) bool
Returns true if user was removed successfully
func (*LocalConfig) ResolveContext ¶
func (l *LocalConfig) ResolveContext(name string) (*Context, error)
ResolveContext resolves the specified context. If unspecified, resolves the current context
func (*LocalConfig) UpserAuth ¶
func (l *LocalConfig) UpserAuth(auth Auth)
func (*LocalConfig) UpserContext ¶
func (l *LocalConfig) UpserContext(context ContextRef)
func (*LocalConfig) UpsertInstance ¶
func (l *LocalConfig) UpsertInstance(instance Instance)
func (*LocalConfig) UpsertServer ¶
func (l *LocalConfig) UpsertServer(server Server)
func (*LocalConfig) UpsertUser ¶
func (l *LocalConfig) UpsertUser(user User)