broker

package
v0.0.0-...-6d4a0cd Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: Apache-2.0, Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Currently added in this package to be able to access plans schemas. In future we need to refactor that approach and in one single place have Plan Schemas, Plan Schemas Validator, Plan Schemas Defaults Currently it is shared between `broker`, `provider` and `proces/provisioning/input` packages.

Index

Constants

View Source
const (
	KymaServiceID   = "47c9dcbf-ff30-448e-ab36-d3bad66ba281"
	KymaServiceName = "kymaruntime"
)
View Source
const (
	GCPPlanID     = "ca6e5357-707f-4565-bbbd-b3ab732597c6"
	GCPPlanName   = "gcp"
	AzurePlanID   = "4deee563-e5ec-4731-b9b1-53b42d855f0c"
	AzurePlanName = "azure"
)

Variables

View Source
var Plans = map[string]struct {
	PlanDefinition        domain.ServicePlan
	provisioningRawSchema []byte
}{
	GCPPlanID: {
		PlanDefinition: domain.ServicePlan{
			ID:          GCPPlanID,
			Name:        GCPPlanName,
			Description: "GCP",
			Metadata: &domain.ServicePlanMetadata{
				DisplayName: "GCP",
			},
			Schemas: &domain.ServiceSchemas{
				Instance: domain.ServiceInstanceSchema{
					Create: domain.Schema{
						Parameters: make(map[string]interface{}),
					},
				},
			},
		},
		// contains filtered or unexported fields
	},
	AzurePlanID: {
		PlanDefinition: domain.ServicePlan{
			ID:          AzurePlanID,
			Name:        AzurePlanName,
			Description: "Azure",
			Metadata: &domain.ServicePlanMetadata{
				DisplayName: "Azure",
			},
			Schemas: &domain.ServiceSchemas{
				Instance: domain.ServiceInstanceSchema{
					Create: domain.Schema{
						Parameters: make(map[string]interface{}),
					},
				},
			},
		},
		// contains filtered or unexported fields
	},
}

plans is designed to hold plan defaulting logic keep internal/hyperscaler/azure/config.go in sync with any changes to available zones

Functions

func AttachRoutes

func AttachRoutes(router *mux.Router, serviceBroker domain.ServiceBroker, logger lager.Logger, brokerCredentials *Credentials) *mux.Router

copied from github.com/pivotal-cf/brokerapi/api.go

func AzureRegions

func AzureRegions() []string

func AzureSchema

func AzureSchema() []byte

func GCPSchema

func GCPSchema() []byte

func ToInterfaceSlice

func ToInterfaceSlice(input []string) []interface{}

Types

type BindEndpoint

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

func NewBind

func NewBind(log logrus.FieldLogger) *BindEndpoint

func (*BindEndpoint) Bind

func (b *BindEndpoint) Bind(ctx context.Context, instanceID, bindingID string, details domain.BindDetails, asyncAllowed bool) (domain.Binding, error)

Bind creates a new service binding

PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}

type Config

type Config struct {
	EnablePlans EnablePlans `envconfig:"default=azure"`
}

Config represents configuration for broker

type Credentials

type Credentials struct {
	Username string
	Password string
}

type DeprovisionEndpoint

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

func NewDeprovision

func NewDeprovision(instancesStorage storage.Instances, operationsStorage storage.Operations, q Queue, log logrus.FieldLogger) *DeprovisionEndpoint

func (*DeprovisionEndpoint) Deprovision

func (b *DeprovisionEndpoint) Deprovision(ctx context.Context, instanceID string, details domain.DeprovisionDetails, asyncAllowed bool) (domain.DeprovisionServiceSpec, error)

Deprovision deletes an existing service instance

DELETE /v2/service_instances/{instance_id}

type EnablePlans

type EnablePlans []string

EnablePlans defines the plans that should be available for provisioning

func (*EnablePlans) Unmarshal

func (m *EnablePlans) Unmarshal(in string) error

Unmarshal provides custom parsing of enabled plans. Implements envconfig.Unmarshal interface.

type GetBindingEndpoint

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

func NewGetBinding

func NewGetBinding(log logrus.FieldLogger) *GetBindingEndpoint

func (*GetBindingEndpoint) GetBinding

func (b *GetBindingEndpoint) GetBinding(ctx context.Context, instanceID, bindingID string) (domain.GetBindingSpec, error)

GetBinding fetches an existing service binding

GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}

type GetInstanceEndpoint

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

func NewGetInstance

func NewGetInstance(instancesStorage storage.Instances, log logrus.FieldLogger) *GetInstanceEndpoint

func (*GetInstanceEndpoint) GetInstance

