From 588de80419988e1f1171d895d1a638ede1b775cc Mon Sep 17 00:00:00 2001 From: Jack Newberry Date: Wed, 19 Dec 2018 14:34:36 +0000 Subject: [PATCH] Add MaintenanceInfo to provision request struct [#162013007] --- api_test.go | 18 ++++++++++++++++++ service_broker.go | 29 +++++++++++++++-------------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/api_test.go b/api_test.go index 872b8e43..17aba6d2 100644 --- a/api_test.go +++ b/api_test.go @@ -348,6 +348,12 @@ var _ = Describe("Service Broker API", func() { "plan_id": "plan-id", "organization_guid": "organization-guid", "space_guid": "space-guid", + "maintenance_info": map[string]interface{}{ + "public": map[string]string{ + "k8s-version": "0.0.1-alpha2", + }, + "private": "just a sha thing", + }, } }) @@ -358,6 +364,12 @@ var _ = Describe("Service Broker API", func() { PlanID: "plan-id", OrganizationGUID: "organization-guid", SpaceGUID: "space-guid", + MaintenanceInfo: brokerapi.MaintenanceInfo{ + Public: map[string]string{ + "k8s-version": "0.0.1-alpha2", + }, + Private: "just a sha thing", + }, })) }) @@ -630,6 +642,12 @@ var _ = Describe("Service Broker API", func() { PlanID: "plan-id", OrganizationGUID: "organization-guid", SpaceGUID: "space-guid", + MaintenanceInfo: brokerapi.MaintenanceInfo{ + Public: map[string]string{ + "k8s-version": "0.0.1-alpha2", + }, + Private: "just a sha thing", + }, })) Expect(fakeServiceBroker.ProvisionedInstanceIDs).To(ContainElement(instanceID)) diff --git a/service_broker.go b/service_broker.go index be7f71e7..45ff091d 100644 --- a/service_broker.go +++ b/service_broker.go @@ -74,6 +74,7 @@ type ProvisionDetails struct { SpaceGUID string `json:"space_guid"` RawContext json.RawMessage `json:"context,omitempty"` RawParameters json.RawMessage `json:"parameters,omitempty"` + MaintenanceInfo MaintenanceInfo `json:"maintenance_info,omitempty"` } type ProvisionedServiceSpec struct { @@ -197,20 +198,20 @@ type SharedDevice struct { } const ( - instanceExistsMsg = "instance already exists" - instanceDoesntExistMsg = "instance does not exist" - serviceLimitReachedMsg = "instance limit for this service has been reached" - servicePlanQuotaExceededMsg = "The quota for this service plan has been exceeded. Please contact your Operator for help." - serviceQuotaExceededMsg = "The quota for this service has been exceeded. Please contact your Operator for help." - bindingExistsMsg = "binding already exists" - bindingDoesntExistMsg = "binding does not exist" - bindingNotFoundMsg = "binding cannot be fetched" - asyncRequiredMsg = "This service plan requires client support for asynchronous service operations." - planChangeUnsupportedMsg = "The requested plan migration cannot be performed" - rawInvalidParamsMsg = "The format of the parameters is not valid JSON" - appGuidMissingMsg = "app_guid is a required field but was not provided" - concurrentInstanceAccessMsg = "instance is being updated and cannot be retrieved" - maintenanceInfoConflictMsg = "passed maintenance_info does not match the catalog maintenance_info" + instanceExistsMsg = "instance already exists" + instanceDoesntExistMsg = "instance does not exist" + serviceLimitReachedMsg = "instance limit for this service has been reached" + servicePlanQuotaExceededMsg = "The quota for this service plan has been exceeded. Please contact your Operator for help." + serviceQuotaExceededMsg = "The quota for this service has been exceeded. Please contact your Operator for help." + bindingExistsMsg = "binding already exists" + bindingDoesntExistMsg = "binding does not exist" + bindingNotFoundMsg = "binding cannot be fetched" + asyncRequiredMsg = "This service plan requires client support for asynchronous service operations." + planChangeUnsupportedMsg = "The requested plan migration cannot be performed" + rawInvalidParamsMsg = "The format of the parameters is not valid JSON" + appGuidMissingMsg = "app_guid is a required field but was not provided" + concurrentInstanceAccessMsg = "instance is being updated and cannot be retrieved" + maintenanceInfoConflictMsg = "passed maintenance_info does not match the catalog maintenance_info" maintenanceInfoNilConflictMsg = "maintenance_info was passed, but the broker catalog contains no maintenance_info" )