Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion pkg/brokerapi/openservicebroker/open_service_broker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,35 @@ func (c *openServiceBrokerClient) GetCatalog() (*brokerapi.Catalog, error) {
return &catalog, nil
}

type createServiceInstanceRequestBody struct {
ServiceID string `json:"service_id,omitempty"`
PlanID string `json:"plan_id,omitempty"`
OrgID string `json:"organization_guid,omitempty"`
SpaceID string `json:"space_guid,omitempty"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
ContextProfile brokerapi.ContextProfile `json:"context,omitempty"`
}

func (c *openServiceBrokerClient) CreateServiceInstance(ID string, req *brokerapi.CreateServiceInstanceRequest) (*brokerapi.CreateServiceInstanceResponse, int, error) {
serviceInstanceURL := fmt.Sprintf(serviceInstanceFormatString, c.url, ID)

requestBody := &createServiceInstanceRequestBody{
ServiceID: req.ServiceID,
PlanID: req.PlanID,
OrgID: req.OrgID,
SpaceID: req.SpaceID,
Parameters: req.Parameters,
ContextProfile: req.ContextProfile,
}

resp, err := sendOSBRequest(
c,
http.MethodPut,
serviceInstanceURL,
map[string]string{
"accepts_incomplete": fmt.Sprintf("%t", req.AcceptsIncomplete),
},
req,
requestBody,
)
if err != nil {
glog.Errorf("Error sending create service instance request to broker %q at %v: response: %v error: %#v", c.name, serviceInstanceURL, resp, err)
Expand Down