Support resource callback methods to be defined as part Extensibility Provider type definitions
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Is your feature request related to a problem? Please describe.**
As an extensibility provider author, I would like to define methods for extensibility resource types. Methods would behave similar to [listKeys](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-resource#listkeys), [listSecrets](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-resource#list)
Methods allow users to access secrets of resources from Bicep code. This is a common pattern for ARM resources that is needed for security resources. This is supported natively for ARM resources but not supported for extensibility.
Consider the following example:
```bicep
resource db 'Applications.Connectors/mongoDatabases' = {
...
}
resource backend 'Applications.Core/containers' = {
...
properties: {
...
env: {
DB_CONNECTION: db.connectionString() // Method call
}
}
}
```
**Describe the solution you'd like**
In the extension types definition (Client-Side) resource methods are specified as RPC callbacks to the extensibility provider Server-Side as following:
```json
{
"resourceType": "Applications.Connectors/mongoDatabases",
"method": "connectionString",
"params": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "string"
}
},
"required": [ "id" ]
},
"result" : {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string"
}
}
```
The deployment engine would route the request to get the `connectionString()` of the `db` via a JSON-RPC request to the extensibility provider (Server-Side). One possible way would be to have the Server-Side serve an endpoint `/api/v1/callbacks` that would serve the JSON-RPC request
The process of defining a callback and the requirements on both the Client-Side and Server-Side would be documented and published including examples that can be used by authors as a reference implementation.
Contributor guide
Research direction
Start by locating the client-side extension type definitions and the deployment engine's resource callback handling, then compare them with the proposed /api/v1/callbacks JSON-RPC contract. Done means callback methods can be declared with parameter and result schemas, routed to extensibility providers, and documented with a reference example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, json
- Domain
- backend-api-design, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100