Skip to content

Commit

Permalink
Generic extensions
Browse files Browse the repository at this point in the history
Co-authored-by: Georgi Lozev <[email protected]>
  • Loading branch information
Samze and georgi-lozev committed Jul 25, 2019
1 parent 4979811 commit 5cba556
Showing 1 changed file with 75 additions and 1 deletion.
76 changes: 75 additions & 1 deletion spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [Provisioning](#provisioning)
- [Fetching a Service Instance](#fetching-a-service-instance)
- [Updating a Service Instance](#updating-a-service-instance)
- [Service Instance Extensions](#service-instance-extensions)
- [Binding](#binding)
- [Types of Binding](#types-of-binding)
- [Fetching a Service Binding](#fetching-a-service-binding)
Expand Down Expand Up @@ -486,6 +487,7 @@ how Platforms might expose these values to their users.
| schemas | [Schemas](#schemas-object) | Schema definitions for Service Instances and Service Bindings for the Service Plan. |
| maximum_polling_duration | integer | A duration, in seconds, that the Platform SHOULD use as the Service's [maximum polling duration](#polling-interval-and-duration). |
| maintenance_info | [Maintenance Info](#maintenance-info-object) | Maintenance information for a Service Instance which is provisioned using the Service Plan. If provided, a version string MUST be provided and platforms MAY use this when [Provisioning](#provisioning) or [Updating](#updating-a-service-instance) a Service Instance. |
| extensions | array of [Extension](#extensions-object) objects | An array of extensions that the Service Broker MAY return. If specified, the extensions are available on created Service Instances of this Service Plan. |

\* Fields with an asterisk are REQUIRED.

Expand Down Expand Up @@ -533,6 +535,16 @@ schema being used.

\* Fields with an asterisk are REQUIRED.

##### Extensions Object

| Response Field | Type | Description |
| --- | --- | --- |
| id* | string | A Uniform Resource Name ([URN](https://tools.ietf.org/html/rfc2141)) that uniquely identifies the extension. It MUST include the namespace identifier(NID) `osbext` and a specific string(NSS) for the extension. For example `urn:osbext:/v1/backup`. |
| description | string | A short description of the service instance extension. If present, MUST be a non-empty string. |
| openapi_url* | string | A URI pointing to a valid [OpenAPI 3.0+](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md) document describing the API extension(s) available on each Service Instance of the Service Plan. If this is an absolute URI then it MUST have no authentication and be publicly available. If this is a relative URI then it is assumed to be hosted on the Service Broker and behind the [Service Broker Authentication](#service-broker-authentication). All [Path Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathsObject) MUST be hosted by the Service Broker and MUST be relative to the URL `/v2/service_instances/:instance_id/extensions/:nss` where `:nss` is the namespace specific string(NSS) part of the extension `id`. The Service Broker MUST use the same authentication method used for other Open Service Broker API endpoints.|

\* Fields with an asterisk are REQUIRED.

```
{
"services": [{
Expand Down Expand Up @@ -629,7 +641,19 @@ schema being used.
"maintenance_info": {
"version": "2.1.1+abcdef",
"description": "OS image update.\nExpect downtime."
}
},
"extensions": [
{
"id": "urn:osbext:/v1/backup-and-restore",
"description": "backup and restore service instance data",
"openapi_url": "http://example.com/extensions/backup_restore.yaml"
},
{
"id": "urn:osbext:/v1/ping",
"description": "check the health of a service instance",
"openapi_url": "/extensions/ping.yaml"
}
]
}, {
"name": "fake-plan-2",
"id": "0f4008b5-XXXX-XXXX-XXXX-dace631cd648",
Expand Down Expand Up @@ -1274,6 +1298,56 @@ For success responses, the following fields are defined:
}
```

## Service Instance Extensions

Service Instance Extensions allow Service Broker authors to define new endpoints
that act on a Service Instance. This allows Service Broker authors to
extend the specification for Service specific operations. For example,
Backup, Restore, Start, Stop and Ping.

If the Service Broker has declared Service Instance extensions in the [Catalog](#catalog-management)
then this route is used as the basepath to trigger the extension(s). The extension path(s)
relative to this route are defined in the OpenAPI document returned
in the [Extensions object](#extensions-object).

#### Route
`/v2/service_instances/:instance_id/extensions/:extension_path`

`:instance_id` MUST be the ID of a previously provisioned Service Instance.

`:extension_path` MUST be the namespace specific string(NSS) part of the extension URN plus the path in the OpenAPI document.

For example a Service Broker may define a Service Instance Extension in the [Catalog](#catalog-management):

```json
{
"id": "urn:osbext:/custom-extension",
"description": "Allows backing up of service instance data",
"openapi_url": "/extensions/custom-extension.yaml"
}
```

Which refers to the following OpenAPI document:

```yaml
openapi: "3.0.0"
info:
version: 1.0.0
title: My Service Extension
paths:
/backup:
post:
summary: Backup of a service instance
operationId: backup
tags:
- backup
responses:
'202':
description: Backup accepted
```
In this case the broker MUST handle `POST` requests to
`/v2/service_instances/:instance_id/extensions/custom-extension/backup`.

## Binding

Expand Down

0 comments on commit 5cba556

Please sign in to comment.