diff --git a/domain/apiresponses/responses.go b/domain/apiresponses/responses.go index faad51bd..cd97d9b4 100644 --- a/domain/apiresponses/responses.go +++ b/domain/apiresponses/responses.go @@ -67,6 +67,7 @@ type BindingResponse struct { RouteServiceURL string `json:"route_service_url,omitempty"` VolumeMounts []domain.VolumeMount `json:"volume_mounts,omitempty"` BackupAgentURL string `json:"backup_agent_url,omitempty"` + Metadata any `json:"metadata,omitempty"` } type GetBindingResponse struct { diff --git a/domain/service_broker.go b/domain/service_broker.go index 3a9f3490..cf896aae 100644 --- a/domain/service_broker.go +++ b/domain/service_broker.go @@ -190,14 +190,20 @@ type UnbindSpec struct { } type Binding struct { - IsAsync bool `json:"is_async"` - AlreadyExists bool `json:"already_exists"` - OperationData string `json:"operation_data"` - Credentials interface{} `json:"credentials"` - SyslogDrainURL string `json:"syslog_drain_url"` - RouteServiceURL string `json:"route_service_url"` - BackupAgentURL string `json:"backup_agent_url,omitempty"` - VolumeMounts []VolumeMount `json:"volume_mounts"` + IsAsync bool `json:"is_async"` + AlreadyExists bool `json:"already_exists"` + OperationData string `json:"operation_data"` + Credentials interface{} `json:"credentials"` + SyslogDrainURL string `json:"syslog_drain_url"` + RouteServiceURL string `json:"route_service_url"` + BackupAgentURL string `json:"backup_agent_url,omitempty"` + VolumeMounts []VolumeMount `json:"volume_mounts"` + Metadata BindingMetadata `json:"metadata,omitempty"` +} + +type BindingMetadata struct { + ExpiresAt string `json:"expires_at,omitempty"` + RenewBefore string `json:"renew_before,omitempty"` } type GetBindingSpec struct { @@ -206,6 +212,7 @@ type GetBindingSpec struct { RouteServiceURL string VolumeMounts []VolumeMount Parameters interface{} + Metadata BindingMetadata } func (d ProvisionDetails) GetRawContext() json.RawMessage { @@ -228,6 +235,10 @@ func (m InstanceMetadata) IsEmpty() bool { return len(m.Attributes) == 0 && len(m.Labels) == 0 } +func (m BindingMetadata) IsEmpty() bool { + return len(m.ExpiresAt) == 0 && len(m.RenewBefore) == 0 +} + func (d UpdateDetails) GetRawContext() json.RawMessage { return d.RawContext } diff --git a/handlers/bind.go b/handlers/bind.go index b6f5abca..615c4698 100644 --- a/handlers/bind.go +++ b/handlers/bind.go @@ -85,6 +85,11 @@ func (h APIHandler) Bind(w http.ResponseWriter, req *http.Request) { return } + var metadata any + if !binding.Metadata.IsEmpty() { + metadata = binding.Metadata + } + if binding.AlreadyExists { h.respond(w, http.StatusOK, requestId, apiresponses.BindingResponse{ Credentials: binding.Credentials, @@ -92,6 +97,7 @@ func (h APIHandler) Bind(w http.ResponseWriter, req *http.Request) { RouteServiceURL: binding.RouteServiceURL, VolumeMounts: binding.VolumeMounts, BackupAgentURL: binding.BackupAgentURL, + Metadata: metadata, }) return } @@ -142,5 +148,6 @@ func (h APIHandler) Bind(w http.ResponseWriter, req *http.Request) { RouteServiceURL: binding.RouteServiceURL, VolumeMounts: binding.VolumeMounts, BackupAgentURL: binding.BackupAgentURL, + Metadata: metadata, }) } diff --git a/handlers/get_binding.go b/handlers/get_binding.go index 65d5e2d0..1ed1b68f 100644 --- a/handlers/get_binding.go +++ b/handlers/get_binding.go @@ -57,12 +57,18 @@ func (h APIHandler) GetBinding(w http.ResponseWriter, req *http.Request) { return } + var metadata any + if !binding.Metadata.IsEmpty() { + metadata = binding.Metadata + } + h.respond(w, http.StatusOK, requestId, apiresponses.GetBindingResponse{ BindingResponse: apiresponses.BindingResponse{ Credentials: binding.Credentials, SyslogDrainURL: binding.SyslogDrainURL, RouteServiceURL: binding.RouteServiceURL, VolumeMounts: binding.VolumeMounts, + Metadata: metadata, }, Parameters: binding.Parameters, })