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 2eb9440a..169448af 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 @@ -43,6 +43,16 @@ *

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

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

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(). @@ -150,6 +160,18 @@ public ConnectionServiceStub getStub() { /** * Creates a new connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build();
+   *   String connectionId = "connectionId1923106969";
+   *   ConnectionProto.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. @@ -171,6 +193,18 @@ public final ConnectionProto.Connection createConnection( /** * Creates a new connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build();
+   *   String connectionId = "connectionId1923106969";
+   *   ConnectionProto.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. @@ -192,6 +226,19 @@ public final ConnectionProto.Connection createConnection( /** * Creates a new connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.CreateConnectionRequest request =
+   *       ConnectionProto.CreateConnectionRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setConnectionId("connectionId1923106969")
+   *           .build();
+   *   ConnectionProto.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 */ @@ -205,6 +252,20 @@ public final ConnectionProto.Connection createConnection( * Creates a new connection. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.CreateConnectionRequest request =
+   *       ConnectionProto.CreateConnectionRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setConnectionId("connectionId1923106969")
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.createConnectionCallable().futureCall(request);
+   *   // Do something.
+   *   ConnectionProto.Connection response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createConnectionCallable() { @@ -215,6 +276,15 @@ public final ConnectionProto.Connection createConnection( /** * Returns specified connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
+   *   ConnectionProto.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 @@ -231,6 +301,15 @@ public final ConnectionProto.Connection getConnection(ConnectionName name) { /** * Returns specified connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   ConnectionProto.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 @@ -245,6 +324,18 @@ public final ConnectionProto.Connection getConnection(String name) { /** * Returns specified connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.GetConnectionRequest request =
+   *       ConnectionProto.GetConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .build();
+   *   ConnectionProto.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 */ @@ -258,6 +349,19 @@ public final ConnectionProto.Connection getConnection( * Returns specified connection. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.GetConnectionRequest request =
+   *       ConnectionProto.GetConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.getConnectionCallable().futureCall(request);
+   *   // Do something.
+   *   ConnectionProto.Connection response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getConnectionCallable() { @@ -268,6 +372,17 @@ public final ConnectionProto.Connection getConnection( /** * Returns a list of connections in the given project. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   UInt32Value maxResults = UInt32Value.newBuilder().build();
+   *   ConnectionProto.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. @@ -287,6 +402,17 @@ public final ConnectionProto.ListConnectionsResponse listConnections( /** * Returns a list of connections in the given project. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   UInt32Value maxResults = UInt32Value.newBuilder().build();
+   *   ConnectionProto.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. @@ -306,6 +432,21 @@ public final ConnectionProto.ListConnectionsResponse listConnections( /** * Returns a list of connections in the given project. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.ListConnectionsRequest request =
+   *       ConnectionProto.ListConnectionsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setMaxResults(UInt32Value.newBuilder().build())
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ConnectionProto.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 */ @@ -319,6 +460,21 @@ public final ConnectionProto.ListConnectionsResponse listConnections( * Returns a list of connections in the given project. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.ListConnectionsRequest request =
+   *       ConnectionProto.ListConnectionsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setMaxResults(UInt32Value.newBuilder().build())
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.listConnectionsCallable().futureCall(request);
+   *   // Do something.
+   *   ConnectionProto.ListConnectionsResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable< ConnectionProto.ListConnectionsRequest, ConnectionProto.ListConnectionsResponse> @@ -331,6 +487,18 @@ public final ConnectionProto.ListConnectionsResponse listConnections( * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionName name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
+   *   ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   ConnectionProto.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. @@ -353,6 +521,18 @@ public final ConnectionProto.Connection updateConnection( * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   ConnectionProto.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. @@ -375,6 +555,19 @@ public final ConnectionProto.Connection updateConnection( * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.UpdateConnectionRequest request =
+   *       ConnectionProto.UpdateConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ConnectionProto.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 */ @@ -389,6 +582,20 @@ public final ConnectionProto.Connection updateConnection( * properties are in the update field mask. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.UpdateConnectionRequest request =
+   *       ConnectionProto.UpdateConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.updateConnectionCallable().futureCall(request);
+   *   // Do something.
+   *   ConnectionProto.Connection response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateConnectionCallable() { @@ -399,6 +606,17 @@ public final ConnectionProto.Connection updateConnection( /** * Sets the credential for the specified connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String name = "name3373707";
+   *   ConnectionProto.ConnectionCredential credential =
+   *       ConnectionProto.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. @@ -418,6 +636,18 @@ public final void updateConnectionCredential( /** * Sets the credential for the specified connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.UpdateConnectionCredentialRequest request =
+   *       ConnectionProto.UpdateConnectionCredentialRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .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 */ @@ -431,6 +661,19 @@ public final void updateConnectionCredential( * Sets the credential for the specified connection. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.UpdateConnectionCredentialRequest request =
+   *       ConnectionProto.UpdateConnectionCredentialRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.updateConnectionCredentialCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable updateConnectionCredentialCallable() { @@ -441,6 +684,15 @@ public final void updateConnectionCredential( /** * Deletes connection and associated credential. * + *

Sample code: + * + *

{@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 @@ -457,6 +709,15 @@ public final void deleteConnection(ConnectionName name) { /** * Deletes connection and associated credential. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   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 @@ -471,6 +732,18 @@ public final void deleteConnection(String name) { /** * Deletes connection and associated credential. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.DeleteConnectionRequest request =
+   *       ConnectionProto.DeleteConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").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 */ @@ -483,6 +756,19 @@ public final void deleteConnection(ConnectionProto.DeleteConnectionRequest reque * Deletes connection and associated credential. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ConnectionProto.DeleteConnectionRequest request =
+   *       ConnectionProto.DeleteConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.deleteConnectionCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteConnectionCallable() { @@ -494,6 +780,16 @@ public final void deleteConnection(ConnectionProto.DeleteConnectionRequest reque * 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: + * + *

{@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`. @@ -514,6 +810,16 @@ public final Policy getIamPolicy(ResourceName resource, GetPolicyOptions options * 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: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   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`. @@ -531,6 +837,19 @@ public final Policy getIamPolicy(String resource, GetPolicyOptions options) { * 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: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .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 */ @@ -544,6 +863,19 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { * and does not have a policy set. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = connectionServiceClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); @@ -555,6 +887,16 @@ public final UnaryCallable getIamPolicyCallable() { * *

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

Sample code: + * + *

{@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 @@ -577,6 +919,16 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) { * *

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

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   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 @@ -596,6 +948,19 @@ public final Policy setIamPolicy(String resource, Policy policy) { * *

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

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .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 */ @@ -610,6 +975,19 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { *

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

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = connectionServiceClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); @@ -624,6 +1002,17 @@ public final UnaryCallable setIamPolicyCallable() { * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
+   *   List 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 @@ -650,6 +1039,17 @@ public final TestIamPermissionsResponse testIamPermissions( * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   List 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 @@ -676,6 +1076,19 @@ public final TestIamPermissionsResponse testIamPermissions( * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .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 */ @@ -693,6 +1106,20 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * warning. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture 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/package-info.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigquery/connection/v1beta1/package-info.java index d1b53c92..2a693a61 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 @@ -22,6 +22,16 @@ *

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

Sample for ConnectionServiceClient: + * + *

{@code
+ * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ *   ConnectionProto.Connection connection = ConnectionProto.Connection.newBuilder().build();
+ *   String connectionId = "connectionId1923106969";
+ *   ConnectionProto.Connection response =
+ *       connectionServiceClient.createConnection(parent, connection, connectionId);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.bigquery.connection.v1beta1; 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 f2c98c42..10f0361b 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 @@ -59,6 +59,16 @@ *

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

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

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(). @@ -165,6 +175,18 @@ public ConnectionServiceStub getStub() { /** * Creates a new connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Connection connection = Connection.newBuilder().build();
+   *   String connectionId = "connectionId1923106969";
+   *   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. @@ -186,6 +208,18 @@ public final Connection createConnection( /** * Creates a new connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   Connection connection = Connection.newBuilder().build();
+   *   String connectionId = "connectionId1923106969";
+   *   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. @@ -207,6 +241,20 @@ public final Connection createConnection( /** * Creates a new connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   CreateConnectionRequest request =
+   *       CreateConnectionRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setConnectionId("connectionId1923106969")
+   *           .setConnection(Connection.newBuilder().build())
+   *           .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 */ @@ -219,6 +267,21 @@ public final Connection createConnection(CreateConnectionRequest request) { * Creates a new connection. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   CreateConnectionRequest request =
+   *       CreateConnectionRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setConnectionId("connectionId1923106969")
+   *           .setConnection(Connection.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.createConnectionCallable().futureCall(request);
+   *   // Do something.
+   *   Connection response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createConnectionCallable() { return stub.createConnectionCallable(); @@ -228,6 +291,15 @@ public final UnaryCallable createConnection /** * Returns specified connection. * + *

Sample code: + * + *

{@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 @@ -242,6 +314,15 @@ public final Connection getConnection(ConnectionName name) { /** * Returns specified connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   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 @@ -255,6 +336,18 @@ public final Connection getConnection(String name) { /** * Returns specified connection. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   GetConnectionRequest request =
+   *       GetConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").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 */ @@ -267,6 +360,19 @@ public final Connection getConnection(GetConnectionRequest request) { * Returns specified connection. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   GetConnectionRequest request =
+   *       GetConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.getConnectionCallable().futureCall(request);
+   *   // Do something.
+   *   Connection response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getConnectionCallable() { return stub.getConnectionCallable(); @@ -276,6 +382,17 @@ public final UnaryCallable getConnectionCallab /** * Returns a list of connections in the given project. * + *

Sample code: + * + *

{@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 @@ -292,6 +409,17 @@ public final ListConnectionsPagedResponse listConnections(LocationName parent) { /** * Returns a list of connections in the given project. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   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 @@ -305,6 +433,22 @@ public final ListConnectionsPagedResponse listConnections(String parent) { /** * Returns a list of connections in the given project. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ListConnectionsRequest request =
+   *       ListConnectionsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .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 */ @@ -317,6 +461,23 @@ public final ListConnectionsPagedResponse listConnections(ListConnectionsRequest * Returns a list of connections in the given project. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ListConnectionsRequest request =
+   *       ListConnectionsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.listConnectionsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Connection element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listConnectionsPagedCallable() { @@ -328,6 +489,24 @@ public final ListConnectionsPagedResponse listConnections(ListConnectionsRequest * Returns a list of connections in the given project. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   while (true) {
+   *     ListConnectionsResponse response =
+   *         connectionServiceClient.listConnectionsCallable().call(request);
+   *     for (Connection element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listConnectionsCallable() { @@ -339,6 +518,17 @@ public final ListConnectionsPagedResponse listConnections(ListConnectionsRequest * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * + *

Sample code: + * + *

{@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. @@ -361,6 +551,17 @@ public final Connection updateConnection( * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   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. @@ -383,6 +584,20 @@ public final Connection updateConnection( * Updates the specified connection. For security reasons, also resets credential if connection * properties are in the update field mask. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   UpdateConnectionRequest request =
+   *       UpdateConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setConnection(Connection.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .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 */ @@ -396,6 +611,21 @@ public final Connection updateConnection(UpdateConnectionRequest request) { * properties are in the update field mask. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   UpdateConnectionRequest request =
+   *       UpdateConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setConnection(Connection.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.updateConnectionCallable().futureCall(request);
+   *   // Do something.
+   *   Connection response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateConnectionCallable() { return stub.updateConnectionCallable(); @@ -405,6 +635,15 @@ public final UnaryCallable updateConnection /** * Deletes connection and associated credential. * + *

Sample code: + * + *

{@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 @@ -419,6 +658,15 @@ public final void deleteConnection(ConnectionName name) { /** * Deletes connection and associated credential. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String name = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   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 @@ -432,6 +680,18 @@ public final void deleteConnection(String name) { /** * Deletes connection and associated credential. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   DeleteConnectionRequest request =
+   *       DeleteConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").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 */ @@ -444,6 +704,19 @@ public final void deleteConnection(DeleteConnectionRequest request) { * Deletes connection and associated credential. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   DeleteConnectionRequest request =
+   *       DeleteConnectionRequest.newBuilder()
+   *           .setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       connectionServiceClient.deleteConnectionCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteConnectionCallable() { return stub.deleteConnectionCallable(); @@ -454,6 +727,16 @@ public final UnaryCallable deleteConnectionCalla * 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: + * + *

{@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`. @@ -474,6 +757,16 @@ public final Policy getIamPolicy(ResourceName resource, GetPolicyOptions options * 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: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   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`. @@ -491,6 +784,19 @@ public final Policy getIamPolicy(String resource, GetPolicyOptions options) { * 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: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .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 */ @@ -504,6 +810,19 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { * and does not have a policy set. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = connectionServiceClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); @@ -515,6 +834,16 @@ public final UnaryCallable getIamPolicyCallable() { * *

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

Sample code: + * + *

{@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 @@ -537,6 +866,16 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) { * *

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

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   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 @@ -556,6 +895,19 @@ public final Policy setIamPolicy(String resource, Policy policy) { * *

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

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .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 */ @@ -570,6 +922,19 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { *

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

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = connectionServiceClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); @@ -584,6 +949,17 @@ public final UnaryCallable setIamPolicyCallable() { * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   ResourceName resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]");
+   *   List 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 @@ -610,6 +986,17 @@ public final TestIamPermissionsResponse testIamPermissions( * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   String resource = ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString();
+   *   List 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 @@ -636,6 +1023,19 @@ public final TestIamPermissionsResponse testIamPermissions( * command-line tools, not for authorization checking. This operation may "fail open" without * warning. * + *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .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 */ @@ -653,6 +1053,20 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * warning. * *

Sample code: + * + *

{@code
+   * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture 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/package-info.java b/google-cloud-bigqueryconnection/src/main/java/com/google/cloud/bigqueryconnection/v1/package-info.java index 88eb7a92..2909d29f 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 @@ -22,6 +22,16 @@ *

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

Sample for ConnectionServiceClient: + * + *

{@code
+ * try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ *   Connection connection = Connection.newBuilder().build();
+ *   String connectionId = "connectionId1923106969";
+ *   Connection response =
+ *       connectionServiceClient.createConnection(parent, connection, connectionId);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.bigqueryconnection.v1; diff --git a/synth.metadata b/synth.metadata index e718d2e8..73d7466f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,23 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigqueryconnection.git", - "sha": "496c126a4de82c3359c39127d085dd4286446b3f" + "sha": "3ffb3f24a820613e0d8fc7eb102e1035e23ad0bf" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {