broker

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package broker holds the code that users of the skeleton write for their broker. To make a broker, fill out:

  • The Options type, which holds options for the broker
  • The AddFlags function, which adds CLI flags for an Options
  • The methods of the BusinessLogic type, which implements the broker's business logic
  • The NewBusinessLogic function, which creates a BusinessLogic from the Options the program is run with

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(o *Options)

func ApplyParamsToStatement

func ApplyParamsToStatement(statement string, args ...string) string

func CanBeDeleted

func CanBeDeleted(status string) bool

available, failed, incompatible-parameters, incompatible-network, restore-failed, recovering

func CanBeModified

func CanBeModified(status string) bool

func CanGetBindings

func CanGetBindings(status string) bool

func ConflictErrorWithMessage

func ConflictErrorWithMessage(description string) error

func CrudeOSBIHacks

func CrudeOSBIHacks(router *mux.Router, b *BusinessLogic)

These are hacks to support more of V2.14 such as get service instance and get service bindings.

func FinishedTask

func FinishedTask(storage Storage, taskId string, retries int64, result string, status string)

func HttpWrite

func HttpWrite(w http.ResponseWriter, status int, obj interface{})

func InProgress

func InProgress(status string) bool

func InternalServerError

func InternalServerError() error

func IsAvailable

func IsAvailable(status string) bool

func IsReady

func IsReady(status string) bool

func IsReadyKubernetes added in v1.0.2

func IsReadyKubernetes(dep *v1apps.Deployment) bool

func NotFound

func NotFound() error

func RandomString

func RandomString(n int) string

func RestoreBackup

func RestoreBackup(storage Storage, instance *Instance, namePrefix string, backup string) error

func RunBackgroundTasks

func RunBackgroundTasks(ctx context.Context, o Options) error

func RunPreprovisionTasks

func RunPreprovisionTasks(ctx context.Context, o Options, namePrefix string, storage Storage, wait int64)

func RunWorkerTasks

func RunWorkerTasks(ctx context.Context, o Options, namePrefix string, storage Storage) error

func TickTocPreprovisionTasks

func TickTocPreprovisionTasks(ctx context.Context, o Options, namePrefix string, storage Storage)

func UnprocessableEntity

func UnprocessableEntity() error

func UnprocessableEntityWithMessage

func UnprocessableEntityWithMessage(err string, description string) error

func UpdateTaskStatus

func UpdateTaskStatus(storage Storage, taskId string, retries int64, result string, status string)

func UpgradeAcrossProviders

func UpgradeAcrossProviders(storage Storage, from *Instance, toPlanId string, namePrefix string) (string, error)

func UpgradeWithinProviders

func UpgradeWithinProviders(storage Storage, fromDb *Instance, toPlanId string, namePrefix string) (string, error)

Types

type AWSInstanceMemcachedProvider

type AWSInstanceMemcachedProvider struct {
	Provider
	// contains filtered or unexported fields
}

func NewAWSInstanceMemcachedProvider

func NewAWSInstanceMemcachedProvider(namePrefix string) (*AWSInstanceMemcachedProvider, error)

func (AWSInstanceMemcachedProvider) CreateBackup

func (provider AWSInstanceMemcachedProvider) CreateBackup(*Instance) (*BackupSpec, error)

func (AWSInstanceMemcachedProvider) Deprovision

func (provider AWSInstanceMemcachedProvider) Deprovision(Instance *Instance, takeSnapshot bool) error

func (AWSInstanceMemcachedProvider) Flush

func (provider AWSInstanceMemcachedProvider) Flush(Instance *Instance) error

func (AWSInstanceMemcachedProvider) GetBackup

func (provider AWSInstanceMemcachedProvider) GetBackup(*Instance, string) (*BackupSpec, error)

func (AWSInstanceMemcachedProvider) GetInstance

func (provider AWSInstanceMemcachedProvider) GetInstance(name string, plan *ProviderPlan) (*Instance, error)

func (AWSInstanceMemcachedProvider) GetUrl

func (provider AWSInstanceMemcachedProvider) GetUrl(instance *Instance) map[string]interface{}

func (AWSInstanceMemcachedProvider) ListBackups

func (provider AWSInstanceMemcachedProvider) ListBackups(*Instance) ([]BackupSpec, error)

func (AWSInstanceMemcachedProvider) Modify

