service

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InstanceStateProvisioningDeferred represents the state where service
	// instance provisioning has been requested and deferred pending the
	// completion of some other action
	InstanceStateProvisioningDeferred = "PROVISIONING_DEFERRED"
	// InstanceStateProvisioning represents the state where service instance
	// provisioning is in progress
	InstanceStateProvisioning = "PROVISIONING"
	// InstanceStateProvisioned represents the state where service instance
	// provisioning has completed successfully
	InstanceStateProvisioned = "PROVISIONED"
	// InstanceStateProvisioningFailed represents the state where service instance
	// provisioning has failed
	InstanceStateProvisioningFailed = "PROVISIONING_FAILED"
	// InstanceStateUpdating represents the state where service instance
	// updating is in progress
	InstanceStateUpdating = "UPDATING"
	// InstanceStateUpdatingFailed represents the state where service instance
	// updating has failed
	InstanceStateUpdatingFailed = "UPDATING_FAILED"
	// InstanceStateDeprovisioningDeferred represents the state where service
	// instance deprovisioning has been requested and deferred pending the
	// completion of some other action
	InstanceStateDeprovisioningDeferred = "DEPROVISIONING_DEFERRED"
	// InstanceStateDeprovisioning represents the state where service instance
	// deprovisioning is in progress
	InstanceStateDeprovisioning = "DEPROVISIONING"
	// InstanceStateDeprovisioningFailed represents the state where service
	// instance deprovisioning has failed
	InstanceStateDeprovisioningFailed = "DEPROVISIONING_FAILED"
	// BindingStateBound represents the state where service binding has completed
	// successfully
	BindingStateBound = "BOUND"
	// BindingStateBindingFailed represents the state where service binding has
	// failed
	BindingStateBindingFailed = "BINDING_FAILED"
	// BindingStateUnbindingFailed represents the state where service unbinding
	// has failed
	BindingStateUnbindingFailed = "UNBINDING_FAILED"
)
View Source
const (
	// MigrationTag is the tag of migration services. It can be used for tag
	// filter to filter out migration services.
	MigrationTag string = "Migration"
	// DRTag is the tag of DR services. It can be used for tag filter to
	// filter out DR services.
	DRTag string = "Disaster Recovery"
)

Variables

This section is empty.

Functions

func GetMapFromStruct added in v0.10.0

func GetMapFromStruct(s interface{}) (map[string]interface{}, error)

GetMapFromStruct is a utility function that extracts values from the provided struct into a map[string]interface{}. Maps form the input and output to all ServiceManager functions. This utility function offers ServiceManager implementors the option of working with firendlier, service-specific structs then easily extracting information from those structs into maps.

func GetStructFromMap added in v0.10.0

func GetStructFromMap(m map[string]interface{}, s interface{}) error

GetStructFromMap is a utility function that extracts values from a map[string]interface{} to the provided struct. Maps form the input and output to all ServiceManager functions. This utility function offers ServiceManager implementors the option of working with firendlier, service-specific structs by easily extracting information from maps into thos structs.

Types

type ArrayPropertySchema added in v0.12.0

type ArrayPropertySchema struct {
	Title                   string                       `json:"title,omitempty"`       // nolint: lll
	Description             string                       `json:"description,omitempty"` // nolint: lll
	MinItems                *int                         `json:"minItems,omitempty"`    // nolint: lll
	MaxItems                *int                         `json:"maxItems,omitempty"`    // nolint: lll
	ItemsSchema             PropertySchema               `json:"items,omitempty"`
	CustomPropertyValidator CustomArrayPropertyValidator `json:"-"`
	DefaultValue            []interface{}                `json:"-"`
}

ArrayPropertySchema represents the attributes of an array type

func (ArrayPropertySchema) MarshalJSON added in v0.12.0

func (a ArrayPropertySchema) MarshalJSON() ([]byte, error)

MarshalJSON provides functionality to marshal an ArrayPropertySchema to JSON

type Binding

