From 6c426d2876b3e72427bbe36e0ac332e274c451b0 Mon Sep 17 00:00:00 2001 From: Ed Cook Date: Wed, 27 May 2020 00:19:44 +0100 Subject: [PATCH] Add Version 2.14 (#146) * Add version 2.14 - Graduate previously alpha features * Fix incorrect version in comment for 2.14 * Update comments for graduated features to show required client version --- README.md | 1 + v2/bind.go | 2 +- v2/bind_test.go | 19 ++++---------- v2/client.go | 16 ++++++++++++ v2/client_test.go | 28 -------------------- v2/errors.go | 15 ++++++++++- v2/get_binding.go | 2 +- v2/get_binding_test.go | 27 ++++++------------- v2/get_instance.go | 2 +- v2/get_instance_test.go | 27 ++++++------------- v2/interface.go | 12 +++------ v2/poll_binding_last_operation.go | 2 +- v2/poll_binding_last_operation_test.go | 36 +++++++------------------- v2/types.go | 28 +++++--------------- v2/unbind.go | 2 +- v2/unbind_test.go | 19 ++++---------- v2/update_instance.go | 4 +-- v2/update_instance_test.go | 27 +++++-------------- v2/version.go | 12 ++++++++- v2/version_test.go | 5 ++-- 20 files changed, 104 insertions(+), 182 deletions(-) diff --git a/README.md b/README.md index 1ab5850..0c32fe1 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ func GetBrokerCatalog(URL string) (*osb.CatalogResponse, error) { This client library supports the following versions of the [Open Service Broker API](https://github.com/openservicebrokerapi/servicebroker): +- [v2.14](https://github.com/openservicebrokerapi/servicebroker/tree/v2.14) - [v2.13](https://github.com/openservicebrokerapi/servicebroker/tree/v2.13) - [v2.12](https://github.com/openservicebrokerapi/servicebroker/tree/v2.12) - [v2.11](https://github.com/openservicebrokerapi/servicebroker/tree/v2.11) diff --git a/v2/bind.go b/v2/bind.go index b68c64c..40eb8a1 100644 --- a/v2/bind.go +++ b/v2/bind.go @@ -48,7 +48,7 @@ const ( func (c *client) Bind(r *BindRequest) (*BindResponse, error) { if r.AcceptsIncomplete { - if err := c.validateAlphaAPIMethodsAllowed(); err != nil { + if err := c.validateClientVersionIsAtLeast(Version2_14()); err != nil { return nil, AsyncBindingOperationsNotAllowedError{ reason: err.Error(), } diff --git a/v2/bind_test.go b/v2/bind_test.go index c730302..48f7fb5 100644 --- a/v2/bind_test.go +++ b/v2/bind_test.go @@ -152,10 +152,9 @@ func TestBind(t *testing.T) { expectedResponse: successBindResponse(), }, { - name: "success - asynchronous", - version: LatestAPIVersion(), - enableAlpha: true, - request: defaultAsyncBindRequest(), + name: "success - asynchronous", + version: Version2_14(), + request: defaultAsyncBindRequest(), httpChecks: httpChecks{ params: map[string]string{ AcceptsIncomplete: "true", @@ -265,19 +264,11 @@ func TestBind(t *testing.T) { }, expectedResponse: successBindResponse(), }, - { - name: "async with alpha features disabled", - version: LatestAPIVersion(), - enableAlpha: false, - request: defaultAsyncBindRequest(), - expectedErrMessage: "Asynchronous binding operations are not allowed: alpha API methods not allowed: alpha features must be enabled", - }, { name: "async with unsupported API version", - version: Version2_12(), - enableAlpha: true, + version: Version2_13(), request: defaultAsyncBindRequest(), - expectedErrMessage: "Asynchronous binding operations are not allowed: alpha API methods not allowed: must have latest API Version. Current: 2.12, Expected: 2.13", + expectedErrMessage: "Asynchronous binding operations are not allowed: operation not allowed: must have API version >= 2.14. Current: 2.13", }, } diff --git a/v2/client.go b/v2/client.go index 9e5fd6d..002a7fe 100644 --- a/v2/client.go +++ b/v2/client.go @@ -302,6 +302,22 @@ func (c *client) validateAlphaAPIMethodsAllowed() error { return nil } +// validateClientVersionIsAtLeast returns an error if client version is not at +// least the specified version +func (c *client) validateClientVersionIsAtLeast(version APIVersion) error { + if !c.APIVersion.AtLeast(version) { + return OperationNotAllowedError{ + reason: fmt.Sprintf( + "must have API version >= %s. Current: %s", + version, + c.APIVersion.label, + ), + } + } + + return nil +} + // drainReader reads and discards the remaining data in reader (for example // response body data) For HTTP this ensures that the http connection // could be reused for another request if the keepalive is enabled. diff --git a/v2/client_test.go b/v2/client_test.go index a890ac5..1595657 100644 --- a/v2/client_test.go +++ b/v2/client_test.go @@ -54,34 +54,6 @@ func testHTTPStatusCodeError() error { } } -func testGetInstanceNotAllowedErrorUnsupportedAPIVersion() error { - e := AlphaAPIMethodsNotAllowedError{ - reason: fmt.Sprintf( - "must have latest API Version. Current: %s, Expected: %s", - Version2_11().label, - LatestAPIVersion().label, - ), - } - - return GetInstanceNotAllowedError{ - reason: e.Error(), - } -} - -func testGetBindingNotAllowedErrorUnsupportedAPIVersion() error { - e := AlphaAPIMethodsNotAllowedError{ - reason: fmt.Sprintf( - "must have latest API Version. Current: %s, Expected: %s", - Version2_11().label, - LatestAPIVersion().label, - ), - } - - return GetBindingNotAllowedError{ - reason: e.Error(), - } -} - func truePtr() *bool { b := true return &b diff --git a/v2/errors.go b/v2/errors.go index cd5d506..25391f7 100644 --- a/v2/errors.go +++ b/v2/errors.go @@ -186,7 +186,7 @@ func IsConcurrencyError(err error) bool { } // AlphaAPIMethodsNotAllowedError is an error type signifying that alpha API -// methods are not allowed for this client's API Version. +// methods are not allowed for this client's API Version or alpha opt-in. type AlphaAPIMethodsNotAllowedError struct { reason string } @@ -198,6 +198,19 @@ func (e AlphaAPIMethodsNotAllowedError) Error() string { ) } +// OperationNotAllowedError is an error type signifying that an operation +// is not allowed for this client. +type OperationNotAllowedError struct { + reason string +} + +func (e OperationNotAllowedError) Error() string { + return fmt.Sprintf( + "operation not allowed: %s", + e.reason, + ) +} + // GetInstanceNotAllowedError is an error type signifying that doing a GET to // fetch a service instance is not allowed for this client. type GetInstanceNotAllowedError struct { diff --git a/v2/get_binding.go b/v2/get_binding.go index 5261640..e2755ee 100644 --- a/v2/get_binding.go +++ b/v2/get_binding.go @@ -22,7 +22,7 @@ import ( ) func (c *client) GetBinding(r *GetBindingRequest) (*GetBindingResponse, error) { - if err := c.validateAlphaAPIMethodsAllowed(); err != nil { + if err := c.validateClientVersionIsAtLeast(Version2_14()); err != nil { return nil, GetBindingNotAllowedError{ reason: err.Error(), } diff --git a/v2/get_binding_test.go b/v2/get_binding_test.go index a689082..7cdf755 100644 --- a/v2/get_binding_test.go +++ b/v2/get_binding_test.go @@ -55,8 +55,7 @@ func TestGetBinding(t *testing.T) { expectedErr error }{ { - name: "success", - enableAlpha: true, + name: "success", httpReaction: httpReaction{ status: http.StatusOK, body: okBindingBytes, @@ -64,16 +63,14 @@ func TestGetBinding(t *testing.T) { expectedResponse: okGetBindingResponse(), }, { - name: "http error", - enableAlpha: true, + name: "http error", httpReaction: httpReaction{ err: fmt.Errorf("http error"), }, expectedErrMessage: "http error", }, { - name: "200 with malformed response", - enableAlpha: true, + name: "200 with malformed response", httpReaction: httpReaction{ status: http.StatusOK, body: malformedResponse, @@ -81,8 +78,7 @@ func TestGetBinding(t *testing.T) { expectedErrMessage: "Status: 200; ErrorMessage: ; Description: ; ResponseError: unexpected end of JSON input", }, { - name: "500 with malformed response", - enableAlpha: true, + name: "500 with malformed response", httpReaction: httpReaction{ status: http.StatusInternalServerError, body: malformedResponse, @@ -90,8 +86,7 @@ func TestGetBinding(t *testing.T) { expectedErrMessage: "Status: 500; ErrorMessage: ; Description: ; ResponseError: unexpected end of JSON input", }, { - name: "500 with conventional response", - enableAlpha: true, + name: "500 with conventional response", httpReaction: httpReaction{ status: http.StatusInternalServerError, body: conventionalFailureResponseBody, @@ -99,15 +94,9 @@ func TestGetBinding(t *testing.T) { expectedErr: testHTTPStatusCodeError(), }, { - name: "alpha features disabled", - enableAlpha: false, - expectedErrMessage: "GetBinding not allowed: alpha API methods not allowed: alpha features must be enabled", - }, - { - name: "unsupported API version", - enableAlpha: true, - APIVersion: Version2_11(), - expectedErr: testGetBindingNotAllowedErrorUnsupportedAPIVersion(), + name: "unsupported API version", + APIVersion: Version2_13(), + expectedErrMessage: "GetBinding not allowed: operation not allowed: must have API version >= 2.14. Current: 2.13", }, } diff --git a/v2/get_instance.go b/v2/get_instance.go index e1410b0..4841c95 100644 --- a/v2/get_instance.go +++ b/v2/get_instance.go @@ -22,7 +22,7 @@ import ( ) func (c *client) GetInstance(r *GetInstanceRequest) (*GetInstanceResponse, error) { - if err := c.validateAlphaAPIMethodsAllowed(); err != nil { + if err := c.validateClientVersionIsAtLeast(Version2_14()); err != nil { return nil, GetInstanceNotAllowedError{ reason: err.Error(), } diff --git a/v2/get_instance_test.go b/v2/get_instance_test.go index 0d7e30a..ca2ce51 100644 --- a/v2/get_instance_test.go +++ b/v2/get_instance_test.go @@ -53,8 +53,7 @@ func TestGetInstance(t *testing.T) { expectedErr error }{ { - name: "success", - enableAlpha: true, + name: "success", httpReaction: httpReaction{ status: http.StatusOK, body: okInstanceBytes, @@ -62,16 +61,14 @@ func TestGetInstance(t *testing.T) { expectedResponse: okGetInstanceResponse(), }, { - name: "http error", - enableAlpha: true, + name: "http error", httpReaction: httpReaction{ err: fmt.Errorf("http error"), }, expectedErrMessage: "http error", }, { - name: "200 with malformed response", - enableAlpha: true, + name: "200 with malformed response", httpReaction: httpReaction{ status: http.StatusOK, body: malformedResponse, @@ -79,8 +76,7 @@ func TestGetInstance(t *testing.T) { expectedErrMessage: "Status: 200; ErrorMessage: ; Description: ; ResponseError: unexpected end of JSON input", }, { - name: "500 with malformed response", - enableAlpha: true, + name: "500 with malformed response", httpReaction: httpReaction{ status: http.StatusInternalServerError, body: malformedResponse, @@ -88,8 +84,7 @@ func TestGetInstance(t *testing.T) { expectedErrMessage: "Status: 500; ErrorMessage: ; Description: ; ResponseError: unexpected end of JSON input", }, { - name: "500 with conventional response", - enableAlpha: true, + name: "500 with conventional response", httpReaction: httpReaction{ status: http.StatusInternalServerError, body: conventionalFailureResponseBody, @@ -97,15 +92,9 @@ func TestGetInstance(t *testing.T) { expectedErr: testHTTPStatusCodeError(), }, { - name: "alpha features disabled", - enableAlpha: false, - expectedErrMessage: "GetInstance not allowed: alpha API methods not allowed: alpha features must be enabled", - }, - { - name: "unsupported API version", - enableAlpha: true, - APIVersion: Version2_11(), - expectedErr: testGetInstanceNotAllowedErrorUnsupportedAPIVersion(), + name: "unsupported API version", + APIVersion: Version2_13(), + expectedErrMessage: "GetInstance not allowed: operation not allowed: must have API version >= 2.14. Current: 2.13", }, } diff --git a/v2/interface.go b/v2/interface.go index fe7257f..640e88b 100644 --- a/v2/interface.go +++ b/v2/interface.go @@ -148,9 +148,7 @@ type Client interface { // there are special semantics for PollLastOperation when checking the // status of deprovision operations; see the doc for that method. DeprovisionInstance(r *DeprovisionRequest) (*DeprovisionResponse, error) - // GetInstance is an ALPHA API method and may change. Alpha features must - // be enabled and the client must be using the latest API Version in - // order to use this method. + // GetInstance requires a client API version >= 2.14. // // GetInstance returns information about an existing instance. // GetInstance calls GET on the Broker's endpoint for the requested @@ -171,9 +169,7 @@ type Client interface { // asynchronous deprovision, callers should test the value of the returned // error with IsGoneError. PollLastOperation(r *LastOperationRequest) (*LastOperationResponse, error) - // PollBindingLastOperation is an ALPHA API method and may change. - // Alpha features must be enabled and the client must be using the - // latest API Version in order to use this method. + // PollBindingLastOperation requires a client API version >= 2.14. // // PollBindingLastOperation sends a request to query the last operation // for a service binding to the broker and returns information about the @@ -199,9 +195,7 @@ type Client interface { // error. Unbind does a DELETE on the Broker's endpoint for the requested // instance and binding IDs (/v2/service_instances/instance-id/service_bindings/binding-id). Unbind(r *UnbindRequest) (*UnbindResponse, error) - // GetBinding is an ALPHA API method and may change. Alpha features must - // be enabled and the client must be using the latest API Version in - // order to use this method. + // GetBinding requires a client API version >= 2.14. // // GetBinding returns configuration and credential information // about an existing binding. GetBindings calls GET on the Broker's diff --git a/v2/poll_binding_last_operation.go b/v2/poll_binding_last_operation.go index 1b0897e..808158c 100644 --- a/v2/poll_binding_last_operation.go +++ b/v2/poll_binding_last_operation.go @@ -22,7 +22,7 @@ import ( ) func (c *client) PollBindingLastOperation(r *BindingLastOperationRequest) (*LastOperationResponse, error) { - if err := c.validateAlphaAPIMethodsAllowed(); err != nil { + if err := c.validateClientVersionIsAtLeast(Version2_14()); err != nil { return nil, AsyncBindingOperationsNotAllowedError{ reason: err.Error(), } diff --git a/v2/poll_binding_last_operation_test.go b/v2/poll_binding_last_operation_test.go index 3b9e6f4..6f086ea 100644 --- a/v2/poll_binding_last_operation_test.go +++ b/v2/poll_binding_last_operation_test.go @@ -47,8 +47,7 @@ func TestPollBindingLastOperation(t *testing.T) { expectedErr error }{ { - name: "op succeeded", - enableAlpha: true, + name: "op succeeded", httpReaction: httpReaction{ status: http.StatusOK, body: successLastOperationResponseBody, @@ -56,8 +55,7 @@ func TestPollBindingLastOperation(t *testing.T) { expectedResponse: successLastOperationResponse(), }, { - name: "op in progress", - enableAlpha: true, + name: "op in progress", httpReaction: httpReaction{ status: http.StatusOK, body: inProgressLastOperationResponseBody, @@ -65,8 +63,7 @@ func TestPollBindingLastOperation(t *testing.T) { expectedResponse: inProgressLastOperationResponse(), }, { - name: "op failed", - enableAlpha: true, + name: "op failed", httpReaction: httpReaction{ status: http.StatusOK, body: failedLastOperationResponseBody, @@ -74,16 +71,14 @@ func TestPollBindingLastOperation(t *testing.T) { expectedResponse: failedLastOperationResponse(), }, { - name: "http error", - enableAlpha: true, + name: "http error", httpReaction: httpReaction{ err: fmt.Errorf("http error"), }, expectedErrMessage: "http error", }, { - name: "200 with malformed response", - enableAlpha: true, + name: "200 with malformed response", httpReaction: httpReaction{ status: http.StatusOK, body: malformedResponse, @@ -91,8 +86,7 @@ func TestPollBindingLastOperation(t *testing.T) { expectedErrMessage: "Status: 200; ErrorMessage: ; Description: ; ResponseError: unexpected end of JSON input", }, { - name: "500 with malformed response", - enableAlpha: true, + name: "500 with malformed response", httpReaction: httpReaction{ status: http.StatusInternalServerError, body: malformedResponse, @@ -100,8 +94,7 @@ func TestPollBindingLastOperation(t *testing.T) { expectedErrMessage: "Status: 500; ErrorMessage: ; Description: ; ResponseError: unexpected end of JSON input", }, { - name: "500 with conventional response", - enableAlpha: true, + name: "500 with conventional response", httpReaction: httpReaction{ status: http.StatusInternalServerError, body: conventionalFailureResponseBody, @@ -109,8 +102,7 @@ func TestPollBindingLastOperation(t *testing.T) { expectedErr: testHTTPStatusCodeError(), }, { - name: "op succeeded", - enableAlpha: true, + name: "op succeeded", httpReaction: httpReaction{ status: http.StatusOK, body: successLastOperationResponseBody, @@ -119,7 +111,6 @@ func TestPollBindingLastOperation(t *testing.T) { }, { name: "originating identity included", - enableAlpha: true, originatingIdentity: testOriginatingIdentity, httpChecks: httpChecks{headers: map[string]string{OriginatingIdentityHeader: testOriginatingIdentityHeaderValue}}, httpReaction: httpReaction{ @@ -130,7 +121,6 @@ func TestPollBindingLastOperation(t *testing.T) { }, { name: "originating identity excluded", - enableAlpha: true, originatingIdentity: nil, httpChecks: httpChecks{headers: map[string]string{OriginatingIdentityHeader: ""}}, httpReaction: httpReaction{ @@ -139,16 +129,10 @@ func TestPollBindingLastOperation(t *testing.T) { }, expectedResponse: successLastOperationResponse(), }, - { - name: "alpha features disabled", - enableAlpha: false, - expectedErrMessage: "Asynchronous binding operations are not allowed: alpha API methods not allowed: alpha features must be enabled", - }, { name: "unsupported API version", - enableAlpha: true, - APIVersion: Version2_12(), - expectedErrMessage: "Asynchronous binding operations are not allowed: alpha API methods not allowed: must have latest API Version. Current: 2.12, Expected: 2.13", + APIVersion: Version2_13(), + expectedErrMessage: "Asynchronous binding operations are not allowed: operation not allowed: must have API version >= 2.14. Current: 2.13", }, } diff --git a/v2/types.go b/v2/types.go index 71a87e8..f2f52b9 100644 --- a/v2/types.go +++ b/v2/types.go @@ -293,9 +293,7 @@ type UpdateInstanceResponse struct { // Async indicates whether the broker is handling the update request // asynchronously. Async bool `json:"async"` - // DashboardURL is an ALPHA API attribute and may change. Alpha - // features must be enabled and the client must be using the latest - // API Version in order to use this. + // DashboardURL requires a client API version >= 2.14. // // DashboardURL is the URL of a web-based management user interface for // the service instance. @@ -435,9 +433,7 @@ type BindRequest struct { BindingID string `json:"binding_id"` // InstanceID is the ID of the instance to bind to. InstanceID string `json:"instance_id"` - // AcceptsIncomplete is an ALPHA API attribute and may change. Alpha - // features must be enabled and the client must be using the latest API - // Version in order to use this. + // AcceptsIncomplete requires a client API version >= 2.14. // // AcceptsIncomplete indicates whether the client can accept asynchronous // binding. If the broker cannot fulfill a request synchronously and @@ -477,9 +473,7 @@ type BindResource struct { // BindResponse represents a broker's response to a BindRequest. type BindResponse struct { - // Async is an ALPHA API attribute and may change. Alpha - // features must be enabled and the client must be using the - // latest API Version in order to use this. + // Async requires a client API version >= 2.14. // // Async indicates whether the broker is handling the bind request // asynchronously. @@ -500,9 +494,7 @@ type BindResponse struct { // CF-specific. May only be supplied by a service that declares a // requirement for the 'volume_mount' permission. VolumeMounts []interface{} `json:"volume_mounts,omitempty"` - // OperationKey is an ALPHA API attribute and may change. Alpha - // features must be enabled and the client must be using the - // latest API Version in order to use this. + // OperationKey requires a client API version >= 2.14. // // OperationKey is an extra identifier supplied by the broker to identify // asynchronous operations. @@ -515,9 +507,7 @@ type UnbindRequest struct { InstanceID string `json:"instance_id"` // BindingID is the ID of the binding to delete. BindingID string `json:"binding_id"` - // AcceptsIncomplete is an ALPHA API attribute and may change. Alpha - // features must be enabled and the client must be using the latest API - // Version in order to use this. + // AcceptsIncomplete requires a client API version >= 2.14. // // AcceptsIncomplete indicates whether the client can accept asynchronous // unbinding. If the broker cannot fulfill a request synchronously and @@ -538,16 +528,12 @@ type UnbindRequest struct { // UnbindResponse represents a broker's response to an UnbindRequest. type UnbindResponse struct { - // Async is an ALPHA API attribute and may change. Alpha features must be - // enabled and the client must be using the latest API Version in order to - // use this. + // Async requires a client API version >= 2.14. // // Async indicates whether the broker is handling the unbind request // asynchronously. Async bool `json:"async"` - // OperationKey is an ALPHA API attribute and may change. Alpha features - // must be enabled and the client must be using the latest API Version in - // order to use this. + // OperationKey requires a client API version >= 2.14. // // OperationKey is an extra identifier supplied by the broker to identify // asynchronous operations. diff --git a/v2/unbind.go b/v2/unbind.go index def6bb7..e28beb2 100644 --- a/v2/unbind.go +++ b/v2/unbind.go @@ -29,7 +29,7 @@ type unbindSuccessResponseBody struct { func (c *client) Unbind(r *UnbindRequest) (*UnbindResponse, error) { if r.AcceptsIncomplete { - if err := c.validateAlphaAPIMethodsAllowed(); err != nil { + if err := c.validateClientVersionIsAtLeast(Version2_14()); err != nil { return nil, AsyncBindingOperationsNotAllowedError{ reason: err.Error(), } diff --git a/v2/unbind_test.go b/v2/unbind_test.go index 70e9aa3..8ad4bcf 100644 --- a/v2/unbind_test.go +++ b/v2/unbind_test.go @@ -85,10 +85,9 @@ func TestUnbind(t *testing.T) { expectedResponse: successUnbindResponse(), }, { - name: "success - asynchronous", - version: LatestAPIVersion(), - enableAlpha: true, - request: defaultAsyncUnbindRequest(), + name: "success - asynchronous", + version: LatestAPIVersion(), + request: defaultAsyncUnbindRequest(), httpChecks: httpChecks{ params: map[string]string{ AcceptsIncomplete: "true", @@ -172,19 +171,11 @@ func TestUnbind(t *testing.T) { }, expectedResponse: successUnbindResponse(), }, - { - name: "async with alpha features disabled", - version: LatestAPIVersion(), - enableAlpha: false, - request: defaultAsyncUnbindRequest(), - expectedErrMessage: "Asynchronous binding operations are not allowed: alpha API methods not allowed: alpha features must be enabled", - }, { name: "async with unsupported API version", - version: Version2_12(), - enableAlpha: true, + version: Version2_13(), request: defaultAsyncUnbindRequest(), - expectedErrMessage: "Asynchronous binding operations are not allowed: alpha API methods not allowed: must have latest API Version. Current: 2.12, Expected: 2.13", + expectedErrMessage: "Asynchronous binding operations are not allowed: operation not allowed: must have API version >= 2.14. Current: 2.13", }, } diff --git a/v2/update_instance.go b/v2/update_instance.go index 4b29c12..085b612 100644 --- a/v2/update_instance.go +++ b/v2/update_instance.go @@ -79,7 +79,7 @@ func (c *client) UpdateInstance(r *UpdateInstanceRequest) (*UpdateInstanceRespon Async: false, OperationKey: nil, } - if c.validateAlphaAPIMethodsAllowed() == nil { + if c.APIVersion.AtLeast(Version2_14()) { userResponse.DashboardURL = responseBodyObj.DashboardURL } @@ -107,7 +107,7 @@ func (c *client) UpdateInstance(r *UpdateInstanceRequest) (*UpdateInstanceRespon Async: true, OperationKey: opPtr, } - if c.validateAlphaAPIMethodsAllowed() == nil { + if c.APIVersion.AtLeast(Version2_14()) { userResponse.DashboardURL = responseBodyObj.DashboardURL } diff --git a/v2/update_instance_test.go b/v2/update_instance_test.go index b1c4653..27a56de 100644 --- a/v2/update_instance_test.go +++ b/v2/update_instance_test.go @@ -264,9 +264,8 @@ func TestUpdateInstanceInstance(t *testing.T) { expectedResponse: successUpdateInstanceResponse(), }, { - name: "success with updated dashboard url - ok if alpha API features are enabled", - version: LatestAPIVersion(), - enableAlpha: true, + name: "success with updated dashboard url - ok", + version: LatestAPIVersion(), httpReaction: httpReaction{ status: http.StatusOK, body: successUpdateInstanceResponseBodyWithNewDashboardURL, @@ -274,10 +273,9 @@ func TestUpdateInstanceInstance(t *testing.T) { expectedResponse: successUpdateInstanceResponseWithDashboard(), }, { - name: "success with updated dashboard url - async if alpha API features are enabled", - version: LatestAPIVersion(), - enableAlpha: true, - request: defaultAsyncUpdateInstanceRequest(), + name: "success with updated dashboard url - async", + version: LatestAPIVersion(), + request: defaultAsyncUpdateInstanceRequest(), httpChecks: httpChecks{ params: map[string]string{ AcceptsIncomplete: "true", @@ -290,19 +288,8 @@ func TestUpdateInstanceInstance(t *testing.T) { expectedResponse: successUpdateInstanceResponeAsyncWithDashboard(), }, { - name: "dashboard url not sent unless alpha API features enabled", - version: LatestAPIVersion(), - enableAlpha: false, - httpReaction: httpReaction{ - status: http.StatusOK, - body: successUpdateInstanceResponseBodyWithNewDashboardURL, - }, - expectedResponse: successUpdateInstanceResponse(), - }, - { - name: "dashboard url not sent unless latest version of the API is used", - version: Version2_12(), - enableAlpha: true, + name: "dashboard url not sent unless API version >= 2.14", + version: Version2_13(), httpReaction: httpReaction{ status: http.StatusOK, body: successUpdateInstanceResponseBodyWithNewDashboardURL, diff --git a/v2/version.go b/v2/version.go index 954090d..2a2bee5 100644 --- a/v2/version.go +++ b/v2/version.go @@ -41,7 +41,7 @@ func (v APIVersion) String() string { // LatestAPIVersion returns the latest supported API version in the current // release of this library. func LatestAPIVersion() APIVersion { - return Version2_13() + return Version2_14() } // APIVersions returns a list of the APIVersions supported by this library, with @@ -51,6 +51,7 @@ func APIVersions() []APIVersion { Version2_11(), Version2_12(), Version2_13(), + Version2_14(), } } @@ -66,6 +67,10 @@ const ( // internalAPIVersion2_13 represents the 2.13 version of the Open Service // Broker API. internalAPIVersion2_13 = "2.13" + + // internalAPIVersion2_14 represents the 2.14 version of the Open Service + // Broker API. + internalAPIVersion2_14 = "2.14" ) //Version2_11 returns an APIVersion struct with the internal API version set to "2.11" @@ -82,3 +87,8 @@ func Version2_12() APIVersion { func Version2_13() APIVersion { return APIVersion{label: internalAPIVersion2_13, order: 2} } + +//Version2_14 returns an APIVersion struct with the internal API version set to "2.14" +func Version2_14() APIVersion { + return APIVersion{label: internalAPIVersion2_14, order: 3} +} diff --git a/v2/version_test.go b/v2/version_test.go index 7ec4ab7..cbe8d12 100644 --- a/v2/version_test.go +++ b/v2/version_test.go @@ -34,8 +34,7 @@ func TestAtLeast(t *testing.T) { } func TestLatestAPIVersion(t *testing.T) { - - if LatestAPIVersion() != Version2_13() { - t.Error("Unexpected Latest API Version--expected 2.13") + if LatestAPIVersion() != Version2_14() { + t.Error("Unexpected Latest API Version--expected 2.14") } }