sm

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIInternalBrokers is the SM API for obtaining the brokers for this proxy
	APIInternalBrokers = "%s" + web.BrokersURL

	// APIVisibilities is the SM API for obtaining plan visibilities
	APIVisibilities = "%s" + web.VisibilitiesURL

	// APIPlans is the SM API for obtaining service plans
	APIPlans = "%s" + web.ServicePlansURL

	// APIServiceOfferings is the SM API for obtaining service offerings
	APIServiceOfferings = "%s" + web.ServiceOfferingsURL
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuthTransport

type BasicAuthTransport struct {
	Username string
	Password string

	Rt http.RoundTripper
}

BasicAuthTransport implements http.RoundTripper interface and intercepts that request that is being sent, adding basic authorization and delegates back to the original transport.

func (*BasicAuthTransport) RoundTrip

func (b *BasicAuthTransport) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTrip and adds basic authorization header before delegating to the underlying RoundTripper

type Broker

type Broker struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	BrokerURL string `json:"broker_url"`

	ServiceOfferings []types.ServiceOffering    `json:"services"`
	Metadata         map[string]json.RawMessage `json:"metadata,omitempty"`
}

Broker type used for responses from the Service Manager client

type Brokers

type Brokers struct {
	Brokers []Broker `json:"service_brokers"`
}

Brokers type used for responses from the Service Manager client

type Client

type Client interface {
	GetBrokers(ctx context.Context) ([]Broker, error)
	GetVisibilities(ctx context.Context) ([]*types.Visibility, error)
	GetPlans(ctx context.Context) ([]*types.ServicePlan, error)
	GetServiceOfferingsByBrokerIDs(ctx context.Context, brokerIDs []string) ([]*types.ServiceOffering, error)
	GetPlansByServiceOfferings(ctx context.Context, sos []*types.ServiceOffering) ([]*types.ServicePlan, error)
}

Client provides the logic for calling into the Service Manager

type ServiceManagerClient added in v0.1.1

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

ServiceManagerClient allows consuming Service Manager APIs

func NewClient

func NewClient(config *Settings) (*ServiceManagerClient, error)

NewClient builds a new Service Manager Client from the provided configuration

func (*ServiceManagerClient) GetBrokers added in v0.1.1

func (c *ServiceManagerClient) GetBrokers(ctx context.Context) ([]Broker, error)

GetBrokers calls the Service Manager in order to obtain all brokers that need to be registered in the service broker proxy

func (*ServiceManagerClient) GetPlans added in v0.2.0

func (c *ServiceManagerClient) GetPlans(ctx context.Context) ([]*types.ServicePlan, error)

GetPlans returns plans from Service Manager

func (*ServiceManagerClient) GetPlansByServiceOfferings added in v0.3.0

func (c *ServiceManagerClient) GetPlansByServiceOfferings(ctx context.Context, sos []*types.ServiceOffering) ([]*types.ServicePlan, error)

GetPlansByServiceOfferings returns plans from Service Manager

func (*ServiceManagerClient) GetServiceOfferingsByBrokerIDs added in v0.3.0

func (c *ServiceManagerClient) GetServiceOfferingsByBrokerIDs(ctx context.Context, brokerIDs []string) ([]*types.ServiceOffering, error)

GetServiceOfferingsByBrokerIDs returns plans from Service Manager

func (*ServiceManagerClient) GetVisibilities added in v0.2.0

func (c *ServiceManagerClient) GetVisibilities(ctx context.Context) ([]*types.Visibility, error)

GetVisibilities returns plan visibilities from Service Manager

type Settings

type Settings struct {
	User              string
	Password          string
	URL               string
	OSBAPIPath        string        `mapstructure:"osb_api_path"`
	RequestTimeout    time.Duration `mapstructure:"request_timeout"`
	ResyncPeriod      time.Duration `mapstructure:"resync_period"`
	SkipSSLValidation bool          `mapstructure:"skip_ssl_validation"`

	Transport http.RoundTripper
}

Settings type holds SM Client config properties

func DefaultSettings

func DefaultSettings() *Settings

DefaultSettings builds a default Service Manager Settings

func NewSettings

func NewSettings(env env.Environment) (*Settings, error)

NewSettings builds a Service Manager Settings from the provided Environment

func (*Settings) Validate

func (c *Settings) Validate() error

Validate validates the configuration and returns appropriate errors in case it is invalid

type SkipSSLTransport

type SkipSSLTransport struct {
	SkipSslValidation bool

	Rt http.RoundTripper
}

SkipSSLTransport implements http.RoundTripper and sets the SSL Validation to match the provided property

func (*SkipSSLTransport) RoundTrip

func (b *SkipSSLTransport) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTrip and adds skip SSL validation logic

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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