Giter VIP home page Giter VIP logo

azure-ratecard-api-wrapper's Introduction

azure-ratecard-api-wrapper

A simple library allowing you to send a request to the Azure RateCard API through node.js

Before Using The Package

Installation

npm install --save azure-ratecard-api-wrapper

Usage

  • After doing the prerequisite and installing the package you'll be able to use the only exported method
  • GetPriceAndMetadataInformation is exported and expect a parameters object & a callback
let GetPrices = require("azure-ratecard-api-wrapper").GetPriceAndMetadataInformation;

let params =
{
    aad_tenant_id : "AAD_TENANT_ID",
    application_id : "AAD_REGISTERED_APP_ID",
    application_secret : "AAD_REGISTERED_APP_SECRET",
    subscription_id : "AZURE_SUBSCRIPTION_ID",
    offer_id : "MS-AZR-0003P",
    currency : "EUR",
    locale : "en-us",
    region : "FR"
}

GetPrices(params, function(result)
{
    // Handle the error if any.
    if (result instanceof Error)
    {
        console.log("Error : " + result.message);
        return;
    }

    // Work with the result.
    console.log("VM A0 Windows in US West price is "
                    + result.VirtualMachines.A0VMWindows.ComputeHours.USWest.Value
                    + " " + params.currency
                    + " per " + result.VirtualMachines.A0VMWindows.ComputeHours.USWest.Unit);
});

Using the result

Testing

  • Tests are implemented using Mocha & Chai
  • npm test will execute the test code under \test directory
  • getprice-config.js file should be customized with your own values especially for :
    • aad_tenant_id matching your Azure AD directory id
    • application_id matching your Application Id as mentionned in the 'Before Using The Package' section
    • application_secret matching your Application Secret as mentionned in the 'Before Using The Package' section
    • subscription_id matching the Azure subscription id under which the application got the 'Reader' role

azure-ratecard-api-wrapper's People

Contributors

olileger avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.