cloudsql

package
v3.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SecondGenPricingPlan string = "PER_USE"

Variables

This section is empty.

Functions

func MapPlan

func MapPlan(details map[string]string) map[string]string

Types

type CloudSQLBroker

type CloudSQLBroker struct {
	Client         *http.Client
	ProjectId      string
	Logger         lager.Logger
	AccountManager models.AccountManager
}

func (*CloudSQLBroker) Bind

func (b *CloudSQLBroker) Bind(instanceID, bindingID string, details models.BindDetails) (models.ServiceBindingCredentials, error)

creates a new username, password, and set of ssl certs for the given instance may be slow to return because CloudSQL operations are async. Timeout may need to be raised to 90 or 120 seconds

func (*CloudSQLBroker) BuildInstanceCredentials

func (b *CloudSQLBroker) BuildInstanceCredentials(bindDetails map[string]string, instanceDetails map[string]string) map[string]string

func (*CloudSQLBroker) Deprovision

func (b *CloudSQLBroker) Deprovision(instanceId string, details models.DeprovisionDetails) error

issue a delete call on the database instance

func (*CloudSQLBroker) DeprovisionsAsync

func (b *CloudSQLBroker) DeprovisionsAsync() bool

func (*CloudSQLBroker) FinishProvisioning

func (b *CloudSQLBroker) FinishProvisioning(instanceId string, params map[string]string) error

Completes the second step in provisioning a cloudsql instance, namely, creating the db. executing this "synchronously" even though technically db creation returns an op - but it's just a db call, so it should be quick and not actually async.

func (*CloudSQLBroker) LastOperationWasDelete

func (b *CloudSQLBroker) LastOperationWasDelete(instanceId string) (bool, error)

used during polling of async operations to determine if the workflow is a provision or deprovision flow based off the type of the most recent operation

func (*CloudSQLBroker) PollInstance

func (b *CloudSQLBroker) PollInstance(instanceId string) (bool, error)

gets the last operation for this instance and polls the status of it

func (*CloudSQLBroker) PollOperation

func (b *CloudSQLBroker) PollOperation(instance models.ServiceInstanceDetails, op models.CloudOperation) (bool, error)

Checks the status of the given CloudSQL operation and determines if it is ready to continue provisioning. If so, calls the finish method and returns a bool indicating if provisioning is done or not, and any error TODO(cbriant): at least rename, if not restructure, this function XXX: note that for this function in particular, we are being explicit to return errors from the google api exactly as we get them, because further up the stack these errors will be evaluated differently and need to be preserved

func (*CloudSQLBroker) Provision

Creates a new CloudSQL instance

optional custom parameters:

  • database_name (generated and returned in ServiceInstanceDetails.OtherDetails.DatabaseName)
  • instance_name (generated and returned in ServiceInstanceDetails.Name if not provided)
  • version (defaults to 5.6)
  • disk_size in GB (only for 2nd gen, defaults to 10)
  • region (defaults to us-central)
  • zone (for 2nd gen)
  • disk_type (for 2nd gen, defaults to ssd)
  • failover_replica_name (only for 2nd gen, if specified creates a failover replica, defaults to "")
  • maintenance_window_day (for 2nd gen only)
  • defaults to 1 (Sunday))
  • maintenance_window_hour (for 2nd gen only, defaults to 0)
  • backups_enabled (defaults to true)
  • backup_start_time (defaults to 06:00)
  • binlog (defaults to false for 1st gen, true for 2nd gen)
  • activation_policy (defaults to on demand)
  • replication_type (defaults to synchronous)
  • auto_resize (2nd gen only, defaults to false)

for more information, see: https://cloud.google.com/sql/docs/admin-api/v1beta4/instances/insert

func (*CloudSQLBroker) ProvisionsAsync

func (b *CloudSQLBroker) ProvisionsAsync() bool

Indicates that CloudSQL uses asynchronous provisioning

func (*CloudSQLBroker) Unbind

Deletes the user and invalidates the ssl certs associated with this binding CloudFoundry doesn't seem to support async unbinding, so hopefully this works all the time even though technically some of these operations are async

type CloudSQLDynamicPlan

type CloudSQLDynamicPlan struct {
	Guid        string `json:"guid"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Tier        string `json:"tier"`
	PricingPlan string `json:"pricing_plan"`
	MaxDiskSize string `json:"max_disk_size"`
	DisplayName string `json:"display_name"`
	ServiceId   string `json:"service"`
}

type InstanceInformation

type InstanceInformation struct {
	InstanceName string `json:"instance_name"`
	DatabaseName string `json:"database_name"`
	Host         string `json:"host"`

	LastMasterOperationId string `json:"last_master_operation_id"`
}

Jump to

Keyboard shortcuts

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