Skip to content

Commit

Permalink
adding documentation for request context
Browse files Browse the repository at this point in the history
  • Loading branch information
kisamoto committed Mar 5, 2019
1 parent 0b4438e commit eff7b25
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,27 @@ use the `NewFailureResponseBuilder()` to add a custom `Error:` value in the
response, or indicate that the broker should return an empty response rather
than the error message.

## Request Context

When provisioning a service `brokerapi` validates the `service_id` and `plan_id`
in the request, attaching the found instances to the request Context. These
values can be retrieved in a `brokerapi.ServiceBroker` implementation using
utility methods `RetrieveServiceFromContext` and `RetrieveServicePlanFromContext`
as shown below.

```golang
func (sb *ServiceBrokerImplementation) Provision(ctx context.Context,
instanceID string, details brokerapi.ProvisionDetails, asyncAllowed bool) {

service := brokerapi.RetrieveServiceFromContext(ctx)
if service == nil {
// Lookup service
}

// [..]
}
```

## Originating Identity

The request context for every request contains the unparsed
Expand Down

0 comments on commit eff7b25

Please sign in to comment.