type Binding struct {
	BindingID         string             `json:"bindingId"`
	InstanceID        string             `json:"instanceId"`
	ServiceID         string             `json:"serviceId"`
	BindingParameters *BindingParameters `json:"bindingParameters"`
	Status            string             `json:"status"`
	StatusReason      string             `json:"statusReason"`
	Details           BindingDetails     `json:"details"`
	Created           time.Time          `json:"created"`
}

Binding represents a binding to a service

func NewBindingFromJSON

func NewBindingFromJSON(
	jsonBytes []byte,
	emptyBindingDetails BindingDetails,
	schema *InputParametersSchema,
) (Binding, error)

NewBindingFromJSON returns a new Binding unmarshalled from the provided JSON []byte

func (Binding) ToJSON

func (b Binding) ToJSON() ([]byte, error)

ToJSON returns a []byte containing a JSON representation of the instance

type BindingDetails added in v0.10.0

type BindingDetails interface{}

BindingDetails is an alias for the empty interface. It exists only to improve the clarity of function signatures and documentation.

type BindingParameters

type BindingParameters struct {
	Parameters
}

BindingParameters wraps a map containing binding parameters.

type BindingSchemas added in v0.12.0

type BindingSchemas struct {
	BindingParametersSchema InputParametersSchema `json:"create,omitempty"`
}

BindingSchemas encapsulates all plan-related schemas for validating input parameters to all service binding operations.

type Catalog

type Catalog interface {
	GetServices() []Service
	GetService(serviceID string) (Service, bool)
}

Catalog is an interface to be implemented by types that represents the service/plans offered by a service module or by the entire broker.

func NewCatalog

func NewCatalog(services []Service) Catalog

NewCatalog initializes and returns a new Catalog

type CatalogConfig added in v0.10.0

type CatalogConfig struct {
	MinStability            Stability
	EnableMigrationServices bool
	EnableDRServices        bool
}

CatalogConfig represents details re: which modules' services should be included or excluded from the catalog

func GetCatalogConfigFromEnvironment added in v0.10.0

func GetCatalogConfigFromEnvironment() (CatalogConfig, error)

GetCatalogConfigFromEnvironment returns catalog configuration

func NewCatalogConfigWithDefaults added in v0.10.0

func NewCatalogConfigWithDefaults() CatalogConfig

NewCatalogConfigWithDefaults returns a CatalogConfig object with default values already applied. Callers are then free to set custom values for the remaining fields and/or override default values.

type Credentials

type Credentials interface{}

Credentials is an interface to be implemented by service-specific types that represent service credentials. This interface doesn't require any functions to be implemented. It exists to improve the clarity of function signatures and documentation.

type CustomArrayPropertyValidator added in v0.12.0

type CustomArrayPropertyValidator func(
	context string,
	value []interface{},
) error

CustomArrayPropertyValidator is a function type that describes the signature for functions that provide custom validation logic for array properties.

type CustomFloatPropertyValidator added in v0.12.0

type CustomFloatPropertyValidator func(context string, value float64) error

CustomFloatPropertyValidator is a function type that describes the signature for functions that provide custom validation logic for float properties.

type CustomIntPropertyValidator added in v0.12.0

type CustomIntPropertyValidator func(context string, value int64) error

CustomIntPropertyValidator is a function type that describes the signature for functions that provide custom validation logic for integer properties.

type CustomObjectPropertyValidator added in v0.12.0

type CustomObjectPropertyValidator func(
	context string,
	value map[string]interface{},
) error

CustomObjectPropertyValidator is a function type that describes the signature for functions that provide custom validation logic for object properties.

type CustomStringPropertyValidator added in v0.12.0

type CustomStringPropertyValidator func(context, value string) error

CustomStringPropertyValidator is a function type that describes the signature for functions that provide custom validation logic for string properties.

type Deprovisioner

type Deprovisioner interface {
	GetFirstStepName() (string, bool)
	GetStep(name string) (DeprovisioningStep, bool)
	GetNextStepName(name string) (string, bool)
}

