Solution Configuration Service¶
Summary¶
This service provides access to the active solution context information and usage.
Operations
Name | Tag | Summary |
---|---|---|
config.getParameters() | ||
config.listServices() | ||
config.solution() | ||
config.usage() |
Events
Name | Summary |
---|---|
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. As well enable caching in the scrpting environment itself. Example if cachedValue == nil then cachedValue = Keystore.get({key = "myValue"}).value end |
Operations¶
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)
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. 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¶
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)