Class v1.CloudMemcacheClient

Configures and manages Cloud Memorystore for Memcached instances.

The memcache.googleapis.com service implements the Google Cloud Memorystore for Memcached API and defines the following resource model for managing Memorystore Memcached (also called Memcached below) instances: * The service works with a collection of cloud projects, named: /projects/* * Each project has a collection of available locations, named: /locations/* * Each location has a collection of Memcached instances, named: /instances/* * As such, Memcached instances are resources of the form: /projects/{project_id}/locations/{location_id}/instances/{instance_id}

Note that location_id must be a GCP region; for example: * projects/my-memcached-project/locations/us-central1/instances/my-memcached v1

Package

@google-cloud/memcache

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of CloudMemcacheClient.

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;

cloudMemcacheStub

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

descriptors

descriptors: Descriptors;

innerApiCalls

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

operationsClient

operationsClient: gax.OperationsClient;

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

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

applyParameters(request, options)

applyParameters(request?: protos.google.cloud.memcache.v1.IApplyParametersRequest, options?: CallOptions): Promise<[LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

ApplyParameters will restart the set of specified nodes in order to update them to the current set of parameters for the Memcached Instance.

Parameters
NameDescription
request protos.google.cloud.memcache.v1.IApplyParametersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the Memcached instance for which parameter group updates
   *  should be applied.
   */
  // const name = 'abc123'
  /**
   *  Nodes to which we should apply the instance-level parameter group.
   */
  // const nodeIds = 'abc123'
  /**
   *  Whether to apply instance-level parameter group to all nodes. If set to
   *  true, will explicitly restrict users from specifying any nodes, and apply
   *  parameter group updates to all nodes within the instance.
   */
  // const applyAll = true

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callApplyParameters() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await memcacheClient.applyParameters(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callApplyParameters();

applyParameters(request, options, callback)

applyParameters(request: protos.google.cloud.memcache.v1.IApplyParametersRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IApplyParametersRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

applyParameters(request, callback)

applyParameters(request: protos.google.cloud.memcache.v1.IApplyParametersRequest, callback: Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IApplyParametersRequest
callback Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

checkApplyParametersProgress(name)

checkApplyParametersProgress(name: string): Promise<LROperation<protos.google.cloud.memcache.v1.Instance, protos.google.cloud.memcache.v1.OperationMetadata>>;

Check the status of the long running operation returned by applyParameters().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.memcache.v1.Instance, protos.google.cloud.memcache.v1.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the Memcached instance for which parameter group updates
   *  should be applied.
   */
  // const name = 'abc123'
  /**
   *  Nodes to which we should apply the instance-level parameter group.
   */
  // const nodeIds = 'abc123'
  /**
   *  Whether to apply instance-level parameter group to all nodes. If set to
   *  true, will explicitly restrict users from specifying any nodes, and apply
   *  parameter group updates to all nodes within the instance.
   */
  // const applyAll = true

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callApplyParameters() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await memcacheClient.applyParameters(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callApplyParameters();

checkCreateInstanceProgress(name)

checkCreateInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.memcache.v1.Instance, protos.google.cloud.memcache.v1.OperationMetadata>>;

Check the status of the long running operation returned by createInstance().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.memcache.v1.Instance, protos.google.cloud.memcache.v1.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the instance location using the form:
   *      `projects/{project_id}/locations/{location_id}`
   *  where `location_id` refers to a GCP region
   */
  // const parent = 'abc123'
  /**
   *  Required. The logical name of the Memcached instance in the user
   *  project with the following restrictions:
   *  * Must contain only lowercase letters, numbers, and hyphens.
   *  * Must start with a letter.
   *  * Must be between 1-40 characters.
   *  * Must end with a number or a letter.
   *  * Must be unique within the user project / location
   *  If any of the above are not met, will raise an invalid argument error.
   */
  // const instanceId = 'abc123'
  /**
   *  Required. A Memcached Instance
   */
  // const instance = {}

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callCreateInstance() {
    // Construct request
    const request = {
      parent,
      instanceId,
      instance,
    };

    // Run request
    const [operation] = await memcacheClient.createInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateInstance();

checkDeleteInstanceProgress(name)

checkDeleteInstanceProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.memcache.v1.OperationMetadata>>;

Check the status of the long running operation returned by deleteInstance().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.memcache.v1.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Memcached instance resource name in the format:
   *      `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
   *  where `location_id` refers to a GCP region
   */
  // const name = 'abc123'

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callDeleteInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await memcacheClient.deleteInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteInstance();

checkUpdateInstanceProgress(name)

checkUpdateInstanceProgress(name: string): Promise<LROperation<protos.google.cloud.memcache.v1.Instance, protos.google.cloud.memcache.v1.OperationMetadata>>;

Check the status of the long running operation returned by updateInstance().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.memcache.v1.Instance, protos.google.cloud.memcache.v1.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Mask of fields to update.
   *   *   `displayName`
   */
  // const updateMask = {}
  /**
   *  Required. A Memcached Instance.
   *  Only fields specified in update_mask are updated.
   */
  // const instance = {}

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callUpdateInstance() {
    // Construct request
    const request = {
      updateMask,
      instance,
    };

    // Run request
    const [operation] = await memcacheClient.updateInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateInstance();

checkUpdateParametersProgress(name)

checkUpdateParametersProgress(name: string): Promise<LROperation<protos.google.cloud.memcache.v1.Instance, protos.google.cloud.memcache.v1.OperationMetadata>>;

Check the status of the long running operation returned by updateParameters().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.memcache.v1.Instance, protos.google.cloud.memcache.v1.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the Memcached instance for which the parameters should be
   *  updated.
   */
  // const name = 'abc123'
  /**
   *  Required. Mask of fields to update.
   */
  // const updateMask = {}
  /**
   *  The parameters to apply to the instance.
   */
  // const parameters = {}

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callUpdateParameters() {
    // Construct request
    const request = {
      name,
      updateMask,
    };

    // Run request
    const [operation] = await memcacheClient.updateParameters(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateParameters();

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.

createInstance(request, options)

createInstance(request?: protos.google.cloud.memcache.v1.ICreateInstanceRequest, options?: CallOptions): Promise<[LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Creates a new Instance in a given location.

Parameters
NameDescription
request protos.google.cloud.memcache.v1.ICreateInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the instance location using the form:
   *      `projects/{project_id}/locations/{location_id}`
   *  where `location_id` refers to a GCP region
   */
  // const parent = 'abc123'
  /**
   *  Required. The logical name of the Memcached instance in the user
   *  project with the following restrictions:
   *  * Must contain only lowercase letters, numbers, and hyphens.
   *  * Must start with a letter.
   *  * Must be between 1-40 characters.
   *  * Must end with a number or a letter.
   *  * Must be unique within the user project / location
   *  If any of the above are not met, will raise an invalid argument error.
   */
  // const instanceId = 'abc123'
  /**
   *  Required. A Memcached Instance
   */
  // const instance = {}

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callCreateInstance() {
    // Construct request
    const request = {
      parent,
      instanceId,
      instance,
    };

    // Run request
    const [operation] = await memcacheClient.createInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateInstance();

createInstance(request, options, callback)

createInstance(request: protos.google.cloud.memcache.v1.ICreateInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.ICreateInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createInstance(request, callback)

createInstance(request: protos.google.cloud.memcache.v1.ICreateInstanceRequest, callback: Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.ICreateInstanceRequest
callback Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteInstance(request, options)

deleteInstance(request?: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, options?: CallOptions): Promise<[LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Deletes a single Instance.

Parameters
NameDescription
request protos.google.cloud.memcache.v1.IDeleteInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Memcached instance resource name in the format:
   *      `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
   *  where `location_id` refers to a GCP region
   */
  // const name = 'abc123'

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callDeleteInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await memcacheClient.deleteInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteInstance();

deleteInstance(request, options, callback)

deleteInstance(request: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IDeleteInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteInstance(request, callback)

deleteInstance(request: protos.google.cloud.memcache.v1.IDeleteInstanceRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IDeleteInstanceRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getInstance(request, options)

getInstance(request?: protos.google.cloud.memcache.v1.IGetInstanceRequest, options?: CallOptions): Promise<[protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IGetInstanceRequest | undefined, {} | undefined]>;

Gets details of a single Instance.

Parameters
NameDescription
request protos.google.cloud.memcache.v1.IGetInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IGetInstanceRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Instance]. 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.
   */
  /**
   *  Required. Memcached instance resource name in the format:
   *      `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
   *  where `location_id` refers to a GCP region
   */
  // const name = 'abc123'

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callGetInstance() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await memcacheClient.getInstance(request);
    console.log(response);
  }

  callGetInstance();

getInstance(request, options, callback)

getInstance(request: protos.google.cloud.memcache.v1.IGetInstanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IGetInstanceRequest
options CallOptions
callback Callback<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getInstance(request, callback)

getInstance(request: protos.google.cloud.memcache.v1.IGetInstanceRequest, callback: Callback<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IGetInstanceRequest
callback Callback<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IGetInstanceRequest | 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

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.

instancePath(project, location, instance)

instancePath(project: string, location: string, instance: string): string;

Return a fully-qualified instance resource name string.

Parameters
NameDescription
project string
location string
instance string
Returns
TypeDescription
string

{string} Resource name string.

listInstances(request, options)

listInstances(request?: protos.google.cloud.memcache.v1.IListInstancesRequest, options?: CallOptions): Promise<[protos.google.cloud.memcache.v1.IInstance[], protos.google.cloud.memcache.v1.IListInstancesRequest | null, protos.google.cloud.memcache.v1.IListInstancesResponse]>;

Lists Instances in a given location.

Parameters
NameDescription
request protos.google.cloud.memcache.v1.IListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.memcache.v1.IInstance[], protos.google.cloud.memcache.v1.IListInstancesRequest | null, protos.google.cloud.memcache.v1.IListInstancesResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Instance]. 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 listInstancesAsync() 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.

listInstances(request, options, callback)

listInstances(request: protos.google.cloud.memcache.v1.IListInstancesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.memcache.v1.IListInstancesRequest, protos.google.cloud.memcache.v1.IListInstancesResponse | null | undefined, protos.google.cloud.memcache.v1.IInstance>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IListInstancesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.memcache.v1.IListInstancesRequest, protos.google.cloud.memcache.v1.IListInstancesResponse | null | undefined, protos.google.cloud.memcache.v1.IInstance>
Returns
TypeDescription
void

listInstances(request, callback)

listInstances(request: protos.google.cloud.memcache.v1.IListInstancesRequest, callback: PaginationCallback<protos.google.cloud.memcache.v1.IListInstancesRequest, protos.google.cloud.memcache.v1.IListInstancesResponse | null | undefined, protos.google.cloud.memcache.v1.IInstance>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IListInstancesRequest
callback PaginationCallback<protos.google.cloud.memcache.v1.IListInstancesRequest, protos.google.cloud.memcache.v1.IListInstancesResponse | null | undefined, protos.google.cloud.memcache.v1.IInstance>
Returns
TypeDescription
void

listInstancesAsync(request, options)

listInstancesAsync(request?: protos.google.cloud.memcache.v1.IListInstancesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.memcache.v1.IInstance>;

Equivalent to listInstances, 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.memcache.v1.IListInstancesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.memcache.v1.IInstance>

{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 [Instance]. 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.
   */
  /**
   *  Required. The resource name of the instance location using the form:
   *      `projects/{project_id}/locations/{location_id}`
   *  where `location_id` refers to a GCP region
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of items to return.
   *  If not specified, a default value of 1000 will be used by the service.
   *  Regardless of the page_size value, the response may include a partial list
   *  and a caller should only rely on response's
   *  next_page_token CloudMemcache.ListInstancesResponse.next_page_token
   *  to determine if there are more instances left to be queried.
   */
  // const pageSize = 1234
  /**
   *  The next_page_token value returned from a previous List request,
   *  if any.
   */
  // const pageToken = 'abc123'
  /**
   *  List filter. For example, exclude all Memcached instances with name as
   *  my-instance by specifying "name != my-instance".
   */
  // const filter = 'abc123'
  /**
   *  Sort results. Supported values are "name", "name desc" or "" (unsorted).
   */
  // const orderBy = 'abc123'

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callListInstances() {
    // Construct request
    const request = {
      parent,
    };

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

  callListInstances();

listInstancesStream(request, options)

listInstancesStream(request?: protos.google.cloud.memcache.v1.IListInstancesRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.cloud.memcache.v1.IListInstancesRequest

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 [Instance] 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 listInstancesAsync() 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.

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

matchInstanceFromInstanceName(instanceName)

matchInstanceFromInstanceName(instanceName: string): string | number;

Parse the instance from Instance resource.

Parameter
NameDescription
instanceName string

A fully-qualified path representing Instance resource.

Returns
TypeDescription
string | number

{string} A string representing the instance.

matchLocationFromInstanceName(instanceName)

matchLocationFromInstanceName(instanceName: string): string | number;

Parse the location from Instance resource.

Parameter
NameDescription
instanceName string

A fully-qualified path representing Instance resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromInstanceName(instanceName)

matchProjectFromInstanceName(instanceName: string): string | number;

Parse the project from Instance resource.

Parameter
NameDescription
instanceName string

A fully-qualified path representing Instance resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

updateInstance(request, options)

updateInstance(request?: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, options?: CallOptions): Promise<[LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Updates an existing Instance in a given project and location.

Parameters
NameDescription
request protos.google.cloud.memcache.v1.IUpdateInstanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Mask of fields to update.
   *   *   `displayName`
   */
  // const updateMask = {}
  /**
   *  Required. A Memcached Instance.
   *  Only fields specified in update_mask are updated.
   */
  // const instance = {}

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callUpdateInstance() {
    // Construct request
    const request = {
      updateMask,
      instance,
    };

    // Run request
    const [operation] = await memcacheClient.updateInstance(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateInstance();

updateInstance(request, options, callback)

updateInstance(request: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IUpdateInstanceRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateInstance(request, callback)

updateInstance(request: protos.google.cloud.memcache.v1.IUpdateInstanceRequest, callback: Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IUpdateInstanceRequest
callback Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateParameters(request, options)

updateParameters(request?: protos.google.cloud.memcache.v1.IUpdateParametersRequest, options?: CallOptions): Promise<[LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;

Updates the defined Memcached Parameters for an existing Instance. This method only stages the parameters, it must be followed by ApplyParameters to apply the parameters to nodes of the Memcached Instance.

Parameters
NameDescription
request protos.google.cloud.memcache.v1.IUpdateParametersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.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. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Resource name of the Memcached instance for which the parameters should be
   *  updated.
   */
  // const name = 'abc123'
  /**
   *  Required. Mask of fields to update.
   */
  // const updateMask = {}
  /**
   *  The parameters to apply to the instance.
   */
  // const parameters = {}

  // Imports the Memcache library
  const {CloudMemcacheClient} = require('@google-cloud/memcache').v1;

  // Instantiates a client
  const memcacheClient = new CloudMemcacheClient();

  async function callUpdateParameters() {
    // Construct request
    const request = {
      name,
      updateMask,
    };

    // Run request
    const [operation] = await memcacheClient.updateParameters(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateParameters();

updateParameters(request, options, callback)

updateParameters(request: protos.google.cloud.memcache.v1.IUpdateParametersRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IUpdateParametersRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateParameters(request, callback)

updateParameters(request: protos.google.cloud.memcache.v1.IUpdateParametersRequest, callback: Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.memcache.v1.IUpdateParametersRequest
callback Callback<LROperation<protos.google.cloud.memcache.v1.IInstance, protos.google.cloud.memcache.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void