The base module for all azure-chaos extensions
A helper module for all node
azure-chaos extensions
This module defines a javascript
framework that is helpful when authoring azure-chaos functions. It provides lightweight helpers that allow extension authors to more easily engineer chaos, without worrying about communication details with the orchestrator.
This is the exported API from the azure-chaos-fn
module.
Request validation helpers. Useful to ensure data coming in is behaving as expecting.
const validate = require('azure-chaos-fn/validators')
Validates that the body
of a req
object contains a valid accessToken
.
try { require('azure-chaos-fn/validators').accessToken(req) } catch (ex) { console.error(`error: ${ex}`) }
Validates that the body
of a req
object contains a valid resources
array.
try { require('azure-chaos-fn/validators').resources(req) } catch (ex) { console.error(`error: ${ex}`) }
Note: these depend on the validators to ensure only valid data is parsed.
Request parser helpers. Useful to parse valid request data into models.
const parsers = require('azure-chaos-fn/parsers')
Inflates the accessToken
from a req
objects body
into a ms-rest-azure compatible credentials object.
const credentials = require('azure-chaos-fn/parsers').accessTokenToCredentials(req)
Inflates the resources
from a req
objects body
into a collection of objects containing the following properties:
subscriptionId
- the azure subscription id to targetresourceGroupName
- the azure resource group name to targetresourceName
- the azure resource name to target
const objs = require('azure-chaos-fn/parsers').resourcesToObjects(req)
MIT