Solution Configuration Service¶
Summary¶
This service provides access to the active solution context information and usage.
Operations
| Name | Tag | Summary |
|---|---|---|
| config.env() | ||
| config.getOperation() | ||
| config.getParameters() | ||
| config.listOperations() | ||
| config.listServices() | ||
| config.solution() | ||
| config.usage() |
Events
| Name | Summary |
|---|---|
| init | Solution Initialization |
| service | configuration update |
| fallback | fallback event handler |
Configuration parameters¶
| Name | Type | Description |
|---|---|---|
| auto_update | boolean | Enable the automatic update solution functionality or not when the solution is installed by the template. If enabled, the solution will automatically apply to the latest version when the template is updated. Default: true |
| reuse_vm | boolean | Enable hot virtual machine so event can re-use an existing scripting context instead of creating a new one. If enabled, scripting trigger loading time is reduced, therefore reducing latency. |
Operations¶
env¶
Description
Get the solution environment variables.
Responses
-
Returns
{object}for The solution environment variables mapName Type Description * string - -
Returns
{object}when Failed to get the current usage.Error response
{object}Name Type Description type string Error type error string Error message status integer Response code
Example
local env = Config.env()
for key, value in pairs(env) do
print(key .. ": " .. value)
end
getOperation¶
Description
Get the full resolved detail for a specific operation on a configured service. Parameters and responses are returned as a script caller would use them — after name remapping, reference resolution, and body flattening. Restricted, hidden, and internal-use fields are excluded.
Arguments
| Name | Type | Description |
|---|---|---|
| service | string | The service alias |
| operationId | string | The operation ID |
Responses
-
Returns
{object}when The full operation detail.Full resolved detail for a single operation.
{object}Name Type Description tags [ string ] Grouping tags as defined by the service author. example string Scripting example from the service definition. summary string Short human-readable description. responses object Map of HTTP status code to resolved response schema. References are inlined. Restricted fields are excluded. * any Any other properties are accepted. parameters object Resolved parameter schema for this operation. parameters.required [ string ] List of required parameter names. parameters.properties object Map of parameter name to its JSON Schema definition. Names reflect the script-facing API after any x-exosite-from remapping. * any Any other properties are accepted. description string Full description. operationId string The operation identifier. -
Returns
{object}when Failed to get the operation.Error response
{object}Name Type Description type string Error type error string Error message status integer Response code
Example
local op = Config.getOperation({service = "twilio", operationId = "postMessage"})
print(op.summary)
getParameters¶
Description
Get the services configuration parameters.
Arguments
| Name | Type | Description |
|---|---|---|
| service | string | Indicates the service name |
| includeSchema | boolean | Indicates whether to include schema information in the response |
Responses
-
Returns
{[ object ]}for The services configuration parametersName Type Description schema object The service configuration parameters schema. parameters object The service configuration parameters elements. -
Returns
{object}when Failed to get the services configuration.Error response
{object}Name Type Description type string Error type error string Error message status integer Response code
Example
local parameters = Config.getParameters({service = 'content'})
print(parameters)
listOperations¶
Description
Get the list of callable operations exposed by a configured service. Restricted, hidden, and internal-use operations are excluded. Results are derived from the service swagger definition.
Arguments
| Name | Type | Description |
|---|---|---|
| service | string | The service alias |
| tags | [ string ] | Filter operations by tag |
Responses
-
Returns
{[ object ]}when The list of operations for this service.List of operations exposed by a service.
{object}Name Type Description tags [ string ] Grouping tags as defined by the service author. summary string Short human-readable description of the operation. description string Full description of the operation. operationId string The operation identifier, used to call the service. -
Returns
{object}when Failed to get the operations.Error response
{object}Name Type Description type string Error type error string Error message status integer Response code
Example
local ops = Config.listOperations({service = "twilio"})
for _, op in ipairs(ops) do
print(op.operationId .. ": " .. (op.summary or ""))
end
listServices¶
Description
Get the list of services configured for this solution. This is useful to see what additional services has been added from scripting logic. As Murano Product are exposed as services added to the solution this function can be used to list available Products.
Arguments
| Name | Type | Description |
|---|---|---|
| type | "core", "exosite", "exchange", "product", "application" | The type filter to indicate the type of service. - core: Native Murano services - exosite: Additional services provided by Exosite and available on Exchange marketplace - exchange: Service available on Exchange marketplace and provided by 3rd party - product: A Murano product - application: A Murano solution exposed through the Interface Service |
| service | string | Filter services by name |
| tags | [ string {1..20} ] {1..10} | Filter services by tags |
Responses
-
Returns
{[ object ]}when Returns the list of services configuration within this solution.List of services configuration
{object}Name Type Description id string(uuid) Unique Id for the service configuration. tags [ string ] Service grouping tags. type "core", "exosite", "exchange", "product", "application" The type filter to indicate the type of service. - core: Native Murano services - exosite: Additional services provided by Exosite and available on Exchange marketplace - exchange: Service available on Exchange marketplace and provided by 3rd party - product: Murano product - application: A Murano solution exposed through the Interface Service service string Service alias reference. script_key string Scripting key reference, unique per solution. -
Returns
{object}when Failed to get the services configuration.Error response
{object}Name Type Description type string Error type error string Error message status integer Response code
Example
-- Get all Product services linked to this solution
local products = Config.listServices({type = "product"})
local results = {}
for i, product in ipairs(products) do
-- get product details
results[product.script_key] = murano.service_call(product.service, "getGatewaySettings")
end
return results
solution¶
Description
Get the solution information.
Responses
-
Returns
{object}when Returns the solution data.Represents a Murano solution data
{object}Name Type Description id ^[a-zA-Z0-9]+$ Unique reference of the solution name string User defined custom name domain ^[a-zA-Z0-9\_\-\.]+$ Solution API domain name used by the Webservice core service. (deprecated) products [ ^[a-zA-Z0-9\_\-\.]+$ ] The list of products from legacy Device service associated with this solution.
In most case you probably are using Murano Product attached to your solution as services. You then want to use the 'listServices' operation.business_id ^[a-zA-Z0-9\_\-]+$ Customer Account ID -
Returns
{object}when Failed to retrieve the data.Error response
{object}Name Type Description type string Error type error string Error message status integer Response code
Example
local solution = Config.solution()
print(solution.id)
usage¶
Description
Get the solution usage and limitation by services.
Arguments
| Name | Type | Description |
|---|---|---|
| services | [ string {1..100} ] {..10} | List of services to return metrics from. |
Responses
-
Returns
{object}when Returns the solution usage.Current solution usage. A map of serviceAlias (e.g., email or webservice).
{object}Name Type Description serviceAlias object Current usage & quota for this particular service. serviceAlias.quota object Current quota for this service. serviceAlias.quota.calls_daily number Service call limitation per day. serviceAlias.quota.other_quota number Other Service specific limitation. See http://docs.exosite.com/reference/services/ for more information on service limitations. serviceAlias.quota.calls_monthly number Service call limitation per month. serviceAlias.usage object Current usage for this service. serviceAlias.usage.calls_daily number Today's service calls counts. serviceAlias.usage.calls_total number Total service calls counts for this solution. serviceAlias.usage.other_metric number Other service specific metrics. See http://docs.exosite.com/reference/services/ for more information on service available metrics and quota. serviceAlias.usage.calls_monthly number Service calls counts so far this month. serviceAlias.service ^[a-z][a-z0-9]+$ Unique name used as service reference in scripts. -
Returns
{object}when Failed to get the current usage.Error response
{object}Name Type Description type string Error type error string Error message status integer Response code
Example
local usage = Config.usage({services={"keystore", "tsdb"}})
local total_services_calls_today = 0
for alias, serviceinfo in pairs(usage) do
if serviceinfo.usage.calls_daily ~= nil then
total_services_calls_today = total_services_calls_today + serviceinfo.usage.calls_daily
end
end
print(total_services_calls_today)
Events¶
init¶
Description
Triggered after all services have been initialized, allowing for more complex solutions which may need to do additional initialization logic.
Arguments
| Name | Type | Description |
|---|---|---|
Example
print("Solution has been initialized")
service¶
Description
Notification indicating a service configuration has changed withing the solution.
Arguments
| Name | Type | Description |
|---|---|---|
| id | string(uuid) | Unique Id for the service configuration. |
| type | "core", "exosite", "exchange", "product", "application" | The type filter to indicate the type of service. - core: Native Murano services - exosite: Additional services provided by Exosite and available on Exchange marketplace - exchange: Service available on Exchange marketplace and provided by 3rd party - product: A Murano product - application: A Murano solution exposed through the Interface Service |
| action | "added", "updated", "removed" | Action of service config changed. |
| service | string | Service alias reference. |
| script_key | string | Scripting key reference, unique per solution. |
Example
print("Service " .. service.service .. "(" .. service.script_key .. ") has been " .. service.action)
fallback¶
Description
A generic event which gets executed as fallback if the specific handler is not defined. This is useful for applications requiring to handle dynamic products/service to be added at run-time. To know what service & event is being triggered, used the execution 'context' information. Eg. context.service, context.event, context.service_type (product, application, ..) More information on http://docs.exosite.com/articles/working-with-apis/#context Event argument 'event' contains the data from the original event.
Arguments
| Name | Type | Description |
|---|---|---|
Example
print("Fallback on event " .. context.service .. "." .. context.event)