diff --git a/java-bigquerydatapolicy/README.md b/java-bigquerydatapolicy/README.md index d9978792b19c..ce6faa212884 100644 --- a/java-bigquerydatapolicy/README.md +++ b/java-bigquerydatapolicy/README.md @@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-bigquerydatapolicy - 0.2.0 + 0.3.0 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigquerydatapolicy:0.2.0' +implementation 'com.google.cloud:google-cloud-bigquerydatapolicy:0.3.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquerydatapolicy" % "0.2.0" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquerydatapolicy" % "0.3.0" ``` ## Authentication @@ -165,16 +165,16 @@ Java is a registered trademark of Oracle and/or its affiliates. [product-docs]: https://cloud.google.com/bigquery/docs/reference/datapolicy/ [javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-bigquerydatapolicy/latest/overview -[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java7.svg -[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java7.html -[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java8.svg -[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java8.html -[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java8-osx.svg -[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java8-osx.html -[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java8-win.svg -[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java8-win.html -[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java11.svg -[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquerydatapolicy/java11.html +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html [stability-image]: https://img.shields.io/badge/stability-preview-yellow [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquerydatapolicy.svg [maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigquerydatapolicy&core=gav @@ -186,9 +186,9 @@ Java is a registered trademark of Oracle and/or its affiliates. [create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects [cloud-sdk]: https://cloud.google.com/sdk/ [troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting -[contributing]: https://github.com/googleapis/java-bigquerydatapolicy/blob/main/CONTRIBUTING.md -[code-of-conduct]: https://github.com/googleapis/java-bigquerydatapolicy/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct -[license]: https://github.com/googleapis/java-bigquerydatapolicy/blob/main/LICENSE +[contributing]: https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/google-cloud-java/blob/main/LICENSE [enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing [enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=bigquerydatapolicy.googleapis.com [libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy-bom/pom.xml b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy-bom/pom.xml index 8932666f92f9..7917511dac7b 100644 --- a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy-bom/pom.xml +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy-bom/pom.xml @@ -34,11 +34,21 @@ grpc-google-cloud-bigquerydatapolicy-v1beta1 0.4.0-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-bigquerydatapolicy-v1 + 0.4.0-SNAPSHOT + com.google.api.grpc proto-google-cloud-bigquerydatapolicy-v1beta1 0.4.0-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-bigquerydatapolicy-v1 + 0.4.0-SNAPSHOT + diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/pom.xml b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/pom.xml index 4539bf37c7f9..fd4269c624bb 100644 --- a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/pom.xml +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/pom.xml @@ -41,6 +41,10 @@ proto-google-common-protos + + com.google.api.grpc + proto-google-cloud-bigquerydatapolicy-v1 + com.google.api.grpc proto-google-cloud-bigquerydatapolicy-v1beta1 @@ -65,6 +69,11 @@ com.google.api.grpc grpc-google-common-protos + + com.google.api.grpc + grpc-google-cloud-bigquerydatapolicy-v1 + test + com.google.api.grpc proto-google-iam-v1 diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClient.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClient.java new file mode 100644 index 000000000000..a0fd172da82c --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClient.java @@ -0,0 +1,1175 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.bigquery.datapolicies.v1.stub.DataPolicyServiceStub; +import com.google.cloud.bigquery.datapolicies.v1.stub.DataPolicyServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +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.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Data Policy Service provides APIs for managing the label-policy bindings. + * + *

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

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ *   DataPolicy dataPolicy = DataPolicy.newBuilder().build();
+ *   DataPolicy response = dataPolicyServiceClient.createDataPolicy(parent, dataPolicy);
+ * }
+ * }
+ * + *

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

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

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

This class can be customized by passing in a custom instance of DataPolicyServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * DataPolicyServiceSettings dataPolicyServiceSettings =
+ *     DataPolicyServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * DataPolicyServiceClient dataPolicyServiceClient =
+ *     DataPolicyServiceClient.create(dataPolicyServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * DataPolicyServiceSettings dataPolicyServiceSettings =
+ *     DataPolicyServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * DataPolicyServiceClient dataPolicyServiceClient =
+ *     DataPolicyServiceClient.create(dataPolicyServiceSettings);
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * DataPolicyServiceSettings dataPolicyServiceSettings =
+ *     DataPolicyServiceSettings.newHttpJsonBuilder().build();
+ * DataPolicyServiceClient dataPolicyServiceClient =
+ *     DataPolicyServiceClient.create(dataPolicyServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class DataPolicyServiceClient implements BackgroundResource { + private final DataPolicyServiceSettings settings; + private final DataPolicyServiceStub stub; + + /** Constructs an instance of DataPolicyServiceClient with default settings. */ + public static final DataPolicyServiceClient create() throws IOException { + return create(DataPolicyServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of DataPolicyServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final DataPolicyServiceClient create(DataPolicyServiceSettings settings) + throws IOException { + return new DataPolicyServiceClient(settings); + } + + /** + * Constructs an instance of DataPolicyServiceClient, using the given stub for making calls. This + * is for advanced usage - prefer using create(DataPolicyServiceSettings). + */ + public static final DataPolicyServiceClient create(DataPolicyServiceStub stub) { + return new DataPolicyServiceClient(stub); + } + + /** + * Constructs an instance of DataPolicyServiceClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected DataPolicyServiceClient(DataPolicyServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((DataPolicyServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected DataPolicyServiceClient(DataPolicyServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final DataPolicyServiceSettings getSettings() { + return settings; + } + + public DataPolicyServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new data policy under a project with the given `dataPolicyId` (used as the display + * name), policy tag, and data policy type. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   DataPolicy dataPolicy = DataPolicy.newBuilder().build();
+   *   DataPolicy response = dataPolicyServiceClient.createDataPolicy(parent, dataPolicy);
+   * }
+   * }
+ * + * @param parent Required. Resource name of the project that the data policy will belong to. The + * format is `projects/{project_number}/locations/{location_id}`. + * @param dataPolicy Required. The data policy to create. The `name` field does not need to be + * provided for the data policy creation. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DataPolicy createDataPolicy(LocationName parent, DataPolicy dataPolicy) { + CreateDataPolicyRequest request = + CreateDataPolicyRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setDataPolicy(dataPolicy) + .build(); + return createDataPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new data policy under a project with the given `dataPolicyId` (used as the display + * name), policy tag, and data policy type. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   DataPolicy dataPolicy = DataPolicy.newBuilder().build();
+   *   DataPolicy response = dataPolicyServiceClient.createDataPolicy(parent, dataPolicy);
+   * }
+   * }
+ * + * @param parent Required. Resource name of the project that the data policy will belong to. The + * format is `projects/{project_number}/locations/{location_id}`. + * @param dataPolicy Required. The data policy to create. The `name` field does not need to be + * provided for the data policy creation. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DataPolicy createDataPolicy(String parent, DataPolicy dataPolicy) { + CreateDataPolicyRequest request = + CreateDataPolicyRequest.newBuilder().setParent(parent).setDataPolicy(dataPolicy).build(); + return createDataPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new data policy under a project with the given `dataPolicyId` (used as the display + * name), policy tag, and data policy type. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   CreateDataPolicyRequest request =
+   *       CreateDataPolicyRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setDataPolicy(DataPolicy.newBuilder().build())
+   *           .build();
+   *   DataPolicy response = dataPolicyServiceClient.createDataPolicy(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 DataPolicy createDataPolicy(CreateDataPolicyRequest request) { + return createDataPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new data policy under a project with the given `dataPolicyId` (used as the display + * name), policy tag, and data policy type. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   CreateDataPolicyRequest request =
+   *       CreateDataPolicyRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setDataPolicy(DataPolicy.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       dataPolicyServiceClient.createDataPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   DataPolicy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createDataPolicyCallable() { + return stub.createDataPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the metadata for an existing data policy. The target data policy can be specified by + * the resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   DataPolicy dataPolicy = DataPolicy.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   DataPolicy response = dataPolicyServiceClient.updateDataPolicy(dataPolicy, updateMask);
+   * }
+   * }
+ * + * @param dataPolicy Required. Update the data policy's metadata. + *

The target data policy is determined by the `name` field. Other fields are updated to + * the specified values based on the field masks. + * @param updateMask The update mask applies to the resource. For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask If + * not set, defaults to all of the fields that are allowed to update. + *

Updates to the `name` and `dataPolicyId` fields are not allowed. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DataPolicy updateDataPolicy(DataPolicy dataPolicy, FieldMask updateMask) { + UpdateDataPolicyRequest request = + UpdateDataPolicyRequest.newBuilder() + .setDataPolicy(dataPolicy) + .setUpdateMask(updateMask) + .build(); + return updateDataPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the metadata for an existing data policy. The target data policy can be specified by + * the resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   UpdateDataPolicyRequest request =
+   *       UpdateDataPolicyRequest.newBuilder()
+   *           .setDataPolicy(DataPolicy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   DataPolicy response = dataPolicyServiceClient.updateDataPolicy(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 DataPolicy updateDataPolicy(UpdateDataPolicyRequest request) { + return updateDataPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the metadata for an existing data policy. The target data policy can be specified by + * the resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   UpdateDataPolicyRequest request =
+   *       UpdateDataPolicyRequest.newBuilder()
+   *           .setDataPolicy(DataPolicy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       dataPolicyServiceClient.updateDataPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   DataPolicy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateDataPolicyCallable() { + return stub.updateDataPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Renames the id (display name) of the specified data policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   String name = "name3373707";
+   *   String newDataPolicyId = "newDataPolicyId288407927";
+   *   DataPolicy response = dataPolicyServiceClient.renameDataPolicy(name, newDataPolicyId);
+   * }
+   * }
+ * + * @param name Required. Resource name of the data policy to rename. The format is + * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}` + * @param newDataPolicyId Required. The new data policy id. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DataPolicy renameDataPolicy(String name, String newDataPolicyId) { + RenameDataPolicyRequest request = + RenameDataPolicyRequest.newBuilder() + .setName(name) + .setNewDataPolicyId(newDataPolicyId) + .build(); + return renameDataPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Renames the id (display name) of the specified data policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   RenameDataPolicyRequest request =
+   *       RenameDataPolicyRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setNewDataPolicyId("newDataPolicyId288407927")
+   *           .build();
+   *   DataPolicy response = dataPolicyServiceClient.renameDataPolicy(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 DataPolicy renameDataPolicy(RenameDataPolicyRequest request) { + return renameDataPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Renames the id (display name) of the specified data policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   RenameDataPolicyRequest request =
+   *       RenameDataPolicyRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setNewDataPolicyId("newDataPolicyId288407927")
+   *           .build();
+   *   ApiFuture future =
+   *       dataPolicyServiceClient.renameDataPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   DataPolicy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable renameDataPolicyCallable() { + return stub.renameDataPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the data policy specified by its resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]");
+   *   dataPolicyServiceClient.deleteDataPolicy(name);
+   * }
+   * }
+ * + * @param name Required. Resource name of the data policy to delete. Format is + * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteDataPolicy(DataPolicyName name) { + DeleteDataPolicyRequest request = + DeleteDataPolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteDataPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the data policy specified by its resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   String name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString();
+   *   dataPolicyServiceClient.deleteDataPolicy(name);
+   * }
+   * }
+ * + * @param name Required. Resource name of the data policy to delete. Format is + * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteDataPolicy(String name) { + DeleteDataPolicyRequest request = DeleteDataPolicyRequest.newBuilder().setName(name).build(); + deleteDataPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the data policy specified by its resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   DeleteDataPolicyRequest request =
+   *       DeleteDataPolicyRequest.newBuilder()
+   *           .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .build();
+   *   dataPolicyServiceClient.deleteDataPolicy(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 deleteDataPolicy(DeleteDataPolicyRequest request) { + deleteDataPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the data policy specified by its resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   DeleteDataPolicyRequest request =
+   *       DeleteDataPolicyRequest.newBuilder()
+   *           .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       dataPolicyServiceClient.deleteDataPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteDataPolicyCallable() { + return stub.deleteDataPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the data policy specified by its resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]");
+   *   DataPolicy response = dataPolicyServiceClient.getDataPolicy(name);
+   * }
+   * }
+ * + * @param name Required. Resource name of the requested data policy. Format is + * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DataPolicy getDataPolicy(DataPolicyName name) { + GetDataPolicyRequest request = + GetDataPolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getDataPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the data policy specified by its resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   String name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString();
+   *   DataPolicy response = dataPolicyServiceClient.getDataPolicy(name);
+   * }
+   * }
+ * + * @param name Required. Resource name of the requested data policy. Format is + * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DataPolicy getDataPolicy(String name) { + GetDataPolicyRequest request = GetDataPolicyRequest.newBuilder().setName(name).build(); + return getDataPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the data policy specified by its resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   GetDataPolicyRequest request =
+   *       GetDataPolicyRequest.newBuilder()
+   *           .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .build();
+   *   DataPolicy response = dataPolicyServiceClient.getDataPolicy(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 DataPolicy getDataPolicy(GetDataPolicyRequest request) { + return getDataPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the data policy specified by its resource name. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   GetDataPolicyRequest request =
+   *       GetDataPolicyRequest.newBuilder()
+   *           .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       dataPolicyServiceClient.getDataPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   DataPolicy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getDataPolicyCallable() { + return stub.getDataPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List all of the data policies in the specified parent project. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (DataPolicy element : dataPolicyServiceClient.listDataPolicies(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. Resource name of the project for which to list data policies. Format is + * `projects/{project_number}/locations/{location_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListDataPoliciesPagedResponse listDataPolicies(LocationName parent) { + ListDataPoliciesRequest request = + ListDataPoliciesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listDataPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List all of the data policies in the specified parent project. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (DataPolicy element : dataPolicyServiceClient.listDataPolicies(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. Resource name of the project for which to list data policies. Format is + * `projects/{project_number}/locations/{location_id}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListDataPoliciesPagedResponse listDataPolicies(String parent) { + ListDataPoliciesRequest request = + ListDataPoliciesRequest.newBuilder().setParent(parent).build(); + return listDataPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List all of the data policies in the specified parent project. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   ListDataPoliciesRequest request =
+   *       ListDataPoliciesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   for (DataPolicy element : dataPolicyServiceClient.listDataPolicies(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListDataPoliciesPagedResponse listDataPolicies(ListDataPoliciesRequest request) { + return listDataPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List all of the data policies in the specified parent project. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   ListDataPoliciesRequest request =
+   *       ListDataPoliciesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   ApiFuture future =
+   *       dataPolicyServiceClient.listDataPoliciesPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (DataPolicy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listDataPoliciesPagedCallable() { + return stub.listDataPoliciesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List all of the data policies in the specified parent project. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   ListDataPoliciesRequest request =
+   *       ListDataPoliciesRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   while (true) {
+   *     ListDataPoliciesResponse response =
+   *         dataPolicyServiceClient.listDataPoliciesCallable().call(request);
+   *     for (DataPolicy element : response.getDataPoliciesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listDataPoliciesCallable() { + return stub.listDataPoliciesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the IAM policy for the specified data policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   Policy response = dataPolicyServiceClient.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 + */ + public final Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the IAM policy for the specified data policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = dataPolicyServiceClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getIamPolicyCallable() { + return stub.getIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the IAM policy for the specified data policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Policy response = dataPolicyServiceClient.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 + */ + public final Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the IAM policy for the specified data policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = dataPolicyServiceClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable setIamPolicyCallable() { + return stub.setIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the caller's permission on the specified data policy resource. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   TestIamPermissionsResponse response = dataPolicyServiceClient.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 + */ + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the caller's permission on the specified data policy resource. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       dataPolicyServiceClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
+   *   TestIamPermissionsResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + testIamPermissionsCallable() { + return stub.testIamPermissionsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListDataPoliciesPagedResponse + extends AbstractPagedListResponse< + ListDataPoliciesRequest, + ListDataPoliciesResponse, + DataPolicy, + ListDataPoliciesPage, + ListDataPoliciesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListDataPoliciesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListDataPoliciesPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListDataPoliciesPagedResponse(ListDataPoliciesPage page) { + super(page, ListDataPoliciesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListDataPoliciesPage + extends AbstractPage< + ListDataPoliciesRequest, ListDataPoliciesResponse, DataPolicy, ListDataPoliciesPage> { + + private ListDataPoliciesPage( + PageContext context, + ListDataPoliciesResponse response) { + super(context, response); + } + + private static ListDataPoliciesPage createEmptyPage() { + return new ListDataPoliciesPage(null, null); + } + + @Override + protected ListDataPoliciesPage createPage( + PageContext context, + ListDataPoliciesResponse response) { + return new ListDataPoliciesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListDataPoliciesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListDataPoliciesRequest, + ListDataPoliciesResponse, + DataPolicy, + ListDataPoliciesPage, + ListDataPoliciesFixedSizeCollection> { + + private ListDataPoliciesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListDataPoliciesFixedSizeCollection createEmptyCollection() { + return new ListDataPoliciesFixedSizeCollection(null, 0); + } + + @Override + protected ListDataPoliciesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListDataPoliciesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceSettings.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceSettings.java new file mode 100644 index 000000000000..d792c5866fb1 --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceSettings.java @@ -0,0 +1,304 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1; + +import static com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClient.ListDataPoliciesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.bigquery.datapolicies.v1.stub.DataPolicyServiceStubSettings; +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.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link DataPolicyServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (bigquerydatapolicy.googleapis.com) and default port (443) are + * used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createDataPolicy to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * DataPolicyServiceSettings.Builder dataPolicyServiceSettingsBuilder =
+ *     DataPolicyServiceSettings.newBuilder();
+ * dataPolicyServiceSettingsBuilder
+ *     .createDataPolicySettings()
+ *     .setRetrySettings(
+ *         dataPolicyServiceSettingsBuilder
+ *             .createDataPolicySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * DataPolicyServiceSettings dataPolicyServiceSettings = dataPolicyServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class DataPolicyServiceSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to createDataPolicy. */ + public UnaryCallSettings createDataPolicySettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).createDataPolicySettings(); + } + + /** Returns the object with the settings used for calls to updateDataPolicy. */ + public UnaryCallSettings updateDataPolicySettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).updateDataPolicySettings(); + } + + /** Returns the object with the settings used for calls to renameDataPolicy. */ + public UnaryCallSettings renameDataPolicySettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).renameDataPolicySettings(); + } + + /** Returns the object with the settings used for calls to deleteDataPolicy. */ + public UnaryCallSettings deleteDataPolicySettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).deleteDataPolicySettings(); + } + + /** Returns the object with the settings used for calls to getDataPolicy. */ + public UnaryCallSettings getDataPolicySettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).getDataPolicySettings(); + } + + /** Returns the object with the settings used for calls to listDataPolicies. */ + public PagedCallSettings< + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> + listDataPoliciesSettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).listDataPoliciesSettings(); + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).getIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).setIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return ((DataPolicyServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); + } + + public static final DataPolicyServiceSettings create(DataPolicyServiceStubSettings stub) + throws IOException { + return new DataPolicyServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return DataPolicyServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return DataPolicyServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DataPolicyServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return DataPolicyServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return DataPolicyServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return DataPolicyServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return DataPolicyServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DataPolicyServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DataPolicyServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for DataPolicyServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(DataPolicyServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(DataPolicyServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(DataPolicyServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(DataPolicyServiceStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(DataPolicyServiceStubSettings.newHttpJsonBuilder()); + } + + public DataPolicyServiceStubSettings.Builder getStubSettingsBuilder() { + return ((DataPolicyServiceStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createDataPolicy. */ + public UnaryCallSettings.Builder + createDataPolicySettings() { + return getStubSettingsBuilder().createDataPolicySettings(); + } + + /** Returns the builder for the settings used for calls to updateDataPolicy. */ + public UnaryCallSettings.Builder + updateDataPolicySettings() { + return getStubSettingsBuilder().updateDataPolicySettings(); + } + + /** Returns the builder for the settings used for calls to renameDataPolicy. */ + public UnaryCallSettings.Builder + renameDataPolicySettings() { + return getStubSettingsBuilder().renameDataPolicySettings(); + } + + /** Returns the builder for the settings used for calls to deleteDataPolicy. */ + public UnaryCallSettings.Builder deleteDataPolicySettings() { + return getStubSettingsBuilder().deleteDataPolicySettings(); + } + + /** Returns the builder for the settings used for calls to getDataPolicy. */ + public UnaryCallSettings.Builder getDataPolicySettings() { + return getStubSettingsBuilder().getDataPolicySettings(); + } + + /** Returns the builder for the settings used for calls to listDataPolicies. */ + public PagedCallSettings.Builder< + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> + listDataPoliciesSettings() { + return getStubSettingsBuilder().listDataPoliciesSettings(); + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getStubSettingsBuilder().getIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return getStubSettingsBuilder().setIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return getStubSettingsBuilder().testIamPermissionsSettings(); + } + + @Override + public DataPolicyServiceSettings build() throws IOException { + return new DataPolicyServiceSettings(this); + } + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/gapic_metadata.json b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/gapic_metadata.json new file mode 100644 index 000000000000..607537ef4522 --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/gapic_metadata.json @@ -0,0 +1,45 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.cloud.bigquery.datapolicies.v1", + "libraryPackage": "com.google.cloud.bigquery.datapolicies.v1", + "services": { + "DataPolicyService": { + "clients": { + "grpc": { + "libraryClient": "DataPolicyServiceClient", + "rpcs": { + "CreateDataPolicy": { + "methods": ["createDataPolicy", "createDataPolicy", "createDataPolicy", "createDataPolicyCallable"] + }, + "DeleteDataPolicy": { + "methods": ["deleteDataPolicy", "deleteDataPolicy", "deleteDataPolicy", "deleteDataPolicyCallable"] + }, + "GetDataPolicy": { + "methods": ["getDataPolicy", "getDataPolicy", "getDataPolicy", "getDataPolicyCallable"] + }, + "GetIamPolicy": { + "methods": ["getIamPolicy", "getIamPolicyCallable"] + }, + "ListDataPolicies": { + "methods": ["listDataPolicies", "listDataPolicies", "listDataPolicies", "listDataPoliciesPagedCallable", "listDataPoliciesCallable"] + }, + "RenameDataPolicy": { + "methods": ["renameDataPolicy", "renameDataPolicy", "renameDataPolicyCallable"] + }, + "SetIamPolicy": { + "methods": ["setIamPolicy", "setIamPolicyCallable"] + }, + "TestIamPermissions": { + "methods": ["testIamPermissions", "testIamPermissionsCallable"] + }, + "UpdateDataPolicy": { + "methods": ["updateDataPolicy", "updateDataPolicy", "updateDataPolicyCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/package-info.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/package-info.java new file mode 100644 index 000000000000..74be408c0a35 --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/package-info.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A client to BigQuery Data Policy API + * + *

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

======================= DataPolicyServiceClient ======================= + * + *

Service Description: Data Policy Service provides APIs for managing the label-policy bindings. + * + *

Sample for DataPolicyServiceClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DataPolicyServiceClient dataPolicyServiceClient = DataPolicyServiceClient.create()) {
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ *   DataPolicy dataPolicy = DataPolicy.newBuilder().build();
+ *   DataPolicy response = dataPolicyServiceClient.createDataPolicy(parent, dataPolicy);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.cloud.bigquery.datapolicies.v1; + +import javax.annotation.Generated; diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/DataPolicyServiceStub.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/DataPolicyServiceStub.java new file mode 100644 index 000000000000..f155229fce72 --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/DataPolicyServiceStub.java @@ -0,0 +1,93 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1.stub; + +import static com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClient.ListDataPoliciesPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.DataPolicy; +import com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest; +import com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse; +import com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest; +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.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the DataPolicyService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class DataPolicyServiceStub implements BackgroundResource { + + public UnaryCallable createDataPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: createDataPolicyCallable()"); + } + + public UnaryCallable updateDataPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: updateDataPolicyCallable()"); + } + + public UnaryCallable renameDataPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: renameDataPolicyCallable()"); + } + + public UnaryCallable deleteDataPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: deleteDataPolicyCallable()"); + } + + public UnaryCallable getDataPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getDataPolicyCallable()"); + } + + public UnaryCallable + listDataPoliciesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listDataPoliciesPagedCallable()"); + } + + public UnaryCallable + listDataPoliciesCallable() { + throw new UnsupportedOperationException("Not implemented: listDataPoliciesCallable()"); + } + + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); + } + + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); + } + + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/DataPolicyServiceStubSettings.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/DataPolicyServiceStubSettings.java new file mode 100644 index 000000000000..27127addf20e --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/DataPolicyServiceStubSettings.java @@ -0,0 +1,606 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1.stub; + +import static com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClient.ListDataPoliciesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.DataPolicy; +import com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest; +import com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse; +import com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +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.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link DataPolicyServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (bigquerydatapolicy.googleapis.com) and default port (443) are + * used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createDataPolicy to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * DataPolicyServiceStubSettings.Builder dataPolicyServiceSettingsBuilder =
+ *     DataPolicyServiceStubSettings.newBuilder();
+ * dataPolicyServiceSettingsBuilder
+ *     .createDataPolicySettings()
+ *     .setRetrySettings(
+ *         dataPolicyServiceSettingsBuilder
+ *             .createDataPolicySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * DataPolicyServiceStubSettings dataPolicyServiceSettings =
+ *     dataPolicyServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class DataPolicyServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/bigquery") + .add("https://www.googleapis.com/auth/cloud-platform") + .build(); + + private final UnaryCallSettings createDataPolicySettings; + private final UnaryCallSettings updateDataPolicySettings; + private final UnaryCallSettings renameDataPolicySettings; + private final UnaryCallSettings deleteDataPolicySettings; + private final UnaryCallSettings getDataPolicySettings; + private final PagedCallSettings< + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> + listDataPoliciesSettings; + private final UnaryCallSettings getIamPolicySettings; + private final UnaryCallSettings setIamPolicySettings; + private final UnaryCallSettings + testIamPermissionsSettings; + + private static final PagedListDescriptor< + ListDataPoliciesRequest, ListDataPoliciesResponse, DataPolicy> + LIST_DATA_POLICIES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListDataPoliciesRequest injectToken( + ListDataPoliciesRequest payload, String token) { + return ListDataPoliciesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListDataPoliciesRequest injectPageSize( + ListDataPoliciesRequest payload, int pageSize) { + return ListDataPoliciesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListDataPoliciesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListDataPoliciesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListDataPoliciesResponse payload) { + return payload.getDataPoliciesList() == null + ? ImmutableList.of() + : payload.getDataPoliciesList(); + } + }; + + private static final PagedListResponseFactory< + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> + LIST_DATA_POLICIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListDataPoliciesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_DATA_POLICIES_PAGE_STR_DESC, request, context); + return ListDataPoliciesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to createDataPolicy. */ + public UnaryCallSettings createDataPolicySettings() { + return createDataPolicySettings; + } + + /** Returns the object with the settings used for calls to updateDataPolicy. */ + public UnaryCallSettings updateDataPolicySettings() { + return updateDataPolicySettings; + } + + /** Returns the object with the settings used for calls to renameDataPolicy. */ + public UnaryCallSettings renameDataPolicySettings() { + return renameDataPolicySettings; + } + + /** Returns the object with the settings used for calls to deleteDataPolicy. */ + public UnaryCallSettings deleteDataPolicySettings() { + return deleteDataPolicySettings; + } + + /** Returns the object with the settings used for calls to getDataPolicy. */ + public UnaryCallSettings getDataPolicySettings() { + return getDataPolicySettings; + } + + /** Returns the object with the settings used for calls to listDataPolicies. */ + public PagedCallSettings< + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> + listDataPoliciesSettings() { + return listDataPoliciesSettings; + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + public DataPolicyServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcDataPolicyServiceStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonDataPolicyServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "bigquerydatapolicy.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "bigquerydatapolicy.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(DataPolicyServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(DataPolicyServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DataPolicyServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DataPolicyServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createDataPolicySettings = settingsBuilder.createDataPolicySettings().build(); + updateDataPolicySettings = settingsBuilder.updateDataPolicySettings().build(); + renameDataPolicySettings = settingsBuilder.renameDataPolicySettings().build(); + deleteDataPolicySettings = settingsBuilder.deleteDataPolicySettings().build(); + getDataPolicySettings = settingsBuilder.getDataPolicySettings().build(); + listDataPoliciesSettings = settingsBuilder.listDataPoliciesSettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); + } + + /** Builder for DataPolicyServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder + createDataPolicySettings; + private final UnaryCallSettings.Builder + updateDataPolicySettings; + private final UnaryCallSettings.Builder + renameDataPolicySettings; + private final UnaryCallSettings.Builder + deleteDataPolicySettings; + private final UnaryCallSettings.Builder getDataPolicySettings; + private final PagedCallSettings.Builder< + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> + listDataPoliciesSettings; + 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( + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(10000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createDataPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateDataPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + renameDataPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteDataPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getDataPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listDataPoliciesSettings = PagedCallSettings.newBuilder(LIST_DATA_POLICIES_PAGE_STR_FACT); + getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createDataPolicySettings, + updateDataPolicySettings, + renameDataPolicySettings, + deleteDataPolicySettings, + getDataPolicySettings, + listDataPoliciesSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + initDefaults(this); + } + + protected Builder(DataPolicyServiceStubSettings settings) { + super(settings); + + createDataPolicySettings = settings.createDataPolicySettings.toBuilder(); + updateDataPolicySettings = settings.updateDataPolicySettings.toBuilder(); + renameDataPolicySettings = settings.renameDataPolicySettings.toBuilder(); + deleteDataPolicySettings = settings.deleteDataPolicySettings.toBuilder(); + getDataPolicySettings = settings.getDataPolicySettings.toBuilder(); + listDataPoliciesSettings = settings.listDataPoliciesSettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createDataPolicySettings, + updateDataPolicySettings, + renameDataPolicySettings, + deleteDataPolicySettings, + getDataPolicySettings, + listDataPoliciesSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .createDataPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updateDataPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .renameDataPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .deleteDataPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getDataPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .listDataPoliciesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .setIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .testIamPermissionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createDataPolicy. */ + public UnaryCallSettings.Builder + createDataPolicySettings() { + return createDataPolicySettings; + } + + /** Returns the builder for the settings used for calls to updateDataPolicy. */ + public UnaryCallSettings.Builder + updateDataPolicySettings() { + return updateDataPolicySettings; + } + + /** Returns the builder for the settings used for calls to renameDataPolicy. */ + public UnaryCallSettings.Builder + renameDataPolicySettings() { + return renameDataPolicySettings; + } + + /** Returns the builder for the settings used for calls to deleteDataPolicy. */ + public UnaryCallSettings.Builder deleteDataPolicySettings() { + return deleteDataPolicySettings; + } + + /** Returns the builder for the settings used for calls to getDataPolicy. */ + public UnaryCallSettings.Builder getDataPolicySettings() { + return getDataPolicySettings; + } + + /** Returns the builder for the settings used for calls to listDataPolicies. */ + public PagedCallSettings.Builder< + ListDataPoliciesRequest, ListDataPoliciesResponse, ListDataPoliciesPagedResponse> + listDataPoliciesSettings() { + return listDataPoliciesSettings; + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + @Override + public DataPolicyServiceStubSettings build() throws IOException { + return new DataPolicyServiceStubSettings(this); + } + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/GrpcDataPolicyServiceCallableFactory.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/GrpcDataPolicyServiceCallableFactory.java new file mode 100644 index 000000000000..5f6aa821444a --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/GrpcDataPolicyServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the DataPolicyService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcDataPolicyServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/GrpcDataPolicyServiceStub.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/GrpcDataPolicyServiceStub.java new file mode 100644 index 000000000000..efa16ebbf9db --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/GrpcDataPolicyServiceStub.java @@ -0,0 +1,432 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1.stub; + +import static com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClient.ListDataPoliciesPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.DataPolicy; +import com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest; +import com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse; +import com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest; +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; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the DataPolicyService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcDataPolicyServiceStub extends DataPolicyServiceStub { + private static final MethodDescriptor + createDataPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/CreateDataPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateDataPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(DataPolicy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateDataPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/UpdateDataPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateDataPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(DataPolicy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + renameDataPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/RenameDataPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(RenameDataPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(DataPolicy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteDataPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/DeleteDataPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteDataPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + getDataPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/GetDataPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(GetDataPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(DataPolicy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listDataPoliciesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/ListDataPolicies") + .setRequestMarshaller( + ProtoUtils.marshaller(ListDataPoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListDataPoliciesResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.bigquery.datapolicies.v1.DataPolicyService/GetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor setIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.bigquery.datapolicies.v1.DataPolicyService/SetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + testIamPermissionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/TestIamPermissions") + .setRequestMarshaller( + ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable createDataPolicyCallable; + private final UnaryCallable updateDataPolicyCallable; + private final UnaryCallable renameDataPolicyCallable; + private final UnaryCallable deleteDataPolicyCallable; + private final UnaryCallable getDataPolicyCallable; + private final UnaryCallable + listDataPoliciesCallable; + private final UnaryCallable + listDataPoliciesPagedCallable; + 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 GrpcDataPolicyServiceStub create(DataPolicyServiceStubSettings settings) + throws IOException { + return new GrpcDataPolicyServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcDataPolicyServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcDataPolicyServiceStub( + DataPolicyServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcDataPolicyServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcDataPolicyServiceStub( + DataPolicyServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcDataPolicyServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcDataPolicyServiceStub( + DataPolicyServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcDataPolicyServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcDataPolicyServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcDataPolicyServiceStub( + DataPolicyServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings createDataPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createDataPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings updateDataPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateDataPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("data_policy.name", String.valueOf(request.getDataPolicy().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings renameDataPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(renameDataPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings deleteDataPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteDataPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getDataPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getDataPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + listDataPoliciesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listDataPoliciesMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings getIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + }) + .build(); + GrpcCallSettings setIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + }) + .build(); + GrpcCallSettings + testIamPermissionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + }) + .build(); + + this.createDataPolicyCallable = + callableFactory.createUnaryCallable( + createDataPolicyTransportSettings, settings.createDataPolicySettings(), clientContext); + this.updateDataPolicyCallable = + callableFactory.createUnaryCallable( + updateDataPolicyTransportSettings, settings.updateDataPolicySettings(), clientContext); + this.renameDataPolicyCallable = + callableFactory.createUnaryCallable( + renameDataPolicyTransportSettings, settings.renameDataPolicySettings(), clientContext); + this.deleteDataPolicyCallable = + callableFactory.createUnaryCallable( + deleteDataPolicyTransportSettings, settings.deleteDataPolicySettings(), clientContext); + this.getDataPolicyCallable = + callableFactory.createUnaryCallable( + getDataPolicyTransportSettings, settings.getDataPolicySettings(), clientContext); + this.listDataPoliciesCallable = + callableFactory.createUnaryCallable( + listDataPoliciesTransportSettings, settings.listDataPoliciesSettings(), clientContext); + this.listDataPoliciesPagedCallable = + callableFactory.createPagedCallable( + listDataPoliciesTransportSettings, settings.listDataPoliciesSettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable createDataPolicyCallable() { + return createDataPolicyCallable; + } + + @Override + public UnaryCallable updateDataPolicyCallable() { + return updateDataPolicyCallable; + } + + @Override + public UnaryCallable renameDataPolicyCallable() { + return renameDataPolicyCallable; + } + + @Override + public UnaryCallable deleteDataPolicyCallable() { + return deleteDataPolicyCallable; + } + + @Override + public UnaryCallable getDataPolicyCallable() { + return getDataPolicyCallable; + } + + @Override + public UnaryCallable + listDataPoliciesCallable() { + return listDataPoliciesCallable; + } + + @Override + public UnaryCallable + listDataPoliciesPagedCallable() { + return listDataPoliciesPagedCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/HttpJsonDataPolicyServiceCallableFactory.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/HttpJsonDataPolicyServiceCallableFactory.java new file mode 100644 index 000000000000..fd5c58a51d64 --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/HttpJsonDataPolicyServiceCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the DataPolicyService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDataPolicyServiceCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/HttpJsonDataPolicyServiceStub.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/HttpJsonDataPolicyServiceStub.java new file mode 100644 index 000000000000..721b8d6fb745 --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/main/java/com/google/cloud/bigquery/datapolicies/v1/stub/HttpJsonDataPolicyServiceStub.java @@ -0,0 +1,649 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1.stub; + +import static com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClient.ListDataPoliciesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.DataPolicy; +import com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest; +import com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse; +import com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest; +import com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest; +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.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the DataPolicyService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonDataPolicyServiceStub extends DataPolicyServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + createDataPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/CreateDataPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/dataPolicies", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("dataPolicy", request.getDataPolicy(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateDataPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/UpdateDataPolicy") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{dataPolicy.name=projects/*/locations/*/dataPolicies/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "dataPolicy.name", request.getDataPolicy().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("dataPolicy", request.getDataPolicy(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + renameDataPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/RenameDataPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/dataPolicies/*}:rename", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteDataPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/DeleteDataPolicy") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/dataPolicies/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getDataPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/GetDataPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/dataPolicies/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listDataPoliciesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/ListDataPolicies") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/dataPolicies", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListDataPoliciesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/GetIamPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/locations/*/dataPolicies/*}:getIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + setIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/SetIamPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/locations/*/dataPolicies/*}:setIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + testIamPermissionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.bigquery.datapolicies.v1.DataPolicyService/TestIamPermissions") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/locations/*/dataPolicies/*}:testIamPermissions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createDataPolicyCallable; + private final UnaryCallable updateDataPolicyCallable; + private final UnaryCallable renameDataPolicyCallable; + private final UnaryCallable deleteDataPolicyCallable; + private final UnaryCallable getDataPolicyCallable; + private final UnaryCallable + listDataPoliciesCallable; + private final UnaryCallable + listDataPoliciesPagedCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonDataPolicyServiceStub create(DataPolicyServiceStubSettings settings) + throws IOException { + return new HttpJsonDataPolicyServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonDataPolicyServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonDataPolicyServiceStub( + DataPolicyServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonDataPolicyServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonDataPolicyServiceStub( + DataPolicyServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonDataPolicyServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonDataPolicyServiceStub( + DataPolicyServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonDataPolicyServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonDataPolicyServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonDataPolicyServiceStub( + DataPolicyServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings createDataPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createDataPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateDataPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateDataPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings renameDataPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(renameDataPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteDataPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteDataPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getDataPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getDataPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listDataPoliciesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listDataPoliciesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings setIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + testIamPermissionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createDataPolicyCallable = + callableFactory.createUnaryCallable( + createDataPolicyTransportSettings, settings.createDataPolicySettings(), clientContext); + this.updateDataPolicyCallable = + callableFactory.createUnaryCallable( + updateDataPolicyTransportSettings, settings.updateDataPolicySettings(), clientContext); + this.renameDataPolicyCallable = + callableFactory.createUnaryCallable( + renameDataPolicyTransportSettings, settings.renameDataPolicySettings(), clientContext); + this.deleteDataPolicyCallable = + callableFactory.createUnaryCallable( + deleteDataPolicyTransportSettings, settings.deleteDataPolicySettings(), clientContext); + this.getDataPolicyCallable = + callableFactory.createUnaryCallable( + getDataPolicyTransportSettings, settings.getDataPolicySettings(), clientContext); + this.listDataPoliciesCallable = + callableFactory.createUnaryCallable( + listDataPoliciesTransportSettings, settings.listDataPoliciesSettings(), clientContext); + this.listDataPoliciesPagedCallable = + callableFactory.createPagedCallable( + listDataPoliciesTransportSettings, settings.listDataPoliciesSettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createDataPolicyMethodDescriptor); + methodDescriptors.add(updateDataPolicyMethodDescriptor); + methodDescriptors.add(renameDataPolicyMethodDescriptor); + methodDescriptors.add(deleteDataPolicyMethodDescriptor); + methodDescriptors.add(getDataPolicyMethodDescriptor); + methodDescriptors.add(listDataPoliciesMethodDescriptor); + methodDescriptors.add(getIamPolicyMethodDescriptor); + methodDescriptors.add(setIamPolicyMethodDescriptor); + methodDescriptors.add(testIamPermissionsMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable createDataPolicyCallable() { + return createDataPolicyCallable; + } + + @Override + public UnaryCallable updateDataPolicyCallable() { + return updateDataPolicyCallable; + } + + @Override + public UnaryCallable renameDataPolicyCallable() { + return renameDataPolicyCallable; + } + + @Override + public UnaryCallable deleteDataPolicyCallable() { + return deleteDataPolicyCallable; + } + + @Override + public UnaryCallable getDataPolicyCallable() { + return getDataPolicyCallable; + } + + @Override + public UnaryCallable + listDataPoliciesCallable() { + return listDataPoliciesCallable; + } + + @Override + public UnaryCallable + listDataPoliciesPagedCallable() { + return listDataPoliciesPagedCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClientHttpJsonTest.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClientHttpJsonTest.java new file mode 100644 index 000000000000..f200d24d86c3 --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClientHttpJsonTest.java @@ -0,0 +1,717 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1; + +import static com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClient.ListDataPoliciesPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.bigquery.datapolicies.v1.stub.HttpJsonDataPolicyServiceStub; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +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.protobuf.ByteString; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class DataPolicyServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static DataPolicyServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonDataPolicyServiceStub.getMethodDescriptors(), + DataPolicyServiceSettings.getDefaultEndpoint()); + DataPolicyServiceSettings settings = + DataPolicyServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + DataPolicyServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DataPolicyServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createDataPolicyTest() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + + DataPolicy actualResponse = client.createDataPolicy(parent, dataPolicy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createDataPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + client.createDataPolicy(parent, dataPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDataPolicyTest2() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + + DataPolicy actualResponse = client.createDataPolicy(parent, dataPolicy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createDataPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + client.createDataPolicy(parent, dataPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateDataPolicyTest() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockService.addResponse(expectedResponse); + + DataPolicy dataPolicy = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + DataPolicy actualResponse = client.updateDataPolicy(dataPolicy, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateDataPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataPolicy dataPolicy = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateDataPolicy(dataPolicy, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void renameDataPolicyTest() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2886/locations/location-2886/dataPolicies/dataPolicie-2886"; + String newDataPolicyId = "newDataPolicyId288407927"; + + DataPolicy actualResponse = client.renameDataPolicy(name, newDataPolicyId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void renameDataPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2886/locations/location-2886/dataPolicies/dataPolicie-2886"; + String newDataPolicyId = "newDataPolicyId288407927"; + client.renameDataPolicy(name, newDataPolicyId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDataPolicyTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]"); + + client.deleteDataPolicy(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteDataPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]"); + client.deleteDataPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDataPolicyTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2886/locations/location-2886/dataPolicies/dataPolicie-2886"; + + client.deleteDataPolicy(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteDataPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2886/locations/location-2886/dataPolicies/dataPolicie-2886"; + client.deleteDataPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataPolicyTest() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockService.addResponse(expectedResponse); + + DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]"); + + DataPolicy actualResponse = client.getDataPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDataPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]"); + client.getDataPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataPolicyTest2() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2886/locations/location-2886/dataPolicies/dataPolicie-2886"; + + DataPolicy actualResponse = client.getDataPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDataPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2886/locations/location-2886/dataPolicies/dataPolicie-2886"; + client.getDataPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDataPoliciesTest() throws Exception { + DataPolicy responsesElement = DataPolicy.newBuilder().build(); + ListDataPoliciesResponse expectedResponse = + ListDataPoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllDataPolicies(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListDataPoliciesPagedResponse pagedListResponse = client.listDataPolicies(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDataPoliciesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDataPoliciesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listDataPolicies(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDataPoliciesTest2() throws Exception { + DataPolicy responsesElement = DataPolicy.newBuilder().build(); + ListDataPoliciesResponse expectedResponse = + ListDataPoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllDataPolicies(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListDataPoliciesPagedResponse pagedListResponse = client.listDataPolicies(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDataPoliciesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDataPoliciesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listDataPolicies(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClientTest.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClientTest.java new file mode 100644 index 000000000000..f195218ff143 --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceClientTest.java @@ -0,0 +1,642 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1; + +import static com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClient.ListDataPoliciesPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +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.protobuf.AbstractMessage; +import com.google.protobuf.ByteString; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class DataPolicyServiceClientTest { + private static MockDataPolicyService mockDataPolicyService; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private DataPolicyServiceClient client; + + @BeforeClass + public static void startStaticServer() { + mockDataPolicyService = new MockDataPolicyService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockDataPolicyService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + DataPolicyServiceSettings settings = + DataPolicyServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DataPolicyServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createDataPolicyTest() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + + DataPolicy actualResponse = client.createDataPolicy(parent, dataPolicy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDataPolicyRequest actualRequest = ((CreateDataPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(dataPolicy, actualRequest.getDataPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDataPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + client.createDataPolicy(parent, dataPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDataPolicyTest2() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + + DataPolicy actualResponse = client.createDataPolicy(parent, dataPolicy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateDataPolicyRequest actualRequest = ((CreateDataPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(dataPolicy, actualRequest.getDataPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createDataPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + String parent = "parent-995424086"; + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + client.createDataPolicy(parent, dataPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateDataPolicyTest() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + DataPolicy actualResponse = client.updateDataPolicy(dataPolicy, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateDataPolicyRequest actualRequest = ((UpdateDataPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(dataPolicy, actualRequest.getDataPolicy()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateDataPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + DataPolicy dataPolicy = DataPolicy.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateDataPolicy(dataPolicy, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void renameDataPolicyTest() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + String name = "name3373707"; + String newDataPolicyId = "newDataPolicyId288407927"; + + DataPolicy actualResponse = client.renameDataPolicy(name, newDataPolicyId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RenameDataPolicyRequest actualRequest = ((RenameDataPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(newDataPolicyId, actualRequest.getNewDataPolicyId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void renameDataPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + String name = "name3373707"; + String newDataPolicyId = "newDataPolicyId288407927"; + client.renameDataPolicy(name, newDataPolicyId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDataPolicyTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDataPolicyService.addResponse(expectedResponse); + + DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]"); + + client.deleteDataPolicy(name); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteDataPolicyRequest actualRequest = ((DeleteDataPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteDataPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]"); + client.deleteDataPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDataPolicyTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockDataPolicyService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteDataPolicy(name); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteDataPolicyRequest actualRequest = ((DeleteDataPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteDataPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + String name = "name3373707"; + client.deleteDataPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataPolicyTest() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]"); + + DataPolicy actualResponse = client.getDataPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetDataPolicyRequest actualRequest = ((GetDataPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getDataPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + DataPolicyName name = DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]"); + client.getDataPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataPolicyTest2() throws Exception { + DataPolicy expectedResponse = + DataPolicy.newBuilder() + .setName(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setDataPolicyId("dataPolicyId1874146231") + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + String name = "name3373707"; + + DataPolicy actualResponse = client.getDataPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetDataPolicyRequest actualRequest = ((GetDataPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getDataPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + String name = "name3373707"; + client.getDataPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDataPoliciesTest() throws Exception { + DataPolicy responsesElement = DataPolicy.newBuilder().build(); + ListDataPoliciesResponse expectedResponse = + ListDataPoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllDataPolicies(Arrays.asList(responsesElement)) + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListDataPoliciesPagedResponse pagedListResponse = client.listDataPolicies(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDataPoliciesList().get(0), resources.get(0)); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDataPoliciesRequest actualRequest = ((ListDataPoliciesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listDataPoliciesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listDataPolicies(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDataPoliciesTest2() throws Exception { + DataPolicy responsesElement = DataPolicy.newBuilder().build(); + ListDataPoliciesResponse expectedResponse = + ListDataPoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllDataPolicies(Arrays.asList(responsesElement)) + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListDataPoliciesPagedResponse pagedListResponse = client.listDataPolicies(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDataPoliciesList().get(0), resources.get(0)); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListDataPoliciesRequest actualRequest = ((ListDataPoliciesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listDataPoliciesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listDataPolicies(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockDataPolicyService.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockDataPolicyService.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockDataPolicyService.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(DataPolicyName.of("[PROJECT]", "[LOCATION]", "[DATA_POLICY]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/MockDataPolicyService.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/MockDataPolicyService.java new file mode 100644 index 000000000000..615995c633ac --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/MockDataPolicyService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockDataPolicyService implements MockGrpcService { + private final MockDataPolicyServiceImpl serviceImpl; + + public MockDataPolicyService() { + serviceImpl = new MockDataPolicyServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/MockDataPolicyServiceImpl.java b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/MockDataPolicyServiceImpl.java new file mode 100644 index 000000000000..b1602e72815b --- /dev/null +++ b/java-bigquerydatapolicy/google-cloud-bigquerydatapolicy/src/test/java/com/google/cloud/bigquery/datapolicies/v1/MockDataPolicyServiceImpl.java @@ -0,0 +1,254 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceGrpc.DataPolicyServiceImplBase; +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.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockDataPolicyServiceImpl extends DataPolicyServiceImplBase { + private List requests; + private Queue responses; + + public MockDataPolicyServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createDataPolicy( + CreateDataPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof DataPolicy) { + requests.add(request); + responseObserver.onNext(((DataPolicy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateDataPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + DataPolicy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateDataPolicy( + UpdateDataPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof DataPolicy) { + requests.add(request); + responseObserver.onNext(((DataPolicy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateDataPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + DataPolicy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void renameDataPolicy( + RenameDataPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof DataPolicy) { + requests.add(request); + responseObserver.onNext(((DataPolicy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method RenameDataPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + DataPolicy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteDataPolicy( + DeleteDataPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteDataPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getDataPolicy( + GetDataPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof DataPolicy) { + requests.add(request); + responseObserver.onNext(((DataPolicy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetDataPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + DataPolicy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listDataPolicies( + ListDataPoliciesRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListDataPoliciesResponse) { + requests.add(request); + responseObserver.onNext(((ListDataPoliciesResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListDataPolicies, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListDataPoliciesResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext(((Policy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetIamPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext(((Policy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method SetIamPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void testIamPermissions( + TestIamPermissionsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof TestIamPermissionsResponse) { + requests.add(request); + responseObserver.onNext(((TestIamPermissionsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method TestIamPermissions, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + TestIamPermissionsResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-bigquerydatapolicy/grpc-google-cloud-bigquerydatapolicy-v1/pom.xml b/java-bigquerydatapolicy/grpc-google-cloud-bigquerydatapolicy-v1/pom.xml new file mode 100644 index 000000000000..d7d463233b57 --- /dev/null +++ b/java-bigquerydatapolicy/grpc-google-cloud-bigquerydatapolicy-v1/pom.xml @@ -0,0 +1,45 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-bigquerydatapolicy-v1 + 0.4.0-SNAPSHOT + grpc-google-cloud-bigquerydatapolicy-v1 + GRPC library for google-cloud-bigquerydatapolicy + + com.google.cloud + google-cloud-bigquerydatapolicy-parent + 0.4.0-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-bigquerydatapolicy-v1 + + + com.google.guava + guava + + + diff --git a/java-bigquerydatapolicy/grpc-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceGrpc.java b/java-bigquerydatapolicy/grpc-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceGrpc.java new file mode 100644 index 000000000000..f8be5b0afce0 --- /dev/null +++ b/java-bigquerydatapolicy/grpc-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyServiceGrpc.java @@ -0,0 +1,1313 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.bigquery.datapolicies.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Data Policy Service provides APIs for managing the label-policy bindings.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class DataPolicyServiceGrpc { + + private DataPolicyServiceGrpc() {} + + public static final String SERVICE_NAME = + "google.cloud.bigquery.datapolicies.v1.DataPolicyService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getCreateDataPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateDataPolicy", + requestType = com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest.class, + responseType = com.google.cloud.bigquery.datapolicies.v1.DataPolicy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getCreateDataPolicyMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getCreateDataPolicyMethod; + if ((getCreateDataPolicyMethod = DataPolicyServiceGrpc.getCreateDataPolicyMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getCreateDataPolicyMethod = DataPolicyServiceGrpc.getCreateDataPolicyMethod) == null) { + DataPolicyServiceGrpc.getCreateDataPolicyMethod = + getCreateDataPolicyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateDataPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy + .getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("CreateDataPolicy")) + .build(); + } + } + } + return getCreateDataPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getUpdateDataPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateDataPolicy", + requestType = com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest.class, + responseType = com.google.cloud.bigquery.datapolicies.v1.DataPolicy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getUpdateDataPolicyMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getUpdateDataPolicyMethod; + if ((getUpdateDataPolicyMethod = DataPolicyServiceGrpc.getUpdateDataPolicyMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getUpdateDataPolicyMethod = DataPolicyServiceGrpc.getUpdateDataPolicyMethod) == null) { + DataPolicyServiceGrpc.getUpdateDataPolicyMethod = + getUpdateDataPolicyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateDataPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy + .getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("UpdateDataPolicy")) + .build(); + } + } + } + return getUpdateDataPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getRenameDataPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "RenameDataPolicy", + requestType = com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest.class, + responseType = com.google.cloud.bigquery.datapolicies.v1.DataPolicy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getRenameDataPolicyMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getRenameDataPolicyMethod; + if ((getRenameDataPolicyMethod = DataPolicyServiceGrpc.getRenameDataPolicyMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getRenameDataPolicyMethod = DataPolicyServiceGrpc.getRenameDataPolicyMethod) == null) { + DataPolicyServiceGrpc.getRenameDataPolicyMethod = + getRenameDataPolicyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "RenameDataPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy + .getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("RenameDataPolicy")) + .build(); + } + } + } + return getRenameDataPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest, + com.google.protobuf.Empty> + getDeleteDataPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteDataPolicy", + requestType = com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest, + com.google.protobuf.Empty> + getDeleteDataPolicyMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest, + com.google.protobuf.Empty> + getDeleteDataPolicyMethod; + if ((getDeleteDataPolicyMethod = DataPolicyServiceGrpc.getDeleteDataPolicyMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getDeleteDataPolicyMethod = DataPolicyServiceGrpc.getDeleteDataPolicyMethod) == null) { + DataPolicyServiceGrpc.getDeleteDataPolicyMethod = + getDeleteDataPolicyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteDataPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("DeleteDataPolicy")) + .build(); + } + } + } + return getDeleteDataPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getGetDataPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetDataPolicy", + requestType = com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest.class, + responseType = com.google.cloud.bigquery.datapolicies.v1.DataPolicy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getGetDataPolicyMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getGetDataPolicyMethod; + if ((getGetDataPolicyMethod = DataPolicyServiceGrpc.getGetDataPolicyMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getGetDataPolicyMethod = DataPolicyServiceGrpc.getGetDataPolicyMethod) == null) { + DataPolicyServiceGrpc.getGetDataPolicyMethod = + getGetDataPolicyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetDataPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy + .getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("GetDataPolicy")) + .build(); + } + } + } + return getGetDataPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest, + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse> + getListDataPoliciesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListDataPolicies", + requestType = com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest.class, + responseType = com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest, + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse> + getListDataPoliciesMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest, + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse> + getListDataPoliciesMethod; + if ((getListDataPoliciesMethod = DataPolicyServiceGrpc.getListDataPoliciesMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getListDataPoliciesMethod = DataPolicyServiceGrpc.getListDataPoliciesMethod) == null) { + DataPolicyServiceGrpc.getListDataPoliciesMethod = + getListDataPoliciesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListDataPolicies")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("ListDataPolicies")) + .build(); + } + } + } + return getListDataPoliciesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> + getGetIamPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetIamPolicy", + requestType = com.google.iam.v1.GetIamPolicyRequest.class, + responseType = com.google.iam.v1.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> + getGetIamPolicyMethod() { + io.grpc.MethodDescriptor + getGetIamPolicyMethod; + if ((getGetIamPolicyMethod = DataPolicyServiceGrpc.getGetIamPolicyMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getGetIamPolicyMethod = DataPolicyServiceGrpc.getGetIamPolicyMethod) == null) { + DataPolicyServiceGrpc.getGetIamPolicyMethod = + getGetIamPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetIamPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.Policy.getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("GetIamPolicy")) + .build(); + } + } + } + return getGetIamPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> + getSetIamPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SetIamPolicy", + requestType = com.google.iam.v1.SetIamPolicyRequest.class, + responseType = com.google.iam.v1.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> + getSetIamPolicyMethod() { + io.grpc.MethodDescriptor + getSetIamPolicyMethod; + if ((getSetIamPolicyMethod = DataPolicyServiceGrpc.getSetIamPolicyMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getSetIamPolicyMethod = DataPolicyServiceGrpc.getSetIamPolicyMethod) == null) { + DataPolicyServiceGrpc.getSetIamPolicyMethod = + getSetIamPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetIamPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.Policy.getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("SetIamPolicy")) + .build(); + } + } + } + return getSetIamPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "TestIamPermissions", + requestType = com.google.iam.v1.TestIamPermissionsRequest.class, + responseType = com.google.iam.v1.TestIamPermissionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, + com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod; + if ((getTestIamPermissionsMethod = DataPolicyServiceGrpc.getTestIamPermissionsMethod) == null) { + synchronized (DataPolicyServiceGrpc.class) { + if ((getTestIamPermissionsMethod = DataPolicyServiceGrpc.getTestIamPermissionsMethod) + == null) { + DataPolicyServiceGrpc.getTestIamPermissionsMethod = + getTestIamPermissionsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "TestIamPermissions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.TestIamPermissionsResponse.getDefaultInstance())) + .setSchemaDescriptor( + new DataPolicyServiceMethodDescriptorSupplier("TestIamPermissions")) + .build(); + } + } + } + return getTestIamPermissionsMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static DataPolicyServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public DataPolicyServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DataPolicyServiceStub(channel, callOptions); + } + }; + return DataPolicyServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static DataPolicyServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public DataPolicyServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DataPolicyServiceBlockingStub(channel, callOptions); + } + }; + return DataPolicyServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static DataPolicyServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public DataPolicyServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DataPolicyServiceFutureStub(channel, callOptions); + } + }; + return DataPolicyServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Data Policy Service provides APIs for managing the label-policy bindings.
+   * 
+ */ + public abstract static class DataPolicyServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a new data policy under a project with the given `dataPolicyId`
+     * (used as the display name), policy tag, and data policy type.
+     * 
+ */ + public void createDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateDataPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the metadata for an existing data policy. The target data policy
+     * can be specified by the resource name.
+     * 
+ */ + public void updateDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateDataPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Renames the id (display name) of the specified data policy.
+     * 
+ */ + public void renameDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getRenameDataPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes the data policy specified by its resource name.
+     * 
+ */ + public void deleteDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteDataPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets the data policy specified by its resource name.
+     * 
+ */ + public void getDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetDataPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * List all of the data policies in the specified parent project.
+     * 
+ */ + public void listDataPolicies( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest request, + io.grpc.stub.StreamObserver< + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse> + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListDataPoliciesMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets the IAM policy for the specified data policy.
+     * 
+ */ + public void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetIamPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Sets the IAM policy for the specified data policy.
+     * 
+ */ + public void setIamPolicy( + com.google.iam.v1.SetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getSetIamPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns the caller's permission on the specified data policy resource.
+     * 
+ */ + public void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getTestIamPermissionsMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateDataPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy>( + this, METHODID_CREATE_DATA_POLICY))) + .addMethod( + getUpdateDataPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy>( + this, METHODID_UPDATE_DATA_POLICY))) + .addMethod( + getRenameDataPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy>( + this, METHODID_RENAME_DATA_POLICY))) + .addMethod( + getDeleteDataPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest, + com.google.protobuf.Empty>(this, METHODID_DELETE_DATA_POLICY))) + .addMethod( + getGetDataPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy>( + this, METHODID_GET_DATA_POLICY))) + .addMethod( + getListDataPoliciesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest, + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse>( + this, METHODID_LIST_DATA_POLICIES))) + .addMethod( + getGetIamPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>( + this, METHODID_GET_IAM_POLICY))) + .addMethod( + getSetIamPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>( + this, METHODID_SET_IAM_POLICY))) + .addMethod( + getTestIamPermissionsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.TestIamPermissionsRequest, + com.google.iam.v1.TestIamPermissionsResponse>( + this, METHODID_TEST_IAM_PERMISSIONS))) + .build(); + } + } + + /** + * + * + *
+   * Data Policy Service provides APIs for managing the label-policy bindings.
+   * 
+ */ + public static final class DataPolicyServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private DataPolicyServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DataPolicyServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DataPolicyServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new data policy under a project with the given `dataPolicyId`
+     * (used as the display name), policy tag, and data policy type.
+     * 
+ */ + public void createDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateDataPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the metadata for an existing data policy. The target data policy
+     * can be specified by the resource name.
+     * 
+ */ + public void updateDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateDataPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Renames the id (display name) of the specified data policy.
+     * 
+ */ + public void renameDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getRenameDataPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes the data policy specified by its resource name.
+     * 
+ */ + public void deleteDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteDataPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets the data policy specified by its resource name.
+     * 
+ */ + public void getDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetDataPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * List all of the data policies in the specified parent project.
+     * 
+ */ + public void listDataPolicies( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest request, + io.grpc.stub.StreamObserver< + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse> + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListDataPoliciesMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets the IAM policy for the specified data policy.
+     * 
+ */ + public void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Sets the IAM policy for the specified data policy.
+     * 
+ */ + public void setIamPolicy( + com.google.iam.v1.SetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns the caller's permission on the specified data policy resource.
+     * 
+ */ + public void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Data Policy Service provides APIs for managing the label-policy bindings.
+   * 
+ */ + public static final class DataPolicyServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private DataPolicyServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DataPolicyServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DataPolicyServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new data policy under a project with the given `dataPolicyId`
+     * (used as the display name), policy tag, and data policy type.
+     * 
+ */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy createDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateDataPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the metadata for an existing data policy. The target data policy
+     * can be specified by the resource name.
+     * 
+ */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy updateDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateDataPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Renames the id (display name) of the specified data policy.
+     * 
+ */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy renameDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getRenameDataPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes the data policy specified by its resource name.
+     * 
+ */ + public com.google.protobuf.Empty deleteDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteDataPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets the data policy specified by its resource name.
+     * 
+ */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetDataPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * List all of the data policies in the specified parent project.
+     * 
+ */ + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse listDataPolicies( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListDataPoliciesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets the IAM policy for the specified data policy.
+     * 
+ */ + public com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Sets the IAM policy for the specified data policy.
+     * 
+ */ + public com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns the caller's permission on the specified data policy resource.
+     * 
+ */ + public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getTestIamPermissionsMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Data Policy Service provides APIs for managing the label-policy bindings.
+   * 
+ */ + public static final class DataPolicyServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private DataPolicyServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DataPolicyServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DataPolicyServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new data policy under a project with the given `dataPolicyId`
+     * (used as the display name), policy tag, and data policy type.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + createDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateDataPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the metadata for an existing data policy. The target data policy
+     * can be specified by the resource name.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + updateDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateDataPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Renames the id (display name) of the specified data policy.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + renameDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getRenameDataPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes the data policy specified by its resource name.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteDataPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets the data policy specified by its resource name.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy> + getDataPolicy(com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetDataPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * List all of the data policies in the specified parent project.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse> + listDataPolicies( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListDataPoliciesMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets the IAM policy for the specified data policy.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Sets the IAM policy for the specified data policy.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns the caller's permission on the specified data policy resource.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.iam.v1.TestIamPermissionsResponse> + testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_DATA_POLICY = 0; + private static final int METHODID_UPDATE_DATA_POLICY = 1; + private static final int METHODID_RENAME_DATA_POLICY = 2; + private static final int METHODID_DELETE_DATA_POLICY = 3; + private static final int METHODID_GET_DATA_POLICY = 4; + private static final int METHODID_LIST_DATA_POLICIES = 5; + private static final int METHODID_GET_IAM_POLICY = 6; + private static final int METHODID_SET_IAM_POLICY = 7; + private static final int METHODID_TEST_IAM_PERMISSIONS = 8; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final DataPolicyServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(DataPolicyServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_DATA_POLICY: + serviceImpl.createDataPolicy( + (com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_DATA_POLICY: + serviceImpl.updateDataPolicy( + (com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_RENAME_DATA_POLICY: + serviceImpl.renameDataPolicy( + (com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DELETE_DATA_POLICY: + serviceImpl.deleteDataPolicy( + (com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_DATA_POLICY: + serviceImpl.getDataPolicy( + (com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_DATA_POLICIES: + serviceImpl.listDataPolicies( + (com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse>) + responseObserver); + break; + case METHODID_GET_IAM_POLICY: + serviceImpl.getIamPolicy( + (com.google.iam.v1.GetIamPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SET_IAM_POLICY: + serviceImpl.setIamPolicy( + (com.google.iam.v1.SetIamPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_TEST_IAM_PERMISSIONS: + serviceImpl.testIamPermissions( + (com.google.iam.v1.TestIamPermissionsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class DataPolicyServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + DataPolicyServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("DataPolicyService"); + } + } + + private static final class DataPolicyServiceFileDescriptorSupplier + extends DataPolicyServiceBaseDescriptorSupplier { + DataPolicyServiceFileDescriptorSupplier() {} + } + + private static final class DataPolicyServiceMethodDescriptorSupplier + extends DataPolicyServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + DataPolicyServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (DataPolicyServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new DataPolicyServiceFileDescriptorSupplier()) + .addMethod(getCreateDataPolicyMethod()) + .addMethod(getUpdateDataPolicyMethod()) + .addMethod(getRenameDataPolicyMethod()) + .addMethod(getDeleteDataPolicyMethod()) + .addMethod(getGetDataPolicyMethod()) + .addMethod(getListDataPoliciesMethod()) + .addMethod(getGetIamPolicyMethod()) + .addMethod(getSetIamPolicyMethod()) + .addMethod(getTestIamPermissionsMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-bigquerydatapolicy/pom.xml b/java-bigquerydatapolicy/pom.xml index 47c70d8b3390..092fddfb29c8 100644 --- a/java-bigquerydatapolicy/pom.xml +++ b/java-bigquerydatapolicy/pom.xml @@ -31,6 +31,16 @@ google-cloud-bigquerydatapolicy 0.4.0-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-bigquerydatapolicy-v1 + 0.4.0-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-bigquerydatapolicy-v1 + 0.4.0-SNAPSHOT + com.google.api.grpc grpc-google-cloud-bigquerydatapolicy-v1beta1 @@ -47,7 +57,9 @@ google-cloud-bigquerydatapolicy grpc-google-cloud-bigquerydatapolicy-v1beta1 + grpc-google-cloud-bigquerydatapolicy-v1 proto-google-cloud-bigquerydatapolicy-v1beta1 + proto-google-cloud-bigquerydatapolicy-v1 google-cloud-bigquerydatapolicy-bom diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/clirr-ignored-differences.xml b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/clirr-ignored-differences.xml new file mode 100644 index 000000000000..b4430731cfd7 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/cloud/bigquery/datapolicies/v1/*OrBuilder + * get*(*) + + + 7012 + com/google/cloud/bigquery/datapolicies/v1/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/cloud/bigquery/datapolicies/v1/*OrBuilder + boolean has*(*) + + diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/pom.xml b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/pom.xml new file mode 100644 index 000000000000..6b84b6a637e7 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-bigquerydatapolicy-v1 + 0.4.0-SNAPSHOT + proto-google-cloud-bigquerydatapolicy-v1 + Proto library for google-cloud-bigquerydatapolicy + + com.google.cloud + google-cloud-bigquerydatapolicy-parent + 0.4.0-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/CreateDataPolicyRequest.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/CreateDataPolicyRequest.java new file mode 100644 index 000000000000..1ebedda0745e --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/CreateDataPolicyRequest.java @@ -0,0 +1,949 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * Request message for the CreateDataPolicy method.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest} + */ +public final class CreateDataPolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) + CreateDataPolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateDataPolicyRequest.newBuilder() to construct. + private CreateDataPolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateDataPolicyRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateDataPolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Resource name of the project that the data policy will belong to.
+   * The format is `projects/{project_number}/locations/{location_id}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Resource name of the project that the data policy will belong to.
+   * The format is `projects/{project_number}/locations/{location_id}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DATA_POLICY_FIELD_NUMBER = 2; + private com.google.cloud.bigquery.datapolicies.v1.DataPolicy dataPolicy_; + /** + * + * + *
+   * Required. The data policy to create. The `name` field does not need to be
+   * provided for the data policy creation.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the dataPolicy field is set. + */ + @java.lang.Override + public boolean hasDataPolicy() { + return dataPolicy_ != null; + } + /** + * + * + *
+   * Required. The data policy to create. The `name` field does not need to be
+   * provided for the data policy creation.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The dataPolicy. + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicy() { + return dataPolicy_ == null + ? com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance() + : dataPolicy_; + } + /** + * + * + *
+   * Required. The data policy to create. The `name` field does not need to be
+   * provided for the data policy creation.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPolicyOrBuilder() { + return getDataPolicy(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (dataPolicy_ != null) { + output.writeMessage(2, getDataPolicy()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (dataPolicy_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDataPolicy()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest other = + (com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasDataPolicy() != other.hasDataPolicy()) return false; + if (hasDataPolicy()) { + if (!getDataPolicy().equals(other.getDataPolicy())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasDataPolicy()) { + hash = (37 * hash) + DATA_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getDataPolicy().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the CreateDataPolicy method.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest.Builder.class); + } + + // Construct using + // com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (dataPolicyBuilder_ == null) { + dataPolicy_ = null; + } else { + dataPolicy_ = null; + dataPolicyBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest + getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest build() { + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest result = + new com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest(this); + result.parent_ = parent_; + if (dataPolicyBuilder_ == null) { + result.dataPolicy_ = dataPolicy_; + } else { + result.dataPolicy_ = dataPolicyBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) { + return mergeFrom((com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest other) { + if (other + == com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasDataPolicy()) { + mergeDataPolicy(other.getDataPolicy()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + input.readMessage(getDataPolicyFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Resource name of the project that the data policy will belong to.
+     * The format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the project that the data policy will belong to.
+     * The format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the project that the data policy will belong to.
+     * The format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the project that the data policy will belong to.
+     * The format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the project that the data policy will belong to.
+     * The format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.bigquery.datapolicies.v1.DataPolicy dataPolicy_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder> + dataPolicyBuilder_; + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the dataPolicy field is set. + */ + public boolean hasDataPolicy() { + return dataPolicyBuilder_ != null || dataPolicy_ != null; + } + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The dataPolicy. + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicy() { + if (dataPolicyBuilder_ == null) { + return dataPolicy_ == null + ? com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance() + : dataPolicy_; + } else { + return dataPolicyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setDataPolicy(com.google.cloud.bigquery.datapolicies.v1.DataPolicy value) { + if (dataPolicyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + dataPolicy_ = value; + onChanged(); + } else { + dataPolicyBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder builderForValue) { + if (dataPolicyBuilder_ == null) { + dataPolicy_ = builderForValue.build(); + onChanged(); + } else { + dataPolicyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeDataPolicy(com.google.cloud.bigquery.datapolicies.v1.DataPolicy value) { + if (dataPolicyBuilder_ == null) { + if (dataPolicy_ != null) { + dataPolicy_ = + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.newBuilder(dataPolicy_) + .mergeFrom(value) + .buildPartial(); + } else { + dataPolicy_ = value; + } + onChanged(); + } else { + dataPolicyBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearDataPolicy() { + if (dataPolicyBuilder_ == null) { + dataPolicy_ = null; + onChanged(); + } else { + dataPolicy_ = null; + dataPolicyBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder getDataPolicyBuilder() { + + onChanged(); + return getDataPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPolicyOrBuilder() { + if (dataPolicyBuilder_ != null) { + return dataPolicyBuilder_.getMessageOrBuilder(); + } else { + return dataPolicy_ == null + ? com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance() + : dataPolicy_; + } + } + /** + * + * + *
+     * Required. The data policy to create. The `name` field does not need to be
+     * provided for the data policy creation.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder> + getDataPolicyFieldBuilder() { + if (dataPolicyBuilder_ == null) { + dataPolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder>( + getDataPolicy(), getParentForChildren(), isClean()); + dataPolicy_ = null; + } + return dataPolicyBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) + private static final com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateDataPolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/CreateDataPolicyRequestOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/CreateDataPolicyRequestOrBuilder.java new file mode 100644 index 000000000000..f3bdd25d920f --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/CreateDataPolicyRequestOrBuilder.java @@ -0,0 +1,100 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface CreateDataPolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Resource name of the project that the data policy will belong to.
+   * The format is `projects/{project_number}/locations/{location_id}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Resource name of the project that the data policy will belong to.
+   * The format is `projects/{project_number}/locations/{location_id}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The data policy to create. The `name` field does not need to be
+   * provided for the data policy creation.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the dataPolicy field is set. + */ + boolean hasDataPolicy(); + /** + * + * + *
+   * Required. The data policy to create. The `name` field does not need to be
+   * provided for the data policy creation.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The dataPolicy. + */ + com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicy(); + /** + * + * + *
+   * Required. The data policy to create. The `name` field does not need to be
+   * provided for the data policy creation.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPolicyOrBuilder(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicy.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicy.java new file mode 100644 index 000000000000..4fb7a922002d --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicy.java @@ -0,0 +1,960 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * The data masking policy that is used to specify data masking rule.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy} + */ +public final class DataMaskingPolicy extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) + DataMaskingPolicyOrBuilder { + private static final long serialVersionUID = 0L; + // Use DataMaskingPolicy.newBuilder() to construct. + private DataMaskingPolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DataMaskingPolicy() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DataMaskingPolicy(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.class, + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.Builder.class); + } + + /** + * + * + *
+   * The available masking rules. Learn more here:
+   * https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options.
+   * 
+ * + * Protobuf enum {@code + * google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression} + */ + public enum PredefinedExpression implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default, unspecified predefined expression. No masking will take place
+     * since no expression is specified.
+     * 
+ * + * PREDEFINED_EXPRESSION_UNSPECIFIED = 0; + */ + PREDEFINED_EXPRESSION_UNSPECIFIED(0), + /** + * + * + *
+     * Masking expression to replace data with SHA-256 hash.
+     * 
+ * + * SHA256 = 3; + */ + SHA256(3), + /** + * + * + *
+     * Masking expression to replace data with NULLs.
+     * 
+ * + * ALWAYS_NULL = 5; + */ + ALWAYS_NULL(5), + /** + * + * + *
+     * Masking expression to replace data with their default masking values.
+     * The default masking values for each type listed as below:
+     * * STRING: ""
+     * * BYTES: b''
+     * * INTEGER: 0
+     * * FLOAT: 0.0
+     * * NUMERIC: 0
+     * * BOOLEAN: FALSE
+     * * TIMESTAMP: 0001-01-01 00:00:00 UTC
+     * * DATE: 0001-01-01
+     * * TIME: 00:00:00
+     * * DATETIME: 0001-01-01T00:00:00
+     * * GEOGRAPHY: POINT(0 0)
+     * * BIGNUMERIC: 0
+     * * ARRAY: []
+     * * STRUCT: NOT_APPLICABLE
+     * * JSON: NULL
+     * 
+ * + * DEFAULT_MASKING_VALUE = 7; + */ + DEFAULT_MASKING_VALUE(7), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default, unspecified predefined expression. No masking will take place
+     * since no expression is specified.
+     * 
+ * + * PREDEFINED_EXPRESSION_UNSPECIFIED = 0; + */ + public static final int PREDEFINED_EXPRESSION_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Masking expression to replace data with SHA-256 hash.
+     * 
+ * + * SHA256 = 3; + */ + public static final int SHA256_VALUE = 3; + /** + * + * + *
+     * Masking expression to replace data with NULLs.
+     * 
+ * + * ALWAYS_NULL = 5; + */ + public static final int ALWAYS_NULL_VALUE = 5; + /** + * + * + *
+     * Masking expression to replace data with their default masking values.
+     * The default masking values for each type listed as below:
+     * * STRING: ""
+     * * BYTES: b''
+     * * INTEGER: 0
+     * * FLOAT: 0.0
+     * * NUMERIC: 0
+     * * BOOLEAN: FALSE
+     * * TIMESTAMP: 0001-01-01 00:00:00 UTC
+     * * DATE: 0001-01-01
+     * * TIME: 00:00:00
+     * * DATETIME: 0001-01-01T00:00:00
+     * * GEOGRAPHY: POINT(0 0)
+     * * BIGNUMERIC: 0
+     * * ARRAY: []
+     * * STRUCT: NOT_APPLICABLE
+     * * JSON: NULL
+     * 
+ * + * DEFAULT_MASKING_VALUE = 7; + */ + public static final int DEFAULT_MASKING_VALUE_VALUE = 7; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PredefinedExpression valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static PredefinedExpression forNumber(int value) { + switch (value) { + case 0: + return PREDEFINED_EXPRESSION_UNSPECIFIED; + case 3: + return SHA256; + case 5: + return ALWAYS_NULL; + case 7: + return DEFAULT_MASKING_VALUE; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public PredefinedExpression findValueByNumber(int number) { + return PredefinedExpression.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final PredefinedExpression[] VALUES = values(); + + public static PredefinedExpression valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private PredefinedExpression(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression) + } + + private int maskingExpressionCase_ = 0; + private java.lang.Object maskingExpression_; + + public enum MaskingExpressionCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + PREDEFINED_EXPRESSION(1), + MASKINGEXPRESSION_NOT_SET(0); + private final int value; + + private MaskingExpressionCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MaskingExpressionCase valueOf(int value) { + return forNumber(value); + } + + public static MaskingExpressionCase forNumber(int value) { + switch (value) { + case 1: + return PREDEFINED_EXPRESSION; + case 0: + return MASKINGEXPRESSION_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public MaskingExpressionCase getMaskingExpressionCase() { + return MaskingExpressionCase.forNumber(maskingExpressionCase_); + } + + public static final int PREDEFINED_EXPRESSION_FIELD_NUMBER = 1; + /** + * + * + *
+   * A predefined masking expression.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return Whether the predefinedExpression field is set. + */ + public boolean hasPredefinedExpression() { + return maskingExpressionCase_ == 1; + } + /** + * + * + *
+   * A predefined masking expression.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return The enum numeric value on the wire for predefinedExpression. + */ + public int getPredefinedExpressionValue() { + if (maskingExpressionCase_ == 1) { + return (java.lang.Integer) maskingExpression_; + } + return 0; + } + /** + * + * + *
+   * A predefined masking expression.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return The predefinedExpression. + */ + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression + getPredefinedExpression() { + if (maskingExpressionCase_ == 1) { + @SuppressWarnings("deprecation") + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression result = + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression.valueOf( + (java.lang.Integer) maskingExpression_); + return result == null + ? com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression + .UNRECOGNIZED + : result; + } + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression + .PREDEFINED_EXPRESSION_UNSPECIFIED; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (maskingExpressionCase_ == 1) { + output.writeEnum(1, ((java.lang.Integer) maskingExpression_)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (maskingExpressionCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeEnumSize( + 1, ((java.lang.Integer) maskingExpression_)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy other = + (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) obj; + + if (!getMaskingExpressionCase().equals(other.getMaskingExpressionCase())) return false; + switch (maskingExpressionCase_) { + case 1: + if (getPredefinedExpressionValue() != other.getPredefinedExpressionValue()) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (maskingExpressionCase_) { + case 1: + hash = (37 * hash) + PREDEFINED_EXPRESSION_FIELD_NUMBER; + hash = (53 * hash) + getPredefinedExpressionValue(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The data masking policy that is used to specify data masking rule.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.class, + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.Builder.class); + } + + // Construct using com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + maskingExpressionCase_ = 0; + maskingExpression_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy build() { + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy result = + new com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy(this); + if (maskingExpressionCase_ == 1) { + result.maskingExpression_ = maskingExpression_; + } + result.maskingExpressionCase_ = maskingExpressionCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) { + return mergeFrom((com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy other) { + if (other == com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDefaultInstance()) + return this; + switch (other.getMaskingExpressionCase()) { + case PREDEFINED_EXPRESSION: + { + setPredefinedExpressionValue(other.getPredefinedExpressionValue()); + break; + } + case MASKINGEXPRESSION_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + maskingExpressionCase_ = 1; + maskingExpression_ = rawValue; + break; + } // case 8 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int maskingExpressionCase_ = 0; + private java.lang.Object maskingExpression_; + + public MaskingExpressionCase getMaskingExpressionCase() { + return MaskingExpressionCase.forNumber(maskingExpressionCase_); + } + + public Builder clearMaskingExpression() { + maskingExpressionCase_ = 0; + maskingExpression_ = null; + onChanged(); + return this; + } + + /** + * + * + *
+     * A predefined masking expression.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return Whether the predefinedExpression field is set. + */ + @java.lang.Override + public boolean hasPredefinedExpression() { + return maskingExpressionCase_ == 1; + } + /** + * + * + *
+     * A predefined masking expression.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return The enum numeric value on the wire for predefinedExpression. + */ + @java.lang.Override + public int getPredefinedExpressionValue() { + if (maskingExpressionCase_ == 1) { + return ((java.lang.Integer) maskingExpression_).intValue(); + } + return 0; + } + /** + * + * + *
+     * A predefined masking expression.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @param value The enum numeric value on the wire for predefinedExpression to set. + * @return This builder for chaining. + */ + public Builder setPredefinedExpressionValue(int value) { + maskingExpressionCase_ = 1; + maskingExpression_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A predefined masking expression.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return The predefinedExpression. + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression + getPredefinedExpression() { + if (maskingExpressionCase_ == 1) { + @SuppressWarnings("deprecation") + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression result = + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression + .valueOf((java.lang.Integer) maskingExpression_); + return result == null + ? com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression + .UNRECOGNIZED + : result; + } + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression + .PREDEFINED_EXPRESSION_UNSPECIFIED; + } + /** + * + * + *
+     * A predefined masking expression.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @param value The predefinedExpression to set. + * @return This builder for chaining. + */ + public Builder setPredefinedExpression( + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression value) { + if (value == null) { + throw new NullPointerException(); + } + maskingExpressionCase_ = 1; + maskingExpression_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * A predefined masking expression.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return This builder for chaining. + */ + public Builder clearPredefinedExpression() { + if (maskingExpressionCase_ == 1) { + maskingExpressionCase_ = 0; + maskingExpression_ = null; + onChanged(); + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) + private static final com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DataMaskingPolicy parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicyOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicyOrBuilder.java new file mode 100644 index 000000000000..df62045bbf75 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicyOrBuilder.java @@ -0,0 +1,72 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface DataMaskingPolicyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A predefined masking expression.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return Whether the predefinedExpression field is set. + */ + boolean hasPredefinedExpression(); + /** + * + * + *
+   * A predefined masking expression.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return The enum numeric value on the wire for predefinedExpression. + */ + int getPredefinedExpressionValue(); + /** + * + * + *
+   * A predefined masking expression.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression predefined_expression = 1; + * + * + * @return The predefinedExpression. + */ + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression + getPredefinedExpression(); + + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.MaskingExpressionCase + getMaskingExpressionCase(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicy.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicy.java new file mode 100644 index 000000000000..ef7b6ed1afa2 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicy.java @@ -0,0 +1,1854 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * Represents the label-policy binding.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.DataPolicy} + */ +public final class DataPolicy extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.DataPolicy) + DataPolicyOrBuilder { + private static final long serialVersionUID = 0L; + // Use DataPolicy.newBuilder() to construct. + private DataPolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DataPolicy() { + name_ = ""; + dataPolicyType_ = 0; + dataPolicyId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DataPolicy(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.class, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder.class); + } + + /** + * + * + *
+   * A list of supported data policy types.
+   * 
+ * + * Protobuf enum {@code google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType} + */ + public enum DataPolicyType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value for the data policy type. This should not be used.
+     * 
+ * + * DATA_POLICY_TYPE_UNSPECIFIED = 0; + */ + DATA_POLICY_TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * Used to create a data policy for column-level security, without data
+     * masking.
+     * 
+ * + * COLUMN_LEVEL_SECURITY_POLICY = 3; + */ + COLUMN_LEVEL_SECURITY_POLICY(3), + /** + * + * + *
+     * Used to create a data policy for data masking.
+     * 
+ * + * DATA_MASKING_POLICY = 2; + */ + DATA_MASKING_POLICY(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value for the data policy type. This should not be used.
+     * 
+ * + * DATA_POLICY_TYPE_UNSPECIFIED = 0; + */ + public static final int DATA_POLICY_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Used to create a data policy for column-level security, without data
+     * masking.
+     * 
+ * + * COLUMN_LEVEL_SECURITY_POLICY = 3; + */ + public static final int COLUMN_LEVEL_SECURITY_POLICY_VALUE = 3; + /** + * + * + *
+     * Used to create a data policy for data masking.
+     * 
+ * + * DATA_MASKING_POLICY = 2; + */ + public static final int DATA_MASKING_POLICY_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DataPolicyType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static DataPolicyType forNumber(int value) { + switch (value) { + case 0: + return DATA_POLICY_TYPE_UNSPECIFIED; + case 3: + return COLUMN_LEVEL_SECURITY_POLICY; + case 2: + return DATA_MASKING_POLICY; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public DataPolicyType findValueByNumber(int number) { + return DataPolicyType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final DataPolicyType[] VALUES = values(); + + public static DataPolicyType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private DataPolicyType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType) + } + + private int matchingLabelCase_ = 0; + private java.lang.Object matchingLabel_; + + public enum MatchingLabelCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + POLICY_TAG(4), + MATCHINGLABEL_NOT_SET(0); + private final int value; + + private MatchingLabelCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MatchingLabelCase valueOf(int value) { + return forNumber(value); + } + + public static MatchingLabelCase forNumber(int value) { + switch (value) { + case 4: + return POLICY_TAG; + case 0: + return MATCHINGLABEL_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public MatchingLabelCase getMatchingLabelCase() { + return MatchingLabelCase.forNumber(matchingLabelCase_); + } + + private int policyCase_ = 0; + private java.lang.Object policy_; + + public enum PolicyCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + DATA_MASKING_POLICY(5), + POLICY_NOT_SET(0); + private final int value; + + private PolicyCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PolicyCase valueOf(int value) { + return forNumber(value); + } + + public static PolicyCase forNumber(int value) { + switch (value) { + case 5: + return DATA_MASKING_POLICY; + case 0: + return POLICY_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public PolicyCase getPolicyCase() { + return PolicyCase.forNumber(policyCase_); + } + + public static final int POLICY_TAG_FIELD_NUMBER = 4; + /** + * + * + *
+   * Policy tag resource name, in the format of
+   * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+   * 
+ * + * string policy_tag = 4; + * + * @return Whether the policyTag field is set. + */ + public boolean hasPolicyTag() { + return matchingLabelCase_ == 4; + } + /** + * + * + *
+   * Policy tag resource name, in the format of
+   * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+   * 
+ * + * string policy_tag = 4; + * + * @return The policyTag. + */ + public java.lang.String getPolicyTag() { + java.lang.Object ref = ""; + if (matchingLabelCase_ == 4) { + ref = matchingLabel_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (matchingLabelCase_ == 4) { + matchingLabel_ = s; + } + return s; + } + } + /** + * + * + *
+   * Policy tag resource name, in the format of
+   * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+   * 
+ * + * string policy_tag = 4; + * + * @return The bytes for policyTag. + */ + public com.google.protobuf.ByteString getPolicyTagBytes() { + java.lang.Object ref = ""; + if (matchingLabelCase_ == 4) { + ref = matchingLabel_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (matchingLabelCase_ == 4) { + matchingLabel_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DATA_MASKING_POLICY_FIELD_NUMBER = 5; + /** + * + * + *
+   * The data masking policy that specifies the data masking rule to use.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + * @return Whether the dataMaskingPolicy field is set. + */ + @java.lang.Override + public boolean hasDataMaskingPolicy() { + return policyCase_ == 5; + } + /** + * + * + *
+   * The data masking policy that specifies the data masking rule to use.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + * @return The dataMaskingPolicy. + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy getDataMaskingPolicy() { + if (policyCase_ == 5) { + return (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) policy_; + } + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDefaultInstance(); + } + /** + * + * + *
+   * The data masking policy that specifies the data masking rule to use.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicyOrBuilder + getDataMaskingPolicyOrBuilder() { + if (policyCase_ == 5) { + return (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) policy_; + } + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDefaultInstance(); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. Resource name of this data policy, in the format of
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Resource name of this data policy, in the format of
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DATA_POLICY_TYPE_FIELD_NUMBER = 2; + private int dataPolicyType_; + /** + * + * + *
+   * Type of data policy.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @return The enum numeric value on the wire for dataPolicyType. + */ + @java.lang.Override + public int getDataPolicyTypeValue() { + return dataPolicyType_; + } + /** + * + * + *
+   * Type of data policy.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @return The dataPolicyType. + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType getDataPolicyType() { + @SuppressWarnings("deprecation") + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType result = + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType.valueOf( + dataPolicyType_); + return result == null + ? com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType.UNRECOGNIZED + : result; + } + + public static final int DATA_POLICY_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object dataPolicyId_; + /** + * + * + *
+   * User-assigned (human readable) ID of the data policy that needs to be
+   * unique within a project. Used as {data_policy_id} in part of the resource
+   * name.
+   * 
+ * + * string data_policy_id = 3; + * + * @return The dataPolicyId. + */ + @java.lang.Override + public java.lang.String getDataPolicyId() { + java.lang.Object ref = dataPolicyId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + dataPolicyId_ = s; + return s; + } + } + /** + * + * + *
+   * User-assigned (human readable) ID of the data policy that needs to be
+   * unique within a project. Used as {data_policy_id} in part of the resource
+   * name.
+   * 
+ * + * string data_policy_id = 3; + * + * @return The bytes for dataPolicyId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDataPolicyIdBytes() { + java.lang.Object ref = dataPolicyId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + dataPolicyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (dataPolicyType_ + != com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType + .DATA_POLICY_TYPE_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, dataPolicyType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(dataPolicyId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, dataPolicyId_); + } + if (matchingLabelCase_ == 4) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, matchingLabel_); + } + if (policyCase_ == 5) { + output.writeMessage(5, (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) policy_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (dataPolicyType_ + != com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType + .DATA_POLICY_TYPE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, dataPolicyType_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(dataPolicyId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, dataPolicyId_); + } + if (matchingLabelCase_ == 4) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, matchingLabel_); + } + if (policyCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) policy_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.DataPolicy)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.DataPolicy other = + (com.google.cloud.bigquery.datapolicies.v1.DataPolicy) obj; + + if (!getName().equals(other.getName())) return false; + if (dataPolicyType_ != other.dataPolicyType_) return false; + if (!getDataPolicyId().equals(other.getDataPolicyId())) return false; + if (!getMatchingLabelCase().equals(other.getMatchingLabelCase())) return false; + switch (matchingLabelCase_) { + case 4: + if (!getPolicyTag().equals(other.getPolicyTag())) return false; + break; + case 0: + default: + } + if (!getPolicyCase().equals(other.getPolicyCase())) return false; + switch (policyCase_) { + case 5: + if (!getDataMaskingPolicy().equals(other.getDataMaskingPolicy())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DATA_POLICY_TYPE_FIELD_NUMBER; + hash = (53 * hash) + dataPolicyType_; + hash = (37 * hash) + DATA_POLICY_ID_FIELD_NUMBER; + hash = (53 * hash) + getDataPolicyId().hashCode(); + switch (matchingLabelCase_) { + case 4: + hash = (37 * hash) + POLICY_TAG_FIELD_NUMBER; + hash = (53 * hash) + getPolicyTag().hashCode(); + break; + case 0: + default: + } + switch (policyCase_) { + case 5: + hash = (37 * hash) + DATA_MASKING_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getDataMaskingPolicy().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.bigquery.datapolicies.v1.DataPolicy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents the label-policy binding.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.DataPolicy} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.DataPolicy) + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.class, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder.class); + } + + // Construct using com.google.cloud.bigquery.datapolicies.v1.DataPolicy.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (dataMaskingPolicyBuilder_ != null) { + dataMaskingPolicyBuilder_.clear(); + } + name_ = ""; + + dataPolicyType_ = 0; + + dataPolicyId_ = ""; + + matchingLabelCase_ = 0; + matchingLabel_ = null; + policyCase_ = 0; + policy_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy build() { + com.google.cloud.bigquery.datapolicies.v1.DataPolicy result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.DataPolicy result = + new com.google.cloud.bigquery.datapolicies.v1.DataPolicy(this); + if (matchingLabelCase_ == 4) { + result.matchingLabel_ = matchingLabel_; + } + if (policyCase_ == 5) { + if (dataMaskingPolicyBuilder_ == null) { + result.policy_ = policy_; + } else { + result.policy_ = dataMaskingPolicyBuilder_.build(); + } + } + result.name_ = name_; + result.dataPolicyType_ = dataPolicyType_; + result.dataPolicyId_ = dataPolicyId_; + result.matchingLabelCase_ = matchingLabelCase_; + result.policyCase_ = policyCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.DataPolicy) { + return mergeFrom((com.google.cloud.bigquery.datapolicies.v1.DataPolicy) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.bigquery.datapolicies.v1.DataPolicy other) { + if (other == com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.dataPolicyType_ != 0) { + setDataPolicyTypeValue(other.getDataPolicyTypeValue()); + } + if (!other.getDataPolicyId().isEmpty()) { + dataPolicyId_ = other.dataPolicyId_; + onChanged(); + } + switch (other.getMatchingLabelCase()) { + case POLICY_TAG: + { + matchingLabelCase_ = 4; + matchingLabel_ = other.matchingLabel_; + onChanged(); + break; + } + case MATCHINGLABEL_NOT_SET: + { + break; + } + } + switch (other.getPolicyCase()) { + case DATA_MASKING_POLICY: + { + mergeDataMaskingPolicy(other.getDataMaskingPolicy()); + break; + } + case POLICY_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 16: + { + dataPolicyType_ = input.readEnum(); + + break; + } // case 16 + case 26: + { + dataPolicyId_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + matchingLabelCase_ = 4; + matchingLabel_ = s; + break; + } // case 34 + case 42: + { + input.readMessage( + getDataMaskingPolicyFieldBuilder().getBuilder(), extensionRegistry); + policyCase_ = 5; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int matchingLabelCase_ = 0; + private java.lang.Object matchingLabel_; + + public MatchingLabelCase getMatchingLabelCase() { + return MatchingLabelCase.forNumber(matchingLabelCase_); + } + + public Builder clearMatchingLabel() { + matchingLabelCase_ = 0; + matchingLabel_ = null; + onChanged(); + return this; + } + + private int policyCase_ = 0; + private java.lang.Object policy_; + + public PolicyCase getPolicyCase() { + return PolicyCase.forNumber(policyCase_); + } + + public Builder clearPolicy() { + policyCase_ = 0; + policy_ = null; + onChanged(); + return this; + } + + /** + * + * + *
+     * Policy tag resource name, in the format of
+     * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+     * 
+ * + * string policy_tag = 4; + * + * @return Whether the policyTag field is set. + */ + @java.lang.Override + public boolean hasPolicyTag() { + return matchingLabelCase_ == 4; + } + /** + * + * + *
+     * Policy tag resource name, in the format of
+     * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+     * 
+ * + * string policy_tag = 4; + * + * @return The policyTag. + */ + @java.lang.Override + public java.lang.String getPolicyTag() { + java.lang.Object ref = ""; + if (matchingLabelCase_ == 4) { + ref = matchingLabel_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (matchingLabelCase_ == 4) { + matchingLabel_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Policy tag resource name, in the format of
+     * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+     * 
+ * + * string policy_tag = 4; + * + * @return The bytes for policyTag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPolicyTagBytes() { + java.lang.Object ref = ""; + if (matchingLabelCase_ == 4) { + ref = matchingLabel_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (matchingLabelCase_ == 4) { + matchingLabel_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Policy tag resource name, in the format of
+     * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+     * 
+ * + * string policy_tag = 4; + * + * @param value The policyTag to set. + * @return This builder for chaining. + */ + public Builder setPolicyTag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + matchingLabelCase_ = 4; + matchingLabel_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Policy tag resource name, in the format of
+     * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+     * 
+ * + * string policy_tag = 4; + * + * @return This builder for chaining. + */ + public Builder clearPolicyTag() { + if (matchingLabelCase_ == 4) { + matchingLabelCase_ = 0; + matchingLabel_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Policy tag resource name, in the format of
+     * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+     * 
+ * + * string policy_tag = 4; + * + * @param value The bytes for policyTag to set. + * @return This builder for chaining. + */ + public Builder setPolicyTagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + matchingLabelCase_ = 4; + matchingLabel_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicyOrBuilder> + dataMaskingPolicyBuilder_; + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + * + * @return Whether the dataMaskingPolicy field is set. + */ + @java.lang.Override + public boolean hasDataMaskingPolicy() { + return policyCase_ == 5; + } + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + * + * @return The dataMaskingPolicy. + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy getDataMaskingPolicy() { + if (dataMaskingPolicyBuilder_ == null) { + if (policyCase_ == 5) { + return (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) policy_; + } + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDefaultInstance(); + } else { + if (policyCase_ == 5) { + return dataMaskingPolicyBuilder_.getMessage(); + } + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDefaultInstance(); + } + } + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + */ + public Builder setDataMaskingPolicy( + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy value) { + if (dataMaskingPolicyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + policy_ = value; + onChanged(); + } else { + dataMaskingPolicyBuilder_.setMessage(value); + } + policyCase_ = 5; + return this; + } + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + */ + public Builder setDataMaskingPolicy( + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.Builder builderForValue) { + if (dataMaskingPolicyBuilder_ == null) { + policy_ = builderForValue.build(); + onChanged(); + } else { + dataMaskingPolicyBuilder_.setMessage(builderForValue.build()); + } + policyCase_ = 5; + return this; + } + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + */ + public Builder mergeDataMaskingPolicy( + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy value) { + if (dataMaskingPolicyBuilder_ == null) { + if (policyCase_ == 5 + && policy_ + != com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy + .getDefaultInstance()) { + policy_ = + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.newBuilder( + (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) policy_) + .mergeFrom(value) + .buildPartial(); + } else { + policy_ = value; + } + onChanged(); + } else { + if (policyCase_ == 5) { + dataMaskingPolicyBuilder_.mergeFrom(value); + } else { + dataMaskingPolicyBuilder_.setMessage(value); + } + } + policyCase_ = 5; + return this; + } + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + */ + public Builder clearDataMaskingPolicy() { + if (dataMaskingPolicyBuilder_ == null) { + if (policyCase_ == 5) { + policyCase_ = 0; + policy_ = null; + onChanged(); + } + } else { + if (policyCase_ == 5) { + policyCase_ = 0; + policy_ = null; + } + dataMaskingPolicyBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + */ + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.Builder + getDataMaskingPolicyBuilder() { + return getDataMaskingPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicyOrBuilder + getDataMaskingPolicyOrBuilder() { + if ((policyCase_ == 5) && (dataMaskingPolicyBuilder_ != null)) { + return dataMaskingPolicyBuilder_.getMessageOrBuilder(); + } else { + if (policyCase_ == 5) { + return (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) policy_; + } + return com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDefaultInstance(); + } + } + /** + * + * + *
+     * The data masking policy that specifies the data masking rule to use.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicyOrBuilder> + getDataMaskingPolicyFieldBuilder() { + if (dataMaskingPolicyBuilder_ == null) { + if (!(policyCase_ == 5)) { + policy_ = + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.getDefaultInstance(); + } + dataMaskingPolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicyOrBuilder>( + (com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy) policy_, + getParentForChildren(), + isClean()); + policy_ = null; + } + policyCase_ = 5; + onChanged(); + ; + return dataMaskingPolicyBuilder_; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. Resource name of this data policy, in the format of
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Resource name of this data policy, in the format of
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Resource name of this data policy, in the format of
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Resource name of this data policy, in the format of
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Resource name of this data policy, in the format of
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private int dataPolicyType_ = 0; + /** + * + * + *
+     * Type of data policy.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @return The enum numeric value on the wire for dataPolicyType. + */ + @java.lang.Override + public int getDataPolicyTypeValue() { + return dataPolicyType_; + } + /** + * + * + *
+     * Type of data policy.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @param value The enum numeric value on the wire for dataPolicyType to set. + * @return This builder for chaining. + */ + public Builder setDataPolicyTypeValue(int value) { + + dataPolicyType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Type of data policy.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @return The dataPolicyType. + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType getDataPolicyType() { + @SuppressWarnings("deprecation") + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType result = + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType.valueOf( + dataPolicyType_); + return result == null + ? com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Type of data policy.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @param value The dataPolicyType to set. + * @return This builder for chaining. + */ + public Builder setDataPolicyType( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType value) { + if (value == null) { + throw new NullPointerException(); + } + + dataPolicyType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Type of data policy.
+     * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @return This builder for chaining. + */ + public Builder clearDataPolicyType() { + + dataPolicyType_ = 0; + onChanged(); + return this; + } + + private java.lang.Object dataPolicyId_ = ""; + /** + * + * + *
+     * User-assigned (human readable) ID of the data policy that needs to be
+     * unique within a project. Used as {data_policy_id} in part of the resource
+     * name.
+     * 
+ * + * string data_policy_id = 3; + * + * @return The dataPolicyId. + */ + public java.lang.String getDataPolicyId() { + java.lang.Object ref = dataPolicyId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + dataPolicyId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * User-assigned (human readable) ID of the data policy that needs to be
+     * unique within a project. Used as {data_policy_id} in part of the resource
+     * name.
+     * 
+ * + * string data_policy_id = 3; + * + * @return The bytes for dataPolicyId. + */ + public com.google.protobuf.ByteString getDataPolicyIdBytes() { + java.lang.Object ref = dataPolicyId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + dataPolicyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * User-assigned (human readable) ID of the data policy that needs to be
+     * unique within a project. Used as {data_policy_id} in part of the resource
+     * name.
+     * 
+ * + * string data_policy_id = 3; + * + * @param value The dataPolicyId to set. + * @return This builder for chaining. + */ + public Builder setDataPolicyId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + dataPolicyId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * User-assigned (human readable) ID of the data policy that needs to be
+     * unique within a project. Used as {data_policy_id} in part of the resource
+     * name.
+     * 
+ * + * string data_policy_id = 3; + * + * @return This builder for chaining. + */ + public Builder clearDataPolicyId() { + + dataPolicyId_ = getDefaultInstance().getDataPolicyId(); + onChanged(); + return this; + } + /** + * + * + *
+     * User-assigned (human readable) ID of the data policy that needs to be
+     * unique within a project. Used as {data_policy_id} in part of the resource
+     * name.
+     * 
+ * + * string data_policy_id = 3; + * + * @param value The bytes for dataPolicyId to set. + * @return This builder for chaining. + */ + public Builder setDataPolicyIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + dataPolicyId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.DataPolicy) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.DataPolicy) + private static final com.google.cloud.bigquery.datapolicies.v1.DataPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.DataPolicy(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DataPolicy parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyName.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyName.java new file mode 100644 index 000000000000..db6f06b34518 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyName.java @@ -0,0 +1,223 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +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. +@Generated("by gapic-generator-java") +public class DataPolicyName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_DATA_POLICY = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/dataPolicies/{data_policy}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String dataPolicy; + + @Deprecated + protected DataPolicyName() { + project = null; + location = null; + dataPolicy = null; + } + + private DataPolicyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + dataPolicy = Preconditions.checkNotNull(builder.getDataPolicy()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getDataPolicy() { + return dataPolicy; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static DataPolicyName of(String project, String location, String dataPolicy) { + return newBuilder().setProject(project).setLocation(location).setDataPolicy(dataPolicy).build(); + } + + public static String format(String project, String location, String dataPolicy) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setDataPolicy(dataPolicy) + .build() + .toString(); + } + + public static DataPolicyName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_DATA_POLICY.validatedMatch( + formattedString, "DataPolicyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("data_policy")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (DataPolicyName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_DATA_POLICY.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (dataPolicy != null) { + fieldMapBuilder.put("data_policy", dataPolicy); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_DATA_POLICY.instantiate( + "project", project, "location", location, "data_policy", dataPolicy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + DataPolicyName that = ((DataPolicyName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.dataPolicy, that.dataPolicy); + } + 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(dataPolicy); + return h; + } + + /** Builder for projects/{project}/locations/{location}/dataPolicies/{data_policy}. */ + public static class Builder { + private String project; + private String location; + private String dataPolicy; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getDataPolicy() { + return dataPolicy; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setDataPolicy(String dataPolicy) { + this.dataPolicy = dataPolicy; + return this; + } + + private Builder(DataPolicyName dataPolicyName) { + this.project = dataPolicyName.project; + this.location = dataPolicyName.location; + this.dataPolicy = dataPolicyName.dataPolicy; + } + + public DataPolicyName build() { + return new DataPolicyName(this); + } + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyOrBuilder.java new file mode 100644 index 000000000000..a15da5c0b364 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyOrBuilder.java @@ -0,0 +1,189 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface DataPolicyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.DataPolicy) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Policy tag resource name, in the format of
+   * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+   * 
+ * + * string policy_tag = 4; + * + * @return Whether the policyTag field is set. + */ + boolean hasPolicyTag(); + /** + * + * + *
+   * Policy tag resource name, in the format of
+   * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+   * 
+ * + * string policy_tag = 4; + * + * @return The policyTag. + */ + java.lang.String getPolicyTag(); + /** + * + * + *
+   * Policy tag resource name, in the format of
+   * `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`.
+   * 
+ * + * string policy_tag = 4; + * + * @return The bytes for policyTag. + */ + com.google.protobuf.ByteString getPolicyTagBytes(); + + /** + * + * + *
+   * The data masking policy that specifies the data masking rule to use.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + * @return Whether the dataMaskingPolicy field is set. + */ + boolean hasDataMaskingPolicy(); + /** + * + * + *
+   * The data masking policy that specifies the data masking rule to use.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + * + * @return The dataMaskingPolicy. + */ + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy getDataMaskingPolicy(); + /** + * + * + *
+   * The data masking policy that specifies the data masking rule to use.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy data_masking_policy = 5; + */ + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicyOrBuilder + getDataMaskingPolicyOrBuilder(); + + /** + * + * + *
+   * Output only. Resource name of this data policy, in the format of
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. Resource name of this data policy, in the format of
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Type of data policy.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @return The enum numeric value on the wire for dataPolicyType. + */ + int getDataPolicyTypeValue(); + /** + * + * + *
+   * Type of data policy.
+   * 
+ * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType data_policy_type = 2; + * + * + * @return The dataPolicyType. + */ + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType getDataPolicyType(); + + /** + * + * + *
+   * User-assigned (human readable) ID of the data policy that needs to be
+   * unique within a project. Used as {data_policy_id} in part of the resource
+   * name.
+   * 
+ * + * string data_policy_id = 3; + * + * @return The dataPolicyId. + */ + java.lang.String getDataPolicyId(); + /** + * + * + *
+   * User-assigned (human readable) ID of the data policy that needs to be
+   * unique within a project. Used as {data_policy_id} in part of the resource
+   * name.
+   * 
+ * + * string data_policy_id = 3; + * + * @return The bytes for dataPolicyId. + */ + com.google.protobuf.ByteString getDataPolicyIdBytes(); + + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.MatchingLabelCase + getMatchingLabelCase(); + + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.PolicyCase getPolicyCase(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyProto.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyProto.java new file mode 100644 index 000000000000..b145152d9d6d --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyProto.java @@ -0,0 +1,295 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public final class DataPolicyProto { + private DataPolicyProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n6google/cloud/bigquery/datapolicies/v1/" + + "datapolicy.proto\022%google.cloud.bigquery." + + "datapolicies.v1\032\034google/api/annotations." + + "proto\032\027google/api/client.proto\032\037google/a" + + "pi/field_behavior.proto\032\031google/api/reso" + + "urce.proto\032\036google/iam/v1/iam_policy.pro" + + "to\032\032google/iam/v1/policy.proto\032\033google/p" + + "rotobuf/empty.proto\032 google/protobuf/fie" + + "ld_mask.proto\"\254\001\n\027CreateDataPolicyReques" + + "t\022D\n\006parent\030\001 \001(\tB4\340A\002\372A.\022,bigquerydatap" + + "olicy.googleapis.com/DataPolicy\022K\n\013data_" + + "policy\030\002 \001(\01321.google.cloud.bigquery.dat" + + "apolicies.v1.DataPolicyB\003\340A\002\"\227\001\n\027UpdateD" + + "ataPolicyRequest\022K\n\013data_policy\030\001 \001(\01321." + + "google.cloud.bigquery.datapolicies.v1.Da" + + "taPolicyB\003\340A\002\022/\n\013update_mask\030\002 \001(\0132\032.goo" + + "gle.protobuf.FieldMask\"M\n\027RenameDataPoli" + + "cyRequest\022\021\n\004name\030\001 \001(\tB\003\340A\002\022\037\n\022new_data" + + "_policy_id\030\002 \001(\tB\003\340A\002\"]\n\027DeleteDataPolic" + + "yRequest\022B\n\004name\030\001 \001(\tB4\340A\002\372A.\n,bigquery" + + "datapolicy.googleapis.com/DataPolicy\"Z\n\024" + + "GetDataPolicyRequest\022B\n\004name\030\001 \001(\tB4\340A\002\372" + + "A.\n,bigquerydatapolicy.googleapis.com/Da" + + "taPolicy\"\226\001\n\027ListDataPoliciesRequest\022D\n\006" + + "parent\030\001 \001(\tB4\340A\002\372A.\022,bigquerydatapolicy" + + ".googleapis.com/DataPolicy\022\021\n\tpage_size\030" + + "\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\022\016\n\006filter\030\004 \001(" + + "\t\"}\n\030ListDataPoliciesResponse\022H\n\rdata_po" + + "licies\030\001 \003(\01321.google.cloud.bigquery.dat" + + "apolicies.v1.DataPolicy\022\027\n\017next_page_tok" + + "en\030\002 \001(\t\"\204\004\n\nDataPolicy\022\024\n\npolicy_tag\030\004 " + + "\001(\tH\000\022W\n\023data_masking_policy\030\005 \001(\01328.goo" + + "gle.cloud.bigquery.datapolicies.v1.DataM" + + "askingPolicyH\001\022\021\n\004name\030\001 \001(\tB\003\340A\003\022Z\n\020dat" + + "a_policy_type\030\002 \001(\0162@.google.cloud.bigqu" + + "ery.datapolicies.v1.DataPolicy.DataPolic" + + "yType\022\026\n\016data_policy_id\030\003 \001(\t\"m\n\016DataPol" + + "icyType\022 \n\034DATA_POLICY_TYPE_UNSPECIFIED\020" + + "\000\022 \n\034COLUMN_LEVEL_SECURITY_POLICY\020\003\022\027\n\023D" + + "ATA_MASKING_POLICY\020\002:u\352Ar\n,bigquerydatap" + + "olicy.googleapis.com/DataPolicy\022Bproject" + + "s/{project}/locations/{location}/dataPol" + + "icies/{data_policy}B\020\n\016matching_labelB\010\n" + + "\006policy\"\220\002\n\021DataMaskingPolicy\022n\n\025predefi" + + "ned_expression\030\001 \001(\0162M.google.cloud.bigq" + + "uery.datapolicies.v1.DataMaskingPolicy.P" + + "redefinedExpressionH\000\"u\n\024PredefinedExpre" + + "ssion\022%\n!PREDEFINED_EXPRESSION_UNSPECIFI" + + "ED\020\000\022\n\n\006SHA256\020\003\022\017\n\013ALWAYS_NULL\020\005\022\031\n\025DEF" + + "AULT_MASKING_VALUE\020\007B\024\n\022masking_expressi" + + "on2\220\017\n\021DataPolicyService\022\341\001\n\020CreateDataP" + + "olicy\022>.google.cloud.bigquery.datapolici" + + "es.v1.CreateDataPolicyRequest\0321.google.c" + + "loud.bigquery.datapolicies.v1.DataPolicy" + + "\"Z\202\323\344\223\002?\"0/v1/{parent=projects/*/locatio" + + "ns/*}/dataPolicies:\013data_policy\332A\022parent" + + ",data_policy\022\362\001\n\020UpdateDataPolicy\022>.goog" + + "le.cloud.bigquery.datapolicies.v1.Update" + + "DataPolicyRequest\0321.google.cloud.bigquer" + + "y.datapolicies.v1.DataPolicy\"k\202\323\344\223\002K2" + + ".google.cloud.bigquery.datapolicies.v1.R" + + "enameDataPolicyRequest\0321.google.cloud.bi" + + "gquery.datapolicies.v1.DataPolicy\"\\\202\323\344\223\002" + + "<\"7/v1/{name=projects/*/locations/*/data" + + "Policies/*}:rename:\001*\332A\027name,new_data_po" + + "licy_id\022\253\001\n\020DeleteDataPolicy\022>.google.cl" + + "oud.bigquery.datapolicies.v1.DeleteDataP" + + "olicyRequest\032\026.google.protobuf.Empty\"?\202\323" + + "\344\223\0022*0/v1/{name=projects/*/locations/*/d" + + "ataPolicies/*}\332A\004name\022\300\001\n\rGetDataPolicy\022" + + ";.google.cloud.bigquery.datapolicies.v1." + + "GetDataPolicyRequest\0321.google.cloud.bigq" + + "uery.datapolicies.v1.DataPolicy\"?\202\323\344\223\0022\022" + + "0/v1/{name=projects/*/locations/*/dataPo" + + "licies/*}\332A\004name\022\326\001\n\020ListDataPolicies\022>." + + "google.cloud.bigquery.datapolicies.v1.Li" + + "stDataPoliciesRequest\032?.google.cloud.big" + + "query.datapolicies.v1.ListDataPoliciesRe" + + "sponse\"A\202\323\344\223\0022\0220/v1/{parent=projects/*/l" + + "ocations/*}/dataPolicies\332A\006parent\022\227\001\n\014Ge" + + "tIamPolicy\022\".google.iam.v1.GetIamPolicyR" + + "equest\032\025.google.iam.v1.Policy\"L\202\323\344\223\002F\"A/" + + "v1/{resource=projects/*/locations/*/data" + + "Policies/*}:getIamPolicy:\001*\022\227\001\n\014SetIamPo" + + "licy\022\".google.iam.v1.SetIamPolicyRequest" + + "\032\025.google.iam.v1.Policy\"L\202\323\344\223\002F\"A/v1/{re" + + "source=projects/*/locations/*/dataPolici" + + "es/*}:setIamPolicy:\001*\022\275\001\n\022TestIamPermiss" + + "ions\022(.google.iam.v1.TestIamPermissionsR" + + "equest\032).google.iam.v1.TestIamPermission" + + "sResponse\"R\202\323\344\223\002L\"G/v1/{resource=project" + + "s/*/locations/*/dataPolicies/*}:testIamP" + + "ermissions:\001*\032~\312A!bigquerydatapolicy.goo" + + "gleapis.com\322AWhttps://www.googleapis.com" + + "/auth/bigquery,https://www.googleapis.co" + + "m/auth/cloud-platformB\215\002\n)com.google.clo" + + "ud.bigquery.datapolicies.v1B\017DataPolicyP" + + "rotoP\001ZQgoogle.golang.org/genproto/googl" + + "eapis/cloud/bigquery/datapolicies/v1;dat" + + "apolicies\252\002%Google.Cloud.BigQuery.DataPo" + + "licies.V1\312\002%Google\\Cloud\\BigQuery\\DataPo" + + "licies\\V1\352\002)Google::Cloud::Bigquery::Dat" + + "aPolicies::V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.iam.v1.IamPolicyProto.getDescriptor(), + com.google.iam.v1.PolicyProto.getDescriptor(), + com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), + }); + internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_CreateDataPolicyRequest_descriptor, + new java.lang.String[] { + "Parent", "DataPolicy", + }); + internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_descriptor, + new java.lang.String[] { + "DataPolicy", "UpdateMask", + }); + internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_descriptor, + new java.lang.String[] { + "Name", "NewDataPolicyId", + }); + internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", "Filter", + }); + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_descriptor, + new java.lang.String[] { + "DataPolicies", "NextPageToken", + }); + internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_DataPolicy_descriptor, + new java.lang.String[] { + "PolicyTag", + "DataMaskingPolicy", + "Name", + "DataPolicyType", + "DataPolicyId", + "MatchingLabel", + "Policy", + }); + internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_descriptor, + new java.lang.String[] { + "PredefinedExpression", "MaskingExpression", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.iam.v1.IamPolicyProto.getDescriptor(); + com.google.iam.v1.PolicyProto.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DeleteDataPolicyRequest.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DeleteDataPolicyRequest.java new file mode 100644 index 000000000000..007f7e7be883 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DeleteDataPolicyRequest.java @@ -0,0 +1,645 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * Request message for the DeleteDataPolicy method.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest} + */ +public final class DeleteDataPolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) + DeleteDataPolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteDataPolicyRequest.newBuilder() to construct. + private DeleteDataPolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteDataPolicyRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteDataPolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Resource name of the data policy to delete. Format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Resource name of the data policy to delete. Format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest other = + (com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the DeleteDataPolicy method.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest.Builder.class); + } + + // Construct using + // com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_DeleteDataPolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest + getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest build() { + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest result = + new com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) { + return mergeFrom((com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest other) { + if (other + == com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Resource name of the data policy to delete. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the data policy to delete. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the data policy to delete. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the data policy to delete. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the data policy to delete. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) + private static final com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteDataPolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DeleteDataPolicyRequestOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DeleteDataPolicyRequestOrBuilder.java new file mode 100644 index 000000000000..5485eab9158d --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DeleteDataPolicyRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface DeleteDataPolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Resource name of the data policy to delete. Format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Resource name of the data policy to delete. Format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/GetDataPolicyRequest.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/GetDataPolicyRequest.java new file mode 100644 index 000000000000..1ba0b72f5908 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/GetDataPolicyRequest.java @@ -0,0 +1,642 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * Request message for the GetDataPolicy method.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest} + */ +public final class GetDataPolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) + GetDataPolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetDataPolicyRequest.newBuilder() to construct. + private GetDataPolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetDataPolicyRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetDataPolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Resource name of the requested data policy. Format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Resource name of the requested data policy. Format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest other = + (com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the GetDataPolicy method.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest.Builder.class); + } + + // Construct using com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_GetDataPolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest + getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest build() { + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest result = + new com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) { + return mergeFrom((com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest other) { + if (other + == com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Resource name of the requested data policy. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the requested data policy. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the requested data policy. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the requested data policy. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the requested data policy. Format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) + private static final com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetDataPolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/GetDataPolicyRequestOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/GetDataPolicyRequestOrBuilder.java new file mode 100644 index 000000000000..3e16fb4438ab --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/GetDataPolicyRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface GetDataPolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Resource name of the requested data policy. Format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Resource name of the requested data policy. Format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequest.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequest.java new file mode 100644 index 000000000000..2ccb990fb26c --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequest.java @@ -0,0 +1,1149 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * Request message for the ListDataPolicies method.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest} + */ +public final class ListDataPoliciesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) + ListDataPoliciesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListDataPoliciesRequest.newBuilder() to construct. + private ListDataPoliciesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListDataPoliciesRequest() { + parent_ = ""; + pageToken_ = ""; + filter_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListDataPoliciesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest.class, + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Resource name of the project for which to list data policies.
+   * Format is `projects/{project_number}/locations/{location_id}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Resource name of the project for which to list data policies.
+   * Format is `projects/{project_number}/locations/{location_id}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * The maximum number of data policies to return. Must be a value between 1
+   * and 1000.
+   * If not set, defaults to 50.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * The `nextPageToken` value returned from a previous list request, if any. If
+   * not set, defaults to an empty string.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * The `nextPageToken` value returned from a previous list request, if any. If
+   * not set, defaults to an empty string.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 4; + private volatile java.lang.Object filter_; + /** + * + * + *
+   * Filters the data policies by policy tags that they
+   * are associated with. Currently filter only supports
+   * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+   * filter can be "policy<span></span>_tag:
+   * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+   * wildcard such as "policy<span></span>_tag:
+   * `'projects/1/locations/us/taxonomies/2/*'`".
+   * 
+ * + * string filter = 4; + * + * @return The filter. + */ + @java.lang.Override + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Filters the data policies by policy tags that they
+   * are associated with. Currently filter only supports
+   * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+   * filter can be "policy<span></span>_tag:
+   * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+   * wildcard such as "policy<span></span>_tag:
+   * `'projects/1/locations/us/taxonomies/2/*'`".
+   * 
+ * + * string filter = 4; + * + * @return The bytes for filter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, filter_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, filter_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest other = + (com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getFilter().equals(other.getFilter())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the ListDataPolicies method.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest.class, + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest.Builder.class); + } + + // Construct using + // com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + filter_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest + getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest build() { + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest result = + new com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.filter_ = filter_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) { + return mergeFrom((com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest other) { + if (other + == com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: + { + filter_ = input.readStringRequireUtf8(); + + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Resource name of the project for which to list data policies.
+     * Format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the project for which to list data policies.
+     * Format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the project for which to list data policies.
+     * Format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the project for which to list data policies.
+     * Format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the project for which to list data policies.
+     * Format is `projects/{project_number}/locations/{location_id}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * The maximum number of data policies to return. Must be a value between 1
+     * and 1000.
+     * If not set, defaults to 50.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * The maximum number of data policies to return. Must be a value between 1
+     * and 1000.
+     * If not set, defaults to 50.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The maximum number of data policies to return. Must be a value between 1
+     * and 1000.
+     * If not set, defaults to 50.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * The `nextPageToken` value returned from a previous list request, if any. If
+     * not set, defaults to an empty string.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The `nextPageToken` value returned from a previous list request, if any. If
+     * not set, defaults to an empty string.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The `nextPageToken` value returned from a previous list request, if any. If
+     * not set, defaults to an empty string.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The `nextPageToken` value returned from a previous list request, if any. If
+     * not set, defaults to an empty string.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * The `nextPageToken` value returned from a previous list request, if any. If
+     * not set, defaults to an empty string.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Filters the data policies by policy tags that they
+     * are associated with. Currently filter only supports
+     * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+     * filter can be "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+     * wildcard such as "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/*'`".
+     * 
+ * + * string filter = 4; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Filters the data policies by policy tags that they
+     * are associated with. Currently filter only supports
+     * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+     * filter can be "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+     * wildcard such as "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/*'`".
+     * 
+ * + * string filter = 4; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Filters the data policies by policy tags that they
+     * are associated with. Currently filter only supports
+     * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+     * filter can be "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+     * wildcard such as "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/*'`".
+     * 
+ * + * string filter = 4; + * + * @param value The filter to set. + * @return This builder for chaining. + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Filters the data policies by policy tags that they
+     * are associated with. Currently filter only supports
+     * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+     * filter can be "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+     * wildcard such as "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/*'`".
+     * 
+ * + * string filter = 4; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+     * Filters the data policies by policy tags that they
+     * are associated with. Currently filter only supports
+     * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+     * filter can be "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+     * wildcard such as "policy<span></span>_tag:
+     * `'projects/1/locations/us/taxonomies/2/*'`".
+     * 
+ * + * string filter = 4; + * + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) + private static final com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListDataPoliciesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequestOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequestOrBuilder.java new file mode 100644 index 000000000000..c6588aae89df --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequestOrBuilder.java @@ -0,0 +1,135 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface ListDataPoliciesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Resource name of the project for which to list data policies.
+   * Format is `projects/{project_number}/locations/{location_id}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Resource name of the project for which to list data policies.
+   * Format is `projects/{project_number}/locations/{location_id}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The maximum number of data policies to return. Must be a value between 1
+   * and 1000.
+   * If not set, defaults to 50.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * The `nextPageToken` value returned from a previous list request, if any. If
+   * not set, defaults to an empty string.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * The `nextPageToken` value returned from a previous list request, if any. If
+   * not set, defaults to an empty string.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Filters the data policies by policy tags that they
+   * are associated with. Currently filter only supports
+   * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+   * filter can be "policy<span></span>_tag:
+   * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+   * wildcard such as "policy<span></span>_tag:
+   * `'projects/1/locations/us/taxonomies/2/*'`".
+   * 
+ * + * string filter = 4; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Filters the data policies by policy tags that they
+   * are associated with. Currently filter only supports
+   * "policy<span></span>_tag" based filtering and OR based predicates. Sample
+   * filter can be "policy<span></span>_tag:
+   * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use
+   * wildcard such as "policy<span></span>_tag:
+   * `'projects/1/locations/us/taxonomies/2/*'`".
+   * 
+ * + * string filter = 4; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesResponse.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesResponse.java new file mode 100644 index 000000000000..2c3f0e38f928 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesResponse.java @@ -0,0 +1,1135 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * Response message for the ListDataPolicies method.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse} + */ +public final class ListDataPoliciesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse) + ListDataPoliciesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListDataPoliciesResponse.newBuilder() to construct. + private ListDataPoliciesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListDataPoliciesResponse() { + dataPolicies_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListDataPoliciesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse.class, + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse.Builder.class); + } + + public static final int DATA_POLICIES_FIELD_NUMBER = 1; + private java.util.List dataPolicies_; + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + @java.lang.Override + public java.util.List + getDataPoliciesList() { + return dataPolicies_; + } + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + @java.lang.Override + public java.util.List + getDataPoliciesOrBuilderList() { + return dataPolicies_; + } + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + @java.lang.Override + public int getDataPoliciesCount() { + return dataPolicies_.size(); + } + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicies(int index) { + return dataPolicies_.get(index); + } + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPoliciesOrBuilder( + int index) { + return dataPolicies_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * Token used to retrieve the next page of results, or empty if there are no
+   * more results.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Token used to retrieve the next page of results, or empty if there are no
+   * more results.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < dataPolicies_.size(); i++) { + output.writeMessage(1, dataPolicies_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < dataPolicies_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, dataPolicies_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse other = + (com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse) obj; + + if (!getDataPoliciesList().equals(other.getDataPoliciesList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getDataPoliciesCount() > 0) { + hash = (37 * hash) + DATA_POLICIES_FIELD_NUMBER; + hash = (53 * hash) + getDataPoliciesList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for the ListDataPolicies method.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse) + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse.class, + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse.Builder.class); + } + + // Construct using + // com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (dataPoliciesBuilder_ == null) { + dataPolicies_ = java.util.Collections.emptyList(); + } else { + dataPolicies_ = null; + dataPoliciesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_ListDataPoliciesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse build() { + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse result = + new com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse(this); + int from_bitField0_ = bitField0_; + if (dataPoliciesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + dataPolicies_ = java.util.Collections.unmodifiableList(dataPolicies_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.dataPolicies_ = dataPolicies_; + } else { + result.dataPolicies_ = dataPoliciesBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse) { + return mergeFrom( + (com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse other) { + if (other + == com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + .getDefaultInstance()) return this; + if (dataPoliciesBuilder_ == null) { + if (!other.dataPolicies_.isEmpty()) { + if (dataPolicies_.isEmpty()) { + dataPolicies_ = other.dataPolicies_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureDataPoliciesIsMutable(); + dataPolicies_.addAll(other.dataPolicies_); + } + onChanged(); + } + } else { + if (!other.dataPolicies_.isEmpty()) { + if (dataPoliciesBuilder_.isEmpty()) { + dataPoliciesBuilder_.dispose(); + dataPoliciesBuilder_ = null; + dataPolicies_ = other.dataPolicies_; + bitField0_ = (bitField0_ & ~0x00000001); + dataPoliciesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getDataPoliciesFieldBuilder() + : null; + } else { + dataPoliciesBuilder_.addAllMessages(other.dataPolicies_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.bigquery.datapolicies.v1.DataPolicy m = + input.readMessage( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.parser(), + extensionRegistry); + if (dataPoliciesBuilder_ == null) { + ensureDataPoliciesIsMutable(); + dataPolicies_.add(m); + } else { + dataPoliciesBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List dataPolicies_ = + java.util.Collections.emptyList(); + + private void ensureDataPoliciesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + dataPolicies_ = + new java.util.ArrayList( + dataPolicies_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder> + dataPoliciesBuilder_; + + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public java.util.List + getDataPoliciesList() { + if (dataPoliciesBuilder_ == null) { + return java.util.Collections.unmodifiableList(dataPolicies_); + } else { + return dataPoliciesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public int getDataPoliciesCount() { + if (dataPoliciesBuilder_ == null) { + return dataPolicies_.size(); + } else { + return dataPoliciesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicies(int index) { + if (dataPoliciesBuilder_ == null) { + return dataPolicies_.get(index); + } else { + return dataPoliciesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder setDataPolicies( + int index, com.google.cloud.bigquery.datapolicies.v1.DataPolicy value) { + if (dataPoliciesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataPoliciesIsMutable(); + dataPolicies_.set(index, value); + onChanged(); + } else { + dataPoliciesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder setDataPolicies( + int index, com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder builderForValue) { + if (dataPoliciesBuilder_ == null) { + ensureDataPoliciesIsMutable(); + dataPolicies_.set(index, builderForValue.build()); + onChanged(); + } else { + dataPoliciesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder addDataPolicies(com.google.cloud.bigquery.datapolicies.v1.DataPolicy value) { + if (dataPoliciesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataPoliciesIsMutable(); + dataPolicies_.add(value); + onChanged(); + } else { + dataPoliciesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder addDataPolicies( + int index, com.google.cloud.bigquery.datapolicies.v1.DataPolicy value) { + if (dataPoliciesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDataPoliciesIsMutable(); + dataPolicies_.add(index, value); + onChanged(); + } else { + dataPoliciesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder addDataPolicies( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder builderForValue) { + if (dataPoliciesBuilder_ == null) { + ensureDataPoliciesIsMutable(); + dataPolicies_.add(builderForValue.build()); + onChanged(); + } else { + dataPoliciesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder addDataPolicies( + int index, com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder builderForValue) { + if (dataPoliciesBuilder_ == null) { + ensureDataPoliciesIsMutable(); + dataPolicies_.add(index, builderForValue.build()); + onChanged(); + } else { + dataPoliciesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder addAllDataPolicies( + java.lang.Iterable values) { + if (dataPoliciesBuilder_ == null) { + ensureDataPoliciesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, dataPolicies_); + onChanged(); + } else { + dataPoliciesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder clearDataPolicies() { + if (dataPoliciesBuilder_ == null) { + dataPolicies_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + dataPoliciesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public Builder removeDataPolicies(int index) { + if (dataPoliciesBuilder_ == null) { + ensureDataPoliciesIsMutable(); + dataPolicies_.remove(index); + onChanged(); + } else { + dataPoliciesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder getDataPoliciesBuilder( + int index) { + return getDataPoliciesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPoliciesOrBuilder( + int index) { + if (dataPoliciesBuilder_ == null) { + return dataPolicies_.get(index); + } else { + return dataPoliciesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public java.util.List + getDataPoliciesOrBuilderList() { + if (dataPoliciesBuilder_ != null) { + return dataPoliciesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(dataPolicies_); + } + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder addDataPoliciesBuilder() { + return getDataPoliciesFieldBuilder() + .addBuilder(com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance()); + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder addDataPoliciesBuilder( + int index) { + return getDataPoliciesFieldBuilder() + .addBuilder( + index, com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance()); + } + /** + * + * + *
+     * Data policies that belong to the requested project.
+     * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + public java.util.List + getDataPoliciesBuilderList() { + return getDataPoliciesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder> + getDataPoliciesFieldBuilder() { + if (dataPoliciesBuilder_ == null) { + dataPoliciesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder>( + dataPolicies_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + dataPolicies_ = null; + } + return dataPoliciesBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * Token used to retrieve the next page of results, or empty if there are no
+     * more results.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Token used to retrieve the next page of results, or empty if there are no
+     * more results.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Token used to retrieve the next page of results, or empty if there are no
+     * more results.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Token used to retrieve the next page of results, or empty if there are no
+     * more results.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Token used to retrieve the next page of results, or empty if there are no
+     * more results.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse) + private static final com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListDataPoliciesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesResponseOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesResponseOrBuilder.java new file mode 100644 index 000000000000..86e1d2e9fa48 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesResponseOrBuilder.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface ListDataPoliciesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + java.util.List getDataPoliciesList(); + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicies(int index); + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + int getDataPoliciesCount(); + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + java.util.List + getDataPoliciesOrBuilderList(); + /** + * + * + *
+   * Data policies that belong to the requested project.
+   * 
+ * + * repeated .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policies = 1; + */ + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPoliciesOrBuilder(int index); + + /** + * + * + *
+   * Token used to retrieve the next page of results, or empty if there are no
+   * more results.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * Token used to retrieve the next page of results, or empty if there are no
+   * more results.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/LocationName.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/LocationName.java new file mode 100644 index 000000000000..e098bd8abc9f --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/LocationName.java @@ -0,0 +1,192 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigquery.datapolicies.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +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. +@Generated("by gapic-generator-java") +public class LocationName implements ResourceName { + 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; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static LocationName of(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static LocationName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION.validatedMatch( + formattedString, "LocationName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (LocationName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION.instantiate("project", project, "location", location); + } + + @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; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder(LocationName locationName) { + this.project = locationName.project; + this.location = locationName.location; + } + + public LocationName build() { + return new LocationName(this); + } + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/RenameDataPolicyRequest.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/RenameDataPolicyRequest.java new file mode 100644 index 000000000000..2391a549fecb --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/RenameDataPolicyRequest.java @@ -0,0 +1,809 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * Request message for the RenameDataPolicy method.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest} + */ +public final class RenameDataPolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) + RenameDataPolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use RenameDataPolicyRequest.newBuilder() to construct. + private RenameDataPolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RenameDataPolicyRequest() { + name_ = ""; + newDataPolicyId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RenameDataPolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Resource name of the data policy to rename. The format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Resource name of the data policy to rename. The format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NEW_DATA_POLICY_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object newDataPolicyId_; + /** + * + * + *
+   * Required. The new data policy id.
+   * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The newDataPolicyId. + */ + @java.lang.Override + public java.lang.String getNewDataPolicyId() { + java.lang.Object ref = newDataPolicyId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + newDataPolicyId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The new data policy id.
+   * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for newDataPolicyId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNewDataPolicyIdBytes() { + java.lang.Object ref = newDataPolicyId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + newDataPolicyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(newDataPolicyId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, newDataPolicyId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(newDataPolicyId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, newDataPolicyId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest other = + (com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getNewDataPolicyId().equals(other.getNewDataPolicyId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + NEW_DATA_POLICY_ID_FIELD_NUMBER; + hash = (53 * hash) + getNewDataPolicyId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the RenameDataPolicy method.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest.Builder.class); + } + + // Construct using + // com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + newDataPolicyId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_RenameDataPolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest + getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest build() { + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest result = + new com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest(this); + result.name_ = name_; + result.newDataPolicyId_ = newDataPolicyId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) { + return mergeFrom((com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest other) { + if (other + == com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getNewDataPolicyId().isEmpty()) { + newDataPolicyId_ = other.newDataPolicyId_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + newDataPolicyId_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Resource name of the data policy to rename. The format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the data policy to rename. The format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Resource name of the data policy to rename. The format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the data policy to rename. The format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Resource name of the data policy to rename. The format is
+     * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object newDataPolicyId_ = ""; + /** + * + * + *
+     * Required. The new data policy id.
+     * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The newDataPolicyId. + */ + public java.lang.String getNewDataPolicyId() { + java.lang.Object ref = newDataPolicyId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + newDataPolicyId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The new data policy id.
+     * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for newDataPolicyId. + */ + public com.google.protobuf.ByteString getNewDataPolicyIdBytes() { + java.lang.Object ref = newDataPolicyId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + newDataPolicyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The new data policy id.
+     * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The newDataPolicyId to set. + * @return This builder for chaining. + */ + public Builder setNewDataPolicyId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + newDataPolicyId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The new data policy id.
+     * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearNewDataPolicyId() { + + newDataPolicyId_ = getDefaultInstance().getNewDataPolicyId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The new data policy id.
+     * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for newDataPolicyId to set. + * @return This builder for chaining. + */ + public Builder setNewDataPolicyIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + newDataPolicyId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) + private static final com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RenameDataPolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/RenameDataPolicyRequestOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/RenameDataPolicyRequestOrBuilder.java new file mode 100644 index 000000000000..76db1bd75a0b --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/RenameDataPolicyRequestOrBuilder.java @@ -0,0 +1,77 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface RenameDataPolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Resource name of the data policy to rename. The format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Resource name of the data policy to rename. The format is
+   * `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Required. The new data policy id.
+   * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The newDataPolicyId. + */ + java.lang.String getNewDataPolicyId(); + /** + * + * + *
+   * Required. The new data policy id.
+   * 
+ * + * string new_data_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for newDataPolicyId. + */ + com.google.protobuf.ByteString getNewDataPolicyIdBytes(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/UpdateDataPolicyRequest.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/UpdateDataPolicyRequest.java new file mode 100644 index 000000000000..6f834c52d5e4 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/UpdateDataPolicyRequest.java @@ -0,0 +1,1072 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +/** + * + * + *
+ * Response message for the UpdateDataPolicy method.
+ * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest} + */ +public final class UpdateDataPolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) + UpdateDataPolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateDataPolicyRequest.newBuilder() to construct. + private UpdateDataPolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateDataPolicyRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateDataPolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest.Builder.class); + } + + public static final int DATA_POLICY_FIELD_NUMBER = 1; + private com.google.cloud.bigquery.datapolicies.v1.DataPolicy dataPolicy_; + /** + * + * + *
+   * Required. Update the data policy's metadata.
+   * The target data policy is determined by the `name` field.
+   * Other fields are updated to the specified values based on the field masks.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the dataPolicy field is set. + */ + @java.lang.Override + public boolean hasDataPolicy() { + return dataPolicy_ != null; + } + /** + * + * + *
+   * Required. Update the data policy's metadata.
+   * The target data policy is determined by the `name` field.
+   * Other fields are updated to the specified values based on the field masks.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The dataPolicy. + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicy() { + return dataPolicy_ == null + ? com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance() + : dataPolicy_; + } + /** + * + * + *
+   * Required. Update the data policy's metadata.
+   * The target data policy is determined by the `name` field.
+   * Other fields are updated to the specified values based on the field masks.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPolicyOrBuilder() { + return getDataPolicy(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * The update mask applies to the resource. For the `FieldMask` definition,
+   * see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * If not set, defaults to all of the fields that are allowed to update.
+   * Updates to the `name` and `dataPolicyId` fields are not allowed.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * The update mask applies to the resource. For the `FieldMask` definition,
+   * see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * If not set, defaults to all of the fields that are allowed to update.
+   * Updates to the `name` and `dataPolicyId` fields are not allowed.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * The update mask applies to the resource. For the `FieldMask` definition,
+   * see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * If not set, defaults to all of the fields that are allowed to update.
+   * Updates to the `name` and `dataPolicyId` fields are not allowed.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (dataPolicy_ != null) { + output.writeMessage(1, getDataPolicy()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (dataPolicy_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDataPolicy()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest)) { + return super.equals(obj); + } + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest other = + (com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) obj; + + if (hasDataPolicy() != other.hasDataPolicy()) return false; + if (hasDataPolicy()) { + if (!getDataPolicy().equals(other.getDataPolicy())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasDataPolicy()) { + hash = (37 * hash) + DATA_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getDataPolicy().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for the UpdateDataPolicy method.
+   * 
+ * + * Protobuf type {@code google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest.class, + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest.Builder.class); + } + + // Construct using + // com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (dataPolicyBuilder_ == null) { + dataPolicy_ = null; + } else { + dataPolicy_ = null; + dataPolicyBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.bigquery.datapolicies.v1.DataPolicyProto + .internal_static_google_cloud_bigquery_datapolicies_v1_UpdateDataPolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest + getDefaultInstanceForType() { + return com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest build() { + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest buildPartial() { + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest result = + new com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest(this); + if (dataPolicyBuilder_ == null) { + result.dataPolicy_ = dataPolicy_; + } else { + result.dataPolicy_ = dataPolicyBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) { + return mergeFrom((com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest other) { + if (other + == com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest.getDefaultInstance()) + return this; + if (other.hasDataPolicy()) { + mergeDataPolicy(other.getDataPolicy()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getDataPolicyFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 10 + case 18: + { + input.readMessage(getUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private com.google.cloud.bigquery.datapolicies.v1.DataPolicy dataPolicy_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder> + dataPolicyBuilder_; + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the dataPolicy field is set. + */ + public boolean hasDataPolicy() { + return dataPolicyBuilder_ != null || dataPolicy_ != null; + } + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The dataPolicy. + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicy() { + if (dataPolicyBuilder_ == null) { + return dataPolicy_ == null + ? com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance() + : dataPolicy_; + } else { + return dataPolicyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setDataPolicy(com.google.cloud.bigquery.datapolicies.v1.DataPolicy value) { + if (dataPolicyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + dataPolicy_ = value; + onChanged(); + } else { + dataPolicyBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setDataPolicy( + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder builderForValue) { + if (dataPolicyBuilder_ == null) { + dataPolicy_ = builderForValue.build(); + onChanged(); + } else { + dataPolicyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeDataPolicy(com.google.cloud.bigquery.datapolicies.v1.DataPolicy value) { + if (dataPolicyBuilder_ == null) { + if (dataPolicy_ != null) { + dataPolicy_ = + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.newBuilder(dataPolicy_) + .mergeFrom(value) + .buildPartial(); + } else { + dataPolicy_ = value; + } + onChanged(); + } else { + dataPolicyBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearDataPolicy() { + if (dataPolicyBuilder_ == null) { + dataPolicy_ = null; + onChanged(); + } else { + dataPolicy_ = null; + dataPolicyBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder getDataPolicyBuilder() { + + onChanged(); + return getDataPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPolicyOrBuilder() { + if (dataPolicyBuilder_ != null) { + return dataPolicyBuilder_.getMessageOrBuilder(); + } else { + return dataPolicy_ == null + ? com.google.cloud.bigquery.datapolicies.v1.DataPolicy.getDefaultInstance() + : dataPolicy_; + } + } + /** + * + * + *
+     * Required. Update the data policy's metadata.
+     * The target data policy is determined by the `name` field.
+     * Other fields are updated to the specified values based on the field masks.
+     * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder> + getDataPolicyFieldBuilder() { + if (dataPolicyBuilder_ == null) { + dataPolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.bigquery.datapolicies.v1.DataPolicy, + com.google.cloud.bigquery.datapolicies.v1.DataPolicy.Builder, + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder>( + getDataPolicy(), getParentForChildren(), isClean()); + dataPolicy_ = null; + } + return dataPolicyBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * The update mask applies to the resource. For the `FieldMask` definition,
+     * see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * If not set, defaults to all of the fields that are allowed to update.
+     * Updates to the `name` and `dataPolicyId` fields are not allowed.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) + private static final com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest(); + } + + public static com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateDataPolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/UpdateDataPolicyRequestOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/UpdateDataPolicyRequestOrBuilder.java new file mode 100644 index 000000000000..270ab640ef7a --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/UpdateDataPolicyRequestOrBuilder.java @@ -0,0 +1,119 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto + +package com.google.cloud.bigquery.datapolicies.v1; + +public interface UpdateDataPolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Update the data policy's metadata.
+   * The target data policy is determined by the `name` field.
+   * Other fields are updated to the specified values based on the field masks.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the dataPolicy field is set. + */ + boolean hasDataPolicy(); + /** + * + * + *
+   * Required. Update the data policy's metadata.
+   * The target data policy is determined by the `name` field.
+   * Other fields are updated to the specified values based on the field masks.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The dataPolicy. + */ + com.google.cloud.bigquery.datapolicies.v1.DataPolicy getDataPolicy(); + /** + * + * + *
+   * Required. Update the data policy's metadata.
+   * The target data policy is determined by the `name` field.
+   * Other fields are updated to the specified values based on the field masks.
+   * 
+ * + * + * .google.cloud.bigquery.datapolicies.v1.DataPolicy data_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.bigquery.datapolicies.v1.DataPolicyOrBuilder getDataPolicyOrBuilder(); + + /** + * + * + *
+   * The update mask applies to the resource. For the `FieldMask` definition,
+   * see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * If not set, defaults to all of the fields that are allowed to update.
+   * Updates to the `name` and `dataPolicyId` fields are not allowed.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * The update mask applies to the resource. For the `FieldMask` definition,
+   * see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * If not set, defaults to all of the fields that are allowed to update.
+   * Updates to the `name` and `dataPolicyId` fields are not allowed.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * The update mask applies to the resource. For the `FieldMask` definition,
+   * see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * If not set, defaults to all of the fields that are allowed to update.
+   * Updates to the `name` and `dataPolicyId` fields are not allowed.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/proto/google/cloud/bigquery/datapolicies/v1/datapolicy.proto b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/proto/google/cloud/bigquery/datapolicies/v1/datapolicy.proto new file mode 100644 index 000000000000..cd79acfba307 --- /dev/null +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/proto/google/cloud/bigquery/datapolicies/v1/datapolicy.proto @@ -0,0 +1,320 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.bigquery.datapolicies.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.BigQuery.DataPolicies.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/datapolicies/v1;datapolicies"; +option java_multiple_files = true; +option java_outer_classname = "DataPolicyProto"; +option java_package = "com.google.cloud.bigquery.datapolicies.v1"; +option php_namespace = "Google\\Cloud\\BigQuery\\DataPolicies\\V1"; +option ruby_package = "Google::Cloud::Bigquery::DataPolicies::V1"; + +// Data Policy Service provides APIs for managing the label-policy bindings. +service DataPolicyService { + option (google.api.default_host) = "bigquerydatapolicy.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/bigquery," + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new data policy under a project with the given `dataPolicyId` + // (used as the display name), policy tag, and data policy type. + rpc CreateDataPolicy(CreateDataPolicyRequest) returns (DataPolicy) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/dataPolicies" + body: "data_policy" + }; + option (google.api.method_signature) = "parent,data_policy"; + } + + // Updates the metadata for an existing data policy. The target data policy + // can be specified by the resource name. + rpc UpdateDataPolicy(UpdateDataPolicyRequest) returns (DataPolicy) { + option (google.api.http) = { + patch: "/v1/{data_policy.name=projects/*/locations/*/dataPolicies/*}" + body: "data_policy" + }; + option (google.api.method_signature) = "data_policy,update_mask"; + } + + // Renames the id (display name) of the specified data policy. + rpc RenameDataPolicy(RenameDataPolicyRequest) returns (DataPolicy) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/dataPolicies/*}:rename" + body: "*" + }; + option (google.api.method_signature) = "name,new_data_policy_id"; + } + + // Deletes the data policy specified by its resource name. + rpc DeleteDataPolicy(DeleteDataPolicyRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/dataPolicies/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the data policy specified by its resource name. + rpc GetDataPolicy(GetDataPolicyRequest) returns (DataPolicy) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/dataPolicies/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List all of the data policies in the specified parent project. + rpc ListDataPolicies(ListDataPoliciesRequest) + returns (ListDataPoliciesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/dataPolicies" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the IAM policy for the specified data policy. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/dataPolicies/*}:getIamPolicy" + body: "*" + }; + } + + // Sets the IAM policy for the specified data policy. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/dataPolicies/*}:setIamPolicy" + body: "*" + }; + } + + // Returns the caller's permission on the specified data policy resource. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/dataPolicies/*}:testIamPermissions" + body: "*" + }; + } +} + +// Request message for the CreateDataPolicy method. +message CreateDataPolicyRequest { + // Required. Resource name of the project that the data policy will belong to. + // The format is `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "bigquerydatapolicy.googleapis.com/DataPolicy" + } + ]; + + // Required. The data policy to create. The `name` field does not need to be + // provided for the data policy creation. + DataPolicy data_policy = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for the UpdateDataPolicy method. +message UpdateDataPolicyRequest { + // Required. Update the data policy's metadata. + // + // The target data policy is determined by the `name` field. + // Other fields are updated to the specified values based on the field masks. + DataPolicy data_policy = 1 [(google.api.field_behavior) = REQUIRED]; + + // The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + // If not set, defaults to all of the fields that are allowed to update. + // + // Updates to the `name` and `dataPolicyId` fields are not allowed. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for the RenameDataPolicy method. +message RenameDataPolicyRequest { + // Required. Resource name of the data policy to rename. The format is + // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The new data policy id. + string new_data_policy_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for the DeleteDataPolicy method. +message DeleteDataPolicyRequest { + // Required. Resource name of the data policy to delete. Format is + // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigquerydatapolicy.googleapis.com/DataPolicy" + } + ]; +} + +// Request message for the GetDataPolicy method. +message GetDataPolicyRequest { + // Required. Resource name of the requested data policy. Format is + // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "bigquerydatapolicy.googleapis.com/DataPolicy" + } + ]; +} + +// Request message for the ListDataPolicies method. +message ListDataPoliciesRequest { + // Required. Resource name of the project for which to list data policies. + // Format is `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "bigquerydatapolicy.googleapis.com/DataPolicy" + } + ]; + + // The maximum number of data policies to return. Must be a value between 1 + // and 1000. + // If not set, defaults to 50. + int32 page_size = 2; + + // The `nextPageToken` value returned from a previous list request, if any. If + // not set, defaults to an empty string. + string page_token = 3; + + // Filters the data policies by policy tags that they + // are associated with. Currently filter only supports + // "policy_tag" based filtering and OR based predicates. Sample + // filter can be "policy_tag: + // `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use + // wildcard such as "policy_tag: + // `'projects/1/locations/us/taxonomies/2/*'`". + string filter = 4; +} + +// Response message for the ListDataPolicies method. +message ListDataPoliciesResponse { + // Data policies that belong to the requested project. + repeated DataPolicy data_policies = 1; + + // Token used to retrieve the next page of results, or empty if there are no + // more results. + string next_page_token = 2; +} + +// Represents the label-policy binding. +message DataPolicy { + option (google.api.resource) = { + type: "bigquerydatapolicy.googleapis.com/DataPolicy" + pattern: "projects/{project}/locations/{location}/dataPolicies/{data_policy}" + }; + + // A list of supported data policy types. + enum DataPolicyType { + // Default value for the data policy type. This should not be used. + DATA_POLICY_TYPE_UNSPECIFIED = 0; + + // Used to create a data policy for column-level security, without data + // masking. + COLUMN_LEVEL_SECURITY_POLICY = 3; + + // Used to create a data policy for data masking. + DATA_MASKING_POLICY = 2; + } + + // Label that is bound to this data policy. + oneof matching_label { + // Policy tag resource name, in the format of + // `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`. + string policy_tag = 4; + } + + // The policy that is bound to this data policy. + oneof policy { + // The data masking policy that specifies the data masking rule to use. + DataMaskingPolicy data_masking_policy = 5; + } + + // Output only. Resource name of this data policy, in the format of + // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Type of data policy. + DataPolicyType data_policy_type = 2; + + // User-assigned (human readable) ID of the data policy that needs to be + // unique within a project. Used as {data_policy_id} in part of the resource + // name. + string data_policy_id = 3; +} + +// The data masking policy that is used to specify data masking rule. +message DataMaskingPolicy { + // The available masking rules. Learn more here: + // https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options. + enum PredefinedExpression { + // Default, unspecified predefined expression. No masking will take place + // since no expression is specified. + PREDEFINED_EXPRESSION_UNSPECIFIED = 0; + + // Masking expression to replace data with SHA-256 hash. + SHA256 = 3; + + // Masking expression to replace data with NULLs. + ALWAYS_NULL = 5; + + // Masking expression to replace data with their default masking values. + // The default masking values for each type listed as below: + // + // * STRING: "" + // * BYTES: b'' + // * INTEGER: 0 + // * FLOAT: 0.0 + // * NUMERIC: 0 + // * BOOLEAN: FALSE + // * TIMESTAMP: 0001-01-01 00:00:00 UTC + // * DATE: 0001-01-01 + // * TIME: 00:00:00 + // * DATETIME: 0001-01-01T00:00:00 + // * GEOGRAPHY: POINT(0 0) + // * BIGNUMERIC: 0 + // * ARRAY: [] + // * STRUCT: NOT_APPLICABLE + // * JSON: NULL + DEFAULT_MASKING_VALUE = 7; + } + + // A masking expression to bind to the data masking rule. + oneof masking_expression { + // A predefined masking expression. + PredefinedExpression predefined_expression = 1; + } +} diff --git a/versions.txt b/versions.txt index ab898554fcc5..44557b7247da 100644 --- a/versions.txt +++ b/versions.txt @@ -593,8 +593,10 @@ grpc-google-cloud-vmwareengine-v1:0.0.0:0.0.1-SNAPSHOT google-maps-addressvalidation:0.0.0:0.0.1-SNAPSHOT proto-google-maps-addressvalidation-v1:0.0.0:0.0.1-SNAPSHOT grpc-google-maps-addressvalidation-v1:0.0.0:0.0.1-SNAPSHOT +proto-google-cloud-bigquerydatapolicy-v1:0.3.0:0.4.0-SNAPSHOT +grpc-google-cloud-bigquerydatapolicy-v1:0.3.0:0.4.0-SNAPSHOT google-cloud-monitoring-metricsscope:0.0.0:0.0.1-SNAPSHOT proto-google-cloud-monitoring-metricsscope-v1:0.0.0:0.0.1-SNAPSHOT grpc-google-cloud-monitoring-metricsscope-v1:0.0.0:0.0.1-SNAPSHOT proto-google-cloud-tpu-v2:2.7.0:2.8.0-SNAPSHOT -grpc-google-cloud-tpu-v2:2.7.0:2.8.0-SNAPSHOT +grpc-google-cloud-tpu-v2:2.7.0:2.8.0-SNAPSHOT \ No newline at end of file