func (provider AWSInstanceMemcachedProvider) Modify(Instance *Instance, plan *ProviderPlan) (*Instance, error)

func (AWSInstanceMemcachedProvider) PerformPostProvision

func (provider AWSInstanceMemcachedProvider) PerformPostProvision(db *Instance) (*Instance, error)

func (AWSInstanceMemcachedProvider) Provision

func (provider AWSInstanceMemcachedProvider) Provision(Id string, plan *ProviderPlan, Owner string) (*Instance, error)

func (AWSInstanceMemcachedProvider) ProvisionWithSettings

func (provider AWSInstanceMemcachedProvider) ProvisionWithSettings(Id string, plan *ProviderPlan, settings *elasticache.CreateCacheClusterInput) (*Instance, error)

func (AWSInstanceMemcachedProvider) Restart

func (provider AWSInstanceMemcachedProvider) Restart(Instance *Instance) error

func (AWSInstanceMemcachedProvider) RestoreBackup

func (provider AWSInstanceMemcachedProvider) RestoreBackup(*Instance, string) error

func (AWSInstanceMemcachedProvider) Stats

func (provider AWSInstanceMemcachedProvider) Stats(Instance *Instance) ([]Stat, error)

func (AWSInstanceMemcachedProvider) Tag

func (provider AWSInstanceMemcachedProvider) Tag(Instance *Instance, Name string, Value string) error

func (AWSInstanceMemcachedProvider) Untag

func (provider AWSInstanceMemcachedProvider) Untag(Instance *Instance, Name string) error

type AWSInstanceRedisProvider

type AWSInstanceRedisProvider struct {
	Provider
	// contains filtered or unexported fields
}

func NewAWSInstanceRedisProvider

func NewAWSInstanceRedisProvider(namePrefix string) (*AWSInstanceRedisProvider, error)

func (AWSInstanceRedisProvider) CreateBackup

func (provider AWSInstanceRedisProvider) CreateBackup(instance *Instance) (*BackupSpec, error)

func (AWSInstanceRedisProvider) Deprovision

func (provider AWSInstanceRedisProvider) Deprovision(Instance *Instance, takeSnapshot bool) error

func (AWSInstanceRedisProvider) Flush

func (provider AWSInstanceRedisProvider) Flush(Instance *Instance) error

func (AWSInstanceRedisProvider) GetBackup

func (provider AWSInstanceRedisProvider) GetBackup(instance *Instance, Id string) (*BackupSpec, error)

func (AWSInstanceRedisProvider) GetInstance

func (provider AWSInstanceRedisProvider) GetInstance(name string, plan *ProviderPlan) (*Instance, error)

func (AWSInstanceRedisProvider) GetUrl

func (provider AWSInstanceRedisProvider) GetUrl(instance *Instance) map[string]interface{}

func (AWSInstanceRedisProvider) ListBackups

func (provider AWSInstanceRedisProvider) ListBackups(instance *Instance) ([]BackupSpec, error)

func (AWSInstanceRedisProvider) Modify

func (provider AWSInstanceRedisProvider) Modify(Instance *Instance, plan *ProviderPlan) (*Instance, error)

func (AWSInstanceRedisProvider) ModifyWithSettings

func (provider AWSInstanceRedisProvider) ModifyWithSettings(instance *Instance, plan *ProviderPlan, settings *elasticache.CreateCacheClusterInput) (*Instance, error)

func (AWSInstanceRedisProvider) PerformPostProvision

func (provider AWSInstanceRedisProvider) PerformPostProvision(db *Instance) (*Instance, error)

func (AWSInstanceRedisProvider) Provision

func (provider AWSInstanceRedisProvider) Provision(Id string, plan *ProviderPlan, Owner string) (*Instance, error)

func (AWSInstanceRedisProvider) ProvisionWithSettings

func (provider AWSInstanceRedisProvider) ProvisionWithSettings(Id string, plan *ProviderPlan, settings *elasticache.CreateCacheClusterInput) (*Instance, error)

func (AWSInstanceRedisProvider) Restart

func (provider AWSInstanceRedisProvider) Restart(Instance *Instance) error

func (AWSInstanceRedisProvider) RestoreBackup

func (provider AWSInstanceRedisProvider) RestoreBackup(instance *Instance, Id string) error

func (AWSInstanceRedisProvider) Stats

func (provider AWSInstanceRedisProvider) Stats(Instance *Instance) ([]Stat, error)

