Class v1.ManagedKafkaClient (0.1.0)

The service that a client application uses to manage Apache Kafka clusters, topics and consumer groups. v1

Package

@google-cloud/managedkafka

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of ManagedKafkaClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new ManagedKafkaClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

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

locationsClient

locationsClient: LocationsClient;

managedKafkaStub

managedKafkaStub?: Promise<{
        [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.

universeDomain

get universeDomain(): string;

warn

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

Methods

cancelOperation(request, options, callback)

cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED.

Parameters
Name Description
request CancelOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});

checkCreateClusterProgress(name)

checkCreateClusterProgress(name: string): Promise<LROperation<protos.google.cloud.managedkafka.v1.Cluster, protos.google.cloud.managedkafka.v1.OperationMetadata>>;

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

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.managedkafka.v1.Cluster, protos.google.cloud.managedkafka.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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent region in which to create the cluster. Structured like
   *  `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ID to use for the cluster, which will become the final
   *  component of the cluster's name. The ID must be 1-63 characters long, and
   *  match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply with
   *  RFC 1035.
   *  This value is structured like: `my-cluster-id`.
   */
  // const clusterId = 'abc123'
  /**
   *  Required. Configuration of the cluster to create. Its `name` field is
   *  ignored.
   */
  // const cluster = {}
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID to avoid duplication of requests. If a request times out or
   *  fails, retrying with the same ID allows the server to recognize the
   *  previous attempt. For at least 60 minutes, the server ignores duplicate
   *  requests bearing the same ID.
   *  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
   *  within 60 minutes of the last request, the server checks if an original
   *  operation with the same request ID was received. If so, the server ignores
   *  the second request.
   *  The request ID must be a valid UUID. A zero UUID is not supported
   *  (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

  async function callCreateCluster() {
    // Construct request
    const request = {
      parent,
      clusterId,
      cluster,
    };

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

  callCreateCluster();

checkDeleteClusterProgress(name)

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

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

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.managedkafka.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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the cluster to delete.
   */
  // const name = 'abc123'
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID to avoid duplication of requests. If a request times out or
   *  fails, retrying with the same ID allows the server to recognize the
   *  previous attempt. For at least 60 minutes, the server ignores duplicate
   *  requests bearing the same ID.
   *  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
   *  within 60 minutes of the last request, the server checks if an original
   *  operation with the same request ID was received. If so, the server ignores
   *  the second request.
   *  The request ID must be a valid UUID. A zero UUID is not supported
   *  (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

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

  callDeleteCluster();

checkUpdateClusterProgress(name)

checkUpdateClusterProgress(name: string): Promise<LROperation<protos.google.cloud.managedkafka.v1.Cluster, protos.google.cloud.managedkafka.v1.OperationMetadata>>;

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

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.managedkafka.v1.Cluster, protos.google.cloud.managedkafka.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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Field mask is used to specify the fields to be overwritten in the
   *  cluster resource by the update. The fields specified in the update_mask are
   *  relative to the resource, not the full request. A field will be overwritten
   *  if it is in the mask. The mask is required and a value of * will update all
   *  fields.
   */
  // const updateMask = {}
  /**
   *  Required. The cluster to update. Its `name` field must be populated.
   */
  // const cluster = {}
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID to avoid duplication of requests. If a request times out or
   *  fails, retrying with the same ID allows the server to recognize the
   *  previous attempt. For at least 60 minutes, the server ignores duplicate
   *  requests bearing the same ID.
   *  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
   *  within 60 minutes of the last request, the server checks if an original
   *  operation with the same request ID was received. If so, the server ignores
   *  the second request.
   *  The request ID must be a valid UUID. A zero UUID is not supported
   *  (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

  async function callUpdateCluster() {
    // Construct request
    const request = {
      updateMask,
      cluster,
    };

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

  callUpdateCluster();

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
Type Description
Promise<void>

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

clusterPath(project, location, cluster)

clusterPath(project: string, location: string, cluster: string): string;

Return a fully-qualified cluster resource name string.

Parameters
Name Description
project string
location string
cluster string
Returns
Type Description
string

{string} Resource name string.

consumerGroupPath(project, location, cluster, consumerGroup)

consumerGroupPath(project: string, location: string, cluster: string, consumerGroup: string): string;

Return a fully-qualified consumerGroup resource name string.

Parameters
Name Description
project string
location string
cluster string
consumerGroup string
Returns
Type Description
string

{string} Resource name string.

createCluster(request, options)

createCluster(request?: protos.google.cloud.managedkafka.v1.ICreateClusterRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a new cluster in a given project and location.

Parameters
Name Description
request ICreateClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent region in which to create the cluster. Structured like
   *  `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ID to use for the cluster, which will become the final
   *  component of the cluster's name. The ID must be 1-63 characters long, and
   *  match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply with
   *  RFC 1035.
   *  This value is structured like: `my-cluster-id`.
   */
  // const clusterId = 'abc123'
  /**
   *  Required. Configuration of the cluster to create. Its `name` field is
   *  ignored.
   */
  // const cluster = {}
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID to avoid duplication of requests. If a request times out or
   *  fails, retrying with the same ID allows the server to recognize the
   *  previous attempt. For at least 60 minutes, the server ignores duplicate
   *  requests bearing the same ID.
   *  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
   *  within 60 minutes of the last request, the server checks if an original
   *  operation with the same request ID was received. If so, the server ignores
   *  the second request.
   *  The request ID must be a valid UUID. A zero UUID is not supported
   *  (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

  async function callCreateCluster() {
    // Construct request
    const request = {
      parent,
      clusterId,
      cluster,
    };

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

  callCreateCluster();

createCluster(request, options, callback)

createCluster(request: protos.google.cloud.managedkafka.v1.ICreateClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createCluster(request, callback)

createCluster(request: protos.google.cloud.managedkafka.v1.ICreateClusterRequest, callback: Callback<LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateClusterRequest
callback Callback<LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createTopic(request, options)

createTopic(request?: protos.google.cloud.managedkafka.v1.ICreateTopicRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.ITopic,
        protos.google.cloud.managedkafka.v1.ICreateTopicRequest | undefined,
        {} | undefined
    ]>;

Creates a new topic in a given project and location.

Parameters
Name Description
request ICreateTopicRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.ICreateTopicRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Topic. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent cluster in which to create the topic.
   *  Structured like
   *  `projects/{project}/locations/{location}/clusters/{cluster}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ID to use for the topic, which will become the final
   *  component of the topic's name.
   *  This value is structured like: `my-topic-name`.
   */
  // const topicId = 'abc123'
  /**
   *  Required. Configuration of the topic to create. Its `name` field is
   *  ignored.
   */
  // const topic = {}

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

  async function callCreateTopic() {
    // Construct request
    const request = {
      parent,
      topicId,
      topic,
    };

    // Run request
    const response = await managedkafkaClient.createTopic(request);
    console.log(response);
  }

  callCreateTopic();

createTopic(request, options, callback)

createTopic(request: protos.google.cloud.managedkafka.v1.ICreateTopicRequest, options: CallOptions, callback: Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.ICreateTopicRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateTopicRequest
options CallOptions
callback Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.ICreateTopicRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createTopic(request, callback)

createTopic(request: protos.google.cloud.managedkafka.v1.ICreateTopicRequest, callback: Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.ICreateTopicRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateTopicRequest
callback Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.ICreateTopicRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteCluster(request, options)

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

Deletes a single cluster.

Parameters
Name Description
request IDeleteClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the cluster to delete.
   */
  // const name = 'abc123'
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID to avoid duplication of requests. If a request times out or
   *  fails, retrying with the same ID allows the server to recognize the
   *  previous attempt. For at least 60 minutes, the server ignores duplicate
   *  requests bearing the same ID.
   *  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
   *  within 60 minutes of the last request, the server checks if an original
   *  operation with the same request ID was received. If so, the server ignores
   *  the second request.
   *  The request ID must be a valid UUID. A zero UUID is not supported
   *  (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

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

  callDeleteCluster();

deleteCluster(request, options, callback)

deleteCluster(request: protos.google.cloud.managedkafka.v1.IDeleteClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteCluster(request, callback)

deleteCluster(request: protos.google.cloud.managedkafka.v1.IDeleteClusterRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteClusterRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteConsumerGroup(request, options)

deleteConsumerGroup(request?: protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest | undefined),
        {} | undefined
    ]>;

Deletes a single consumer group.

Parameters
Name Description
request IDeleteConsumerGroupRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the consumer group to delete.
   *  `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`.
   */
  // const name = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

    // Run request
    const response = await managedkafkaClient.deleteConsumerGroup(request);
    console.log(response);
  }

  callDeleteConsumerGroup();

deleteConsumerGroup(request, options, callback)

deleteConsumerGroup(request: protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteConsumerGroupRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteConsumerGroup(request, callback)

deleteConsumerGroup(request: protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteConsumerGroupRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteConsumerGroupRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteOperation(request, options, callback)

deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
Name Description
request DeleteOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});

deleteTopic(request, options)

deleteTopic(request?: protos.google.cloud.managedkafka.v1.IDeleteTopicRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.cloud.managedkafka.v1.IDeleteTopicRequest | undefined,
        {} | undefined
    ]>;

Deletes a single topic.

Parameters
Name Description
request IDeleteTopicRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteTopicRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the topic to delete.
   *  `projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}`.
   */
  // const name = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

    // Run request
    const response = await managedkafkaClient.deleteTopic(request);
    console.log(response);
  }

  callDeleteTopic();

deleteTopic(request, options, callback)

deleteTopic(request: protos.google.cloud.managedkafka.v1.IDeleteTopicRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteTopicRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteTopicRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteTopicRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteTopic(request, callback)

deleteTopic(request: protos.google.cloud.managedkafka.v1.IDeleteTopicRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteTopicRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteTopicRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.managedkafka.v1.IDeleteTopicRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getCluster(request, options)

getCluster(request?: protos.google.cloud.managedkafka.v1.IGetClusterRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.ICluster,
        protos.google.cloud.managedkafka.v1.IGetClusterRequest | undefined,
        {} | undefined
    ]>;

Returns the properties of a single cluster.

Parameters
Name Description
request IGetClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IGetClusterRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the cluster whose configuration to return.
   */
  // const name = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

    // Run request
    const response = await managedkafkaClient.getCluster(request);
    console.log(response);
  }

  callGetCluster();

getCluster(request, options, callback)

getCluster(request: protos.google.cloud.managedkafka.v1.IGetClusterRequest, options: CallOptions, callback: Callback<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IGetClusterRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetClusterRequest
options CallOptions
callback Callback<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IGetClusterRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getCluster(request, callback)

getCluster(request: protos.google.cloud.managedkafka.v1.IGetClusterRequest, callback: Callback<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IGetClusterRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetClusterRequest
callback Callback<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IGetClusterRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getConsumerGroup(request, options)

getConsumerGroup(request?: protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.IConsumerGroup,
        protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest | undefined,
        {} | undefined
    ]>;

Returns the properties of a single consumer group.

Parameters
Name Description
request IGetConsumerGroupRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ConsumerGroup. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the consumer group whose configuration to return.
   *  `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`.
   */
  // const name = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

    // Run request
    const response = await managedkafkaClient.getConsumerGroup(request);
    console.log(response);
  }

  callGetConsumerGroup();

getConsumerGroup(request, options, callback)

getConsumerGroup(request: protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest, options: CallOptions, callback: Callback<protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetConsumerGroupRequest
options CallOptions
callback Callback<protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getConsumerGroup(request, callback)

getConsumerGroup(request: protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest, callback: Callback<protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetConsumerGroupRequest
callback Callback<protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IGetConsumerGroupRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
Name Description
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
Promise<google.cloud.location.ILocation>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

const [response] = await client.getLocation(request);

getOperation(request, options, callback)

getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
Name Description
request GetOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<[protos.google.longrunning.Operation]>
Example

const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

getTopic(request, options)

getTopic(request?: protos.google.cloud.managedkafka.v1.IGetTopicRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.ITopic,
        protos.google.cloud.managedkafka.v1.IGetTopicRequest | undefined,
        {} | undefined
    ]>;

Returns the properties of a single topic.

Parameters
Name Description
request IGetTopicRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IGetTopicRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Topic. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the topic whose configuration to return. Structured
   *  like:
   *  projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}.
   */
  // const name = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

    // Run request
    const response = await managedkafkaClient.getTopic(request);
    console.log(response);
  }

  callGetTopic();

getTopic(request, options, callback)

getTopic(request: protos.google.cloud.managedkafka.v1.IGetTopicRequest, options: CallOptions, callback: Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IGetTopicRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetTopicRequest
options CallOptions
callback Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IGetTopicRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getTopic(request, callback)

getTopic(request: protos.google.cloud.managedkafka.v1.IGetTopicRequest, callback: Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IGetTopicRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetTopicRequest
callback Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IGetTopicRequest | null | undefined, {} | null | undefined>
Returns
Type Description
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
Type Description
Promise<{ [name: string]: Function; }>

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

listClusters(request, options)

listClusters(request?: protos.google.cloud.managedkafka.v1.IListClustersRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.ICluster[],
        protos.google.cloud.managedkafka.v1.IListClustersRequest | null,
        protos.google.cloud.managedkafka.v1.IListClustersResponse
    ]>;

Lists the clusters in a given project and location.

Parameters
Name Description
request IListClustersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.ICluster[], protos.google.cloud.managedkafka.v1.IListClustersRequest | null, protos.google.cloud.managedkafka.v1.IListClustersResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 listClustersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listClusters(request, options, callback)

listClusters(request: protos.google.cloud.managedkafka.v1.IListClustersRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.managedkafka.v1.IListClustersRequest, protos.google.cloud.managedkafka.v1.IListClustersResponse | null | undefined, protos.google.cloud.managedkafka.v1.ICluster>): void;
Parameters
Name Description
request IListClustersRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.managedkafka.v1.IListClustersRequest, protos.google.cloud.managedkafka.v1.IListClustersResponse | null | undefined, protos.google.cloud.managedkafka.v1.ICluster>
Returns
Type Description
void

listClusters(request, callback)

listClusters(request: protos.google.cloud.managedkafka.v1.IListClustersRequest, callback: PaginationCallback<protos.google.cloud.managedkafka.v1.IListClustersRequest, protos.google.cloud.managedkafka.v1.IListClustersResponse | null | undefined, protos.google.cloud.managedkafka.v1.ICluster>): void;
Parameters
Name Description
request IListClustersRequest
callback PaginationCallback<protos.google.cloud.managedkafka.v1.IListClustersRequest, protos.google.cloud.managedkafka.v1.IListClustersResponse | null | undefined, protos.google.cloud.managedkafka.v1.ICluster>
Returns
Type Description
void

listClustersAsync(request, options)

listClustersAsync(request?: protos.google.cloud.managedkafka.v1.IListClustersRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.managedkafka.v1.ICluster>;

Equivalent to listClusters, but returns an iterable object.

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

Parameters
Name Description
request IListClustersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.managedkafka.v1.ICluster>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent location whose clusters are to be listed. Structured
   *  like `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of clusters to return. The service may return
   *  fewer than this value. If unspecified, server will pick an appropriate
   *  default.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous `ListClusters` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListClusters` must match
   *  the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. Filter expression for the result.
   */
  // const filter = 'abc123'
  /**
   *  Optional. Order by fields for the result.
   */
  // const orderBy = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

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

  callListClusters();

listClustersStream(request, options)

listClustersStream(request?: protos.google.cloud.managedkafka.v1.IListClustersRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListClustersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing 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 listClustersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listConsumerGroups(request, options)

listConsumerGroups(request?: protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.IConsumerGroup[],
        protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest | null,
        protos.google.cloud.managedkafka.v1.IListConsumerGroupsResponse
    ]>;

Lists the consumer groups in a given cluster.

Parameters
Name Description
request IListConsumerGroupsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.IConsumerGroup[], protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest | null, protos.google.cloud.managedkafka.v1.IListConsumerGroupsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of ConsumerGroup. 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 listConsumerGroupsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listConsumerGroups(request, options, callback)

listConsumerGroups(request: protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, protos.google.cloud.managedkafka.v1.IListConsumerGroupsResponse | null | undefined, protos.google.cloud.managedkafka.v1.IConsumerGroup>): void;
Parameters
Name Description
request IListConsumerGroupsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, protos.google.cloud.managedkafka.v1.IListConsumerGroupsResponse | null | undefined, protos.google.cloud.managedkafka.v1.IConsumerGroup>
Returns
Type Description
void

listConsumerGroups(request, callback)

listConsumerGroups(request: protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, callback: PaginationCallback<protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, protos.google.cloud.managedkafka.v1.IListConsumerGroupsResponse | null | undefined, protos.google.cloud.managedkafka.v1.IConsumerGroup>): void;
Parameters
Name Description
request IListConsumerGroupsRequest
callback PaginationCallback<protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, protos.google.cloud.managedkafka.v1.IListConsumerGroupsResponse | null | undefined, protos.google.cloud.managedkafka.v1.IConsumerGroup>
Returns
Type Description
void

listConsumerGroupsAsync(request, options)

listConsumerGroupsAsync(request?: protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.managedkafka.v1.IConsumerGroup>;

Equivalent to listConsumerGroups, but returns an iterable object.

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

Parameters
Name Description
request IListConsumerGroupsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.managedkafka.v1.IConsumerGroup>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing ConsumerGroup. 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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent cluster whose consumer groups are to be listed.
   *  Structured like
   *  `projects/{project}/locations/{location}/clusters/{cluster}`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of consumer groups to return. The service may
   *  return fewer than this value. If unset or zero, all consumer groups for the
   *  parent is returned.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous `ListConsumerGroups` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListConsumerGroups` must
   *  match the call that provided the page token.
   */
  // const pageToken = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

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

  callListConsumerGroups();

listConsumerGroupsStream(request, options)

listConsumerGroupsStream(request?: protos.google.cloud.managedkafka.v1.IListConsumerGroupsRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListConsumerGroupsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing ConsumerGroup 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 listConsumerGroupsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

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

Parameters
Name Description
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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 for more details and examples.

Example

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
Name Description
request ListOperationsRequest

The request object that will be sent.

options CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

Returns
Type Description
AsyncIterable<protos.google.longrunning.ListOperationsResponse>

{Object} An iterable Object that conforms to iteration protocols.

Example

const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)

listTopics(request, options)

listTopics(request?: protos.google.cloud.managedkafka.v1.IListTopicsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.ITopic[],
        protos.google.cloud.managedkafka.v1.IListTopicsRequest | null,
        protos.google.cloud.managedkafka.v1.IListTopicsResponse
    ]>;

Lists the topics in a given cluster.

Parameters
Name Description
request IListTopicsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.ITopic[], protos.google.cloud.managedkafka.v1.IListTopicsRequest | null, protos.google.cloud.managedkafka.v1.IListTopicsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Topic. 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 listTopicsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listTopics(request, options, callback)

listTopics(request: protos.google.cloud.managedkafka.v1.IListTopicsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.managedkafka.v1.IListTopicsRequest, protos.google.cloud.managedkafka.v1.IListTopicsResponse | null | undefined, protos.google.cloud.managedkafka.v1.ITopic>): void;
Parameters
Name Description
request IListTopicsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.managedkafka.v1.IListTopicsRequest, protos.google.cloud.managedkafka.v1.IListTopicsResponse | null | undefined, protos.google.cloud.managedkafka.v1.ITopic>
Returns
Type Description
void

listTopics(request, callback)

listTopics(request: protos.google.cloud.managedkafka.v1.IListTopicsRequest, callback: PaginationCallback<protos.google.cloud.managedkafka.v1.IListTopicsRequest, protos.google.cloud.managedkafka.v1.IListTopicsResponse | null | undefined, protos.google.cloud.managedkafka.v1.ITopic>): void;
Parameters
Name Description
request IListTopicsRequest
callback PaginationCallback<protos.google.cloud.managedkafka.v1.IListTopicsRequest, protos.google.cloud.managedkafka.v1.IListTopicsResponse | null | undefined, protos.google.cloud.managedkafka.v1.ITopic>
Returns
Type Description
void

listTopicsAsync(request, options)

listTopicsAsync(request?: protos.google.cloud.managedkafka.v1.IListTopicsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.managedkafka.v1.ITopic>;

Equivalent to listTopics, but returns an iterable object.

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

Parameters
Name Description
request IListTopicsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.managedkafka.v1.ITopic>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Topic. 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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent cluster whose topics are to be listed. Structured like
   *  `projects/{project}/locations/{location}/clusters/{cluster}`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of topics to return. The service may return
   *  fewer than this value. If unset or zero, all topics for the parent is
   *  returned.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous `ListTopics` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListTopics` must match
   *  the call that provided the page token.
   */
  // const pageToken = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

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

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

  callListTopics();

listTopicsStream(request, options)

listTopicsStream(request?: protos.google.cloud.managedkafka.v1.IListTopicsRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListTopicsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing Topic 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 listTopicsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

locationPath(project, location)

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

Return a fully-qualified location resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

matchClusterFromClusterName(clusterName)

matchClusterFromClusterName(clusterName: string): string | number;

Parse the cluster from Cluster resource.

Parameter
Name Description
clusterName string

A fully-qualified path representing Cluster resource.

Returns
Type Description
string | number

{string} A string representing the cluster.

matchClusterFromConsumerGroupName(consumerGroupName)

matchClusterFromConsumerGroupName(consumerGroupName: string): string | number;

Parse the cluster from ConsumerGroup resource.

Parameter
Name Description
consumerGroupName string

A fully-qualified path representing ConsumerGroup resource.

Returns
Type Description
string | number

{string} A string representing the cluster.

matchClusterFromTopicName(topicName)

matchClusterFromTopicName(topicName: string): string | number;

Parse the cluster from Topic resource.

Parameter
Name Description
topicName string

A fully-qualified path representing Topic resource.

Returns
Type Description
string | number

{string} A string representing the cluster.

matchConsumerGroupFromConsumerGroupName(consumerGroupName)

matchConsumerGroupFromConsumerGroupName(consumerGroupName: string): string | number;

Parse the consumer_group from ConsumerGroup resource.

Parameter
Name Description
consumerGroupName string

A fully-qualified path representing ConsumerGroup resource.

Returns
Type Description
string | number

{string} A string representing the consumer_group.

matchLocationFromClusterName(clusterName)

matchLocationFromClusterName(clusterName: string): string | number;

Parse the location from Cluster resource.

Parameter
Name Description
clusterName string

A fully-qualified path representing Cluster resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromConsumerGroupName(consumerGroupName)

matchLocationFromConsumerGroupName(consumerGroupName: string): string | number;

Parse the location from ConsumerGroup resource.

Parameter
Name Description
consumerGroupName string

A fully-qualified path representing ConsumerGroup resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromTopicName(topicName)

matchLocationFromTopicName(topicName: string): string | number;

Parse the location from Topic resource.

Parameter
Name Description
topicName string

A fully-qualified path representing Topic resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchProjectFromClusterName(clusterName)

matchProjectFromClusterName(clusterName: string): string | number;

Parse the project from Cluster resource.

Parameter
Name Description
clusterName string

A fully-qualified path representing Cluster resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromConsumerGroupName(consumerGroupName)

matchProjectFromConsumerGroupName(consumerGroupName: string): string | number;

Parse the project from ConsumerGroup resource.

Parameter
Name Description
consumerGroupName string

A fully-qualified path representing ConsumerGroup resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
Name Description
projectName string

A fully-qualified path representing Project resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromTopicName(topicName)

matchProjectFromTopicName(topicName: string): string | number;

Parse the project from Topic resource.

Parameter
Name Description
topicName string

A fully-qualified path representing Topic resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchTopicFromTopicName(topicName)

matchTopicFromTopicName(topicName: string): string | number;

Parse the topic from Topic resource.

Parameter
Name Description
topicName string

A fully-qualified path representing Topic resource.

Returns
Type Description
string | number

{string} A string representing the topic.

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
Name Description
project string
Returns
Type Description
string

{string} Resource name string.

topicPath(project, location, cluster, topic)

topicPath(project: string, location: string, cluster: string, topic: string): string;

Return a fully-qualified topic resource name string.

Parameters
Name Description
project string
location string
cluster string
topic string
Returns
Type Description
string

{string} Resource name string.

updateCluster(request, options)

updateCluster(request?: protos.google.cloud.managedkafka.v1.IUpdateClusterRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Updates the properties of a single cluster.

Parameters
Name Description
request IUpdateClusterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.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 for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Field mask is used to specify the fields to be overwritten in the
   *  cluster resource by the update. The fields specified in the update_mask are
   *  relative to the resource, not the full request. A field will be overwritten
   *  if it is in the mask. The mask is required and a value of * will update all
   *  fields.
   */
  // const updateMask = {}
  /**
   *  Required. The cluster to update. Its `name` field must be populated.
   */
  // const cluster = {}
  /**
   *  Optional. An optional request ID to identify requests. Specify a unique
   *  request ID to avoid duplication of requests. If a request times out or
   *  fails, retrying with the same ID allows the server to recognize the
   *  previous attempt. For at least 60 minutes, the server ignores duplicate
   *  requests bearing the same ID.
   *  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
   *  within 60 minutes of the last request, the server checks if an original
   *  operation with the same request ID was received. If so, the server ignores
   *  the second request.
   *  The request ID must be a valid UUID. A zero UUID is not supported
   *  (00000000-0000-0000-0000-000000000000).
   */
  // const requestId = 'abc123'

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

  async function callUpdateCluster() {
    // Construct request
    const request = {
      updateMask,
      cluster,
    };

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

  callUpdateCluster();

updateCluster(request, options, callback)

updateCluster(request: protos.google.cloud.managedkafka.v1.IUpdateClusterRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateClusterRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateCluster(request, callback)

updateCluster(request: protos.google.cloud.managedkafka.v1.IUpdateClusterRequest, callback: Callback<LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateClusterRequest
callback Callback<LROperation<protos.google.cloud.managedkafka.v1.ICluster, protos.google.cloud.managedkafka.v1.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateConsumerGroup(request, options)

updateConsumerGroup(request?: protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.IConsumerGroup,
        (protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest | undefined),
        {} | undefined
    ]>;

Updates the properties of a single consumer group.

Parameters
Name Description
request IUpdateConsumerGroupRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.IConsumerGroup, (protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ConsumerGroup. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Field mask is used to specify the fields to be overwritten in the
   *  ConsumerGroup resource by the update.
   *  The fields specified in the update_mask are relative to the resource, not
   *  the full request. A field will be overwritten if it is in the mask. The
   *  mask is required and a value of * will update all fields.
   */
  // const updateMask = {}
  /**
   *  Required. The consumer group to update. Its `name` field must be populated.
   */
  // const consumerGroup = {}

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

  async function callUpdateConsumerGroup() {
    // Construct request
    const request = {
      updateMask,
      consumerGroup,
    };

    // Run request
    const response = await managedkafkaClient.updateConsumerGroup(request);
    console.log(response);
  }

  callUpdateConsumerGroup();

updateConsumerGroup(request, options, callback)

updateConsumerGroup(request: protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest, options: CallOptions, callback: Callback<protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateConsumerGroupRequest
options CallOptions
callback Callback<protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateConsumerGroup(request, callback)

updateConsumerGroup(request: protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest, callback: Callback<protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateConsumerGroupRequest
callback Callback<protos.google.cloud.managedkafka.v1.IConsumerGroup, protos.google.cloud.managedkafka.v1.IUpdateConsumerGroupRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateTopic(request, options)

updateTopic(request?: protos.google.cloud.managedkafka.v1.IUpdateTopicRequest, options?: CallOptions): Promise<[
        protos.google.cloud.managedkafka.v1.ITopic,
        protos.google.cloud.managedkafka.v1.IUpdateTopicRequest | undefined,
        {} | undefined
    ]>;

Updates the properties of a single topic.

Parameters
Name Description
request IUpdateTopicRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IUpdateTopicRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Topic. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Field mask is used to specify the fields to be overwritten in the
   *  Topic resource by the update. The fields specified in the update_mask are
   *  relative to the resource, not the full request. A field will be overwritten
   *  if it is in the mask. The mask is required and a value of * will update all
   *  fields.
   */
  // const updateMask = {}
  /**
   *  Required. The topic to update. Its `name` field must be populated.
   */
  // const topic = {}

  // Imports the Managedkafka library
  const {ManagedKafkaClient} = require('@google-cloud/managedkafka').v1;

  // Instantiates a client
  const managedkafkaClient = new ManagedKafkaClient();

  async function callUpdateTopic() {
    // Construct request
    const request = {
      updateMask,
      topic,
    };

    // Run request
    const response = await managedkafkaClient.updateTopic(request);
    console.log(response);
  }

  callUpdateTopic();

updateTopic(request, options, callback)

updateTopic(request: protos.google.cloud.managedkafka.v1.IUpdateTopicRequest, options: CallOptions, callback: Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IUpdateTopicRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateTopicRequest
options CallOptions
callback Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IUpdateTopicRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateTopic(request, callback)

updateTopic(request: protos.google.cloud.managedkafka.v1.IUpdateTopicRequest, callback: Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IUpdateTopicRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateTopicRequest
callback Callback<protos.google.cloud.managedkafka.v1.ITopic, protos.google.cloud.managedkafka.v1.IUpdateTopicRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void