Class ManagedKafkaClient (0.20.0)

GitHub RepositoryProduct Reference

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

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   Cluster response = managedKafkaClient.getCluster(name);
 }
 

Note: close() needs to be called on the ManagedKafkaClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

ListClusters

Lists the clusters in a given project and location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listClusters(ListClustersRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listClusters(LocationName parent)

  • listClusters(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listClustersPagedCallable()

  • listClustersCallable()

GetCluster

Returns the properties of a single cluster.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getCluster(GetClusterRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getCluster(ClusterName name)

  • getCluster(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getClusterCallable()

CreateCluster

Creates a new cluster in a given project and location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createClusterAsync(CreateClusterRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createClusterAsync(LocationName parent, Cluster cluster, String clusterId)

  • createClusterAsync(String parent, Cluster cluster, String clusterId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createClusterOperationCallable()

  • createClusterCallable()

UpdateCluster

Updates the properties of a single cluster.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateClusterAsync(UpdateClusterRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updateClusterAsync(Cluster cluster, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateClusterOperationCallable()

  • updateClusterCallable()

DeleteCluster

Deletes a single cluster.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteClusterAsync(DeleteClusterRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteClusterAsync(ClusterName name)

  • deleteClusterAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteClusterOperationCallable()

  • deleteClusterCallable()

ListTopics

Lists the topics in a given cluster.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listTopics(ListTopicsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listTopics(ClusterName parent)

  • listTopics(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listTopicsPagedCallable()

  • listTopicsCallable()

GetTopic

Returns the properties of a single topic.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getTopic(GetTopicRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getTopic(TopicName name)

  • getTopic(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getTopicCallable()

CreateTopic

Creates a new topic in a given project and location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createTopic(CreateTopicRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createTopic(ClusterName parent, Topic topic, String topicId)

  • createTopic(String parent, Topic topic, String topicId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createTopicCallable()

UpdateTopic

Updates the properties of a single topic.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateTopic(UpdateTopicRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateTopic(Topic topic, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateTopicCallable()

DeleteTopic

Deletes a single topic.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteTopic(DeleteTopicRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteTopic(TopicName name)

  • deleteTopic(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteTopicCallable()

ListConsumerGroups

Lists the consumer groups in a given cluster.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listConsumerGroups(ListConsumerGroupsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listConsumerGroups(ClusterName parent)

  • listConsumerGroups(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listConsumerGroupsPagedCallable()

  • listConsumerGroupsCallable()

GetConsumerGroup

Returns the properties of a single consumer group.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getConsumerGroup(GetConsumerGroupRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getConsumerGroup(ConsumerGroupName name)

  • getConsumerGroup(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getConsumerGroupCallable()

UpdateConsumerGroup

Updates the properties of a single consumer group.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateConsumerGroup(UpdateConsumerGroupRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateConsumerGroup(ConsumerGroup consumerGroup, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateConsumerGroupCallable()

DeleteConsumerGroup

Deletes a single consumer group.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteConsumerGroup(DeleteConsumerGroupRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteConsumerGroup(ConsumerGroupName name)

  • deleteConsumerGroup(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteConsumerGroupCallable()

ListAcls

Lists the acls in a given cluster.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listAcls(ListAclsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listAcls(ClusterName parent)

  • listAcls(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listAclsPagedCallable()

  • listAclsCallable()

GetAcl

Returns the properties of a single acl.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getAcl(GetAclRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getAcl(AclName name)

  • getAcl(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getAclCallable()

CreateAcl

Creates a new acl in the given project, location, and cluster.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createAcl(CreateAclRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createAcl(ClusterName parent, Acl acl, String aclId)

  • createAcl(String parent, Acl acl, String aclId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createAclCallable()

UpdateAcl

Updates the properties of a single acl.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateAcl(UpdateAclRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateAcl(Acl acl, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateAclCallable()

DeleteAcl

Deletes an acl.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteAcl(DeleteAclRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteAcl(AclName name)

  • deleteAcl(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteAclCallable()

AddAclEntry

Incremental update: Adds an acl entry to an acl. Creates the acl if it does not exist yet.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • addAclEntry(AddAclEntryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • addAclEntry(AclName acl, AclEntry aclEntry)

  • addAclEntry(String acl, AclEntry aclEntry)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • addAclEntryCallable()

RemoveAclEntry

Incremental update: Removes an acl entry from an acl. Deletes the acl if its acl entries become empty (i.e. if the removed entry was the last one in the acl).

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • removeAclEntry(RemoveAclEntryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • removeAclEntry(AclName acl, AclEntry aclEntry)

  • removeAclEntry(String acl, AclEntry aclEntry)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • removeAclEntryCallable()

ListLocations

Lists information about the supported locations for this service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ManagedKafkaSettings to create(). For example:

To customize credentials:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ManagedKafkaSettings managedKafkaSettings =
     ManagedKafkaSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create(managedKafkaSettings);
 

To customize the endpoint:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ManagedKafkaSettings managedKafkaSettings =
     ManagedKafkaSettings.newBuilder().setEndpoint(myEndpoint).build();
 ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create(managedKafkaSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ManagedKafkaSettings managedKafkaSettings = ManagedKafkaSettings.newHttpJsonBuilder().build();
 ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create(managedKafkaSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > ManagedKafkaClient

Static Methods

create()

public static final ManagedKafkaClient create()

Constructs an instance of ManagedKafkaClient with default settings.

Returns
Type Description
ManagedKafkaClient
Exceptions
Type Description
IOException

create(ManagedKafkaSettings settings)

public static final ManagedKafkaClient create(ManagedKafkaSettings settings)

Constructs an instance of ManagedKafkaClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings ManagedKafkaSettings
Returns
Type Description
ManagedKafkaClient
Exceptions
Type Description
IOException

create(ManagedKafkaStub stub)

public static final ManagedKafkaClient create(ManagedKafkaStub stub)

Constructs an instance of ManagedKafkaClient, using the given stub for making calls. This is for advanced usage - prefer using create(ManagedKafkaSettings).

Parameter
Name Description
stub ManagedKafkaStub
Returns
Type Description
ManagedKafkaClient

Constructors

ManagedKafkaClient(ManagedKafkaSettings settings)

protected ManagedKafkaClient(ManagedKafkaSettings settings)

Constructs an instance of ManagedKafkaClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings ManagedKafkaSettings

ManagedKafkaClient(ManagedKafkaStub stub)

protected ManagedKafkaClient(ManagedKafkaStub stub)
Parameter
Name Description
stub ManagedKafkaStub

Methods

addAclEntry(AclName acl, AclEntry aclEntry)

public final AddAclEntryResponse addAclEntry(AclName acl, AclEntry aclEntry)

Incremental update: Adds an acl entry to an acl. Creates the acl if it does not exist yet.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   AclName acl = AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]");
   AclEntry aclEntry = AclEntry.newBuilder().build();
   AddAclEntryResponse response = managedKafkaClient.addAclEntry(acl, aclEntry);
 }
 
Parameters
Name Description
acl AclName

Required. The name of the acl to add the acl entry to. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}.

The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. See Acl.name for details.

aclEntry AclEntry

Required. The acl entry to add.

Returns
Type Description
AddAclEntryResponse

addAclEntry(AddAclEntryRequest request)

public final AddAclEntryResponse addAclEntry(AddAclEntryRequest request)

Incremental update: Adds an acl entry to an acl. Creates the acl if it does not exist yet.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   AddAclEntryRequest request =
       AddAclEntryRequest.newBuilder()
           .setAcl(AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString())
           .setAclEntry(AclEntry.newBuilder().build())
           .build();
   AddAclEntryResponse response = managedKafkaClient.addAclEntry(request);
 }
 
Parameter
Name Description
request AddAclEntryRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AddAclEntryResponse

addAclEntry(String acl, AclEntry aclEntry)

public final AddAclEntryResponse addAclEntry(String acl, AclEntry aclEntry)

Incremental update: Adds an acl entry to an acl. Creates the acl if it does not exist yet.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String acl = AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString();
   AclEntry aclEntry = AclEntry.newBuilder().build();
   AddAclEntryResponse response = managedKafkaClient.addAclEntry(acl, aclEntry);
 }
 
Parameters
Name Description
acl String

Required. The name of the acl to add the acl entry to. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}.

The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. See Acl.name for details.

aclEntry AclEntry

Required. The acl entry to add.

Returns
Type Description
AddAclEntryResponse

addAclEntryCallable()

public final UnaryCallable,AddAclEntryResponse> addAclEntryCallable()

Incremental update: Adds an acl entry to an acl. Creates the acl if it does not exist yet.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   AddAclEntryRequest request =
       AddAclEntryRequest.newBuilder()
           .setAcl(AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString())
           .setAclEntry(AclEntry.newBuilder().build())
           .build();
   ApiFuture future =
       managedKafkaClient.addAclEntryCallable().futureCall(request);
   // Do something.
   AddAclEntryResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<AddAclEntryRequest,AddAclEntryResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createAcl(ClusterName parent, Acl acl, String aclId)

public final Acl createAcl(ClusterName parent, Acl acl, String aclId)

Creates a new acl in the given project, location, and cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   Acl acl = Acl.newBuilder().build();
   String aclId = "aclId92636997";
   Acl response = managedKafkaClient.createAcl(parent, acl, aclId);
 }
 
Parameters
Name Description
parent ClusterName

Required. The parent cluster in which to create the acl. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

acl Acl

Required. Configuration of the acl to create. Its name field is ignored.

aclId String

Required. The ID to use for the acl, which will become the final component of the acl's name. The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. acl_id is structured like one of the following:

For acls on the cluster: cluster

For acls on a single resource within the cluster: topic/{resource_name} consumerGroup/{resource_name} transactionalId/{resource_name}

For acls on all resources that match a prefix: topicPrefixed/{resource_name} consumerGroupPrefixed/{resource_name} transactionalIdPrefixed/{resource_name}

For acls on all resources of a given type (i.e. the wildcard literal "*"): allTopics (represents topic/*) allConsumerGroups (represents consumerGroup/*) allTransactionalIds (represents transactionalId/*)

Returns
Type Description
Acl

createAcl(CreateAclRequest request)

public final Acl createAcl(CreateAclRequest request)

Creates a new acl in the given project, location, and cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   CreateAclRequest request =
       CreateAclRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setAclId("aclId92636997")
           .setAcl(Acl.newBuilder().build())
           .build();
   Acl response = managedKafkaClient.createAcl(request);
 }
 
Parameter
Name Description
request CreateAclRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Acl

createAcl(String parent, Acl acl, String aclId)

public final Acl createAcl(String parent, Acl acl, String aclId)

Creates a new acl in the given project, location, and cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   Acl acl = Acl.newBuilder().build();
   String aclId = "aclId92636997";
   Acl response = managedKafkaClient.createAcl(parent, acl, aclId);
 }
 
Parameters
Name Description
parent String

Required. The parent cluster in which to create the acl. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

acl Acl

Required. Configuration of the acl to create. Its name field is ignored.

aclId String

Required. The ID to use for the acl, which will become the final component of the acl's name. The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. acl_id is structured like one of the following:

For acls on the cluster: cluster

For acls on a single resource within the cluster: topic/{resource_name} consumerGroup/{resource_name} transactionalId/{resource_name}

For acls on all resources that match a prefix: topicPrefixed/{resource_name} consumerGroupPrefixed/{resource_name} transactionalIdPrefixed/{resource_name}

For acls on all resources of a given type (i.e. the wildcard literal "*"): allTopics (represents topic/*) allConsumerGroups (represents consumerGroup/*) allTransactionalIds (represents transactionalId/*)

Returns
Type Description
Acl

createAclCallable()

public final UnaryCallable,Acl> createAclCallable()

Creates a new acl in the given project, location, and cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   CreateAclRequest request =
       CreateAclRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setAclId("aclId92636997")
           .setAcl(Acl.newBuilder().build())
           .build();
   ApiFuture future = managedKafkaClient.createAclCallable().futureCall(request);
   // Do something.
   Acl response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateAclRequest,Acl>

createClusterAsync(CreateClusterRequest request)

public final OperationFuture,OperationMetadata> createClusterAsync(CreateClusterRequest request)

Creates a new cluster in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   CreateClusterRequest request =
       CreateClusterRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setClusterId("clusterId561939637")
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Cluster response = managedKafkaClient.createClusterAsync(request).get();
 }
 
Parameter
Name Description
request CreateClusterRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Cluster,OperationMetadata>

createClusterAsync(LocationName parent, Cluster cluster, String clusterId)

public final OperationFuture,OperationMetadata> createClusterAsync(LocationName parent, Cluster cluster, String clusterId)

Creates a new cluster in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Cluster cluster = Cluster.newBuilder().build();
   String clusterId = "clusterId561939637";
   Cluster response = managedKafkaClient.createClusterAsync(parent, cluster, clusterId).get();
 }
 
Parameters
Name Description
parent LocationName

Required. The parent region in which to create the cluster. Structured like projects/{project}/locations/{location}.

cluster Cluster

Required. Configuration of the cluster to create. Its name field is ignored.

clusterId String

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? to comply with RFC 1035.

This value is structured like: my-cluster-id.

Returns
Type Description
OperationFuture<Cluster,OperationMetadata>

createClusterAsync(String parent, Cluster cluster, String clusterId)

public final OperationFuture,OperationMetadata> createClusterAsync(String parent, Cluster cluster, String clusterId)

Creates a new cluster in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Cluster cluster = Cluster.newBuilder().build();
   String clusterId = "clusterId561939637";
   Cluster response = managedKafkaClient.createClusterAsync(parent, cluster, clusterId).get();
 }
 
Parameters
Name Description
parent String

Required. The parent region in which to create the cluster. Structured like projects/{project}/locations/{location}.

cluster Cluster

Required. Configuration of the cluster to create. Its name field is ignored.

clusterId String

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? to comply with RFC 1035.

This value is structured like: my-cluster-id.

Returns
Type Description
OperationFuture<Cluster,OperationMetadata>

createClusterCallable()

public final UnaryCallable,Operation> createClusterCallable()

Creates a new cluster in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   CreateClusterRequest request =
       CreateClusterRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setClusterId("clusterId561939637")
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture future = managedKafkaClient.createClusterCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateClusterRequest,Operation>

createClusterOperationCallable()

public final OperationCallable,Cluster,OperationMetadata> createClusterOperationCallable()

Creates a new cluster in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   CreateClusterRequest request =
       CreateClusterRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setClusterId("clusterId561939637")
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture, OperationMetadata> future =
       managedKafkaClient.createClusterOperationCallable().futureCall(request);
   // Do something.
   Cluster response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateClusterRequest,Cluster,OperationMetadata>

createTopic(ClusterName parent, Topic topic, String topicId)

public final Topic createTopic(ClusterName parent, Topic topic, String topicId)

Creates a new topic in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   Topic topic = Topic.newBuilder().build();
   String topicId = "topicId-1139259734";
   Topic response = managedKafkaClient.createTopic(parent, topic, topicId);
 }
 
Parameters
Name Description
parent ClusterName

Required. The parent cluster in which to create the topic. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

topic Topic

Required. Configuration of the topic to create. Its name field is ignored.

topicId String

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.

Returns
Type Description
Topic

createTopic(CreateTopicRequest request)

public final Topic createTopic(CreateTopicRequest request)

Creates a new topic in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   CreateTopicRequest request =
       CreateTopicRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setTopicId("topicId-1139259734")
           .setTopic(Topic.newBuilder().build())
           .build();
   Topic response = managedKafkaClient.createTopic(request);
 }
 
Parameter
Name Description
request CreateTopicRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Topic

createTopic(String parent, Topic topic, String topicId)

public final Topic createTopic(String parent, Topic topic, String topicId)

Creates a new topic in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   Topic topic = Topic.newBuilder().build();
   String topicId = "topicId-1139259734";
   Topic response = managedKafkaClient.createTopic(parent, topic, topicId);
 }
 
Parameters
Name Description
parent String

Required. The parent cluster in which to create the topic. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

topic Topic

Required. Configuration of the topic to create. Its name field is ignored.

topicId String

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.

Returns
Type Description
Topic

createTopicCallable()

public final UnaryCallable,Topic> createTopicCallable()

Creates a new topic in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   CreateTopicRequest request =
       CreateTopicRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setTopicId("topicId-1139259734")
           .setTopic(Topic.newBuilder().build())
           .build();
   ApiFuture future = managedKafkaClient.createTopicCallable().futureCall(request);
   // Do something.
   Topic response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateTopicRequest,Topic>

deleteAcl(AclName name)

public final void deleteAcl(AclName name)

Deletes an acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   AclName name = AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]");
   managedKafkaClient.deleteAcl(name);
 }
 
Parameter
Name Description
name AclName

Required. The name of the acl to delete. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}.

The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. See Acl.name for details.

deleteAcl(DeleteAclRequest request)

public final void deleteAcl(DeleteAclRequest request)

Deletes an acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteAclRequest request =
       DeleteAclRequest.newBuilder()
           .setName(AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString())
           .build();
   managedKafkaClient.deleteAcl(request);
 }
 
Parameter
Name Description
request DeleteAclRequest

The request object containing all of the parameters for the API call.

deleteAcl(String name)

public final void deleteAcl(String name)

Deletes an acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String name = AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString();
   managedKafkaClient.deleteAcl(name);
 }
 
Parameter
Name Description
name String

Required. The name of the acl to delete. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}.

The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. See Acl.name for details.

deleteAclCallable()

public final UnaryCallable,Empty> deleteAclCallable()

Deletes an acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteAclRequest request =
       DeleteAclRequest.newBuilder()
           .setName(AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString())
           .build();
   ApiFuture future = managedKafkaClient.deleteAclCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteAclRequest,Empty>

deleteClusterAsync(ClusterName name)

public final OperationFuture,OperationMetadata> deleteClusterAsync(ClusterName name)

Deletes a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   managedKafkaClient.deleteClusterAsync(name).get();
 }
 
Parameter
Name Description
name ClusterName

Required. The name of the cluster to delete.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteClusterAsync(DeleteClusterRequest request)

public final OperationFuture,OperationMetadata> deleteClusterAsync(DeleteClusterRequest request)

Deletes a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteClusterRequest request =
       DeleteClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setRequestId("requestId693933066")
           .build();
   managedKafkaClient.deleteClusterAsync(request).get();
 }
 
Parameter
Name Description
request DeleteClusterRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteClusterAsync(String name)

public final OperationFuture,OperationMetadata> deleteClusterAsync(String name)

Deletes a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   managedKafkaClient.deleteClusterAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The name of the cluster to delete.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteClusterCallable()

public final UnaryCallable,Operation> deleteClusterCallable()

Deletes a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteClusterRequest request =
       DeleteClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture future = managedKafkaClient.deleteClusterCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteClusterRequest,Operation>

deleteClusterOperationCallable()

public final OperationCallable,Empty,OperationMetadata> deleteClusterOperationCallable()

Deletes a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteClusterRequest request =
       DeleteClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture, OperationMetadata> future =
       managedKafkaClient.deleteClusterOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteClusterRequest,Empty,OperationMetadata>

deleteConsumerGroup(ConsumerGroupName name)

public final void deleteConsumerGroup(ConsumerGroupName name)

Deletes a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ConsumerGroupName name =
       ConsumerGroupName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[CONSUMER_GROUP]");
   managedKafkaClient.deleteConsumerGroup(name);
 }
 
Parameter
Name Description
name ConsumerGroupName

Required. The name of the consumer group to delete. projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}.

deleteConsumerGroup(DeleteConsumerGroupRequest request)

public final void deleteConsumerGroup(DeleteConsumerGroupRequest request)

Deletes a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteConsumerGroupRequest request =
       DeleteConsumerGroupRequest.newBuilder()
           .setName(
               ConsumerGroupName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[CONSUMER_GROUP]")
                   .toString())
           .build();
   managedKafkaClient.deleteConsumerGroup(request);
 }
 
Parameter
Name Description
request DeleteConsumerGroupRequest

The request object containing all of the parameters for the API call.

deleteConsumerGroup(String name)

public final void deleteConsumerGroup(String name)

Deletes a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String name =
       ConsumerGroupName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[CONSUMER_GROUP]")
           .toString();
   managedKafkaClient.deleteConsumerGroup(name);
 }
 
Parameter
Name Description
name String

Required. The name of the consumer group to delete. projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}.

deleteConsumerGroupCallable()

public final UnaryCallable,Empty> deleteConsumerGroupCallable()

Deletes a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteConsumerGroupRequest request =
       DeleteConsumerGroupRequest.newBuilder()
           .setName(
               ConsumerGroupName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[CONSUMER_GROUP]")
                   .toString())
           .build();
   ApiFuture future =
       managedKafkaClient.deleteConsumerGroupCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteConsumerGroupRequest,Empty>

deleteTopic(DeleteTopicRequest request)

public final void deleteTopic(DeleteTopicRequest request)

Deletes a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteTopicRequest request =
       DeleteTopicRequest.newBuilder()
           .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[TOPIC]").toString())
           .build();
   managedKafkaClient.deleteTopic(request);
 }
 
Parameter
Name Description
request DeleteTopicRequest

The request object containing all of the parameters for the API call.

deleteTopic(TopicName name)

public final void deleteTopic(TopicName name)

Deletes a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[TOPIC]");
   managedKafkaClient.deleteTopic(name);
 }
 
Parameter
Name Description
name TopicName

Required. The name of the topic to delete. projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}.

deleteTopic(String name)

public final void deleteTopic(String name)

Deletes a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String name = TopicName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[TOPIC]").toString();
   managedKafkaClient.deleteTopic(name);
 }
 
Parameter
Name Description
name String

Required. The name of the topic to delete. projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}.

deleteTopicCallable()

public final UnaryCallable,Empty> deleteTopicCallable()

Deletes a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   DeleteTopicRequest request =
       DeleteTopicRequest.newBuilder()
           .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[TOPIC]").toString())
           .build();
   ApiFuture future = managedKafkaClient.deleteTopicCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteTopicRequest,Empty>

getAcl(AclName name)

public final Acl getAcl(AclName name)

Returns the properties of a single acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   AclName name = AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]");
   Acl response = managedKafkaClient.getAcl(name);
 }
 
Parameter
Name Description
name AclName

Required. The name of the acl to return. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}.

The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. See Acl.name for details.

Returns
Type Description
Acl

getAcl(GetAclRequest request)

public final Acl getAcl(GetAclRequest request)

Returns the properties of a single acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetAclRequest request =
       GetAclRequest.newBuilder()
           .setName(AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString())
           .build();
   Acl response = managedKafkaClient.getAcl(request);
 }
 
Parameter
Name Description
request GetAclRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Acl

getAcl(String name)

public final Acl getAcl(String name)

Returns the properties of a single acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String name = AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString();
   Acl response = managedKafkaClient.getAcl(name);
 }
 
Parameter
Name Description
name String

Required. The name of the acl to return. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}.

The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. See Acl.name for details.

Returns
Type Description
Acl

getAclCallable()

public final UnaryCallable,Acl> getAclCallable()

Returns the properties of a single acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetAclRequest request =
       GetAclRequest.newBuilder()
           .setName(AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString())
           .build();
   ApiFuture future = managedKafkaClient.getAclCallable().futureCall(request);
   // Do something.
   Acl response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetAclRequest,Acl>

getCluster(ClusterName name)

public final Cluster getCluster(ClusterName name)

Returns the properties of a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   Cluster response = managedKafkaClient.getCluster(name);
 }
 
Parameter
Name Description
name ClusterName

Required. The name of the cluster whose configuration to return.

Returns
Type Description
Cluster

getCluster(GetClusterRequest request)

public final Cluster getCluster(GetClusterRequest request)

Returns the properties of a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetClusterRequest request =
       GetClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .build();
   Cluster response = managedKafkaClient.getCluster(request);
 }
 
Parameter
Name Description
request GetClusterRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Cluster

getCluster(String name)

public final Cluster getCluster(String name)

Returns the properties of a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   Cluster response = managedKafkaClient.getCluster(name);
 }
 
Parameter
Name Description
name String

Required. The name of the cluster whose configuration to return.

Returns
Type Description
Cluster

getClusterCallable()

public final UnaryCallable,Cluster> getClusterCallable()

Returns the properties of a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetClusterRequest request =
       GetClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .build();
   ApiFuture future = managedKafkaClient.getClusterCallable().futureCall(request);
   // Do something.
   Cluster response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetClusterRequest,Cluster>

getConsumerGroup(ConsumerGroupName name)

public final ConsumerGroup getConsumerGroup(ConsumerGroupName name)

Returns the properties of a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ConsumerGroupName name =
       ConsumerGroupName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[CONSUMER_GROUP]");
   ConsumerGroup response = managedKafkaClient.getConsumerGroup(name);
 }
 
Parameter
Name Description
name ConsumerGroupName

Required. The name of the consumer group whose configuration to return. projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}.

Returns
Type Description
ConsumerGroup

getConsumerGroup(GetConsumerGroupRequest request)

public final ConsumerGroup getConsumerGroup(GetConsumerGroupRequest request)

Returns the properties of a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetConsumerGroupRequest request =
       GetConsumerGroupRequest.newBuilder()
           .setName(
               ConsumerGroupName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[CONSUMER_GROUP]")
                   .toString())
           .build();
   ConsumerGroup response = managedKafkaClient.getConsumerGroup(request);
 }
 
Parameter
Name Description
request GetConsumerGroupRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ConsumerGroup

getConsumerGroup(String name)

public final ConsumerGroup getConsumerGroup(String name)

Returns the properties of a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String name =
       ConsumerGroupName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[CONSUMER_GROUP]")
           .toString();
   ConsumerGroup response = managedKafkaClient.getConsumerGroup(name);
 }
 
Parameter
Name Description
name String

Required. The name of the consumer group whose configuration to return. projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}.

Returns
Type Description
ConsumerGroup

getConsumerGroupCallable()

public final UnaryCallable,ConsumerGroup> getConsumerGroupCallable()

Returns the properties of a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetConsumerGroupRequest request =
       GetConsumerGroupRequest.newBuilder()
           .setName(
               ConsumerGroupName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[CONSUMER_GROUP]")
                   .toString())
           .build();
   ApiFuture future =
       managedKafkaClient.getConsumerGroupCallable().futureCall(request);
   // Do something.
   ConsumerGroup response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetConsumerGroupRequest,ConsumerGroup>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = managedKafkaClient.getLocation(request);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable,Location> getLocationCallable()

Gets information about a location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture future = managedKafkaClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getSettings()

public final ManagedKafkaSettings getSettings()
Returns
Type Description
ManagedKafkaSettings

getStub()

public ManagedKafkaStub getStub()
Returns
Type Description
ManagedKafkaStub

getTopic(GetTopicRequest request)

public final Topic getTopic(GetTopicRequest request)

Returns the properties of a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetTopicRequest request =
       GetTopicRequest.newBuilder()
           .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[TOPIC]").toString())
           .build();
   Topic response = managedKafkaClient.getTopic(request);
 }
 
Parameter
Name Description
request GetTopicRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Topic

getTopic(TopicName name)

public final Topic getTopic(TopicName name)

Returns the properties of a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[TOPIC]");
   Topic response = managedKafkaClient.getTopic(name);
 }
 
Parameter
Name Description
name TopicName

Required. The name of the topic whose configuration to return. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}.

Returns
Type Description
Topic

getTopic(String name)

public final Topic getTopic(String name)

Returns the properties of a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String name = TopicName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[TOPIC]").toString();
   Topic response = managedKafkaClient.getTopic(name);
 }
 
Parameter
Name Description
name String

Required. The name of the topic whose configuration to return. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}.

Returns
Type Description
Topic

getTopicCallable()

public final UnaryCallable,Topic> getTopicCallable()

Returns the properties of a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   GetTopicRequest request =
       GetTopicRequest.newBuilder()
           .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[TOPIC]").toString())
           .build();
   ApiFuture future = managedKafkaClient.getTopicCallable().futureCall(request);
   // Do something.
   Topic response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetTopicRequest,Topic>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listAcls(ClusterName parent)

public final ManagedKafkaClient.ListAclsPagedResponse listAcls(ClusterName parent)

Lists the acls in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   for (Acl element : managedKafkaClient.listAcls(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent ClusterName

Required. The parent cluster whose acls are to be listed. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

Returns
Type Description
ManagedKafkaClient.ListAclsPagedResponse

listAcls(ListAclsRequest request)

public final ManagedKafkaClient.ListAclsPagedResponse listAcls(ListAclsRequest request)

Lists the acls in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListAclsRequest request =
       ListAclsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Acl element : managedKafkaClient.listAcls(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListAclsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ManagedKafkaClient.ListAclsPagedResponse

listAcls(String parent)

public final ManagedKafkaClient.ListAclsPagedResponse listAcls(String parent)

Lists the acls in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   for (Acl element : managedKafkaClient.listAcls(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent cluster whose acls are to be listed. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

Returns
Type Description
ManagedKafkaClient.ListAclsPagedResponse

listAclsCallable()

public final UnaryCallable,ListAclsResponse> listAclsCallable()

Lists the acls in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListAclsRequest request =
       ListAclsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListAclsResponse response = managedKafkaClient.listAclsCallable().call(request);
     for (Acl element : response.getAclsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListAclsRequest,ListAclsResponse>

listAclsPagedCallable()

public final UnaryCallable,ManagedKafkaClient.ListAclsPagedResponse> listAclsPagedCallable()

Lists the acls in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListAclsRequest request =
       ListAclsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture future = managedKafkaClient.listAclsPagedCallable().futureCall(request);
   // Do something.
   for (Acl element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListAclsRequest,ListAclsPagedResponse>

listClusters(ListClustersRequest request)

public final ManagedKafkaClient.ListClustersPagedResponse listClusters(ListClustersRequest request)

Lists the clusters in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListClustersRequest request =
       ListClustersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   for (Cluster element : managedKafkaClient.listClusters(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListClustersRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ManagedKafkaClient.ListClustersPagedResponse

listClusters(LocationName parent)

public final ManagedKafkaClient.ListClustersPagedResponse listClusters(LocationName parent)

Lists the clusters in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Cluster element : managedKafkaClient.listClusters(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The parent location whose clusters are to be listed. Structured like projects/{project}/locations/{location}.

Returns
Type Description
ManagedKafkaClient.ListClustersPagedResponse

listClusters(String parent)

public final ManagedKafkaClient.ListClustersPagedResponse listClusters(String parent)

Lists the clusters in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Cluster element : managedKafkaClient.listClusters(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent location whose clusters are to be listed. Structured like projects/{project}/locations/{location}.

Returns
Type Description
ManagedKafkaClient.ListClustersPagedResponse

listClustersCallable()

public final UnaryCallable,ListClustersResponse> listClustersCallable()

Lists the clusters in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListClustersRequest request =
       ListClustersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   while (true) {
     ListClustersResponse response = managedKafkaClient.listClustersCallable().call(request);
     for (Cluster element : response.getClustersList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListClustersRequest,ListClustersResponse>

listClustersPagedCallable()

public final UnaryCallable,ManagedKafkaClient.ListClustersPagedResponse> listClustersPagedCallable()

Lists the clusters in a given project and location.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListClustersRequest request =
       ListClustersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   ApiFuture future =
       managedKafkaClient.listClustersPagedCallable().futureCall(request);
   // Do something.
   for (Cluster element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListClustersRequest,ListClustersPagedResponse>

listConsumerGroups(ClusterName parent)

public final ManagedKafkaClient.ListConsumerGroupsPagedResponse listConsumerGroups(ClusterName parent)

Lists the consumer groups in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   for (ConsumerGroup element : managedKafkaClient.listConsumerGroups(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent ClusterName

Required. The parent cluster whose consumer groups are to be listed. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

Returns
Type Description
ManagedKafkaClient.ListConsumerGroupsPagedResponse

listConsumerGroups(ListConsumerGroupsRequest request)

public final ManagedKafkaClient.ListConsumerGroupsPagedResponse listConsumerGroups(ListConsumerGroupsRequest request)

Lists the consumer groups in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListConsumerGroupsRequest request =
       ListConsumerGroupsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (ConsumerGroup element : managedKafkaClient.listConsumerGroups(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListConsumerGroupsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ManagedKafkaClient.ListConsumerGroupsPagedResponse

listConsumerGroups(String parent)

public final ManagedKafkaClient.ListConsumerGroupsPagedResponse listConsumerGroups(String parent)

Lists the consumer groups in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   for (ConsumerGroup element : managedKafkaClient.listConsumerGroups(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent cluster whose consumer groups are to be listed. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

Returns
Type Description
ManagedKafkaClient.ListConsumerGroupsPagedResponse

listConsumerGroupsCallable()

public final UnaryCallable,ListConsumerGroupsResponse> listConsumerGroupsCallable()

Lists the consumer groups in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListConsumerGroupsRequest request =
       ListConsumerGroupsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListConsumerGroupsResponse response =
         managedKafkaClient.listConsumerGroupsCallable().call(request);
     for (ConsumerGroup element : response.getConsumerGroupsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListConsumerGroupsRequest,ListConsumerGroupsResponse>

listConsumerGroupsPagedCallable()

public final UnaryCallable,ManagedKafkaClient.ListConsumerGroupsPagedResponse> listConsumerGroupsPagedCallable()

Lists the consumer groups in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListConsumerGroupsRequest request =
       ListConsumerGroupsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture future =
       managedKafkaClient.listConsumerGroupsPagedCallable().futureCall(request);
   // Do something.
   for (ConsumerGroup element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListConsumerGroupsRequest,ListConsumerGroupsPagedResponse>

listLocations(ListLocationsRequest request)

public final ManagedKafkaClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : managedKafkaClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ManagedKafkaClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = managedKafkaClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable,ManagedKafkaClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture future =
       managedKafkaClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

listTopics(ClusterName parent)

public final ManagedKafkaClient.ListTopicsPagedResponse listTopics(ClusterName parent)

Lists the topics in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   for (Topic element : managedKafkaClient.listTopics(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent ClusterName

Required. The parent cluster whose topics are to be listed. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

Returns
Type Description
ManagedKafkaClient.ListTopicsPagedResponse

listTopics(ListTopicsRequest request)

public final ManagedKafkaClient.ListTopicsPagedResponse listTopics(ListTopicsRequest request)

Lists the topics in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListTopicsRequest request =
       ListTopicsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Topic element : managedKafkaClient.listTopics(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListTopicsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ManagedKafkaClient.ListTopicsPagedResponse

listTopics(String parent)

public final ManagedKafkaClient.ListTopicsPagedResponse listTopics(String parent)

Lists the topics in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   for (Topic element : managedKafkaClient.listTopics(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent cluster whose topics are to be listed. Structured like projects/{project}/locations/{location}/clusters/{cluster}.

Returns
Type Description
ManagedKafkaClient.ListTopicsPagedResponse

listTopicsCallable()

public final UnaryCallable,ListTopicsResponse> listTopicsCallable()

Lists the topics in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListTopicsRequest request =
       ListTopicsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListTopicsResponse response = managedKafkaClient.listTopicsCallable().call(request);
     for (Topic element : response.getTopicsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListTopicsRequest,ListTopicsResponse>

listTopicsPagedCallable()

public final UnaryCallable,ManagedKafkaClient.ListTopicsPagedResponse> listTopicsPagedCallable()

Lists the topics in a given cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ListTopicsRequest request =
       ListTopicsRequest.newBuilder()
           .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture future = managedKafkaClient.listTopicsPagedCallable().futureCall(request);
   // Do something.
   for (Topic element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListTopicsRequest,ListTopicsPagedResponse>

removeAclEntry(AclName acl, AclEntry aclEntry)

public final RemoveAclEntryResponse removeAclEntry(AclName acl, AclEntry aclEntry)

Incremental update: Removes an acl entry from an acl. Deletes the acl if its acl entries become empty (i.e. if the removed entry was the last one in the acl).

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   AclName acl = AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]");
   AclEntry aclEntry = AclEntry.newBuilder().build();
   RemoveAclEntryResponse response = managedKafkaClient.removeAclEntry(acl, aclEntry);
 }
 
Parameters
Name Description
acl AclName

Required. The name of the acl to remove the acl entry from. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}.

The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. See Acl.name for details.

aclEntry AclEntry

Required. The acl entry to remove.

Returns
Type Description
RemoveAclEntryResponse

removeAclEntry(RemoveAclEntryRequest request)

public final RemoveAclEntryResponse removeAclEntry(RemoveAclEntryRequest request)

Incremental update: Removes an acl entry from an acl. Deletes the acl if its acl entries become empty (i.e. if the removed entry was the last one in the acl).

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   RemoveAclEntryRequest request =
       RemoveAclEntryRequest.newBuilder()
           .setAcl(AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString())
           .setAclEntry(AclEntry.newBuilder().build())
           .build();
   RemoveAclEntryResponse response = managedKafkaClient.removeAclEntry(request);
 }
 
Parameter
Name Description
request RemoveAclEntryRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
RemoveAclEntryResponse

removeAclEntry(String acl, AclEntry aclEntry)

public final RemoveAclEntryResponse removeAclEntry(String acl, AclEntry aclEntry)

Incremental update: Removes an acl entry from an acl. Deletes the acl if its acl entries become empty (i.e. if the removed entry was the last one in the acl).

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   String acl = AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString();
   AclEntry aclEntry = AclEntry.newBuilder().build();
   RemoveAclEntryResponse response = managedKafkaClient.removeAclEntry(acl, aclEntry);
 }
 
Parameters
Name Description
acl String

Required. The name of the acl to remove the acl entry from. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}.

The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. See Acl.name for details.

aclEntry AclEntry

Required. The acl entry to remove.

Returns
Type Description
RemoveAclEntryResponse

removeAclEntryCallable()

public final UnaryCallable,RemoveAclEntryResponse> removeAclEntryCallable()

Incremental update: Removes an acl entry from an acl. Deletes the acl if its acl entries become empty (i.e. if the removed entry was the last one in the acl).

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   RemoveAclEntryRequest request =
       RemoveAclEntryRequest.newBuilder()
           .setAcl(AclName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[ACL]").toString())
           .setAclEntry(AclEntry.newBuilder().build())
           .build();
   ApiFuture future =
       managedKafkaClient.removeAclEntryCallable().futureCall(request);
   // Do something.
   RemoveAclEntryResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<RemoveAclEntryRequest,RemoveAclEntryResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateAcl(Acl acl, FieldMask updateMask)

public final Acl updateAcl(Acl acl, FieldMask updateMask)

Updates the properties of a single acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   Acl acl = Acl.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Acl response = managedKafkaClient.updateAcl(acl, updateMask);
 }
 
Parameters
Name Description
acl Acl

Required. The updated acl. Its name and etag fields must be populated. acl_entries must not be empty in the updated acl; to remove all acl entries for an acl, use DeleteAcl.

updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the Acl 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.

Returns
Type Description
Acl

updateAcl(UpdateAclRequest request)

public final Acl updateAcl(UpdateAclRequest request)

Updates the properties of a single acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateAclRequest request =
       UpdateAclRequest.newBuilder()
           .setAcl(Acl.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Acl response = managedKafkaClient.updateAcl(request);
 }
 
Parameter
Name Description
request UpdateAclRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Acl

updateAclCallable()

public final UnaryCallable,Acl> updateAclCallable()

Updates the properties of a single acl.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateAclRequest request =
       UpdateAclRequest.newBuilder()
           .setAcl(Acl.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture future = managedKafkaClient.updateAclCallable().futureCall(request);
   // Do something.
   Acl response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateAclRequest,Acl>

updateClusterAsync(Cluster cluster, FieldMask updateMask)

public final OperationFuture,OperationMetadata> updateClusterAsync(Cluster cluster, FieldMask updateMask)

Updates the properties of a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   Cluster cluster = Cluster.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Cluster response = managedKafkaClient.updateClusterAsync(cluster, updateMask).get();
 }
 
Parameters
Name Description
cluster Cluster

Required. The cluster to update. Its name field must be populated.

updateMask FieldMask

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.

Returns
Type Description
OperationFuture<Cluster,OperationMetadata>

updateClusterAsync(UpdateClusterRequest request)

public final OperationFuture,OperationMetadata> updateClusterAsync(UpdateClusterRequest request)

Updates the properties of a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateClusterRequest request =
       UpdateClusterRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Cluster response = managedKafkaClient.updateClusterAsync(request).get();
 }
 
Parameter
Name Description
request UpdateClusterRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Cluster,OperationMetadata>

updateClusterCallable()

public final UnaryCallable,Operation> updateClusterCallable()

Updates the properties of a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateClusterRequest request =
       UpdateClusterRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture future = managedKafkaClient.updateClusterCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateClusterRequest,Operation>

updateClusterOperationCallable()

public final OperationCallable,Cluster,OperationMetadata> updateClusterOperationCallable()

Updates the properties of a single cluster.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateClusterRequest request =
       UpdateClusterRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture, OperationMetadata> future =
       managedKafkaClient.updateClusterOperationCallable().futureCall(request);
   // Do something.
   Cluster response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateClusterRequest,Cluster,OperationMetadata>

updateConsumerGroup(ConsumerGroup consumerGroup, FieldMask updateMask)

public final ConsumerGroup updateConsumerGroup(ConsumerGroup consumerGroup, FieldMask updateMask)

Updates the properties of a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   ConsumerGroup consumerGroup = ConsumerGroup.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   ConsumerGroup response = managedKafkaClient.updateConsumerGroup(consumerGroup, updateMask);
 }
 
Parameters
Name Description
consumerGroup ConsumerGroup

Required. The consumer group to update. Its name field must be populated.

updateMask FieldMask

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.

Returns
Type Description
ConsumerGroup

updateConsumerGroup(UpdateConsumerGroupRequest request)

public final ConsumerGroup updateConsumerGroup(UpdateConsumerGroupRequest request)

Updates the properties of a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateConsumerGroupRequest request =
       UpdateConsumerGroupRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setConsumerGroup(ConsumerGroup.newBuilder().build())
           .build();
   ConsumerGroup response = managedKafkaClient.updateConsumerGroup(request);
 }
 
Parameter
Name Description
request UpdateConsumerGroupRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ConsumerGroup

updateConsumerGroupCallable()

public final UnaryCallable,ConsumerGroup> updateConsumerGroupCallable()

Updates the properties of a single consumer group.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateConsumerGroupRequest request =
       UpdateConsumerGroupRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setConsumerGroup(ConsumerGroup.newBuilder().build())
           .build();
   ApiFuture future =
       managedKafkaClient.updateConsumerGroupCallable().futureCall(request);
   // Do something.
   ConsumerGroup response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateConsumerGroupRequest,ConsumerGroup>

updateTopic(Topic topic, FieldMask updateMask)

public final Topic updateTopic(Topic topic, FieldMask updateMask)

Updates the properties of a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   Topic topic = Topic.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Topic response = managedKafkaClient.updateTopic(topic, updateMask);
 }
 
Parameters
Name Description
topic Topic

Required. The topic to update. Its name field must be populated.

updateMask FieldMask

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.

Returns
Type Description
Topic

updateTopic(UpdateTopicRequest request)

public final Topic updateTopic(UpdateTopicRequest request)

Updates the properties of a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateTopicRequest request =
       UpdateTopicRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setTopic(Topic.newBuilder().build())
           .build();
   Topic response = managedKafkaClient.updateTopic(request);
 }
 
Parameter
Name Description
request UpdateTopicRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Topic

updateTopicCallable()

public final UnaryCallable,Topic> updateTopicCallable()

Updates the properties of a single topic.

Sample code:


 // 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.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ManagedKafkaClient managedKafkaClient = ManagedKafkaClient.create()) {
   UpdateTopicRequest request =
       UpdateTopicRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setTopic(Topic.newBuilder().build())
           .build();
   ApiFuture future = managedKafkaClient.updateTopicCallable().futureCall(request);
   // Do something.
   Topic response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateTopicRequest,Topic>