func (AWSInstanceRedisProvider) Tag

func (provider AWSInstanceRedisProvider) Tag(Instance *Instance, Name string, Value string) error

func (AWSInstanceRedisProvider) Untag

func (provider AWSInstanceRedisProvider) Untag(Instance *Instance, Name string) error

type Action

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

type ActionBase

type ActionBase struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ActionBase) ActionSchemaHandler

func (b *ActionBase) ActionSchemaHandler(w http.ResponseWriter, r *http.Request)

func (*ActionBase) AddActions

func (b *ActionBase) AddActions(name string, path string, method string, handler func(string, map[string]string, *broker.RequestContext) (interface{}, error)) error

func (*ActionBase) ConvertActionsToExtensions

func (b *ActionBase) ConvertActionsToExtensions(serviceId string) []osb.ExtensionAPI

func (*ActionBase) RouteActions

func (b *ActionBase) RouteActions(router *mux.Router) error

type BackupSpec

type BackupSpec struct {
	Resource ResourceSpec `json:"resource"`
	Id       *string      `json:"id"`
	Progress *int64       `json:"progress"`
	Status   *string      `json:"status"`
	Created  string       `json:"created_at"`
}

type BusinessLogic

type BusinessLogic struct {
	ActionBase
	// contains filtered or unexported fields
}

func NewBusinessLogic

func NewBusinessLogic(ctx context.Context, o Options) (*BusinessLogic, error)

func (*BusinessLogic) ActionCreateBackup

func (b *BusinessLogic) ActionCreateBackup(InstanceID string, vars map[string]string, context *broker.RequestContext) (interface{}, error)

func (*BusinessLogic) ActionFlushData

func (b *BusinessLogic) ActionFlushData(InstanceID string, vars map[string]string, context *broker.RequestContext) (interface{}, error)

func (*BusinessLogic) ActionGetBackup

func (b *BusinessLogic) ActionGetBackup(InstanceID string, vars map[string]string, context *broker.RequestContext) (interface{}, error)

func (*BusinessLogic) ActionGetStats

func (b *BusinessLogic) ActionGetStats(InstanceID string, vars map[string]string, context *broker.RequestContext) (interface{}, error)

func (*BusinessLogic) ActionListBackups

func (b *BusinessLogic) ActionListBackups(InstanceID string, vars map[string]string, context *broker.RequestContext) (interface{}, error)

func (*BusinessLogic) ActionRestart

func (b *BusinessLogic) ActionRestart(InstanceID string, vars map[string]string, context *broker.RequestContext) (interface{}, error)

func (*BusinessLogic) ActionRestoreBackup

func (b *BusinessLogic) ActionRestoreBackup(InstanceID string, vars map[string]string, context *broker.RequestContext) (interface{}, error)

func (*BusinessLogic) Bind

func (*BusinessLogic) Deprovision

func (*BusinessLogic) GetBinding

func (b *BusinessLogic) GetBinding(request *osb.GetBindingRequest, context *broker.RequestContext) (*osb.GetBindingResponse, error)

func (*BusinessLogic) GetCatalog

func (*BusinessLogic) GetInstanceById

func (b *BusinessLogic) GetInstanceById(Id string) (*Instance, error)

func (*BusinessLogic) GetUnclaimedInstance

func (b *BusinessLogic) GetUnclaimedInstance(PlanId string, InstanceId string) (*Instance, error)

func (*BusinessLogic) LastOperation

func (*BusinessLogic) Provision

A peice of advice, never try to make this syncronous by waiting for a to return a response. The problem is that can take up to 10 minutes in my experience (depending on the provider), and aside from the API call timing out the other issue is it can cause the mutex lock to make the entire API unresponsive.

func (*BusinessLogic) Unbind

func (*BusinessLogic) Update

func (*BusinessLogic) ValidateBrokerAPIVersion

func (b *BusinessLogic) ValidateBrokerAPIVersion(version string) error

type ChangePlansTaskMetadata

type ChangePlansTaskMetadata struct {
	Plan string `json:"plan"`
}

type ChangeProvidersTaskMetadata

type ChangeProvidersTaskMetadata struct {
	Plan string `json:"plan"`
}

type Entry

type Entry struct {
	Id       string
	Name     string
	PlanId   string
	Claimed  bool
	Tasks    int
	Status   string
	Username string
	Password string
	Endpoint string
}

type Instance

