Documentation ¶
Overview ¶
Package client enables code to make OSBAPI calls
Index ¶
- Constants
- func RunExamplesForService(allExamples []CompleteServiceExample, client *Client, ...)
- func RunExamplesFromFile(client *Client, fileName, serviceName, exampleName string)
- type BrokerResponse
- type Client
- func (client *Client) Bind(instanceID, bindingID, serviceID, planID, requestID string, ...) *BrokerResponse
- func (client *Client) Catalog(requestID string) *BrokerResponse
- func (client *Client) Deprovision(instanceID, serviceID, planID, requestID string) *BrokerResponse
- func (client *Client) LastOperation(instanceID, requestID string) *BrokerResponse
- func (client *Client) Provision(instanceID, serviceID, planID, requestID string, ...) *BrokerResponse
- func (client *Client) Unbind(instanceID, bindingID, serviceID, planID, requestID string) *BrokerResponse
- func (client *Client) Update(instanceID, serviceID, planID, requestID string, parameters json.RawMessage, ...) *BrokerResponse
- type CompleteServiceExample
Examples ¶
Constants ¶
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 RunExamplesForService ¶
func RunExamplesForService(allExamples []CompleteServiceExample, client *Client, serviceName, exampleName string, jobCount int)
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 ¶
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 ¶
func NewClientFromEnv ¶
NewClientFromEnv creates a new client from the client configuration properties.
func (*Client) Bind ¶
func (client *Client) Bind(instanceID, bindingID, serviceID, planID, requestID 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(requestID string) *BrokerResponse
Catalog fetches the service catalog
func (*Client) Deprovision ¶
func (client *Client) Deprovision(instanceID, serviceID, planID, requestID string) *BrokerResponse
Deprovision destroys a service instance of type instanceId
func (*Client) LastOperation ¶
func (client *Client) LastOperation(instanceID, requestID string) *BrokerResponse
LastOperation queries the status of a long-running job on the server
func (*Client) Provision ¶
func (client *Client) Provision(instanceID, serviceID, planID, requestID 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, requestID string) *BrokerResponse
Unbind destroys an account identified by bindingId
func (*Client) Update ¶
func (client *Client) Update(instanceID, serviceID, planID, requestID string, parameters json.RawMessage, previousValues domain.PreviousValues, maintenanceInfo *domain.MaintenanceInfo) *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]any `json:"expected_output"` }
Example (JsonSpec) ¶
allExamples := []CompleteServiceExample{ { ServiceExample: broker.ServiceExample{ Name: "Basic Configuration", Description: "Creates an account with the permission `clouddebugger.agent`.", PlanID: "10866183-a775-49e8-96e3-4e7a901e4a79", ProvisionParams: map[string]any{}, BindParams: map[string]any{}}, ServiceName: "google-stackdriver-debugger", ServiceID: "83837945-1547-41e0-b661-ea31d76eed11", ExpectedOutput: broker.CreateJSONSchema([]broker.BrokerVariable{ { Required: true, FieldName: "Email", Type: "string", Details: "Email address of the service account.", }, }), }, } b, err := json.MarshalIndent(allExamples, "", "\t") if err != nil { panic(err) } os.Stdout.Write(b)
Output:
func FilterMatchingServiceExamples ¶
func FilterMatchingServiceExamples(allExamples []CompleteServiceExample, serviceName, exampleName string) []CompleteServiceExample
FilterMatchingServiceExamples should not be 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)