Deprovisioner is an interface to be implemented by types that model a declared chain of tasks used to asynchronously deprovision a service

func NewDeprovisioner

func NewDeprovisioner(steps ...DeprovisioningStep) (Deprovisioner, error)

NewDeprovisioner returns a new deprovisioner

type DeprovisioningStep

type DeprovisioningStep interface {
	GetName() string
	Execute(
		ctx context.Context,
		instance Instance,
	) (InstanceDetails, error)
}

DeprovisioningStep is an interface to be implemented by types that represent a single step in a chain of steps that defines a deprovisioning process

func NewDeprovisioningStep

func NewDeprovisioningStep(
	name string,
	fn DeprovisioningStepFunction,
) DeprovisioningStep

NewDeprovisioningStep returns a new DeprovisioningStep

type DeprovisioningStepFunction

type DeprovisioningStepFunction func(
	ctx context.Context,
	instance Instance,
) (InstanceDetails, error)

DeprovisioningStepFunction is the signature for functions that implement a deprovisioning step

type EnumValue added in v1.4.0

type EnumValue struct {
	Value string
	Title string
}

EnumValue represents an enum item in the oneOf JSON schema collection

func (EnumValue) MarshalJSON added in v1.4.0

func (v EnumValue) MarshalJSON() ([]byte, error)

MarshalJSON provides functionality to marshal an EnumValue to JSON according to JSON schema definition.

type FloatPropertySchema added in v0.12.0

type FloatPropertySchema struct {
	Title         string    `json:"title,omitempty"`
	Description   string    `json:"description,omitempty"`
	MinValue      *float64  `json:"minimum,omitempty"`
	MaxValue      *float64  `json:"maximum,omitempty"`
	AllowedValues []float64 `json:"enum,omitempty"`
	// krancour: AllowedIncrement is for the schema consumer's benefit only.
	// Validation vis-a-vis AllowedIncrement is not currently supported because of
	// floating point division errors. If you need this, write a custom property
	// validator instead, test it well, and avoid floating-point division if you
	// can.
	AllowedIncrement        *float64                     `json:"multipleOf,omitempty"` // nolint: lll
	CustomPropertyValidator CustomFloatPropertyValidator `json:"-"`
	DefaultValue            *float64                     `json:"default,omitempty"` // nolint: lll
}

FloatPropertySchema represents schema for a single floating point property

func (FloatPropertySchema) MarshalJSON added in v0.12.0

func (f FloatPropertySchema) MarshalJSON() ([]byte, error)

MarshalJSON provides functionality to marshal a FloatPropertySchema to JSON

type InputParametersSchema added in v0.12.0

type InputParametersSchema struct {
	RequiredProperties []string                  `json:"required,omitempty"`
	SecureProperties   []string                  `json:"-"`
	PropertySchemas    map[string]PropertySchema `json:"properties,omitempty"`
}

InputParametersSchema encapsulates schema for validating input parameters to any single operation.

func (InputParametersSchema) GetAdditionalPropertySchema added in v0.12.0

func (i InputParametersSchema) GetAdditionalPropertySchema() PropertySchema

GetAdditionalPropertySchema returns the "additional" property schema-- the schema that defines and allows for arbitrary properties on an object

func (InputParametersSchema) GetPropertySchemas added in v0.12.0

func (i InputParametersSchema) GetPropertySchemas() map[string]PropertySchema

GetPropertySchemas returns a map of subordinate property schemas

func (InputParametersSchema) MarshalJSON added in v0.12.0

func (i InputParametersSchema) MarshalJSON() ([]byte, error)

MarshalJSON defines custom JSON marshaling for InputParametersSchema and introduces an intermediate "parameters" property which is required by the OSB spec.

func (InputParametersSchema) Validate added in v0.12.0

func (i InputParametersSchema) Validate(valMap map[string]interface{}) error

