Documentation ¶
Index ¶
- Constants
- Variables
- func AddServicePlanToContext(ctx context.Context, plan *ServicePlan) context.Context
- func AddServiceToContext(ctx context.Context, service *Service) context.Context
- func AttachRoutes(router *mux.Router, serviceBroker ServiceBroker, logger lager.Logger)
- func BindableValue(v bool) *bool
- func FreeValue(v bool) *bool
- func GetJsonNames(s reflect.Value) (res []string)
- func New(serviceBroker ServiceBroker, logger lager.Logger, ...) http.Handler
- type AsyncBindResponse
- type BindDetails
- type BindResource
- type Binding
- type BindingResponse
- type BrokerCredentials
- type CatalogResponse
- type DeprovisionDetails
- type DeprovisionResponse
- type DeprovisionServiceSpec
- type DetailsWithRawContext
- type DetailsWithRawParameters
- type EmptyResponse
- type ErrorResponse
- type ExperimentalVolumeMount
- type ExperimentalVolumeMountBindingResponse
- type ExperimentalVolumeMountPrivate
- type FailureResponse
- type FailureResponseBuilder
- type GetBindingResponse
- type GetBindingSpec
- type GetInstanceDetailsSpec
- type GetInstanceResponse
- type LastOperation
- type LastOperationResponse
- type LastOperationState
- type MaintenanceInfo
- type PollDetails
- type PreviousValues
- type ProvisionDetails
- type ProvisionedServiceSpec
- type ProvisioningResponse
- type RequiredPermission
- type Schema
- type Service
- type ServiceBindingSchema
- type ServiceBroker
- type ServiceDashboardClient
- type ServiceInstanceSchema
- type ServiceMetadata
- type ServicePlan
- type ServicePlanCost
- type ServicePlanMetadata
- type ServiceSchemas
- type SharedDevice
- type UnbindDetails
- type UnbindResponse
- type UnbindSpec
- type UpdateDetails
- type UpdateResponse
- type UpdateServiceSpec
- type VolumeMount
Constants ¶
const ( PermissionRouteForwarding = RequiredPermission("route_forwarding") PermissionSyslogDrain = RequiredPermission("syslog_drain") PermissionVolumeMount = RequiredPermission("volume_mount") )
Variables ¶
var ( ErrInstanceAlreadyExists = NewFailureResponseBuilder( errors.New(instanceExistsMsg), http.StatusConflict, instanceAlreadyExistsErrorKey, ).WithEmptyResponse().Build() ErrInstanceDoesNotExist = NewFailureResponseBuilder( errors.New(instanceDoesntExistMsg), http.StatusGone, instanceMissingErrorKey, ).WithEmptyResponse().Build() ErrInstanceLimitMet = NewFailureResponse( errors.New(serviceLimitReachedMsg), http.StatusInternalServerError, instanceLimitReachedErrorKey, ) ErrBindingAlreadyExists = NewFailureResponse( errors.New(bindingExistsMsg), http.StatusConflict, bindingAlreadyExistsErrorKey, ) ErrBindingDoesNotExist = NewFailureResponseBuilder( errors.New(bindingDoesntExistMsg), http.StatusGone, bindingMissingErrorKey, ).WithEmptyResponse().Build() ErrBindingNotFound = NewFailureResponseBuilder( errors.New(bindingNotFoundMsg), http.StatusNotFound, bindingNotFoundErrorKey, ).WithEmptyResponse().Build() ErrAsyncRequired = NewFailureResponseBuilder( errors.New(asyncRequiredMsg), http.StatusUnprocessableEntity, asyncRequiredKey, ).WithErrorKey("AsyncRequired").Build() ErrPlanChangeNotSupported = NewFailureResponseBuilder( errors.New(planChangeUnsupportedMsg), http.StatusUnprocessableEntity, planChangeNotSupportedKey, ).WithErrorKey("PlanChangeNotSupported").Build() ErrRawParamsInvalid = NewFailureResponse( errors.New(rawInvalidParamsMsg), http.StatusUnprocessableEntity, invalidRawParamsKey, ) ErrAppGuidNotProvided = NewFailureResponse( errors.New(appGuidMissingMsg), http.StatusUnprocessableEntity, appGuidNotProvidedErrorKey, ) ErrPlanQuotaExceeded = errors.New(servicePlanQuotaExceededMsg) ErrServiceQuotaExceeded = errors.New(serviceQuotaExceededMsg) ErrConcurrentInstanceAccess = NewFailureResponseBuilder( errors.New(concurrentInstanceAccessMsg), http.StatusUnprocessableEntity, concurrentAccessKey, ).WithErrorKey("ConcurrencyError") ErrMaintenanceInfoConflict = NewFailureResponseBuilder( errors.New(maintenanceInfoConflictMsg), http.StatusUnprocessableEntity, maintenanceInfoConflictKey, ).WithErrorKey("MaintenanceInfoConflict").Build() ErrMaintenanceInfoNilConflict = NewFailureResponseBuilder( errors.New(maintenanceInfoNilConflictMsg), http.StatusUnprocessableEntity, maintenanceInfoConflictKey, ).WithErrorKey("MaintenanceInfoConflict").Build() )
Functions ¶
func AddServicePlanToContext ¶
func AddServicePlanToContext(ctx context.Context, plan *ServicePlan) context.Context
func AddServiceToContext ¶
func AttachRoutes ¶
func AttachRoutes(router *mux.Router, serviceBroker ServiceBroker, logger lager.Logger)
func BindableValue ¶
func GetJsonNames ¶
func New ¶
func New(serviceBroker ServiceBroker, logger lager.Logger, brokerCredentials BrokerCredentials) http.Handler
Types ¶
type AsyncBindResponse ¶
type AsyncBindResponse struct {
OperationData string `json:"operation,omitempty"`
}
type BindDetails ¶
type BindDetails struct { AppGUID string `json:"app_guid"` PlanID string `json:"plan_id"` ServiceID string `json:"service_id"` BindResource *BindResource `json:"bind_resource,omitempty"` RawContext json.RawMessage `json:"context,omitempty"` RawParameters json.RawMessage `json:"parameters,omitempty"` }
func (BindDetails) GetRawContext ¶
func (d BindDetails) GetRawContext() json.RawMessage
func (BindDetails) GetRawParameters ¶
func (d BindDetails) GetRawParameters() json.RawMessage
type BindResource ¶
type Binding ¶
type Binding struct { IsAsync bool `json:"is_async"` OperationData string `json:"operation_data"` Credentials interface{} `json:"credentials"` SyslogDrainURL string `json:"syslog_drain_url"` RouteServiceURL string `json:"route_service_url"` VolumeMounts []VolumeMount `json:"volume_mounts"` }
type BindingResponse ¶
type BindingResponse struct { Credentials interface{} `json:"credentials"` SyslogDrainURL string `json:"syslog_drain_url,omitempty"` RouteServiceURL string `json:"route_service_url,omitempty"` VolumeMounts []VolumeMount `json:"volume_mounts,omitempty"` }
type BrokerCredentials ¶
type CatalogResponse ¶
type CatalogResponse struct {
Services []Service `json:"services"`
}
type DeprovisionDetails ¶
type DeprovisionResponse ¶
type DeprovisionResponse struct {
OperationData string `json:"operation,omitempty"`
}
type DeprovisionServiceSpec ¶
type DetailsWithRawContext ¶
type DetailsWithRawContext interface {
GetRawContext() json.RawMessage
}
type DetailsWithRawParameters ¶
type DetailsWithRawParameters interface {
GetRawParameters() json.RawMessage
}
type EmptyResponse ¶
type EmptyResponse struct{}
type ErrorResponse ¶
type ExperimentalVolumeMount ¶
type ExperimentalVolumeMount struct { ContainerPath string `json:"container_path"` Mode string `json:"mode"` Private ExperimentalVolumeMountPrivate `json:"private"` }
type ExperimentalVolumeMountBindingResponse ¶
type ExperimentalVolumeMountBindingResponse struct { Credentials interface{} `json:"credentials"` SyslogDrainURL string `json:"syslog_drain_url,omitempty"` RouteServiceURL string `json:"route_service_url,omitempty"` VolumeMounts []ExperimentalVolumeMount `json:"volume_mounts,omitempty"` }
type FailureResponse ¶
type FailureResponse struct {
// contains filtered or unexported fields
}
FailureResponse can be returned from any of the `ServiceBroker` interface methods which allow an error to be returned. Doing so will provide greater control over the HTTP response.
func NewFailureResponse ¶
func NewFailureResponse(err error, statusCode int, loggerAction string) *FailureResponse
NewFailureResponse returns a pointer to a new instance of FailureResponse. err will by default be used as both a logging message and HTTP response description. statusCode is the HTTP status code to be returned, must be 4xx or 5xx loggerAction is a short description which will be used as the action if the error is logged.
func (*FailureResponse) AppendErrorMessage ¶
func (f *FailureResponse) AppendErrorMessage(msg string) *FailureResponse
AppendErrorMessage returns an error with the message updated. All other properties are preserved.
func (*FailureResponse) ErrorResponse ¶
func (f *FailureResponse) ErrorResponse() interface{}
ErrorResponse returns an interface{} which will be JSON encoded and form the body of the HTTP response
func (*FailureResponse) LoggerAction ¶
func (f *FailureResponse) LoggerAction() string
LoggerAction returns the loggerAction, used as the action when logging
func (*FailureResponse) ValidatedStatusCode ¶
func (f *FailureResponse) ValidatedStatusCode(logger lager.Logger) int
ValidatedStatusCode returns the HTTP response status code. If the code is not 4xx or 5xx, an InternalServerError will be returned instead.
type FailureResponseBuilder ¶
type FailureResponseBuilder struct {
// contains filtered or unexported fields
}
FailureResponseBuilder provides a fluent set of methods to build a *FailureResponse.
func NewFailureResponseBuilder ¶
func NewFailureResponseBuilder(err error, statusCode int, loggerAction string) *FailureResponseBuilder
NewFailureResponseBuilder returns a pointer to a newly instantiated FailureResponseBuilder Accepts required arguments to create a FailureResponse.
func (*FailureResponseBuilder) Build ¶
func (f *FailureResponseBuilder) Build() *FailureResponse
Build returns the generated FailureResponse built using previously configured variables.
func (*FailureResponseBuilder) WithEmptyResponse ¶
func (f *FailureResponseBuilder) WithEmptyResponse() *FailureResponseBuilder
WithEmptyResponse will cause the built FailureResponse to return an empty JSON object as the HTTP response body
func (*FailureResponseBuilder) WithErrorKey ¶
func (f *FailureResponseBuilder) WithErrorKey(errorKey string) *FailureResponseBuilder
WithErrorKey adds a custom ErrorKey which will be used in FailureResponse to add an `Error` field to the JSON HTTP response body
type GetBindingResponse ¶
type GetBindingResponse struct { BindingResponse Parameters interface{} `json:"parameters,omitempty"` }
type GetBindingSpec ¶
type GetBindingSpec struct { Credentials interface{} SyslogDrainURL string RouteServiceURL string VolumeMounts []VolumeMount Parameters interface{} }
type GetInstanceDetailsSpec ¶
type GetInstanceResponse ¶
type LastOperation ¶
type LastOperation struct { State LastOperationState Description string }
type LastOperationResponse ¶
type LastOperationResponse struct { State LastOperationState `json:"state"` Description string `json:"description,omitempty"` }
type LastOperationState ¶
type LastOperationState string
const ( InProgress LastOperationState = "in progress" Succeeded LastOperationState = "succeeded" Failed LastOperationState = "failed" )
type MaintenanceInfo ¶
type PollDetails ¶
type PreviousValues ¶
type ProvisionDetails ¶
type ProvisionDetails struct { ServiceID string `json:"service_id"` PlanID string `json:"plan_id"` OrganizationGUID string `json:"organization_guid"` SpaceGUID string `json:"space_guid"` RawContext json.RawMessage `json:"context,omitempty"` RawParameters json.RawMessage `json:"parameters,omitempty"` MaintenanceInfo MaintenanceInfo `json:"maintenance_info,omitempty"` }
func (ProvisionDetails) GetRawContext ¶
func (d ProvisionDetails) GetRawContext() json.RawMessage
func (ProvisionDetails) GetRawParameters ¶
func (d ProvisionDetails) GetRawParameters() json.RawMessage
type ProvisionedServiceSpec ¶
type ProvisioningResponse ¶
type RequiredPermission ¶
type RequiredPermission string
type Service ¶
type Service struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Bindable bool `json:"bindable"` InstancesRetrievable bool `json:"instances_retrievable,omitempty"` BindingsRetrievable bool `json:"bindings_retrievable,omitempty"` Tags []string `json:"tags,omitempty"` PlanUpdatable bool `json:"plan_updateable"` Plans []ServicePlan `json:"plans"` Requires []RequiredPermission `json:"requires,omitempty"` Metadata *ServiceMetadata `json:"metadata,omitempty"` DashboardClient *ServiceDashboardClient `json:"dashboard_client,omitempty"` }
type ServiceBindingSchema ¶
type ServiceBindingSchema struct {
Create Schema `json:"create,omitempty"`
}
type ServiceBroker ¶
type ServiceBroker interface { // Services gets the catalog of services offered by the service broker // GET /v2/catalog Services(ctx context.Context) ([]Service, error) // Provision creates a new service instance // PUT /v2/service_instances/{instance_id} Provision(ctx context.Context, instanceID string, details ProvisionDetails, asyncAllowed bool) (ProvisionedServiceSpec, error) // Deprovision deletes an existing service instance // DELETE /v2/service_instances/{instance_id} Deprovision(ctx context.Context, instanceID string, details DeprovisionDetails, asyncAllowed bool) (DeprovisionServiceSpec, error) // GetInstance fetches information about a service instance // GET /v2/service_instances/{instance_id} GetInstance(ctx context.Context, instanceID string) (GetInstanceDetailsSpec, error) // Update modifies an existing service instance // PATCH /v2/service_instances/{instance_id} Update(ctx context.Context, instanceID string, details UpdateDetails, asyncAllowed bool) (UpdateServiceSpec, error) // LastOperation fetches last operation state for a service instance // GET /v2/service_instances/{instance_id}/last_operation LastOperation(ctx context.Context, instanceID string, details PollDetails) (LastOperation, error) // Bind creates a new service binding // PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id} Bind(ctx context.Context, instanceID, bindingID string, details BindDetails, asyncAllowed bool) (Binding, error) // Unbind deletes an existing service binding // DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id} Unbind(ctx context.Context, instanceID, bindingID string, details UnbindDetails, asyncAllowed bool) (UnbindSpec, error) // GetBinding fetches an existing service binding // GET /v2/service_instances/{instance_id}/service_bindings/{binding_id} GetBinding(ctx context.Context, instanceID, bindingID string) (GetBindingSpec, error) // LastBindingOperation fetches last operation state for a service binding // GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation LastBindingOperation(ctx context.Context, instanceID, bindingID string, details PollDetails) (LastOperation, error) }
Each method of the ServiceBroker interface maps to an individual endpoint of the Open Service Broker API.
The specification is available here: https://github.com/openservicebrokerapi/servicebroker/blob/v2.14/spec.md
The OpenAPI documentation is available here: http://petstore.swagger.io/?url=https://raw.githubusercontent.com/openservicebrokerapi/servicebroker/v2.14/openapi.yaml
type ServiceDashboardClient ¶
type ServiceInstanceSchema ¶
type ServiceMetadata ¶
type ServiceMetadata struct { DisplayName string `json:"displayName,omitempty"` ImageUrl string `json:"imageUrl,omitempty"` LongDescription string `json:"longDescription,omitempty"` ProviderDisplayName string `json:"providerDisplayName,omitempty"` DocumentationUrl string `json:"documentationUrl,omitempty"` SupportUrl string `json:"supportUrl,omitempty"` AdditionalMetadata map[string]interface{} }
func (ServiceMetadata) MarshalJSON ¶
func (sm ServiceMetadata) MarshalJSON() ([]byte, error)
func (*ServiceMetadata) UnmarshalJSON ¶
func (sm *ServiceMetadata) UnmarshalJSON(data []byte) error
type ServicePlan ¶
type ServicePlan struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Free *bool `json:"free,omitempty"` Bindable *bool `json:"bindable,omitempty"` Metadata *ServicePlanMetadata `json:"metadata,omitempty"` Schemas *ServiceSchemas `json:"schemas,omitempty"` MaintenanceInfo *MaintenanceInfo `json:"maintenance_info,omitempty"` }
func RetrieveServicePlanFromContext ¶
func RetrieveServicePlanFromContext(ctx context.Context) *ServicePlan
type ServicePlanCost ¶
type ServicePlanMetadata ¶
type ServicePlanMetadata struct { DisplayName string `json:"displayName,omitempty"` Bullets []string `json:"bullets,omitempty"` Costs []ServicePlanCost `json:"costs,omitempty"` AdditionalMetadata map[string]interface{} }
func (ServicePlanMetadata) MarshalJSON ¶
func (spm ServicePlanMetadata) MarshalJSON() ([]byte, error)
func (*ServicePlanMetadata) UnmarshalJSON ¶
func (spm *ServicePlanMetadata) UnmarshalJSON(data []byte) error
type ServiceSchemas ¶
type ServiceSchemas struct { Instance ServiceInstanceSchema `json:"service_instance,omitempty"` Binding ServiceBindingSchema `json:"service_binding,omitempty"` }
type SharedDevice ¶
type SharedDevice struct {}
type UnbindDetails ¶
type UnbindResponse ¶
type UnbindResponse struct {
OperationData string `json:"operation,omitempty"`
}
type UnbindSpec ¶
type UpdateDetails ¶
type UpdateDetails struct { ServiceID string `json:"service_id"` PlanID string `json:"plan_id"` RawParameters json.RawMessage `json:"parameters,omitempty"` PreviousValues PreviousValues `json:"previous_values"` RawContext json.RawMessage `json:"context,omitempty"` MaintenanceInfo MaintenanceInfo `json:"maintenance_info,omitempty"` }
func (UpdateDetails) GetRawParameters ¶
func (d UpdateDetails) GetRawParameters() json.RawMessage
type UpdateResponse ¶
type UpdateServiceSpec ¶
type VolumeMount ¶
type VolumeMount struct { Driver string `json:"driver"` ContainerDir string `json:"container_dir"` Mode string `json:"mode"` DeviceType string `json:"device_type"` Device SharedDevice `json:"device"` }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
middlewares
|
|