type Instance struct {
	Id            string        `json:"id"`
	Name          string        `json:"name"`
	ProviderId    string        `json:"provider_id"`
	Plan          *ProviderPlan `json:"plan,omitempty"`
	Username      string        `json:"username"`
	Password      string        `json:"password"`
	Endpoint      string        `json:"endpoint"`
	Status        string        `json:"status"`
	Ready         bool          `json:"ready"`
	Engine        string        `json:"engine"`
	EngineVersion string        `json:"engine_version"`
	Scheme        string        `json:"scheme"`
}

func GetInstanceById

func GetInstanceById(namePrefix string, storage Storage, Id string) (*Instance, error)

func (*Instance) Match

func (i *Instance) Match(other *Instance) bool

type KubernetesInstanceMemcachedProvider added in v1.0.2

type KubernetesInstanceMemcachedProvider struct {
	Provider
	// contains filtered or unexported fields
}

func NewKubernetesInstanceMemcachedProvider added in v1.0.2

func NewKubernetesInstanceMemcachedProvider(namePrefix string) (*KubernetesInstanceMemcachedProvider, error)

func (KubernetesInstanceMemcachedProvider) CreateBackup added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) CreateBackup(*Instance) (*BackupSpec, error)

func (KubernetesInstanceMemcachedProvider) Deprovision added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) Deprovision(Instance *Instance, takeSnapshot bool) error

func (KubernetesInstanceMemcachedProvider) Flush added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) Flush(Instance *Instance) error

func (KubernetesInstanceMemcachedProvider) GetBackup added in v1.0.2

func (KubernetesInstanceMemcachedProvider) GetInstance added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) GetInstance(name string, plan *ProviderPlan) (*Instance, error)

func (KubernetesInstanceMemcachedProvider) GetUrl added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) GetUrl(instance *Instance) map[string]interface{}

func (KubernetesInstanceMemcachedProvider) ListBackups added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) ListBackups(*Instance) ([]BackupSpec, error)

func (KubernetesInstanceMemcachedProvider) Modify added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) Modify(Instance *Instance, plan *ProviderPlan) (*Instance, error)

func (KubernetesInstanceMemcachedProvider) PerformPostProvision added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) PerformPostProvision(db *Instance) (*Instance, error)

func (KubernetesInstanceMemcachedProvider) Provision added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) Provision(Id string, plan *ProviderPlan, Owner string) (*Instance, error)

func (KubernetesInstanceMemcachedProvider) Restart added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) Restart(Instance *Instance) error

func (KubernetesInstanceMemcachedProvider) RestoreBackup added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) RestoreBackup(*Instance, string) error

func (KubernetesInstanceMemcachedProvider) Stats added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) Stats(Instance *Instance) ([]Stat, error)

func (KubernetesInstanceMemcachedProvider) Tag added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) Tag(Instance *Instance, Name string, Value string) error

func (KubernetesInstanceMemcachedProvider) Untag added in v1.0.2

func (provider KubernetesInstanceMemcachedProvider) Untag(Instance *Instance, Name string) error

type KubernetesInstanceRedisProvider added in v1.0.2

type KubernetesInstanceRedisProvider struct {
	Provider
	// contains filtered or unexported fields
}

func NewKubernetesInstanceRedisProvider added in v1.0.2

func NewKubernetesInstanceRedisProvider(namePrefix string) (*KubernetesInstanceRedisProvider, error)

func (KubernetesInstanceRedisProvider) CreateBackup added in v1.0.2

func (provider KubernetesInstanceRedisProvider) CreateBackup(*Instance) (*BackupSpec, error)

func (KubernetesInstanceRedisProvider) Deprovision added in v1.0.2

func (provider KubernetesInstanceRedisProvider) Deprovision(Instance *Instance, takeSnapshot bool) error

func (KubernetesInstanceRedisProvider) Flush added in v1.0.2

func (provider KubernetesInstanceRedisProvider) Flush(Instance *Instance) error

func (KubernetesInstanceRedisProvider) GetBackup added in v1.0.2

func (KubernetesInstanceRedisProvider) GetInstance added in v1.0.2

func (provider KubernetesInstanceRedisProvider) GetInstance(name string, plan *ProviderPlan) (*Instance, error)

func (KubernetesInstanceRedisProvider) GetUrl added in v1.0.2

func (provider KubernetesInstanceRedisProvider) GetUrl(instance *Instance) map[string]interface{}