Validate validates the given map[string]interface{} again this schema

type Instance

type Instance struct {
	InstanceID             string                  `json:"instanceId"`
	Alias                  string                  `json:"alias"`
	ServiceID              string                  `json:"serviceId"`
	Service                Service                 `json:"-"`
	PlanID                 string                  `json:"planId"`
	Plan                   Plan                    `json:"-"`
	ProvisioningParameters *ProvisioningParameters `json:"provisioningParameters"`
	UpdatingParameters     *ProvisioningParameters `json:"updatingParameters"`
	Status                 string                  `json:"status"`
	StatusReason           string                  `json:"statusReason"`
	Parent                 *Instance               `json:"-"`
	ParentAlias            string                  `json:"parentAlias"`
	Details                InstanceDetails         `json:"details"`
	Created                time.Time               `json:"created"`
}

Instance represents an instance of a service

func NewInstanceFromJSON

func NewInstanceFromJSON(
	jsonBytes []byte,
	emptyInstanceDetails InstanceDetails,
	provisioningParametersSchema *InputParametersSchema,
) (Instance, error)

NewInstanceFromJSON returns a new Instance unmarshalled from the provided JSON []byte

func (Instance) ToJSON

func (i Instance) ToJSON() ([]byte, error)

ToJSON returns a []byte containing a JSON representation of the instance

type InstanceDetails added in v0.10.0

type InstanceDetails interface{}

InstanceDetails is an alias for the emoty interface. It exists only to improve the clarity of function signatures and documentation.

type InstanceSchemas added in v0.12.0

type InstanceSchemas struct {
	ProvisioningParametersSchema InputParametersSchema `json:"create,omitempty"`
	UpdatingParametersSchema     InputParametersSchema `json:"update,omitempty"`
}

InstanceSchemas encapsulates all plan-related schemas for validating input parameters to all service instance operations.

type IntPropertySchema added in v0.12.0

type IntPropertySchema struct {
	Title                   string                     `json:"title,omitempty"`       // nolint: lll
	Description             string                     `json:"description,omitempty"` // nolint: lll
	MinValue                *int64                     `json:"minimum,omitempty"`
	MaxValue                *int64                     `json:"maximum,omitempty"`
	AllowedValues           []int64                    `json:"enum,omitempty"`
	AllowedIncrement        *int64                     `json:"multipleOf,omitempty"` // nolint: lll
	CustomPropertyValidator CustomIntPropertyValidator `json:"-"`
	DefaultValue            *int64                     `json:"default,omitempty"`
}

IntPropertySchema represents schema for a single integer property

func (IntPropertySchema) MarshalJSON added in v0.12.0

func (i IntPropertySchema) MarshalJSON() ([]byte, error)

MarshalJSON provides functionality to marshal an IntPropertySchema to JSON

type KeyedPropertySchemaContainer added in v0.12.0

type KeyedPropertySchemaContainer interface {
	GetPropertySchemas() map[string]PropertySchema
	GetAdditionalPropertySchema() PropertySchema
}

KeyedPropertySchemaContainer is an interface for any PropertySchema that contains an map of subordinate PropertySchemas. The existence of this interface alllows Params to treat InputParametersSchema and ObjectPropertySchema the same even though there are some differences between the two that are unimportant from Params' perspective.

type Module

type Module interface {
	// GetName returns a module's name
	GetName() string
	// GetCatalog returns a Catalog of service/plans offered by a module
	GetCatalog() (Catalog, error)
}

Module is an interface to be implemented by the broker's modules

type ObjectPropertySchema added in v0.12.0

type ObjectPropertySchema struct {
	Title                   string                        `json:"title,omitempty"`                // nolint: lll
	Description             string                        `json:"description,omitempty"`          // nolint: lll
	RequiredProperties      []string                      `json:"required,omitempty"`             // nolint: lll
	PropertySchemas         map[string]PropertySchema     `json:"properties,omitempty"`           // nolint: lll
	Additional              PropertySchema                `json:"additionalProperties,omitempty"` // nolint: lll
	CustomPropertyValidator CustomObjectPropertyValidator `json:"-"`
	DefaultValue            map[string]interface{}        `json:"-"`
}

