broker

package
v0.0.0-...-fb356ce Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentName = "on-demand-service-broker"

	OperationTypeCreate      = OperationType("create")
	OperationTypeUpdate      = OperationType("update")
	OperationTypeUpgrade     = OperationType("upgrade")
	OperationTypeRecreate    = OperationType("recreate")
	OperationTypeDelete      = OperationType("delete")
	OperationTypeForceDelete = OperationType("force-delete")
	OperationTypeBind        = OperationType("bind")
	OperationTypeUnbind      = OperationType("unbind")

	MinimumCFVersion                                     = "2.57.0"
	MinimumMajorStemcellDirectorVersionForODB            = 3262
	MinimumMajorSemverDirectorVersionForLifecycleErrands = 261
)
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 NewDeploymentNotFoundError

func NewDeploymentNotFoundError(e error) error

func NewOperationAlreadyCompletedError

func NewOperationAlreadyCompletedError(e error) error

func NewOperationInProgressError

func NewOperationInProgressError(e error) error

func NewPendingChangesNotAppliedError

func NewPendingChangesNotAppliedError(e error) error

func NewServiceError

func NewServiceError(e error) error

Types

type BoshClient

type BoshClient interface {
	GetTask(taskID int, logger *log.Logger) (boshdirector.BoshTask, error)
	GetTasksInProgress(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, force bool, taskReporter *boshdirector.AsyncTaskReporter, logger *log.Logger) (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)
	Deploy(manifest []byte, contextID string, logger *log.Logger, reporter *boshdirector.AsyncTaskReporter) (int, error)
	Recreate(deploymentName, contextID string, logger *log.Logger, taskReporter *boshdirector.AsyncTaskReporter) (int, error)
	GetConfigs(configName string, logger *log.Logger) ([]boshdirector.BoshConfig, error)
	DeleteConfig(configType, configName string, logger *log.Logger) (bool, error)
	DeleteConfigs(configName string, logger *log.Logger) error
}

type Broker

type Broker struct {
	ExposeOperationalErrors   bool
	EnablePlanSchemas         bool
	EnableSecureManifests     bool
	SupportBackupAgentBinding bool
	DisableBoshConfigs        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,
	manifestSecretManager ManifestSecretManager,
	instanceLister service.InstanceLister,
	hasher Hasher,
	loggerFactory *loggerfactory.LoggerFactory,
	telemetryLogger TelemetryLogger,
	decider Decider) (*Broker, error)

func (*Broker) Bind

func (b *Broker) Bind(
	ctx context.Context,
	instanceID,
	bindingID string,
	details domain.BindDetails,
	asyncAllowed bool,
) (domain.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 domain.DeprovisionDetails,
	asyncAllowed bool,
) (domain.DeprovisionServiceSpec, error)

func (*Broker) GetBinding

func (b *Broker) GetBinding(ctx context.Context, instanceID, bindingID string, bindingsDetails domain.FetchBindingDetails) (domain.GetBindingSpec, error)

func (*Broker) GetInstance

func (b *Broker) GetInstance(ctx context.Context, instanceID string, instanceDetails domain.FetchInstanceDetails) (domain.GetInstanceDetailsSpec, error)

func (*Broker) GetServiceInstanceClient

func (b *Broker) GetServiceInstanceClient(instanceID string, contextMap map[string]interface{}) (map[string]string, error)

func (*Broker) Instances

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

func (*Broker) LastBindingOperation

func (b *Broker) LastBindingOperation(ctx context.Context, instanceID, bindingID string, details domain.PollDetails) (domain.LastOperation, error)

func (*Broker) LastOperation

func (b *Broker) LastOperation(
	ctx context.Context,
	instanceID string,
	pollDetails domain.PollDetails,
) (domain.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 domain.ProvisionDetails,
	asyncAllowed bool) (domain.ProvisionedServiceSpec, error)

func (*Broker) Recreate

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

func (*Broker) Services

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

func (*Broker) SetUAAClient

func (b *Broker) SetUAAClient(uaaClient UAAClient)

func (*Broker) Unbind

func (b *Broker) Unbind(
	ctx context.Context,
	instanceID,
	bindingID string,
	details domain.UnbindDetails,
	asyncAllowed bool,
) (domain.UnbindSpec, error)

func (*Broker) Update

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

func (*Broker) UpdateServiceInstanceClient

func (b *Broker) UpdateServiceInstanceClient(instanceID, dashboardURL string, siClient map[string]string, contextMap map[string]interface{}, logger *log.Logger) error

func (*Broker) Upgrade

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

type BrokerError

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)
	GetServiceInstances(filter cf.GetInstancesFilter, logger *log.Logger) ([]cf.Instance, error)
}

type Decider

type Decider interface {
	DecideOperation(catalog []domain.Service, details domain.UpdateDetails, logger *log.Logger) (decider.Operation, error)
	CanProvision(catalog []domain.Service, planID string, maintenanceInfo *domain.MaintenanceInfo, logger *log.Logger) error
}

type Deployer

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

type DeploymentNotFoundError

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

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

func (e DisplayableError) ExtendedCFError() error

type Errand

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

type Hasher

type Hasher interface {
	Hash(m map[string]string) string
}

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 ManifestSecret

type ManifestSecret struct {
	Name  string
	Path  string
	Value interface{}
}

type ManifestSecretManager

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

type OperationAlreadyCompletedError

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

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 PendingChangesNotAppliedError

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

type PlanNotFoundError

type PlanNotFoundError struct {
	PlanGUID string
}

func (PlanNotFoundError) Error

func (e PlanNotFoundError) Error() string

type PostDeployErrand

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

type PreDeleteErrand

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{}, secretsMap map[string]string, dnsAddresses map[string]string, logger *log.Logger) error
	GenerateDashboardUrl(instanceID string, plan serviceadapter.Plan, manifest []byte, logger *log.Logger) (string, error)
	GeneratePlanSchema(plan serviceadapter.Plan, logger *log.Logger) (domain.ServiceSchemas, error)
}

type ServiceError

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

type StartupChecker

type StartupChecker interface {
	Check() error
}

type TaskInProgressError

type TaskInProgressError struct {
	Message string
}

func (TaskInProgressError) Error

func (e TaskInProgressError) Error() string

type TelemetryLogger

type TelemetryLogger interface {
	LogInstances(instanceLister service.InstanceLister, item string, operation string)
}

type UAAClient

type UAAClient interface {
	HasClientDefinition() bool
	CreateClient(id, name, spaceGUID string) (map[string]string, error)
	UpdateClient(id, redirectURI, spaceGUID string) (map[string]string, error)
	DeleteClient(id string) error
	GetClient(id string) (map[string]string, error)
}

type Validator

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

func NewValidator

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

func (*Validator) ValidateParams

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

func (*Validator) ValidateSchema

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