func (KubernetesInstanceRedisProvider) ListBackups added in v1.0.2

func (provider KubernetesInstanceRedisProvider) ListBackups(*Instance) ([]BackupSpec, error)

func (KubernetesInstanceRedisProvider) Modify added in v1.0.2

func (provider KubernetesInstanceRedisProvider) Modify(Instance *Instance, plan *ProviderPlan) (*Instance, error)

func (KubernetesInstanceRedisProvider) PerformPostProvision added in v1.0.2

func (provider KubernetesInstanceRedisProvider) PerformPostProvision(db *Instance) (*Instance, error)

func (KubernetesInstanceRedisProvider) Provision added in v1.0.2

func (provider KubernetesInstanceRedisProvider) Provision(Id string, plan *ProviderPlan, Owner string) (*Instance, error)

func (KubernetesInstanceRedisProvider) Restart added in v1.0.2

func (provider KubernetesInstanceRedisProvider) Restart(Instance *Instance) error

func (KubernetesInstanceRedisProvider) RestoreBackup added in v1.0.2

func (provider KubernetesInstanceRedisProvider) RestoreBackup(*Instance, string) error

func (KubernetesInstanceRedisProvider) Stats added in v1.0.2

func (provider KubernetesInstanceRedisProvider) Stats(Instance *Instance) ([]Stat, error)

func (KubernetesInstanceRedisProvider) Tag added in v1.0.2

func (provider KubernetesInstanceRedisProvider) Tag(Instance *Instance, Name string, Value string) error

func (KubernetesInstanceRedisProvider) Untag added in v1.0.2

func (provider KubernetesInstanceRedisProvider) Untag(Instance *Instance, Name string) error

type MemcachedProviderPlan added in v1.0.2

type MemcachedProviderPlan struct {
	SizeInMegabytes string  `json:"size_in_megabytes"`
	Version         string  `json:"version"`
	DockerImage     *string `json:"docker_image"`
	Port            *int    `json:"port"`
}

type Options

type Options struct {
	DatabaseUrl string
	NamePrefix  string
}

type PostgresStorage

type PostgresStorage struct {
	Storage
	// contains filtered or unexported fields
}

func InitStorage

func InitStorage(ctx context.Context, o Options) (*PostgresStorage, error)

func (*PostgresStorage) AddInstance

func (b *PostgresStorage) AddInstance(Instance *Instance) error

func (*PostgresStorage) AddTask

func (b *PostgresStorage) AddTask(Id string, action TaskAction, metadata string) (string, error)

func (*PostgresStorage) DeleteInstance

func (b *PostgresStorage) DeleteInstance(Instance *Instance) error

func (*PostgresStorage) GetInstance

func (b *PostgresStorage) GetInstance(Id string) (*Entry, error)

func (*PostgresStorage) GetPlanByID

func (b *PostgresStorage) GetPlanByID(planId string) (*ProviderPlan, error)

func (*PostgresStorage) GetPlans

func (b *PostgresStorage) GetPlans(serviceId string) ([]ProviderPlan, error)

func (*PostgresStorage) GetServices

func (b *PostgresStorage) GetServices() ([]osb.Service, error)

func (*PostgresStorage) GetUnclaimedInstance

func (b *PostgresStorage) GetUnclaimedInstance(PlanId string, InstanceId string) (*Entry, error)

func (*PostgresStorage) IsRestoring

func (b *PostgresStorage) IsRestoring(dbId string) (bool, error)

func (*PostgresStorage) IsUpgrading

func (b *PostgresStorage) IsUpgrading(dbId string) (bool, error)

func (*PostgresStorage) NukeInstance

func (b *PostgresStorage) NukeInstance(Id string) error

func (*PostgresStorage) PopPendingTask

func (b *PostgresStorage) PopPendingTask() (*Task, error)

func (*PostgresStorage) ReturnClaimedInstance

func (b *PostgresStorage) ReturnClaimedInstance(Id string) error

func (*PostgresStorage) StartProvisioningTasks

func (b *PostgresStorage) StartProvisioningTasks() ([]Entry, error)

func (*PostgresStorage) UpdateInstance

func (b *PostgresStorage) UpdateInstance(Instance *Instance, PlanId string) error

func (*PostgresStorage) UpdateTask

func (b *PostgresStorage) UpdateTask(Id string, status *string, retries *int64, metadata *string, result *string, started *time.Time, finsihed *time.Time) error

