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: + * + *
{@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); + * } + * }+ * + *
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(). + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
DeleteConnectCluster | Deletes a single Connect cluster. |
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
DeleteConnector | Deletes a connector. |
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
RestartConnector | Restarts the connector. |
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
StopConnector | Stops the connector. |
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
ListLocations | Lists information about the supported locations for this service. |
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
GetLocation | Gets information about a location. |
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of ManagedKafkaConnectSettings to + * create(). For example: + * + *
To customize credentials: + * + *
{@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 + * ManagedKafkaConnectSettings managedKafkaConnectSettings = + * ManagedKafkaConnectSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * ManagedKafkaConnectClient managedKafkaConnectClient = + * ManagedKafkaConnectClient.create(managedKafkaConnectSettings); + * }+ * + *
To customize the endpoint: + * + *
{@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 + * 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: + * + *
{@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 + * ManagedKafkaConnectSettings managedKafkaConnectSettings = + * ManagedKafkaConnectSettings.newHttpJsonBuilder().build(); + * ManagedKafkaConnectClient managedKafkaConnectClient = + * ManagedKafkaConnectClient.create(managedKafkaConnectSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class ManagedKafkaConnectClient implements BackgroundResource { + private final ManagedKafkaConnectSettings settings; + private final ManagedKafkaConnectStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of ManagedKafkaConnectClient with default settings. */ + public static final ManagedKafkaConnectClient create() throws IOException { + return create(ManagedKafkaConnectSettings.newBuilder().build()); + } + + /** + * 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. + */ + public static final ManagedKafkaConnectClient create(ManagedKafkaConnectSettings settings) + throws IOException { + return new ManagedKafkaConnectClient(settings); + } + + /** + * Constructs an instance of ManagedKafkaConnectClient, using the given stub for making calls. + * This is for advanced usage - prefer using create(ManagedKafkaConnectSettings). + */ + public static final ManagedKafkaConnectClient create(ManagedKafkaConnectStub stub) { + return new ManagedKafkaConnectClient(stub); + } + + /** + * 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. + */ + protected ManagedKafkaConnectClient(ManagedKafkaConnectSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ManagedKafkaConnectStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected ManagedKafkaConnectClient(ManagedKafkaConnectStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final ManagedKafkaConnectSettings getSettings() { + return settings; + } + + public ManagedKafkaConnectStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the Kafka Connect clusters in a given project and location. + * + *
Sample code: + * + *
{@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); + * } + * } + * }+ * + * @param parent Required. The parent project/location whose Connect clusters are to be listed. + * Structured like `projects/{project}/locations/{location}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListConnectClustersPagedResponse listConnectClusters(LocationName parent) { + ListConnectClustersRequest request = + ListConnectClustersRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listConnectClusters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the Kafka Connect clusters in a given project and location. + * + *
Sample code: + * + *
{@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); + * } + * } + * }+ * + * @param parent Required. The parent project/location whose Connect clusters are to be listed. + * Structured like `projects/{project}/locations/{location}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListConnectClustersPagedResponse listConnectClusters(String parent) { + ListConnectClustersRequest request = + ListConnectClustersRequest.newBuilder().setParent(parent).build(); + return listConnectClusters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the Kafka Connect clusters in a given project and location. + * + *
Sample code: + * + *
{@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); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListConnectClustersPagedResponse listConnectClusters( + ListConnectClustersRequest request) { + return listConnectClustersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the Kafka Connect clusters in a given project and location. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.listConnectClustersPagedCallable().futureCall(request); + * // Do something. + * for (ConnectCluster element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@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; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the Kafka Connect cluster whose configuration to return. + * Structured like + * `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ConnectCluster getConnectCluster(ConnectClusterName name) { + GetConnectClusterRequest request = + GetConnectClusterRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getConnectCluster(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the properties of a single Kafka Connect cluster. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the Kafka Connect cluster whose configuration to return. + * Structured like + * `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ConnectCluster getConnectCluster(String name) { + GetConnectClusterRequest request = GetConnectClusterRequest.newBuilder().setName(name).build(); + return getConnectCluster(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the properties of a single Kafka Connect cluster. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ConnectCluster getConnectCluster(GetConnectClusterRequest request) { + return getConnectClusterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the properties of a single Kafka Connect cluster. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.getConnectClusterCallable().futureCall(request); + * // Do something. + * ConnectCluster response = future.get(); + * } + * }
Sample code: + * + *
{@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(); + * } + * }+ * + * @param parent Required. The parent project/location in which to create the Kafka Connect + * cluster. Structured like `projects/{project}/locations/{location}/`. + * @param connectCluster Required. Configuration of the Kafka Connect cluster to create. Its + * `name` field is ignored. + * @param 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 com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture
Sample code: + * + *
{@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(); + * } + * }+ * + * @param parent Required. The parent project/location in which to create the Kafka Connect + * cluster. Structured like `projects/{project}/locations/{location}/`. + * @param connectCluster Required. Configuration of the Kafka Connect cluster to create. Its + * `name` field is ignored. + * @param 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 com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture
Sample code: + * + *
{@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(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@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+ */ + public final OperationCallablefuture = + * managedKafkaConnectClient.createConnectClusterOperationCallable().futureCall(request); + * // Do something. + * ConnectCluster response = future.get(); + * } + * }
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.createConnectClusterCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@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(); + * } + * }+ * + * @param connectCluster Required. The Kafka Connect cluster to update. Its `name` field must be + * populated. + * @param 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 com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@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(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@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+ */ + public final OperationCallablefuture = + * managedKafkaConnectClient.updateConnectClusterOperationCallable().futureCall(request); + * // Do something. + * ConnectCluster response = future.get(); + * } + * }
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.updateConnectClusterCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@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(); + * } + * }+ * + * @param name Required. The name of the Kafka Connect cluster to delete. Structured like + * `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@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(); + * } + * }+ * + * @param name Required. The name of the Kafka Connect cluster to delete. Structured like + * `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@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(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@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+ */ + public final OperationCallablefuture = + * managedKafkaConnectClient.deleteConnectClusterOperationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.deleteConnectClusterCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * } + * }+ * + * @param parent Required. The parent Connect cluster whose connectors are to be listed. + * Structured like + * `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListConnectorsPagedResponse listConnectors(ConnectClusterName parent) { + ListConnectorsRequest request = + ListConnectorsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listConnectors(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the connectors in a given Connect cluster. + * + *
Sample code: + * + *
{@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); + * } + * } + * }+ * + * @param parent Required. The parent Connect cluster whose connectors are to be listed. + * Structured like + * `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListConnectorsPagedResponse listConnectors(String parent) { + ListConnectorsRequest request = ListConnectorsRequest.newBuilder().setParent(parent).build(); + return listConnectors(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the connectors in a given Connect cluster. + * + *
Sample code: + * + *
{@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); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListConnectorsPagedResponse listConnectors(ListConnectorsRequest request) { + return listConnectorsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the connectors in a given Connect cluster. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.listConnectorsPagedCallable().futureCall(request); + * // Do something. + * for (Connector element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@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; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector whose configuration to return. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Connector getConnector(ConnectorName name) { + GetConnectorRequest request = + GetConnectorRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the properties of a single connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector whose configuration to return. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Connector getConnector(String name) { + GetConnectorRequest request = GetConnectorRequest.newBuilder().setName(name).build(); + return getConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the properties of a single connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Connector getConnector(GetConnectorRequest request) { + return getConnectorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the properties of a single connector. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.getConnectorCallable().futureCall(request); + * // Do something. + * Connector response = future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * }+ * + * @param parent Required. The parent Connect cluster in which to create the connector. Structured + * like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`. + * @param connector Required. The connector to create. + * @param 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 com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Connector createConnector( + ConnectClusterName parent, Connector connector, String connectorId) { + CreateConnectorRequest request = + CreateConnectorRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setConnector(connector) + .setConnectorId(connectorId) + .build(); + return createConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new connector in a given Connect cluster. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param parent Required. The parent Connect cluster in which to create the connector. Structured + * like `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`. + * @param connector Required. The connector to create. + * @param 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 com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Connector createConnector(String parent, Connector connector, String connectorId) { + CreateConnectorRequest request = + CreateConnectorRequest.newBuilder() + .setParent(parent) + .setConnector(connector) + .setConnectorId(connectorId) + .build(); + return createConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new connector in a given Connect cluster. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Connector createConnector(CreateConnectorRequest request) { + return createConnectorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new connector in a given Connect cluster. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.createConnectorCallable().futureCall(request); + * // Do something. + * Connector response = future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * }+ * + * @param connector Required. The connector to update. Its `name` field must be populated. + * @param 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 com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Connector updateConnector(Connector connector, FieldMask updateMask) { + UpdateConnectorRequest request = + UpdateConnectorRequest.newBuilder() + .setConnector(connector) + .setUpdateMask(updateMask) + .build(); + return updateConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the properties of a connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Connector updateConnector(UpdateConnectorRequest request) { + return updateConnectorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the properties of a connector. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.updateConnectorCallable().futureCall(request); + * // Do something. + * Connector response = future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to delete. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteConnector(ConnectorName name) { + DeleteConnectorRequest request = + DeleteConnectorRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to delete. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteConnector(String name) { + DeleteConnectorRequest request = DeleteConnectorRequest.newBuilder().setName(name).build(); + deleteConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteConnector(DeleteConnectorRequest request) { + deleteConnectorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a connector. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.deleteConnectorCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to pause. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PauseConnectorResponse pauseConnector(ConnectorName name) { + PauseConnectorRequest request = + PauseConnectorRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return pauseConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pauses the connector and its tasks. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to pause. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PauseConnectorResponse pauseConnector(String name) { + PauseConnectorRequest request = PauseConnectorRequest.newBuilder().setName(name).build(); + return pauseConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pauses the connector and its tasks. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PauseConnectorResponse pauseConnector(PauseConnectorRequest request) { + return pauseConnectorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pauses the connector and its tasks. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.pauseConnectorCallable().futureCall(request); + * // Do something. + * PauseConnectorResponse response = future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to pause. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ResumeConnectorResponse resumeConnector(ConnectorName name) { + ResumeConnectorRequest request = + ResumeConnectorRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return resumeConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes the connector and its tasks. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to pause. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ResumeConnectorResponse resumeConnector(String name) { + ResumeConnectorRequest request = ResumeConnectorRequest.newBuilder().setName(name).build(); + return resumeConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes the connector and its tasks. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ResumeConnectorResponse resumeConnector(ResumeConnectorRequest request) { + return resumeConnectorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Resumes the connector and its tasks. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.resumeConnectorCallable().futureCall(request); + * // Do something. + * ResumeConnectorResponse response = future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to restart. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final RestartConnectorResponse restartConnector(ConnectorName name) { + RestartConnectorRequest request = + RestartConnectorRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return restartConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Restarts the connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to restart. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final RestartConnectorResponse restartConnector(String name) { + RestartConnectorRequest request = RestartConnectorRequest.newBuilder().setName(name).build(); + return restartConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Restarts the connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final RestartConnectorResponse restartConnector(RestartConnectorRequest request) { + return restartConnectorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Restarts the connector. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.restartConnectorCallable().futureCall(request); + * // Do something. + * RestartConnectorResponse response = future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to stop. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final StopConnectorResponse stopConnector(ConnectorName name) { + StopConnectorRequest request = + StopConnectorRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return stopConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Stops the connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param name Required. The name of the connector to stop. Structured like: + * projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final StopConnectorResponse stopConnector(String name) { + StopConnectorRequest request = StopConnectorRequest.newBuilder().setName(name).build(); + return stopConnector(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Stops the connector. + * + *
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final StopConnectorResponse stopConnector(StopConnectorRequest request) { + return stopConnectorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Stops the connector. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.stopConnectorCallable().futureCall(request); + * // Do something. + * StopConnectorResponse response = future.get(); + * } + * }
Sample code: + * + *
{@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); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.listLocationsPagedCallable().futureCall(request); + * // Do something. + * for (Location element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@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; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@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); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *
Sample code: + * + *
{@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+ */ + public final UnaryCallablefuture = + * managedKafkaConnectClient.getLocationCallable().futureCall(request); + * // Do something. + * Location response = future.get(); + * } + * }
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of getConnectCluster: + * + *
{@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 + * ManagedKafkaConnectSettings.Builder managedKafkaConnectSettingsBuilder = + * ManagedKafkaConnectSettings.newBuilder(); + * managedKafkaConnectSettingsBuilder + * .getConnectClusterSettings() + * .setRetrySettings( + * managedKafkaConnectSettingsBuilder + * .getConnectClusterSettings() + * .getRetrySettings() + * .toBuilder() + * .setInitialRetryDelayDuration(Duration.ofSeconds(1)) + * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5)) + * .setMaxAttempts(5) + * .setMaxRetryDelayDuration(Duration.ofSeconds(30)) + * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60)) + * .setRetryDelayMultiplier(1.3) + * .setRpcTimeoutMultiplier(1.5) + * .setTotalTimeoutDuration(Duration.ofSeconds(300)) + * .build()); + * ManagedKafkaConnectSettings managedKafkaConnectSettings = + * managedKafkaConnectSettingsBuilder.build(); + * }+ * + * Please refer to the [Client Side Retry + * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for + * additional support in setting retries. + * + *
To configure the RetrySettings of a Long Running Operation method, create an + * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to + * configure the RetrySettings for createConnectCluster: + * + *
{@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 + * ManagedKafkaConnectSettings.Builder managedKafkaConnectSettingsBuilder = + * ManagedKafkaConnectSettings.newBuilder(); + * TimedRetryAlgorithm timedRetryAlgorithm = + * OperationalTimedPollAlgorithm.create( + * RetrySettings.newBuilder() + * .setInitialRetryDelayDuration(Duration.ofMillis(500)) + * .setRetryDelayMultiplier(1.5) + * .setMaxRetryDelayDuration(Duration.ofMillis(5000)) + * .setTotalTimeoutDuration(Duration.ofHours(24)) + * .build()); + * managedKafkaConnectSettingsBuilder + * .createClusterOperationSettings() + * .setPollingAlgorithm(timedRetryAlgorithm) + * .build(); + * }+ */ +@Generated("by gapic-generator-java") +public class ManagedKafkaConnectSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction
======================= ManagedKafkaConnectClient ======================= + * + *
Service Description: The service that a client application uses to manage Apache Kafka Connect + * clusters and connectors. + * + *
Sample for ManagedKafkaConnectClient: + * + *
{@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); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.managedkafka.v1; diff --git a/java-managedkafka/google-cloud-managedkafka/src/main/java/com/google/cloud/managedkafka/v1/stub/GrpcManagedKafkaConnectCallableFactory.java b/java-managedkafka/google-cloud-managedkafka/src/main/java/com/google/cloud/managedkafka/v1/stub/GrpcManagedKafkaConnectCallableFactory.java new file mode 100644 index 000000000000..5255c68af3b8 --- /dev/null +++ b/java-managedkafka/google-cloud-managedkafka/src/main/java/com/google/cloud/managedkafka/v1/stub/GrpcManagedKafkaConnectCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.managedkafka.v1.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the ManagedKafkaConnect service API. + * + *
This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcManagedKafkaConnectCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public
This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcManagedKafkaConnectStub extends ManagedKafkaConnectStub {
+ private static final MethodDescriptor
This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class HttpJsonManagedKafkaConnectCallableFactory
+ implements HttpJsonStubCallableFactory
This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class HttpJsonManagedKafkaConnectStub extends ManagedKafkaConnectStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(Empty.getDescriptor())
+ .add(ConnectCluster.getDescriptor())
+ .add(OperationMetadata.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor