Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Commit f23a52c

Browse files
authored
Remove ExtensionAPIs from provision response (#154)
- ExtensionAPIs corresponds to an OSBAPI proposal that has since been superceded
1 parent dd98e10 commit f23a52c

File tree

3 files changed

+0
-115
lines changed

3 files changed

+0
-115
lines changed

v2/provision_instance.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ func (c *client) ProvisionInstance(r *ProvisionRequest) (*ProvisionResponse, err
8080
return nil, HTTPStatusCodeError{StatusCode: response.StatusCode, ResponseError: err}
8181
}
8282

83-
if !c.APIVersion.AtLeast(Version2_13()) || !c.EnableAlphaFeatures {
84-
userResponse.ExtensionAPIs = nil
85-
}
86-
8783
return userResponse, nil
8884
case http.StatusAccepted:
8985
if !r.AcceptsIncomplete {

v2/provision_instance_test.go

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -75,51 +75,6 @@ func successProvisionResponseAsync() *ProvisionResponse {
7575

7676
const contextProvisionRequestBody = `{"service_id":"test-service-id","plan_id":"test-plan-id","organization_guid":"test-organization-guid","space_guid":"test-space-guid","context":{"foo":"bar"}}`
7777

78-
const provisionResponseBodyWithExtensions = `{
79-
"extension_apis":[{
80-
"discovery_url": "http://example-openapi-doc.example.com/extensions",
81-
"server_url": "http://myremoteserver.example.com",
82-
"credentials": {
83-
"basic": {
84-
"username": "admin",
85-
"password": "changeme"
86-
},
87-
"api_key": {
88-
"api_key": "some_key_value"
89-
},
90-
"petstore_auth": {
91-
"token": "some_token_value"
92-
}
93-
},
94-
"adheres_to": "http://example-specification.example.com"
95-
}]
96-
}`
97-
98-
func successProvisionResponseWithExtensions() *ProvisionResponse {
99-
response := &ProvisionResponse{}
100-
response.ExtensionAPIs = []ExtensionAPI{
101-
{
102-
DiscoveryURL: "http://example-openapi-doc.example.com/extensions",
103-
ServerURL: "http://myremoteserver.example.com",
104-
Credentials: map[string]interface{}{
105-
"basic": map[string]interface{}{
106-
"username": "admin",
107-
"password": "changeme",
108-
},
109-
"api_key": map[string]interface{}{
110-
"api_key": "some_key_value",
111-
},
112-
"petstore_auth": map[string]interface{}{
113-
"token": "some_token_value",
114-
},
115-
},
116-
AdheresTo: "http://example-specification.example.com",
117-
},
118-
}
119-
120-
return response
121-
}
122-
12378
func TestProvisionInstance(t *testing.T) {
12479
cases := []struct {
12580
name string
@@ -281,35 +236,6 @@ func TestProvisionInstance(t *testing.T) {
281236
},
282237
expectedResponse: successProvisionResponse(),
283238
},
284-
{
285-
name: "success with extension APIs",
286-
version: Version2_13(),
287-
enableAlpha: true,
288-
httpReaction: httpReaction{
289-
status: http.StatusCreated,
290-
body: provisionResponseBodyWithExtensions,
291-
},
292-
expectedResponse: successProvisionResponseWithExtensions(),
293-
},
294-
{
295-
name: "extension APIs shouldn't be returned for < 2.13",
296-
version: Version2_12(),
297-
enableAlpha: true,
298-
httpReaction: httpReaction{
299-
status: http.StatusCreated,
300-
body: provisionResponseBodyWithExtensions,
301-
},
302-
expectedResponse: &ProvisionResponse{},
303-
},
304-
{
305-
name: "extension APIs shouldn't be returned when alpha features disabled",
306-
version: Version2_13(),
307-
httpReaction: httpReaction{
308-
status: http.StatusCreated,
309-
body: provisionResponseBodyWithExtensions,
310-
},
311-
expectedResponse: &ProvisionResponse{},
312-
},
313239
}
314240

315241
for _, tc := range cases {

v2/types.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -225,43 +225,6 @@ type ProvisionResponse struct {
225225
// OperationKey is an extra identifier supplied by the broker to identify
226226
// asynchronous operations.
227227
OperationKey *OperationKey `json:"operation,omitempty"`
228-
// ExtensionAPIs is a list of extension APIs for this instance.
229-
//
230-
// ExtensionsAPI is an ALPHA API attribute and may change. Alpha
231-
// features must be enabled and the client must be using the
232-
// latest API Version in order to use this.
233-
ExtensionAPIs []ExtensionAPI `json:"extension_apis,omitempty"`
234-
}
235-
236-
// ExtensionAPI contains information about an API endpoint that describes
237-
// extension operations on a ServiceInstance.
238-
//
239-
// ExtensionAPI is an ALPHA API attribute and may change. Alpha
240-
// features must be enabled and the client must be using the
241-
// latest API Version in order to use this.
242-
type ExtensionAPI struct {
243-
// DiscoveryURL is a URI pointing to a valid OpenAPI 3.0+ document
244-
// describing the API extension(s) to the Open Service Broker API including,
245-
// endpoints, parameters, authentication mechanism and any other detail the
246-
// platform needs for invocation. The location of the API extension
247-
// endpoint(s) can be local to the Service Broker or on a remote server. If
248-
// local to the Service Broker the same authentication method for normal
249-
// Service Broker calls must be used.
250-
DiscoveryURL string `json:"discovery_url,omitempty"`
251-
// ServerURL is a URI pointing to a remote server where API extensions will
252-
// run. This URI will be used as the basepath for the paths objects
253-
// described by the `discovery_url` OpenAPI document. If ServerURL is
254-
// missing, it means that the paths are invoked relative to the service
255-
// broker URL.
256-
ServerURL string `json:"server_url,omitempty"`
257-
// Credentials is a set of authentication details for running any of the
258-
// extension API calls, especially for those running on remote servers.
259-
//
260-
// The information in Credentials should be treated as SECRET.
261-
Credentials map[string]interface{} `json:"credentials,omitempty"`
262-
// AdheresTo is a URI refering to a specification detailing the interface
263-
// the OpenAPI document hosted at the `discovery_url` adheres to.
264-
AdheresTo string `json:"adheres_to,omitempty"`
265228
}
266229

267230
// OperationKey is an extra identifier from the broker in order to provide extra

0 commit comments

Comments
 (0)