Class v1.ProjectsClient

The Projects API. v1

Package

@google-cloud/compute

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of ProjectsClient.

Parameter
NameDescription
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

port

static get port(): number;

The port for this API service.

projectsStub

projectsStub?: Promise<{
        [name: string]: Function;
    }>;

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

disableXpnHost(request, options)

disableXpnHost(request?: protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Disable this project as a shared VPC host project.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callDisableXpnHost() {
    // Construct request
    const request = {
      project,
    };

    // Run request
    const response = await computeClient.disableXpnHost(request);
    console.log(response);
  }

  callDisableXpnHost();

disableXpnHost(request, options, callback)

disableXpnHost(request: protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

disableXpnHost(request, callback)

disableXpnHost(request: protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDisableXpnHostProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

disableXpnResource(request, options)

disableXpnResource(request?: protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Disable a service resource (also known as service project) associated with this host project.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The body resource for this request
   */
  // const projectsDisableXpnResourceRequestResource = {}
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callDisableXpnResource() {
    // Construct request
    const request = {
      project,
      projectsDisableXpnResourceRequestResource,
    };

    // Run request
    const response = await computeClient.disableXpnResource(request);
    console.log(response);
  }

  callDisableXpnResource();

disableXpnResource(request, options, callback)

disableXpnResource(request: protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

disableXpnResource(request, callback)

disableXpnResource(request: protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IDisableXpnResourceProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

enableXpnHost(request, options)

enableXpnHost(request?: protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Enable this project as a shared VPC host project.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callEnableXpnHost() {
    // Construct request
    const request = {
      project,
    };

    // Run request
    const response = await computeClient.enableXpnHost(request);
    console.log(response);
  }

  callEnableXpnHost();

enableXpnHost(request, options, callback)

enableXpnHost(request: protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

enableXpnHost(request, callback)

enableXpnHost(request: protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IEnableXpnHostProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

enableXpnResource(request, options)

enableXpnResource(request?: protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The body resource for this request
   */
  // const projectsEnableXpnResourceRequestResource = {}
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callEnableXpnResource() {
    // Construct request
    const request = {
      project,
      projectsEnableXpnResourceRequestResource,
    };

    // Run request
    const response = await computeClient.enableXpnResource(request);
    console.log(response);
  }

  callEnableXpnResource();

enableXpnResource(request, options, callback)

enableXpnResource(request: protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

enableXpnResource(request, callback)

enableXpnResource(request: protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IEnableXpnResourceProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

get(request, options)

get(request?: protos.google.cloud.compute.v1.IGetProjectRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IProject,
        protos.google.cloud.compute.v1.IGetProjectRequest | undefined,
        {} | undefined
    ]>;

Returns the specified Project resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas field). To exclude one or more fields, set your request's fields query parameter to only include the fields you need. For example, to only include the id and selfLink fields, add the query parameter ?fields=id,selfLink to your request.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetProjectRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Project]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callGet() {
    // Construct request
    const request = {
      project,
    };

    // Run request
    const response = await computeClient.get(request);
    console.log(response);
  }

  callGet();

get(request, options, callback)

get(request: protos.google.cloud.compute.v1.IGetProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

get(request, callback)

get(request: protos.google.cloud.compute.v1.IGetProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetProjectRequest
callback Callback<protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

getXpnHost(request, options)

getXpnHost(request?: protos.google.cloud.compute.v1.IGetXpnHostProjectRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IProject,
        protos.google.cloud.compute.v1.IGetXpnHostProjectRequest | undefined,
        {} | undefined
    ]>;

Gets the shared VPC host project that this project links to. May be empty if no link exists.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetXpnHostProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetXpnHostProjectRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Project]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callGetXpnHost() {
    // Construct request
    const request = {
      project,
    };

    // Run request
    const response = await computeClient.getXpnHost(request);
    console.log(response);
  }

  callGetXpnHost();

getXpnHost(request, options, callback)

getXpnHost(request: protos.google.cloud.compute.v1.IGetXpnHostProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetXpnHostProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetXpnHostProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetXpnHostProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getXpnHost(request, callback)

getXpnHost(request: protos.google.cloud.compute.v1.IGetXpnHostProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetXpnHostProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetXpnHostProjectRequest
callback Callback<protos.google.cloud.compute.v1.IProject, protos.google.cloud.compute.v1.IGetXpnHostProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getXpnResources(request, options)

getXpnResources(request?: protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IXpnResourceId[],
        protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest | null,
        protos.google.cloud.compute.v1.IProjectsGetXpnResources
    ]>;

Gets service resources (a.k.a service project) associated with this host project.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IXpnResourceId[], protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest | null, protos.google.cloud.compute.v1.IProjectsGetXpnResources ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [XpnResourceId]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using getXpnResourcesAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

getXpnResources(request, options, callback)

getXpnResources(request: protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, protos.google.cloud.compute.v1.IProjectsGetXpnResources | null | undefined, protos.google.cloud.compute.v1.IXpnResourceId>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, protos.google.cloud.compute.v1.IProjectsGetXpnResources | null | undefined, protos.google.cloud.compute.v1.IXpnResourceId>
Returns
TypeDescription
void

getXpnResources(request, callback)

getXpnResources(request: protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, callback: PaginationCallback<protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, protos.google.cloud.compute.v1.IProjectsGetXpnResources | null | undefined, protos.google.cloud.compute.v1.IXpnResourceId>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest
callback PaginationCallback<protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, protos.google.cloud.compute.v1.IProjectsGetXpnResources | null | undefined, protos.google.cloud.compute.v1.IXpnResourceId>
Returns
TypeDescription
void

getXpnResourcesAsync(request, options)

getXpnResourcesAsync(request?: protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.compute.v1.IXpnResourceId>;

Equivalent to getXpnResources, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.compute.v1.IXpnResourceId>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [XpnResourceId]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`,><=`, `="">=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
   */
  // const filter = 'abc123'
  /**
   *  The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
   */
  // const maxResults = 1234
  /**
   *  Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
   */
  // const orderBy = 'abc123'
  /**
   *  Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
   */
  // const pageToken = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
   */
  // const returnPartialSuccess = true

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callGetXpnResources() {
    // Construct request
    const request = {
      project,
    };

    // Run request
    const iterable = await computeClient.getXpnResourcesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callGetXpnResources();

getXpnResourcesStream(request, options)

getXpnResourcesStream(request?: protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IGetXpnResourcesProjectsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [XpnResourceId] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using getXpnResourcesAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listXpnHosts(request, options)

listXpnHosts(request?: protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.compute.v1.IProject[],
        protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest | null,
        protos.google.cloud.compute.v1.IXpnHostList
    ]>;

Lists all shared VPC host projects visible to the user in an organization.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.compute.v1.IProject[], protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest | null, protos.google.cloud.compute.v1.IXpnHostList ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Project]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listXpnHostsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listXpnHosts(request, options, callback)

listXpnHosts(request: protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, protos.google.cloud.compute.v1.IXpnHostList | null | undefined, protos.google.cloud.compute.v1.IProject>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, protos.google.cloud.compute.v1.IXpnHostList | null | undefined, protos.google.cloud.compute.v1.IProject>
Returns
TypeDescription
void

listXpnHosts(request, callback)

listXpnHosts(request: protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, callback: PaginationCallback<protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, protos.google.cloud.compute.v1.IXpnHostList | null | undefined, protos.google.cloud.compute.v1.IProject>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest
callback PaginationCallback<protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, protos.google.cloud.compute.v1.IXpnHostList | null | undefined, protos.google.cloud.compute.v1.IProject>
Returns
TypeDescription
void

listXpnHostsAsync(request, options)

listXpnHostsAsync(request?: protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.compute.v1.IProject>;

Equivalent to listXpnHosts, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.compute.v1.IProject>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Project]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`,><=`, `="">=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ```
   */
  // const filter = 'abc123'
  /**
   *  The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
   */
  // const maxResults = 1234
  /**
   *  Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
   */
  // const orderBy = 'abc123'
  /**
   *  Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
   */
  // const pageToken = 'abc123'
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The body resource for this request
   */
  // const projectsListXpnHostsRequestResource = {}
  /**
   *  Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
   */
  // const returnPartialSuccess = true

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callListXpnHosts() {
    // Construct request
    const request = {
      project,
      projectsListXpnHostsRequestResource,
    };

    // Run request
    const iterable = await computeClient.listXpnHostsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListXpnHosts();

listXpnHostsStream(request, options)

listXpnHostsStream(request?: protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IListXpnHostsProjectsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Project] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listXpnHostsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

moveDisk(request, options)

moveDisk(request?: protos.google.cloud.compute.v1.IMoveDiskProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Moves a persistent disk from one zone to another.

Parameters
NameDescription
request protos.google.cloud.compute.v1.IMoveDiskProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const diskMoveRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callMoveDisk() {
    // Construct request
    const request = {
      diskMoveRequestResource,
      project,
    };

    // Run request
    const response = await computeClient.moveDisk(request);
    console.log(response);
  }

  callMoveDisk();

moveDisk(request, options, callback)

moveDisk(request: protos.google.cloud.compute.v1.IMoveDiskProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IMoveDiskProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IMoveDiskProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IMoveDiskProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

moveDisk(request, callback)

moveDisk(request: protos.google.cloud.compute.v1.IMoveDiskProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IMoveDiskProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IMoveDiskProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IMoveDiskProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

moveInstance(request, options)

moveInstance(request?: protos.google.cloud.compute.v1.IMoveInstanceProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Moves an instance and its attached persistent disks from one zone to another. *Note*: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the [known issue](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior).

Parameters
NameDescription
request protos.google.cloud.compute.v1.IMoveInstanceProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const instanceMoveRequestResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callMoveInstance() {
    // Construct request
    const request = {
      instanceMoveRequestResource,
      project,
    };

    // Run request
    const response = await computeClient.moveInstance(request);
    console.log(response);
  }

  callMoveInstance();

moveInstance(request, options, callback)

moveInstance(request: protos.google.cloud.compute.v1.IMoveInstanceProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IMoveInstanceProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IMoveInstanceProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IMoveInstanceProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

moveInstance(request, callback)

moveInstance(request: protos.google.cloud.compute.v1.IMoveInstanceProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IMoveInstanceProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.IMoveInstanceProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IMoveInstanceProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setCommonInstanceMetadata(request, options)

setCommonInstanceMetadata(request?: protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Sets metadata common to all instances within the specified project using the data included in the request.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The body resource for this request
   */
  // const metadataResource = {}
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callSetCommonInstanceMetadata() {
    // Construct request
    const request = {
      metadataResource,
      project,
    };

    // Run request
    const response = await computeClient.setCommonInstanceMetadata(request);
    console.log(response);
  }

  callSetCommonInstanceMetadata();

setCommonInstanceMetadata(request, options, callback)

setCommonInstanceMetadata(request: protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setCommonInstanceMetadata(request, callback)

setCommonInstanceMetadata(request: protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetCommonInstanceMetadataProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setDefaultNetworkTier(request, options)

setDefaultNetworkTier(request?: protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  The body resource for this request
   */
  // const projectsSetDefaultNetworkTierRequestResource = {}
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callSetDefaultNetworkTier() {
    // Construct request
    const request = {
      project,
      projectsSetDefaultNetworkTierRequestResource,
    };

    // Run request
    const response = await computeClient.setDefaultNetworkTier(request);
    console.log(response);
  }

  callSetDefaultNetworkTier();

setDefaultNetworkTier(request, options, callback)

setDefaultNetworkTier(request: protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setDefaultNetworkTier(request, callback)

setDefaultNetworkTier(request: protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetDefaultNetworkTierProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setUsageExportBucket(request, options)

setUsageExportBucket(request?: protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.compute.v1.IOperation, null>,
        protos.google.cloud.compute.v1.IOperation | undefined,
        {} | undefined
    ]>;

Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled.

Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.compute.v1.IOperation, null>, protos.google.cloud.compute.v1.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time. .promise() is not supported yet.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID for this request.
   */
  // const project = 'my-project'
  /**
   *  An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'
  /**
   *  The body resource for this request
   */
  // const usageExportLocationResource = {}

  // Imports the Compute library
  const {ProjectsClient} = require('@google-cloud/compute').v1;

  // Instantiates a client
  const computeClient = new ProjectsClient();

  async function callSetUsageExportBucket() {
    // Construct request
    const request = {
      project,
      usageExportLocationResource,
    };

    // Run request
    const response = await computeClient.setUsageExportBucket(request);
    console.log(response);
  }

  callSetUsageExportBucket();

setUsageExportBucket(request, options, callback)

setUsageExportBucket(request: protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest
options CallOptions
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setUsageExportBucket(request, callback)

setUsageExportBucket(request: protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest, callback: Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest
callback Callback<protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.ISetUsageExportBucketProjectRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void