Documentation ¶
Index ¶
- Constants
- func MysqlServiceDefinition() *broker.ServiceDefinition
- func PostgresServiceDefinition() *broker.ServiceDefinition
- type CloudSQLBroker
- func (b *CloudSQLBroker) Bind(ctx context.Context, vc *varcontext.VarContext) (map[string]interface{}, error)
- func (b *CloudSQLBroker) BuildInstanceCredentials(ctx context.Context, bindRecord models.ServiceBindingCredentials, ...) (*brokerapi.Binding, error)
- func (b *CloudSQLBroker) Deprovision(ctx context.Context, instance models.ServiceInstanceDetails, ...) (*string, error)
- func (b *CloudSQLBroker) DeprovisionsAsync() bool
- func (b *CloudSQLBroker) PollInstance(ctx context.Context, instance models.ServiceInstanceDetails) (bool, error)
- func (b *CloudSQLBroker) Provision(ctx context.Context, provisionContext *varcontext.VarContext) (models.ServiceInstanceDetails, error)
- func (b *CloudSQLBroker) ProvisionsAsync() bool
- func (b *CloudSQLBroker) Unbind(ctx context.Context, instance models.ServiceInstanceDetails, ...) error
- func (b *CloudSQLBroker) UpdateInstanceDetails(ctx context.Context, instance *models.ServiceInstanceDetails) error
- type InstanceInformation
Constants ¶
const ( MySqlServiceId = "4bc59b9a-8520-409f-85da-1c7552315863" CloudsqlMySQLName = "google-cloudsql-mysql" )
const PostgresServiceId = "cbad6d78-a73c-432d-b8ff-b219a17a803a"
Variables ¶
This section is empty.
Functions ¶
func MysqlServiceDefinition ¶
func MysqlServiceDefinition() *broker.ServiceDefinition
MysqlServiceDefinition creates a new ServiceDefinition object for the MySQL service.
func PostgresServiceDefinition ¶
func PostgresServiceDefinition() *broker.ServiceDefinition
PostgresServiceDefinition creates a new ServiceDefinition object for the PostgreSQL service.
Types ¶
type CloudSQLBroker ¶
type CloudSQLBroker struct {
base.BrokerBase
}
CloudSQLBroker is the service-broker back-end for creating and binding CloudSQL instances.
func (*CloudSQLBroker) Bind ¶
func (b *CloudSQLBroker) Bind(ctx context.Context, vc *varcontext.VarContext) (map[string]interface{}, error)
Bind creates a new username, password, and set of ssl certs for the given instance. The function may be slow to return because CloudSQL operations are asynchronous. The default PCF service broker timeout may need to be raised to 90 or 120 seconds to accommodate the long bind time.
func (*CloudSQLBroker) BuildInstanceCredentials ¶
func (b *CloudSQLBroker) BuildInstanceCredentials(ctx context.Context, bindRecord models.ServiceBindingCredentials, instanceRecord models.ServiceInstanceDetails) (*brokerapi.Binding, error)
func (*CloudSQLBroker) Deprovision ¶
func (b *CloudSQLBroker) Deprovision(ctx context.Context, instance models.ServiceInstanceDetails, details brokerapi.DeprovisionDetails) (*string, error)
Deprovision issues a delete call on the database instance.
func (*CloudSQLBroker) DeprovisionsAsync ¶
func (b *CloudSQLBroker) DeprovisionsAsync() bool
DeprovisionsAsync indicates that CloudSQL uses asynchronous deprovisioning.
func (*CloudSQLBroker) PollInstance ¶
func (b *CloudSQLBroker) PollInstance(ctx context.Context, instance models.ServiceInstanceDetails) (bool, error)
PollInstance gets the last operation for this instance and checks its status.
func (*CloudSQLBroker) Provision ¶
func (b *CloudSQLBroker) Provision(ctx context.Context, provisionContext *varcontext.VarContext) (models.ServiceInstanceDetails, error)
Provision creates a new CloudSQL instance from the settings in the user-provided details and service plan.
func (*CloudSQLBroker) ProvisionsAsync ¶
func (b *CloudSQLBroker) ProvisionsAsync() bool
ProvisionsAsync indicates that CloudSQL uses asynchronous provisioning.
func (*CloudSQLBroker) Unbind ¶
func (b *CloudSQLBroker) Unbind(ctx context.Context, instance models.ServiceInstanceDetails, binding models.ServiceBindingCredentials) error
Unbind deletes the database user, service account and invalidates the ssl certs associated with this binding. It returns early to make an unbind fail if any subcommand fails. -> It is possible that the deletion of a postgres sql user fails because of depending objects in the db. In that case, the service account should not be deleted (BrokerBase.Unbind) because the users would not be able to connect to the db anymore. Terraform handles the issue in a similar way.
func (*CloudSQLBroker) UpdateInstanceDetails ¶
func (b *CloudSQLBroker) UpdateInstanceDetails(ctx context.Context, instance *models.ServiceInstanceDetails) error
refreshServiceInstanceDetails fetches the settings for the instance from GCP and upates the provided instance with the refreshed info.
type InstanceInformation ¶
type InstanceInformation struct { InstanceName string `json:"instance_name"` DatabaseName string `json:"database_name"` Host string `json:"host"` Region string `json:"region"` LastMasterOperationId string `json:"last_master_operation_id"` }
InstanceInformation holds the details needed to bind a service account to a CloudSQL instance after it has been provisioned.