项目作者: bengreenier-archive

项目描述 :
The base module for all azure-chaos extensions
高级语言: JavaScript
项目地址: git://github.com/bengreenier-archive/azure-chaos-fn.git
创建时间: 2018-02-02T22:01:10Z
项目社区:https://github.com/bengreenier-archive/azure-chaos-fn

开源协议:MIT License

下载


azure-chaos-fn

Build Status

A helper module for all node azure-chaos extensions :gear: :robot:

readme logo

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.

API

This is the exported API from the azure-chaos-fn module.

validators

Request validation helpers. Useful to ensure data coming in is behaving as expecting.

  1. const validate = require('azure-chaos-fn/validators')

accessToken

Validates that the body of a req object contains a valid accessToken.

  1. try { require('azure-chaos-fn/validators').accessToken(req) } catch (ex) { console.error(`error: ${ex}`) }

resources

Validates that the body of a req object contains a valid resources array.

  1. try { require('azure-chaos-fn/validators').resources(req) } catch (ex) { console.error(`error: ${ex}`) }

parsers

Note: these depend on the validators to ensure only valid data is parsed.

Request parser helpers. Useful to parse valid request data into models.

  1. const parsers = require('azure-chaos-fn/parsers')

accessTokenToCredentials

Inflates the accessToken from a req objects body into a ms-rest-azure compatible credentials object.

  1. const credentials = require('azure-chaos-fn/parsers').accessTokenToCredentials(req)

resourcesToObjects

Inflates the resources from a req objects body into a collection of objects containing the following properties:

  • subscriptionId - the azure subscription id to target
  • resourceGroupName - the azure resource group name to target
  • resourceName - the azure resource name to target
  1. const objs = require('azure-chaos-fn/parsers').resourcesToObjects(req)

License

MIT