Constructor

Project

new Project(compute)

Parameter

compute

Compute

Compute object this project belongs to.

See also

Projects Overview

Projects Resource

Example

const Compute = require('@google-cloud/compute');
const compute = new Compute();
const project = compute.project();

Methods

get

get()

Get a Project object.

Example

const Compute = require('@google-cloud/compute');
const compute = new Compute();
const project = compute.project();

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

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

getMetadata

getMetadata(callback)

Get the project's metadata.

Parameter

callback

Optional

function()

The callback function.

Values in callback have the following properties:

Parameter

err

error

An error returned while making this request.

Value may be null.

metadata

object

The machine type's metadata.

apiResponse

object

The full API response.

See also

Projects: get API Documentation

Projects Resource

Example

const Compute = require('@google-cloud/compute');
const compute = new Compute();
const project = compute.project();

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

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