rdsbroker

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const MasterPasswordLength = 32
View Source
const MasterUsernameLength = 16
View Source
const RestoreFromLatestSnapshotBeforeTimeFormat = "2006-01-02 15:04:05"
View Source
const RestoreFromPointInTimeBeforeTimeFormat = "2006-01-02 15:04:05"
View Source
const StateReboot = "PendingReboot"
View Source
const StateResetUserPassword = "PendingResetUserPassword"
View Source
const StateUpdateSettings = "PendingUpdateSettings"

Variables

View Source
var (
	ErrEncryptionNotUpdateable = errors.New("instance can not be updated to a plan with different encryption settings")
)
View Source
var SupportedPreloadExtensions = map[string][]DBExtension{
	"postgres11": {
		DBExtension{
			Name:                   "auto_explain",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "orafce",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pgaudit",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pglogical",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pg_similarity",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pg_stat_statements",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pg_hint_plan",
			RequiresPreloadLibrary: true,
		},
	},

	"postgres10": {
		DBExtension{
			Name:                   "auto_explain",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "orafce",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pgaudit",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pglogical",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pg_similarity",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pg_stat_statements",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pg_hint_plan",
			RequiresPreloadLibrary: true,
		},
	},

	"postgres9.5": {
		DBExtension{
			Name:                   "auto_explain",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pgaudit",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pg_stat_statements",
			RequiresPreloadLibrary: true,
		},
		DBExtension{
			Name:                   "pg_hint_plan",
			RequiresPreloadLibrary: true,
		},
	},

	"mysql5.7": []DBExtension{},
}

Lists the supported database extensions that require libraries to be loaded on startup, keyed on database engine family

Functions

This section is empty.

Types

type BindParameters

type BindParameters struct {
	ReadOnly bool `json:"read_only"`
}

type Catalog

type Catalog struct {
	Services       []Service `json:"services,omitempty"`
	ExcludeEngines []Engine  `json:"exclude_engines"`
}

func (Catalog) FindService

func (c Catalog) FindService(serviceID string) (service Service, found bool)

func (Catalog) FindServicePlan

func (c Catalog) FindServicePlan(planID string) (plan ServicePlan, found bool)

func (Catalog) Validate

func (c Catalog) Validate() error

type CatalogExternal

type CatalogExternal struct {
	Services []brokerapi.Service `json:"services"`
}

type Config

type Config struct {
	Region                       string  `json:"region"`
	DBPrefix                     string  `json:"db_prefix"`
	BrokerName                   string  `json:"broker_name"`
	AWSPartition                 string  `json:"aws_partition"`
	MasterPasswordSeed           string  `json:"master_password_seed"`
	AllowUserProvisionParameters bool    `json:"allow_user_provision_parameters"`
	AllowUserUpdateParameters    bool    `json:"allow_user_update_parameters"`
	AllowUserBindParameters      bool    `json:"allow_user_bind_parameters"`
	Catalog                      Catalog `json:"catalog"`
}

func (*Config) FillDefaults

func (c *Config) FillDefaults()

func (Config) Validate

func (c Config) Validate() error

type Credentials

type Credentials struct {
	Host     string `json:"host"`
	Port     int64  `json:"port"`
	Name     string `json:"name"`
	Username string `json:"username"`
	Password string `json:"password"`
	URI      string `json:"uri"`
	JDBCURI  string `json:"jdbcuri"`
}

type DBExtension added in v0.27.0

type DBExtension struct {
	Name                   string
	RequiresPreloadLibrary bool
}

type Engine

type Engine struct {
	Engine        string `json:"engine"`
	EngineVersion string `json:"engine_version"`
}

type ParameterGroupSelector added in v0.27.0

type ParameterGroupSelector interface {
	SelectParameterGroup(servicePlan ServicePlan, extensions []string) (string, error)
}

type ParameterGroupSource added in v0.27.0

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

func NewParameterGroupSource added in v0.27.0

func NewParameterGroupSource(config Config, rdsInstance awsrds.RDSInstance, supportedPreloadExtensions map[string][]DBExtension, logger lager.Logger) *ParameterGroupSource

func (*ParameterGroupSource) SelectParameterGroup added in v0.27.0

func (pgs *ParameterGroupSource) SelectParameterGroup(servicePlan ServicePlan, extensions []string) (string, error)

type ProvisionParameters

