Documentation ¶
Index ¶
- Constants
- func AuthorizedNetwork() broker.BrokerVariable
- func InstanceID(minLength, maxLength int, uniqueArea UniqueArea) broker.BrokerVariable
- func Region(defaultLocation, supportedLocationsURL string) broker.BrokerVariable
- func Zone(defaultLocation, supportedLocationsURL string) broker.BrokerVariable
- type AsynchronousInstanceMixin
- type BrokerBase
- func (b *BrokerBase) Bind(ctx context.Context, vc *varcontext.VarContext) (map[string]interface{}, error)
- func (b *BrokerBase) DeprovisionsAsync() bool
- func (b *BrokerBase) PollInstance(ctx context.Context, instance models.ServiceInstanceDetails) (bool, error)
- func (b *BrokerBase) ProvisionsAsync() bool
- func (b *BrokerBase) Unbind(ctx context.Context, instance models.ServiceInstanceDetails, ...) error
- func (b *BrokerBase) UpdateInstanceDetails(ctx context.Context, instance *models.ServiceInstanceDetails) error
- type MergedInstanceCredsMixin
- type NoOpBindMixin
- type PeeredNetworkServiceBase
- type ServiceAccountManager
- type UniqueArea
Constants ¶
const ( // InstanceIDKey is the key used by Instance identifier BrokerVariables. InstanceIDKey = "instance_id" // ZoneKey is the key used by Zone BrokerVariables. ZoneKey = "zone" // RegionKey is the key used by Region BrokerVariables. RegionKey = "region" // AuthorizedNetworkKey is the key used to define authorized networks. AuthorizedNetworkKey = "authorized_network" )
Variables ¶
This section is empty.
Functions ¶
func AuthorizedNetwork ¶
func AuthorizedNetwork() broker.BrokerVariable
AuthorizedNetwork returns a variable used to attach resources to a user-defined network.
func InstanceID ¶
func InstanceID(minLength, maxLength int, uniqueArea UniqueArea) broker.BrokerVariable
InstanceID creates an InstanceID broker variable with key InstanceIDKey. It accepts lower-case InstanceIDs with hyphens.
func Region ¶
func Region(defaultLocation, supportedLocationsURL string) broker.BrokerVariable
Region creates a variable that accepts GCP regions.
func Zone ¶
func Zone(defaultLocation, supportedLocationsURL string) broker.BrokerVariable
Zone creates a variable that accepts GCP zones.
Types ¶
type AsynchronousInstanceMixin ¶
type AsynchronousInstanceMixin struct{}
AsynchronousInstanceMixin sets ProvisionAsync and DeprovisionsAsync functions to be true.
func (*AsynchronousInstanceMixin) DeprovisionsAsync ¶
func (b *AsynchronousInstanceMixin) DeprovisionsAsync() bool
DeprovisionsAsync indicates if deprovisioning must be done asynchronously.
func (*AsynchronousInstanceMixin) ProvisionsAsync ¶
func (b *AsynchronousInstanceMixin) ProvisionsAsync() bool
ProvisionsAsync indicates if provisioning must be done asynchronously.
type BrokerBase ¶
type BrokerBase struct { MergedInstanceCredsMixin AccountManager ServiceAccountManager HttpConfig *jwt.Config ProjectId string Logger lager.Logger // contains filtered or unexported fields }
BrokerBase is the reference bind and unbind implementation for brokers that bind and unbind with only Service Accounts.
func NewBrokerBase ¶
NewBrokerBase creates a new broker base and account manager it uses from the given settings.
func (*BrokerBase) Bind ¶
func (b *BrokerBase) Bind(ctx context.Context, vc *varcontext.VarContext) (map[string]interface{}, error)
Bind creates a service account with access to the provisioned resource with the given instance.
func (*BrokerBase) DeprovisionsAsync ¶
func (b *BrokerBase) DeprovisionsAsync() bool
DeprovisionsAsync indicates if deprovisioning must be done asynchronously.
func (*BrokerBase) PollInstance ¶
func (b *BrokerBase) PollInstance(ctx context.Context, instance models.ServiceInstanceDetails) (bool, error)
PollInstance does nothing but return an error because Base services are provisioned synchronously so this method should not be called.
func (*BrokerBase) ProvisionsAsync ¶
func (b *BrokerBase) ProvisionsAsync() bool
ProvisionsAsync indicates if provisioning must be done asynchronously.
func (*BrokerBase) Unbind ¶
func (b *BrokerBase) Unbind(ctx context.Context, instance models.ServiceInstanceDetails, creds models.ServiceBindingCredentials) error
Unbind deletes the created service account from the GCP Project.
func (*BrokerBase) UpdateInstanceDetails ¶
func (b *BrokerBase) UpdateInstanceDetails(ctx context.Context, instance *models.ServiceInstanceDetails) error
UpdateInstanceDetails updates the ServiceInstanceDetails with the most recent state from GCP. This instance is a no-op method.
type MergedInstanceCredsMixin ¶
type MergedInstanceCredsMixin struct{}
MergedInstanceCredsMixin adds the BuildInstanceCredentials function that merges the OtherDetails of the bind and instance records.
func (*MergedInstanceCredsMixin) BuildInstanceCredentials ¶
func (b *MergedInstanceCredsMixin) BuildInstanceCredentials(ctx context.Context, bindRecord models.ServiceBindingCredentials, instanceRecord models.ServiceInstanceDetails) (*brokerapi.Binding, error)
BuildInstanceCredentials combines the bind credentials with the connection information in the instance details to get a full set of connection details.
type NoOpBindMixin ¶
type NoOpBindMixin struct{}
NoOpBindMixin does a no-op binding. This can be used when you still want a service to be bindable but nothing is required server-side to support it. For example, when the service requires no authentication.
func (*NoOpBindMixin) Bind ¶
func (m *NoOpBindMixin) Bind(ctx context.Context, vc *varcontext.VarContext) (map[string]interface{}, error)
Bind does a no-op bind.
func (*NoOpBindMixin) Unbind ¶
func (m *NoOpBindMixin) Unbind(ctx context.Context, instance models.ServiceInstanceDetails, creds models.ServiceBindingCredentials) error
Unbind does a no-op unbind.
type PeeredNetworkServiceBase ¶
type PeeredNetworkServiceBase struct { MergedInstanceCredsMixin AccountManager ServiceAccountManager HTTPConfig *jwt.Config DefaultProjectID string Logger lager.Logger }
PeeredNetworkServiceBase is a base for services that are attached to a project via peered network.
func NewPeeredNetworkServiceBase ¶
func NewPeeredNetworkServiceBase(projectID string, auth *jwt.Config, logger lager.Logger) PeeredNetworkServiceBase
NewPeeredNetworkServiceBase creates a new PeeredNetworkServiceBase from the given settings.
type ServiceAccountManager ¶
type ServiceAccountManager interface { CreateCredentials(ctx context.Context, vc *varcontext.VarContext) (map[string]interface{}, error) DeleteCredentials(ctx context.Context, creds models.ServiceBindingCredentials) error }
type UniqueArea ¶
type UniqueArea string
UniqueArea defines an umbrella under which identifiers must be unique.
const ( // ZoneArea indicates uniqueness per zone ZoneArea UniqueArea = "per zone" // RegionArea indicates uniqueness per region RegionArea UniqueArea = "per region" // ProjectArea indicates uniqueness per project ProjectArea UniqueArea = "per project" // GlobalArea indicates global uniqueness GlobalArea UniqueArea = "globally" )