rdsbroker

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2017 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanUpdate added in v1.0.0

func CanUpdate(oldPlan, newPlan ServicePlan, service Service, parameters UpdateParameters) bool

This function does NOT cover every combination. It just picks up the obviously bad combinations.

Types

type BindParameters

type BindParameters struct {
	Username string `json:"username"`
}

type Catalog

type Catalog struct {
	Services []Service `yaml:"services,omitempty"`
}

As much as it would be nice to use brokerapi.Service here rather than redefining * the whole structure ourselves, the version in brokerapi is specifically * replicating the structure sent to cloud foundry. And we want to add a few more * options for defining the RDS properties. And brokerapi doesn't let us dump it in * metadata. * * TODO: Find a better way

func (Catalog) FindService

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

func (Catalog) FindServicePlan

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

func (Catalog) Validate

func (c Catalog) Validate() error

type Config

type Config struct {
	Region                       string  `yaml:"region"`
	DBPrefix                     string  `yaml:"db_prefix"`
	AllowUserProvisionParameters bool    `yaml:"allow_user_provision_parameters"`
	AllowUserUpdateParameters    bool    `yaml:"allow_user_update_parameters"`
	AllowUserBindParameters      bool    `yaml:"allow_user_bind_parameters"`
	Catalog                      Catalog `yaml:"catalog"`
}

func (Config) Validate

func (c Config) Validate() error

type Cost

type Cost struct {
	Amount map[string]interface{} `json:"amount,omitempty" yaml:"amount,omitempty"`
	Unit   string                 `json:"unit,omitempty" yaml:"unit,omitempty"`
}

type CredentialsHash added in v1.0.0

type CredentialsHash struct {
	Host     string `json:"host,omitempty"`
	Port     int64  `json:"port,omitempty"`
	Name     string `json:"name,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	URI      string `json:"uri,omitempty"`
	JDBCURI  string `json:"jdbcUrl,omitempty"`
}

type DashboardClient

type DashboardClient struct {
	ID          string `json:"id,omitempty" yaml:"id,omitempty"`
	Secret      string `json:"secret,omitempty" yaml:"secret,omitempty"`
	RedirectURI string `json:"redirect_uri,omitempty" yaml:"redirect_uri,omitempty"`
}

type ProvisionParameters

type ProvisionParameters struct {
	BackupRetentionPeriod      int64  `json:"backup_retention_period"`
	CharacterSetName           string `json:"character_set_name"`
	PreferredBackupWindow      string `json:"preferred_backup_window"`
	PreferredMaintenanceWindow string `json:"preferred_maintenance_window"`
}

Currently the provision parameters are a json.RawMessage in brokerapi * while the update and bind parameters are a map[string]interface{} * There is some interest in changing everything to json.RawMessage * https://github.com/pivotal-cf/brokerapi/issues/36

type RDSBroker

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

func New

func New(
	config Config,
	dbInstance awsrds.DBInstance,
	dbCluster awsrds.DBCluster,
	sqlProvider sqlengine.Provider,
	logger lager.Logger,
	internalDB *gorm.DB,
	sharedPostgres sqlengine.SQLEngine,
	sharedMysql sqlengine.SQLEngine,
	encryptionKey []byte,
) *RDSBroker

func (*RDSBroker) Bind

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

func (*RDSBroker) Deprovision

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

func (*RDSBroker) LastOperation

func (b *RDSBroker) LastOperation(context context.Context, instanceID, operationData string) (brokerapi.LastOperation, error)

func (*RDSBroker) Provision

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

func (*RDSBroker) Services

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

func (*RDSBroker) Unbind

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

func (*RDSBroker) Update

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

type RDSProperties

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

func (RDSProperties) Validate

func (rp RDSProperties) Validate() error

type Service

type Service struct {
	ID              string           `json:"id" yaml:"id"`
	Name            string           `json:"name" yaml:"name"`
	Description     string           `json:"description" yaml:"description"`
	Bindable        bool             `json:"bindable,omitempty" yaml:"bindable,omitempty"`
	Tags            []string         `json:"tags,omitempty" yaml:"tags,omitempty"`
	Metadata        *ServiceMetadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Requires        []string         `json:"requires,omitempty" yaml:"requires,omitempty"`
	PlanUpdateable  bool             `json:"plan_updateable" yaml:"plan_updateable"`
	Plans           []ServicePlan    `json:"plans,omitempty" yaml:"plans,omitempty"`
	DashboardClient *DashboardClient `json:"dashboard_client,omitempty" yaml:"dashboard_client,omitempty"`
}

func (Service) Validate

func (s Service) Validate() error

type ServiceMetadata

type ServiceMetadata struct {
	DisplayName         string `json:"displayName,omitempty" yaml:"displayName,omitempty"`
	ImageURL            string `json:"imageUrl,omitempty" yaml:"imageUrl,omitempty"`
	LongDescription     string `json:"longDescription,omitempty" yaml:"longDescription,omitempty"`
	ProviderDisplayName string `json:"providerDisplayName,omitempty" yaml:"providerDisplayName,omitempty"`
	DocumentationURL    string `json:"documentationUrl,omitempty" yaml:"documentationUrl,omitempty"`
	SupportURL          string `json:"supportUrl,omitempty" yaml:"supportUrl,omitempty"`
}

type ServicePlan

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

func (ServicePlan) Validate

func (sp ServicePlan) Validate() error

type ServicePlanMetadata

type ServicePlanMetadata struct {
	Bullets     []string `json:"bullets,omitempty" yaml:"bullets,omitempty"`
	Costs       []Cost   `json:"costs,omitempty" yaml:"costs,omitempty"`
	DisplayName string   `json:"displayName,omitempty" yaml:"displayName,omitempty"`
}

type UpdateParameters

type UpdateParameters struct {
	ApplyImmediately           bool      `json:"apply_immediately"`
	BackupRetentionPeriod      int64     `json:"backup_retention_period"`
	PreferredBackupWindow      string    `json:"preferred_backup_window"`
	PreferredMaintenanceWindow string    `json:"preferred_maintenance_window"`
	Extensions                 *[]string `json:"extensions"`
}

Jump to

Keyboard shortcuts

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