ObjectPropertySchema represents the attributes of a complicated schema type that can have nested properties

func (ObjectPropertySchema) GetAdditionalPropertySchema added in v0.12.0

func (o ObjectPropertySchema) GetAdditionalPropertySchema() PropertySchema

GetAdditionalPropertySchema returns the "additional" property schema-- the schema that defines and allows for arbitrary properties on an object

func (ObjectPropertySchema) GetPropertySchemas added in v0.12.0

func (o ObjectPropertySchema) GetPropertySchemas() map[string]PropertySchema

GetPropertySchemas returns a map of subordinate property schemas

func (ObjectPropertySchema) MarshalJSON added in v0.12.0

func (o ObjectPropertySchema) MarshalJSON() ([]byte, error)

MarshalJSON provides functionality to marshal an ObjectPropertySchema to JSON

type Parameters added in v0.12.0

type Parameters struct {
	Schema KeyedPropertySchemaContainer
	Data   map[string]interface{}
}

Parameters is a wrapper for a map that uses a schema to inform data access, marshaling, and unmarshaling with seamless encryption and decryption of sensitive string fields using the globally configured codec.

func (*Parameters) GetFloat64 added in v0.12.0

func (p *Parameters) GetFloat64(key string) float64

GetFloat64 retrieves a float64 by key from the Parameters' underlying map. If the key does not exist in the schema, 0 is returned. If the key does exist in the schema, also exists in the map, and that value from the map can be coerced to a float64, it will be returned. If, however, the key does not exist in the map or its value cannot be coerced to a float64, any default value specified for that field in the schema will be returned. If no default is defined, 0 is returned.

func (*Parameters) GetFloat64Array added in v0.12.0

func (p *Parameters) GetFloat64Array(key string) []float64

GetFloat64Array retrieves a []float64 by key from the Parameters' underlying map. If the key does not exist in the schema, nil is returned. If the key does exist in the schema, also exists in the map, and that value from the map can be coerced to a []float64, it will be returned. If, however, the key does not exist in the map or its value cannot be coerced to a []float64, any default value specified for that field in the schema will be returned. If no default is defined, nil is returned.

func (*Parameters) GetInt64 added in v0.12.0

func (p *Parameters) GetInt64(key string) int64

GetInt64 retrieves an int64 by key from the Parameters' underlying map. If the key does not exist in the schema, 0 is returned. If the key does exist in the schema, also exists in the map, and that value from the map can be coerced to an int64, it will be returned. If, however, the key does not exist in the map or its value cannot be coerced to an int64, any default value specified for that field in the schema will be returned. If no default is defined, 0 is returned.

func (*Parameters) GetInt64Array added in v0.12.0

func (p *Parameters) GetInt64Array(key string) []int64

GetInt64Array retrieves an []int64 by key from the Parameters' underlying map. If the key does not exist in the schema, nil is returned. If the key does exist in the schema, also exists in the map, and that value from the map can be coerced to an []int64, it will be returned. If, however, the key does not exist in the map or its value cannot be coerced to an []int64, any default value specified for that field in the schema will be returned. If no default is defined, nil is returned.

func (*Parameters) GetObject added in v0.12.0

func (p *Parameters) GetObject(key string) Parameters

GetObject retrieves a map[string]interface{} by key from the Parameters' underlying map wrapped in a new Parameters object. If the key does not exist in the schema, a Parameters object with no underlying map is returned. If the key does exist in the schema, also exists in the map, and that value from the map can be coerced to a map[string]interface{}, it will be wrapped and returned. If, however, the key does not exist in the map or its value cannot be coerced to a map[string]interface{}, any default value specified for that field in the schema will be wrapped and returned. If no default is defined, a Parameters object with no underlying map is returned. GetObject calls can be chained to "drill down" into a complex set of parameters.

