Documentation ¶
Index ¶
- func LoadRules() error
- func ParseRule(rule Rule) error
- func ShouldInitiateDestruction(tags resource.Tags) bool
- func ShouldInitiateResumption(tag resource.Tags) bool
- func ShouldInitiateStopping(tag resource.Tags) bool
- type Action
- type ActiveDurationRule
- type Rule
- type Ruler
- type TerminationDateRule
- type TerminationPolicyRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadRules ¶
func LoadRules() error
LoadRules loads exclude rules into memory. It is abstracted as a different function because at the time of calling init, config values have not been loaded yet
func ShouldInitiateDestruction ¶
ShouldInitiateDestruction checks if the tags to initiate destruction are valid at the time of execution
func ShouldInitiateResumption ¶
ShouldInitiateResumption checks if the tags to initiate destruction are valid at the time of execution
func ShouldInitiateStopping ¶
ShouldInitiateStopping checks if the tags to initiate destruction are valid at the time of execution
Types ¶
type Action ¶
type Action int
Action : The Action to be applied to the resources matching a particular rule
func ActionString ¶
ActionString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func GetResourceAction ¶
GetResourceAction get action to be performed on a resource
type ActiveDurationRule ¶
ActiveDurationRule defines the period within which a resource should be active. Any time Outside the duration, the resource is stopped and resumed again when period is active
func (ActiveDurationRule) CheckResource ¶
func (r ActiveDurationRule) CheckResource(res *resource.Resource) Action
CheckResource Returns a list of resources activeDuration is valid
type Ruler ¶
type Ruler interface { CheckResource(*resource.Resource) Action String() string // contains filtered or unexported methods }
Ruler interface for all rules
type TerminationDateRule ¶
TerminationDateRule defines rule that sets when a resource should be terminated based on termination-date rule set in config file. This rule checks if the set termination-date is past and activates destroy on the instance
func (TerminationDateRule) CheckResource ¶
func (r TerminationDateRule) CheckResource(res *resource.Resource) Action
CheckResource Returns a list of resources whose termination Date is exceeed
type TerminationPolicyRule ¶
TerminationPolicyRule defines rule that sets when a resource should be terminated.
func (TerminationPolicyRule) CheckResource ¶
func (r TerminationPolicyRule) CheckResource(res *resource.Resource) Action
CheckResource Returns a list of resources whose termination Date is exceeed