◆ addQueryData()
CloudRequestEngine::addQueryData | ( | flowData, | |
queryData, | |||
allEvidence, | |||
evidence | |||
) |
Add query data to the evidence.
- Parameters
-
- {object} - queryData The destination dictionary to add query data to.
- {Evidence} - allEvidence All evidence in the flow data. This is used to report which evidence keys are conflicting.
- {object} - evidence Evidence to add to the query Data.
◆ constructor()
CloudRequestEngine::constructor ( { resourceKey, licenseKey, baseURL, cloudRequestOrigin, requestClient } ) inlineConstructor for CloudRequestEngine.
- Parameters
-
- {object} - options options object
- {string} - options.resourceKey resourcekey for cloud service
- {string} - options.licenseKey licensekey for cloud service
- {string} - options.baseURL url the cloud service is located at if overriding default
- {string} - options.cloudRequestOrigin The value to set for the Origin header when making requests to the cloud service. This is used by the cloud service to check that the request is being made from a origin matching those allowed by the resource key. For more detail, see the 'Request Headers' section in the cloud documentation.
◆ fetchProperties()
CloudRequestEngine::fetchProperties ( ) inlineInternal process to fetch all the properties available under a resourcekey.
- Returns
- {Promise} properties from the cloud server
◆ getContent()
CloudRequestEngine::getContent ( flowData ) inlineGenerate the Content to send in the POST request.
The evidence keys e.g. 'query.' and 'header.' have an order of precedence. These are added to the evidence in reverse order, if there is conflict then the queryData value is overwritten. 'query.' evidence should take precedence over all other evidence. If there are evidence keys other than 'query.' that conflict then this is unexpected so a warning will be logged.
- Parameters
-
- {FlowData} - flowData
◆ getData()
CloudRequestEngine::getData ( flowData ) inlineInternal function to get data from cloud service.
- Parameters
-
- {FlowData} - flowData FlowData used to extract evidence and send to cloud service for processing
- Returns
- {Promise} result of processing
◆ getErrorMessages()
CloudRequestEngine::getErrorMessages ( responseBody ) inlineTypically, cloud will return errors as JSON.
However, transport level errors or other failures can result in responses that are plain text. This function handles these cases.
- Parameters
-
- {String} - response the response data to process
- Returns
- {Array} The error messages
◆ getEvidenceKeys()
CloudRequestEngine::getEvidenceKeys ( ) inlineInternal function to get evidenceKeys used by cloud resourcekey.
- Returns
- {Array} evidence key list
◆ getSelectedEvidence()
CloudRequestEngine::getSelectedEvidence ( evidence, type ) inlineGet evidence with specified prefix.
- Parameters
-
- {Evidence} - evidence All evidence in the flow data.
- {stirng} - type Required evidence key prefix
◆ hasKeyPrefix()
CloudRequestEngine::hasKeyPrefix ( itemKey, prefix ) inlineCheck that the key of a KeyValuePair has the given prefix.
- Parameters
-
- {string} - itemKey Key to check
- {string} - prefix The prefix to check for.
- Returns
- True if the key has the prefix.
◆ processInternal()
CloudRequestEngine::processInternal ( flowData ) inlineInternal process for cloud engine Returns raw JSON as a "cloud" property in "cloud".
- Parameters
-
- {FlowData} - flowData flowData to process
- Returns
- {Promise} data from cloud service
◆ ready()
CloudRequestEngine::ready ( ) inlineFunction for testing if the cloud engine is ready Checks to see if properties and evidence keys have been fetched.
- Returns
- {Promise} whether ready