type ProvisionParameters struct {
	BackupRetentionPeriod           int64    `json:"backup_retention_period"`
	CharacterSetName                string   `json:"character_set_name"`
	DBName                          string   `json:"dbname"`
	PreferredBackupWindow           string   `json:"preferred_backup_window"`
	PreferredMaintenanceWindow      string   `json:"preferred_maintenance_window"`
	SkipFinalSnapshot               *bool    `json:"skip_final_snapshot"`
	RestoreFromPointInTimeOf        *string  `json:"restore_from_point_in_time_of"`
	RestoreFromPointInTimeBefore    *string  `json:"restore_from_point_in_time_before"`
	RestoreFromLatestSnapshotOf     *string  `json:"restore_from_latest_snapshot_of"`
	RestoreFromLatestSnapshotBefore *string  `json:"restore_from_latest_snapshot_before"`
	Extensions                      []string `json:"enable_extensions"`
}

func (*ProvisionParameters) Validate

func (pp *ProvisionParameters) Validate() error

type RDSBroker

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

func New

func New(
	config Config,
	dbInstance awsrds.RDSInstance,
	sqlProvider sqlengine.Provider,
	parameterGroupSelector ParameterGroupSelector,
	logger lager.Logger,
) *RDSBroker

func (*RDSBroker) Bind

func (b *RDSBroker) Bind(
	ctx context.Context,
	instanceID, bindingID string,
	details brokerapi.BindDetails,
	asyncAllowed bool,
) (brokerapi.Binding, error)

func (*RDSBroker) CheckAndRotateCredentials

func (b *RDSBroker) CheckAndRotateCredentials()

func (*RDSBroker) Deprovision

func (b *RDSBroker) Deprovision(
	ctx context.Context,
	instanceID string,
	details brokerapi.DeprovisionDetails,
	asyncAllowed bool,
) (brokerapi.DeprovisionServiceSpec, error)

func (*RDSBroker) GetBinding added in v0.39.0

func (b *RDSBroker) GetBinding(ctx context.Context, first, second string) (brokerapi.GetBindingSpec, error)

func (*RDSBroker) GetInstance added in v0.39.0

func (b *RDSBroker) GetInstance(ctx context.Context, first string) (brokerapi.GetInstanceDetailsSpec, error)

func (*RDSBroker) LastBindingOperation added in v0.39.0

func (b *RDSBroker) LastBindingOperation(ctx context.Context, first, second string, pollDetails brokerapi.PollDetails) (brokerapi.LastOperation, error)

func (*RDSBroker) LastOperation

func (b *RDSBroker) LastOperation(
	ctx context.Context,
	instanceID string,
	pollDetails brokerapi.PollDetails,
) (brokerapi.LastOperation, error)

func (*RDSBroker) PostRestoreTasks

func (b *RDSBroker) PostRestoreTasks(instanceID string, dbInstance *rds.DBInstance, tagsByName map[string]string) (asyncOperationTriggered bool, err error)

func (*RDSBroker) Provision

func (b *RDSBroker) Provision(
	ctx context.Context,
	instanceID string,
	details brokerapi.ProvisionDetails,
	asyncAllowed bool,
) (brokerapi.ProvisionedServiceSpec, error)

func (*RDSBroker) RebootIfRequired added in v0.31.0

func (b *RDSBroker) RebootIfRequired(instanceID string, dbInstance *rds.DBInstance) (asyncOperationTriggered bool, err error)

func (*RDSBroker) Services

func (b *RDSBroker) Services(ctx context.Context) ([]brokerapi.Service, error)

func (*RDSBroker) Unbind

func (b *RDSBroker) Unbind(
	ctx context.Context,
	instanceID, bindingID string,
	details brokerapi.UnbindDetails,
	asyncAllowed bool,
) (brokerapi.UnbindSpec, error)

func (*RDSBroker) Update

func (b *RDSBroker) Update(
	ctx context.Context,
	instanceID string,
	details brokerapi.UpdateDetails,
	asyncAllowed bool,
) (brokerapi.UpdateServiceSpec, error)

type RDSInstanceTags added in v0.27.0

type RDSInstanceTags struct {
	Action                   string
	ServiceID                string
	PlanID                   string
	OrganizationID           string
	SpaceID                  string
	SkipFinalSnapshot        string
	OriginSnapshotIdentifier string
	OriginDatabaseIdentifier string
	OriginPointInTime        string
	Extensions               []string
}

type RDSProperties

