Class ManagedKafkaClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteCluster |
Deletes a single cluster. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteTopic |
Deletes a single topic. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteConsumerGroup |
Deletes a single consumer group. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteAcl |
Deletes an acl. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedManagedKafkaClient(ManagedKafkaSettings settings) Constructs an instance of ManagedKafkaClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionfinal AddAclEntryResponseaddAclEntry(AclName acl, AclEntry aclEntry) Incremental update: Adds an acl entry to an acl.final AddAclEntryResponseaddAclEntry(AddAclEntryRequest request) Incremental update: Adds an acl entry to an acl.final AddAclEntryResponseaddAclEntry(String acl, AclEntry aclEntry) Incremental update: Adds an acl entry to an acl.Incremental update: Adds an acl entry to an acl.booleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final ManagedKafkaClientcreate()Constructs an instance of ManagedKafkaClient with default settings.static final ManagedKafkaClientcreate(ManagedKafkaSettings settings) Constructs an instance of ManagedKafkaClient, using the given settings.static final ManagedKafkaClientcreate(ManagedKafkaStub stub) Constructs an instance of ManagedKafkaClient, using the given stub for making calls.final AclcreateAcl(ClusterName parent, Acl acl, String aclId) Creates a new acl in the given project, location, and cluster.final AclcreateAcl(CreateAclRequest request) Creates a new acl in the given project, location, and cluster.final AclCreates a new acl in the given project, location, and cluster.final UnaryCallable<CreateAclRequest,Acl> Creates a new acl in the given project, location, and cluster.createClusterAsync(CreateClusterRequest request) Creates a new cluster in a given project and location.createClusterAsync(LocationName parent, Cluster cluster, String clusterId) Creates a new cluster in a given project and location.createClusterAsync(String parent, Cluster cluster, String clusterId) Creates a new cluster in a given project and location.Creates a new cluster in a given project and location.Creates a new cluster in a given project and location.final TopiccreateTopic(ClusterName parent, Topic topic, String topicId) Creates a new topic in a given project and location.final TopiccreateTopic(CreateTopicRequest request) Creates a new topic in a given project and location.final TopiccreateTopic(String parent, Topic topic, String topicId) Creates a new topic in a given project and location.final UnaryCallable<CreateTopicRequest,Topic> Creates a new topic in a given project and location.final voidDeletes an acl.final voiddeleteAcl(DeleteAclRequest request) Deletes an acl.final voidDeletes an acl.final UnaryCallable<DeleteAclRequest,com.google.protobuf.Empty> Deletes an acl.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Deletes a single cluster.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteClusterAsync(DeleteClusterRequest request) Deletes a single cluster.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteClusterAsync(String name) Deletes a single cluster.Deletes a single cluster.final OperationCallable<DeleteClusterRequest,com.google.protobuf.Empty, OperationMetadata> Deletes a single cluster.final voidDeletes a single consumer group.final voidDeletes a single consumer group.final voiddeleteConsumerGroup(String name) Deletes a single consumer group.final UnaryCallable<DeleteConsumerGroupRequest,com.google.protobuf.Empty> Deletes a single consumer group.final voiddeleteTopic(DeleteTopicRequest request) Deletes a single topic.final voiddeleteTopic(TopicName name) Deletes a single topic.final voiddeleteTopic(String name) Deletes a single topic.final UnaryCallable<DeleteTopicRequest,com.google.protobuf.Empty> Deletes a single topic.final AclReturns the properties of a single acl.final AclgetAcl(GetAclRequest request) Returns the properties of a single acl.final AclReturns the properties of a single acl.final UnaryCallable<GetAclRequest,Acl> Returns the properties of a single acl.final ClustergetCluster(ClusterName name) Returns the properties of a single cluster.final ClustergetCluster(GetClusterRequest request) Returns the properties of a single cluster.final ClustergetCluster(String name) Returns the properties of a single cluster.Returns the properties of a single cluster.final ConsumerGroupReturns the properties of a single consumer group.final ConsumerGroupgetConsumerGroup(GetConsumerGroupRequest request) Returns the properties of a single consumer group.final ConsumerGroupgetConsumerGroup(String name) Returns the properties of a single consumer group.Returns the properties of a single consumer group.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final ManagedKafkaSettingsgetStub()final TopicgetTopic(GetTopicRequest request) Returns the properties of a single topic.final TopicReturns the properties of a single topic.final TopicReturns the properties of a single topic.final UnaryCallable<GetTopicRequest,Topic> Returns the properties of a single topic.booleanbooleanlistAcls(ClusterName parent) Lists the acls in a given cluster.listAcls(ListAclsRequest request) Lists the acls in a given cluster.Lists the acls in a given cluster.Lists the acls in a given cluster.Lists the acls in a given cluster.listClusters(ListClustersRequest request) Lists the clusters in a given project and location.listClusters(LocationName parent) Lists the clusters in a given project and location.listClusters(String parent) Lists the clusters in a given project and location.Lists the clusters in a given project and location.Lists the clusters in a given project and location.listConsumerGroups(ClusterName parent) Lists the consumer groups in a given cluster.Lists the consumer groups in a given cluster.listConsumerGroups(String parent) Lists the consumer groups in a given cluster.Lists the consumer groups in a given cluster.Lists the consumer groups in a given cluster.listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.listTopics(ClusterName parent) Lists the topics in a given cluster.listTopics(ListTopicsRequest request) Lists the topics in a given cluster.listTopics(String parent) Lists the topics in a given cluster.Lists the topics in a given cluster.Lists the topics in a given cluster.final RemoveAclEntryResponseremoveAclEntry(AclName acl, AclEntry aclEntry) Incremental update: Removes an acl entry from an acl.final RemoveAclEntryResponseremoveAclEntry(RemoveAclEntryRequest request) Incremental update: Removes an acl entry from an acl.final RemoveAclEntryResponseremoveAclEntry(String acl, AclEntry aclEntry) Incremental update: Removes an acl entry from an acl.Incremental update: Removes an acl entry from an acl.voidshutdown()voidfinal AclUpdates the properties of a single acl.final AclupdateAcl(UpdateAclRequest request) Updates the properties of a single acl.final UnaryCallable<UpdateAclRequest,Acl> Updates the properties of a single acl.updateClusterAsync(Cluster cluster, com.google.protobuf.FieldMask updateMask) Updates the properties of a single cluster.updateClusterAsync(UpdateClusterRequest request) Updates the properties of a single cluster.Updates the properties of a single cluster.Updates the properties of a single cluster.final ConsumerGroupupdateConsumerGroup(ConsumerGroup consumerGroup, com.google.protobuf.FieldMask updateMask) Updates the properties of a single consumer group.final ConsumerGroupUpdates the properties of a single consumer group.Updates the properties of a single consumer group.final TopicupdateTopic(Topic topic, com.google.protobuf.FieldMask updateMask) Updates the properties of a single topic.final TopicupdateTopic(UpdateTopicRequest request) Updates the properties of a single topic.final UnaryCallable<UpdateTopicRequest,Topic> Updates the properties of a single topic.
-
Constructor Details
-
ManagedKafkaClient
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.- Throws:
IOException
-
ManagedKafkaClient
-
-
Method Details
-
create
Constructs an instance of ManagedKafkaClient with default settings.- Throws:
IOException
-
create
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.- Throws:
IOException
-
create
Constructs an instance of ManagedKafkaClient, using the given stub for making calls. This is for advanced usage - prefer using create(ManagedKafkaSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
listClusters
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); } }- Parameters:
parent- Required. The parent location whose clusters are to be listed. Structured like `projects/{project}/locations/{location}`.- Throws:
ApiException- if the remote call fails
-
listClusters
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); } }- Parameters:
parent- Required. The parent location whose clusters are to be listed. Structured like `projects/{project}/locations/{location}`.- Throws:
ApiException- if the remote call fails
-
listClusters
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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listClustersPagedCallable
public final UnaryCallable<ListClustersRequest,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<Cluster> future = managedKafkaClient.listClustersPagedCallable().futureCall(request); // Do something. for (Cluster element : future.get().iterateAll()) { // doThingsWith(element); } } -
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; } } } -
getCluster
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); }- Parameters:
name- Required. The name of the cluster whose configuration to return.- Throws:
ApiException- if the remote call fails
-
getCluster
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); }- Parameters:
name- Required. The name of the cluster whose configuration to return.- Throws:
ApiException- if the remote call fails
-
getCluster
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Cluster> future = managedKafkaClient.getClusterCallable().futureCall(request); // Do something. Cluster response = future.get(); } -
createClusterAsync
public final OperationFuture<Cluster,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:
parent- Required. The parent region in which to create the cluster. Structured like `projects/{project}/locations/{location}`.cluster- Required. Configuration of the cluster to create. Its `name` field is ignored.clusterId- Required. The ID to use for the cluster, which will become the final component of the cluster's name. The ID must be 1-63 characters long, and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply with RFC 1035.This value is structured like: `my-cluster-id`.
- Throws:
ApiException- if the remote call fails
-
createClusterAsync
public final OperationFuture<Cluster,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:
parent- Required. The parent region in which to create the cluster. Structured like `projects/{project}/locations/{location}`.cluster- Required. Configuration of the cluster to create. Its `name` field is ignored.clusterId- Required. The ID to use for the cluster, which will become the final component of the cluster's name. The ID must be 1-63 characters long, and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply with RFC 1035.This value is structured like: `my-cluster-id`.
- Throws:
ApiException- if the remote call fails
-
createClusterAsync
public final OperationFuture<Cluster,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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createClusterOperationCallable
public final OperationCallable<CreateClusterRequest,Cluster, createClusterOperationCallable()OperationMetadata> 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<Cluster, OperationMetadata> future = managedKafkaClient.createClusterOperationCallable().futureCall(request); // Do something. Cluster response = future.get(); } -
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<Operation> future = managedKafkaClient.createClusterCallable().futureCall(request); // Do something. Operation response = future.get(); } -
updateClusterAsync
public final OperationFuture<Cluster,OperationMetadata> updateClusterAsync(Cluster cluster, com.google.protobuf.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:
cluster- Required. The cluster to update. Its `name` field must be populated.updateMask- 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.- Throws:
ApiException- if the remote call fails
-
updateClusterAsync
public final OperationFuture<Cluster,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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateClusterOperationCallable
public final OperationCallable<UpdateClusterRequest,Cluster, updateClusterOperationCallable()OperationMetadata> 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<Cluster, OperationMetadata> future = managedKafkaClient.updateClusterOperationCallable().futureCall(request); // Do something. Cluster response = future.get(); } -
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<Operation> future = managedKafkaClient.updateClusterCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deleteClusterAsync
public final OperationFuture<com.google.protobuf.Empty,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(); }- Parameters:
name- Required. The name of the cluster to delete.- Throws:
ApiException- if the remote call fails
-
deleteClusterAsync
public final OperationFuture<com.google.protobuf.Empty,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(); }- Parameters:
name- Required. The name of the cluster to delete.- Throws:
ApiException- if the remote call fails
-
deleteClusterAsync
public final OperationFuture<com.google.protobuf.Empty,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(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteClusterOperationCallable
public final OperationCallable<DeleteClusterRequest,com.google.protobuf.Empty, deleteClusterOperationCallable()OperationMetadata> 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<Empty, OperationMetadata> future = managedKafkaClient.deleteClusterOperationCallable().futureCall(request); // Do something. future.get(); } -
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<Operation> future = managedKafkaClient.deleteClusterCallable().futureCall(request); // Do something. future.get(); } -
listTopics
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); } }- Parameters:
parent- Required. The parent cluster whose topics are to be listed. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.- Throws:
ApiException- if the remote call fails
-
listTopics
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); } }- Parameters:
parent- Required. The parent cluster whose topics are to be listed. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.- Throws:
ApiException- if the remote call fails
-
listTopics
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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listTopicsPagedCallable
public final UnaryCallable<ListTopicsRequest,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<Topic> future = managedKafkaClient.listTopicsPagedCallable().futureCall(request); // Do something. for (Topic element : future.get().iterateAll()) { // doThingsWith(element); } } -
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; } } } -
getTopic
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); }- Parameters:
name- Required. The name of the topic whose configuration to return. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}.- Throws:
ApiException- if the remote call fails
-
getTopic
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); }- Parameters:
name- Required. The name of the topic whose configuration to return. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}.- Throws:
ApiException- if the remote call fails
-
getTopic
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Topic> future = managedKafkaClient.getTopicCallable().futureCall(request); // Do something. Topic response = future.get(); } -
createTopic
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:
parent- Required. The parent cluster in which to create the topic. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.topic- Required. Configuration of the topic to create. Its `name` field is ignored.topicId- 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`.
- Throws:
ApiException- if the remote call fails
-
createTopic
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:
parent- Required. The parent cluster in which to create the topic. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.topic- Required. Configuration of the topic to create. Its `name` field is ignored.topicId- 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`.
- Throws:
ApiException- if the remote call fails
-
createTopic
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Topic> future = managedKafkaClient.createTopicCallable().futureCall(request); // Do something. Topic response = future.get(); } -
updateTopic
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:
topic- Required. The topic to update. Its `name` field must be populated.updateMask- 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.- Throws:
ApiException- if the remote call fails
-
updateTopic
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Topic> future = managedKafkaClient.updateTopicCallable().futureCall(request); // Do something. Topic response = future.get(); } -
deleteTopic
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); }- Parameters:
name- Required. The name of the topic to delete. `projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}`.- Throws:
ApiException- if the remote call fails
-
deleteTopic
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); }- Parameters:
name- Required. The name of the topic to delete. `projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}`.- Throws:
ApiException- if the remote call fails
-
deleteTopic
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Empty> future = managedKafkaClient.deleteTopicCallable().futureCall(request); // Do something. future.get(); } -
listConsumerGroups
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); } }- Parameters:
parent- Required. The parent cluster whose consumer groups are to be listed. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.- Throws:
ApiException- if the remote call fails
-
listConsumerGroups
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); } }- Parameters:
parent- Required. The parent cluster whose consumer groups are to be listed. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.- Throws:
ApiException- if the remote call fails
-
listConsumerGroups
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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listConsumerGroupsPagedCallable
public final UnaryCallable<ListConsumerGroupsRequest,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<ConsumerGroup> future = managedKafkaClient.listConsumerGroupsPagedCallable().futureCall(request); // Do something. for (ConsumerGroup element : future.get().iterateAll()) { // doThingsWith(element); } } -
listConsumerGroupsCallable
public final UnaryCallable<ListConsumerGroupsRequest,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; } } } -
getConsumerGroup
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); }- Parameters:
name- Required. The name of the consumer group whose configuration to return. `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`.- Throws:
ApiException- if the remote call fails
-
getConsumerGroup
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); }- Parameters:
name- Required. The name of the consumer group whose configuration to return. `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`.- Throws:
ApiException- if the remote call fails
-
getConsumerGroup
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<ConsumerGroup> future = managedKafkaClient.getConsumerGroupCallable().futureCall(request); // Do something. ConsumerGroup response = future.get(); } -
updateConsumerGroup
public final ConsumerGroup updateConsumerGroup(ConsumerGroup consumerGroup, com.google.protobuf.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:
consumerGroup- Required. The consumer group to update. Its `name` field must be populated.updateMask- 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.- Throws:
ApiException- if the remote call fails
-
updateConsumerGroup
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<ConsumerGroup> future = managedKafkaClient.updateConsumerGroupCallable().futureCall(request); // Do something. ConsumerGroup response = future.get(); } -
deleteConsumerGroup
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); }- Parameters:
name- Required. The name of the consumer group to delete. `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`.- Throws:
ApiException- if the remote call fails
-
deleteConsumerGroup
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); }- Parameters:
name- Required. The name of the consumer group to delete. `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`.- Throws:
ApiException- if the remote call fails
-
deleteConsumerGroup
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteConsumerGroupCallable
public final UnaryCallable<DeleteConsumerGroupRequest,com.google.protobuf.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<Empty> future = managedKafkaClient.deleteConsumerGroupCallable().futureCall(request); // Do something. future.get(); } -
listAcls
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); } }- Parameters:
parent- Required. The parent cluster whose acls are to be listed. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.- Throws:
ApiException- if the remote call fails
-
listAcls
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); } }- Parameters:
parent- Required. The parent cluster whose acls are to be listed. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.- Throws:
ApiException- if the remote call fails
-
listAcls
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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listAclsPagedCallable
public final UnaryCallable<ListAclsRequest,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<Acl> future = managedKafkaClient.listAclsPagedCallable().futureCall(request); // Do something. for (Acl element : future.get().iterateAll()) { // doThingsWith(element); } } -
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; } } } -
getAcl
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); }- Parameters:
name- 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.
- Throws:
ApiException- if the remote call fails
-
getAcl
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); }- Parameters:
name- 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.
- Throws:
ApiException- if the remote call fails
-
getAcl
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Acl> future = managedKafkaClient.getAclCallable().futureCall(request); // Do something. Acl response = future.get(); } -
createAcl
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:
parent- Required. The parent cluster in which to create the acl. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.acl- Required. Configuration of the acl to create. Its `name` field is ignored.aclId- 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/*`)
- Throws:
ApiException- if the remote call fails
-
createAcl
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:
parent- Required. The parent cluster in which to create the acl. Structured like `projects/{project}/locations/{location}/clusters/{cluster}`.acl- Required. Configuration of the acl to create. Its `name` field is ignored.aclId- 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/*`)
- Throws:
ApiException- if the remote call fails
-
createAcl
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Acl> future = managedKafkaClient.createAclCallable().futureCall(request); // Do something. Acl response = future.get(); } -
updateAcl
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:
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- 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.- Throws:
ApiException- if the remote call fails
-
updateAcl
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Acl> future = managedKafkaClient.updateAclCallable().futureCall(request); // Do something. Acl response = future.get(); } -
deleteAcl
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); }- Parameters:
name- 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.
- Throws:
ApiException- if the remote call fails
-
deleteAcl
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); }- Parameters:
name- 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.
- Throws:
ApiException- if the remote call fails
-
deleteAcl
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Empty> future = managedKafkaClient.deleteAclCallable().futureCall(request); // Do something. future.get(); } -
addAclEntry
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:
acl- 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- Required. The acl entry to add.- Throws:
ApiException- if the remote call fails
-
addAclEntry
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:
acl- 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- Required. The acl entry to add.- Throws:
ApiException- if the remote call fails
-
addAclEntry
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<AddAclEntryResponse> future = managedKafkaClient.addAclEntryCallable().futureCall(request); // Do something. AddAclEntryResponse response = future.get(); } -
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).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:
acl- 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- Required. The acl entry to remove.- Throws:
ApiException- if the remote call fails
-
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).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:
acl- 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- Required. The acl entry to remove.- Throws:
ApiException- if the remote call fails
-
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).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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<RemoveAclEntryResponse> future = managedKafkaClient.removeAclEntryCallable().futureCall(request); // Do something. RemoveAclEntryResponse response = future.get(); } -
listLocations
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); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,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<Location> future = managedKafkaClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
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; } } } -
getLocation
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); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
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<Location> future = managedKafkaClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-