func (*Parameters) GetObjectArray added in v0.12.0

func (p *Parameters) GetObjectArray(key string) []Parameters

GetObjectArray retrieves a []map[string]interface{} by key from the Parameters' underlying map, wraps each element in a new Parameters object and returns []Parameters containing those wrapped []map[string]interface{}. If the key does not exist in the schema, nil is returned. If the key does exist in the schema, also exists in the map, and that value from the map can be coerced to a []map[string]interface{}, each element will be wrapped in a new Parameters object and []Parameters will be returned. If, however, the key does not exist in the map or its value cannot be coerced to a []map[string]interface{}, any default value specified for that field in the schema will have each of its elements wrapped and []Parameters will be returned. If no default is defined, nil is returned.

func (*Parameters) GetString added in v0.12.0

func (p *Parameters) GetString(key string) string

GetString retrieves a string by key from the Parameters' underlying map. If the key does not exist in the schema, an empty string is returned. If the key does exist in the schema, also exists in the map, and that value from the map can be coerced to a string, it will be returned. If, however, the key does not exist in the map or its value cannot be coerced to a string, any default value specified for that field in the schema will be returned. If no default is defined, an empty string is returned.

func (*Parameters) GetStringArray added in v0.12.0

func (p *Parameters) GetStringArray(key string) []string

GetStringArray retrieves a []string by key from the Parameters' underlying map. If the key does not exist in the schema, nil is returned. If the key does exist in the schema, also exists in the map, and that value from the map can be coerced to a []string, it will be returned. If, however, the key does not exist in the map or its value cannot be coerced to a []string, any default value specified for that field in the schema will be returned. If no default is defined, nil is returned.

func (Parameters) MarshalJSON added in v0.12.0

func (p Parameters) MarshalJSON() ([]byte, error)

MarshalJSON marshals Parameters to JSON

func (*Parameters) UnmarshalJSON added in v0.12.0

func (p *Parameters) UnmarshalJSON(bytes []byte) error

UnmarshalJSON umarshals JSON to a Parameters objects

type Plan

type Plan interface {
	GetID() string
	GetName() string
	GetProperties() PlanProperties
	IsEndOfLife() bool
	GetSchemas() PlanSchemas
	GetStability() Stability
}

Plan is an interface to be implemented by types that represent a single variant or "sku" of a service

func NewPlan

func NewPlan(planProperties PlanProperties) Plan

NewPlan initializes and returns a new Plan

type PlanProperties

type PlanProperties struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Free        bool                   `json:"free"`
	Metadata    ServicePlanMetadata    `json:"metadata,omitempty"` // nolint: lll
	Extended    map[string]interface{} `json:"-"`
	EndOfLife   bool                   `json:"-"`
	Schemas     PlanSchemas            `json:"schemas,omitempty"`
	Stability   Stability              `json:"-"`
}

PlanProperties represent the properties of a Plan that can be directly instantiated and passed to the NewPlan() constructor function which will carry out all necessary initialization.

type PlanSchemas added in v0.12.0

type PlanSchemas struct {
	ServiceInstances InstanceSchemas `json:"service_instance,omitempty"`
	ServiceBindings  BindingSchemas  `json:"service_binding,omitempty"`
}

PlanSchemas is the root of a tree that encapsulates all plan-related schemas for validating input parameters to all service instance and service binding operations.

func (*PlanSchemas) AddCommonSchema added in v1.0.1

func (p *PlanSchemas) AddCommonSchema(sp ServiceProperties)

AddCommonSchema annotates a PlanSchema object with common attributes based on the given ServiceProperties

type PropertySchema added in v0.12.0

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

PropertySchema is an interface for the schema of any kind of property.

type Provisioner

type Provisioner interface {
	GetFirstStepName() (string, bool)
	GetStep(name string) (ProvisioningStep, bool)
	GetNextStepName(name string) (string, bool)
}

