Class ManagedKafkaConnectClient

java.lang.Object
com.google.cloud.managedkafka.v1.ManagedKafkaConnectClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class ManagedKafkaConnectClient extends Object implements BackgroundResource
Service Description: The service that a client application uses to manage Apache Kafka Connect clusters and connectors.

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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
   ConnectClusterName name =
       ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]");
   ConnectCluster response = managedKafkaConnectClient.getConnectCluster(name);
 }
 

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

Methods
Method Description Method Variants

ListConnectClusters

Lists the Kafka Connect 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.

  • listConnectClusters(ListConnectClustersRequest request)

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

  • listConnectClusters(LocationName parent)

  • listConnectClusters(String parent)

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

  • listConnectClustersPagedCallable()

  • listConnectClustersCallable()

GetConnectCluster

Returns the properties of a single Kafka Connect cluster.

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

  • getConnectCluster(GetConnectClusterRequest request)

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

  • getConnectCluster(ConnectClusterName name)

  • getConnectCluster(String name)

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

  • getConnectClusterCallable()

CreateConnectCluster

Creates a new Kafka Connect 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.

  • createConnectClusterAsync(CreateConnectClusterRequest request)

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

  • createConnectClusterAsync(LocationName parent, ConnectCluster connectCluster, String connectClusterId)

  • createConnectClusterAsync(String parent, ConnectCluster connectCluster, String connectClusterId)

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

  • createConnectClusterOperationCallable()

  • createConnectClusterCallable()

UpdateConnectCluster

Updates the properties of a single Kafka Connect cluster.

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

  • updateConnectClusterAsync(UpdateConnectClusterRequest request)

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

  • updateConnectClusterAsync(ConnectCluster connectCluster, FieldMask updateMask)

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

  • updateConnectClusterOperationCallable()

  • updateConnectClusterCallable()

DeleteConnectCluster

Deletes a single Connect cluster.

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

  • deleteConnectClusterAsync(DeleteConnectClusterRequest request)

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

  • deleteConnectClusterAsync(ConnectClusterName name)

  • deleteConnectClusterAsync(String name)

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

  • deleteConnectClusterOperationCallable()

  • deleteConnectClusterCallable()

ListConnectors

Lists the connectors in a given Connect cluster.

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

  • listConnectors(ListConnectorsRequest request)

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

  • listConnectors(ConnectClusterName parent)

  • listConnectors(String parent)

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

  • listConnectorsPagedCallable()

  • listConnectorsCallable()

GetConnector

Returns the properties of a single connector.

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

  • getConnector(GetConnectorRequest request)

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

  • getConnector(ConnectorName name)

  • getConnector(String name)

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

  • getConnectorCallable()

CreateConnector

Creates a new connector in a given Connect cluster.

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

  • createConnector(CreateConnectorRequest request)

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

  • createConnector(ConnectClusterName parent, Connector connector, String connectorId)

  • createConnector(String parent, Connector connector, String connectorId)

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

  • createConnectorCallable()

UpdateConnector

Updates the properties of a connector.

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

  • updateConnector(UpdateConnectorRequest request)

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

  • updateConnector(Connector connector, FieldMask updateMask)

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

  • updateConnectorCallable()

DeleteConnector

Deletes a connector.

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

  • deleteConnector(DeleteConnectorRequest request)

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

  • deleteConnector(ConnectorName name)

  • deleteConnector(String name)

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

  • deleteConnectorCallable()

PauseConnector

Pauses the connector and its tasks.

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

  • pauseConnector(PauseConnectorRequest request)

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

  • pauseConnector(ConnectorName name)

  • pauseConnector(String name)

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

  • pauseConnectorCallable()

ResumeConnector

Resumes the connector and its tasks.

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

  • resumeConnector(ResumeConnectorRequest request)

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

  • resumeConnector(ConnectorName name)

  • resumeConnector(String name)

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

  • resumeConnectorCallable()

RestartConnector

Restarts the connector.

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

  • restartConnector(RestartConnectorRequest request)

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

  • restartConnector(ConnectorName name)

  • restartConnector(String name)

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

  • restartConnectorCallable()

StopConnector

