Documentation ¶
Index ¶
- type Config
- type ConfigService
- func (s *ConfigService) Create(conf *Config) (*Config, error)
- func (s *ConfigService) Delete(id string) error
- func (s *ConfigService) Get(id string) (*Config, error)
- func (s *ConfigService) GetAll() ([]*Config, error)
- func (s *ConfigService) GetByInterface(ifaceName string) (*Config, error)
- func (s *ConfigService) Update(conf *Config) (*Config, error)
- type Configs
- type JSONRepo
- func (r *JSONRepo) Create(conf *Config) (*Config, error)
- func (r *JSONRepo) Delete(id string) error
- func (r *JSONRepo) Get(id string) (*Config, error)
- func (r *JSONRepo) GetAll() ([]*Config, error)
- func (r *JSONRepo) GetByInterface(ifaceName string) (*Config, error)
- func (r *JSONRepo) Update(conf *Config) (*Config, error)
- type Repo
- type SSHConfig
- type SSHOverride
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ID string `json:"id"` Name string `json:"name"` SSH SSHConfig `json:"ssh"` Interface string `json:"interface"` }
Config represents the data structure of our user provided json configuration
type ConfigService ¶
type ConfigService struct {
// contains filtered or unexported fields
}
nolint:revive ConfigService is an implementation of the config.Service interface
func NewConfigService ¶
func NewConfigService(repo Repo) *ConfigService
NewConfigService returns a new instance of ConfigService
func (*ConfigService) Create ¶
func (s *ConfigService) Create(conf *Config) (*Config, error)
Create creates a new config
func (*ConfigService) Delete ¶
func (s *ConfigService) Delete(id string) error
Delete deletes a config
func (*ConfigService) Get ¶
func (s *ConfigService) Get(id string) (*Config, error)
Get returns a config by id
func (*ConfigService) GetAll ¶
func (s *ConfigService) GetAll() ([]*Config, error)
GetAll returns all stored configs
func (*ConfigService) GetByInterface ¶ added in v1.2.0
func (s *ConfigService) GetByInterface(ifaceName string) (*Config, error)
GetByInterface returns config associated with given interface name
type Configs ¶ added in v1.0.0
type Configs struct {
Configs []*Config `json:"configs"`
}
Configs represents our collection of json configs
type JSONRepo ¶ added in v1.0.0
type JSONRepo struct {
// contains filtered or unexported fields
}
JSONRepo is our repo implementation for json
func NewJSONRepo ¶ added in v1.0.0
NewJSONRepo returns a new ops repo for flat yaml file
func (*JSONRepo) GetByInterface ¶ added in v1.2.0
GetByInterface returns config associated with specific interface name
type Repo ¶
type Repo interface { Get(id string) (*Config, error) GetAll() ([]*Config, error) GetByInterface(ifaceName string) (*Config, error) Create(conf *Config) (*Config, error) Update(conf *Config) (*Config, error) Delete(id string) error }
Repo interface representing access to stored configs
type SSHConfig ¶
type SSHConfig struct { User string `json:"user"` Identity string `json:"identity"` Port string `json:"port"` Overrides []SSHOverride `json:"overrides"` }
SSHConfig represents the config needed to ssh to servers
type SSHOverride ¶
type SSHOverride struct { Target string `json:"target"` User string `json:"user"` Identity string `json:"identity"` Port string `json:"port"` }
SSHOverride represents the config needed to override ssh config for a single target
type Service ¶
type Service interface { Get(id string) (*Config, error) GetAll() ([]*Config, error) GetByInterface(ifaceName string) (*Config, error) Create(conf *Config) (*Config, error) Update(conf *Config) (*Config, error) Delete(id string) error }
Service interface for manipulating configurations