config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountConfig

type AccountConfig struct {
	Name  string `yaml:"name"`
	ID    int64  `yaml:"id"`
	Role  string `yaml:"role"`
	Owner string `yaml:"owner"`
}

AccountConfig identifies an AWS account we want to monitor

type Config

type Config struct {
	Version     int                 `yaml:version`
	Policies    []PolicyConfig      `yaml:"policies"`
	AWSRegions  []string            `yaml:"aws_regions"`
	Accounts    []AccountConfig     `yaml:"accounts"`
	IdentityMap []IdentityMapConfig `yaml:"identity_map"`
}

Config is the configuration

func FromFile

func FromFile(fs afero.Fs, fileName string) (*Config, error)

FromFile reads a config from a file

func (*Config) GetAccounts

func (c *Config) GetAccounts() ([]*policy.Account, error)

GetAccounts will return policy.Account objects

func (*Config) GetIdentityMap

func (c *Config) GetIdentityMap() (map[string]string, error)

GetIdentityMap will return a map of email -> slack identifier

func (*Config) GetPolicies

func (c *Config) GetPolicies() ([]policy.Policy, error)

GetPolicies gets the policies from a config

type Duration

type Duration time.Duration

Duration because I really love writing time un/marshal logic

func (*Duration) Duration

func (d *Duration) Duration() *time.Duration

Duration returns our custom type as a time.Duration handling nils when needed

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(unmarshal func(v interface{}) error) error

UnmarshalYAML custom unmarshal logic

type IdentityMapConfig

type IdentityMapConfig struct {
	Email string `yaml:"email"`
	Slack string `yaml:"slack"`
}

IdentityMapConfig will allow mapping group email lists to slack channels

type NotificationConfig

type NotificationConfig struct {
	Recipient       string `yaml:"recipient"`
	MessageTemplate string `yaml:"message_template"`
}

NotificationConfig is a notification config

type NotificationsConfig

type NotificationsConfig struct {
	Warnings []NotificationConfig `yaml:"warnings"`
}

type PolicyConfig

type PolicyConfig struct {
	Name             string  `yaml:"name"`
	ResourceSelector string  `yaml:"resource_selector"`
	TagSelector      *string `yaml:"tag_selector"`
	LabelSelector    *string `yaml:"label_selector"`
	// MaxAge for this resource
	// If it matches the policy and exceeds MaxAge remediation will be taken.
	MaxAge *Duration `yaml:"max_age"`

	Notifications NotificationsConfig `yaml:"notifications"`
}

PolicyConfig is the configuration for a policy

type TypeResource

type TypeResource string

TypeResource describes the type of resource

Jump to

Keyboard shortcuts

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