new Project(compute)

Example

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

Parameter

Name Type Optional Description

compute

 

 

Compute object this project belongs to.

See also

Projects Overview

Projects Resource

Methods

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([callback])

Get the project's metadata.

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];
});

Parameters

Name Type Optional Description

callback

function()

Yes

The callback function.

Values in callback have the following properties:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

metadata

object

 

The machine type's metadata.

apiResponse

object

 

The full API response.

See also

Projects: get API Documentation

Projects Resource