Documentation ¶
Index ¶
- Constants
- Variables
- func NewCCDBConnection(dbHost string, dbUsername string, dbPassword string, tunnelHost string, ...) (*sqlx.DB, error)
- func NewNullInt64(i int64) sql.NullInt64
- func NewNullString(s string) sql.NullString
- type CloudController
- func (d *CloudController) CalculateSaltLength() error
- func (d *CloudController) CreateServiceBinding(binding cfclient.ServiceBinding, appGUID string, encryptionKey string) error
- func (d *CloudController) CreateServiceInstance(si cfclient.ServiceInstance, targetSpace cfclient.Space, ...) error
- func (d *CloudController) DeleteServiceInstance(spaceGUID string, serviceInstanceGUID string) (bool, error)
- func (d *CloudController) GenerateSalt() (string, error)
- func (d *CloudController) ServiceInstanceExists(serviceInstanceGUID string) (bool, error)
- type Repository
Constants ¶
const ( CreateServiceInstanceSQLStatement = `` /* 380-byte string literal not displayed */ DeleteServiceInstanceSQLStatement = `DELETE FROM service_instances WHERE guid=? AND space_id=?` CreateServiceBindingSQLStatement = `` /* 280-byte string literal not displayed */ DeleteServiceBindingsSQLStatement = `DELETE FROM service_bindings WHERE service_instance_guid=?` DeleteServiceKeysSQLStatement = `DELETE FROM service_keys WHERE service_instance_id=?` DeleteServiceInstanceOperationsSQLStatement = `DELETE FROM service_instance_operations WHERE service_instance_id=?` CreateServiceUsageEventSQLStatement = `` /* 420-byte string literal not displayed */ GetIDFromGUIDLimitToOneTemplateQuery = `SELECT id FROM %s WHERE guid=? LIMIT 1` GetIDFromGUIDTemplateQuery = `SELECT id FROM %s WHERE guid=?` )
Variables ¶
var ErrUnsupportedOperation = errors.New("unsupported operation")
Functions ¶
func NewCCDBConnection ¶
func NewCCDBConnection(dbHost string, dbUsername string, dbPassword string, tunnelHost string, tunnelUser string, tunnelPassword string, tunnelPrivateKey string, tunnelRequired bool) (*sqlx.DB, error)
NewCCDBConnection will establish a connection to the CCDB on the host with the specified username and password
func NewNullInt64 ¶
NewNullInt64 will return an empty sql.NullInt64 if i is 0, and an sql.NullInt64 with i in it if it is not
func NewNullString ¶
func NewNullString(s string) sql.NullString
NewNullString will return an empty sql.NullString if s is empty, and an sql.NullString with s in it if not
Types ¶
type CloudController ¶
CloudController is the concrete struct that will implement Repository
func (*CloudController) CalculateSaltLength ¶
func (d *CloudController) CalculateSaltLength() error
CalculateSaltLength will look in the CCDB for an existing salt to get its length, as it will be static throughout the DB
func (*CloudController) CreateServiceBinding ¶
func (d *CloudController) CreateServiceBinding(binding cfclient.ServiceBinding, appGUID string, encryptionKey string) error
CreateServiceBinding will inject a service binding into the DB
func (*CloudController) CreateServiceInstance ¶
func (d *CloudController) CreateServiceInstance(si cfclient.ServiceInstance, targetSpace cfclient.Space, targetPlan cfclient.ServicePlan, targetService cfclient.Service, key string) error
CreateServiceInstance will insert a service instance (and associated service usage event) in the CC DB
func (*CloudController) DeleteServiceInstance ¶
func (d *CloudController) DeleteServiceInstance(spaceGUID string, serviceInstanceGUID string) (bool, error)
func (*CloudController) GenerateSalt ¶
func (d *CloudController) GenerateSalt() (string, error)
GenerateSalt will create a random hex string with the appropriate length for the foundation
func (*CloudController) ServiceInstanceExists ¶
func (d *CloudController) ServiceInstanceExists(serviceInstanceGUID string) (bool, error)
type Repository ¶
type Repository interface { ServiceInstanceExists(guid string) (bool, error) CreateServiceInstance(si cfclient.ServiceInstance, targetSpace cfclient.Space, targetPlan cfclient.ServicePlan, targetService cfclient.Service, key string) error DeleteServiceInstance(spaceGUID string, serviceInstanceGUID string) (bool, error) CreateServiceBinding(binding cfclient.ServiceBinding, appGUID string, encryptionKey string) error }
Repository calls operations on the CCDB