summaryrefslogtreecommitdiff
path: root/res/ari/resource_asterisk.h
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-07-08 16:39:35 -0500
committerMatt Jordan <mjordan@digium.com>2015-07-16 20:38:57 -0500
commit254d07b15b6f6a741c1293cf9d26a2a235e795ed (patch)
tree0a1d7d9e98f5bd166fd74f575ea6d46c8ddf2b53 /res/ari/resource_asterisk.h
parentaf9ee2910d4f791243fa9c6ef98dd53264acc445 (diff)
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
Diffstat (limited to 'res/ari/resource_asterisk.h')
-rw-r--r--res/ari/resource_asterisk.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/res/ari/resource_asterisk.h b/res/ari/resource_asterisk.h
index 574d947e4..1afc09317 100644
--- a/res/ari/resource_asterisk.h
+++ b/res/ari/resource_asterisk.h
@@ -39,6 +39,70 @@
#include "asterisk/ari.h"
+/*! Argument struct for ast_ari_asterisk_get_object() */
+struct ast_ari_asterisk_get_object_args {
+ /*! The configuration class containing dynamic configuration objects. */
+ const char *config_class;
+ /*! The type of configuration object to retrieve. */
+ const char *object_type;
+ /*! The unique identifier of the object to retrieve. */
+ const char *id;
+};
+/*!
+ * \brief Retrieve a dynamic configuration object.
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void ast_ari_asterisk_get_object(struct ast_variable *headers, struct ast_ari_asterisk_get_object_args *args, struct ast_ari_response *response);
+/*! Argument struct for ast_ari_asterisk_update_object() */
+struct ast_ari_asterisk_update_object_args {
+ /*! The configuration class containing dynamic configuration objects. */
+ const char *config_class;
+ /*! The type of configuration object to create or update. */
+ const char *object_type;
+ /*! The unique identifier of the object to create or update. */
+ const char *id;
+ /*! The body object should have a value that is a list of ConfigTuples, which provide the fields to update. Ex. [ { "attribute": "directmedia", "value": "false" } ] */
+ struct ast_json *fields;
+};
+/*!
+ * \brief Body parsing function for /asterisk/config/dynamic/{configClass}/{objectType}/{id}.
+ * \param body The JSON body from which to parse parameters.
+ * \param[out] args The args structure to parse into.
+ * \retval zero on success
+ * \retval non-zero on failure
+ */
+int ast_ari_asterisk_update_object_parse_body(
+ struct ast_json *body,
+ struct ast_ari_asterisk_update_object_args *args);
+
+/*!
+ * \brief Create or update a dynamic configuration object.
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void ast_ari_asterisk_update_object(struct ast_variable *headers, struct ast_ari_asterisk_update_object_args *args, struct ast_ari_response *response);
+/*! Argument struct for ast_ari_asterisk_delete_object() */
+struct ast_ari_asterisk_delete_object_args {
+ /*! The configuration class containing dynamic configuration objects. */
+ const char *config_class;
+ /*! The type of configuration object to delete. */
+ const char *object_type;
+ /*! The unique identifier of the object to delete. */
+ const char *id;
+};
+/*!
+ * \brief Delete a dynamic configuration object.
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void ast_ari_asterisk_delete_object(struct ast_variable *headers, struct ast_ari_asterisk_delete_object_args *args, struct ast_ari_response *response);
/*! Argument struct for ast_ari_asterisk_get_info() */
struct ast_ari_asterisk_get_info_args {
/*! Array of Filter information returned */