Skip to content

Commit d55069c

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

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)
@@ -492,6 +493,7 @@ how Platforms might expose these values to their users.
492493
| schemas | [Schemas](#schemas-object) | Schema definitions for Service Instances and Service Bindings for the Service Plan. |
493494
| maximum_polling_duration | integer | A duration, in seconds, that the Platform SHOULD use as the Service's [maximum polling duration](#polling-interval-and-duration). |
494495
| 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. |
496+
| 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. |
495497

496498
\* Fields with an asterisk are REQUIRED.
497499

@@ -539,6 +541,17 @@ schema being used.
539541

540542
\* Fields with an asterisk are REQUIRED.
541543

544+
##### Extensions Object
545+
546+
| Response Field | Type | Description |
547+
| --- | --- | --- |
548+
| 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`. |
549+
| 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. |
550+
| description | string | A short description of the Service Instance extension. If present, MUST be a non-empty string. |
551+
| 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](#platform-to-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. |
552+
553+
\* Fields with an asterisk are REQUIRED.
554+
542555
```
543556
{
544557
"services": [{
@@ -635,7 +648,21 @@ schema being used.
635648
"maintenance_info": {
636649
"version": "2.1.1+abcdef",
637650
"description": "OS image update.\nExpect downtime."
638-
}
651+
},
652+
"extensions": [
653+
{
654+
"id": "urn:osbext:backup-and-restore:v1",
655+
"path": "instance-backup",
656+
"description": "backup and restore Service Instance data.",
657+
"openapi_url": "http://example.com/extensions/backup_restore.yaml"
658+
},
659+
{
660+
"id": "urn:osbext:ping:v1",
661+
"path": "instance-ping",
662+
"description": "check the health of a Service Instance.",
663+
"openapi_url": "/extensions/ping.yaml"
664+
}
665+
]
639666
}, {
640667
"name": "fake-plan-2",
641668
"id": "0f4008b5-XXXX-XXXX-XXXX-dace631cd648",
@@ -1282,6 +1309,63 @@ For success responses, the following fields are defined:
12821309
}
12831310
```
12841311

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

0 commit comments

Comments
 (0)