server

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertCatalog

func ConvertCatalog(cat *pkgbrokerapi.Catalog) []pivbrokerapi.Service

ConvertCatalog converts a (github.com/kubernetes-incubator/service-catalog/contrib/pkg/brokerapi).Catalog to an array of brokerapi.Services

func NewCreateFunc

func NewCreateFunc(srv *httptest.Server, user, pass string) brokerapi.CreateFunc

NewCreateFunc creates a new brokerapi.CreateFunc according to a broker server running in srv

func Run

func Run(hdl *Handler, username, password string) *httptest.Server

Run runs a new test server from the given broker handler and auth credentials

Types

type BindRequest

type BindRequest struct {
	InstanceID string
	BindingID  string
	Details    brokerapi.BindDetails
}

BindRequest is the struct to contain details of a bind request

type DeprovisionRequest

type DeprovisionRequest struct {
	InstanceID string
	Details    brokerapi.DeprovisionDetails
}

DeprovisionRequest is the struct to contain details of a single deprovision request

type Handler

type Handler struct {
	Catalog []brokerapi.Service
	// Since there are no data passed to catalog calls, this is just the number of calls
	// that were made to the catalog endpoint
	CatalogRequests int

	ProvisionResp      brokerapi.ProvisionedServiceSpec
	ProvisionRespError error
	ProvisionRequests  []ProvisionRequest

	DeprovisionResp     brokerapi.DeprovisionServiceSpec
	DeprovisonRespErr   error
	DeprovisionRequests []DeprovisionRequest

	BindResp     brokerapi.Binding
	BindRespErr  error
	BindRequests []BindRequest

	UnbindRespErr  error
	UnbindRequests []UnbindRequest

	UpdateResp     brokerapi.UpdateServiceSpec
	UpdateRespErr  error
	UpdateRequests []UpdateRequest

	LastOperationResp     brokerapi.LastOperation
	LastOperationRespErr  error
	LastOperationRequests []LastOperationRequest
}

Handler is a fake implementation oif a brokerapi.ServiceBroker. It's useful as a mock because it has pre-canned response values for use in testing, and also keeps track of calls made to it. Handler is not concurrency-safe

func NewHandler

func NewHandler() *Handler

NewHandler creates a new fake server handler

func (*Handler) Bind

func (h *Handler) Bind(context context.Context, instanceID, bindingID string, details brokerapi.BindDetails) (brokerapi.Binding, error)

Bind adds an element to h.BindRequqests and returns h.BindResp, h.BindRespErr

func (*Handler) Deprovision

func (h *Handler) Deprovision(context context.Context, instanceID string, details brokerapi.DeprovisionDetails, asyncAllowed bool) (brokerapi.DeprovisionServiceSpec, error)

Deprovision adds an element to h.DeprovisionRequests and returns h.DeprovisionResp, h.DeprovisionRespErr

func (*Handler) LastOperation

func (h *Handler) LastOperation(context context.Context, instanceID, operationData string) (brokerapi.LastOperation, error)

LastOperation adds an element to h.LastOperationRequests and returns h.LastOperationResp, h.LastOperationRespErr

func (*Handler) Provision

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

Provision adds an element to h.ProvisionRequests and returns h.ProvisionResp, h.ProvisionRespError

func (*Handler) Services

func (h *Handler) Services(ctx context.Context) []brokerapi.Service

Services increments h.CatalogRequests and returns h.Catalog

func (*Handler) Unbind

func (h *Handler) Unbind(context context.Context, instanceID, bindingID string, details brokerapi.UnbindDetails) error

Unbind adds an element to h.UnbindRequests and returns h.UnbindRespErr

func (*Handler) Update

func (h *Handler) Update(context context.Context, instanceID string, details brokerapi.UpdateDetails, asyncAllowed bool) (brokerapi.UpdateServiceSpec, error)

Update adds an element to h.UpdateRequests and returns h.UpdateResp, h.UpdateRespErr

type LastOperationRequest

type LastOperationRequest struct {
	InstanceID    string
	OperationData string
}

LastOperationRequest is the struct that contains details of a single request to get the last operation of an ongoing broker action

type ProvisionRequest

type ProvisionRequest struct {
	InstanceID   string
	Details      brokerapi.ProvisionDetails
	AsyncAllowed bool
}

ProvisionRequest is the struct to house details of a single provision request

type UnbindRequest

type UnbindRequest struct {
	InstanceID string
	BindingID  string
	Details    brokerapi.UnbindDetails
}

UnbindRequest is the struct to house details of a single unbind request

type UpdateRequest

type UpdateRequest struct {
	InstanceID   string
	Details      brokerapi.UpdateDetails
	AsyncAllowed bool
}

UpdateRequest is the struct that contains details of a single update request

Jump to

Keyboard shortcuts

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