Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AppFs = afero.NewOsFs()
AppFs is an abstraction of the file system to allow mocking in tests.
Functions ¶
This section is empty.
Types ¶
type APIDesc ¶
type APIDesc struct { TerraformType string DescribeOutputName []string DeleteID string Describe interface{} DescribeInput interface{} Select func(Resources, interface{}, Filter, *AWSClient) []Resources }
APIDesc stores the necessary information about a single resource type (identified by its terraform type) to list and delete resources of that type via the go-aws-sdk and Terraform AWS provider API.
type AWSClient ¶
type AWSClient struct { EC2conn ec2iface.EC2API ASconn autoscalingiface.AutoScalingAPI ELBconn elbiface.ELBAPI R53conn route53iface.Route53API CFconn cloudformationiface.CloudFormationAPI EFSconn efsiface.EFSAPI IAMconn iamiface.IAMAPI KMSconn kmsiface.KMSAPI S3conn s3iface.S3API STSconn stsiface.STSAPI }
AWSClient stores all the clients of AWS services including their sessions.
type Filter ¶
type Filter interface { Validate(as []APIDesc) error Matches(resType string, id string, tags ...map[string]string) bool Types() []string }
Filter selects resources for deletion.
type Resource ¶
type Resource struct { Type string // we use the terraform type to identify the resource type ID string Attrs map[string]string Tags map[string]string }
Resource contains information about a single AWS resource.
type YamlCfg ¶
type YamlCfg map[string]yamlEntry
YamlCfg represents the data structure of a yaml file that is used as a contract to select resources. Each yamlEntry selects the resources of a particular resource type.
type YamlFilter ¶
type YamlFilter struct {
// contains filtered or unexported fields
}
YamlFilter selects resources stated in a yaml configuration for deletion.
func NewFilter ¶
func NewFilter(yamlFile string) *YamlFilter
NewFilter creates a new filter to select resources for deletion based on the path of yaml file.
func (YamlFilter) Matches ¶
Matches checks whether a resource (given by its type and tags) matches the configured filter criteria for tags and ids.
func (YamlFilter) Types ¶
func (f YamlFilter) Types() []string
Types returns all the resource types stated in the yaml config. We use the same identifiers of resource types as the Terraform AWS provider.
func (YamlFilter) Validate ¶
func (f YamlFilter) Validate(as []APIDesc) error
Validate checks if all resource types appearing in the config of the filter are currently supported.