Members
id
name
zone
The parent Zone instance of this MachineType instance.
Methods
create(callback)
Check if the machine type exists.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function |
The callback function. Properties
|
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-b');
const machineType = zone.machineType('g1-small');
machineType.exists(function(err, exists) {});
//-
// If the callback is omitted, we'll return a Promise.
//-
machineType.exists().then(function(data) {
const exists = data[0];
});
get()
Get a machine type if it exists.
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-b');
const machineType = zone.machineType('g1-small');
machineType.get(function(err, machineType, apiResponse) {
// `machineType` is a MachineType object.
});
//-
// If the callback is omitted, we'll return a Promise.
//-
machineType.get().then(function(data) {
const machineType = data[0];
const apiResponse = data[1];
});
getMetadata(callbackopt)
Get the machine type's metadata.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function |
<optional> |
The callback function. Properties
|
Example
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-b');
const machineType = zone.machineType('g1-small');
machineType.getMetadata(function(err, metadata, apiResponse) {});
//-
// If the callback is omitted, we'll return a Promise.
//-
machineType.getMetadata().then(function(data) {
const metadata = data[0];
const apiResponse = data[1];
});