broker

package
v0.0.0-...-91a9a81 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LivenessApplicationSampleName = "informer.liveness.probe.application.name"
	LivenessServiceSampleID       = "informer.liveness.probe.service.id"
)

Variables

This section is empty.

Functions

func IsForbiddenError

func IsForbiddenError(err error) bool

IsForbiddenError checks if error represent Forbidden one.

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError check if error is NotFound one.

Types

type BindParametersDTO

type BindParametersDTO struct {
	ServiceID string                 `json:"service_id"`
	PlanID    string                 `json:"plan_id"`
	Context   map[string]interface{} `json:"context,omitempty"`
}

BindParametersDTO contains parameters sent by Service Catalog in the body of bind request.

func (*BindParametersDTO) Validate

func (params *BindParametersDTO) Validate() error

Validate checks if bind parameters aren't empty

type BindSuccessResponseDTO

type BindSuccessResponseDTO struct {
	// Credentials is a free-form hash of credentials that can be used by
	// applications or users to access the service.
	Credentials map[string]interface{} `json:"credentials,omitempty"`
}

BindSuccessResponseDTO represents response with credentials for service instance after successful binding

type BindingCredentialsRenderer

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

BindingCredentialsRenderer provides functionality for rendering binding information

func NewBindingCredentialsRenderer

func NewBindingCredentialsRenderer(APIPackageCredGetter apiPackageCredentialsGetter, gatewayBaseURLFormat string, fetcher ServiceBindingFetcher) *BindingCredentialsRenderer

NewBindingCredentialsRenderer returns new instance of BindingCredentialsRenderer

func (*BindingCredentialsRenderer) GetBindingCredentialsV1

func (b *BindingCredentialsRenderer) GetBindingCredentialsV1(_ context.Context, _ string, service internal.Service, _, _, _ string) (map[string]interface{}, error)

Deprecated, remove in https://github.com/kyma-project/kyma/issues/7415 in old approach if it is bindable then it has only one API entry

func (*BindingCredentialsRenderer) GetBindingCredentialsV2

func (b *BindingCredentialsRenderer) GetBindingCredentialsV2(ctx context.Context, ns string, service internal.Service, bindingID, appID, instanceID string) (map[string]interface{}, error)

GetBindingCredentialsV2 returns binding information with API Package credential

type DeprovisionProcessRequest

type DeprovisionProcessRequest struct {
	Instance             *internal.Instance
	OperationID          internal.OperationID
	ApplicationServiceID internal.ApplicationServiceID
}

type DeprovisionService

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

DeprovisionService performs deprovision action

func NewDeprovisioner

func NewDeprovisioner(
	instStorage instanceStorage,
	instanceStateGetter instanceStateGetter,
	operationInserter operationInserter,
	operationUpdater operationUpdater,
	opIDProvider func() (internal.OperationID, error),
	appSvcFinder appSvcFinder,
	eaClient v1client.ApplicationconnectorV1alpha1Interface,
	log logrus.FieldLogger,
	selector appSvcIDSelector,
	apiPkgCredsRemover apiPackageCredentialsRemover) *DeprovisionService

NewDeprovisioner creates new Deprovisioner

func (*DeprovisionService) Deprovision

func (svc *DeprovisionService) Deprovision(ctx context.Context, osbCtx osbContext, req *osb.DeprovisionRequest) (*osb.DeprovisionResponse, error)

Deprovision action

func (*DeprovisionService) DeprovisionReprocess

func (svc *DeprovisionService) DeprovisionReprocess(req DeprovisionProcessRequest)

type DeprovisionSuccessResponseDTO

type DeprovisionSuccessResponseDTO struct {
	Operation *internal.OperationID `json:"operation,omitempty"`
}

DeprovisionSuccessResponseDTO represents response after successful deprovisioning

type DirectorService

type DirectorService interface {
	// contains filtered or unexported methods
}

type ForbiddenError

type ForbiddenError struct {
}

ForbiddenError represents situation when operation is forbidden

func (*ForbiddenError) Error

func (fe *ForbiddenError) Error() string

func (*ForbiddenError) Forbidden

func (fe *ForbiddenError) Forbidden() bool

Forbidden is a marker method, used in IsForbiddenError method

type IDSelector

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

func NewIDSelector

func NewIDSelector(apiPackagesSupport bool) *IDSelector

func (*IDSelector) SelectApplicationServiceID

func (s *IDSelector) SelectApplicationServiceID(serviceID, planID string) internal.ApplicationServiceID

func (*IDSelector) SelectID

func (s *IDSelector) SelectID(req interface{}) internal.ApplicationServiceID

type LastOperationSuccessResponseDTO

type LastOperationSuccessResponseDTO struct {
	State       internal.OperationState `json:"state"`
	Description *string                 `json:"description,omitempty"`
}

LastOperationSuccessResponseDTO represents info response about last successful operation

type LivenessCheckStatus

type LivenessCheckStatus struct {
	Succeeded bool
}

type NsBrokerService

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

NsBrokerService provides information about AB brokers

func NewNsBrokerService

func NewNsBrokerService() (*NsBrokerService, error)

NewNsBrokerService creates NsBrokerService from configuration

func (*NsBrokerService) GetNsFromBrokerURL

func (bf *NsBrokerService) GetNsFromBrokerURL(url string) (string, error)

GetNsFromBrokerURL extracts namespace from broker URL

func (*NsBrokerService) GetServiceNameForNsBroker

func (bf *NsBrokerService) GetServiceNameForNsBroker(ns string) string