func (*PostgresStorage) ValidateInstanceID

func (b *PostgresStorage) ValidateInstanceID(id string) error

func (*PostgresStorage) WarnOnUnfinishedTasks

func (b *PostgresStorage) WarnOnUnfinishedTasks()

type Provider

type Provider interface {
	GetInstance(string, *ProviderPlan) (*Instance, error)
	Provision(string, *ProviderPlan, string) (*Instance, error)
	Deprovision(*Instance, bool) error
	Modify(*Instance, *ProviderPlan) (*Instance, error)
	Tag(*Instance, string, string) error
	Untag(*Instance, string) error
	Restart(*Instance) error
	PerformPostProvision(*Instance) (*Instance, error)
	GetUrl(*Instance) map[string]interface{}
	Flush(*Instance) error
	Stats(*Instance) ([]Stat, error)
	GetBackup(*Instance, string) (*BackupSpec, error)
	ListBackups(*Instance) ([]BackupSpec, error)
	CreateBackup(*Instance) (*BackupSpec, error)
	RestoreBackup(*Instance, string) error
}

func GetProviderByPlan

func GetProviderByPlan(namePrefix string, plan *ProviderPlan) (Provider, error)

type ProviderPlan

type ProviderPlan struct {
	Provider Providers `json:"provider"`

	ID     string `json:"id"`
	Scheme string `json:"scheme"`
	// contains filtered or unexported fields
}

type Providers

type Providers string
const (
	AWSRedisInstance            Providers = "aws-redis-instance"
	AWSMemcachedInstance        Providers = "aws-memcached-instance"
	KubernetesMemcachedInstance Providers = "kubernetes-memcached-instance"
	KubernetesRedisInstance     Providers = "kubernetes-redis-instance"
	Unknown                     Providers = "unknown"
)

func GetProvidersFromString

func GetProvidersFromString(str string) Providers

type ResourceSpec

type ResourceSpec struct {
	Name string `json:"name"`
}

type ResourceUrlSpec

type ResourceUrlSpec struct {
	Username string
	Password string
	Endpoint string
	Plan     string
}

type RestoreTaskMetadata

type RestoreTaskMetadata struct {
	Backup string `json:"backup"`
}

type Stat

type Stat struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Storage

type Storage interface {
	GetPlans(string) ([]ProviderPlan, error)
	GetPlanByID(string) (*ProviderPlan, error)
	GetInstance(string) (*Entry, error)
	AddInstance(*Instance) error
	DeleteInstance(*Instance) error
	UpdateInstance(*Instance, string) error
	AddTask(string, TaskAction, string) (string, error)
	GetServices() ([]osb.Service, error)
	UpdateTask(string, *string, *int64, *string, *string, *time.Time, *time.Time) error
	PopPendingTask() (*Task, error)
	GetUnclaimedInstance(string, string) (*Entry, error)
	ReturnClaimedInstance(string) error
	StartProvisioningTasks() ([]Entry, error)
	NukeInstance(string) error
	WarnOnUnfinishedTasks()
	IsRestoring(string) (bool, error)
	IsUpgrading(string) (bool, error)
	ValidateInstanceID(string) error
}

func InitFromOptions

func InitFromOptions(ctx context.Context, o Options) (Storage, string, error)

type Task

type Task struct {
	Id         string
	Action     TaskAction
	ResourceId string
	Status     string
	Retries    int64
	Metadata   string
	Result     string
	Started    *time.Time
	Finished   *time.Time
}

type TaskAction

type TaskAction string
const (
	DeleteTask                           TaskAction = "delete"
	ResyncFromProviderTask               TaskAction = "resync-from-provider"
	ResyncFromProviderUntilAvailableTask TaskAction = "resync-until-available"
	NotifyCreateServiceWebhookTask       TaskAction = "notify-create-service-webhook"
	NotifyCreateBindingWebhookTask       TaskAction = "notify-create-binding-webhook"
	ChangeProvidersTask                  TaskAction = "change-providers"
	ChangePlansTask                      TaskAction = "change-plans"
	RestoreTask                          TaskAction = "restore"
	PerformPostProvisionTask             TaskAction = "perform-post-provision"
)

type WebhookTaskMetadata

type WebhookTaskMetadata struct {
	Url    string `json:"url"`
	Secret string `json:"secret"`
}

Jump to

Keyboard shortcuts

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