Skip to content

Commit be39e7c

Browse files
Samzegeorgi-lozev
andcommitted
Generic extensions
Co-authored-by: Georgi Lozev <[email protected]>
1 parent 4979811 commit be39e7c

File tree

1 file changed

+85
-1
lines changed

1 file changed

+85
-1
lines changed

spec.md

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- [Provisioning](#provisioning)
2626
- [Fetching a Service Instance](#fetching-a-service-instance)
2727
- [Updating a Service Instance](#updating-a-service-instance)
28+
- [Service Instance Extensions](#service-instance-extensions)
2829
- [Binding](#binding)
2930
- [Types of Binding](#types-of-binding)
3031
- [Fetching a Service Binding](#fetching-a-service-binding)
@@ -486,6 +487,7 @@ how Platforms might expose these values to their users.
486487
| schemas | [Schemas](#schemas-object) | Schema definitions for Service Instances and Service Bindings for the Service Plan. |
487488
| maximum_polling_duration | integer | A duration, in seconds, that the Platform SHOULD use as the Service's [maximum polling duration](#polling-interval-and-duration). |
488489
| 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. |
490+
| 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. |
489491

490492
\* Fields with an asterisk are REQUIRED.
491493

@@ -533,6 +535,17 @@ schema being used.
533535

534536
\* Fields with an asterisk are REQUIRED.
535537

538+
##### Extensions Object
539+
540+
| Response Field | Type | Description |
541+
| --- | --- | --- |
542+
| 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`. |
543+
| path* | string | A relative path on the Service Broker to trigger the extension's endpoint(s). This path will be relative to `/v2/service_instances/:instance_id/extensions`. This MUST be a relative URI. The Service Broker author can use this path to namespace an extension to avoid [Path Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathsObject) colliding with other extensions. |
544+
| description | string | A short description of the service instance extension. If present, MUST be a non-empty string. |
545+
| 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) described in the document MUST be hosted by the Service Broker and MUST be relative to the URL `/v2/service_instances/:instance_id/extensions/:path`. The Service Broker MUST use the same authentication method used for other Open Service Broker API endpoints.|
546+
547+
\* Fields with an asterisk are REQUIRED.
548+
536549
```
537550
{
538551
"services": [{
@@ -629,7 +642,21 @@ schema being used.
629642
"maintenance_info": {
630643
"version": "2.1.1+abcdef",
631644
"description": "OS image update.\nExpect downtime."
632-
}
645+
},
646+
"extensions": [
647+
{
648+
"id": "urn:osbext:/v1/backup-and-restore",
649+
"path": "instance-backup",
650+
"description": "backup and restore service instance data",
651+
"openapi_url": "http://example.com/extensions/backup_restore.yaml"
652+
},
653+
{
654+
"id": "urn:osbext:/v1/ping",
655+
"path": "instance-ping",
656+
"description": "check the health of a service instance",
657+
"openapi_url": "/extensions/ping.yaml"
658+
}
659+
]
633660
}, {
634661
"name": "fake-plan-2",
635662
"id": "0f4008b5-XXXX-XXXX-XXXX-dace631cd648",
@@ -1274,6 +1301,63 @@ For success responses, the following fields are defined:
12741301
}
12751302
```
12761303

1304+
## Service Instance Extensions
1305+
1306+
Service Instance Extensions allow Service Broker authors to define new endpoints
1307+
that act on a Service Instance. This allows Service Broker authors to
1308+
extend the specification for Service specific operations. For example,
1309+
Backup, Restore, Start, Stop and Ping.
1310+
1311+
If the Service Broker has declared Service Instance extension(s) in the [Catalog](#catalog-management),
1312+
then the Service Broker MUST host a route that is used as the basepath to trigger
1313+
the extension(s). The Service Broker MUST host the path(s) relative to this route
1314+
that are defined in the [Extensions object](#extensions-object). The routes MUST
1315+
be a combination of the Service Broker author defined `path` field and the
1316+
[Path Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathsObject)
1317+
defined in the extension's OpenAPI 3.0 document.
1318+
1319+
#### Route
1320+
`/v2/service_instances/:instance_id/extensions/:extension_path`
1321+
1322+
`:instance_id` MUST be the ID of a previously provisioned Service Instance.
1323+
1324+
`:extension_path` MUST be the `path` field defined in the [Extensions object](#extensions-object).
1325+
1326+
For example if a Service Broker wanted to allow `POST` requests to trigger a
1327+
backup on the following path:
1328+
1329+
`/v2/service_instances/:instance_id/extensions/broker-extension-path/backup`.
1330+
1331+
They would define the following Service Instance Extension in the [Catalog](#catalog-management):
1332+
1333+
```json
1334+
{
1335+
"id": "urn:osbext:custom-extension",
1336+
"path": "/broker-extension-path",
1337+
"description": "Allows backing up of service instance data",
1338+
"openapi_url": "/extensions/custom-extension.yaml"
1339+
}
1340+
```
1341+
1342+
Where the `openapi_uri` field refers to the following OpenAPI document:
1343+
1344+
```yaml
1345+
openapi: "3.0.0"
1346+
info:
1347+
version: 1.0.0
1348+
title: My Service Extension
1349+
paths:
1350+
/backup:
1351+
post:
1352+
summary: Backup of a service instance
1353+
operationId: backup
1354+
tags:
1355+
- backup
1356+
responses:
1357+
'202':
1358+
description: Backup accepted
1359+
```
1360+
12771361
12781362
## Binding
12791363

0 commit comments

Comments
 (0)