broker

package
v0.22.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: Apache-2.0 Imports: 22 Imported by: 10

Documentation

Index

Constants

View Source
const (
	OperationTypeCreate  = OperationType("create")
	OperationTypeUpdate  = OperationType("update")
	OperationTypeUpgrade = OperationType("upgrade")
	OperationTypeDelete  = OperationType("delete")
	OperationTypeBind    = OperationType("bind")
	OperationTypeUnbind  = OperationType("unbind")

	MinimumCFVersion                                     = "2.57.0"
	MinimumMajorStemcellDirectorVersionForODB            = 3262
	MinimumMajorSemverDirectorVersionForLifecycleErrands = 261
	MinimumSemverVersionForBindingWithDNS                = "266.3.0"
)
View Source
const (
	GenericErrorPrefix         = "There was a problem completing your request. Please contact your operations team providing the following information:"
	PendingChangesErrorMessage = "The service broker has been updated, and this service instance is out of date. Please contact your operator."
	OperationInProgressMessage = "An operation is in progress for your service instance. Please try again later."

	UpdateLoggerAction = ""
)
View Source
const InstancePrefix = "service-instance_"

Variables

This section is empty.

Functions

func NewOperationInProgressError

func NewOperationInProgressError(e error) error

Types

type BoshClient

type BoshClient interface {
	GetTask(taskID int, logger *log.Logger) (boshdirector.BoshTask, error)
	GetTasks(deploymentName string, logger *log.Logger) (boshdirector.BoshTasks, error)
	GetNormalisedTasksByContext(deploymentName, contextID string, logger *log.Logger) (boshdirector.BoshTasks, error)
	VMs(deploymentName string, logger *log.Logger) (bosh.BoshVMs, error)
	GetDeployment(name string, logger *log.Logger) ([]byte, bool, error)
	GetDeployments(logger *log.Logger) ([]boshdirector.Deployment, error)
	DeleteDeployment(name, contextID string, logger *log.Logger, taskReporter *boshdirector.AsyncTaskReporter) (int, error)
	GetInfo(logger *log.Logger) (boshdirector.Info, error)
	RunErrand(deploymentName, errandName string, errandInstances []string, contextID string, logger *log.Logger, taskReporter *boshdirector.AsyncTaskReporter) (int, error)
	Variables(deploymentName string, logger *log.Logger) ([]boshdirector.Variable, error)
	VerifyAuth(logger *log.Logger) error
	GetDNSAddresses(deploymentName string, requestedDNS []config.BindingDNS) (map[string]string, error)
}

type Broker

type Broker struct {
	ExposeOperationalErrors    bool
	EnablePlanSchemas          bool
	EnableResolveSecretsAtBind bool
	// contains filtered or unexported fields
}

func New

func New(
	boshClient BoshClient,
	cfClient CloudFoundryClient,
	serviceOffering config.ServiceOffering,
	brokerConfig config.Broker,
	startupCheckers []StartupChecker,
	serviceAdapter ServiceAdapterClient,
	deployer Deployer,
	manifestSecretResolver ManifestSecretResolver,
	loggerFactory *loggerfactory.LoggerFactory,
) (*Broker, error)

func (*Broker) Bind

func (b *Broker) Bind(
	ctx context.Context,
	instanceID,
	bindingID string,
	details brokerapi.BindDetails,
) (brokerapi.Binding, error)

func (*Broker) CountInstancesOfPlans

func (b *Broker) CountInstancesOfPlans(logger *log.Logger) (map[cf.ServicePlan]int, error)

func (*Broker) Deprovision

func (b *Broker) Deprovision(
	ctx context.Context,
	instanceID string,
	deprovisionDetails brokerapi.DeprovisionDetails,
	asyncAllowed bool,
) (brokerapi.DeprovisionServiceSpec, error)

func (*Broker) FilteredInstances added in v0.21.0

func (b *Broker) FilteredInstances(orgName, spaceName string, logger *log.Logger) ([]service.Instance, error)

func (*Broker) Instances

func (b *Broker) Instances(logger *log.Logger) ([]service.Instance, error)

func (*Broker) LastOperation

func (b *Broker) LastOperation(ctx context.Context, instanceID, operationDataRaw string,
) (brokerapi.LastOperation, error)

func (*Broker) OrphanDeployments

func (b *Broker) OrphanDeployments(logger *log.Logger) ([]string, error)

func (*Broker) Provision

func (b *Broker) Provision(ctx context.Context, instanceID string, details brokerapi.ProvisionDetails,
	asyncAllowed bool) (brokerapi.ProvisionedServiceSpec, error)

func (*Broker) Services

func (b *Broker) Services(ctx context.Context) ([]brokerapi.Service, error)

func (*Broker) Unbind

func (b *Broker) Unbind(
	ctx context.Context,
	instanceID,
	bindingID string,
	details brokerapi.UnbindDetails,
) error

func (*Broker) Update

func (b *Broker) Update(
	ctx context.Context,
	instanceID string,
	details brokerapi.UpdateDetails,
	asyncAllowed bool,
) (brokerapi.UpdateServiceSpec, error)

func (*Broker) Upgrade