type RDSProperties struct {
	DBInstanceClass            *string   `json:"db_instance_class"`
	Engine                     *string   `json:"engine"`
	EngineVersion              *string   `json:"engine_version"`
	EngineFamily               *string   `json:"engine_family"`
	AllocatedStorage           *int64    `json:"allocated_storage"`
	AutoMinorVersionUpgrade    *bool     `json:"auto_minor_version_upgrade,omitempty"`
	AvailabilityZone           *string   `json:"availability_zone,omitempty"`
	BackupRetentionPeriod      *int64    `json:"backup_retention_period,omitempty"`
	CharacterSetName           *string   `json:"character_set_name,omitempty"`
	DBSecurityGroups           []*string `json:"db_security_groups,omitempty"`
	DBSubnetGroupName          *string   `json:"db_subnet_group_name,omitempty"`
	LicenseModel               *string   `json:"license_model,omitempty"`
	MultiAZ                    *bool     `json:"multi_az,omitempty"`
	OptionGroupName            *string   `json:"option_group_name,omitempty"`
	Port                       *int64    `json:"port,omitempty"`
	PreferredBackupWindow      *string   `json:"preferred_backup_window,omitempty"`
	PreferredMaintenanceWindow *string   `json:"preferred_maintenance_window,omitempty"`
	PubliclyAccessible         *bool     `json:"publicly_accessible,omitempty"`
	StorageEncrypted           *bool     `json:"storage_encrypted,omitempty"`
	KmsKeyID                   *string   `json:"kms_key_id,omitempty"`
	StorageType                *string   `json:"storage_type,omitempty"`
	Iops                       *int64    `json:"iops,omitempty"`
	VpcSecurityGroupIds        []*string `json:"vpc_security_group_ids,omitempty"`
	CopyTagsToSnapshot         *bool     `json:"copy_tags_to_snapshot,omitempty"`
	SkipFinalSnapshot          *bool     `json:"skip_final_snapshot,omitempty"`
	DefaultExtensions          []*string `json:"default_extensions,omitempty"`
	AllowedExtensions          []*string `json:"allowed_extensions"`
}

func (RDSProperties) Validate

func (rp RDSProperties) Validate(c Catalog) error

type Service

type Service struct {
	ID              string                            `json:"id"`
	Name            string                            `json:"name"`
	Description     string                            `json:"description"`
	Tags            []string                          `json:"tags,omitempty"`
	PlanUpdatable   bool                              `json:"plan_updateable"`
	Plans           []ServicePlan                     `json:"plans"`
	Requires        []brokerapi.RequiredPermission    `json:"requires,omitempty"`
	Metadata        *brokerapi.ServiceMetadata        `json:"metadata,omitempty"`
	DashboardClient *brokerapi.ServiceDashboardClient `json:"dashboard_client,omitempty"`
}

func (Service) Validate

func (s Service) Validate(c Catalog) error

type ServicePlan

type ServicePlan struct {
	ID            string                         `json:"id"`
	Name          string                         `json:"name"`
	Description   string                         `json:"description"`
	Free          *bool                          `json:"free,omitempty"`
	Metadata      *brokerapi.ServicePlanMetadata `json:"metadata,omitempty"`
	RDSProperties RDSProperties                  `json:"rds_properties,omitempty"`
}

func (ServicePlan) Validate

func (sp ServicePlan) Validate(c Catalog) error

type UpdateParameters

type UpdateParameters struct {
	ApplyAtMaintenanceWindow    bool     `json:"apply_at_maintenance_window"`
	BackupRetentionPeriod       int64    `json:"backup_retention_period"`
	PreferredBackupWindow       string   `json:"preferred_backup_window"`
	PreferredMaintenanceWindow  string   `json:"preferred_maintenance_window"`
	SkipFinalSnapshot           *bool    `json:"skip_final_snapshot"`
	Reboot                      *bool    `json:"reboot"`
	UpgradeMinorVersionToLatest *bool    `json:"update_minor_version_to_latest"`
	ForceFailover               *bool    `json:"force_failover"`
	EnableExtensions            []string `json:"enable_extensions"`
	DisableExtensions           []string `json:"disable_extensions"`
}

func (*UpdateParameters) CheckForCompatibilityWithPlanChange added in v0.36.0

func (up *UpdateParameters) CheckForCompatibilityWithPlanChange() error

func (*UpdateParameters) Validate

func (up *UpdateParameters) Validate() error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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