servicemanager

package
v0.0.0-...-dc8ed20 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: Apache-2.0, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FakeEmsServiceID = "fake-ems-svc-id"
)

Variables

This section is empty.

Functions

func NewFakeServiceManagerClientFactory

func NewFakeServiceManagerClientFactory(offerings []types.ServiceOffering, plans []types.ServicePlan) *fakeServiceManagerClientFactory

func NewPassthroughServiceManagerClientFactory

func NewPassthroughServiceManagerClientFactory(cli Client) *passthroughServiceManagerClientFactory

Types

type Binding

type Binding struct {
	Credentials map[string]interface{} `json:"credentials"`
}

type BindingResponse

type BindingResponse struct {
	Binding
	HTTPResponse
}

type Client

type Client interface {
	ListOfferings() (*types.ServiceOfferings, error)
	ListOfferingsByName(name string) (*types.ServiceOfferings, error)
	ListPlansByName(planName, offeringID string) (*types.ServicePlans, error)
	Provision(brokerID string, request ProvisioningInput, acceptsIncomplete bool) (*ProvisionResponse, error)
	Deprovision(instanceKey InstanceKey, acceptsIncomplete bool) (*DeprovisionResponse, error)
	Bind(instanceKey InstanceKey, bindingID string, parameters interface{}, acceptsIncomplete bool) (*BindingResponse, error)
	Unbind(instanceKey InstanceKey, bindingID string, acceptsIncomplete bool) (*DeprovisionResponse, error)
	LastInstanceOperation(key InstanceKey, operationID string) (LastOperationResponse, error)
}

func New

func New(credentials Credentials) Client

func NewWithHttpClient

func NewWithHttpClient(credentials Credentials, httpClient *http.Client) Client

type ClientFactory

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

func NewClientFactory

func NewClientFactory(cfg Config) *ClientFactory

func (*ClientFactory) ForCredentials

func (f *ClientFactory) ForCredentials(credentials *Credentials) Client

put here methods which creates SM client for different Credentials ...

func (*ClientFactory) ForCustomerCredentials

func (f *ClientFactory) ForCustomerCredentials(reqCredentials *Credentials, log logrus.FieldLogger) (Client, error)

ForCustomerCredentials provides a client with request Credentials (see internal.ProvisioningParameters.ErsContext). Those Credentials could be overridden based on KEB configuration (OverrideMode).

func (*ClientFactory) ProvideCredentials

func (f *ClientFactory) ProvideCredentials(reqCredentials *Credentials, log logrus.FieldLogger) (*Credentials, error)

type Config

type Config struct {
	OverrideMode ServiceManagerOverrideMode `envconfig:"default=Never"`
	URL          string
	Password     string
	Username     string
}

type Credentials

type Credentials struct {
	Username string
	Password string
	URL      string
}

func (Credentials) WithNormalizedURL

func (c Credentials) WithNormalizedURL() Credentials

type DeprovisionResponse

type DeprovisionResponse struct {
	OperationResponse
	HTTPResponse
}

type HTTPResponse

type HTTPResponse struct {
	StatusCode int
}

func (*HTTPResponse) IsDone

func (pr *HTTPResponse) IsDone() bool

func (*HTTPResponse) IsInProgress

func (pr *HTTPResponse) IsInProgress() bool

type InstanceKey

type InstanceKey struct {
	BrokerID   string
	InstanceID string
	ServiceID  string
	PlanID     string
}

InstanceKey contains all identifiers which allows us to perform all actions on an instance: - bind - unbind - deprovision

type LastOperationResponse

type LastOperationResponse struct {
	State       LastOperationState `json:"state"`
	Description string             `json:"description"`
}

type LastOperationState

type LastOperationState string
const (
	InProgress LastOperationState = "in progress"
	Succeeded  LastOperationState = "succeeded"
	Failed     LastOperationState = "failed"
)

type Metadata

type Metadata struct {
	ServiceID string
	BrokerID  string
	PlanID    string
}

func GenerateMetadata

func GenerateMetadata(c Client, offeringName, planName string) (*Metadata, error)

type OperationResponse

type OperationResponse struct {
	OperationID string `json:"operation"`
}

func (*OperationResponse) GetOperationID

func (pr *OperationResponse) GetOperationID() string

type ProvisionRequest

type ProvisionRequest struct {
	ServiceID  string                 `json:"service_id"`
	PlanID     string                 `json:"plan_id"`
	Parameters interface{}            `json:"parameters,omitempty"`
	Context    map[string]interface{} `json:"context,omitempty"`

	OrganizationGUID string `json:"organization_guid"`
	SpaceGUID        string `json:"space_guid"`
}

type ProvisionResponse

type ProvisionResponse struct {
	ProvisionResponseBody
	HTTPResponse
}

type ProvisionResponseBody

type ProvisionResponseBody struct {
	OperationResponse `json:""`
	Async             bool    `json:"async"`
	DashboardURL      *string `json:"dashboard_url,omitempty"`
}

type ProvisioningInput

type ProvisioningInput struct {
	ProvisionRequest
	ID string
}

ProvisioningInput aggregates provisioning parameters

type ServiceManagerOverrideMode

type ServiceManagerOverrideMode string
const (
	SMOverrideModeAlways               ServiceManagerOverrideMode = "Always"
	SMOverrideModeWhenNotSentInRequest ServiceManagerOverrideMode = "WhenNotSentInRequest"
	SMOverrideModeNever                ServiceManagerOverrideMode = "Never"
)

func (ServiceManagerOverrideMode) IsUnknown

func (m ServiceManagerOverrideMode) IsUnknown() bool

func (ServiceManagerOverrideMode) Names

func (*ServiceManagerOverrideMode) Unmarshal

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

Unmarshal provides custom parsing of service manager credential mode. Implements envconfig.Unmarshal interface.

type UnbindResponse

type UnbindResponse struct {
	OperationResponse
	HTTPResponse
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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