Provisioner is an interface to be implemented by types that model a declared chain of tasks used to asynchronously provision a service

func NewProvisioner

func NewProvisioner(steps ...ProvisioningStep) (Provisioner, error)

NewProvisioner returns a new provisioner

type ProvisioningParameters

type ProvisioningParameters struct {
	Parameters
}

ProvisioningParameters wraps a map containing provisioning parameters.

type ProvisioningStep

type ProvisioningStep interface {
	GetName() string
	Execute(
		ctx context.Context,
		instance Instance,
	) (InstanceDetails, error)
}

ProvisioningStep is an interface to be implemented by types that represent a single step in a chain of steps that defines a provisioning process

func NewProvisioningStep

func NewProvisioningStep(
	name string,
	fn ProvisioningStepFunction,
) ProvisioningStep

NewProvisioningStep returns a new ProvisioningStep

type ProvisioningStepFunction

type ProvisioningStepFunction func(
	ctx context.Context,
	instance Instance,
) (InstanceDetails, error)

ProvisioningStepFunction is the signature for functions that implement a provisioning step

type SecureString added in v0.12.0

type SecureString string

SecureString is a string that is seamlessly encrypted and decrypted when it is, respectively, marshaled or unmarshaled

func (SecureString) MarshalJSON added in v0.12.0

func (s SecureString) MarshalJSON() ([]byte, error)

MarshalJSON converts a SecureString to JSON, encrypting it in the process

func (*SecureString) UnmarshalJSON added in v0.12.0

func (s *SecureString) UnmarshalJSON(bytes []byte) error

UnmarshalJSON converts JSON to a SecureString, decrypting it in the process

type Service

type Service interface {
	GetID() string
	GetName() string
	IsBindable() bool
	GetServiceManager() ServiceManager
	GetPlans() []Plan
	GetPlan(planID string) (Plan, bool)
	GetParentServiceID() string
	GetChildServiceID() string
	GetProperties() ServiceProperties
	GetTags() []string
	IsEndOfLife() bool
}

Service is an interface to be implemented by types that represent a single type of service with one or more plans

func NewService

func NewService(
	serviceProperties ServiceProperties,
	serviceManager ServiceManager,
	plans ...Plan,
) Service

NewService initialized and returns a new Service

type ServiceManager added in v0.10.0

type ServiceManager interface {
	// GetEmptyInstanceDetails returns an "empty" service-specific object that
	// can be populated with data during unmarshaling of JSON to an Instance
	GetEmptyInstanceDetails() InstanceDetails
	// GetProvisioner returns a provisioner that defines the steps a module must
	// execute asynchronously to provision a service.
	GetProvisioner(Plan) (Provisioner, error)
	// ValidateUpdatingParameters validates the provided
	// updating parameters against current instance state
	// and returns an error if there is any problem
	ValidateUpdatingParameters(Instance) error
	// GetUpdater returns a updater that defines the steps a module must
	// execute asynchronously to update a service.
	GetUpdater(Plan) (Updater, error)
	// GetEmptyBindingDetails returns an "empty" service-specific object that
	// can be populated with data during unmarshaling of JSON to a Binding
	GetEmptyBindingDetails() BindingDetails
	// Bind synchronously binds to a service
	Bind(Instance, BindingParameters) (BindingDetails, error)
	// GetCredentials returns service-specific credentials populated from instance
	// and binding details
	GetCredentials(Instance, Binding) (Credentials, error)
	// Unbind synchronously unbinds from a service
	Unbind(Instance, Binding) error
	// GetDeprovisioner returns a deprovisioner that defines the steps a module
	// must execute asynchronously to deprovision a service
	GetDeprovisioner(Plan) (Deprovisioner, error)
}

ServiceManager is an interface to be implemented by module components responsible for managing the lifecycle of services and plans thereof

type ServiceMetadata added in v0.10.0

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"`
}

ServiceMetadata contains metadata about the service classes

type ServicePlanMetadata added in v0.10.0

type ServicePlanMetadata struct {
	DisplayName string   `json:"displayName,omitempty"`
	Bullets     []string `json:"bullets,omitempty"`
}

ServicePlanMetadata contains metadata about the service plans

type ServiceProperties

type ServiceProperties struct {
	Name          string          `json:"name"`
	ID            string          `json:"id"`
	Description   string          `json:"description"`
	Metadata      ServiceMetadata `json:"metadata,omitempty"`
	Tags          []string        `json:"tags"`
	Bindable      bool            `json:"bindable"`
	PlanUpdatable bool            `json:"plan_updateable"` // Misspelling is
	// deliberate to match the spec
	ParentServiceID string                 `json:"-"`
	ChildServiceID  string                 `json:"-"`
	Extended        map[string]interface{} `json:"-"`
	EndOfLife       bool                   `json:"-"`
}

ServiceProperties represent the properties of a Service that can be directly instantiated and passed to the NewService() constructor function which will carry out all necessary initialization.

type Stability

type Stability int

Stability is a type that represents the relative stability of a service module

const (
	// StabilityExperimental represents relative stability of the most immature
	// service modules. At this level of stability, we're not even certain we've
	// built the right thing!
	StabilityExperimental Stability = iota
	// StabilityPreview represents relative stability of modules we believe are
	// approaching a stable state.
	StabilityPreview
	// StabilityStable represents relative stability of the mature, production-
	// ready service modules.
	StabilityStable
)

type StringPropertySchema added in v0.12.0

type StringPropertySchema struct {
	Title                   string                        `json:"title,omitempty"`       // nolint: lll
	Description             string                        `json:"description,omitempty"` // nolint: lll
	MinLength               *int                          `json:"minLength,omitempty"`   // nolint: lll
	MaxLength               *int                          `json:"maxLength,omitempty"`   // nolint: lll
	AllowedValues           []string                      `json:"enum,omitempty"`
	AllowedPattern          string                        `json:"pattern,omitempty"` // nolint: lll
	CustomPropertyValidator CustomStringPropertyValidator `json:"-"`
	DefaultValue            string                        `json:"default,omitempty"` // nolint: lll
	OneOf                   []EnumValue                   `json:"oneOf,omitempty"`   // nolint: lll
}

StringPropertySchema represents schema for a single string property

func (StringPropertySchema) MarshalJSON added in v0.12.0

func (s StringPropertySchema) MarshalJSON() ([]byte, error)

MarshalJSON provides functionality to marshal a StringPropertySchema to JSON

type Updater

type Updater interface {
	GetFirstStepName() (string, bool)
	GetStep(name string) (UpdatingStep, bool)
	GetNextStepName(name string) (string, bool)
}

Updater is an interface to be implemented by types that model a declared chain of tasks used to asynchronously update a service

func NewUpdater

func NewUpdater(steps ...UpdatingStep) (Updater, error)

NewUpdater returns a new updater

type UpdatingStep

type UpdatingStep interface {
	GetName() string
	Execute(
		ctx context.Context,
		instance Instance,
	) (InstanceDetails, error)
}

UpdatingStep is an interface to be implemented by types that represent a single step in a chain of steps that defines a updating process

func NewUpdatingStep

func NewUpdatingStep(
	name string,
	fn UpdatingStepFunction,
) UpdatingStep

NewUpdatingStep returns a new UpdatingStep

type UpdatingStepFunction

type UpdatingStepFunction func(
	ctx context.Context,
	instance Instance,
) (InstanceDetails, error)

UpdatingStepFunction is the signature for functions that implement a updating step

type ValidationError

type ValidationError struct {
	Field string
	Issue string
}

ValidationError represents an error validating requestParameters. This specific error type should be used to allow the broker's framework to differentiate between validation errors and other common, unexpected errors.

func NewValidationError

func NewValidationError(field, issue string) *ValidationError

NewValidationError returns a new ValidationError for the given field and issue

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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