mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
ARI: Add support for push configuration of dynamic object
This patch adds support for push configuration of dynamic, i.e., sorcery, objects in Asterisk. It adds three new REST API calls to the 'asterisk' resource: * GET /asterisk/{configClass}/{objectType}/{id}: retrieve the current object given its ID. This returns back a list of ConfigTuples, which define the fields and their present values that make up the object. * PUT /asterisk/{configClass}/{objectType}/{id}: create or update an object. A body may be passed with the request that contains fields to populate in the object. The same format as what is retrieved using the GET operation is used for the body, save that we specify that the list of fields to update are contained in the "fields" attribute. * DELETE /asterisk/{configClass}/{objectType}/{id}: remove a dynamic object from its backing storage. Note that the success/failure of these operations is somewhat configuration dependent, i.e., you must be using a sorcery wizard that supports the operation in question. If a sorcery wizard does not support the create or delete mechanisms, then the REST API call will fail with a 403 forbidden. ASTERISK-25238 #close Change-Id: I28cd5c7bf6f67f8e9e437ff097f8fd171d30ff5c
This commit is contained in:
@@ -7,6 +7,146 @@
|
||||
"basePath": "http://localhost:8088/ari",
|
||||
"resourcePath": "/api-docs/asterisk.{format}",
|
||||
"apis": [
|
||||
{
|
||||
"path": "/asterisk/config/dynamic/{configClass}/{objectType}/{id}",
|
||||
"description": "Asterisk dynamic configuration",
|
||||
"operations": [
|
||||
{
|
||||
"httpMethod": "GET",
|
||||
"summary": "Retrieve a dynamic configuration object.",
|
||||
"nickname": "getObject",
|
||||
"responseClass": "List[ConfigTuple]",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "configClass",
|
||||
"description": "The configuration class containing dynamic configuration objects.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "objectType",
|
||||
"description": "The type of configuration object to retrieve.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"description": "The unique identifier of the object to retrieve.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
}
|
||||
],
|
||||
"errorResponses": [
|
||||
{
|
||||
"code": 404,
|
||||
"reason": "{configClass|objectType|id} not found"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"httpMethod": "PUT",
|
||||
"summary": "Create or update a dynamic configuration object.",
|
||||
"nickname": "updateObject",
|
||||
"responseClass": "List[ConfigTuple]",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "configClass",
|
||||
"description": "The configuration class containing dynamic configuration objects.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "objectType",
|
||||
"description": "The type of configuration object to create or update.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"description": "The unique identifier of the object to create or update.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "fields",
|
||||
"description": "The body object should have a value that is a list of ConfigTuples, which provide the fields to update. Ex. [ { \"attribute\": \"directmedia\", \"value\": \"false\" } ]",
|
||||
"paramType": "body",
|
||||
"required": false,
|
||||
"dataType": "containers",
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"errorResponses": [
|
||||
{
|
||||
"code": 400,
|
||||
"reason": "Bad request body"
|
||||
},
|
||||
{
|
||||
"code": 403,
|
||||
"reason": "Could not create or update object"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"reason": "{configClass|objectType} not found"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"httpMethod": "DELETE",
|
||||
"summary": "Delete a dynamic configuration object.",
|
||||
"nickname": "deleteObject",
|
||||
"responseClass": "void",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "configClass",
|
||||
"description": "The configuration class containing dynamic configuration objects.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "objectType",
|
||||
"description": "The type of configuration object to delete.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"description": "The unique identifier of the object to delete.",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
}
|
||||
],
|
||||
"errorResponses": [
|
||||
{
|
||||
"code": 403,
|
||||
"reason": "Could not delete object"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"reason": "{configClass|objectType|id} not found"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/asterisk/info",
|
||||
"description": "Asterisk system information (similar to core show settings)",
|
||||
@@ -403,6 +543,22 @@
|
||||
"description": "The value of the variable requested"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ConfigTuple": {
|
||||
"id": "ConfigTuple",
|
||||
"description": "A key/value pair that makes up part of a configuration object.",
|
||||
"properties": {
|
||||
"attribute": {
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "A configuration object attribute."
|
||||
},
|
||||
"value": {
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"description": "The value for the attribute."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user