Logo: Relish

  1. Sign in

Project: Behave-relish

List server flavors (node)

The following code example shows how to list flavors for the node SDK.
See also Listing Flavors in the OpenStack documentation.

Scenarios
  • @node
List flavors (node)
Given
I am setup to run example code for node
When
I execute the following code:
var pkgcloud = require('pkgcloud'),
    _ = require('underscore');

var client = pkgcloud.providers.rackspace.compute.createClient({
  username: process.env.OS_USERNAME,
  apiKey: process.env.OS_PASSWORD
});

// first we're going to get our flavors
client.getFlavors(function (err, flavors) {
  if (err) {
    console.dir(err);
    return;
  }
  flavors.forEach(function (flavor) {
    console.log("Name: " + flavor.name)
    console.log("  ID: " + flavor.id)
    console.log("  RAM: " + flavor.ram)
    console.log("  Disk: " + flavor.disk)
    console.log("  VCPUs: " + flavor.vcpus)
    console.log()
  })
});
Then
the output should match

Name: 512MB Standard Instance
  ID: 2
  RAM: 512
  Disk: 20
  VCPUs: 1

Name: 1GB Standard Instance
  ID: 3
  RAM: 1024
  Disk: 40
  VCPUs: 1

Name: 2GB Standard Instance
  ID: 4
  RAM: 2048
  Disk: 80
  VCPUs: 2

Name: 4GB Standard Instance
  ID: 5
  RAM: 4096
  Disk: 160
  VCPUs: 2

Name: 8GB Standard Instance
  ID: 6
  RAM: 8192
  Disk: 320
  VCPUs: 4

Name: 15GB Standard Instance
  ID: 7
  RAM: 15360
  Disk: 620
  VCPUs: 6

Name: 30GB Standard Instance
  ID: 8
  RAM: 30720
  Disk: 1200
  VCPUs: 8

Last published almost 7 years ago by Max Lincoln.