client

package
v5.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// ClientsBrokerApiVersion is the minimum supported version of the client.
	// Note: This may need to be changed in the future as we use newer versions
	// of the OSB API, but should be kept near the lower end of the systems we
	// expect to be compatible with to ensure any reverse-compatibility measures
	// put in place work.
	ClientsBrokerApiVersion = "2.13"
)

Variables

This section is empty.

Functions

func RunExample

func RunExample(client *Client, serviceExample CompleteServiceExample) error

RunExample runs a single example against the given service on the broker pointed to by client.

func RunExamplesForService

func RunExamplesForService(allExamples []CompleteServiceExample, client *Client, serviceName, exampleName string) error

RunExamplesForService runs all the examples for a given service name against the service broker pointed to by client. All examples in the registry get run if serviceName is blank. If exampleName is non-blank then only the example with the given name is run.

func RunExamplesFromFile

func RunExamplesFromFile(client *Client, fileName, serviceName, exampleName string) error

RunExamplesFromFile reads a json-encoded list of CompleteServiceExamples. All examples in the list get run if serviceName is blank. If exampleName is non-blank then only the example with the given name is run.

Types

type BrokerResponse

type BrokerResponse struct {
	// WARNING: BrokerResponse is exposed to users and automated tooling
	// so DO NOT remove or rename fields unless strictly necessary.
	// You MAY add new fields.
	Error        error           `json:"error,omitempty"`
	Url          string          `json:"url,omitempty"`
	Method       string          `json:"http_method,omitempty"`
	StatusCode   int             `json:"status_code,omitempty"`
	ResponseBody json.RawMessage `json:"response,omitempty"`
}

BrokerResponse encodes an OSB HTTP response in a (technical) human and machine readable way.

func (*BrokerResponse) InError

func (br *BrokerResponse) InError() bool

func (*BrokerResponse) String

func (br *BrokerResponse) String() string

func (*BrokerResponse) UpdateError

func (br *BrokerResponse) UpdateError(err error)

func (*BrokerResponse) UpdateRequest

func (br *BrokerResponse) UpdateRequest(req *http.Request)

func (*BrokerResponse) UpdateResponse

func (br *BrokerResponse) UpdateResponse(res *http.Response)

type Client

type Client struct {
	BaseUrl *url.URL
}

func New

func New(username, password, hostname string, port int) (*Client, error)

New creates a new OSB Client connected to the given resource.

func NewClientFromEnv

func NewClientFromEnv() (*Client, error)

NewClientFromEnv creates a new client from the client configuration properties.

func (*Client) Bind

func (client *Client) Bind(instanceId, bindingId, serviceId, planId string, parameters json.RawMessage) *BrokerResponse

Bind creates an account identified by bindingId and gives it access to instanceId

func (*Client) Catalog

func (client *Client) Catalog() *BrokerResponse

Catalog fetches the service catalog

func (*Client) Deprovision

func (client *Client) Deprovision(instanceId, serviceId, planId string) *BrokerResponse

Deprovision destroys a service instance of type instanceId

func (*Client) LastOperation

func (client *Client) LastOperation(instanceId string) *BrokerResponse

LastOperation queries the status of a long-running job on the server

func (*Client) Provision

func (client *Client) Provision(instanceId, serviceId, planId string, provisioningDetails json.RawMessage) *BrokerResponse

Provision creates a new service with the given instanceId, of type serviceId, from the plan planId, with additional details provisioningDetails

func (*Client) Unbind

func (client *Client) Unbind(instanceId, bindingId, serviceId, planId string) *BrokerResponse

Unbind destroys an account identified by bindingId

func (*Client) Update

func (client *Client) Update(instanceId, serviceId, planId string, parameters json.RawMessage) *BrokerResponse

Update sends a patch request to change the plan

type CompleteServiceExample

type CompleteServiceExample struct {
	broker.ServiceExample `json: ",inline"`
	ServiceName           string                 `json: "service_name"`
	ServiceId             string                 `json: "service_id"`
	ExpectedOutput        map[string]interface{} `json: "expected_output"`
}

func FilterMatchingServiceExamples

func FilterMatchingServiceExamples(allExamples []CompleteServiceExample, serviceName, exampleName string) []CompleteServiceExample

Do not run example if: 1. The service name is specified and does not match the current example's ServiceName 2. The service name is specified and matches the current example's ServiceName, and the example name is specified and does not match the current example's ExampleName

func GetExamplesForAService

func GetExamplesForAService(service *broker.ServiceDefinition) ([]CompleteServiceExample, error)

Jump to

Keyboard shortcuts

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