1.0.6 • Published 3 years ago

npm-zesty-azure v1.0.6

Weekly downloads
80
License
ISC
Repository
-
Last release
3 years ago

npm-zesty-azure

How to use

import { getJsonFile, getCreds } from 'npm-zesty-azure'

export const invoke = async ({ body }, res) => {
  try {
    const { service, zestyCommand, params, credentials } = body

    const data = await getJsonFile('mapping.json')
    const action = data[zestyCommand][service].action
    const client = data[zestyCommand][service].client

    const Command = require(`npm-zesty-azure/lib/clients/${client}/commands/${action}`)
    const Client = require(`npm-zesty-azure/lib/clients/${client}/${client}`)

    const creds = await getCreds(credentials)
    const clientInstance = new Client({
      credentials: creds.credentials,
      subscriptionId: creds.subscriptions[0].id
    })

    const response = await clientInstance.send(new Command(params))

    return res.status(200).json({
      response
    })
  } catch (err) {
    console.error(err)
    return res.status(400).json({
      err
    })
  }
}
1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago