Zone

Zone

A Zone object allows you to interact with a Google Compute Engine zone.

Constructor

new Zone(compute, name)

Parameters:
Name Type Description
compute Compute

Compute object this zone belongs to.

name string

Name of the zone.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

Members

compute :Compute

The parent Compute instance of this Zone instance.

Source:

getAutoscalersStream

Get a list of Autoscaler objects from this zone as a readable object stream.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getAutoscalersStream()
  .on('error', console.error)
  .on('data', function(autoscaler) {
    // `autoscaler` is an `Autoscaler` object.
  })
  .on('end', function() {
    // All autoscalers retrieved.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
zone.getAutoscalersStream()
  .on('data', function(autoscaler) {
    this.end();
  });

getDisksStream

Get a list of Disk objects in this zone as a readable object stream.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getDisksStream()
  .on('error', console.error)
  .on('data', function(disk) {
    // `disk` is a `Disk` object.
  })
  .on('end', function() {
    // All disks retrieved.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
zone.getDisksStream()
  .on('data', function(disk) {
    this.end();
  });

getInstanceGroupsStream

Get a list of InstanceGroup objects for this zone as a readable object stream.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getInstanceGroupsStream()
  .on('error', console.error)
  .on('data', function(instanceGroup) {
    // `instanceGroup` is an `InstanceGroup` object.
  })
  .on('end', function() {
    // All instance groups retrieved.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
zone.getInstanceGroupsStream()
  .on('data', function(instanceGroup) {
    this.end();
  });

getMachineTypesStream

Get a list of MachineType objects for this zone as a readable object stream.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getMachineTypesStream()
  .on('error', console.error)
  .on('data', function(machineType) {
    // `machineType` is a `MachineType` object.
  })
  .on('end', function() {
    // All machine types retrieved.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
zone.getMachineTypesStream()
  .on('data', function(machineType) {
    this.end();
  });

getOperationsStream

Get a list of Operation objects for this zone as a readable object stream.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getOperationsStream()
  .on('error', console.error)
  .on('data', function(operation) {
    // `operation` is an `Operation` object.
  })
  .on('end', function() {
    // All operations retrieved.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
zone.getOperationsStream()
  .on('data', function(operation) {
    this.end();
  });

getVMsStream

Get a list of VM instances in this zone as a readable object stream.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getVMsStream()
  .on('error', console.error)
  .on('data', function(vm) {
    // `vm` is a `VM` object.
  })
  .on('end', function() {
    // All instances retrieved.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
zone.getVMsStream()
  .on('data', function(vm) {
    this.end();
  });

id :string

Source:

name :string

Source:

Methods

autoscaler(name) → {Autoscaler}

Get a reference to a Google Compute Engine autoscaler in this zone.

Parameters:
Name Type Description
name string

Name of the autoscaler.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

const autoscaler = zone.autoscaler('autoscaler-name');

createAutoscaler(name, config, callback)

Create an autoscaler in this zone.

Parameters:
Name Type Description
name string

Name of the autoscaler.

config object

See an Autoscaler resource.

Properties
Name Type Description
coolDown number

The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. Alias for config.autoscalingPolicy.coolDownPeriodSec.

cpu number

The target CPU utilization that the autoscaler should maintain, between 1 - 100. Alias for config.autoscalingPolicy.cpuUtilization.utilizationTarget.

loadBalance number

Backend capacity utilization that autoscaler should maintain, between 1 - 100. Alias for config.autoscalingPolicy.loadBalancingUtilization.utilizationTarget.

maxReplicas number

The maximum number of instances that the autoscaler can scale up to. Alias for config.autoscalingPolicy.maxNumReplicas.

minReplicas number

The minimum number of replicas that the autoscaler can scale down to. Alias for config.autoscalingPolicy.minNumReplicas.

target string

The name of the managed instance group that this autoscaler will scale.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

autoscaler Autoscaler

The created Autoscaler object.

operation Operation

An operation object that can be used to check the status of the request.

apiResponse object

The full API response.

Source:
See:
Throws:

If config.target is not provided.

Type
Error
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

const config = {
  coolDown: 30,
  cpu: 80,
  loadBalance: 40,
  maxReplicas: 5,
  minReplicas: 0,
  target: 'instance-group-manager-1'
};

function callback(err, autoscaler, operation, apiResponse) {
  // `autoscaler` is an Autoscaler object.

  // `operation` is an Operation object that can be used to check the status
  // of the request.
}

zone.createAutoscaler('name', config, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.createAutoscaler('name', config).then(function(data) {
  const autoscaler = data[0];
  const operation = data[1];
  const apiResponse = data[2];
});

createDisk(name, config, callback)

Create a persistent disk in this zone.

Parameters:
Name Type Description
name string

Name of the disk.

config object

See a Disk resource.

Properties
Name Type Attributes Description
os string <optional>

Specify the name of an OS, and we will use the latest version as the source image of a new boot disk. See this list of accepted OS names.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

disk Disk

The created Disk object.

operation Operation

An operation object that can be used to check the status of the request.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

//-
// Create a persistent disk using the latest Ubuntu version
// as the source image.
//-
const config = {
  os: 'ubuntu',
  sizeGb: 10
};

//-
// Create a persistent disk using the latest Ubuntu version from your project
// as the source image.
//-
const config = {
  os: 'your-project-id-or-name/ubuntu',
  sizeGb: 10
};

zone.createDisk('name', config, function(err, disk, operation, apiResponse) {
  // `disk` is a Disk object.

  // `operation` is an Operation object that can be used to check the status
  // of the request.
});

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.createDisk('name', config).then(function(data) {
  const disk = data[0];
  const operation = data[1];
  const apiResponse = data[2];
});

createInstanceGroup(name, options, callback)

Create an instance group in this zone.

Parameters:
Name Type Description
name string

Name of the instance group.

options object

See an InstanceGroup resource.

Properties
Name Type Description
ports object

A map of names to ports. The key should be the name, and the value the port number. Maps to options.namedPorts.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

instanceGroup InstanceGroup

The created InstanceGroup object.

operation Operation

An operation object that can be used to check the status of the request.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

function onCreated(err, instanceGroup, operation, apiResponse) {
  // `instanceGroup` is an InstanceGroup object.

  // `operation` is an Operation object that can be used to check the status
  // of the request.
}

zone.createInstanceGroup('instance-group-name', onCreated);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.createInstanceGroup('instance-group-name', config).then(function(data) {
  const instanceGroup = data[0];
  const operation = data[1];
  const apiResponse = data[2];
});

createVM(name, config, callback)

Create a virtual machine in this zone.

Parameters:
Name Type Description
name string

Name of the instance.

config object

See an Instance resource.

Properties
Name Type Attributes Description
disks Array.<object> <nullable>

See disks object.

http boolean <optional>

Allow HTTP traffic. Default: false

https boolean <optional>

Allow HTTPS traffic. Default: false

networkInterfaces Array.<object> <nullable>

An array of configurations for this interface. This specifies how this interface should interact with other network services, such as connecting to the internet. Default: [ { network: 'global/networks/default' } ]

machineType string <optional>

The machine type resource to use. Provide only the name of the machine, e.g. n1-standard-16. Refer to Available Machine Types. Default: n1-standard-1

os string <optional>

Specify the name of an OS, and we will use the latest version as the source image of a new boot disk. See this list of accepted OS names.

tags Array.<string> <nullable>

An array of tags.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

vm VM

The created VM object.

operation Operation

An operation object that can be used to check the status of the request.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

//-
// Create a new instance using the latest Debian version from your project
// as the source image for a new boot disk.
//-
const config = {
  os: 'your-project-id-or-name/debian',
  http: true,
  tags: ['debian-server']
};

//-
// Create a new instance using the latest Debian version as the source image
// for a new boot disk.
//-
const config = {
  os: 'debian',
  http: true,
  tags: ['debian-server']
};

//-
// The above object will auto-expand behind the scenes to something like the
// following. The Debian version may be different when you run the command.
//-
const config = {
  machineType: 'n1-standard-1',
  disks: [
    {
      boot: true,
      initializeParams: {
        sourceImage:
          'https://www.googleapis.com/compute/v1/projects' +
          '/debian-cloud/global/images/debian-7-wheezy-v20150710'
      }
    }
  ],
  networkInterfaces: [
    {
      network: 'global/networks/default'
    }
  ],
  tags: [
    {
      items: [
        'debian-server',
        'http-server'
      ]
    }
  ]
};

function callback(err, vm, operation, apiResponse) {
  // `vm` is a VM object.

  // `operation` is an Operation object that can be used to check the status
  // of the request.
}

zone.createVM('new-vm-name', config, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.createVM('new-vm-name', config).then(function(data) {
  const vm = data[0];
  const operation = data[1];
  const apiResponse = data[2];
});

disk(name) → {Disk}

Get a reference to a Google Compute Engine disk in this zone.

Parameters:
Name Type Description
name string

Name of the disk.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

const disk = zone.disk('disk1');

exists(callback)

Check if the zone exists.

Parameters:
Name Type Description
callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

exists boolean

Whether the zone exists or not.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.exists(function(err, exists) {});

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.exists().then(function(data) {
  const exists = data[0];
});

get()

Get a zone.

Source:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.get(function(err, zone, apiResponse) {
  // `zone` is a Zone object.
});

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.get().then(function(data) {
  const zone = data[0];
  const apiResponse = data[1];
});

getAutoscalers(optionsopt, callback)

Get a list of autoscalers from this zone.

Parameters:
Name Type Attributes Description
options object <optional>

Autoscaler search options.

Properties
Name Type Description
autoPaginate boolean

Have pagination handled automatically. Default: true.

filter string

Search filter in the format of {name} {comparison} {filterString}. - name: the name of the field to compare - comparison: the comparison operator, eq (equal) or ne (not equal) - filterString: the string to filter to. For string fields, this can be a regular expression.

maxApiCalls number

Maximum number of API calls to make.

maxResults number

Maximum number of autoscalers to return.

pageToken string

A previously-returned page token representing part of the larger set of results to view.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

autoscalers Array.<Autoscaler>

Autoscaler objects from your project.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getAutoscalers(function(err, autoscalers) {
  // autoscalers is an array of `Autoscaler` objects.
});

//-
// To control how many API requests are made and page through the results
// manually, set `autoPaginate` to `false`.
//-
function callback(err, autoscalers, nextQuery, apiResponse) {
  if (nextQuery) {
    // More results exist.
    zone.getAutoscalers(nextQuery, callback);
  }
}

zone.getAutoscalers({
  autoPaginate: false
}, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.getAutoscalers().then(function(data) {
  const autoscalers = data[0];
});

getDisks(optionsopt, callback)

Get a list of disks in this zone.

Parameters:
Name Type Attributes Description
options object <optional>

Disk search options.

Properties
Name Type Description
autoPaginate boolean

Have pagination handled automatically. Default: true.

filter string

Search filter in the format of {name} {comparison} {filterString}. - name: the name of the field to compare - comparison: the comparison operator, eq (equal) or ne (not equal) - filterString: the string to filter to. For string fields, this can be a regular expression.

maxApiCalls number

Maximum number of API calls to make.

maxResults number

Maximum number of disks to return.

pageToken string

A previously-returned page token representing part of the larger set of results to view.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

disks Array.<Disk>

Disk objects from this zone.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getDisks(function(err, disks) {
  // `disks` is an array of `Disk` objects.
});

//-
// To control how many API requests are made and page through the results
// manually, set `autoPaginate` to `false`.
//-
function callback(err, disks, nextQuery, apiResponse) {
  if (nextQuery) {
    // More results exist.
    zone.getDisks(nextQuery, callback);
  }
}

zone.getDisks({
  autoPaginate: false
}, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.getDisks().then(function(data) {
  const disks = data[0];
});

getInstanceGroupManagers(optionsopt, callback)

Get a list of instance group managers for this zone.

Parameters:
Name Type Attributes Description
options object <optional>

Instance group manager search options.

Properties
Name Type Description
autoPaginate boolean

Have pagination handled automatically. Default: true.

filter string

Search filter in the format of {name} {comparison} {filterString}. - name: the name of the field to compare - comparison: the comparison operator, eq (equal) or ne (not equal) - filterString: the string to filter to. For string fields, this can be a regular expression.

maxApiCalls number

Maximum number of API calls to make.

maxResults number

Maximum number of instance groups to return.

pageToken string

A previously-returned page token representing part of the larger set of results to view.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

instanceGroupManagers Array.<InstanceGroupManager>

InstanceGroupManager objects from this zone.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getInstanceGroupManagers(function(err, instanceGroupManagers) {
  // `instanceGroupManagers` is an array of `InstanceGroupManager` objects.
});

//-
// To control how many API requests are made and page through the results
// manually, set `autoPaginate` to `false`.
//-
function callback(err, instanceGroupManagers, nextQuery, apiResponse) {
  if (nextQuery) {
    // More results exist.
    zone.getInstanceGroupManagers(nextQuery, callback);
  }
}

zone.getInstanceGroupManagers({
  autoPaginate: false
}, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.getInstanceGroupManagers().then(function(data) {
  const instanceGroupManagerss = data[0];
});

getInstanceGroups(optionsopt, callback)

Get a list of instance groups for this zone.

Parameters:
Name Type Attributes Description
options object <optional>

Instance group search options.

Properties
Name Type Description
autoPaginate boolean

Have pagination handled automatically. Default: true.

filter string

Search filter in the format of {name} {comparison} {filterString}. - name: the name of the field to compare - comparison: the comparison operator, eq (equal) or ne (not equal) - filterString: the string to filter to. For string fields, this can be a regular expression.

maxApiCalls number

Maximum number of API calls to make.

maxResults number

Maximum number of instance groups to return.

pageToken string

A previously-returned page token representing part of the larger set of results to view.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

instanceGroups Array.<InstanceGroup>

InstanceGroup objects from this zone.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getInstanceGroups(function(err, instanceGroups) {
  // `instanceGroups` is an array of `InstanceGroup` objects.
});

//-
// To control how many API requests are made and page through the results
// manually, set `autoPaginate` to `false`.
//-
function callback(err, instanceGroups, nextQuery, apiResponse) {
  if (nextQuery) {
    // More results exist.
    zone.getInstanceGroups(nextQuery, callback);
  }
}

zone.getInstanceGroups({
  autoPaginate: false
}, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.getInstanceGroups().then(function(data) {
  const instanceGroups = data[0];
});

getMachineTypes(optionsopt, callback)

Get a list of machine types for this zone.

Parameters:
Name Type Attributes Description
options object <optional>

Machine type search options.

Properties
Name Type Description
autoPaginate boolean

Have pagination handled automatically. Default: true.

maxApiCalls number

Maximum number of API calls to make.

maxResults number

Maximum number of machineTypes to return.

pageToken string

A previously-returned page token representing part of the larger set of results to view.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

machineTypes Array.<MachineType>

MachineType objects from this zone.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getMachineTypes(function(err, machineTypes) {
  // `machineTypes` is an array of `MachineType` objects.
});

//-
// To control how many API requests are made and page through the results
// manually, set `autoPaginate` to `false`.
//-
function callback(err, machineTypes, nextQuery, apiResponse) {
  if (nextQuery) {
    // More results exist.
    zone.getMachineTypes(nextQuery, callback);
  }
}

zone.getMachineTypes({
  autoPaginate: false
}, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.getMachineTypes().then(function(data) {
  const machineTypes = data[0];
});

getMetadata(callbackopt)

Get the zone's metadata.

Parameters:
Name Type Attributes Description
callback function <optional>

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

metadata object

The zone's metadata.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getMetadata(function(err, metadata, apiResponse) {});

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.getMetadata().then(function(data) {
  const metadata = data[0];
  const apiResponse = data[1];
});

getOperations(optionsopt, callback)

Get a list of operations for this zone.

Parameters:
Name Type Attributes Description
options object <optional>

Operation search options.

Properties
Name Type Description
autoPaginate boolean

Have pagination handled automatically. Default: true.

filter string

Search filter in the format of {name} {comparison} {filterString}. - name: the name of the field to compare - comparison: the comparison operator, eq (equal) or ne (not equal) - filterString: the string to filter to. For string fields, this can be a regular expression.

maxApiCalls number

Maximum number of API calls to make.

maxResults number

Maximum number of operations to return.

pageToken string

A previously-returned page token representing part of the larger set of results to view.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

operations Array.<Operation>

Operation objects from this zone.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getOperations(function(err, operations) {
  // `operations` is an array of `Operation` objects.
});

//-
// To control how many API requests are made and page through the results
// manually, set `autoPaginate` to `false`.
//-
function callback(err, operations, nextQuery, apiResponse) {
  if (nextQuery) {
    // More results exist.
    zone.getOperations(nextQuery, callback);
  }
}

zone.getOperations({
  autoPaginate: false
}, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.getOperations().then(function(data) {
  const operations = data[0];
});

getVMs(optionsopt, callback)

Get a list of VM instances in this zone.

Parameters:
Name Type Attributes Description
options object <optional>

Instance search options.

Properties
Name Type Description
autoPaginate boolean

Have pagination handled automatically. Default: true.

filter string

Search filter in the format of {name} {comparison} {filterString}. - name: the name of the field to compare - comparison: the comparison operator, eq (equal) or ne (not equal) - filterString: the string to filter to. For string fields, this can be a regular expression.

pageToken string

A previously-returned page token representing part of the larger set of results to view.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

vms Array.<VM>

VM objects from this zone.

apiResponse object

The full API response.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

zone.getVMs(function(err, vms) {
  // `vms` is an array of `VM` objects.
});

//-
// To control how many API requests are made and page through the results
// manually, set `autoPaginate` to `false`.
//-
function callback(err, vms, nextQuery, apiResponse) {
  if (nextQuery) {
    // More results exist.
    zone.getVMs(nextQuery, callback);
  }
}

zone.getVMs({
  autoPaginate: false
}, callback);

//-
// If the callback is omitted, we'll return a Promise.
//-
zone.getVMs().then(function(data) {
  const vms = data[0];
});

instanceGroup(name) → {InstanceGroup}

Get a reference to a Google Compute Engine instance group.

Parameters:
Name Type Description
name string

Name of the existing instance group.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

const instanceGroup = zone.instanceGroup('my-instance-group');

instanceGroupManager(name) → {InstanceGroupManager}

Get a reference to a Google Compute Engine instance group manager.

Parameters:
Name Type Description
name string

Name of the existing instance group manager.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

const instanceGroupManager = zone.instanceGroupManager('my-instance-group-manager');

machineType(name) → {MachineType}

Get a reference to a Google Compute Engine machine type.

Parameters:
Name Type Description
name string

Name of the existing machine type.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

const machineType = zone.machineType('g1-small');

operation(name) → {Operation}

Get a reference to a Google Compute Engine zone operation.

Parameters:
Name Type Description
name string

Name of the existing operation.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

const operation = zone.operation('operation-1445532685163-8b137d2a-1822afe7');

vm(name) → {VM}

Get a reference to a Google Compute Engine virtual machine instance.

Parameters:
Name Type Description
name string

Name of the virtual machine.

Source:
See:
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');

const vm = zone.vm('vm-name');