Documentation
¶
Index ¶
- Variables
- func AWSSessions(region string) *session.Session
- type Client
- func (c *Client) ChangeDBpassword(snapshot *rds.DBSnapshot, DBArn, password string) error
- func (c *Client) CheckIfDatabaseSubnetGroupExist(snapshot *rds.DBSnapshot) bool
- func (c *Client) CheckRegexAgainstRow(query, regex string) bool
- func (c *Client) CheckTag(arn, key, value string) bool
- func (c *Client) CleanArn(snapshot *rds.DBSnapshot) string
- func (c *Client) CopySnapshots(snapshot *rds.DBSnapshot, destination, kmsid, preSignedUrl, cleanArn string) error
- func (c *Client) CreateDBFromSnapshot(snapshot *rds.DBSnapshot, instancetype string, vpcsecuritygroupids []string) error
- func (c *Client) CreateDatabaseSubnetGroup(snapshot *rds.DBSnapshot, subnetids []string) error
- func (c *Client) DataDogSession(apiKey, applicationKey string) *datadog.Client
- func (c *Client) DeleteDB(snapshot *rds.DBSnapshot) error
- func (c *Client) DeleteDatabaseSubnetGroup(snapshot *rds.DBSnapshot) error
- func (c *Client) DeleteOldSnapshot(snapshot *rds.DBSnapshot) error
- func (c *Client) GetDBInstanceInfo(snapshot *rds.DBSnapshot) (*rds.DBInstance, error)
- func (c *Client) GetDBInstanceStatus(snapshot *rds.DBSnapshot) string
- func (c *Client) GetOldSnapshots(snapshots []*rds.DBSnapshot, retentionDays int) ([]*rds.DBSnapshot, error)
- func (c *Client) GetSnapshots(DBInstanceIdentifier string) ([]*rds.DBSnapshot, error)
- func (c *Client) GetTagValue(arn, key string) string
- func (c *Client) GetYamlFileFromS3(bucket, key string) (io.Reader, error)
- func (c *Client) InitDb(db *rds.DBInstance, password, dbname string) error
- func (c *Client) PostDatadogChecks(snapshot *rds.DBSnapshot, metricName, status, cmdName string) error
- func (c *Client) PreSignUrl(destinationRegion, snapshotArn, kmsid, cleanArn string) (string, error)
- func (c *Client) SetSessions(region string)
- func (c *Client) UnmarshalYamlFile(body io.Reader) (Doc, error)
- func (c *Client) UpdateTag(snapshot *rds.DBSnapshot, key, value string) error
- type DefaultChecks
- type Doc
- type Instances
- type Queries
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AWSSessions ¶
AWSSessions initiate a new aws session
Types ¶
type Client ¶
type Client struct { Datadog *datadog.Client S3 s3iface.S3API Snapshots []*rds.DBSnapshot RDS rdsiface.RDSAPI DB *sql.DB }
func (*Client) ChangeDBpassword ¶
func (c *Client) ChangeDBpassword(snapshot *rds.DBSnapshot, DBArn, password string) error
ChangeDBpassword changes the database password of a rds instance
func (*Client) CheckIfDatabaseSubnetGroupExist ¶
func (c *Client) CheckIfDatabaseSubnetGroupExist(snapshot *rds.DBSnapshot) bool
CheckIfDatabaseSubnetGroupExist return true if the Subnet Group already exist
func (*Client) CheckRegexAgainstRow ¶
CheckRegexAgainstRow will compare the regex and queries set in the yaml configuration file against each others
func (*Client) CleanArn ¶ added in v0.0.3
func (c *Client) CleanArn(snapshot *rds.DBSnapshot) string
func (*Client) CopySnapshots ¶
func (c *Client) CopySnapshots(snapshot *rds.DBSnapshot, destination, kmsid, preSignedUrl, cleanArn string) error
CopySnapshots copies the snapshots either to the same region as the original or to a new region
func (*Client) CreateDBFromSnapshot ¶
func (c *Client) CreateDBFromSnapshot(snapshot *rds.DBSnapshot, instancetype string, vpcsecuritygroupids []string) error
CreateDBFromSnapshot creates the RDS instance from a snapshot
func (*Client) CreateDatabaseSubnetGroup ¶
func (c *Client) CreateDatabaseSubnetGroup(snapshot *rds.DBSnapshot, subnetids []string) error
CreateDatabaseSubnetGroup creates the Subnet Group if it doesnt already exist
func (*Client) DataDogSession ¶
DataDogSession creates a new datadog session
func (*Client) DeleteDB ¶
func (c *Client) DeleteDB(snapshot *rds.DBSnapshot) error
Delete the RDS instance created from a specific snapshot
func (*Client) DeleteDatabaseSubnetGroup ¶
func (c *Client) DeleteDatabaseSubnetGroup(snapshot *rds.DBSnapshot) error
DeleteDatabaseSubnetGroup deletes the subnet group created for a rds instance
func (*Client) DeleteOldSnapshot ¶ added in v0.0.9
func (c *Client) DeleteOldSnapshot(snapshot *rds.DBSnapshot) error
DeleteOldSnapshot deletes snapshots returned by GetOldSnapshots
func (*Client) GetDBInstanceInfo ¶
func (c *Client) GetDBInstanceInfo(snapshot *rds.DBSnapshot) (*rds.DBInstance, error)
GetDBInstanceInfo returns informations about a rds instance
func (*Client) GetDBInstanceStatus ¶
func (c *Client) GetDBInstanceStatus(snapshot *rds.DBSnapshot) string
GetDBInstanceStatus returns the status of a rds instance
func (*Client) GetOldSnapshots ¶
func (c *Client) GetOldSnapshots(snapshots []*rds.DBSnapshot, retentionDays int) ([]*rds.DBSnapshot, error)
GetOldSnapshots gets old snapshots based on the retention policy retentionDays is a integer of the number of days we want to keep the snapshots.
func (*Client) GetSnapshots ¶
func (c *Client) GetSnapshots(DBInstanceIdentifier string) ([]*rds.DBSnapshot, error)
GetSnapshots gets the latest snapshots of a RDS instance
func (*Client) GetTagValue ¶
GetTagValue returns the value of a specific tag on a AWS resource
func (*Client) GetYamlFileFromS3 ¶
GetYamlFileFromS3 reads a file from s3 and returns its body
func (*Client) InitDb ¶
func (c *Client) InitDb(db *rds.DBInstance, password, dbname string) error
InitDb initialize the database connection
func (*Client) PostDatadogChecks ¶
func (c *Client) PostDatadogChecks(snapshot *rds.DBSnapshot, metricName, status, cmdName string) error
PostDatadogChecks posts to datadog the status of a check
func (*Client) PreSignUrl ¶ added in v0.0.3
PreSignUrl presigned an aws url so that we can copy an encrypted snapshot from a region to another
func (*Client) SetSessions ¶
SetSessions init datadog, RDS and S3 sessions
func (*Client) UnmarshalYamlFile ¶
UnmarshalYamlFile unmarshal the yaml file dowmloaded from s3
type DefaultChecks ¶
type DefaultChecks interface { SetSessions(region string) GetYamlFileFromS3(bucket, key string) (io.Reader, error) UnmarshalYamlFile(body io.Reader) (Doc, error) DataDogSession(apiKey, applicationKey string) *datadog.Client PostDatadogChecks(snapshot *rds.DBSnapshot, metricName, status, cmdName string) error GetSnapshots(DBInstanceIdentifier string) ([]*rds.DBSnapshot, error) CopySnapshots(snapshot *rds.DBSnapshot, destination, kmsid, preSignedUrl, cleanArn string) error GetOldSnapshots(snapshots []*rds.DBSnapshot, retention int) ([]*rds.DBSnapshot, error) DeleteOldSnapshot(snapshot *rds.DBSnapshot) error CheckIfDatabaseSubnetGroupExist(snapshot *rds.DBSnapshot) bool CreateDatabaseSubnetGroup(snapshot *rds.DBSnapshot, subnetids []string) error CreateDBFromSnapshot(snapshot *rds.DBSnapshot, instancetype string, vpcsecuritygroupids []string) error DeleteDB(snapshot *rds.DBSnapshot) error UpdateTag(snapshot *rds.DBSnapshot, key, value string) error CheckTag(arn, key, value string) bool GetDBInstanceInfo(snapshot *rds.DBSnapshot) (*rds.DBInstance, error) DeleteDatabaseSubnetGroup(snapshot *rds.DBSnapshot) error ChangeDBpassword(snapshot *rds.DBSnapshot, DBArn, password string) error GetDBInstanceStatus(snapshot *rds.DBSnapshot) string GetTagValue(arn, key string) string InitDb(db *rds.DBInstance, password, dbname string) error CheckRegexAgainstRow(query, regex string) bool PreSignUrl(destinationRegion, snapshotArn, kmsid, cleanArn string) (string, error) CleanArn(snapshot *rds.DBSnapshot) string }
func New ¶
func New() DefaultChecks