func (b *GetInstanceEndpoint) GetInstance(ctx context.Context, instanceID string) (domain.GetInstanceDetailsSpec, error)

GetInstance fetches information about a service instance

GET /v2/service_instances/{instance_id}

type JSONSchemaValidator

type JSONSchemaValidator interface {
	ValidateString(json string) (jsonschema.ValidationResult, error)
}

type LastBindingOperationEndpoint

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

func (*LastBindingOperationEndpoint) LastBindingOperation

func (b *LastBindingOperationEndpoint) LastBindingOperation(ctx context.Context, instanceID, bindingID string, details domain.PollDetails) (domain.LastOperation, error)

LastBindingOperation fetches last operation state for a service binding

GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation

type LastOperationEndpoint

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

func (*LastOperationEndpoint) LastOperation

func (b *LastOperationEndpoint) LastOperation(ctx context.Context, instanceID string, details domain.PollDetails) (domain.LastOperation, error)

LastOperation fetches last operation state for a service instance

GET /v2/service_instances/{instance_id}/last_operation

type OptionalComponentNamesProvider

type OptionalComponentNamesProvider interface {
	GetAllOptionalComponentsNames() []string
}

OptionalComponentNamesProvider provides optional components names

type PlanValidator

type PlanValidator interface {
	IsPlanSupport(planID string) bool
}

type PlansSchemaValidator

type PlansSchemaValidator map[string]JSONSchemaValidator

func NewPlansSchemaValidator

func NewPlansSchemaValidator() (PlansSchemaValidator, error)

type ProvisionEndpoint

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

func NewProvision

func NewProvision(cfg Config, operationsStorage storage.Operations, instanceStorage storage.Instances, q Queue, builderFactory PlanValidator, validator PlansSchemaValidator, kvod bool, log logrus.FieldLogger) *ProvisionEndpoint

func (*ProvisionEndpoint) Provision

func (b *ProvisionEndpoint) Provision(ctx context.Context, instanceID string, details domain.ProvisionDetails, asyncAllowed bool) (domain.ProvisionedServiceSpec, error)

Provision creates a new service instance

PUT /v2/service_instances/{instance_id}

type ProvisioningProperties

type ProvisioningProperties struct {
	Components     Type `json:"components"`
	Name           Type `json:"name"`
	DiskType       Type `json:"diskType"`
	VolumeSizeGb   Type `json:"volumeSizeGb"`
	MachineType    Type `json:"machineType"`
	Region         Type `json:"region"`
	Zone           Type `json:"zone"`
	AutoScalerMin  Type `json:"autoScalerMin"`
	AutoScalerMax  Type `json:"autoScalerMax"`
	MaxSurge       Type `json:"maxSurge"`
	MaxUnavailable Type `json:"maxUnavailable"`
}

type Queue

type Queue interface {
	Add(operationId string)
}

type RootSchema

type RootSchema struct {
	Schema string `json:"$schema"`
	Type
	Properties interface{} `json:"properties"`
	Required   []string    `json:"required"`
}

type ServicesEndpoint

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

func NewServices

func NewServices(cfg Config, optComponentsSvc OptionalComponentNamesProvider, log logrus.FieldLogger) *ServicesEndpoint

func (*ServicesEndpoint) Services

func (b *ServicesEndpoint) Services(ctx context.Context) ([]domain.Service, error)

Services gets the catalog of services offered by the service broker

GET /v2/catalog

type Type

type Type struct {
	Type            string        `json:"type"`
	Minimum         int           `json:"minimum,omitempty"`
	Enum            []interface{} `json:"enum,omitempty"`
	Items           []Type        `json:"items,omitempty"`
	AdditionalItems *bool         `json:"additionalItems,omitempty"`
	UniqueItems     *bool         `json:"uniqueItems,omitempty"`
	MinLength       int           `json:"minLength,omitempty"`
}

type UnbindEndpoint

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

func NewUnbind

func NewUnbind(log logrus.FieldLogger) *UnbindEndpoint

func (*UnbindEndpoint) Unbind

func (b *UnbindEndpoint) Unbind(ctx context.Context, instanceID, bindingID string, details domain.UnbindDetails, asyncAllowed bool) (domain.UnbindSpec, error)

Unbind deletes an existing service binding

DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}

type UpdateEndpoint

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

func NewUpdate

func NewUpdate(log logrus.FieldLogger) *UpdateEndpoint

func (*UpdateEndpoint) Update

func (b *UpdateEndpoint) Update(ctx context.Context, instanceID string, details domain.UpdateDetails, asyncAllowed bool) (domain.UpdateServiceSpec, error)

Update modifies an existing service instance

PATCH /v2/service_instances/{instance_id}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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