npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

azure-retail-prices

v1.1.2

Published

Wrapper of Azure Retail Prices API. You can easily get the retail price of Azure without authenticating.

Downloads

11

Readme

azure-retail-prices

npm version npm downloads MIT License Build Status Coverage Status

This is wrapper of Azure Retail Prices API.
You can easily get the retail price of Azure without authenticating.

Installation

# via npm
npm install --save azure-retail-prices

# via yarn
yarn add azure-retail-prices

Examples

After having cloned this repository, run the following commands:

cd example/
npm install
npm run import-sample
# # or
# npm run require-sample

Usage

import arp from "azure-retail-prices";
// // or
// const arp = require("azure-retail-prices").default;

async function getRetailPrices() {
  // without currencyCode option (It will return USD)
  let retailPrices = await arp({
    serviceName: "Virtual Machines",
    location: "EU West",
    priceType: "Reservation",
  });
  console.dir(retailPrices);

  // with currencyCode option
  retailPrices = await arp(
    {
      serviceName: "Virtual Machines",
      location: "EU West",
      priceType: "Reservation",
    },
    "JPY"
  );
  console.dir(retailPrices);
}

Sample calls

Here are some examples:

// Compute resources
//  - Response count: 150K+
//  - Response time: 25 minutes
const retailPrices = await arp({
  serviceFamily: "Compute",
});

// Virtual machines
//  - Response count: 130K+
//  - Response time: 20 minutes
const retailPrices = await arp({
  serviceName: "Virtual Machines",
});

// Virtual machines located "EU West"
//  - Response count: 4K+
//  - Response time: 40 seconds
const retailPrices = await arp({
  serviceName: "Virtual Machines",
  location: "EU West",
});

// Virtual machines located "EU West" with currency in EUR
//  - Response count: 4K+
//  - Response time: 40 seconds
const retailPrices = await arp(
  {
    serviceName: "Virtual Machines",
    location: "EU West",
  },
  "EUR"
);

// Reserved virtual machines located "EU West"
//  - Response count: 700+
//  - Response time: 8 seconds
const retailPrices = await arp({
  serviceName: "Virtual Machines",
  location: "EU West",
  priceType: "Reservation",
});

// Identify by unique ID
//  - Response count: 2
//  - Response time: 1 second
const retailPrices = await arp({
  meterId: "000a794b-bdb0-58be-a0cd-0c3a0f222923",
});

Response examples

Here's a sample response, without reservation prices.

[
  {
    "currencyCode": "USD",
    "tierMinimumUnits": 0.0,
    "retailPrice": 0.176346,
    "unitPrice": 0.176346,
    "armRegionName": "westeurope",
    "location": "EU West",
    "effectiveStartDate": "2020-08-01T00:00:00Z",
    "meterId": "000a794b-bdb0-58be-a0cd-0c3a0f222923",
    "meterName": "F16s Spot",
    "productId": "DZH318Z0BQPS",
    "skuId": "DZH318Z0BQPS/00TG",
    "productName": "Virtual Machines FS Series Windows",
    "skuName": "F16s Spot",
    "serviceName": "Virtual Machines",
    "serviceId": "DZH313Z7MMC8",
    "serviceFamily": "Compute",
    "unitOfMeasure": "1 Hour",
    "type": "DevTestConsumption",
    "isPrimaryMeterRegion": true,
    "armSkuName": "Standard_F16s"
  }
]

Here's a sample response with reservation prices and term in the response.

[
  {
    "currencyCode": "USD",
    "tierMinimumUnits": 0.0,
    "reservationTerm": "1 Year",
    "retailPrice": 25007.0,
    "unitPrice": 25007.0,
    "armRegionName": "southcentralus",
    "location": "US South Central",
    "effectiveStartDate": "2020-08-01T00:00:00Z",
    "meterId": "0016083a-928f-56fd-8eeb-39287dcf676d",
    "meterName": "E64 v4",
    "productId": "DZH318Z0D1L7",
    "skuId": "DZH318Z0D1L7/018J",
    "productName": "Virtual Machines Ev4 Series",
    "skuName": "E64 v4",
    "serviceName": "Virtual Machines",
    "serviceId": "DZH313Z7MMC8",
    "serviceFamily": "Compute",
    "unitOfMeasure": "1 Hour",
    "type": "Reservation",
    "isPrimaryMeterRegion": true,
    "armSkuName": "Standard_E64_v4"
  }
]

Filters

You can append the filters to function call, as shown in the Sample calls.

Filters are supported for the following fields:

| Fields | Example Values | Definition | | ------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------- | | armRegionName | westeurope | ARM region where the service is available. This version only supports prices on Commercial Cloud. | | location | EU West | Azure data center where the resource is deployed | | meterId | 000a794b-bdb0-58be-a0cd-0c3a0f222923 | Unique identifier of the resource | | meterName | F16s Spot | Name of the meter | | productId | DZH318Z0BQPS | UniqueID of the product | | skuId | DZH318Z0BQPS/00TG | UniqueID for the SKU | | productName | Virtual Machines FS Series Windows | Product name | | skuName | F16s Spot | SKU name | | serviceName | Virtual Machines | Name of the service | | serviceId | DZH313Z7MMC8 | UniqueID of the service | | serviceFamily | Compute | Service family of the SKU | | priceType | DevTestConsumption | Meter consumption type. Other types are Reservation, Consumption. | | armSkuName | Standard_F16s | SKU name registered in Azure |

Supported currencies

You append the currency code to the API endpoint, as shown in the API sample call.

| Currency code | Detail | | ------------- | ------------------ | | USD | US dollar | | AUD | Australian dollar | | BRL | Brazilian real | | CAD | Canadian dollar | | CHF | Swiss franc | | CNY | Chinese yuan | | DKK | Danish krone | | EUR | Euro | | GBP | British pound | | INR | Indian rupee | | JPY | Japanese yen | | KRW | Korean won | | NOK | Norwegian krone | | NZD | New Zealand dollar | | RUB | Russian ruble | | SEK | Swedish krona | | TWD | Taiwan dollar |

License

This library is licensed under the MIT License.