Solution Configuration Service
This service provides access to the active solution context information.
Operations
- Config.getParameters()
- Config.listServices()
- Config.setParameters()
- Config.solution()
- Config.updateEnv() - Update environment variables
Events
Configuration parameters
Please note that bold arguments are required, while italic arguments are optional.
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 Default: true |
rate_limit | integer | Maximum requests per second (average) allowed in the system. For customization, consider this formula; rate_limit >= {request_per_second_per_device} * {number_of_devices} For Applications linked with connectors, please also update the rate_limit in each connector. Default: 100 |
Operations
Please note that bold arguments are required, while italic arguments are optional.
getParameters
Get the services configuration parameters.
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
service | string | Indicates the service name |
Responses
Code | Body Type | Description |
---|---|---|
200 | object | The services configuration parameters |
default | object | Failed to get the services configuration. |
Object Parameter of 200 response:
Name | Type | Description |
---|---|---|
*** | object | The services configuration parameters object. |
.parameters* | object | The service configuration parameters elements. |
.parameters.hLimit* | number | Limit |
.parameters.connection_scheme* | string | Connection scheme |
Object Parameter of default response:
Name | Type | Description |
---|---|---|
type | string | Error type |
error | string | Error message |
status | integer | Response code |
Example
listServices
Get the list of services configured for this solution. This is useful to see what additional services has been added from scripting logic. As West Connectivity Product are exposed as services added to the solution this function can be used to list available Products.
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
type | "core", "exosite", "exchange", "product", "application" | The type filter to indicate the type of service. - core: Native West Connectivity services - exosite: Additional services provided by West Connectivity and available on Exchange marketplace - exchange: Service available on Exchange marketplace and provided by 3rd party - product: A West Connectivity product - application: A West Connectivity solution exposed through the Interface Service |
service | string | Filter services by name |
tags | [ string {1..20} ] {1..10} | Filter services by tags |
Responses
Code | Body Type | Description |
---|---|---|
200 | [ object ] | Returns the list of services configuration within this solution. |
default | object | Failed to get the services configuration. |
Object Parameter of 200 response:
Name | Type | Description |
---|---|---|
id | string(uuid) | Unique Id for the service configuration. |
tags | [ string ] | List of tags |
type | "core", "exosite", "exchange", "product", "application" | The type filter to indicate the type of service. - core: Native West Connectivity services - exosite: Additional services provided by West Connectivity and available on Exchange marketplace - exchange: Service available on Exchange marketplace and provided by 3rd party - product: West Connectivity product - application: A West Connectivity solution exposed through the Interface Service |
service | string | Service alias reference. |
script_key | string | Scripting key reference, unique per solution. |
Object Parameter of default response:
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
setParameters
Set the services configuration parameters.
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
service | string | Indicates the service name |
* | any | Any other properties are accepted. |
Responses
Code | Body Type | Description |
---|---|---|
204 | nil | Successfully updated |
default | object | Failed to get the services configuration. |
Object Parameter of default response:
Name | Type | Description |
---|---|---|
type | string | Error type |
error | string | Error message |
status | integer | Response code |
Example
solution
Get the solution information.
Responses
Code | Body Type | Description |
---|---|---|
200 | object | Returns the solution data. |
default | object | Failed to retrieve the data. |
Object Parameter of 200 response:
Name | Type | Description |
---|---|---|
id | ^[a-zA-Z0-9]+$ | Unique reference of the solution |
env | object | Environment |
name | string | User defined custom name |
alias | string | Alias |
count | object | Count |
count.route | number | Number of routes |
count.library | number | Number of libraries |
count.eventHandler | number | Number of event handlers |
count.serviceConfig | number | Number of service configurations |
domain | ^[a-zA-Z0-9\_\-\.]+$ | Solution API domain name used by the Webservice core service. |
source | object | - |
source.url | string | URL |
source.from | string | Where the source is from |
source.info | object | Information of the source |
source.info.name | string | Name of the info |
source.info.authors | [ string ] | Array of authors |
source.info.version | string | Version |
source.info.description | string | Description |
source.branch | string | Branch |
source.commit | string | Commit hash |
(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 West Connectivity Product attached to your solution as services. You then want to use the 'listServices' operation. |
reuse_vm | boolean | Reuse vm |
template | string | Template |
created_at | string | Creation time |
deleted_at | string | Deletion time |
rate_limit | number | Rate limit |
updated_at | string | Update time |
auto_update | boolean | Auto update |
business_id | ^[a-zA-Z0-9\_\-]+$ | Customer Account ID |
notifications | object | Notifications |
Object Parameter of default response:
Name | Type | Description |
---|---|---|
type | string | Error type |
error | string | Error message |
status | integer | Response code |
Example
updateEnv
Update environment variables. WARNING!! This is a slow operation and should NEVER be used for real-time data!
SRS-ID: CONFIG-INT-0015
Responses
Code | Body Type | Description |
---|---|---|
204 | nil | Set successful |
default | object | Standard http responses |
Object Parameter of default response:
Name | Type | Description |
---|---|---|
type | string | Error type |
error | string | Error message |
status | integer | Response code |
Example
Config.updateEnv({key1='val1',key2='val2'})
-- Get the env value. Note the update is asyncronous the new value will be returned in the next execution only.
return os.getenv('key1')
Events
status
Event triggered by West Connectivity UI to provide information related to solution health.
Arguments
service (object) - Query data (TBD)
Name | Type | Description |
---|---|---|
Responses
Code | Body Type | Description |
---|---|---|
default | object | The service status trigger response object. |
Object Parameter of default response:
Name | Type | Description |
---|---|---|
* | any | Any other properties are accepted. |
Example
service
Notification indicating a service configuration has changed withing the solution.
Arguments
service (object) - The list of services configured by the user within this solution.
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 West Connectivity services - exosite: Additional services provided by West Connectivity and available on Exchange marketplace - exchange: Service available on Exchange marketplace and provided by 3rd party - product: A West Connectivity product - application: A West Connectivity 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
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, ..) Find more documentation on the
scripting
reference page of the West Connectivity platform documentation. Event argument 'event' contains the data from the original event.
Arguments
event (object) - The event data as provided by the service.
Name | Type | Description |
---|---|---|
Example
Service Health Check
Operations
/health
Enable the hosting system to check if service is active and running
Arguments
No Content
Responses
Name | Type | Description |
---|---|---|
200 | string | OK |
Errors
No content