GetServiceNameForNsBroker returns service name for namespaced broker

type OSBContextMiddleware

type OSBContextMiddleware struct {
}

OSBContextMiddleware implements Handler interface, creates an osbContext instance from HTTP data and stores in the request context.

func (*OSBContextMiddleware) ServeHTTP

ServeHTTP adds content of Open Service Broker Api headers to the requests

type ProvisionRequestDTO

type ProvisionRequestDTO struct {
	ServiceID        internal.ServiceID     `json:"service_id"`
	PlanID           internal.ServicePlanID `json:"plan_id"`
	OrganizationGUID string                 `json:"organization_guid"`
	SpaceGUID        string                 `json:"space_guid"`
	Parameters       map[string]interface{} `json:"parameters,omitempty"`
	Context          contextDTO             `json:"context,omitempty"`
}

ProvisionRequestDTO represents provision request

func (*ProvisionRequestDTO) Validate

func (params *ProvisionRequestDTO) Validate() error

Validate validates necessary provisioning parameters

type ProvisionService

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

ProvisionService performs provisioning action

func NewProvisioner

func NewProvisioner(instanceInserter instanceInserter, instanceStateGetter instanceStateGetter,
	operationInserter operationInserter, operationUpdater operationUpdater,
	accessChecker access.ProvisionChecker, appSvcFinder appSvcFinder,
	eaClient v1client.ApplicationconnectorV1alpha1Interface,
	istioClient securityclientv1beta1.SecurityV1beta1Interface, iStateUpdater instanceStateUpdater,
	operationIDProvider func() (internal.OperationID, error), log logrus.FieldLogger, selector appSvcIDSelector,
	apiPkgCredsCreator apiPackageCredentialsCreator,
	validateReq func(req *osb.ProvisionRequest) *osb.HTTPStatusCodeError) *ProvisionService

NewProvisioner creates provisioner

func (*ProvisionService) Provision

func (svc *ProvisionService) Provision(ctx context.Context, osbCtx osbContext, req *osb.ProvisionRequest) (*osb.ProvisionResponse, *osb.HTTPStatusCodeError)

Provision action

func (*ProvisionService) ProvisionReprocess

func (svc *ProvisionService) ProvisionReprocess(req RestoreProvisionRequest) error

ProvisionReprocess triggers provision process for other than broker (http) calls

type ProvisionSuccessResponseDTO

type ProvisionSuccessResponseDTO struct {
	DashboardURL *string               `json:"dashboard_url"`
	Operation    *internal.OperationID `json:"operation,omitempty"`
}

ProvisionSuccessResponseDTO represents response after successful provisioning

type RequireAsyncMiddleware

type RequireAsyncMiddleware struct{}

RequireAsyncMiddleware asserts if request allows for asynchronous response

func (RequireAsyncMiddleware) ServeHTTP

ServeHTTP handling asynchronous HTTP requests in Open Service Broker Api

type RestoreProvisionRequest

type RestoreProvisionRequest struct {
	Parameters           map[string]interface{}
	InstanceID           internal.InstanceID
	OperationID          internal.OperationID
	Namespace            internal.Namespace
	ApplicationServiceID internal.ApplicationServiceID
}

type SanityCheckService

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

SanityCheckService performs sanity check for Application Broker

func NewSanityChecker

func NewSanityChecker(mClient *mappingCli.Interface, log logrus.FieldLogger, livenessCheckStatus *LivenessCheckStatus) *SanityCheckService

NewSanityChecker creates sanity checker service

func (*SanityCheckService) SanityCheck

func (svc *SanityCheckService) SanityCheck() (int, error)

type Server

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

Server implements HTTP server used to serve OSB API for application broker.

func New

func New(applicationFinder appFinder,
	instStorage instanceStorage,
	opStorage operationStorage,
	accessChecker access.ProvisionChecker,
	eaClient v1alpha1.ApplicationconnectorV1alpha1Interface,
	emLister listers.ApplicationMappingLister,
	brokerService *NsBrokerService,
	mClient *mappingCli.Interface,
	istioClient *securityclientv1beta1.SecurityV1beta1Interface,
	log *logrus.Entry,
	livenessCheckStatus *LivenessCheckStatus,
	apiPackagesSupport bool,
	service director.ServiceConfig, directorProxyURL string,
	sbInformer cache.SharedIndexInformer, gatewayBaseURL string,
	idSelector appSvcIDSelector,
) *Server

New creates instance of broker server.

func (*Server) Addr

func (srv *Server) Addr() string

Addr returns address server is listening on. Its use is targeted for cases when address is not known, e.g. tests.

func (*Server) CreateHandler

func (srv *Server) CreateHandler() http.Handler

CreateHandler creates an http handler

func (*Server) DeprovisionProcess

func (srv *Server) DeprovisionProcess(request DeprovisionProcessRequest)

func (*Server) NewOperationID

func (srv *Server) NewOperationID() (internal.OperationID, error)

func (*Server) ProvisionProcess

func (srv *Server) ProvisionProcess(request RestoreProvisionRequest) error

func (*Server) Run

func (srv *Server) Run(ctx context.Context, addr string) error

Run is starting HTTP server

func (*Server) WithCatalogMiddleware

func (srv *Server) WithCatalogMiddleware(f http.HandlerFunc, async bool) http.Handler

type ServiceBindingFetcher

type ServiceBindingFetcher interface {
	GetServiceBindingSecretName(ns, externalID string) (string, error)
}

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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