Documentation
¶
Index ¶
- func AddChecks(checkConfig *CheckConfig, resources ...[]CheckDefinition)
- func CheckMacroTest[A, B, C, D any](wg *sync.WaitGroup, config *Config, test func(A, B, C, D)) func(A, B, C, D)
- func CheckResources(checkConfig CheckConfig, resources []Resource, ...)
- func CheckTest[A, B, C any](wg *sync.WaitGroup, config *Config, id string, test func(A, B, C)) func(A, B, C)
- func GetLatestReleaseTag(plugin Plugin) (string, error)
- func GetRelease(ctx context.Context, client *github.Client, owner, repo, tag string) (*github.RepositoryRelease, *github.Response, error)
- type Check
- type CheckConfig
- type CheckDefinition
- type CheckFunc
- type Config
- type Ignore
- type Plugin
- type Resource
- type Result
- type T
- type Tests
- type Yatas
- type YatasPlugin
- type YatasRPC
- type YatasRPCServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddChecks ¶ added in v1.5.1
func AddChecks(checkConfig *CheckConfig, resources ...[]CheckDefinition)
func CheckMacroTest ¶
func CheckMacroTest[A, B, C, D any](wg *sync.WaitGroup, config *Config, test func(A, B, C, D)) func(A, B, C, D)
Check Macro test is a wrapper around a category that runs all the checks in the category. It allows for a simpler integration of new categories without bloating the code.
func CheckResources ¶ added in v1.5.0
func CheckResources(checkConfig CheckConfig, resources []Resource, checkDefinitions []CheckDefinition)
func CheckTest ¶
func CheckTest[A, B, C any](wg *sync.WaitGroup, config *Config, id string, test func(A, B, C)) func(A, B, C)
Check test if a wrapper around a check that allows to verify if the check is included or excluded and add some custom logic. It allows for a simpler integration of new tests without bloating the code.
func GetLatestReleaseTag ¶
Types ¶
type Check ¶
type Check struct { Name string `yaml:"name"` // Name of the check Description string `yaml:"description"` // Description of the check Status string `yaml:"status"` // Status of the check - OK, FAIL Id string `yaml:"id"` // ID of the check - unique identifier for the check - AWS_IAM_001 Categories []string `yaml:"categories"` // Category of the check - Security, Cost, Performance, Fault Tolerance, Operational Excellence, etc ... Results []Result `yaml:"results"` // Results of the check Duration time.Duration `yaml:"duration"` // Duration of the check StartTime time.Time EndTime time.Time }
A check is a test that is run on a resource
type CheckConfig ¶
type CheckConfig struct { Wg *sync.WaitGroup // Wait group to wait for all the checks to be done Queue chan Check // Queue to add the results to ConfigYatas *Config // Yatas config }
CheckConfig is a struct that contains all the information needed to run a check.
func (*CheckConfig) Init ¶
func (c *CheckConfig) Init(config *Config)
Init the check config struct. Particularly useful in the categories. It allows to pass the config to the checks and allows them to be run in parallel by adding the results to the queue.
type CheckDefinition ¶ added in v1.5.0
type Config ¶
type Config struct { Plugins []Plugin `yaml:"plugins"` Ignore []Ignore `yaml:"ignore"` PluginConfig []map[string]interface{} `yaml:"pluginsConfiguration"` Tests []Tests `yaml:"tests"` }
func ParseConfig ¶
ParseConfig reads the specified configuration file, parses its content, and returns a Config object. It returns an error if the file cannot be read, the content is not valid YAML, or the configuration is not valid.
func (*Config) CheckExclude ¶
func (*Config) CheckInclude ¶
func (*Config) FindPluginWithName ¶
type Plugin ¶
type Plugin struct { Name string `yaml:"name"` Enabled bool `yaml:"enabled"` Source string `yaml:"source"` Type string `default:"checks" yaml:"type" ` Version string `yaml:"version"` Description string `yaml:"description"` Exclude []string `yaml:"exclude"` Include []string `yaml:"include"` Command string `yaml:"command"` Args []string `yaml:"args"` ExpectedOutput string `yaml:"expected_output"` ExpectedStatus int `yaml:"expected_status"` // Parsed source attributes SourceOwner string SourceRepo string }
func (*Plugin) AssetName ¶
AssetName returns a name that the asset contained in the release should meet. The name must be in a format similar to `yatas-aws_darwin_amd64.zip`.
func (*Plugin) InstallPath ¶
InstallPath returns an installation path from the plugin directory.
type Tests ¶
type Tests struct { Account string `yaml:"account"` // Account name Checks []Check `yaml:"checks"` // Checks }
Wrapper struct that holds all the results of the checks for each account
type YatasPlugin ¶
type YatasPlugin struct { // Impl Injection Impl Yatas }
This is the implementation of plugin.Plugin so we can serve/consume this
This has two methods: Server must return an RPC server for this plugin type. We construct a YatasRPCServer for this.
Client must return an implementation of our interface that communicates over an RPC client. We return YatasRPC for this.
Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.
func (YatasPlugin) Client ¶
func (YatasPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*YatasPlugin) Server ¶
func (p *YatasPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type YatasRPC ¶
type YatasRPC struct {
// contains filtered or unexported fields
}
Here is an implementation that talks over RPC
type YatasRPCServer ¶
type YatasRPCServer struct { // This is the real implementation Impl Yatas }
Here is the RPC server that YatasRPC talks to, conforming to the requirements of net/rpc