diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index 9e5cf2ac..aca8c787 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigqueryconnection.git", - "sha": "10f513e7c97666ba78e74d0cefcc35aa2bb1bd84" + "sha": "78f13c60075ae02e55ea208bc08d051f1953e0d5" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "d5fc0bcf9ea9789c5b0e3154a9e3b29e5cea6116" + "sha": "18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1" } } ] diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh index b7a86b16..5a972bba 100755 --- a/.kokoro/release/publish_javadoc.sh +++ b/.kokoro/release/publish_javadoc.sh @@ -38,8 +38,8 @@ python3 -m pip install gcp-docuploader # compile all packages mvn clean install -B -q -DskipTests=true -NAME=google-cloud-bigqueryconnection -VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) +export NAME=google-cloud-bigqueryconnection +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) # build the docs mvn site -B -q @@ -59,7 +59,8 @@ python3 -m docuploader upload . \ popd -# V2 +# V2 due to problems w/ the released javadoc plugin doclava, Java 8 is required. Beware of accidental updates. + mvn clean site -B -q -Ddevsite.template="${KOKORO_GFILE_DIR}/java/" pushd target/devsite/reference diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e3a8ae8..5632cc23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.0.5](https://www.github.com/googleapis/java-bigqueryconnection/compare/v1.0.4...v1.0.5) (2020-12-14) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 ([#259](https://www.github.com/googleapis/java-bigqueryconnection/issues/259)) ([afbabf7](https://www.github.com/googleapis/java-bigqueryconnection/commit/afbabf7291562bbe5d06b7d8b92f009552f725f5)) + ### [1.0.4](https://www.github.com/googleapis/java-bigqueryconnection/compare/v1.0.3...v1.0.4) (2020-12-02) diff --git a/README.md b/README.md index 421bbf9e..74cec22d 100644 --- a/README.md +++ b/README.md @@ -17,18 +17,18 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-bigqueryconnection - 1.0.3 + 1.0.4 ``` If you are using Gradle, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-bigqueryconnection:1.0.3' +compile 'com.google.cloud:google-cloud-bigqueryconnection:1.0.4' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigqueryconnection" % "1.0.3" +libraryDependencies += "com.google.cloud" % "google-cloud-bigqueryconnection" % "1.0.4" ``` ## Authentication diff --git a/google-cloud-bigqueryconnection-bom/pom.xml b/google-cloud-bigqueryconnection-bom/pom.xml index a64e3b66..da6a8efe 100644 --- a/google-cloud-bigqueryconnection-bom/pom.xml +++ b/google-cloud-bigqueryconnection-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigqueryconnection-bom - 1.0.4 + 1.0.5 pom com.google.cloud @@ -64,27 +64,27 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.4 + 1.0.5 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 1.0.4 + 1.0.5 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 - 1.0.4 + 1.0.5 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1beta1 - 0.5.4 + 0.5.5 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1beta1 - 0.5.4 + 0.5.5 diff --git a/google-cloud-bigqueryconnection/pom.xml b/google-cloud-bigqueryconnection/pom.xml index 7144c0d4..782d6158 100644 --- a/google-cloud-bigqueryconnection/pom.xml +++ b/google-cloud-bigqueryconnection/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigqueryconnection - 1.0.4 + 1.0.5 jar Google Cloud BigQuery Connections https://github.com/googleapis/java-bigqueryconnection @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.4 + 1.0.5 google-cloud-bigqueryconnection diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceClient.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceClient.java index 2dc04fff..d9085a53 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceClient.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.api.resourcenames.ResourceName; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.Connection; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ConnectionCredential; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.CreateConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.DeleteConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.GetConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsResponse; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionCredentialRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionRequest; import com.google.cloud.bigquery.connection.v1beta1.stub.ConnectionServiceStub; import com.google.cloud.bigquery.connection.v1beta1.stub.ConnectionServiceStubSettings; import com.google.iam.v1.GetIamPolicyRequest; @@ -44,25 +36,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Manages external data source connections and credentials. * *

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: * - *

- * 
- * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
- *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- *   Connection connection = Connection.newBuilder().build();
- *   String connectionId = "";
- *   Connection response = connectionServiceClient.createConnection(parent, connection, connectionId);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the connectionServiceClient object to clean up resources + *

Note: close() needs to be called on the ConnectionServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). * @@ -91,30 +72,28 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * ConnectionServiceSettings connectionServiceSettings =
  *     ConnectionServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * ConnectionServiceClient connectionServiceClient =
  *     ConnectionServiceClient.create(connectionServiceSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * ConnectionServiceSettings connectionServiceSettings =
  *     ConnectionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * ConnectionServiceClient connectionServiceClient =
  *     ConnectionServiceClient.create(connectionServiceSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class ConnectionServiceClient implements BackgroundResource { private final ConnectionServiceSettings settings; private final ConnectionServiceStub stub; @@ -135,7 +114,7 @@ public static final ConnectionServiceClient create(ConnectionServiceSettings set /** * Constructs an instance of ConnectionServiceClient, using the given stub for making calls. This - * is for advanced usage - prefer to use ConnectionServiceSettings}. + * is for advanced usage - prefer using create(ConnectionServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final ConnectionServiceClient create(ConnectionServiceStub stub) { @@ -167,31 +146,20 @@ public ConnectionServiceStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   String connectionId = "";
-   *   Connection response = connectionServiceClient.createConnection(parent, connection, connectionId);
-   * }
-   * 
- * * @param parent Required. Parent resource name. Must be in the format * `projects/{project_id}/locations/{location_id}` * @param connection Required. Connection to create. * @param connectionId Optional. Connection id that should be assigned to the created connection. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Connection createConnection( - LocationName parent, Connection connection, String connectionId) { - CreateConnectionRequest request = - CreateConnectionRequest.newBuilder() + public final ConnectionProto.Connection createConnection( + LocationName parent, ConnectionProto.Connection connection, String connectionId) { + ConnectionProto.CreateConnectionRequest request = + ConnectionProto.CreateConnectionRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setConnection(connection) .setConnectionId(connectionId) @@ -199,31 +167,20 @@ public final Connection createConnection( return createConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   String connectionId = "";
-   *   Connection response = connectionServiceClient.createConnection(parent.toString(), connection, connectionId);
-   * }
-   * 
- * * @param parent Required. Parent resource name. Must be in the format * `projects/{project_id}/locations/{location_id}` * @param connection Required. Connection to create. * @param connectionId Optional. Connection id that should be assigned to the created connection. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Connection createConnection( - String parent, Connection connection, String connectionId) { - CreateConnectionRequest request = - CreateConnectionRequest.newBuilder() + public final ConnectionProto.Connection createConnection( + String parent, ConnectionProto.Connection connection, String connectionId) { + ConnectionProto.CreateConnectionRequest request = + ConnectionProto.CreateConnectionRequest.newBuilder() .setParent(parent) .setConnection(connection) .setConnectionId(connectionId) @@ -231,275 +188,159 @@ public final Connection createConnection( return createConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   CreateConnectionRequest request = CreateConnectionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setConnection(connection)
-   *     .build();
-   *   Connection response = connectionServiceClient.createConnection(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 Connection createConnection(CreateConnectionRequest request) { + public final ConnectionProto.Connection createConnection( + ConnectionProto.CreateConnectionRequest request) { return createConnectionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new connection. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   CreateConnectionRequest request = CreateConnectionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setConnection(connection)
-   *     .build();
-   *   ApiFuture<Connection> future = connectionServiceClient.createConnectionCallable().futureCall(request);
-   *   // Do something
-   *   Connection response = future.get();
-   * }
-   * 
*/ - public final UnaryCallable createConnectionCallable() { + public final UnaryCallable + createConnectionCallable() { return stub.createConnectionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns specified connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection response = connectionServiceClient.getConnection(name);
-   * }
-   * 
- * * @param name Required. Name of the requested connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Connection getConnection(ConnectionName name) { - GetConnectionRequest request = - GetConnectionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + public final ConnectionProto.Connection getConnection(ConnectionName name) { + ConnectionProto.GetConnectionRequest request = + ConnectionProto.GetConnectionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); return getConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns specified connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection response = connectionServiceClient.getConnection(name.toString());
-   * }
-   * 
- * * @param name Required. Name of the requested connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Connection getConnection(String name) { - GetConnectionRequest request = GetConnectionRequest.newBuilder().setName(name).build(); + public final ConnectionProto.Connection getConnection(String name) { + ConnectionProto.GetConnectionRequest request = + ConnectionProto.GetConnectionRequest.newBuilder().setName(name).build(); return getConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns specified connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetConnectionRequest request = GetConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Connection response = connectionServiceClient.getConnection(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 Connection getConnection(GetConnectionRequest request) { + public final ConnectionProto.Connection getConnection( + ConnectionProto.GetConnectionRequest request) { return getConnectionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns specified connection. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetConnectionRequest request = GetConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Connection> future = connectionServiceClient.getConnectionCallable().futureCall(request);
-   *   // Do something
-   *   Connection response = future.get();
-   * }
-   * 
*/ - public final UnaryCallable getConnectionCallable() { + public final UnaryCallable + getConnectionCallable() { return stub.getConnectionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   UInt32Value maxResults = UInt32Value.newBuilder().build();
-   *   ListConnectionsResponse response = connectionServiceClient.listConnections(parent, maxResults);
-   * }
-   * 
- * * @param parent Required. Parent resource name. Must be in the form: * `projects/{project_id}/locations/{location_id}` * @param maxResults Required. Maximum number of results per page. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListConnectionsResponse listConnections( + public final ConnectionProto.ListConnectionsResponse listConnections( LocationName parent, UInt32Value maxResults) { - ListConnectionsRequest request = - ListConnectionsRequest.newBuilder() + ConnectionProto.ListConnectionsRequest request = + ConnectionProto.ListConnectionsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setMaxResults(maxResults) .build(); return listConnections(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   UInt32Value maxResults = UInt32Value.newBuilder().build();
-   *   ListConnectionsResponse response = connectionServiceClient.listConnections(parent.toString(), maxResults);
-   * }
-   * 
- * * @param parent Required. Parent resource name. Must be in the form: * `projects/{project_id}/locations/{location_id}` * @param maxResults Required. Maximum number of results per page. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListConnectionsResponse listConnections(String parent, UInt32Value maxResults) { - ListConnectionsRequest request = - ListConnectionsRequest.newBuilder().setParent(parent).setMaxResults(maxResults).build(); + public final ConnectionProto.ListConnectionsResponse listConnections( + String parent, UInt32Value maxResults) { + ConnectionProto.ListConnectionsRequest request = + ConnectionProto.ListConnectionsRequest.newBuilder() + .setParent(parent) + .setMaxResults(maxResults) + .build(); return listConnections(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   UInt32Value maxResults = UInt32Value.newBuilder().build();
-   *   ListConnectionsRequest request = ListConnectionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setMaxResults(maxResults)
-   *     .build();
-   *   ListConnectionsResponse response = connectionServiceClient.listConnections(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 ListConnectionsResponse listConnections(ListConnectionsRequest request) { + public final ConnectionProto.ListConnectionsResponse listConnections( + ConnectionProto.ListConnectionsRequest request) { return listConnectionsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   UInt32Value maxResults = UInt32Value.newBuilder().build();
-   *   ListConnectionsRequest request = ListConnectionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setMaxResults(maxResults)
-   *     .build();
-   *   ApiFuture<ListConnectionsResponse> future = connectionServiceClient.listConnectionsCallable().futureCall(request);
-   *   // Do something
-   *   ListConnectionsResponse response = future.get();
-   * }
-   * 
*/ - public final UnaryCallable + public final UnaryCallable< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsCallable() { return stub.listConnectionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Connection response = connectionServiceClient.updateConnection(name, connection, updateMask);
-   * }
-   * 
- * * @param name Required. Name of the connection to update, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @param connection Required. Connection containing the updated fields. * @param updateMask Required. Update mask for the connection fields to be updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Connection updateConnection( - ConnectionName name, Connection connection, FieldMask updateMask) { - UpdateConnectionRequest request = - UpdateConnectionRequest.newBuilder() + public final ConnectionProto.Connection updateConnection( + ConnectionName name, ConnectionProto.Connection connection, FieldMask updateMask) { + ConnectionProto.UpdateConnectionRequest request = + ConnectionProto.UpdateConnectionRequest.newBuilder() .setName(name == null ? null : name.toString()) .setConnection(connection) .setUpdateMask(updateMask) @@ -507,32 +348,21 @@ public final Connection updateConnection( return updateConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Connection response = connectionServiceClient.updateConnection(name.toString(), connection, updateMask);
-   * }
-   * 
- * * @param name Required. Name of the connection to update, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @param connection Required. Connection containing the updated fields. * @param updateMask Required. Update mask for the connection fields to be updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Connection updateConnection( - String name, Connection connection, FieldMask updateMask) { - UpdateConnectionRequest request = - UpdateConnectionRequest.newBuilder() + public final ConnectionProto.Connection updateConnection( + String name, ConnectionProto.Connection connection, FieldMask updateMask) { + ConnectionProto.UpdateConnectionRequest request = + ConnectionProto.UpdateConnectionRequest.newBuilder() .setName(name) .setConnection(connection) .setUpdateMask(updateMask) @@ -540,244 +370,130 @@ public final Connection updateConnection( return updateConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateConnectionRequest request = UpdateConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setConnection(connection)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Connection response = connectionServiceClient.updateConnection(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 Connection updateConnection(UpdateConnectionRequest request) { + public final ConnectionProto.Connection updateConnection( + ConnectionProto.UpdateConnectionRequest request) { return updateConnectionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateConnectionRequest request = UpdateConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setConnection(connection)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Connection> future = connectionServiceClient.updateConnectionCallable().futureCall(request);
-   *   // Do something
-   *   Connection response = future.get();
-   * }
-   * 
*/ - public final UnaryCallable updateConnectionCallable() { + public final UnaryCallable + updateConnectionCallable() { return stub.updateConnectionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the credential for the specified connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   String name = "";
-   *   ConnectionCredential credential = ConnectionCredential.newBuilder().build();
-   *   connectionServiceClient.updateConnectionCredential(name, credential);
-   * }
-   * 
- * * @param name Required. Name of the connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}/credential` * @param credential Required. Credential to use with the connection. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final void updateConnectionCredential(String name, ConnectionCredential credential) { - UpdateConnectionCredentialRequest request = - UpdateConnectionCredentialRequest.newBuilder() + public final void updateConnectionCredential( + String name, ConnectionProto.ConnectionCredential credential) { + ConnectionProto.UpdateConnectionCredentialRequest request = + ConnectionProto.UpdateConnectionCredentialRequest.newBuilder() .setName(name) .setCredential(credential) .build(); updateConnectionCredential(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the credential for the specified connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   String name = "";
-   *   ConnectionCredential credential = ConnectionCredential.newBuilder().build();
-   *   UpdateConnectionCredentialRequest request = UpdateConnectionCredentialRequest.newBuilder()
-   *     .setName(name)
-   *     .setCredential(credential)
-   *     .build();
-   *   connectionServiceClient.updateConnectionCredential(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 updateConnectionCredential(UpdateConnectionCredentialRequest request) { + public final void updateConnectionCredential( + ConnectionProto.UpdateConnectionCredentialRequest request) { updateConnectionCredentialCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the credential for the specified connection. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   String name = "";
-   *   ConnectionCredential credential = ConnectionCredential.newBuilder().build();
-   *   UpdateConnectionCredentialRequest request = UpdateConnectionCredentialRequest.newBuilder()
-   *     .setName(name)
-   *     .setCredential(credential)
-   *     .build();
-   *   ApiFuture<Void> future = connectionServiceClient.updateConnectionCredentialCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - public final UnaryCallable + public final UnaryCallable updateConnectionCredentialCallable() { return stub.updateConnectionCredentialCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes connection and associated credential. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   connectionServiceClient.deleteConnection(name);
-   * }
-   * 
- * * @param name Required. Name of the deleted connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteConnection(ConnectionName name) { - DeleteConnectionRequest request = - DeleteConnectionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + ConnectionProto.DeleteConnectionRequest request = + ConnectionProto.DeleteConnectionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); deleteConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes connection and associated credential. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   connectionServiceClient.deleteConnection(name.toString());
-   * }
-   * 
- * * @param name Required. Name of the deleted connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteConnection(String name) { - DeleteConnectionRequest request = DeleteConnectionRequest.newBuilder().setName(name).build(); + ConnectionProto.DeleteConnectionRequest request = + ConnectionProto.DeleteConnectionRequest.newBuilder().setName(name).build(); deleteConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes connection and associated credential. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   DeleteConnectionRequest request = DeleteConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   connectionServiceClient.deleteConnection(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 deleteConnection(DeleteConnectionRequest request) { + public final void deleteConnection(ConnectionProto.DeleteConnectionRequest request) { deleteConnectionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes connection and associated credential. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   DeleteConnectionRequest request = DeleteConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = connectionServiceClient.deleteConnectionCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - public final UnaryCallable deleteConnectionCallable() { + public final UnaryCallable + deleteConnectionCallable() { return stub.deleteConnectionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetPolicyOptions options = GetPolicyOptions.newBuilder().build();
-   *   Policy response = connectionServiceClient.getIamPolicy(resource, options);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @param options OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`. @@ -793,21 +509,11 @@ public final Policy getIamPolicy(ResourceName resource, GetPolicyOptions options return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetPolicyOptions options = GetPolicyOptions.newBuilder().build();
-   *   Policy response = connectionServiceClient.getIamPolicy(resource.toString(), options);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @param options OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`. @@ -820,23 +526,11 @@ public final Policy getIamPolicy(String resource, GetPolicyOptions options) { return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   Policy response = connectionServiceClient.getIamPolicy(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 */ @@ -844,45 +538,23 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { return getIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   ApiFuture<Policy> future = connectionServiceClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something
-   *   Policy response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replaces any existing policy. * *

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = connectionServiceClient.setIamPolicy(resource, policy);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the @@ -899,22 +571,12 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replaces any existing policy. * *

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = connectionServiceClient.setIamPolicy(resource.toString(), policy);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the @@ -928,26 +590,12 @@ public final Policy setIamPolicy(String resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replaces any existing policy. * *

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   Policy response = connectionServiceClient.setIamPolicy(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 */ @@ -955,33 +603,19 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { return setIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replaces any existing policy. * *

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   ApiFuture<Policy> future = connectionServiceClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something
-   *   Policy response = future.get();
-   * }
-   * 
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a NOT_FOUND error. @@ -990,16 +624,6 @@ public final UnaryCallable setIamPolicyCallable() { * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = connectionServiceClient.testIamPermissions(resource, permissions);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with @@ -1017,7 +641,7 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a NOT_FOUND error. @@ -1026,16 +650,6 @@ public final TestIamPermissionsResponse testIamPermissions( * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = connectionServiceClient.testIamPermissions(resource.toString(), permissions);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with @@ -1053,7 +667,7 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a NOT_FOUND error. @@ -1062,20 +676,6 @@ public final TestIamPermissionsResponse testIamPermissions( * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   TestIamPermissionsResponse response = connectionServiceClient.testIamPermissions(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 */ @@ -1083,7 +683,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq return testIamPermissionsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a NOT_FOUND error. @@ -1093,20 +693,6 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * warning. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   ApiFuture<TestIamPermissionsResponse> future = connectionServiceClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something
-   *   TestIamPermissionsResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable testIamPermissionsCallable() { diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceSettings.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceSettings.java index 4a983a81..39b4813c 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceSettings.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1; import com.google.api.core.ApiFunction; @@ -25,14 +26,6 @@ import com.google.api.gax.rpc.ClientSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.Connection; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.CreateConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.DeleteConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.GetConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsResponse; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionCredentialRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionRequest; import com.google.cloud.bigquery.connection.v1beta1.stub.ConnectionServiceStubSettings; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; @@ -44,7 +37,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link ConnectionServiceClient}. * @@ -62,52 +55,58 @@ * *

For example, to set the total timeout of createConnection to 30 seconds: * - *

- * 
+ * 
{@code
  * ConnectionServiceSettings.Builder connectionServiceSettingsBuilder =
  *     ConnectionServiceSettings.newBuilder();
  * connectionServiceSettingsBuilder
  *     .createConnectionSettings()
  *     .setRetrySettings(
- *         connectionServiceSettingsBuilder.createConnectionSettings().getRetrySettings().toBuilder()
+ *         connectionServiceSettingsBuilder
+ *             .createConnectionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * ConnectionServiceSettings connectionServiceSettings = connectionServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class ConnectionServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createConnection. */ - public UnaryCallSettings createConnectionSettings() { + public UnaryCallSettings + createConnectionSettings() { return ((ConnectionServiceStubSettings) getStubSettings()).createConnectionSettings(); } /** Returns the object with the settings used for calls to getConnection. */ - public UnaryCallSettings getConnectionSettings() { + public UnaryCallSettings + getConnectionSettings() { return ((ConnectionServiceStubSettings) getStubSettings()).getConnectionSettings(); } /** Returns the object with the settings used for calls to listConnections. */ - public UnaryCallSettings + public UnaryCallSettings< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsSettings() { return ((ConnectionServiceStubSettings) getStubSettings()).listConnectionsSettings(); } /** Returns the object with the settings used for calls to updateConnection. */ - public UnaryCallSettings updateConnectionSettings() { + public UnaryCallSettings + updateConnectionSettings() { return ((ConnectionServiceStubSettings) getStubSettings()).updateConnectionSettings(); } /** Returns the object with the settings used for calls to updateConnectionCredential. */ - public UnaryCallSettings + public UnaryCallSettings updateConnectionCredentialSettings() { return ((ConnectionServiceStubSettings) getStubSettings()).updateConnectionCredentialSettings(); } /** Returns the object with the settings used for calls to deleteConnection. */ - public UnaryCallSettings deleteConnectionSettings() { + public UnaryCallSettings + deleteConnectionSettings() { return ((ConnectionServiceStubSettings) getStubSettings()).deleteConnectionSettings(); } @@ -187,18 +186,15 @@ protected ConnectionServiceSettings(Builder settingsBuilder) throws IOException /** Builder for ConnectionServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(ConnectionServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(ConnectionServiceStubSettings.newBuilder()); - } - protected Builder(ConnectionServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -207,11 +203,15 @@ protected Builder(ConnectionServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(ConnectionServiceStubSettings.newBuilder()); + } + public ConnectionServiceStubSettings.Builder getStubSettingsBuilder() { return ((ConnectionServiceStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -225,36 +225,42 @@ public Builder applyToAllUnaryMethods( } /** Returns the builder for the settings used for calls to createConnection. */ - public UnaryCallSettings.Builder + public UnaryCallSettings.Builder< + ConnectionProto.CreateConnectionRequest, ConnectionProto.Connection> createConnectionSettings() { return getStubSettingsBuilder().createConnectionSettings(); } /** Returns the builder for the settings used for calls to getConnection. */ - public UnaryCallSettings.Builder getConnectionSettings() { + public UnaryCallSettings.Builder< + ConnectionProto.GetConnectionRequest, ConnectionProto.Connection> + getConnectionSettings() { return getStubSettingsBuilder().getConnectionSettings(); } /** Returns the builder for the settings used for calls to listConnections. */ - public UnaryCallSettings.Builder + public UnaryCallSettings.Builder< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsSettings() { return getStubSettingsBuilder().listConnectionsSettings(); } /** Returns the builder for the settings used for calls to updateConnection. */ - public UnaryCallSettings.Builder + public UnaryCallSettings.Builder< + ConnectionProto.UpdateConnectionRequest, ConnectionProto.Connection> updateConnectionSettings() { return getStubSettingsBuilder().updateConnectionSettings(); } /** Returns the builder for the settings used for calls to updateConnectionCredential. */ - public UnaryCallSettings.Builder + public UnaryCallSettings.Builder updateConnectionCredentialSettings() { return getStubSettingsBuilder().updateConnectionCredentialSettings(); } /** Returns the builder for the settings used for calls to deleteConnection. */ - public UnaryCallSettings.Builder deleteConnectionSettings() { + public UnaryCallSettings.Builder + deleteConnectionSettings() { return getStubSettingsBuilder().deleteConnectionSettings(); } diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/package-info.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/package-info.java index dfc46794..d1b53c92 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/package-info.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/package-info.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,28 +15,15 @@ */ /** - * A client to BigQuery Connection API. - * - *

The interfaces provided are listed below, along with usage samples. + * The interfaces provided are listed below, along with usage samples. * *

======================= ConnectionServiceClient ======================= * *

Service Description: Manages external data source connections and credentials. * *

Sample for ConnectionServiceClient: - * - *

- * 
- * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
- *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- *   Connection connection = Connection.newBuilder().build();
- *   String connectionId = "";
- *   Connection response = connectionServiceClient.createConnection(parent, connection, connectionId);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.bigquery.connection.v1beta1; import javax.annotation.Generated; diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/ConnectionServiceStub.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/ConnectionServiceStub.java index 3e46e264..4fe08474 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/ConnectionServiceStub.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/ConnectionServiceStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,19 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.Connection; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.CreateConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.DeleteConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.GetConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsResponse; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionCredentialRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionRequest; +import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; @@ -34,39 +27,43 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for BigQuery Connection API. + * Base stub class for the ConnectionService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class ConnectionServiceStub implements BackgroundResource { - public UnaryCallable createConnectionCallable() { + public UnaryCallable + createConnectionCallable() { throw new UnsupportedOperationException("Not implemented: createConnectionCallable()"); } - public UnaryCallable getConnectionCallable() { + public UnaryCallable + getConnectionCallable() { throw new UnsupportedOperationException("Not implemented: getConnectionCallable()"); } - public UnaryCallable listConnectionsCallable() { + public UnaryCallable< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> + listConnectionsCallable() { throw new UnsupportedOperationException("Not implemented: listConnectionsCallable()"); } - public UnaryCallable updateConnectionCallable() { + public UnaryCallable + updateConnectionCallable() { throw new UnsupportedOperationException("Not implemented: updateConnectionCallable()"); } - public UnaryCallable + public UnaryCallable updateConnectionCredentialCallable() { throw new UnsupportedOperationException( "Not implemented: updateConnectionCredentialCallable()"); } - public UnaryCallable deleteConnectionCallable() { + public UnaryCallable deleteConnectionCallable() { throw new UnsupportedOperationException("Not implemented: deleteConnectionCallable()"); } diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/ConnectionServiceStubSettings.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/ConnectionServiceStubSettings.java index 0698cdc1..25d6f166 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/ConnectionServiceStubSettings.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/ConnectionServiceStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1.stub; import com.google.api.core.ApiFunction; @@ -30,14 +31,7 @@ import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.Connection; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.CreateConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.DeleteConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.GetConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsResponse; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionCredentialRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionRequest; +import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -53,7 +47,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link ConnectionServiceStub}. * @@ -71,22 +65,24 @@ * *

For example, to set the total timeout of createConnection to 30 seconds: * - *

- * 
+ * 
{@code
  * ConnectionServiceStubSettings.Builder connectionServiceSettingsBuilder =
  *     ConnectionServiceStubSettings.newBuilder();
  * connectionServiceSettingsBuilder
  *     .createConnectionSettings()
  *     .setRetrySettings(
- *         connectionServiceSettingsBuilder.createConnectionSettings().getRetrySettings().toBuilder()
+ *         connectionServiceSettingsBuilder
+ *             .createConnectionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * ConnectionServiceStubSettings connectionServiceSettings = connectionServiceSettingsBuilder.build();
- * 
- * 
+ * ConnectionServiceStubSettings connectionServiceSettings = + * connectionServiceSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class ConnectionServiceStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -95,48 +91,60 @@ public class ConnectionServiceStubSettings extends StubSettings createConnectionSettings; - private final UnaryCallSettings getConnectionSettings; - private final UnaryCallSettings + private final UnaryCallSettings< + ConnectionProto.CreateConnectionRequest, ConnectionProto.Connection> + createConnectionSettings; + private final UnaryCallSettings + getConnectionSettings; + private final UnaryCallSettings< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsSettings; - private final UnaryCallSettings updateConnectionSettings; - private final UnaryCallSettings + private final UnaryCallSettings< + ConnectionProto.UpdateConnectionRequest, ConnectionProto.Connection> + updateConnectionSettings; + private final UnaryCallSettings updateConnectionCredentialSettings; - private final UnaryCallSettings deleteConnectionSettings; + private final UnaryCallSettings + deleteConnectionSettings; private final UnaryCallSettings getIamPolicySettings; private final UnaryCallSettings setIamPolicySettings; private final UnaryCallSettings testIamPermissionsSettings; /** Returns the object with the settings used for calls to createConnection. */ - public UnaryCallSettings createConnectionSettings() { + public UnaryCallSettings + createConnectionSettings() { return createConnectionSettings; } /** Returns the object with the settings used for calls to getConnection. */ - public UnaryCallSettings getConnectionSettings() { + public UnaryCallSettings + getConnectionSettings() { return getConnectionSettings; } /** Returns the object with the settings used for calls to listConnections. */ - public UnaryCallSettings + public UnaryCallSettings< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsSettings() { return listConnectionsSettings; } /** Returns the object with the settings used for calls to updateConnection. */ - public UnaryCallSettings updateConnectionSettings() { + public UnaryCallSettings + updateConnectionSettings() { return updateConnectionSettings; } /** Returns the object with the settings used for calls to updateConnectionCredential. */ - public UnaryCallSettings + public UnaryCallSettings updateConnectionCredentialSettings() { return updateConnectionCredentialSettings; } /** Returns the object with the settings used for calls to deleteConnection. */ - public UnaryCallSettings deleteConnectionSettings() { + public UnaryCallSettings + deleteConnectionSettings() { return deleteConnectionSettings; } @@ -162,10 +170,10 @@ public ConnectionServiceStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcConnectionServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -240,37 +248,40 @@ protected ConnectionServiceStubSettings(Builder settingsBuilder) throws IOExcept /** Builder for ConnectionServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - - private final UnaryCallSettings.Builder + private final UnaryCallSettings.Builder< + ConnectionProto.CreateConnectionRequest, ConnectionProto.Connection> createConnectionSettings; - private final UnaryCallSettings.Builder getConnectionSettings; - private final UnaryCallSettings.Builder + private final UnaryCallSettings.Builder< + ConnectionProto.GetConnectionRequest, ConnectionProto.Connection> + getConnectionSettings; + private final UnaryCallSettings.Builder< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsSettings; - private final UnaryCallSettings.Builder + private final UnaryCallSettings.Builder< + ConnectionProto.UpdateConnectionRequest, ConnectionProto.Connection> updateConnectionSettings; - private final UnaryCallSettings.Builder + private final UnaryCallSettings.Builder< + ConnectionProto.UpdateConnectionCredentialRequest, Empty> updateConnectionCredentialSettings; - private final UnaryCallSettings.Builder + private final UnaryCallSettings.Builder deleteConnectionSettings; private final UnaryCallSettings.Builder getIamPolicySettings; private final UnaryCallSettings.Builder setIamPolicySettings; private final UnaryCallSettings.Builder testIamPermissionsSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder> definitions = ImmutableMap.builder(); + definitions.put( + "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( "retry_policy_1_codes", ImmutableSet.copyOf( Lists.newArrayList( StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -281,51 +292,41 @@ public static class Builder extends StubSettings.Builder>of( + createConnectionSettings, + getConnectionSettings, + listConnectionsSettings, + updateConnectionSettings, + updateConnectionCredentialSettings, + deleteConnectionSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createConnectionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .getConnectionSettings() @@ -371,13 +398,13 @@ private static Builder initDefaults(Builder builder) { builder .updateConnectionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .updateConnectionCredentialSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .deleteConnectionSettings() @@ -386,49 +413,23 @@ private static Builder initDefaults(Builder builder) { builder .getIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .setIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .testIamPermissionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); return builder; } - protected Builder(ConnectionServiceStubSettings settings) { - super(settings); - - createConnectionSettings = settings.createConnectionSettings.toBuilder(); - getConnectionSettings = settings.getConnectionSettings.toBuilder(); - listConnectionsSettings = settings.listConnectionsSettings.toBuilder(); - updateConnectionSettings = settings.updateConnectionSettings.toBuilder(); - updateConnectionCredentialSettings = settings.updateConnectionCredentialSettings.toBuilder(); - deleteConnectionSettings = settings.deleteConnectionSettings.toBuilder(); - getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); - setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); - testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createConnectionSettings, - getConnectionSettings, - listConnectionsSettings, - updateConnectionSettings, - updateConnectionCredentialSettings, - deleteConnectionSettings, - getIamPolicySettings, - setIamPolicySettings, - testIamPermissionsSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -445,36 +446,42 @@ public Builder applyToAllUnaryMethods( } /** Returns the builder for the settings used for calls to createConnection. */ - public UnaryCallSettings.Builder + public UnaryCallSettings.Builder< + ConnectionProto.CreateConnectionRequest, ConnectionProto.Connection> createConnectionSettings() { return createConnectionSettings; } /** Returns the builder for the settings used for calls to getConnection. */ - public UnaryCallSettings.Builder getConnectionSettings() { + public UnaryCallSettings.Builder< + ConnectionProto.GetConnectionRequest, ConnectionProto.Connection> + getConnectionSettings() { return getConnectionSettings; } /** Returns the builder for the settings used for calls to listConnections. */ - public UnaryCallSettings.Builder + public UnaryCallSettings.Builder< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsSettings() { return listConnectionsSettings; } /** Returns the builder for the settings used for calls to updateConnection. */ - public UnaryCallSettings.Builder + public UnaryCallSettings.Builder< + ConnectionProto.UpdateConnectionRequest, ConnectionProto.Connection> updateConnectionSettings() { return updateConnectionSettings; } /** Returns the builder for the settings used for calls to updateConnectionCredential. */ - public UnaryCallSettings.Builder + public UnaryCallSettings.Builder updateConnectionCredentialSettings() { return updateConnectionCredentialSettings; } /** Returns the builder for the settings used for calls to deleteConnection. */ - public UnaryCallSettings.Builder deleteConnectionSettings() { + public UnaryCallSettings.Builder + deleteConnectionSettings() { return deleteConnectionSettings; } diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/GrpcConnectionServiceCallableFactory.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/GrpcConnectionServiceCallableFactory.java index 83d3a15f..7aa64134 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/GrpcConnectionServiceCallableFactory.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/GrpcConnectionServiceCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ 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 +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for BigQuery Connection API. + * gRPC callable factory implementation for the ConnectionService service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcConnectionServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/GrpcConnectionServiceStub.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/GrpcConnectionServiceStub.java index 5f40e7c6..585b229b 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/GrpcConnectionServiceStub.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/stub/GrpcConnectionServiceStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -23,20 +23,14 @@ import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.Connection; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.CreateConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.DeleteConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.GetConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsResponse; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionCredentialRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionRequest; +import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto; import com.google.common.collect.ImmutableMap; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -45,77 +39,99 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for BigQuery Connection API. + * gRPC stub implementation for the ConnectionService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcConnectionServiceStub extends ConnectionServiceStub { - - private static final MethodDescriptor + private static final MethodDescriptor< + ConnectionProto.CreateConnectionRequest, ConnectionProto.Connection> createConnectionMethodDescriptor = - MethodDescriptor.newBuilder() + MethodDescriptor + .newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.connection.v1beta1.ConnectionService/CreateConnection") .setRequestMarshaller( - ProtoUtils.marshaller(CreateConnectionRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Connection.getDefaultInstance())) + ProtoUtils.marshaller( + ConnectionProto.CreateConnectionRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ConnectionProto.Connection.getDefaultInstance())) .build(); - private static final MethodDescriptor + + private static final MethodDescriptor< + ConnectionProto.GetConnectionRequest, ConnectionProto.Connection> getConnectionMethodDescriptor = - MethodDescriptor.newBuilder() + MethodDescriptor + .newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.connection.v1beta1.ConnectionService/GetConnection") .setRequestMarshaller( - ProtoUtils.marshaller(GetConnectionRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Connection.getDefaultInstance())) + ProtoUtils.marshaller(ConnectionProto.GetConnectionRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ConnectionProto.Connection.getDefaultInstance())) .build(); - private static final MethodDescriptor + + private static final MethodDescriptor< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsMethodDescriptor = - MethodDescriptor.newBuilder() + MethodDescriptor + . + newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.connection.v1beta1.ConnectionService/ListConnections") .setRequestMarshaller( - ProtoUtils.marshaller(ListConnectionsRequest.getDefaultInstance())) + ProtoUtils.marshaller( + ConnectionProto.ListConnectionsRequest.getDefaultInstance())) .setResponseMarshaller( - ProtoUtils.marshaller(ListConnectionsResponse.getDefaultInstance())) + ProtoUtils.marshaller( + ConnectionProto.ListConnectionsResponse.getDefaultInstance())) .build(); - private static final MethodDescriptor + + private static final MethodDescriptor< + ConnectionProto.UpdateConnectionRequest, ConnectionProto.Connection> updateConnectionMethodDescriptor = - MethodDescriptor.newBuilder() + MethodDescriptor + .newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.connection.v1beta1.ConnectionService/UpdateConnection") .setRequestMarshaller( - ProtoUtils.marshaller(UpdateConnectionRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Connection.getDefaultInstance())) + ProtoUtils.marshaller( + ConnectionProto.UpdateConnectionRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ConnectionProto.Connection.getDefaultInstance())) .build(); - private static final MethodDescriptor + + private static final MethodDescriptor updateConnectionCredentialMethodDescriptor = - MethodDescriptor.newBuilder() + MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.connection.v1beta1.ConnectionService/UpdateConnectionCredential") .setRequestMarshaller( - ProtoUtils.marshaller(UpdateConnectionCredentialRequest.getDefaultInstance())) + ProtoUtils.marshaller( + ConnectionProto.UpdateConnectionCredentialRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private static final MethodDescriptor + + private static final MethodDescriptor deleteConnectionMethodDescriptor = - MethodDescriptor.newBuilder() + MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.connection.v1beta1.ConnectionService/DeleteConnection") .setRequestMarshaller( - ProtoUtils.marshaller(DeleteConnectionRequest.getDefaultInstance())) + ProtoUtils.marshaller( + ConnectionProto.DeleteConnectionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -124,6 +140,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); + private static final MethodDescriptor setIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -132,6 +149,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); + private static final MethodDescriptor testIamPermissionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -144,21 +162,26 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - - private final UnaryCallable createConnectionCallable; - private final UnaryCallable getConnectionCallable; - private final UnaryCallable + private final UnaryCallable + createConnectionCallable; + private final UnaryCallable + getConnectionCallable; + private final UnaryCallable< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsCallable; - private final UnaryCallable updateConnectionCallable; - private final UnaryCallable + private final UnaryCallable + updateConnectionCallable; + private final UnaryCallable updateConnectionCredentialCallable; - private final UnaryCallable deleteConnectionCallable; + private final UnaryCallable + deleteConnectionCallable; private final UnaryCallable getIamPolicyCallable; private final UnaryCallable setIamPolicyCallable; private final UnaryCallable testIamPermissionsCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcConnectionServiceStub create(ConnectionServiceStubSettings settings) @@ -199,88 +222,105 @@ protected GrpcConnectionServiceStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - GrpcCallSettings createConnectionTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(createConnectionMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateConnectionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } - }) - .build(); - GrpcCallSettings getConnectionTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getConnectionMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetConnectionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } - }) - .build(); - GrpcCallSettings + GrpcCallSettings + createConnectionTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(createConnectionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + ConnectionProto.CreateConnectionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getConnectionTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(getConnectionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + ConnectionProto.GetConnectionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> listConnectionsTransportSettings = - GrpcCallSettings.newBuilder() + GrpcCallSettings + . + newBuilder() .setMethodDescriptor(listConnectionsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { + new RequestParamsExtractor() { @Override - public Map extract(ListConnectionsRequest request) { + public Map extract( + ConnectionProto.ListConnectionsRequest request) { ImmutableMap.Builder params = ImmutableMap.builder(); params.put("parent", String.valueOf(request.getParent())); return params.build(); } }) .build(); - GrpcCallSettings updateConnectionTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(updateConnectionMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateConnectionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } - }) - .build(); - GrpcCallSettings + GrpcCallSettings + updateConnectionTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(updateConnectionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + ConnectionProto.UpdateConnectionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateConnectionCredentialTransportSettings = - GrpcCallSettings.newBuilder() + GrpcCallSettings.newBuilder() .setMethodDescriptor(updateConnectionCredentialMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { + new RequestParamsExtractor< + ConnectionProto.UpdateConnectionCredentialRequest>() { @Override public Map extract( - UpdateConnectionCredentialRequest request) { + ConnectionProto.UpdateConnectionCredentialRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + deleteConnectionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteConnectionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + ConnectionProto.DeleteConnectionRequest request) { ImmutableMap.Builder params = ImmutableMap.builder(); params.put("name", String.valueOf(request.getName())); return params.build(); } }) .build(); - GrpcCallSettings deleteConnectionTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(deleteConnectionMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteConnectionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } - }) - .build(); GrpcCallSettings getIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getIamPolicyMethodDescriptor) @@ -354,31 +394,41 @@ public Map extract(TestIamPermissionsRequest request) { settings.testIamPermissionsSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } - public UnaryCallable createConnectionCallable() { + public UnaryCallable + createConnectionCallable() { return createConnectionCallable; } - public UnaryCallable getConnectionCallable() { + public UnaryCallable + getConnectionCallable() { return getConnectionCallable; } - public UnaryCallable listConnectionsCallable() { + public UnaryCallable< + ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> + listConnectionsCallable() { return listConnectionsCallable; } - public UnaryCallable updateConnectionCallable() { + public UnaryCallable + updateConnectionCallable() { return updateConnectionCallable; } - public UnaryCallable + public UnaryCallable updateConnectionCredentialCallable() { return updateConnectionCredentialCallable; } - public UnaryCallable deleteConnectionCallable() { + public UnaryCallable deleteConnectionCallable() { return deleteConnectionCallable; } diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceClient.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceClient.java index 2f0d153f..421b1392 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceClient.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceClient.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1; import com.google.api.core.ApiFunction; @@ -51,25 +52,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Manages external data source connections and credentials. * *

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: * - *

- * 
- * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
- *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- *   Connection connection = Connection.newBuilder().build();
- *   String connectionId = "";
- *   Connection response = connectionServiceClient.createConnection(parent, connection, connectionId);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the connectionServiceClient object to clean up resources + *

Note: close() needs to be called on the ConnectionServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). * @@ -98,30 +88,28 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * ConnectionServiceSettings connectionServiceSettings =
  *     ConnectionServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * ConnectionServiceClient connectionServiceClient =
  *     ConnectionServiceClient.create(connectionServiceSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * ConnectionServiceSettings connectionServiceSettings =
  *     ConnectionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * ConnectionServiceClient connectionServiceClient =
  *     ConnectionServiceClient.create(connectionServiceSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class ConnectionServiceClient implements BackgroundResource { private final ConnectionServiceSettings settings; private final ConnectionServiceStub stub; @@ -142,7 +130,7 @@ public static final ConnectionServiceClient create(ConnectionServiceSettings set /** * Constructs an instance of ConnectionServiceClient, using the given stub for making calls. This - * is for advanced usage - prefer to use ConnectionServiceSettings}. + * is for advanced usage - prefer using create(ConnectionServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final ConnectionServiceClient create(ConnectionServiceStub stub) { @@ -174,21 +162,10 @@ public ConnectionServiceStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   String connectionId = "";
-   *   Connection response = connectionServiceClient.createConnection(parent, connection, connectionId);
-   * }
-   * 
- * * @param parent Required. Parent resource name. Must be in the format * `projects/{project_id}/locations/{location_id}` * @param connection Required. Connection to create. @@ -206,21 +183,10 @@ public final Connection createConnection( return createConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   String connectionId = "";
-   *   Connection response = connectionServiceClient.createConnection(parent.toString(), connection, connectionId);
-   * }
-   * 
- * * @param parent Required. Parent resource name. Must be in the format * `projects/{project_id}/locations/{location_id}` * @param connection Required. Connection to create. @@ -238,24 +204,10 @@ public final Connection createConnection( return createConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   CreateConnectionRequest request = CreateConnectionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setConnection(connection)
-   *     .build();
-   *   Connection response = connectionServiceClient.createConnection(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 */ @@ -263,43 +215,20 @@ public final Connection createConnection(CreateConnectionRequest request) { return createConnectionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new connection. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   CreateConnectionRequest request = CreateConnectionRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setConnection(connection)
-   *     .build();
-   *   ApiFuture<Connection> future = connectionServiceClient.createConnectionCallable().futureCall(request);
-   *   // Do something
-   *   Connection response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createConnectionCallable() { return stub.createConnectionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns specified connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection response = connectionServiceClient.getConnection(name);
-   * }
-   * 
- * * @param name Required. Name of the requested connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -310,19 +239,10 @@ public final Connection getConnection(ConnectionName name) { return getConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns specified connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection response = connectionServiceClient.getConnection(name.toString());
-   * }
-   * 
- * * @param name Required. Name of the requested connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -332,22 +252,10 @@ public final Connection getConnection(String name) { return getConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns specified connection. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetConnectionRequest request = GetConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Connection response = connectionServiceClient.getConnection(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 */ @@ -355,43 +263,20 @@ public final Connection getConnection(GetConnectionRequest request) { return getConnectionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns specified connection. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetConnectionRequest request = GetConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Connection> future = connectionServiceClient.getConnectionCallable().futureCall(request);
-   *   // Do something
-   *   Connection response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getConnectionCallable() { return stub.getConnectionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (Connection element : connectionServiceClient.listConnections(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. Must be in the form: * `projects/{project_id}/locations/{location_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -404,21 +289,10 @@ public final ListConnectionsPagedResponse listConnections(LocationName parent) { return listConnections(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (Connection element : connectionServiceClient.listConnections(parent.toString()).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param parent Required. Parent resource name. Must be in the form: * `projects/{project_id}/locations/{location_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -428,26 +302,10 @@ public final ListConnectionsPagedResponse listConnections(String parent) { return listConnections(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   int pageSize = 0;
-   *   ListConnectionsRequest request = ListConnectionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setPageSize(pageSize)
-   *     .build();
-   *   for (Connection element : connectionServiceClient.listConnections(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 */ @@ -455,83 +313,33 @@ public final ListConnectionsPagedResponse listConnections(ListConnectionsRequest return listConnectionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   int pageSize = 0;
-   *   ListConnectionsRequest request = ListConnectionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setPageSize(pageSize)
-   *     .build();
-   *   ApiFuture<ListConnectionsPagedResponse> future = connectionServiceClient.listConnectionsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Connection element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listConnectionsPagedCallable() { return stub.listConnectionsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of connections in the given project. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   int pageSize = 0;
-   *   ListConnectionsRequest request = ListConnectionsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setPageSize(pageSize)
-   *     .build();
-   *   while (true) {
-   *     ListConnectionsResponse response = connectionServiceClient.listConnectionsCallable().call(request);
-   *     for (Connection element : response.getConnectionsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listConnectionsCallable() { return stub.listConnectionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Connection response = connectionServiceClient.updateConnection(name, connection, updateMask);
-   * }
-   * 
- * * @param name Required. Name of the connection to update, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @param connection Required. Connection containing the updated fields. @@ -549,22 +357,11 @@ public final Connection updateConnection( return updateConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Connection response = connectionServiceClient.updateConnection(name.toString(), connection, updateMask);
-   * }
-   * 
- * * @param name Required. Name of the connection to update, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @param connection Required. Connection containing the updated fields. @@ -582,27 +379,11 @@ public final Connection updateConnection( return updateConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateConnectionRequest request = UpdateConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setConnection(connection)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Connection response = connectionServiceClient.updateConnection(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 */ @@ -610,46 +391,21 @@ public final Connection updateConnection(UpdateConnectionRequest request) { return updateConnectionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Connection connection = Connection.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateConnectionRequest request = UpdateConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setConnection(connection)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Connection> future = connectionServiceClient.updateConnectionCallable().futureCall(request);
-   *   // Do something
-   *   Connection response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateConnectionCallable() { return stub.updateConnectionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes connection and associated credential. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   connectionServiceClient.deleteConnection(name);
-   * }
-   * 
- * * @param name Required. Name of the deleted connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -660,19 +416,10 @@ public final void deleteConnection(ConnectionName name) { deleteConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes connection and associated credential. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   connectionServiceClient.deleteConnection(name.toString());
-   * }
-   * 
- * * @param name Required. Name of the deleted connection, for example: * `projects/{project_id}/locations/{location_id}/connections/{connection_id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -682,22 +429,10 @@ public final void deleteConnection(String name) { deleteConnection(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes connection and associated credential. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   DeleteConnectionRequest request = DeleteConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   connectionServiceClient.deleteConnection(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 */ @@ -705,43 +440,21 @@ public final void deleteConnection(DeleteConnectionRequest request) { deleteConnectionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes connection and associated credential. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   DeleteConnectionRequest request = DeleteConnectionRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = connectionServiceClient.deleteConnectionCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteConnectionCallable() { return stub.deleteConnectionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetPolicyOptions options = GetPolicyOptions.newBuilder().build();
-   *   Policy response = connectionServiceClient.getIamPolicy(resource, options);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @param options OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`. @@ -757,21 +470,11 @@ public final Policy getIamPolicy(ResourceName resource, GetPolicyOptions options return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetPolicyOptions options = GetPolicyOptions.newBuilder().build();
-   *   Policy response = connectionServiceClient.getIamPolicy(resource.toString(), options);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @param options OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`. @@ -784,23 +487,11 @@ public final Policy getIamPolicy(String resource, GetPolicyOptions options) { return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   Policy response = connectionServiceClient.getIamPolicy(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 */ @@ -808,45 +499,23 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { return getIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   ApiFuture<Policy> future = connectionServiceClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something
-   *   Policy response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replaces any existing policy. * *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = connectionServiceClient.setIamPolicy(resource, policy);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the @@ -863,22 +532,12 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replaces any existing policy. * *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = connectionServiceClient.setIamPolicy(resource.toString(), policy);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the @@ -892,26 +551,12 @@ public final Policy setIamPolicy(String resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replaces any existing policy. * *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   Policy response = connectionServiceClient.setIamPolicy(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 */ @@ -919,33 +564,19 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { return setIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replaces any existing policy. * *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   ApiFuture<Policy> future = connectionServiceClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something
-   *   Policy response = future.get();
-   * }
-   * 
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a `NOT_FOUND` error. @@ -954,16 +585,6 @@ public final UnaryCallable setIamPolicyCallable() { * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = connectionServiceClient.testIamPermissions(resource, permissions);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with @@ -981,7 +602,7 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a `NOT_FOUND` error. @@ -990,16 +611,6 @@ public final TestIamPermissionsResponse testIamPermissions( * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = connectionServiceClient.testIamPermissions(resource.toString(), permissions);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with @@ -1017,7 +628,7 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a `NOT_FOUND` error. @@ -1026,20 +637,6 @@ public final TestIamPermissionsResponse testIamPermissions( * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * - *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   TestIamPermissionsResponse response = connectionServiceClient.testIamPermissions(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 */ @@ -1047,7 +644,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq return testIamPermissionsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a `NOT_FOUND` error. @@ -1057,20 +654,6 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * warning. * *

Sample code: - * - *


-   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
-   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   ApiFuture<TestIamPermissionsResponse> future = connectionServiceClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something
-   *   TestIamPermissionsResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable testIamPermissionsCallable() { diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceSettings.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceSettings.java index 5938f308..0be664d4 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceSettings.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1; import static com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient.ListConnectionsPagedResponse; @@ -46,7 +47,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link ConnectionServiceClient}. * @@ -64,23 +65,24 @@ * *

For example, to set the total timeout of createConnection to 30 seconds: * - *

- * 
+ * 
{@code
  * ConnectionServiceSettings.Builder connectionServiceSettingsBuilder =
  *     ConnectionServiceSettings.newBuilder();
  * connectionServiceSettingsBuilder
  *     .createConnectionSettings()
  *     .setRetrySettings(
- *         connectionServiceSettingsBuilder.createConnectionSettings().getRetrySettings().toBuilder()
+ *         connectionServiceSettingsBuilder
+ *             .createConnectionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * ConnectionServiceSettings connectionServiceSettings = connectionServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class ConnectionServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createConnection. */ public UnaryCallSettings createConnectionSettings() { return ((ConnectionServiceStubSettings) getStubSettings()).createConnectionSettings(); @@ -184,18 +186,15 @@ protected ConnectionServiceSettings(Builder settingsBuilder) throws IOException /** Builder for ConnectionServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(ConnectionServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(ConnectionServiceStubSettings.newBuilder()); - } - protected Builder(ConnectionServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -204,11 +203,15 @@ protected Builder(ConnectionServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(ConnectionServiceStubSettings.newBuilder()); + } + public ConnectionServiceStubSettings.Builder getStubSettingsBuilder() { return ((ConnectionServiceStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/package-info.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/package-info.java index 254d8027..88eb7a92 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/package-info.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/package-info.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,28 +15,15 @@ */ /** - * A client to BigQuery Connection API. - * - *

The interfaces provided are listed below, along with usage samples. + * The interfaces provided are listed below, along with usage samples. * *

======================= ConnectionServiceClient ======================= * *

Service Description: Manages external data source connections and credentials. * *

Sample for ConnectionServiceClient: - * - *

- * 
- * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
- *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- *   Connection connection = Connection.newBuilder().build();
- *   String connectionId = "";
- *   Connection response = connectionServiceClient.createConnection(parent, connection, connectionId);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.bigqueryconnection.v1; import javax.annotation.Generated; diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/ConnectionServiceStub.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/ConnectionServiceStub.java index 94190eff..8c658d6a 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/ConnectionServiceStub.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/ConnectionServiceStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1.stub; import static com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient.ListConnectionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.bigquery.connection.v1.Connection; @@ -35,14 +35,13 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for BigQuery Connection API. + * Base stub class for the ConnectionService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class ConnectionServiceStub implements BackgroundResource { public UnaryCallable createConnectionCallable() { diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/ConnectionServiceStubSettings.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/ConnectionServiceStubSettings.java index ae95d91b..dd18c934 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/ConnectionServiceStubSettings.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/ConnectionServiceStubSettings.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1.stub; import static com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient.ListConnectionsPagedResponse; @@ -61,7 +62,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link ConnectionServiceStub}. * @@ -79,22 +80,24 @@ * *

For example, to set the total timeout of createConnection to 30 seconds: * - *

- * 
+ * 
{@code
  * ConnectionServiceStubSettings.Builder connectionServiceSettingsBuilder =
  *     ConnectionServiceStubSettings.newBuilder();
  * connectionServiceSettingsBuilder
  *     .createConnectionSettings()
  *     .setRetrySettings(
- *         connectionServiceSettingsBuilder.createConnectionSettings().getRetrySettings().toBuilder()
+ *         connectionServiceSettingsBuilder
+ *             .createConnectionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * ConnectionServiceStubSettings connectionServiceSettings = connectionServiceSettingsBuilder.build();
- * 
- * 
+ * ConnectionServiceStubSettings connectionServiceSettings = + * connectionServiceSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class ConnectionServiceStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -115,6 +118,62 @@ public class ConnectionServiceStubSettings extends StubSettings testIamPermissionsSettings; + private static final PagedListDescriptor< + ListConnectionsRequest, ListConnectionsResponse, Connection> + LIST_CONNECTIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListConnectionsRequest injectToken( + ListConnectionsRequest payload, String token) { + return ListConnectionsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListConnectionsRequest injectPageSize( + ListConnectionsRequest payload, int pageSize) { + return ListConnectionsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListConnectionsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListConnectionsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListConnectionsResponse payload) { + return payload.getConnectionsList() == null + ? ImmutableList.of() + : payload.getConnectionsList(); + } + }; + + private static final PagedListResponseFactory< + ListConnectionsRequest, ListConnectionsResponse, ListConnectionsPagedResponse> + LIST_CONNECTIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListConnectionsRequest, ListConnectionsResponse, ListConnectionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListConnectionsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_CONNECTIONS_PAGE_STR_DESC, request, context); + return ListConnectionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createConnection. */ public UnaryCallSettings createConnectionSettings() { return createConnectionSettings; @@ -164,10 +223,10 @@ public ConnectionServiceStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcConnectionServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -237,66 +296,9 @@ protected ConnectionServiceStubSettings(Builder settingsBuilder) throws IOExcept testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); } - private static final PagedListDescriptor< - ListConnectionsRequest, ListConnectionsResponse, Connection> - LIST_CONNECTIONS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListConnectionsRequest injectToken( - ListConnectionsRequest payload, String token) { - return ListConnectionsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListConnectionsRequest injectPageSize( - ListConnectionsRequest payload, int pageSize) { - return ListConnectionsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListConnectionsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListConnectionsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListConnectionsResponse payload) { - return payload.getConnectionsList() != null - ? payload.getConnectionsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListConnectionsRequest, ListConnectionsResponse, ListConnectionsPagedResponse> - LIST_CONNECTIONS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListConnectionsRequest, ListConnectionsResponse, ListConnectionsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListConnectionsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_CONNECTIONS_PAGE_STR_DESC, request, context); - return ListConnectionsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for ConnectionServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createConnectionSettings; private final UnaryCallSettings.Builder getConnectionSettings; @@ -311,21 +313,19 @@ public static class Builder extends StubSettings.Builder setIamPolicySettings; private final UnaryCallSettings.Builder testIamPermissionsSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder> definitions = ImmutableMap.builder(); + definitions.put( + "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( "retry_policy_1_codes", ImmutableSet.copyOf( Lists.newArrayList( StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -336,49 +336,40 @@ public static class Builder extends StubSettings.Builder>of( + createConnectionSettings, + getConnectionSettings, + listConnectionsSettings, + updateConnectionSettings, + deleteConnectionSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createConnectionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .getConnectionSettings() @@ -423,8 +438,8 @@ private static Builder initDefaults(Builder builder) { builder .updateConnectionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .deleteConnectionSettings() @@ -433,47 +448,23 @@ private static Builder initDefaults(Builder builder) { builder .getIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .setIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .testIamPermissionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); return builder; } - protected Builder(ConnectionServiceStubSettings settings) { - super(settings); - - createConnectionSettings = settings.createConnectionSettings.toBuilder(); - getConnectionSettings = settings.getConnectionSettings.toBuilder(); - listConnectionsSettings = settings.listConnectionsSettings.toBuilder(); - updateConnectionSettings = settings.updateConnectionSettings.toBuilder(); - deleteConnectionSettings = settings.deleteConnectionSettings.toBuilder(); - getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); - setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); - testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createConnectionSettings, - getConnectionSettings, - listConnectionsSettings, - updateConnectionSettings, - deleteConnectionSettings, - getIamPolicySettings, - setIamPolicySettings, - testIamPermissionsSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/GrpcConnectionServiceCallableFactory.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/GrpcConnectionServiceCallableFactory.java index 361af2a7..64263c7b 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/GrpcConnectionServiceCallableFactory.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/GrpcConnectionServiceCallableFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ 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 +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for BigQuery Connection API. + * gRPC callable factory implementation for the ConnectionService service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcConnectionServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/GrpcConnectionServiceStub.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/GrpcConnectionServiceStub.java index f29e9d55..5f57ad1f 100644 --- a/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/GrpcConnectionServiceStub.java +++ b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/stub/GrpcConnectionServiceStub.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1.stub; import static com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient.ListConnectionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -38,6 +38,7 @@ import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -46,16 +47,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for BigQuery Connection API. + * gRPC stub implementation for the ConnectionService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcConnectionServiceStub extends ConnectionServiceStub { - private static final MethodDescriptor createConnectionMethodDescriptor = MethodDescriptor.newBuilder() @@ -66,6 +65,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { ProtoUtils.marshaller(CreateConnectionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Connection.getDefaultInstance())) .build(); + private static final MethodDescriptor getConnectionMethodDescriptor = MethodDescriptor.newBuilder() @@ -76,6 +76,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { ProtoUtils.marshaller(GetConnectionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Connection.getDefaultInstance())) .build(); + private static final MethodDescriptor listConnectionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -87,6 +88,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListConnectionsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor updateConnectionMethodDescriptor = MethodDescriptor.newBuilder() @@ -97,6 +99,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { ProtoUtils.marshaller(UpdateConnectionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Connection.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteConnectionMethodDescriptor = MethodDescriptor.newBuilder() @@ -107,6 +110,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { ProtoUtils.marshaller(DeleteConnectionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -114,6 +118,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); + private static final MethodDescriptor setIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -121,6 +126,7 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); + private static final MethodDescriptor testIamPermissionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -133,8 +139,6 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable createConnectionCallable; private final UnaryCallable getConnectionCallable; private final UnaryCallable @@ -148,6 +152,8 @@ public class GrpcConnectionServiceStub extends ConnectionServiceStub { private final UnaryCallable testIamPermissionsCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcConnectionServiceStub create(ConnectionServiceStubSettings settings) @@ -188,6 +194,7 @@ protected GrpcConnectionServiceStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings createConnectionTransportSettings = GrpcCallSettings.newBuilder() @@ -326,7 +333,12 @@ public Map extract(TestIamPermissionsRequest request) { settings.testIamPermissionsSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable createConnectionCallable() { @@ -337,15 +349,15 @@ public UnaryCallable getConnectionCallable() { return getConnectionCallable; } + public UnaryCallable listConnectionsCallable() { + return listConnectionsCallable; + } + public UnaryCallable listConnectionsPagedCallable() { return listConnectionsPagedCallable; } - public UnaryCallable listConnectionsCallable() { - return listConnectionsCallable; - } - public UnaryCallable updateConnectionCallable() { return updateConnectionCallable; } diff --git a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceClientTest.java b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceClientTest.java index 6aa6a630..b5c0b20c 100644 --- a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceClientTest.java +++ b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionServiceClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1; import com.google.api.gax.core.NoCredentialsProvider; @@ -23,15 +24,7 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.resourcenames.ResourceName; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.Connection; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ConnectionCredential; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.CreateConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.DeleteConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.GetConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsResponse; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionCredentialRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionRequest; +import com.google.iam.v1.Binding; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.GetPolicyOptions; import com.google.iam.v1.Policy; @@ -43,14 +36,13 @@ import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.UInt32Value; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Objects; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -58,31 +50,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class ConnectionServiceClientTest { - private static MockConnectionService mockConnectionService; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private ConnectionServiceClient client; + private static MockConnectionService mockConnectionService; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockConnectionService = new MockConnectionService(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockConnectionService)); - serviceHelper.start(); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); ConnectionServiceSettings settings = ConnectionServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -97,37 +89,24 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createConnectionTest() { - ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - String friendlyName = "friendlyName1451097503"; - String description = "description-1724546052"; - long creationTime = 1932333101L; - long lastModifiedTime = 671513446L; - boolean hasCredential = true; - Connection expectedResponse = - Connection.newBuilder() - .setName(name.toString()) - .setFriendlyName(friendlyName) - .setDescription(description) - .setCreationTime(creationTime) - .setLastModifiedTime(lastModifiedTime) - .setHasCredential(hasCredential) - .build(); + public void createConnectionTest() throws Exception { + ConnectionProto.Connection expectedResponse = ConnectionProto.Connection.newBuilder().build(); mockConnectionService.addResponse(expectedResponse); LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - Connection connection = Connection.newBuilder().build(); - String connectionId = "connectionId-513204708"; + ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build(); + String connectionId = "connectionId1923106969"; - Connection actualResponse = client.createConnection(parent, connection, connectionId); + ConnectionProto.Connection actualResponse = + client.createConnection(parent, connection, connectionId); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateConnectionRequest actualRequest = (CreateConnectionRequest) actualRequests.get(0); + ConnectionProto.CreateConnectionRequest actualRequest = + ((ConnectionProto.CreateConnectionRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(connection, actualRequest.getConnection()); Assert.assertEquals(connectionId, actualRequest.getConnectionId()); Assert.assertTrue( @@ -137,53 +116,80 @@ public void createConnectionTest() { } @Test - @SuppressWarnings("all") public void createConnectionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - Connection connection = Connection.newBuilder().build(); - String connectionId = "connectionId-513204708"; + ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build(); + String connectionId = "connectionId1923106969"; + client.createConnection(parent, connection, connectionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createConnectionTest2() throws Exception { + ConnectionProto.Connection expectedResponse = ConnectionProto.Connection.newBuilder().build(); + mockConnectionService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build(); + String connectionId = "connectionId1923106969"; + + ConnectionProto.Connection actualResponse = + client.createConnection(parent, connection, connectionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ConnectionProto.CreateConnectionRequest actualRequest = + ((ConnectionProto.CreateConnectionRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(connection, actualRequest.getConnection()); + Assert.assertEquals(connectionId, actualRequest.getConnectionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createConnectionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + try { + String parent = "parent-995424086"; + ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build(); + String connectionId = "connectionId1923106969"; client.createConnection(parent, connection, connectionId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getConnectionTest() { - ConnectionName name2 = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - String friendlyName = "friendlyName1451097503"; - String description = "description-1724546052"; - long creationTime = 1932333101L; - long lastModifiedTime = 671513446L; - boolean hasCredential = true; - Connection expectedResponse = - Connection.newBuilder() - .setName(name2.toString()) - .setFriendlyName(friendlyName) - .setDescription(description) - .setCreationTime(creationTime) - .setLastModifiedTime(lastModifiedTime) - .setHasCredential(hasCredential) - .build(); + public void getConnectionTest() throws Exception { + ConnectionProto.Connection expectedResponse = ConnectionProto.Connection.newBuilder().build(); mockConnectionService.addResponse(expectedResponse); ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - Connection actualResponse = client.getConnection(name); + ConnectionProto.Connection actualResponse = client.getConnection(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetConnectionRequest actualRequest = (GetConnectionRequest) actualRequests.get(0); + ConnectionProto.GetConnectionRequest actualRequest = + ((ConnectionProto.GetConnectionRequest) actualRequests.get(0)); - Assert.assertEquals(name, ConnectionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -191,40 +197,74 @@ public void getConnectionTest() { } @Test - @SuppressWarnings("all") public void getConnectionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); + client.getConnection(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getConnectionTest2() throws Exception { + ConnectionProto.Connection expectedResponse = ConnectionProto.Connection.newBuilder().build(); + mockConnectionService.addResponse(expectedResponse); + + String name = "name3373707"; + + ConnectionProto.Connection actualResponse = client.getConnection(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ConnectionProto.GetConnectionRequest actualRequest = + ((ConnectionProto.GetConnectionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getConnectionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String name = "name3373707"; client.getConnection(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listConnectionsTest() { - String nextPageToken = "nextPageToken-1530815211"; - ListConnectionsResponse expectedResponse = - ListConnectionsResponse.newBuilder().setNextPageToken(nextPageToken).build(); + public void listConnectionsTest() throws Exception { + ConnectionProto.ListConnectionsResponse expectedResponse = + ConnectionProto.ListConnectionsResponse.newBuilder().build(); mockConnectionService.addResponse(expectedResponse); LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); UInt32Value maxResults = UInt32Value.newBuilder().build(); - ListConnectionsResponse actualResponse = client.listConnections(parent, maxResults); + ConnectionProto.ListConnectionsResponse actualResponse = + client.listConnections(parent, maxResults); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListConnectionsRequest actualRequest = (ListConnectionsRequest) actualRequests.get(0); + ConnectionProto.ListConnectionsRequest actualRequest = + ((ConnectionProto.ListConnectionsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(maxResults, actualRequest.getMaxResults()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -233,54 +273,80 @@ public void listConnectionsTest() { } @Test - @SuppressWarnings("all") public void listConnectionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); UInt32Value maxResults = UInt32Value.newBuilder().build(); + client.listConnections(parent, maxResults); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listConnectionsTest2() throws Exception { + ConnectionProto.ListConnectionsResponse expectedResponse = + ConnectionProto.ListConnectionsResponse.newBuilder().build(); + mockConnectionService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + UInt32Value maxResults = UInt32Value.newBuilder().build(); + + ConnectionProto.ListConnectionsResponse actualResponse = + client.listConnections(parent, maxResults); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ConnectionProto.ListConnectionsRequest actualRequest = + ((ConnectionProto.ListConnectionsRequest) actualRequests.get(0)); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(maxResults, actualRequest.getMaxResults()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listConnectionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String parent = "parent-995424086"; + UInt32Value maxResults = UInt32Value.newBuilder().build(); client.listConnections(parent, maxResults); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateConnectionTest() { - ConnectionName name2 = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - String friendlyName = "friendlyName1451097503"; - String description = "description-1724546052"; - long creationTime = 1932333101L; - long lastModifiedTime = 671513446L; - boolean hasCredential = true; - Connection expectedResponse = - Connection.newBuilder() - .setName(name2.toString()) - .setFriendlyName(friendlyName) - .setDescription(description) - .setCreationTime(creationTime) - .setLastModifiedTime(lastModifiedTime) - .setHasCredential(hasCredential) - .build(); + public void updateConnectionTest() throws Exception { + ConnectionProto.Connection expectedResponse = ConnectionProto.Connection.newBuilder().build(); mockConnectionService.addResponse(expectedResponse); ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - Connection connection = Connection.newBuilder().build(); + ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - Connection actualResponse = client.updateConnection(name, connection, updateMask); + ConnectionProto.Connection actualResponse = + client.updateConnection(name, connection, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateConnectionRequest actualRequest = (UpdateConnectionRequest) actualRequests.get(0); + ConnectionProto.UpdateConnectionRequest actualRequest = + ((ConnectionProto.UpdateConnectionRequest) actualRequests.get(0)); - Assert.assertEquals(name, ConnectionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertEquals(connection, actualRequest.getConnection()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( @@ -290,38 +356,79 @@ public void updateConnectionTest() { } @Test - @SuppressWarnings("all") public void updateConnectionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - Connection connection = Connection.newBuilder().build(); + ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateConnection(name, connection, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateConnectionTest2() throws Exception { + ConnectionProto.Connection expectedResponse = ConnectionProto.Connection.newBuilder().build(); + mockConnectionService.addResponse(expectedResponse); + String name = "name3373707"; + ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + ConnectionProto.Connection actualResponse = + client.updateConnection(name, connection, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ConnectionProto.UpdateConnectionRequest actualRequest = + ((ConnectionProto.UpdateConnectionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(connection, actualRequest.getConnection()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateConnectionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String name = "name3373707"; + ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); client.updateConnection(name, connection, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateConnectionCredentialTest() { + public void updateConnectionCredentialTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockConnectionService.addResponse(expectedResponse); String name = "name3373707"; - ConnectionCredential credential = ConnectionCredential.newBuilder().build(); + ConnectionProto.ConnectionCredential credential = + ConnectionProto.ConnectionCredential.newBuilder().build(); client.updateConnectionCredential(name, credential); List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateConnectionCredentialRequest actualRequest = - (UpdateConnectionCredentialRequest) actualRequests.get(0); + ConnectionProto.UpdateConnectionCredentialRequest actualRequest = + ((ConnectionProto.UpdateConnectionCredentialRequest) actualRequests.get(0)); Assert.assertEquals(name, actualRequest.getName()); Assert.assertEquals(credential, actualRequest.getCredential()); @@ -332,25 +439,23 @@ public void updateConnectionCredentialTest() { } @Test - @SuppressWarnings("all") public void updateConnectionCredentialExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { String name = "name3373707"; - ConnectionCredential credential = ConnectionCredential.newBuilder().build(); - + ConnectionProto.ConnectionCredential credential = + ConnectionProto.ConnectionCredential.newBuilder().build(); client.updateConnectionCredential(name, credential); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteConnectionTest() { + public void deleteConnectionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockConnectionService.addResponse(expectedResponse); @@ -360,9 +465,10 @@ public void deleteConnectionTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteConnectionRequest actualRequest = (DeleteConnectionRequest) actualRequests.get(0); + ConnectionProto.DeleteConnectionRequest actualRequest = + ((ConnectionProto.DeleteConnectionRequest) actualRequests.get(0)); - Assert.assertEquals(name, ConnectionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -370,27 +476,62 @@ public void deleteConnectionTest() { } @Test - @SuppressWarnings("all") public void deleteConnectionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); + client.deleteConnection(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteConnectionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockConnectionService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteConnection(name); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ConnectionProto.DeleteConnectionRequest actualRequest = + ((ConnectionProto.DeleteConnectionRequest) actualRequests.get(0)); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteConnectionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String name = "name3373707"; client.deleteConnection(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockConnectionService.addResponse(expectedResponse); ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); @@ -401,9 +542,9 @@ public void getIamPolicyTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(options, actualRequest.getOptions()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -412,28 +553,71 @@ public void getIamPolicyTest() { } @Test - @SuppressWarnings("all") public void getIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); GetPolicyOptions options = GetPolicyOptions.newBuilder().build(); + client.getIamPolicy(resource, options); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockConnectionService.addResponse(expectedResponse); + + String resource = "resource-341064690"; + GetPolicyOptions options = GetPolicyOptions.newBuilder().build(); + + Policy actualResponse = client.getIamPolicy(resource, options); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(options, actualRequest.getOptions()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String resource = "resource-341064690"; + GetPolicyOptions options = GetPolicyOptions.newBuilder().build(); client.getIamPolicy(resource, options); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void setIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockConnectionService.addResponse(expectedResponse); ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); @@ -444,9 +628,9 @@ public void setIamPolicyTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(policy, actualRequest.getPolicy()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -455,26 +639,67 @@ public void setIamPolicyTest() { } @Test - @SuppressWarnings("all") public void setIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); Policy policy = Policy.newBuilder().build(); + client.setIamPolicy(resource, policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockConnectionService.addResponse(expectedResponse); + + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); + + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); client.setIamPolicy(resource, policy); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void testIamPermissionsTest() { - TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockConnectionService.addResponse(expectedResponse); ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); @@ -485,9 +710,9 @@ public void testIamPermissionsTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(permissions, actualRequest.getPermissionsList()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -496,19 +721,56 @@ public void testIamPermissionsTest() { } @Test - @SuppressWarnings("all") public void testIamPermissionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); List permissions = new ArrayList<>(); + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void testIamPermissionsTest2() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockConnectionService.addResponse(expectedResponse); + + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); client.testIamPermissions(resource, permissions); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/MockConnectionService.java b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/MockConnectionService.java index 3761e27b..549336c7 100644 --- a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/MockConnectionService.java +++ b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/MockConnectionService.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockConnectionService implements MockGrpcService { private final MockConnectionServiceImpl serviceImpl; diff --git a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/MockConnectionServiceImpl.java b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/MockConnectionServiceImpl.java index 939a46a0..e16ea536 100644 --- a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/MockConnectionServiceImpl.java +++ b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigquery/connection/v1beta1/MockConnectionServiceImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,17 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigquery.connection.v1beta1; import com.google.api.core.BetaApi; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.Connection; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.CreateConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.DeleteConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.GetConnectionRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.ListConnectionsResponse; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionCredentialRequest; -import com.google.cloud.bigquery.connection.v1beta1.ConnectionProto.UpdateConnectionRequest; import com.google.cloud.bigquery.connection.v1beta1.ConnectionServiceGrpc.ConnectionServiceImplBase; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; @@ -37,9 +30,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockConnectionServiceImpl extends ConnectionServiceImplBase { private List requests; private Queue responses; @@ -72,14 +66,15 @@ public void reset() { @Override public void createConnection( - CreateConnectionRequest request, StreamObserver responseObserver) { + ConnectionProto.CreateConnectionRequest request, + StreamObserver responseObserver) { Object response = responses.remove(); - if (response instanceof Connection) { + if (response instanceof ConnectionProto.Connection) { requests.add(request); - responseObserver.onNext((Connection) response); + responseObserver.onNext(((ConnectionProto.Connection) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -87,14 +82,15 @@ public void createConnection( @Override public void getConnection( - GetConnectionRequest request, StreamObserver responseObserver) { + ConnectionProto.GetConnectionRequest request, + StreamObserver responseObserver) { Object response = responses.remove(); - if (response instanceof Connection) { + if (response instanceof ConnectionProto.Connection) { requests.add(request); - responseObserver.onNext((Connection) response); + responseObserver.onNext(((ConnectionProto.Connection) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -102,14 +98,15 @@ public void getConnection( @Override public void listConnections( - ListConnectionsRequest request, StreamObserver responseObserver) { + ConnectionProto.ListConnectionsRequest request, + StreamObserver responseObserver) { Object response = responses.remove(); - if (response instanceof ListConnectionsResponse) { + if (response instanceof ConnectionProto.ListConnectionsResponse) { requests.add(request); - responseObserver.onNext((ListConnectionsResponse) response); + responseObserver.onNext(((ConnectionProto.ListConnectionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -117,14 +114,15 @@ public void listConnections( @Override public void updateConnection( - UpdateConnectionRequest request, StreamObserver responseObserver) { + ConnectionProto.UpdateConnectionRequest request, + StreamObserver responseObserver) { Object response = responses.remove(); - if (response instanceof Connection) { + if (response instanceof ConnectionProto.Connection) { requests.add(request); - responseObserver.onNext((Connection) response); + responseObserver.onNext(((ConnectionProto.Connection) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -132,14 +130,15 @@ public void updateConnection( @Override public void updateConnectionCredential( - UpdateConnectionCredentialRequest request, StreamObserver responseObserver) { + ConnectionProto.UpdateConnectionCredentialRequest request, + StreamObserver responseObserver) { Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -147,14 +146,14 @@ public void updateConnectionCredential( @Override public void deleteConnection( - DeleteConnectionRequest request, StreamObserver responseObserver) { + ConnectionProto.DeleteConnectionRequest request, StreamObserver responseObserver) { Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -165,10 +164,10 @@ public void getIamPolicy(GetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -179,10 +178,10 @@ public void setIamPolicy(SetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -195,10 +194,10 @@ public void testIamPermissions( Object response = responses.remove(); if (response instanceof TestIamPermissionsResponse) { requests.add(request); - responseObserver.onNext((TestIamPermissionsResponse) response); + responseObserver.onNext(((TestIamPermissionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceClientTest.java b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceClientTest.java index 13cc5198..c53c12e8 100644 --- a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceClientTest.java +++ b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/ConnectionServiceClientTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1; import static com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient.ListConnectionsPagedResponse; @@ -35,6 +36,7 @@ import com.google.cloud.bigquery.connection.v1.LocationName; import com.google.cloud.bigquery.connection.v1.UpdateConnectionRequest; import com.google.common.collect.Lists; +import com.google.iam.v1.Binding; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.GetPolicyOptions; import com.google.iam.v1.Policy; @@ -45,14 +47,13 @@ import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Objects; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -60,31 +61,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class ConnectionServiceClientTest { - private static MockConnectionService mockConnectionService; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private ConnectionServiceClient client; + private static MockConnectionService mockConnectionService; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockConnectionService = new MockConnectionService(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockConnectionService)); - serviceHelper.start(); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); ConnectionServiceSettings settings = ConnectionServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -99,37 +100,30 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createConnectionTest() { - ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - String friendlyName = "friendlyName1451097503"; - String description = "description-1724546052"; - long creationTime = 1932333101L; - long lastModifiedTime = 671513446L; - boolean hasCredential = true; + public void createConnectionTest() throws Exception { Connection expectedResponse = Connection.newBuilder() - .setName(name.toString()) - .setFriendlyName(friendlyName) - .setDescription(description) - .setCreationTime(creationTime) - .setLastModifiedTime(lastModifiedTime) - .setHasCredential(hasCredential) + .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()) + .setFriendlyName("friendlyName461933014") + .setDescription("description-1724546052") + .setCreationTime(1932333101) + .setLastModifiedTime(-671513446) + .setHasCredential(true) .build(); mockConnectionService.addResponse(expectedResponse); LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Connection connection = Connection.newBuilder().build(); - String connectionId = "connectionId-513204708"; + String connectionId = "connectionId1923106969"; Connection actualResponse = client.createConnection(parent, connection, connectionId); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateConnectionRequest actualRequest = (CreateConnectionRequest) actualRequests.get(0); + CreateConnectionRequest actualRequest = ((CreateConnectionRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(connection, actualRequest.getConnection()); Assert.assertEquals(connectionId, actualRequest.getConnectionId()); Assert.assertTrue( @@ -139,40 +133,80 @@ public void createConnectionTest() { } @Test - @SuppressWarnings("all") public void createConnectionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Connection connection = Connection.newBuilder().build(); - String connectionId = "connectionId-513204708"; + String connectionId = "connectionId1923106969"; + client.createConnection(parent, connection, connectionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createConnectionTest2() throws Exception { + Connection expectedResponse = + Connection.newBuilder() + .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()) + .setFriendlyName("friendlyName461933014") + .setDescription("description-1724546052") + .setCreationTime(1932333101) + .setLastModifiedTime(-671513446) + .setHasCredential(true) + .build(); + mockConnectionService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Connection connection = Connection.newBuilder().build(); + String connectionId = "connectionId1923106969"; + + Connection actualResponse = client.createConnection(parent, connection, connectionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateConnectionRequest actualRequest = ((CreateConnectionRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(connection, actualRequest.getConnection()); + Assert.assertEquals(connectionId, actualRequest.getConnectionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void createConnectionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String parent = "parent-995424086"; + Connection connection = Connection.newBuilder().build(); + String connectionId = "connectionId1923106969"; client.createConnection(parent, connection, connectionId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getConnectionTest() { - ConnectionName name2 = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - String friendlyName = "friendlyName1451097503"; - String description = "description-1724546052"; - long creationTime = 1932333101L; - long lastModifiedTime = 671513446L; - boolean hasCredential = true; + public void getConnectionTest() throws Exception { Connection expectedResponse = Connection.newBuilder() - .setName(name2.toString()) - .setFriendlyName(friendlyName) - .setDescription(description) - .setCreationTime(creationTime) - .setLastModifiedTime(lastModifiedTime) - .setHasCredential(hasCredential) + .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()) + .setFriendlyName("friendlyName461933014") + .setDescription("description-1724546052") + .setCreationTime(1932333101) + .setLastModifiedTime(-671513446) + .setHasCredential(true) .build(); mockConnectionService.addResponse(expectedResponse); @@ -183,9 +217,9 @@ public void getConnectionTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetConnectionRequest actualRequest = (GetConnectionRequest) actualRequests.get(0); + GetConnectionRequest actualRequest = ((GetConnectionRequest) actualRequests.get(0)); - Assert.assertEquals(name, ConnectionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -193,31 +227,69 @@ public void getConnectionTest() { } @Test - @SuppressWarnings("all") public void getConnectionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); + client.getConnection(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConnectionTest2() throws Exception { + Connection expectedResponse = + Connection.newBuilder() + .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()) + .setFriendlyName("friendlyName461933014") + .setDescription("description-1724546052") + .setCreationTime(1932333101) + .setLastModifiedTime(-671513446) + .setHasCredential(true) + .build(); + mockConnectionService.addResponse(expectedResponse); + + String name = "name3373707"; + + Connection actualResponse = client.getConnection(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetConnectionRequest actualRequest = ((GetConnectionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getConnectionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + try { + String name = "name3373707"; client.getConnection(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listConnectionsTest() { - String nextPageToken = ""; - Connection connectionsElement = Connection.newBuilder().build(); - List connections = Arrays.asList(connectionsElement); + public void listConnectionsTest() throws Exception { + Connection responsesElement = Connection.newBuilder().build(); ListConnectionsResponse expectedResponse = ListConnectionsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllConnections(connections) + .setNextPageToken("") + .addAllConnections(Arrays.asList(responsesElement)) .build(); mockConnectionService.addResponse(expectedResponse); @@ -226,14 +298,15 @@ public void listConnectionsTest() { ListConnectionsPagedResponse pagedListResponse = client.listConnections(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getConnectionsList().get(0), resources.get(0)); List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListConnectionsRequest actualRequest = (ListConnectionsRequest) actualRequests.get(0); + ListConnectionsRequest actualRequest = ((ListConnectionsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -241,38 +314,73 @@ public void listConnectionsTest() { } @Test - @SuppressWarnings("all") public void listConnectionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listConnections(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listConnectionsTest2() throws Exception { + Connection responsesElement = Connection.newBuilder().build(); + ListConnectionsResponse expectedResponse = + ListConnectionsResponse.newBuilder() + .setNextPageToken("") + .addAllConnections(Arrays.asList(responsesElement)) + .build(); + mockConnectionService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + ListConnectionsPagedResponse pagedListResponse = client.listConnections(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConnectionsList().get(0), resources.get(0)); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListConnectionsRequest actualRequest = ((ListConnectionsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listConnectionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String parent = "parent-995424086"; client.listConnections(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateConnectionTest() { - ConnectionName name2 = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); - String friendlyName = "friendlyName1451097503"; - String description = "description-1724546052"; - long creationTime = 1932333101L; - long lastModifiedTime = 671513446L; - boolean hasCredential = true; + public void updateConnectionTest() throws Exception { Connection expectedResponse = Connection.newBuilder() - .setName(name2.toString()) - .setFriendlyName(friendlyName) - .setDescription(description) - .setCreationTime(creationTime) - .setLastModifiedTime(lastModifiedTime) - .setHasCredential(hasCredential) + .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()) + .setFriendlyName("friendlyName461933014") + .setDescription("description-1724546052") + .setCreationTime(1932333101) + .setLastModifiedTime(-671513446) + .setHasCredential(true) .build(); mockConnectionService.addResponse(expectedResponse); @@ -285,9 +393,9 @@ public void updateConnectionTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateConnectionRequest actualRequest = (UpdateConnectionRequest) actualRequests.get(0); + UpdateConnectionRequest actualRequest = ((UpdateConnectionRequest) actualRequests.get(0)); - Assert.assertEquals(name, ConnectionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertEquals(connection, actualRequest.getConnection()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( @@ -297,26 +405,72 @@ public void updateConnectionTest() { } @Test - @SuppressWarnings("all") public void updateConnectionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); Connection connection = Connection.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateConnection(name, connection, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateConnectionTest2() throws Exception { + Connection expectedResponse = + Connection.newBuilder() + .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()) + .setFriendlyName("friendlyName461933014") + .setDescription("description-1724546052") + .setCreationTime(1932333101) + .setLastModifiedTime(-671513446) + .setHasCredential(true) + .build(); + mockConnectionService.addResponse(expectedResponse); + + String name = "name3373707"; + Connection connection = Connection.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Connection actualResponse = client.updateConnection(name, connection, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateConnectionRequest actualRequest = ((UpdateConnectionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(connection, actualRequest.getConnection()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateConnectionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + try { + String name = "name3373707"; + Connection connection = Connection.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); client.updateConnection(name, connection, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteConnectionTest() { + public void deleteConnectionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockConnectionService.addResponse(expectedResponse); @@ -326,9 +480,9 @@ public void deleteConnectionTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteConnectionRequest actualRequest = (DeleteConnectionRequest) actualRequests.get(0); + DeleteConnectionRequest actualRequest = ((DeleteConnectionRequest) actualRequests.get(0)); - Assert.assertEquals(name, ConnectionName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -336,27 +490,61 @@ public void deleteConnectionTest() { } @Test - @SuppressWarnings("all") public void deleteConnectionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); + client.deleteConnection(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void deleteConnectionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockConnectionService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteConnection(name); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteConnectionRequest actualRequest = ((DeleteConnectionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteConnectionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String name = "name3373707"; client.deleteConnection(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockConnectionService.addResponse(expectedResponse); ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); @@ -367,9 +555,9 @@ public void getIamPolicyTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(options, actualRequest.getOptions()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -378,28 +566,71 @@ public void getIamPolicyTest() { } @Test - @SuppressWarnings("all") public void getIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); GetPolicyOptions options = GetPolicyOptions.newBuilder().build(); + client.getIamPolicy(resource, options); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockConnectionService.addResponse(expectedResponse); + + String resource = "resource-341064690"; + GetPolicyOptions options = GetPolicyOptions.newBuilder().build(); + + Policy actualResponse = client.getIamPolicy(resource, options); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(options, actualRequest.getOptions()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + try { + String resource = "resource-341064690"; + GetPolicyOptions options = GetPolicyOptions.newBuilder().build(); client.getIamPolicy(resource, options); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void setIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockConnectionService.addResponse(expectedResponse); ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); @@ -410,9 +641,9 @@ public void setIamPolicyTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(policy, actualRequest.getPolicy()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -421,26 +652,67 @@ public void setIamPolicyTest() { } @Test - @SuppressWarnings("all") public void setIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); Policy policy = Policy.newBuilder().build(); + client.setIamPolicy(resource, policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockConnectionService.addResponse(expectedResponse); + + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); + + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + try { + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); client.setIamPolicy(resource, policy); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void testIamPermissionsTest() { - TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockConnectionService.addResponse(expectedResponse); ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); @@ -451,9 +723,9 @@ public void testIamPermissionsTest() { List actualRequests = mockConnectionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(permissions, actualRequest.getPermissionsList()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -462,19 +734,56 @@ public void testIamPermissionsTest() { } @Test - @SuppressWarnings("all") public void testIamPermissionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockConnectionService.addException(exception); try { ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]"); List permissions = new ArrayList<>(); + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest2() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockConnectionService.addResponse(expectedResponse); + + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + List actualRequests = mockConnectionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockConnectionService.addException(exception); + + try { + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); client.testIamPermissions(resource, permissions); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/MockConnectionService.java b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/MockConnectionService.java index 3ef04b3e..57e11455 100644 --- a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/MockConnectionService.java +++ b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/MockConnectionService.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockConnectionService implements MockGrpcService { private final MockConnectionServiceImpl serviceImpl; diff --git a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/MockConnectionServiceImpl.java b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/MockConnectionServiceImpl.java index cc8f421e..fbafb47b 100644 --- a/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/MockConnectionServiceImpl.java +++ b/google-cloud-bigqueryconnection/src/test/java/com/google/cloud/bigqueryconnection/v1/MockConnectionServiceImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigqueryconnection.v1; import com.google.api.core.BetaApi; @@ -36,9 +37,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockConnectionServiceImpl extends ConnectionServiceImplBase { private List requests; private Queue responses; @@ -75,10 +77,10 @@ public void createConnection( Object response = responses.remove(); if (response instanceof Connection) { requests.add(request); - responseObserver.onNext((Connection) response); + responseObserver.onNext(((Connection) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -90,10 +92,10 @@ public void getConnection( Object response = responses.remove(); if (response instanceof Connection) { requests.add(request); - responseObserver.onNext((Connection) response); + responseObserver.onNext(((Connection) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -105,10 +107,10 @@ public void listConnections( Object response = responses.remove(); if (response instanceof ListConnectionsResponse) { requests.add(request); - responseObserver.onNext((ListConnectionsResponse) response); + responseObserver.onNext(((ListConnectionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -120,10 +122,10 @@ public void updateConnection( Object response = responses.remove(); if (response instanceof Connection) { requests.add(request); - responseObserver.onNext((Connection) response); + responseObserver.onNext(((Connection) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -135,10 +137,10 @@ public void deleteConnection( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -149,10 +151,10 @@ public void getIamPolicy(GetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -163,10 +165,10 @@ public void setIamPolicy(SetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -179,10 +181,10 @@ public void testIamPermissions( Object response = responses.remove(); if (response instanceof TestIamPermissionsResponse) { requests.add(request); - responseObserver.onNext((TestIamPermissionsResponse) response); + responseObserver.onNext(((TestIamPermissionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/grpc-google-cloud-bigqueryconnection-v1/pom.xml b/grpc-google-cloud-bigqueryconnection-v1/pom.xml index 76df9d94..8c08c640 100644 --- a/grpc-google-cloud-bigqueryconnection-v1/pom.xml +++ b/grpc-google-cloud-bigqueryconnection-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 - 1.0.4 + 1.0.5 grpc-google-cloud-bigqueryconnection-v1 GRPC library for grpc-google-cloud-bigqueryconnection-v1 com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.4 + 1.0.5 diff --git a/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml b/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml index a4716b9e..71d31d42 100644 --- a/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml +++ b/grpc-google-cloud-bigqueryconnection-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1beta1 - 0.5.4 + 0.5.5 grpc-google-cloud-bigqueryconnection-v1beta1 GRPC library for grpc-google-cloud-bigqueryconnection-v1beta1 com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.4 + 1.0.5 diff --git a/pom.xml b/pom.xml index bf796eda..18521c9c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigqueryconnection-parent pom - 1.0.4 + 1.0.5 Google Cloud BigQuery Connections Parent https://github.com/googleapis/java-bigqueryconnection @@ -63,7 +63,7 @@ UTF-8 github google-cloud-bigqueryconnection-parent - 0.16.0 + 0.16.1 @@ -71,27 +71,27 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.4 + 1.0.5 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 1.0.4 + 1.0.5 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1 - 1.0.4 + 1.0.5 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1beta1 - 0.5.4 + 0.5.5 com.google.api.grpc grpc-google-cloud-bigqueryconnection-v1beta1 - 0.5.4 + 0.5.5 diff --git a/proto-google-cloud-bigqueryconnection-v1/pom.xml b/proto-google-cloud-bigqueryconnection-v1/pom.xml index 2ccde2fe..78cd57a9 100644 --- a/proto-google-cloud-bigqueryconnection-v1/pom.xml +++ b/proto-google-cloud-bigqueryconnection-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1 - 1.0.4 + 1.0.5 proto-google-cloud-bigqueryconnection-v1 PROTO library for proto-google-cloud-bigqueryconnection-v1 com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.4 + 1.0.5 diff --git a/proto-google-cloud-bigqueryconnection-v1/src/main/java/com/google/cloud/bigquery/connection/v1/ConnectionName.java b/proto-google-cloud-bigqueryconnection-v1/src/main/java/com/google/cloud/bigquery/connection/v1/ConnectionName.java index fe8290d4..7d8a1c5d 100644 --- a/proto-google-cloud-bigqueryconnection-v1/src/main/java/com/google/cloud/bigquery/connection/v1/ConnectionName.java +++ b/proto-google-cloud-bigqueryconnection-v1/src/main/java/com/google/cloud/bigquery/connection/v1/ConnectionName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ConnectionName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_CONNECTION = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/connections/{connection}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String connection; + @Deprecated + protected ConnectionName() { + project = null; + location = null; + connection = null; + } + + private ConnectionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + connection = Preconditions.checkNotNull(builder.getConnection()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private ConnectionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - connection = Preconditions.checkNotNull(builder.getConnection()); - } - public static ConnectionName of(String project, String location, String connection) { return newBuilder().setProject(project).setLocation(location).setConnection(connection).build(); } @@ -82,7 +88,7 @@ public static ConnectionName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_CONNECTION.validatedMatch( formattedString, "ConnectionName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("connection")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ConnectionName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_CONNECTION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("connection", connection); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (connection != null) { + fieldMapBuilder.put("connection", connection); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,17 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_CONNECTION.instantiate( "project", project, "location", location, "connection", connection); } - /** Builder for ConnectionName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ConnectionName that = ((ConnectionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.connection, that.connection); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(connection); + return h; + } + + /** Builder for projects/{project}/locations/{location}/connections/{connection}. */ + public static class Builder { private String project; private String location; private String connection; + protected Builder() {} + public String getProject() { return project; } @@ -170,8 +210,6 @@ public Builder setConnection(String connection) { return this; } - private Builder() {} - private Builder(ConnectionName connectionName) { project = connectionName.project; location = connectionName.location; @@ -182,30 +220,4 @@ public ConnectionName build() { return new ConnectionName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ConnectionName) { - ConnectionName that = (ConnectionName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.connection.equals(that.connection)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= connection.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigqueryconnection-v1/src/main/java/com/google/cloud/bigquery/connection/v1/LocationName.java b/proto-google-cloud-bigqueryconnection-v1/src/main/java/com/google/cloud/bigquery/connection/v1/LocationName.java index ed82e452..c37a8169 100644 --- a/proto-google-cloud-bigqueryconnection-v1/src/main/java/com/google/cloud/bigquery/connection/v1/LocationName.java +++ b/proto-google-cloud-bigqueryconnection-v1/src/main/java/com/google/cloud/bigquery/connection/v1/LocationName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class LocationName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private LocationName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - } - public static LocationName of(String project, String location) { return newBuilder().setProject(project).setLocation(location).build(); } @@ -70,7 +75,7 @@ public static LocationName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION.validatedMatch( formattedString, "LocationName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (LocationName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location); + return PROJECT_LOCATION.instantiate("project", project, "location", location); } - /** Builder for LocationName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { private String project; private String location; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setLocation(String location) { return this; } - private Builder() {} - private Builder(LocationName locationName) { project = locationName.project; location = locationName.location; @@ -157,26 +189,4 @@ public LocationName build() { return new LocationName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof LocationName) { - LocationName that = (LocationName) o; - return (this.project.equals(that.project)) && (this.location.equals(that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml b/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml index b1567299..7f862a47 100644 --- a/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml +++ b/proto-google-cloud-bigqueryconnection-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-bigqueryconnection-v1beta1 - 0.5.4 + 0.5.5 proto-google-cloud-bigqueryconnection-v1beta1 PROTO library for proto-google-cloud-bigqueryconnection-v1beta1 com.google.cloud google-cloud-bigqueryconnection-parent - 1.0.4 + 1.0.5 diff --git a/proto-google-cloud-bigqueryconnection-v1beta1/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionName.java b/proto-google-cloud-bigqueryconnection-v1beta1/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionName.java index 2cbfc2f8..d4de08ee 100644 --- a/proto-google-cloud-bigqueryconnection-v1beta1/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionName.java +++ b/proto-google-cloud-bigqueryconnection-v1beta1/src/main/java/com/google/cloud/bigquery/connection/v1beta1/ConnectionName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ConnectionName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION_CONNECTION = PathTemplate.createWithoutUrlEncoding( "projects/{project}/locations/{location}/connections/{connection}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; private final String connection; + @Deprecated + protected ConnectionName() { + project = null; + location = null; + connection = null; + } + + private ConnectionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + connection = Preconditions.checkNotNull(builder.getConnection()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private ConnectionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - connection = Preconditions.checkNotNull(builder.getConnection()); - } - public static ConnectionName of(String project, String location, String connection) { return newBuilder().setProject(project).setLocation(location).setConnection(connection).build(); } @@ -82,7 +88,7 @@ public static ConnectionName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION_CONNECTION.validatedMatch( formattedString, "ConnectionName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("connection")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ConnectionName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION_CONNECTION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); - fieldMapBuilder.put("connection", connection); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (connection != null) { + fieldMapBuilder.put("connection", connection); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,17 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_LOCATION_CONNECTION.instantiate( "project", project, "location", location, "connection", connection); } - /** Builder for ConnectionName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ConnectionName that = ((ConnectionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.connection, that.connection); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(connection); + return h; + } + + /** Builder for projects/{project}/locations/{location}/connections/{connection}. */ + public static class Builder { private String project; private String location; private String connection; + protected Builder() {} + public String getProject() { return project; } @@ -170,8 +210,6 @@ public Builder setConnection(String connection) { return this; } - private Builder() {} - private Builder(ConnectionName connectionName) { project = connectionName.project; location = connectionName.location; @@ -182,30 +220,4 @@ public ConnectionName build() { return new ConnectionName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ConnectionName) { - ConnectionName that = (ConnectionName) o; - return (this.project.equals(that.project)) - && (this.location.equals(that.location)) - && (this.connection.equals(that.connection)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - h *= 1000003; - h ^= connection.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigqueryconnection-v1beta1/src/main/java/com/google/cloud/bigquery/connection/v1beta1/LocationName.java b/proto-google-cloud-bigqueryconnection-v1beta1/src/main/java/com/google/cloud/bigquery/connection/v1beta1/LocationName.java index d400af32..ee6ac950 100644 --- a/proto-google-cloud-bigqueryconnection-v1beta1/src/main/java/com/google/cloud/bigquery/connection/v1beta1/LocationName.java +++ b/proto-google-cloud-bigqueryconnection-v1beta1/src/main/java/com/google/cloud/bigquery/connection/v1beta1/LocationName.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class LocationName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private LocationName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - } - public static LocationName of(String project, String location) { return newBuilder().setProject(project).setLocation(location).build(); } @@ -70,7 +75,7 @@ public static LocationName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION.validatedMatch( formattedString, "LocationName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (LocationName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location); + return PROJECT_LOCATION.instantiate("project", project, "location", location); } - /** Builder for LocationName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { private String project; private String location; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setLocation(String location) { return this; } - private Builder() {} - private Builder(LocationName locationName) { project = locationName.project; location = locationName.location; @@ -157,26 +189,4 @@ public LocationName build() { return new LocationName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof LocationName) { - LocationName that = (LocationName) o; - return (this.project.equals(that.project)) && (this.location.equals(that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - return h; - } } diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 69266f1d..4b18c068 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.3 + 1.0.4 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 649f7832..8db4612a 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.4 + 1.0.5 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 8a831b2f..0b1fdcb5 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -40,7 +40,7 @@ com.google.cloud google-cloud-bigqueryconnection - 1.0.3 + 1.0.4 diff --git a/synth.metadata b/synth.metadata index 7db98ec6..8e0d48b3 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,30 +4,30 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigqueryconnection.git", - "sha": "6175bacd0e4fd770b2ffae4c1c1a4fb26607c424" + "sha": "d8842418071fc1d9b086ce3712e13e6853273195" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8cfc6c874574b649b4524a4ef6a0651533325a84", - "internalRef": "345067549" + "sha": "857f70daef9f4c38f042fb3dfb7b8423ae18fd19", + "internalRef": "346372957" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8cfc6c874574b649b4524a4ef6a0651533325a84", - "internalRef": "345067549" + "sha": "857f70daef9f4c38f042fb3dfb7b8423ae18fd19", + "internalRef": "346372957" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "943bb78606d035001123030067dffcc34f4645f2" + "sha": "5d11bd2888c38ce1fb6fa6bf25494a4219a73928" } } ], diff --git a/versions.txt b/versions.txt index c8350c58..6039134e 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-bigqueryconnection:1.0.4:1.0.4 -proto-google-cloud-bigqueryconnection-v1:1.0.4:1.0.4 -grpc-google-cloud-bigqueryconnection-v1:1.0.4:1.0.4 -proto-google-cloud-bigqueryconnection-v1beta1:0.5.4:0.5.4 -grpc-google-cloud-bigqueryconnection-v1beta1:0.5.4:0.5.4 +google-cloud-bigqueryconnection:1.0.5:1.0.5 +proto-google-cloud-bigqueryconnection-v1:1.0.5:1.0.5 +grpc-google-cloud-bigqueryconnection-v1:1.0.5:1.0.5 +proto-google-cloud-bigqueryconnection-v1beta1:0.5.5:0.5.5 +grpc-google-cloud-bigqueryconnection-v1beta1:0.5.5:0.5.5