broker

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package broker implements the github.com/pivotal-cf/brokerapi/domain.ServiceBroker interface

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidUserInput = apiresponses.NewFailureResponse(errors.New(invalidUserInputMsg), http.StatusBadRequest, "parsing-user-request")
)
View Source
var ErrNonUpdatableParameter = apiresponses.NewFailureResponse(errors.New("attempt to update parameter that may result in service instance re-creation and data loss"), http.StatusBadRequest, "prohibited")

Functions

This section is empty.

Types

type BrokerConfig

type BrokerConfig struct {
	Registry  broker.BrokerRegistry
	Credstore credstore.CredStore
}

func NewBrokerConfigFromEnv

func NewBrokerConfigFromEnv(logger lager.Logger) (*BrokerConfig, error)

type ServiceBroker

type ServiceBroker struct {
	Credstore credstore.CredStore

	Logger lager.Logger
	// contains filtered or unexported fields
}

ServiceBroker is a brokerapi.ServiceBroker that can be used to generate an OSB compatible service broker.

func New

func New(cfg *BrokerConfig, store Storage, logger lager.Logger) (*ServiceBroker, error)

New creates a ServiceBroker. Exactly one of ServiceBroker or error will be nil when returned.

func (*ServiceBroker) Bind

func (broker *ServiceBroker) Bind(ctx context.Context, instanceID, bindingID string, details domain.BindDetails, _ bool) (domain.Binding, error)

Bind creates an account with credentials to access an instance of a service. It is bound to the `PUT /v2/service_instances/:instance_id/service_bindings/:binding_id` endpoint and can be called using the `cf bind-service` command.

func (*ServiceBroker) Deprovision

func (broker *ServiceBroker) Deprovision(ctx context.Context, instanceID string, details domain.DeprovisionDetails, clientSupportsAsync bool) (domain.DeprovisionServiceSpec, error)

Deprovision destroys an existing instance of a service. It is bound to the `DELETE /v2/service_instances/:instance_id` endpoint and can be called using the `cf delete-service` command. If a deprovision is asynchronous, the returned DeprovisionServiceSpec will contain the operation ID for tracking its progress.

func (*ServiceBroker) GetBinding

func (broker *ServiceBroker) GetBinding(ctx context.Context, instanceID, bindingID string, _ domain.FetchBindingDetails) (domain.GetBindingSpec, error)

GetBinding fetches an existing service binding. GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}

NOTE: This functionality is not implemented.

func (*ServiceBroker) GetInstance

GetInstance fetches information about a service instance GET /v2/service_instances/{instance_id}

NOTE: This functionality is not implemented.

func (*ServiceBroker) LastBindingOperation

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

LastBindingOperation fetches last operation state for a service binding. GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation

NOTE: This functionality is not implemented.

func (*ServiceBroker) LastOperation

func (broker *ServiceBroker) LastOperation(ctx context.Context, instanceID string, details domain.PollDetails) (domain.LastOperation, error)

LastOperation fetches last operation state for a service instance. It is bound to the `GET /v2/service_instances/:instance_id/last_operation` endpoint. It is called by `cf create-service` or `cf delete-service` if the operation was asynchronous.

func (*ServiceBroker) Provision

func (broker *ServiceBroker) Provision(ctx context.Context, instanceID string, details domain.ProvisionDetails, clientSupportsAsync bool) (domain.ProvisionedServiceSpec, error)

Provision creates a new instance of a service. It is bound to the `PUT /v2/service_instances/:instance_id` endpoint and can be called using the `cf create-service` command.

func (*ServiceBroker) Services

func (broker *ServiceBroker) Services(_ context.Context) ([]domain.Service, error)

Services lists services in the broker's catalog. It is called through the `GET /v2/catalog` endpoint or the `cf marketplace` command.

func (*ServiceBroker) Unbind

func (broker *ServiceBroker) Unbind(ctx context.Context, instanceID, bindingID string, details domain.UnbindDetails, _ bool) (domain.UnbindSpec, error)

Unbind destroys an account and credentials with access to an instance of a service. It is bound to the `DELETE /v2/service_instances/:instance_id/service_bindings/:binding_id` endpoint and can be called using the `cf unbind-service` command.

func (*ServiceBroker) Update

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

Update a service instance plan. This functionality is not implemented and will return an error indicating that plan changes are not supported.

type Storage

type Storage interface {
	broker.ServiceProviderStorage

	CreateServiceBindingCredentials(binding storage.ServiceBindingCredentials) error
	GetServiceBindingCredentials(bindingID, serviceInstanceID string) (storage.ServiceBindingCredentials, error)
	ExistsServiceBindingCredentials(bindingID, serviceInstanceID string) (bool, error)
	DeleteServiceBindingCredentials(bindingID, serviceInstanceID string) error
	StoreBindRequestDetails(bindRequestDetails storage.BindRequestDetails) error
	GetBindRequestDetails(bindingID, instanceID string) (storage.JSONObject, error)
	DeleteBindRequestDetails(bindingID, instanceID string) error
	StoreProvisionRequestDetails(serviceInstanceID string, details storage.JSONObject) error
	GetProvisionRequestDetails(serviceInstanceID string) (storage.JSONObject, error)
	DeleteProvisionRequestDetails(serviceInstanceID string) error
	StoreServiceInstanceDetails(d storage.ServiceInstanceDetails) error
	GetServiceInstanceDetails(guid string) (storage.ServiceInstanceDetails, error)
	ExistsServiceInstanceDetails(guid string) (bool, error)
	DeleteServiceInstanceDetails(guid string) error
}

type TFDeploymentGUID added in v0.11.0

type TFDeploymentGUID string

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
Package decider works out whether a service instance update is an Upgrade or and Update
Package decider works out whether a service instance update is an Upgrade or and Update

Jump to

Keyboard shortcuts

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