Documentation ¶
Index ¶
- Constants
- type Binding
- func (b *Binding) GetBindingContext(context BindingContext, codec crypto.Codec) error
- func (b *Binding) GetBindingParameters(params BindingParameters, codec crypto.Codec) error
- func (b *Binding) GetCredentials(credentials Credentials, codec crypto.Codec) error
- func (b *Binding) SetBindingContext(context BindingContext, codec crypto.Codec) error
- func (b *Binding) SetBindingParameters(params BindingParameters, codec crypto.Codec) error
- func (b *Binding) SetCredentials(credentials Credentials, codec crypto.Codec) error
- func (b *Binding) ToJSON() ([]byte, error)
- type BindingContext
- type BindingParameters
- type Catalog
- type Credentials
- type Deprovisioner
- type DeprovisioningStep
- type DeprovisioningStepFunction
- type Instance
- func (i *Instance) GetProvisioningContext(context ProvisioningContext, codec crypto.Codec) error
- func (i *Instance) GetProvisioningParameters(params ProvisioningParameters, codec crypto.Codec) error
- func (i *Instance) GetUpdatingParameters(params UpdatingParameters, codec crypto.Codec) error
- func (i *Instance) SetProvisioningContext(context ProvisioningContext, codec crypto.Codec) error
- func (i *Instance) SetProvisioningParameters(params ProvisioningParameters, codec crypto.Codec) error
- func (i *Instance) SetUpdatingParameters(params UpdatingParameters, codec crypto.Codec) error
- func (i *Instance) ToJSON() ([]byte, error)
- type Module
- type Plan
- type PlanProperties
- type Provisioner
- type ProvisioningContext
- type ProvisioningParameters
- type ProvisioningStep
- type ProvisioningStepFunction
- type Service
- type ServiceProperties
- type Stability
- type Updater
- type UpdatingParameters
- type UpdatingStep
- type UpdatingStepFunction
- type ValidationError
Constants ¶
const ( // InstanceStateProvisioning represents the state where service instance // provisioning is in progress InstanceStateProvisioning = "PROVISIONING" // InstanceStateProvisioned represents the state where service instance // provisioning has completed successfully InstanceStateProvisioned = "PROVISIONED" // InstanceStateUpdating represents the state where service instance // updating is in progress InstanceStateUpdating = "UPDATING" // InstanceStateUpdated represents the state where service instance // updating has completed successfully // It redirects to InstanceStateProvisioned because it means the same thing // to any other operations besides updating InstanceStateUpdated = InstanceStateProvisioned // InstanceStateProvisioningFailed represents the state where service instance // provisioning has failed InstanceStateProvisioningFailed = "PROVISIONING_FAILED" // InstanceStateDeprovisioning represents the state where service instance // deprovisioning is in progress InstanceStateDeprovisioning = "DEPROVISIONING" // InstanceStateDeprovisioningFailed represents the state where service // instance deprovisioning has failed InstanceStateDeprovisioningFailed = "DEPROVISIONING_FAILED" // BindingStateBound represents the state where service binding has completed // successfully BindingStateBound = "BOUND" // BindingStateBindingFailed represents the state where service binding has // failed BindingStateBindingFailed = "BINDING_FAILED" // BindingStateUnbindingFailed represents the state where service unbinding // has failed BindingStateUnbindingFailed = "UNBINDING_FAILED" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct { BindingID string `json:"bindingId"` InstanceID string `json:"instanceId"` EncryptedBindingParameters []byte `json:"bindingParameters"` Status string `json:"status"` StatusReason string `json:"statusReason"` EncryptedBindingContext []byte `json:"bindingContext"` EncryptedCredentials []byte `json:"credentials"` Created time.Time `json:"created"` }
Binding represents a biding to a service
func NewBindingFromJSON ¶
NewBindingFromJSON returns a new Binding unmarshalled from the provided JSON []byte
func (*Binding) GetBindingContext ¶
func (b *Binding) GetBindingContext( context BindingContext, codec crypto.Codec, ) error
GetBindingContext decrypts the EncryptedBindingContext field and unmarshals the result into the provided bindingContext object
func (*Binding) GetBindingParameters ¶
func (b *Binding) GetBindingParameters( params BindingParameters, codec crypto.Codec, ) error
GetBindingParameters decrypts the EncryptedBindingParameters field and unmarshals the result into the provided bindingParameters object
func (*Binding) GetCredentials ¶
func (b *Binding) GetCredentials( credentials Credentials, codec crypto.Codec, ) error
GetCredentials decrypts the EncryptedCredentials field and unmarshals the result into the provided credentials object
func (*Binding) SetBindingContext ¶
func (b *Binding) SetBindingContext( context BindingContext, codec crypto.Codec, ) error
SetBindingContext marshals the provided bindingContext object, encrypts the result, and stores it in the EncryptedBindingContext field
func (*Binding) SetBindingParameters ¶
func (b *Binding) SetBindingParameters( params BindingParameters, codec crypto.Codec, ) error
SetBindingParameters marshals the provided bindingParameters object, encrypts the result, and stores it in the EncryptedBindingParameters field
func (*Binding) SetCredentials ¶
func (b *Binding) SetCredentials( credentials Credentials, codec crypto.Codec, ) error
SetCredentials marshals the provided credentials object, encrypts the result, and stores it in the EncryptedCredentials field
type BindingContext ¶
type BindingContext interface{}
BindingContext is an interface to be implemented by module-specific types that represent binding context. This interface doesn't require any functions to be implemented. It exists to improve the clarity of function signatures and documentation.
type BindingParameters ¶
type BindingParameters interface{}
BindingParameters is an interface to be implemented by module-specific types that represent binding parameters. This interface doesn't require any functions to be implemented. It exists to improve the clarity of function signatures and documentation.
type Catalog ¶
type Catalog interface { ToJSON() ([]byte, error) GetServices() []Service GetService(serviceID string) (Service, bool) }
Catalog is an interface to be implemented by types that represents the service/plans offered by a service module or by the entire broker.
func NewCatalog ¶
NewCatalog initializes and returns a new Catalog
func NewCatalogFromJSON ¶
NewCatalogFromJSON returns a new Catalog unmarshalled from the provided JSON []byte
type Credentials ¶
type Credentials interface{}
Credentials is an interface to be implemented by module-specific types that represent service credentials. This interface doesn't require any functions to be implemented. It exists to improve the clarity of function signatures and documentation.
type Deprovisioner ¶
type Deprovisioner interface { GetFirstStepName() (string, bool) GetStep(name string) (DeprovisioningStep, bool) GetNextStepName(name string) (string, bool) }
Deprovisioner is an interface to be implemented by types that model a declared chain of tasks used to asynchronously deprovision a service
func NewDeprovisioner ¶
func NewDeprovisioner(steps ...DeprovisioningStep) (Deprovisioner, error)
NewDeprovisioner returns a new deprovisioner
type DeprovisioningStep ¶
type DeprovisioningStep interface { GetName() string Execute( ctx context.Context, instanceID string, serviceID string, planID string, provisioningContext ProvisioningContext, ) (ProvisioningContext, error) }
DeprovisioningStep is an interface to be implemented by types that represent a single step in a chain of steps that defines a deprovisioning process
func NewDeprovisioningStep ¶
func NewDeprovisioningStep( name string, fn DeprovisioningStepFunction, ) DeprovisioningStep
NewDeprovisioningStep returns a new DeprovisioningStep
type DeprovisioningStepFunction ¶
type DeprovisioningStepFunction func( ctx context.Context, instanceID string, serviceID string, planID string, provisioningContext ProvisioningContext, ) (ProvisioningContext, error)
DeprovisioningStepFunction is the signature for functions that implement a deprovisioning step
type Instance ¶
type Instance struct { InstanceID string `json:"instanceId"` ServiceID string `json:"serviceId"` PlanID string `json:"planId"` EncryptedProvisioningParameters []byte `json:"provisioningParameters"` EncryptedUpdatingParameters []byte `json:"updatingParameters"` Status string `json:"status"` StatusReason string `json:"statusReason"` EncryptedProvisioningContext []byte `json:"provisioningContext"` Created time.Time `json:"created"` }
Instance represents an instance of a service
func NewInstanceFromJSON ¶
NewInstanceFromJSON returns a new Instance unmarshalled from the provided JSON []byte
func (*Instance) GetProvisioningContext ¶
func (i *Instance) GetProvisioningContext( context ProvisioningContext, codec crypto.Codec, ) error
GetProvisioningContext decrypts the EncryptedProvisioningContext field and unmarshals the result into the provided provisioningContext object
func (*Instance) GetProvisioningParameters ¶
func (i *Instance) GetProvisioningParameters( params ProvisioningParameters, codec crypto.Codec, ) error
GetProvisioningParameters decrypts the EncryptedProvisioningParameters field and unmarshals the result into the provided provisioningParameters object
func (*Instance) GetUpdatingParameters ¶
func (i *Instance) GetUpdatingParameters( params UpdatingParameters, codec crypto.Codec, ) error
GetUpdatingParameters decrypts the EncryptedUpdatingParameters field and unmarshals the result into the provided updatingParameters object
func (*Instance) SetProvisioningContext ¶
func (i *Instance) SetProvisioningContext( context ProvisioningContext, codec crypto.Codec, ) error
SetProvisioningContext marshals the provided provisioningContext object, encrypts the result, and stores it in the EncrypredProvisioningContext field
func (*Instance) SetProvisioningParameters ¶
func (i *Instance) SetProvisioningParameters( params ProvisioningParameters, codec crypto.Codec, ) error
SetProvisioningParameters marshals the provided provisioningParameters object, encrypts the result, and stores it in the EncryptedProvisioningParameters field
func (*Instance) SetUpdatingParameters ¶
func (i *Instance) SetUpdatingParameters( params UpdatingParameters, codec crypto.Codec, ) error
SetUpdatingParameters marshals the provided updatingParameters object, encrypts the result, and stores it in the EncryptedUpdatingParameters field
type Module ¶
type Module interface { // GetName returns a module's name GetName() string // GetStability returns a module's relative level of stability GetStability() Stability // GetCatalog returns a Catalog of service/plans offered by a module GetCatalog() (Catalog, error) // GetEmptyProvisioningParameters returns an empty instance of module-specific // provisioningParameters GetEmptyProvisioningParameters() ProvisioningParameters // ValidateProvisioningParameters validates the provided // provisioningParameters and returns an error if there is any problem ValidateProvisioningParameters(ProvisioningParameters) error // GetProvisioner returns a provisioner that defines the steps a module must // execute asynchronously to provision a service. // // The two input parameters represent the service ID and plan ID // (respectively). Using these parameters, module implementations can // choose to return different Provisioner implementations for different // services/plans GetProvisioner(serviceID, planID string) (Provisioner, error) // GetEmptyProvisioningContext returns an empty instance of a module-specific // ProvisioningContext GetEmptyProvisioningContext() ProvisioningContext // GetEmptyUpdatingParameters returns an empty instance of module-specific // updatingParameters GetEmptyUpdatingParameters() UpdatingParameters // ValidateUpdatingParameters validates the provided // updatingParameters and returns an error if there is any problem ValidateUpdatingParameters(UpdatingParameters) error // GetUpdater returns a updater that defines the steps a module must // execute asynchronously to update a service. // // The two input parameters represent the service ID and plan ID // (respectively). Using these parameters, module implementations can // choose to return different Updater implementations for different // services/plans GetUpdater(serviceID, planID string) (Updater, error) // GetEmptyBindingParameters returns an empty instance of module-specific // bindingParameters GetEmptyBindingParameters() BindingParameters // ValidateBindingParameters validates the provided bindingParameters and // returns an error if there is any problem ValidateBindingParameters(BindingParameters) error // Bind synchronously binds to a service Bind( ProvisioningContext, BindingParameters, ) (BindingContext, Credentials, error) // GetEmptyBindingContext returns an empty instance of a module-specific // bindingContext GetEmptyBindingContext() BindingContext // GetEmptyCredentials returns an empty instance of module-specific // credentials GetEmptyCredentials() Credentials // Unbind synchronously unbinds from a service Unbind(ProvisioningContext, BindingContext) error // GetDeprovisioner returns a deprovisioner that defines the steps a module // must execute asynchronously to deprovision a service // // The two input parameters represent the service ID and plan ID // (respectively). Using these parameters, module implementations can // choose to return different Deprovisioner implementations for different // services/plans GetDeprovisioner(serviceID, planID string) (Deprovisioner, error) }
Module is an interface to be implemented by the broker's service modules
type Plan ¶
type Plan interface { ToJSON() ([]byte, error) GetID() string GetName() string GetProperties() *PlanProperties }
Plan is an interface to be implemented by types that represent a single variant or "sku" of a service
func NewPlan ¶
func NewPlan(planProperties *PlanProperties) Plan
NewPlan initializes and returns a new Plan
func NewPlanFromJSON ¶
NewPlanFromJSON returns a new Plan unmarshalled from the provided JSON []byte
type PlanProperties ¶
type PlanProperties struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Free bool `json:"free"` Extended map[string]interface{} `json:"-"` }
PlanProperties represent the properties of a Plan that can be directly instantiated and passed to the NewPlan() constructor function which will carry out all necessary initialization.
type Provisioner ¶
type Provisioner interface { GetFirstStepName() (string, bool) GetStep(name string) (ProvisioningStep, bool) GetNextStepName(name string) (string, bool) }
Provisioner is an interface to be implemented by types that model a declared chain of tasks used to asynchronously provision a service
func NewProvisioner ¶
func NewProvisioner(steps ...ProvisioningStep) (Provisioner, error)
NewProvisioner returns a new provisioner
type ProvisioningContext ¶
type ProvisioningContext interface{}
ProvisioningContext is an interface to be implemented by module-specific types that represent provisioning context.
type ProvisioningParameters ¶
type ProvisioningParameters interface { // SetResourceGroup sets the name of the resource group that a service // instance should be provisioned into. SetResourceGroup(string) }
ProvisioningParameters is an interface to be implemented by module-specific types that represent provisioning parameters. This interface doesn't require any functions to be implemented. It exists to improve the clarity of function signatures and documentation.
type ProvisioningStep ¶
type ProvisioningStep interface { GetName() string Execute( ctx context.Context, instanceID string, serviceID string, planID string, provisioningContext ProvisioningContext, params ProvisioningParameters, ) (ProvisioningContext, error) }
ProvisioningStep is an interface to be implemented by types that represent a single step in a chain of steps that defines a provisioning process
func NewProvisioningStep ¶
func NewProvisioningStep( name string, fn ProvisioningStepFunction, ) ProvisioningStep
NewProvisioningStep returns a new ProvisioningStep
type ProvisioningStepFunction ¶
type ProvisioningStepFunction func( ctx context.Context, instanceID string, serviceID string, planID string, provisioningContext ProvisioningContext, params ProvisioningParameters, ) (ProvisioningContext, error)
ProvisioningStepFunction is the signature for functions that implement a provisioning step
type Service ¶
type Service interface { ToJSON() ([]byte, error) GetID() string GetName() string GetPlans() []Plan GetPlan(planID string) (Plan, bool) }
Service is an interface to be implemented by types that represent a single type of service with one or more plans
func NewService ¶
func NewService(serviceProperties *ServiceProperties, plans ...Plan) Service
NewService initialized and returns a new Service
func NewServiceFromJSON ¶
NewServiceFromJSON returns a new Service unmarshalled from the provided JSON []byte
type ServiceProperties ¶
type ServiceProperties struct { Name string `json:"name"` ID string `json:"id"` Description string `json:"description"` Tags []string `json:"tags"` Bindable bool `json:"bindable"` PlanUpdatable bool `json:"plan_updateable"` // Misspelling is deliberate }
ServiceProperties represent the properties of a Service that can be directly instantiated and passed to the NewService() constructor function which will carry out all necessary initialization.
type Stability ¶
type Stability int
Stability is a type that represents the relative stability of a service module
const ( // StabilityAlpha represents relative stability of the most immature and // experimental service modules StabilityAlpha Stability = iota // StabilityBeta represents relative stability of the moderately immature and // semi-experimental service modules StabilityBeta // StabilityStable represents relative stability of the mature, production- // ready service modules StabilityStable )
type Updater ¶
type Updater interface { GetFirstStepName() (string, bool) GetStep(name string) (UpdatingStep, bool) GetNextStepName(name string) (string, bool) }
Updater is an interface to be implemented by types that model a declared chain of tasks used to asynchronously update a service
func NewUpdater ¶
func NewUpdater(steps ...UpdatingStep) (Updater, error)
NewUpdater returns a new updater
type UpdatingParameters ¶
type UpdatingParameters interface{}
UpdatingParameters is an interface to be implemented by module-specific types that represent updating parameters. This interface doesn't require any functions to be implemented. It exists to improve the clarity of function signatures and documentation.
type UpdatingStep ¶
type UpdatingStep interface { GetName() string Execute( ctx context.Context, instanceID string, serviceID string, planID string, provisioningContext ProvisioningContext, params UpdatingParameters, ) (ProvisioningContext, error) }
UpdatingStep is an interface to be implemented by types that represent a single step in a chain of steps that defines a updating process
func NewUpdatingStep ¶
func NewUpdatingStep( name string, fn UpdatingStepFunction, ) UpdatingStep
NewUpdatingStep returns a new UpdatingStep
type UpdatingStepFunction ¶
type UpdatingStepFunction func( ctx context.Context, instanceID string, serviceID string, planID string, provisioningContext ProvisioningContext, params UpdatingParameters, ) (ProvisioningContext, error)
UpdatingStepFunction is the signature for functions that implement a updating step
type ValidationError ¶
ValidationError represents an error validating requestParameters. This specific error type should be used to allow the broker's framework to differentiate between validation errors and other common, unexpected errors.
func NewValidationError ¶
func NewValidationError(field, issue string) *ValidationError
NewValidationError returns a new ValidationError for the given field and issue
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string