func (b *Broker) Upgrade(ctx context.Context, instanceID string, details brokerapi.UpdateDetails, logger *log.Logger) (OperationData, error)

type BrokerError added in v0.20.0

type BrokerError interface {
	ErrorForCFUser() error
	Error() string
}

type CloudFoundryClient

type CloudFoundryClient interface {
	GetAPIVersion(logger *log.Logger) (string, error)
	CountInstancesOfPlan(serviceOfferingID, planID string, logger *log.Logger) (int, error)
	CountInstancesOfServiceOffering(serviceOfferingID string, logger *log.Logger) (instanceCountByPlanID map[cf.ServicePlan]int, err error)
	GetInstanceState(serviceInstanceGUID string, logger *log.Logger) (cf.InstanceState, error)
	GetInstancesOfServiceOffering(serviceOfferingID string, logger *log.Logger) ([]service.Instance, error)
	GetInstancesOfServiceOfferingByOrgSpace(serviceOfferingID, orgName, spaceName string, logger *log.Logger) ([]service.Instance, error)
}

type Deployer

type Deployer interface {
	Create(deploymentName, planID string, requestParams map[string]interface{}, boshContextID string, logger *log.Logger) (int, []byte, error)
	Update(deploymentName, planID string, requestParams map[string]interface{}, previousPlanID *string, boshContextID string, logger *log.Logger) (int, []byte, error)
	Upgrade(deploymentName, planID string, previousPlanID *string, boshContextID string, logger *log.Logger) (int, []byte, error)
}

type DisplayableError

type DisplayableError struct {
	// contains filtered or unexported fields
}

func NewBoshRequestError

func NewBoshRequestError(action string, requestError error) DisplayableError

func NewDisplayableError

func NewDisplayableError(errorForCFUser, errForOperator error) DisplayableError

func NewGenericError

func NewGenericError(ctx context.Context, err error) DisplayableError

func (DisplayableError) Error

func (e DisplayableError) Error() string

func (DisplayableError) ErrorForCFUser

func (e DisplayableError) ErrorForCFUser() error

func (DisplayableError) ExtendedCFError added in v0.20.0

func (e DisplayableError) ExtendedCFError() error

type Errand added in v0.21.0

type Errand struct {
	Name      string   `json:",omitempty"`
	Instances []string `json:",omitempty"`
}

type LifeCycleRunner

type LifeCycleRunner struct {
	// contains filtered or unexported fields
}

func NewLifeCycleRunner

func NewLifeCycleRunner(
	boshClient BoshClient,
	plans config.Plans,
) LifeCycleRunner

func (LifeCycleRunner) GetTask

func (l LifeCycleRunner) GetTask(deploymentName string, operationData OperationData, logger *log.Logger,
) (boshdirector.BoshTask, error)

type ManifestSecretResolver added in v0.22.0

type ManifestSecretResolver interface {
	ResolveManifestSecrets(manifest []byte, deploymentVariables []boshdirector.Variable, logger *log.Logger) (map[string]string, error)
}

type OperationData

type OperationData struct {
	BoshTaskID       int
	BoshContextID    string `json:",omitempty"`
	OperationType    OperationType
	PlanID           string           `json:",omitempty"`
	PostDeployErrand PostDeployErrand // DEPRECATED: only needed for compatibility with ODB 0.20.x
	PreDeleteErrand  PreDeleteErrand  // DEPRECATED: only needed for compatibility with ODB 0.20.x
	Errands          []config.Errand  `json:",omitempty"`
}

type OperationInProgressError

type OperationInProgressError struct {
	// contains filtered or unexported fields
}

type OperationType

type OperationType string

type PostDeployErrand added in v0.18.0

type PostDeployErrand struct {
	Name      string   `json:",omitempty"`
	Instances []string `json:",omitempty"`
}

type PreDeleteErrand added in v0.19.0

type PreDeleteErrand struct {
	Name      string   `json:",omitempty"`
	Instances []string `json:",omitempty"`
}

type ServiceAdapterClient

type ServiceAdapterClient interface {
	CreateBinding(bindingID string, deploymentTopology bosh.BoshVMs, manifest []byte, requestParams map[string]interface{}, secretsMap, dnsAddresses map[string]string, logger *log.Logger) (serviceadapter.Binding, error)
	DeleteBinding(bindingID string, deploymentTopology bosh.BoshVMs, manifest []byte, requestParams map[string]interface{}, logger *log.Logger) error
	GenerateDashboardUrl(instanceID string, plan serviceadapter.Plan, manifest []byte, logger *log.Logger) (string, error)
	GeneratePlanSchema(plan serviceadapter.Plan, logger *log.Logger) (brokerapi.ServiceSchemas, error)
}

type StartupChecker added in v0.18.0

type StartupChecker interface {
	Check() error
}

type Validator added in v0.21.0

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator added in v0.21.0

func NewValidator(rawSchema map[string]interface{}) *Validator

func (*Validator) ValidateParams added in v0.21.0

func (v *Validator) ValidateParams(params map[string]interface{}) error

func (*Validator) ValidateSchema added in v0.21.0

func (v *Validator) ValidateSchema() error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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