Stops the connector.

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

  • stopConnector(StopConnectorRequest request)

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

  • stopConnector(ConnectorName name)

  • stopConnector(String name)

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

  • stopConnectorCallable()

ListLocations

Lists information about the supported locations for this service.

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

  • listLocations(ListLocationsRequest request)

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

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

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

  • getLocation(GetLocationRequest request)

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

  • getLocationCallable()

See the individual methods for example code.

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

This class can be customized by passing in a custom instance of ManagedKafkaConnectSettings 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
 ManagedKafkaConnectSettings managedKafkaConnectSettings =
     ManagedKafkaConnectSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ManagedKafkaConnectClient managedKafkaConnectClient =
     ManagedKafkaConnectClient.create(managedKafkaConnectSettings);
 

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
 ManagedKafkaConnectSettings managedKafkaConnectSettings =
     ManagedKafkaConnectSettings.newBuilder().setEndpoint(myEndpoint).build();
 ManagedKafkaConnectClient managedKafkaConnectClient =
     ManagedKafkaConnectClient.create(managedKafkaConnectSettings);
 

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
 ManagedKafkaConnectSettings managedKafkaConnectSettings =
     ManagedKafkaConnectSettings.newHttpJsonBuilder().build();
 ManagedKafkaConnectClient managedKafkaConnectClient =
     ManagedKafkaConnectClient.create(managedKafkaConnectSettings);
 

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

  • Constructor Details

    • ManagedKafkaConnectClient

      protected ManagedKafkaConnectClient(ManagedKafkaConnectSettings settings) throws IOException
      Constructs an instance of ManagedKafkaConnectClient, 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
    • ManagedKafkaConnectClient

      protected ManagedKafkaConnectClient(ManagedKafkaConnectStub stub)
  • Method Details

    • create

      public static final ManagedKafkaConnectClient create() throws IOException
      Constructs an instance of ManagedKafkaConnectClient with default settings.
      Throws:
      IOException
    • create

      public static final ManagedKafkaConnectClient create(ManagedKafkaConnectSettings settings) throws IOException
      Constructs an instance of ManagedKafkaConnectClient, 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

      public static final ManagedKafkaConnectClient create(ManagedKafkaConnectStub stub)
      Constructs an instance of ManagedKafkaConnectClient, using the given stub for making calls. This is for advanced usage - prefer using create(ManagedKafkaConnectSettings).
    • getSettings

      public final ManagedKafkaConnectSettings getSettings()
    • getStub

      public ManagedKafkaConnectStub getStub()
    • getOperationsClient

      public final OperationsClient getOperationsClient()
      Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
    • getHttpJsonOperationsClient

      @BetaApi public final OperationsClient getHttpJsonOperationsClient()
      Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
    • listConnectClusters

      Lists the Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (ConnectCluster element :
             managedKafkaConnectClient.listConnectClusters(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent project/location whose Connect clusters are to be listed. Structured like `projects/{project}/locations/{location}`.
      Throws:
      ApiException - if the remote call fails
    • listConnectClusters

      public final ManagedKafkaConnectClient.ListConnectClustersPagedResponse listConnectClusters(String parent)
      Lists the Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (ConnectCluster element :
             managedKafkaConnectClient.listConnectClusters(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent project/location whose Connect clusters are to be listed. Structured like `projects/{project}/locations/{location}`.
      Throws:
      ApiException - if the remote call fails
    • listConnectClusters

      Lists the Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListConnectClustersRequest request =
             ListConnectClustersRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         for (ConnectCluster element :
             managedKafkaConnectClient.listConnectClusters(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
    • listConnectClustersPagedCallable

      Lists the Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListConnectClustersRequest request =
             ListConnectClustersRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         ApiFuture<ConnectCluster> future =
             managedKafkaConnectClient.listConnectClustersPagedCallable().futureCall(request);
         // Do something.
         for (ConnectCluster element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listConnectClustersCallable

      public final UnaryCallable<ListConnectClustersRequest,ListConnectClustersResponse> listConnectClustersCallable()
      Lists the Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListConnectClustersRequest request =
             ListConnectClustersRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         while (true) {
           ListConnectClustersResponse response =
               managedKafkaConnectClient.listConnectClustersCallable().call(request);
           for (ConnectCluster element : response.getConnectClustersList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getConnectCluster

      public final ConnectCluster getConnectCluster(ConnectClusterName name)
      Returns the properties of a single Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectClusterName name =
             ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]");
         ConnectCluster response = managedKafkaConnectClient.getConnectCluster(name);
       }
       
      Parameters:
      name - Required. The name of the Kafka Connect cluster whose configuration to return. Structured like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
      Throws:
      ApiException - if the remote call fails
    • getConnectCluster

      public final ConnectCluster getConnectCluster(String name)
      Returns the properties of a single Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String name =
             ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString();
         ConnectCluster response = managedKafkaConnectClient.getConnectCluster(name);
       }
       
      Parameters:
      name - Required. The name of the Kafka Connect cluster whose configuration to return. Structured like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
      Throws:
      ApiException - if the remote call fails
    • getConnectCluster

      public final ConnectCluster getConnectCluster(GetConnectClusterRequest request)
      Returns the properties of a single Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         GetConnectClusterRequest request =
             GetConnectClusterRequest.newBuilder()
                 .setName(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .build();
         ConnectCluster response = managedKafkaConnectClient.getConnectCluster(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getConnectClusterCallable

      public final UnaryCallable<GetConnectClusterRequest,ConnectCluster> getConnectClusterCallable()
      Returns the properties of a single Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         GetConnectClusterRequest request =
             GetConnectClusterRequest.newBuilder()
                 .setName(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .build();
         ApiFuture<ConnectCluster> future =
             managedKafkaConnectClient.getConnectClusterCallable().futureCall(request);
         // Do something.
         ConnectCluster response = future.get();
       }
       
    • createConnectClusterAsync

      public final OperationFuture<ConnectCluster,OperationMetadata> createConnectClusterAsync(LocationName parent, ConnectCluster connectCluster, String connectClusterId)
      Creates a new Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         ConnectCluster connectCluster = ConnectCluster.newBuilder().build();
         String connectClusterId = "connectClusterId-1562078485";
         ConnectCluster response =
             managedKafkaConnectClient
                 .createConnectClusterAsync(parent, connectCluster, connectClusterId)
                 .get();
       }
       
      Parameters:
      parent - Required. The parent project/location in which to create the Kafka Connect cluster. Structured like `projects/{project}/locations/{location}/`.
      connectCluster - Required. Configuration of the Kafka Connect cluster to create. Its `name` field is ignored.
      connectClusterId - Required. The ID to use for the Connect 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
    • createConnectClusterAsync

      public final OperationFuture<ConnectCluster,OperationMetadata> createConnectClusterAsync(String parent, ConnectCluster connectCluster, String connectClusterId)
      Creates a new Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         ConnectCluster connectCluster = ConnectCluster.newBuilder().build();
         String connectClusterId = "connectClusterId-1562078485";
         ConnectCluster response =
             managedKafkaConnectClient
                 .createConnectClusterAsync(parent, connectCluster, connectClusterId)
                 .get();
       }
       
      Parameters:
      parent - Required. The parent project/location in which to create the Kafka Connect cluster. Structured like `projects/{project}/locations/{location}/`.
      connectCluster - Required. Configuration of the Kafka Connect cluster to create. Its `name` field is ignored.
      connectClusterId - Required. The ID to use for the Connect 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
    • createConnectClusterAsync

      public final OperationFuture<ConnectCluster,OperationMetadata> createConnectClusterAsync(CreateConnectClusterRequest request)
      Creates a new Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         CreateConnectClusterRequest request =
             CreateConnectClusterRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setConnectClusterId("connectClusterId-1562078485")
                 .setConnectCluster(ConnectCluster.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         ConnectCluster response = managedKafkaConnectClient.createConnectClusterAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createConnectClusterOperationCallable

      public final OperationCallable<CreateConnectClusterRequest,ConnectCluster,OperationMetadata> createConnectClusterOperationCallable()
      Creates a new Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         CreateConnectClusterRequest request =
             CreateConnectClusterRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setConnectClusterId("connectClusterId-1562078485")
                 .setConnectCluster(ConnectCluster.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         OperationFuture<ConnectCluster, OperationMetadata> future =
             managedKafkaConnectClient.createConnectClusterOperationCallable().futureCall(request);
         // Do something.
         ConnectCluster response = future.get();
       }
       
    • createConnectClusterCallable

      public final UnaryCallable<CreateConnectClusterRequest,Operation> createConnectClusterCallable()
      Creates a new Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         CreateConnectClusterRequest request =
             CreateConnectClusterRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setConnectClusterId("connectClusterId-1562078485")
                 .setConnectCluster(ConnectCluster.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         ApiFuture<Operation> future =
             managedKafkaConnectClient.createConnectClusterCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • updateConnectClusterAsync

      public final OperationFuture<ConnectCluster,OperationMetadata> updateConnectClusterAsync(ConnectCluster connectCluster, com.google.protobuf.FieldMask updateMask)
      Updates the properties of a single Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectCluster connectCluster = ConnectCluster.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         ConnectCluster response =
             managedKafkaConnectClient.updateConnectClusterAsync(connectCluster, updateMask).get();
       }
       
      Parameters:
      connectCluster - Required. The Kafka Connect 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
    • updateConnectClusterAsync

      public final OperationFuture<ConnectCluster,OperationMetadata> updateConnectClusterAsync(UpdateConnectClusterRequest request)
      Updates the properties of a single Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         UpdateConnectClusterRequest request =
             UpdateConnectClusterRequest.newBuilder()
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .setConnectCluster(ConnectCluster.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         ConnectCluster response = managedKafkaConnectClient.updateConnectClusterAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateConnectClusterOperationCallable

      public final OperationCallable<UpdateConnectClusterRequest,ConnectCluster,OperationMetadata> updateConnectClusterOperationCallable()
      Updates the properties of a single Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         UpdateConnectClusterRequest request =
             UpdateConnectClusterRequest.newBuilder()
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .setConnectCluster(ConnectCluster.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         OperationFuture<ConnectCluster, OperationMetadata> future =
             managedKafkaConnectClient.updateConnectClusterOperationCallable().futureCall(request);
         // Do something.
         ConnectCluster response = future.get();
       }
       
    • updateConnectClusterCallable

      public final UnaryCallable<UpdateConnectClusterRequest,Operation> updateConnectClusterCallable()
      Updates the properties of a single Kafka Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         UpdateConnectClusterRequest request =
             UpdateConnectClusterRequest.newBuilder()
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .setConnectCluster(ConnectCluster.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         ApiFuture<Operation> future =
             managedKafkaConnectClient.updateConnectClusterCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • deleteConnectClusterAsync

      public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteConnectClusterAsync(ConnectClusterName name)
      Deletes a single Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectClusterName name =
             ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]");
         managedKafkaConnectClient.deleteConnectClusterAsync(name).get();
       }
       
      Parameters:
      name - Required. The name of the Kafka Connect cluster to delete. Structured like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
      Throws:
      ApiException - if the remote call fails
    • deleteConnectClusterAsync

      public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteConnectClusterAsync(String name)
      Deletes a single Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String name =
             ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString();
         managedKafkaConnectClient.deleteConnectClusterAsync(name).get();
       }
       
      Parameters:
      name - Required. The name of the Kafka Connect cluster to delete. Structured like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
      Throws:
      ApiException - if the remote call fails
    • deleteConnectClusterAsync

      public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteConnectClusterAsync(DeleteConnectClusterRequest request)
      Deletes a single Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         DeleteConnectClusterRequest request =
             DeleteConnectClusterRequest.newBuilder()
                 .setName(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .setRequestId("requestId693933066")
                 .build();
         managedKafkaConnectClient.deleteConnectClusterAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteConnectClusterOperationCallable

      public final OperationCallable<DeleteConnectClusterRequest,com.google.protobuf.Empty,OperationMetadata> deleteConnectClusterOperationCallable()
      Deletes a single Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         DeleteConnectClusterRequest request =
             DeleteConnectClusterRequest.newBuilder()
                 .setName(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .setRequestId("requestId693933066")
                 .build();
         OperationFuture<Empty, OperationMetadata> future =
             managedKafkaConnectClient.deleteConnectClusterOperationCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • deleteConnectClusterCallable

      public final UnaryCallable<DeleteConnectClusterRequest,Operation> deleteConnectClusterCallable()
      Deletes a single Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         DeleteConnectClusterRequest request =
             DeleteConnectClusterRequest.newBuilder()
                 .setName(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .setRequestId("requestId693933066")
                 .build();
         ApiFuture<Operation> future =
             managedKafkaConnectClient.deleteConnectClusterCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • listConnectors

      Lists the connectors in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectClusterName parent =
             ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]");
         for (Connector element : managedKafkaConnectClient.listConnectors(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent Connect cluster whose connectors are to be listed. Structured like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
      Throws:
      ApiException - if the remote call fails
    • listConnectors

      public final ManagedKafkaConnectClient.ListConnectorsPagedResponse listConnectors(String parent)
      Lists the connectors in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String parent =
             ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString();
         for (Connector element : managedKafkaConnectClient.listConnectors(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent Connect cluster whose connectors are to be listed. Structured like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
      Throws:
      ApiException - if the remote call fails
    • listConnectors

      Lists the connectors in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListConnectorsRequest request =
             ListConnectorsRequest.newBuilder()
                 .setParent(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Connector element : managedKafkaConnectClient.listConnectors(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
    • listConnectorsPagedCallable

      Lists the connectors in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListConnectorsRequest request =
             ListConnectorsRequest.newBuilder()
                 .setParent(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Connector> future =
             managedKafkaConnectClient.listConnectorsPagedCallable().futureCall(request);
         // Do something.
         for (Connector element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listConnectorsCallable

      public final UnaryCallable<ListConnectorsRequest,ListConnectorsResponse> listConnectorsCallable()
      Lists the connectors in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListConnectorsRequest request =
             ListConnectorsRequest.newBuilder()
                 .setParent(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListConnectorsResponse response =
               managedKafkaConnectClient.listConnectorsCallable().call(request);
           for (Connector element : response.getConnectorsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getConnector

      public final Connector getConnector(ConnectorName name)
      Returns the properties of a single connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectorName name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]");
         Connector response = managedKafkaConnectClient.getConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector whose configuration to return. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • getConnector

      public final Connector getConnector(String name)
      Returns the properties of a single connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                 .toString();
         Connector response = managedKafkaConnectClient.getConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector whose configuration to return. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • getConnector

      public final Connector getConnector(GetConnectorRequest request)
      Returns the properties of a single connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         GetConnectorRequest request =
             GetConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         Connector response = managedKafkaConnectClient.getConnector(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getConnectorCallable

      public final UnaryCallable<GetConnectorRequest,Connector> getConnectorCallable()
      Returns the properties of a single connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         GetConnectorRequest request =
             GetConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         ApiFuture<Connector> future =
             managedKafkaConnectClient.getConnectorCallable().futureCall(request);
         // Do something.
         Connector response = future.get();
       }
       
    • createConnector

      public final Connector createConnector(ConnectClusterName parent, Connector connector, String connectorId)
      Creates a new connector in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectClusterName parent =
             ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]");
         Connector connector = Connector.newBuilder().build();
         String connectorId = "connectorId1724784200";
         Connector response =
             managedKafkaConnectClient.createConnector(parent, connector, connectorId);
       }
       
      Parameters:
      parent - Required. The parent Connect cluster in which to create the connector. Structured like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
      connector - Required. The connector to create.
      connectorId - Required. The ID to use for the connector, which will become the final component of the connector'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-connector-id`.

      Throws:
      ApiException - if the remote call fails
    • createConnector

      public final Connector createConnector(String parent, Connector connector, String connectorId)
      Creates a new connector in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String parent =
             ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString();
         Connector connector = Connector.newBuilder().build();
         String connectorId = "connectorId1724784200";
         Connector response =
             managedKafkaConnectClient.createConnector(parent, connector, connectorId);
       }
       
      Parameters:
      parent - Required. The parent Connect cluster in which to create the connector. Structured like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
      connector - Required. The connector to create.
      connectorId - Required. The ID to use for the connector, which will become the final component of the connector'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-connector-id`.

      Throws:
      ApiException - if the remote call fails
    • createConnector

      public final Connector createConnector(CreateConnectorRequest request)
      Creates a new connector in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         CreateConnectorRequest request =
             CreateConnectorRequest.newBuilder()
                 .setParent(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .setConnectorId("connectorId1724784200")
                 .setConnector(Connector.newBuilder().build())
                 .build();
         Connector response = managedKafkaConnectClient.createConnector(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createConnectorCallable

      public final UnaryCallable<CreateConnectorRequest,Connector> createConnectorCallable()
      Creates a new connector in a given Connect 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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         CreateConnectorRequest request =
             CreateConnectorRequest.newBuilder()
                 .setParent(
                     ConnectClusterName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]").toString())
                 .setConnectorId("connectorId1724784200")
                 .setConnector(Connector.newBuilder().build())
                 .build();
         ApiFuture<Connector> future =
             managedKafkaConnectClient.createConnectorCallable().futureCall(request);
         // Do something.
         Connector response = future.get();
       }
       
    • updateConnector

      public final Connector updateConnector(Connector connector, com.google.protobuf.FieldMask updateMask)
      Updates the properties of a connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         Connector connector = Connector.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         Connector response = managedKafkaConnectClient.updateConnector(connector, updateMask);
       }
       
      Parameters:
      connector - Required. The connector 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
    • updateConnector

      public final Connector updateConnector(UpdateConnectorRequest request)
      Updates the properties of a connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         UpdateConnectorRequest request =
             UpdateConnectorRequest.newBuilder()
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .setConnector(Connector.newBuilder().build())
                 .build();
         Connector response = managedKafkaConnectClient.updateConnector(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateConnectorCallable

      public final UnaryCallable<UpdateConnectorRequest,Connector> updateConnectorCallable()
      Updates the properties of a connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         UpdateConnectorRequest request =
             UpdateConnectorRequest.newBuilder()
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .setConnector(Connector.newBuilder().build())
                 .build();
         ApiFuture<Connector> future =
             managedKafkaConnectClient.updateConnectorCallable().futureCall(request);
         // Do something.
         Connector response = future.get();
       }
       
    • deleteConnector

      public final void deleteConnector(ConnectorName name)
      Deletes a connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectorName name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]");
         managedKafkaConnectClient.deleteConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to delete. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • deleteConnector

      public final void deleteConnector(String name)
      Deletes a connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                 .toString();
         managedKafkaConnectClient.deleteConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to delete. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • deleteConnector

      public final void deleteConnector(DeleteConnectorRequest request)
      Deletes a connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         DeleteConnectorRequest request =
             DeleteConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         managedKafkaConnectClient.deleteConnector(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteConnectorCallable

      public final UnaryCallable<DeleteConnectorRequest,com.google.protobuf.Empty> deleteConnectorCallable()
      Deletes a connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         DeleteConnectorRequest request =
             DeleteConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         ApiFuture<Empty> future =
             managedKafkaConnectClient.deleteConnectorCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • pauseConnector

      public final PauseConnectorResponse pauseConnector(ConnectorName name)
      Pauses the connector and its tasks.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectorName name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]");
         PauseConnectorResponse response = managedKafkaConnectClient.pauseConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to pause. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • pauseConnector

      public final PauseConnectorResponse pauseConnector(String name)
      Pauses the connector and its tasks.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                 .toString();
         PauseConnectorResponse response = managedKafkaConnectClient.pauseConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to pause. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • pauseConnector

      public final PauseConnectorResponse pauseConnector(PauseConnectorRequest request)
      Pauses the connector and its tasks.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         PauseConnectorRequest request =
             PauseConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         PauseConnectorResponse response = managedKafkaConnectClient.pauseConnector(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • pauseConnectorCallable

      public final UnaryCallable<PauseConnectorRequest,PauseConnectorResponse> pauseConnectorCallable()
      Pauses the connector and its tasks.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         PauseConnectorRequest request =
             PauseConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         ApiFuture<PauseConnectorResponse> future =
             managedKafkaConnectClient.pauseConnectorCallable().futureCall(request);
         // Do something.
         PauseConnectorResponse response = future.get();
       }
       
    • resumeConnector

      public final ResumeConnectorResponse resumeConnector(ConnectorName name)
      Resumes the connector and its tasks.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectorName name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]");
         ResumeConnectorResponse response = managedKafkaConnectClient.resumeConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to pause. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • resumeConnector

      public final ResumeConnectorResponse resumeConnector(String name)
      Resumes the connector and its tasks.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                 .toString();
         ResumeConnectorResponse response = managedKafkaConnectClient.resumeConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to pause. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • resumeConnector

      public final ResumeConnectorResponse resumeConnector(ResumeConnectorRequest request)
      Resumes the connector and its tasks.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ResumeConnectorRequest request =
             ResumeConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         ResumeConnectorResponse response = managedKafkaConnectClient.resumeConnector(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • resumeConnectorCallable

      public final UnaryCallable<ResumeConnectorRequest,ResumeConnectorResponse> resumeConnectorCallable()
      Resumes the connector and its tasks.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ResumeConnectorRequest request =
             ResumeConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         ApiFuture<ResumeConnectorResponse> future =
             managedKafkaConnectClient.resumeConnectorCallable().futureCall(request);
         // Do something.
         ResumeConnectorResponse response = future.get();
       }
       
    • restartConnector

      public final RestartConnectorResponse restartConnector(ConnectorName name)
      Restarts the connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectorName name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]");
         RestartConnectorResponse response = managedKafkaConnectClient.restartConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to restart. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • restartConnector

      public final RestartConnectorResponse restartConnector(String name)
      Restarts the connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                 .toString();
         RestartConnectorResponse response = managedKafkaConnectClient.restartConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to restart. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • restartConnector

      public final RestartConnectorResponse restartConnector(RestartConnectorRequest request)
      Restarts the connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         RestartConnectorRequest request =
             RestartConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         RestartConnectorResponse response = managedKafkaConnectClient.restartConnector(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • restartConnectorCallable

      public final UnaryCallable<RestartConnectorRequest,RestartConnectorResponse> restartConnectorCallable()
      Restarts the connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         RestartConnectorRequest request =
             RestartConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         ApiFuture<RestartConnectorResponse> future =
             managedKafkaConnectClient.restartConnectorCallable().futureCall(request);
         // Do something.
         RestartConnectorResponse response = future.get();
       }
       
    • stopConnector

      public final StopConnectorResponse stopConnector(ConnectorName name)
      Stops the connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ConnectorName name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]");
         StopConnectorResponse response = managedKafkaConnectClient.stopConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to stop. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • stopConnector

      public final StopConnectorResponse stopConnector(String name)
      Stops the connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         String name =
             ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                 .toString();
         StopConnectorResponse response = managedKafkaConnectClient.stopConnector(name);
       }
       
      Parameters:
      name - Required. The name of the connector to stop. Structured like: projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
      Throws:
      ApiException - if the remote call fails
    • stopConnector

      public final StopConnectorResponse stopConnector(StopConnectorRequest request)
      Stops the connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         StopConnectorRequest request =
             StopConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         StopConnectorResponse response = managedKafkaConnectClient.stopConnector(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • stopConnectorCallable

      public final UnaryCallable<StopConnectorRequest,StopConnectorResponse> stopConnectorCallable()
      Stops the connector.

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         StopConnectorRequest request =
             StopConnectorRequest.newBuilder()
                 .setName(
                     ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECT_CLUSTER]", "[CONNECTOR]")
                         .toString())
                 .build();
         ApiFuture<StopConnectorResponse> future =
             managedKafkaConnectClient.stopConnectorCallable().futureCall(request);
         // Do something.
         StopConnectorResponse response = future.get();
       }
       
    • listLocations

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Location element : managedKafkaConnectClient.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

      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 (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Location> future =
             managedKafkaConnectClient.listLocationsPagedCallable().futureCall(request);
         // Do something.
         for (Location element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listLocationsCallable

      public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
      Lists information about the supported locations for this service.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListLocationsResponse response =
               managedKafkaConnectClient.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

      public final Location getLocation(GetLocationRequest request)
      Gets information about a location.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         Location response = managedKafkaConnectClient.getLocation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getLocationCallable

      public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
      Gets information about a location.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (ManagedKafkaConnectClient managedKafkaConnectClient = ManagedKafkaConnectClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         ApiFuture<Location> future =
             managedKafkaConnectClient.getLocationCallable().futureCall(request);
         // Do something.
         Location response = future.get();
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException