rds

package
v0.0.0-...-a93c916 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreDeleteDBSnapshotTopic = "predelete"
	DBInstanceTopic          = "db"
)
View Source
const (
	DBSubnetGroupTopic = "sg"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

Instance represents the RDS Instance CloudObject

func NewInstance

func NewInstance(name string, session client.ConfigProvider) (*Instance, error)

NewInstance returns a new RDS instance object

func (*Instance) ARN

func (i *Instance) ARN() *awsarn.ARN

func (*Instance) Create

Create our RDS Instance for realsies

func (*Instance) Delete

func (i *Instance) Delete(purge bool) error

Delete deletes an Instance.

func (*Instance) Exists

func (i *Instance) Exists() (bool, error)

func (*Instance) ID

func (i *Instance) ID() cloudobject.ID

Get the CloudObjectId for our Instance. Equals to Instance Name. This is not the AWS Id.

func (*Instance) Read

func (i *Instance) Read() error

func (*Instance) Status

func (i *Instance) Status() cloudobject.Status

func (*Instance) Update

type InstanceDBEngine

type InstanceDBEngine string
const (
	MySQLInstanceDBEngine      InstanceDBEngine = "mysql"
	PostgreSQLInstanceDBEngine InstanceDBEngine = "postgres"
	MariaDBInstanceDBEngine    InstanceDBEngine = "mariadb"
)

func (InstanceDBEngine) String

func (engine InstanceDBEngine) String() string

type InstanceMonitoringSpec

type InstanceMonitoringSpec struct {

	// The interval, in seconds, between points when Enhanced Monitoring metrics
	// are collected for the DB instance. To disable collecting Enhanced Monitoring
	// metrics, specify 0. The default is 0.
	//
	// If MonitoringRoleArn is specified, then you must also set MonitoringInterval
	// to a value other than 0.
	//
	// Valid Values: 0, 1, 5, 10, 15, 30, 60
	MonitoringInterval int64

	// The ARN for the IAM role that permits RDS to send enhanced monitoring metrics
	// to Amazon CloudWatch Logs. For example, arn:aws:iam:123456789012:role/emaccess.
	// For information on creating a monitoring role, go to Setting Up and Enabling
	// Enhanced Monitoring (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.Enabling)
	// in the Amazon RDS User Guide.
	//
	// If MonitoringInterval is set to a value other than 0, then you must supply
	// a MonitoringRoleArn value.
	MonitoringRoleArn awsarn.ARN
}

type InstancePerformanceInsightsSpec

type InstancePerformanceInsightsSpec struct {

	// The amount of time, in days, to retain Performance Insights data. Valid values
	// are 7 or 731 (2 years).
	PerformanceInsightsRetentionPeriod int64
}

type InstanceSecrets

type InstanceSecrets struct {
}

func (InstanceSecrets) Map

func (secrets InstanceSecrets) Map() map[string]string

type InstanceSpec

type InstanceSpec struct {
	// A value that indicates whether minor engine upgrades are applied automatically
	// to the DB instance during the maintenance window. By default, minor engine
	// upgrades are applied automatically.
	AutoMinorVersionUpgrade bool

	// The Availability Zone (AZ) where the database will be created. For information
	// on AWS Regions and Availability Zones, see Regions and Availability Zones
	// (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html).
	//
	// Default: A random, system-chosen Availability Zone in the endpoint's AWS
	// Region.
	//
	// Example: us-east-1d
	//
	// Constraint: The AvailabilityZone parameter can't be specified if the DB instance
	// is a Multi-AZ deployment. The specified Availability Zone must be in the
	// same AWS Region as the current endpoint.
	//
	// If you're creating a DB instance in an RDS on VMware environment, specify
	// the identifier of the custom Availability Zone to create the DB instance
	// in.
	//
	// For more information about RDS on VMware, see the RDS on VMware User Guide.
	// (https://docs.aws.amazon.com/AmazonRDS/latest/RDSonVMwareUserGuide/rds-on-vmware.html)
	AvailabilityZone string

	// The number of days for which automated backups are retained. Setting this
	// parameter to a positive number enables backups. Setting this parameter to
	// 0 disables automated backups.
	//
	// Default: 1
	//
	// Constraints:
	//
	//    * Must be a value from 0 to 35
	//
	//    * Can't be set to 0 if the DB instance is a source to read replicas
	BackupRetentionPeriod int64

	// The compute and memory capacity of the DB instance, for example, db.m4.large.
	// Not all DB instance classes are available in all AWS Regions, or for all
	// database engines. For the full list of DB instance classes, and availability
	// for your engine, see DB Instance Class (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html)
	// in the Amazon RDS User Guide.
	//
	// DBInstanceClass is a required field
	DBInstanceClass string

	// The initialized Database name. Default: 'default'
	DBName string

	// A DB subnet group to associate with this DB instance.
	//
	// If there is no DB subnet group, then it is a non-VPC DB instance.
	DBSubnetGroupName string

	// The name of the database engine to be used for this instance.
	Engine InstanceDBEngine

	// The version number of the database engine to use.
	EngineVersion string

	// The password for the master user. The password can include any printable
	// ASCII character except "/", """, or "@".
	MasterUserPassword string

	// The name for the master user.
	MasterUsername string

	// Monitoring defines a separete Monitoring role setup
	Monitoring *InstanceMonitoringSpec

	// Defines PerformanceInsights config if set
	PerformanceInsights *InstancePerformanceInsightsSpec

	// The port number on which the database accepts connections.
	Port int64

	// The daily time range during which automated backups are created if automated
	// backups are enabled, using the BackupRetentionPeriod parameter. For more
	// information, see The Backup Window (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow)
	// in the Amazon RDS User Guide.
	//
	// The default is a 30-minute window selected at random from an 8-hour block
	// of time for each AWS Region. To see the time blocks available, see Adjusting
	// the Preferred DB Instance Maintenance Window (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow)
	// in the Amazon RDS User Guide.
	//
	// Constraints:
	//
	//    * Must be in the format hh24:mi-hh24:mi.
	//
	//    * Must be in Universal Coordinated Time (UTC).
	//
	//    * Must not conflict with the preferred maintenance window.
	//
	//    * Must be at least 30 minutes.
	PreferredBackupWindow string

	// The time range each week during which system maintenance can occur, in Universal
	// Coordinated Time (UTC). For more information, see Amazon RDS Maintenance
	// Window (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance).
	//
	// Format: ddd:hh24:mi-ddd:hh24:mi
	//
	// The default is a 30-minute window selected at random from an 8-hour block
	// of time for each AWS Region, occurring on a random day of the week.
	//
	// Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
	//
	// Constraints: Minimum 30-minute window.
	PreferredMaintenanceWindow string

	// Defines whether the DB will have a public endpoint attached
	PubliclyAccessible bool

	// If true: throws an error when restoration procedure is auto-detected. (Key & Snapshot detected)
	RestorationDisabled bool

	Storage InstanceStorageSpec

	// Tags to assign to the DB instance.
	Tags map[string]string

	// A list of Amazon EC2 VPC security groups to associate with this DB instance.
	VpcSecurityGroupIds []string
}

func SanePostgres

func SanePostgres(name, subnetGroupName, instanceClass, user, pass string, tags map[string]string,
	securityGroupIds []string) InstanceSpec

Returns a "sane" defaulted InstanceSpec

func (*InstanceSpec) CreateDBInstanceInput

func (spec *InstanceSpec) CreateDBInstanceInput(id string) awsrds.CreateDBInstanceInput

CreateDBInstanceInput returns the marshaled AWS Interface object of same name

func (*InstanceSpec) ModifyDBInstanceInput

func (spec *InstanceSpec) ModifyDBInstanceInput(id string) awsrds.
	ModifyDBInstanceInput

ModifyDBInstanceInput returns the marshaled AWS Interface object of same name

func (*InstanceSpec) RestoreDBInstanceFromDBSnapshotInput

func (spec *InstanceSpec) RestoreDBInstanceFromDBSnapshotInput(id string, snapshotId string) awsrds.
	RestoreDBInstanceFromDBSnapshotInput

RestoreDBInstanceFromDBSnapshotInput returns the marshaled AWS Interface object of same name

func (*InstanceSpec) Valid

func (spec *InstanceSpec) Valid() (bool, error)

type InstanceStatus

type InstanceStatus awsrds.DBInstance

func (*InstanceStatus) ProviderID

func (status *InstanceStatus) ProviderID() cloudobject.ProviderID

func (*InstanceStatus) String

func (status *InstanceStatus) String() string

type InstanceStorageSpec

type InstanceStorageSpec struct {

	// The amount of storage (in gibibytes) to allocate for the DB instance.
	//
	// MySQL
	//
	// Constraints to the amount of storage for each storage type are the following:
	//
	//    * General Purpose (SSD) storage (gp2): Must be an integer from 20 to 65536.
	//
	//    * Provisioned IOPS storage (io1): Must be an integer from 100 to 65536.
	//
	//    * Magnetic storage (standard): Must be an integer from 5 to 3072.
	//
	// MariaDB
	//
	// Constraints to the amount of storage for each storage type are the following:
	//
	//    * General Purpose (SSD) storage (gp2): Must be an integer from 20 to 65536.
	//
	//    * Provisioned IOPS storage (io1): Must be an integer from 100 to 65536.
	//
	//    * Magnetic storage (standard): Must be an integer from 5 to 3072.
	//
	// PostgreSQL
	//
	// Constraints to the amount of storage for each storage type are the following:
	//
	//    * General Purpose (SSD) storage (gp2): Must be an integer from 20 to 65536.
	//
	//    * Provisioned IOPS storage (io1): Must be an integer from 100 to 65536.
	//
	//    * Magnetic storage (standard): Must be an integer from 5 to 3072.
	AllocatedStorage int64

	// The amount of Provisioned IOPS (input/output operations per second) to be
	// initially allocated for the DB instance. For information about valid Iops
	// values, see Amazon RDS Provisioned IOPS Storage to Improve Performance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS)
	// in the Amazon RDS User Guide.
	//
	// Constraints: For MariaDB, MySQL, Oracle, and PostgreSQL DB instances, must
	// be a multiple between .5 and 50 of the storage amount for the DB instance.
	Iops int64

	// The upper limit to which Amazon RDS can automatically scale the storage of
	// the DB instance.
	MaxAllocatedStorage int64

	// A value that indicates whether the DB instance is encrypted.
	StorageEncrypted bool

	// Specifies the storage type to be associated with the DB instance.
	//
	// Valid values: standard | gp2 | io1
	StorageType InstanceStorageType
}

type InstanceStorageType

type InstanceStorageType string
const (
	StandardInstanceStorageType InstanceStorageType = "standard"
	IO1InstanceStorageType      InstanceStorageType = "io1"
	GP2InstanceStorageType      InstanceStorageType = "gp2"
)

func (InstanceStorageType) String

func (storageType InstanceStorageType) String() string

type RDS

type RDS interface {
	Create(svc iamiface.IAMAPI) error
	Update(svc iamiface.IAMAPI) error
	Delete(svc iamiface.IAMAPI) error
	SyncStatus(svc iamiface.IAMAPI)
}

RDS defines interactions with the rds cloud objects

type RestorationDisabledError

type RestorationDisabledError struct {
	Message string
}

func (RestorationDisabledError) Error

func (e RestorationDisabledError) Error() string

type SubnetGroup

type SubnetGroup struct {
	// contains filtered or unexported fields
}

func NewSubnetGroup

func NewSubnetGroup(name string, session client.ConfigProvider) (*SubnetGroup, error)

func (*SubnetGroup) Create

func (*SubnetGroup) Delete

func (s *SubnetGroup) Delete(_ bool) error

Delete deletes the SubnetGroup. Purge has no effect, subnet group will always be purged.

func (*SubnetGroup) Exists

func (s *SubnetGroup) Exists() (bool, error)

What does it even mean to exist? Do we all even exist?

func (*SubnetGroup) ID

func (s *SubnetGroup) ID() cloudobject.ID

func (*SubnetGroup) Read

func (s *SubnetGroup) Read() error

func (*SubnetGroup) Status

func (s *SubnetGroup) Status() cloudobject.Status

func (*SubnetGroup) Update

type SubnetGroupSpec

type SubnetGroupSpec struct {
	Description string

	SubnetIDs []string

	Tags map[string]string
}

func (*SubnetGroupSpec) CreateDBSubnetGroupInput

func (spec *SubnetGroupSpec) CreateDBSubnetGroupInput(id string) awsrds.CreateDBSubnetGroupInput

func (*SubnetGroupSpec) ModifyDBSubnetGroupInput

func (spec *SubnetGroupSpec) ModifyDBSubnetGroupInput(id string) awsrds.ModifyDBSubnetGroupInput

func (*SubnetGroupSpec) Valid

func (spec *SubnetGroupSpec) Valid() (bool, error)

type SubnetGroupStatus

type SubnetGroupStatus awsrds.DBSubnetGroup

func (*SubnetGroupStatus) ProviderID

func (status *SubnetGroupStatus) ProviderID() cloudobject.ProviderID

func (*SubnetGroupStatus) String

func (status *SubnetGroupStatus) String() string

Jump to

Keyboard shortcuts

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