From a0f6971a062b39702e93bb22151853032ba9dc8a Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Mon, 12 Sep 2022 19:45:17 +0000 Subject: [PATCH 1/8] chore: update .OwlBot.yaml for v2 --- .github/.OwlBot.yaml | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index b7d331d4..5df4166a 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -16,22 +16,28 @@ docker: image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest" deep-remove-regex: -- "/grpc-google-.*/src" -- "/proto-google-.*/src" + - "/grpc-google-.*/src" + - "/proto-google-.*/src" deep-preserve-regex: -- "/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java" -- "/proto-google-iam-v1/src/main/java/com/google/iam/v1/logging" -- "/proto-google-iam-v1/src/main/proto/google/iam/v1" + - "/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java" + - "/proto-google-iam-v1/src/main/java/com/google/iam/v1/logging" + - "/proto-google-iam-v1/src/main/proto/google/iam/v1" deep-copy-regex: -- source: "/google/iam/v1/google-iam-v1-java/grpc-google-iam-v1-java/src" - dest: "/owl-bot-staging/v1/grpc-google-iam-v1/src" -- source: "/google/iam/v1/google-iam-v1-java/proto-google-iam-v1-java/src" - dest: "/owl-bot-staging/v1/proto-google-iam-v1/src" -- source: "/google/iam/v2beta/google-cloud-iam-v2beta-java/grpc-google-cloud-iam-v2beta-java/src" - dest: "/owl-bot-staging/v2beta/grpc-google-iam-v2beta/src" -- source: "/google/iam/v2beta/google-cloud-iam-v2beta-java/proto-google-cloud-iam-v2beta-java/src" - dest: "/owl-bot-staging/v2beta/proto-google-iam-v2beta/src" -- source: "/google/iam/v2beta/google-cloud-iam-v2beta-java/gapic-google-cloud-iam-v2beta-java/src" - dest: "/owl-bot-staging/v2beta/google-iam-policy/src" \ No newline at end of file + - source: "/google/iam/v1/google-iam-v1-java/grpc-google-iam-v1-java/src" + dest: "/owl-bot-staging/v1/grpc-google-iam-v1/src" + - source: "/google/iam/v1/google-iam-v1-java/proto-google-iam-v1-java/src" + dest: "/owl-bot-staging/v1/proto-google-iam-v1/src" + - source: "/google/iam/v2beta/google-cloud-iam-v2beta-java/grpc-google-cloud-iam-v2beta-java/src" + dest: "/owl-bot-staging/v2beta/grpc-google-iam-v2beta/src" + - source: "/google/iam/v2beta/google-cloud-iam-v2beta-java/proto-google-cloud-iam-v2beta-java/src" + dest: "/owl-bot-staging/v2beta/proto-google-iam-v2beta/src" + - source: "/google/iam/v2beta/google-cloud-iam-v2beta-java/gapic-google-cloud-iam-v2beta-java/src" + dest: "/owl-bot-staging/v2beta/google-iam-policy/src" + - source: "/google/iam/v2/google-cloud-iam-v2-java/grpc-google-cloud-iam-v2-java/src" + dest: "/owl-bot-staging/v2/grpc-google-iam-v2/src" + - source: "/google/iam/v2/google-cloud-iam-v2-java/proto-google-cloud-iam-v2-java/src" + dest: "/owl-bot-staging/v2/proto-google-iam-v2/src" + - source: "/google/iam/v2/google-cloud-iam-v2-java/gapic-google-cloud-iam-v2-java/src" + dest: "/owl-bot-staging/v2/google-iam-policy/src" \ No newline at end of file From 40929b7ad1bbb950f20a921b8369a17a723abc4a Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Mon, 12 Sep 2022 19:47:34 +0000 Subject: [PATCH 2/8] chore: generated code for v2 --- .github/CODEOWNERS | 3 - .../com/google/iam/v2/PoliciesClient.java | 1136 ++++++ .../com/google/iam/v2/PoliciesSettings.java | 303 ++ .../com/google/iam/v2/gapic_metadata.json | 36 + .../java/com/google/iam/v2/package-info.java | 43 + .../v2/stub/GrpcPoliciesCallableFactory.java | 113 + .../google/iam/v2/stub/GrpcPoliciesStub.java | 384 ++ .../stub/HttpJsonPoliciesCallableFactory.java | 105 + .../iam/v2/stub/HttpJsonPoliciesStub.java | 552 +++ .../com/google/iam/v2/stub/PoliciesStub.java | 108 + .../iam/v2/stub/PoliciesStubSettings.java | 738 ++++ .../java/com/google/iam/v2/MockPolicies.java | 59 + .../com/google/iam/v2/MockPoliciesImpl.java | 187 + .../iam/v2/PoliciesClientHttpJsonTest.java | 451 +++ .../com/google/iam/v2/PoliciesClientTest.java | 402 ++ grpc-google-iam-v2/pom.xml | 69 + .../java/com/google/iam/v2/PoliciesGrpc.java | 971 +++++ pom.xml | 12 + .../clirr-ignored-differences.xml | 19 + proto-google-iam-v2/pom.xml | 46 + .../google/iam/v2/CreatePolicyRequest.java | 1148 ++++++ .../iam/v2/CreatePolicyRequestOrBuilder.java | 130 + .../google/iam/v2/DeletePolicyRequest.java | 883 +++++ .../iam/v2/DeletePolicyRequestOrBuilder.java | 95 + .../main/java/com/google/iam/v2/DenyRule.java | 2504 ++++++++++++ .../com/google/iam/v2/DenyRuleOrBuilder.java | 468 +++ .../java/com/google/iam/v2/DenyRuleProto.java | 75 + .../com/google/iam/v2/GetPolicyRequest.java | 674 ++++ .../iam/v2/GetPolicyRequestOrBuilder.java | 62 + .../iam/v2/ListApplicablePoliciesRequest.java | 1207 ++++++ ...istApplicablePoliciesRequestOrBuilder.java | 141 + .../v2/ListApplicablePoliciesResponse.java | 1503 ++++++++ ...stApplicablePoliciesResponseOrBuilder.java | 180 + .../google/iam/v2/ListPoliciesRequest.java | 970 +++++ .../iam/v2/ListPoliciesRequestOrBuilder.java | 107 + .../google/iam/v2/ListPoliciesResponse.java | 1132 ++++++ .../iam/v2/ListPoliciesResponseOrBuilder.java | 105 + .../main/java/com/google/iam/v2/Policy.java | 3369 +++++++++++++++++ .../iam/v2/PolicyOperationMetadata.java | 728 ++++ .../v2/PolicyOperationMetadataOrBuilder.java | 60 + .../com/google/iam/v2/PolicyOrBuilder.java | 444 +++ .../java/com/google/iam/v2/PolicyProto.java | 290 ++ .../java/com/google/iam/v2/PolicyRule.java | 1007 +++++ .../google/iam/v2/PolicyRuleOrBuilder.java | 89 + .../google/iam/v2/UpdatePolicyRequest.java | 755 ++++ .../iam/v2/UpdatePolicyRequestOrBuilder.java | 69 + .../src/main/proto/google/iam/v2/deny.proto | 109 + .../src/main/proto/google/iam/v2/policy.proto | 376 ++ versions.txt | 2 + 49 files changed, 24416 insertions(+), 3 deletions(-) create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/PoliciesClient.java create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/PoliciesSettings.java create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/gapic_metadata.json create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/package-info.java create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesCallableFactory.java create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesStub.java create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/stub/HttpJsonPoliciesCallableFactory.java create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/stub/HttpJsonPoliciesStub.java create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/stub/PoliciesStub.java create mode 100644 google-iam-policy/src/main/java/com/google/iam/v2/stub/PoliciesStubSettings.java create mode 100644 google-iam-policy/src/test/java/com/google/iam/v2/MockPolicies.java create mode 100644 google-iam-policy/src/test/java/com/google/iam/v2/MockPoliciesImpl.java create mode 100644 google-iam-policy/src/test/java/com/google/iam/v2/PoliciesClientHttpJsonTest.java create mode 100644 google-iam-policy/src/test/java/com/google/iam/v2/PoliciesClientTest.java create mode 100644 grpc-google-iam-v2/pom.xml create mode 100644 grpc-google-iam-v2/src/main/java/com/google/iam/v2/PoliciesGrpc.java create mode 100644 proto-google-iam-v2/clirr-ignored-differences.xml create mode 100644 proto-google-iam-v2/pom.xml create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/CreatePolicyRequest.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/CreatePolicyRequestOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/DeletePolicyRequest.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/DeletePolicyRequestOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRule.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRuleOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRuleProto.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/GetPolicyRequest.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/GetPolicyRequestOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesRequest.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesRequestOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesResponse.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesResponseOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesRequest.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesRequestOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesResponse.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesResponseOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/Policy.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOperationMetadata.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOperationMetadataOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyProto.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyRule.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyRuleOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/UpdatePolicyRequest.java create mode 100644 proto-google-iam-v2/src/main/java/com/google/iam/v2/UpdatePolicyRequestOrBuilder.java create mode 100644 proto-google-iam-v2/src/main/proto/google/iam/v2/deny.proto create mode 100644 proto-google-iam-v2/src/main/proto/google/iam/v2/policy.proto diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index db2d8ad1..30fdb7b9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,6 +8,3 @@ # The java-samples-reviewers team is the default owner for samples changes samples/**/*.java @googleapis/java-samples-reviewers - -# Generated snippets should not be owned by samples reviewers -samples/snippets/generated/ @googleapis/yoshi-java diff --git a/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesClient.java b/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesClient.java new file mode 100644 index 00000000..b7e40fcd --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesClient.java @@ -0,0 +1,1136 @@ +/* + * 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.iam.v2; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; +import com.google.api.gax.longrunning.OperationFuture; +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.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.iam.v2.stub.PoliciesStub; +import com.google.iam.v2.stub.PoliciesStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: An interface for managing Identity and Access Management (IAM) policies. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+ *   String name = "name3373707";
+ *   Policy response = policiesClient.getPolicy(name);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the PoliciesClient 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 PoliciesSettings 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
+ * PoliciesSettings policiesSettings =
+ *     PoliciesSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * PoliciesClient policiesClient = PoliciesClient.create(policiesSettings);
+ * }
+ * + *

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
+ * PoliciesSettings policiesSettings =
+ *     PoliciesSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * PoliciesClient policiesClient = PoliciesClient.create(policiesSettings);
+ * }
+ * + *

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
+ * PoliciesSettings policiesSettings =
+ *     PoliciesSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             PoliciesSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * PoliciesClient policiesClient = PoliciesClient.create(policiesSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class PoliciesClient implements BackgroundResource { + private final PoliciesSettings settings; + private final PoliciesStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of PoliciesClient with default settings. */ + public static final PoliciesClient create() throws IOException { + return create(PoliciesSettings.newBuilder().build()); + } + + /** + * Constructs an instance of PoliciesClient, 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 PoliciesClient create(PoliciesSettings settings) throws IOException { + return new PoliciesClient(settings); + } + + /** + * Constructs an instance of PoliciesClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(PoliciesSettings). + */ + public static final PoliciesClient create(PoliciesStub stub) { + return new PoliciesClient(stub); + } + + /** + * Constructs an instance of PoliciesClient, 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 PoliciesClient(PoliciesSettings settings) throws IOException { + this.settings = settings; + this.stub = ((PoliciesStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected PoliciesClient(PoliciesStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final PoliciesSettings getSettings() { + return settings; + } + + public PoliciesStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the policies of the specified kind that are attached to a resource. + * + *

The response lists only policy metadata. In particular, policy rules are omitted. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   String parent = "parent-995424086";
+   *   for (Policy element : policiesClient.listPolicies(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The resource that the policy is attached to, along with the kind of + * policy to list. Format: `policies/{attachment_point}/denypolicies` + *

The attachment point is identified by its URL-encoded full resource name, which means + * that the forward-slash character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + *

For organizations and folders, use the numeric ID in the full resource name. For + * projects, you can use the alphanumeric or the numeric ID. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListPoliciesPagedResponse listPolicies(String parent) { + ListPoliciesRequest request = ListPoliciesRequest.newBuilder().setParent(parent).build(); + return listPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the policies of the specified kind that are attached to a resource. + * + *

The response lists only policy metadata. In particular, policy rules are omitted. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   ListPoliciesRequest request =
+   *       ListPoliciesRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Policy element : policiesClient.listPolicies(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 ListPoliciesPagedResponse listPolicies(ListPoliciesRequest request) { + return listPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the policies of the specified kind that are attached to a resource. + * + *

The response lists only policy metadata. In particular, policy rules are omitted. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   ListPoliciesRequest request =
+   *       ListPoliciesRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = policiesClient.listPoliciesPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Policy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listPoliciesPagedCallable() { + return stub.listPoliciesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the policies of the specified kind that are attached to a resource. + * + *

The response lists only policy metadata. In particular, policy rules are omitted. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   ListPoliciesRequest request =
+   *       ListPoliciesRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListPoliciesResponse response = policiesClient.listPoliciesCallable().call(request);
+   *     for (Policy element : response.getPoliciesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listPoliciesCallable() { + return stub.listPoliciesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   String name = "name3373707";
+   *   Policy response = policiesClient.getPolicy(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + *

Use the URL-encoded full resource name, which means that the forward-slash character, + * `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + *

For organizations and folders, use the numeric ID in the full resource name. For + * projects, you can use the alphanumeric or the numeric ID. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getPolicy(String name) { + GetPolicyRequest request = GetPolicyRequest.newBuilder().setName(name).build(); + return getPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   GetPolicyRequest request = GetPolicyRequest.newBuilder().setName("name3373707").build();
+   *   Policy response = policiesClient.getPolicy(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 getPolicy(GetPolicyRequest request) { + return getPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   GetPolicyRequest request = GetPolicyRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = policiesClient.getPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getPolicyCallable() { + return stub.getPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   String parent = "parent-995424086";
+   *   Policy policy = Policy.newBuilder().build();
+   *   String policyId = "policyId546908653";
+   *   Policy response = policiesClient.createPolicyAsync(parent, policy, policyId).get();
+   * }
+   * }
+ * + * @param parent Required. The resource that the policy is attached to, along with the kind of + * policy to create. Format: `policies/{attachment_point}/denypolicies` + *

The attachment point is identified by its URL-encoded full resource name, which means + * that the forward-slash character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + *

For organizations and folders, use the numeric ID in the full resource name. For + * projects, you can use the alphanumeric or the numeric ID. + * @param policy Required. The policy to create. + * @param policyId The ID to use for this policy, which will become the final component of the + * policy's resource name. The ID must contain 3 to 63 characters. It can contain lowercase + * letters and numbers, as well as dashes (`-`) and periods (`.`). The first character must be + * a lowercase letter. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createPolicyAsync( + String parent, Policy policy, String policyId) { + CreatePolicyRequest request = + CreatePolicyRequest.newBuilder() + .setParent(parent) + .setPolicy(policy) + .setPolicyId(policyId) + .build(); + return createPolicyAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   CreatePolicyRequest request =
+   *       CreatePolicyRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setPolicyId("policyId546908653")
+   *           .build();
+   *   Policy response = policiesClient.createPolicyAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createPolicyAsync( + CreatePolicyRequest request) { + return createPolicyOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   CreatePolicyRequest request =
+   *       CreatePolicyRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setPolicyId("policyId546908653")
+   *           .build();
+   *   OperationFuture future =
+   *       policiesClient.createPolicyOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + createPolicyOperationCallable() { + return stub.createPolicyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   CreatePolicyRequest request =
+   *       CreatePolicyRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setPolicyId("policyId546908653")
+   *           .build();
+   *   ApiFuture future = policiesClient.createPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createPolicyCallable() { + return stub.createPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the specified policy. + * + *

You can update only the rules and the display name for the policy. + * + *

To update a policy, you should use a read-modify-write loop: + * + *

1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the + * policy. 2. Modify the policy as needed. 3. Use `UpdatePolicy` to write the updated policy. + * + *

This pattern helps prevent conflicts between concurrent updates. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   UpdatePolicyRequest request =
+   *       UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build();
+   *   Policy response = policiesClient.updatePolicyAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updatePolicyAsync( + UpdatePolicyRequest request) { + return updatePolicyOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the specified policy. + * + *

You can update only the rules and the display name for the policy. + * + *

To update a policy, you should use a read-modify-write loop: + * + *

1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the + * policy. 2. Modify the policy as needed. 3. Use `UpdatePolicy` to write the updated policy. + * + *

This pattern helps prevent conflicts between concurrent updates. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   UpdatePolicyRequest request =
+   *       UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build();
+   *   OperationFuture future =
+   *       policiesClient.updatePolicyOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + updatePolicyOperationCallable() { + return stub.updatePolicyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the specified policy. + * + *

You can update only the rules and the display name for the policy. + * + *

To update a policy, you should use a read-modify-write loop: + * + *

1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the + * policy. 2. Modify the policy as needed. 3. Use `UpdatePolicy` to write the updated policy. + * + *

This pattern helps prevent conflicts between concurrent updates. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   UpdatePolicyRequest request =
+   *       UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build();
+   *   ApiFuture future = policiesClient.updatePolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updatePolicyCallable() { + return stub.updatePolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a policy. This action is permanent. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   String name = "name3373707";
+   *   Policy response = policiesClient.deletePolicyAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The resource name of the policy to delete. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + *

Use the URL-encoded full resource name, which means that the forward-slash character, + * `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + *

For organizations and folders, use the numeric ID in the full resource name. For + * projects, you can use the alphanumeric or the numeric ID. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deletePolicyAsync(String name) { + DeletePolicyRequest request = DeletePolicyRequest.newBuilder().setName(name).build(); + return deletePolicyAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a policy. This action is permanent. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   DeletePolicyRequest request =
+   *       DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
+   *   Policy response = policiesClient.deletePolicyAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deletePolicyAsync( + DeletePolicyRequest request) { + return deletePolicyOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a policy. This action is permanent. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   DeletePolicyRequest request =
+   *       DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
+   *   OperationFuture future =
+   *       policiesClient.deletePolicyOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + deletePolicyOperationCallable() { + return stub.deletePolicyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a policy. This action is permanent. + * + *

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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   DeletePolicyRequest request =
+   *       DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
+   *   ApiFuture future = policiesClient.deletePolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deletePolicyCallable() { + return stub.deletePolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves all the policies that are attached to the specified resource, or anywhere in the + * ancestry of the resource. For example, for a project this endpoint would return all the + * `denyPolicy` kind policies attached to the project, its parent folder (if any), and its parent + * organization (if any). The endpoint requires the same permissions that it would take to call + * `ListPolicies` or `GetPolicy`. + * + *

The main reason to use this endpoint is as a policy admin to debug access issues for a + * 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   String attachmentPoint = "attachmentPoint-686994899";
+   *   for (Policy element : policiesClient.listApplicablePolicies(attachmentPoint).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param attachmentPoint Required. The Cloud resource at which the applicable policies are to be + * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource name, which means + * that the forward-slash character, `/`, must be written as `%2F`. For example, + * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListApplicablePoliciesPagedResponse listApplicablePolicies(String attachmentPoint) { + ListApplicablePoliciesRequest request = + ListApplicablePoliciesRequest.newBuilder().setAttachmentPoint(attachmentPoint).build(); + return listApplicablePolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves all the policies that are attached to the specified resource, or anywhere in the + * ancestry of the resource. For example, for a project this endpoint would return all the + * `denyPolicy` kind policies attached to the project, its parent folder (if any), and its parent + * organization (if any). The endpoint requires the same permissions that it would take to call + * `ListPolicies` or `GetPolicy`. + * + *

The main reason to use this endpoint is as a policy admin to debug access issues for a + * 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   ListApplicablePoliciesRequest request =
+   *       ListApplicablePoliciesRequest.newBuilder()
+   *           .setAttachmentPoint("attachmentPoint-686994899")
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (Policy element : policiesClient.listApplicablePolicies(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 ListApplicablePoliciesPagedResponse listApplicablePolicies( + ListApplicablePoliciesRequest request) { + return listApplicablePoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves all the policies that are attached to the specified resource, or anywhere in the + * ancestry of the resource. For example, for a project this endpoint would return all the + * `denyPolicy` kind policies attached to the project, its parent folder (if any), and its parent + * organization (if any). The endpoint requires the same permissions that it would take to call + * `ListPolicies` or `GetPolicy`. + * + *

The main reason to use this endpoint is as a policy admin to debug access issues for a + * 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   ListApplicablePoliciesRequest request =
+   *       ListApplicablePoliciesRequest.newBuilder()
+   *           .setAttachmentPoint("attachmentPoint-686994899")
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       policiesClient.listApplicablePoliciesPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Policy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listApplicablePoliciesPagedCallable() { + return stub.listApplicablePoliciesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves all the policies that are attached to the specified resource, or anywhere in the + * ancestry of the resource. For example, for a project this endpoint would return all the + * `denyPolicy` kind policies attached to the project, its parent folder (if any), and its parent + * organization (if any). The endpoint requires the same permissions that it would take to call + * `ListPolicies` or `GetPolicy`. + * + *

The main reason to use this endpoint is as a policy admin to debug access issues for a + * 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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   ListApplicablePoliciesRequest request =
+   *       ListApplicablePoliciesRequest.newBuilder()
+   *           .setAttachmentPoint("attachmentPoint-686994899")
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   while (true) {
+   *     ListApplicablePoliciesResponse response =
+   *         policiesClient.listApplicablePoliciesCallable().call(request);
+   *     for (Policy element : response.getPoliciesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listApplicablePoliciesCallable() { + return stub.listApplicablePoliciesCallable(); + } + + @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 ListPoliciesPagedResponse + extends AbstractPagedListResponse< + ListPoliciesRequest, + ListPoliciesResponse, + Policy, + ListPoliciesPage, + ListPoliciesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListPoliciesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListPoliciesPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListPoliciesPagedResponse(ListPoliciesPage page) { + super(page, ListPoliciesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListPoliciesPage + extends AbstractPage { + + private ListPoliciesPage( + PageContext context, + ListPoliciesResponse response) { + super(context, response); + } + + private static ListPoliciesPage createEmptyPage() { + return new ListPoliciesPage(null, null); + } + + @Override + protected ListPoliciesPage createPage( + PageContext context, + ListPoliciesResponse response) { + return new ListPoliciesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListPoliciesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListPoliciesRequest, + ListPoliciesResponse, + Policy, + ListPoliciesPage, + ListPoliciesFixedSizeCollection> { + + private ListPoliciesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListPoliciesFixedSizeCollection createEmptyCollection() { + return new ListPoliciesFixedSizeCollection(null, 0); + } + + @Override + protected ListPoliciesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListPoliciesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListApplicablePoliciesPagedResponse + extends AbstractPagedListResponse< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + Policy, + ListApplicablePoliciesPage, + ListApplicablePoliciesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListApplicablePoliciesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListApplicablePoliciesPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListApplicablePoliciesPagedResponse(ListApplicablePoliciesPage page) { + super(page, ListApplicablePoliciesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListApplicablePoliciesPage + extends AbstractPage< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + Policy, + ListApplicablePoliciesPage> { + + private ListApplicablePoliciesPage( + PageContext context, + ListApplicablePoliciesResponse response) { + super(context, response); + } + + private static ListApplicablePoliciesPage createEmptyPage() { + return new ListApplicablePoliciesPage(null, null); + } + + @Override + protected ListApplicablePoliciesPage createPage( + PageContext context, + ListApplicablePoliciesResponse response) { + return new ListApplicablePoliciesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListApplicablePoliciesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + Policy, + ListApplicablePoliciesPage, + ListApplicablePoliciesFixedSizeCollection> { + + private ListApplicablePoliciesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListApplicablePoliciesFixedSizeCollection createEmptyCollection() { + return new ListApplicablePoliciesFixedSizeCollection(null, 0); + } + + @Override + protected ListApplicablePoliciesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListApplicablePoliciesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesSettings.java b/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesSettings.java new file mode 100644 index 00000000..a8e27342 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesSettings.java @@ -0,0 +1,303 @@ +/* + * 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.iam.v2; + +import static com.google.iam.v2.PoliciesClient.ListApplicablePoliciesPagedResponse; +import static com.google.iam.v2.PoliciesClient.ListPoliciesPagedResponse; + +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.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.iam.v2.stub.PoliciesStubSettings; +import com.google.longrunning.Operation; +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 PoliciesClient}. + * + *

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

    + *
  • The default service address (iam.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 getPolicy 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
+ * PoliciesSettings.Builder policiesSettingsBuilder = PoliciesSettings.newBuilder();
+ * policiesSettingsBuilder
+ *     .getPolicySettings()
+ *     .setRetrySettings(
+ *         policiesSettingsBuilder.getPolicySettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * PoliciesSettings policiesSettings = policiesSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class PoliciesSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to listPolicies. */ + public PagedCallSettings + listPoliciesSettings() { + return ((PoliciesStubSettings) getStubSettings()).listPoliciesSettings(); + } + + /** Returns the object with the settings used for calls to getPolicy. */ + public UnaryCallSettings getPolicySettings() { + return ((PoliciesStubSettings) getStubSettings()).getPolicySettings(); + } + + /** Returns the object with the settings used for calls to createPolicy. */ + public UnaryCallSettings createPolicySettings() { + return ((PoliciesStubSettings) getStubSettings()).createPolicySettings(); + } + + /** Returns the object with the settings used for calls to createPolicy. */ + public OperationCallSettings + createPolicyOperationSettings() { + return ((PoliciesStubSettings) getStubSettings()).createPolicyOperationSettings(); + } + + /** Returns the object with the settings used for calls to updatePolicy. */ + public UnaryCallSettings updatePolicySettings() { + return ((PoliciesStubSettings) getStubSettings()).updatePolicySettings(); + } + + /** Returns the object with the settings used for calls to updatePolicy. */ + public OperationCallSettings + updatePolicyOperationSettings() { + return ((PoliciesStubSettings) getStubSettings()).updatePolicyOperationSettings(); + } + + /** Returns the object with the settings used for calls to deletePolicy. */ + public UnaryCallSettings deletePolicySettings() { + return ((PoliciesStubSettings) getStubSettings()).deletePolicySettings(); + } + + /** Returns the object with the settings used for calls to deletePolicy. */ + public OperationCallSettings + deletePolicyOperationSettings() { + return ((PoliciesStubSettings) getStubSettings()).deletePolicyOperationSettings(); + } + + /** Returns the object with the settings used for calls to listApplicablePolicies. */ + public PagedCallSettings< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + ListApplicablePoliciesPagedResponse> + listApplicablePoliciesSettings() { + return ((PoliciesStubSettings) getStubSettings()).listApplicablePoliciesSettings(); + } + + public static final PoliciesSettings create(PoliciesStubSettings stub) throws IOException { + return new PoliciesSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return PoliciesStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return PoliciesStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return PoliciesStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return PoliciesStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return PoliciesStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return PoliciesStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return PoliciesStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return PoliciesStubSettings.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 PoliciesSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for PoliciesSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(PoliciesStubSettings.newBuilder(clientContext)); + } + + protected Builder(PoliciesSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(PoliciesStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(PoliciesStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(PoliciesStubSettings.newHttpJsonBuilder()); + } + + public PoliciesStubSettings.Builder getStubSettingsBuilder() { + return ((PoliciesStubSettings.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 listPolicies. */ + public PagedCallSettings.Builder< + ListPoliciesRequest, ListPoliciesResponse, ListPoliciesPagedResponse> + listPoliciesSettings() { + return getStubSettingsBuilder().listPoliciesSettings(); + } + + /** Returns the builder for the settings used for calls to getPolicy. */ + public UnaryCallSettings.Builder getPolicySettings() { + return getStubSettingsBuilder().getPolicySettings(); + } + + /** Returns the builder for the settings used for calls to createPolicy. */ + public UnaryCallSettings.Builder createPolicySettings() { + return getStubSettingsBuilder().createPolicySettings(); + } + + /** Returns the builder for the settings used for calls to createPolicy. */ + public OperationCallSettings.Builder + createPolicyOperationSettings() { + return getStubSettingsBuilder().createPolicyOperationSettings(); + } + + /** Returns the builder for the settings used for calls to updatePolicy. */ + public UnaryCallSettings.Builder updatePolicySettings() { + return getStubSettingsBuilder().updatePolicySettings(); + } + + /** Returns the builder for the settings used for calls to updatePolicy. */ + public OperationCallSettings.Builder + updatePolicyOperationSettings() { + return getStubSettingsBuilder().updatePolicyOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deletePolicy. */ + public UnaryCallSettings.Builder deletePolicySettings() { + return getStubSettingsBuilder().deletePolicySettings(); + } + + /** Returns the builder for the settings used for calls to deletePolicy. */ + public OperationCallSettings.Builder + deletePolicyOperationSettings() { + return getStubSettingsBuilder().deletePolicyOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listApplicablePolicies. */ + public PagedCallSettings.Builder< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + ListApplicablePoliciesPagedResponse> + listApplicablePoliciesSettings() { + return getStubSettingsBuilder().listApplicablePoliciesSettings(); + } + + @Override + public PoliciesSettings build() throws IOException { + return new PoliciesSettings(this); + } + } +} diff --git a/google-iam-policy/src/main/java/com/google/iam/v2/gapic_metadata.json b/google-iam-policy/src/main/java/com/google/iam/v2/gapic_metadata.json new file mode 100644 index 00000000..c0965438 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/gapic_metadata.json @@ -0,0 +1,36 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.iam.v2", + "libraryPackage": "com.google.iam.v2", + "services": { + "Policies": { + "clients": { + "grpc": { + "libraryClient": "PoliciesClient", + "rpcs": { + "CreatePolicy": { + "methods": ["createPolicyAsync", "createPolicyAsync", "createPolicyOperationCallable", "createPolicyCallable"] + }, + "DeletePolicy": { + "methods": ["deletePolicyAsync", "deletePolicyAsync", "deletePolicyOperationCallable", "deletePolicyCallable"] + }, + "GetPolicy": { + "methods": ["getPolicy", "getPolicy", "getPolicyCallable"] + }, + "ListApplicablePolicies": { + "methods": ["listApplicablePolicies", "listApplicablePolicies", "listApplicablePoliciesPagedCallable", "listApplicablePoliciesCallable"] + }, + "ListPolicies": { + "methods": ["listPolicies", "listPolicies", "listPoliciesPagedCallable", "listPoliciesCallable"] + }, + "UpdatePolicy": { + "methods": ["updatePolicyAsync", "updatePolicyOperationCallable", "updatePolicyCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/google-iam-policy/src/main/java/com/google/iam/v2/package-info.java b/google-iam-policy/src/main/java/com/google/iam/v2/package-info.java new file mode 100644 index 00000000..1994b92c --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/package-info.java @@ -0,0 +1,43 @@ +/* + * 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 Identity and Access Management (IAM) API + * + *

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

======================= PoliciesClient ======================= + * + *

Service Description: An interface for managing Identity and Access Management (IAM) policies. + * + *

Sample for PoliciesClient: + * + *

{@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 (PoliciesClient policiesClient = PoliciesClient.create()) {
+ *   String name = "name3373707";
+ *   Policy response = policiesClient.getPolicy(name);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.iam.v2; + +import javax.annotation.Generated; diff --git a/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesCallableFactory.java b/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesCallableFactory.java new file mode 100644 index 00000000..a09e6477 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesCallableFactory.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.iam.v2.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 Policies service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcPoliciesCallableFactory 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/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesStub.java b/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesStub.java new file mode 100644 index 00000000..3a0f0620 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesStub.java @@ -0,0 +1,384 @@ +/* + * 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.iam.v2.stub; + +import static com.google.iam.v2.PoliciesClient.ListApplicablePoliciesPagedResponse; +import static com.google.iam.v2.PoliciesClient.ListPoliciesPagedResponse; + +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.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.iam.v2.CreatePolicyRequest; +import com.google.iam.v2.DeletePolicyRequest; +import com.google.iam.v2.GetPolicyRequest; +import com.google.iam.v2.ListApplicablePoliciesRequest; +import com.google.iam.v2.ListApplicablePoliciesResponse; +import com.google.iam.v2.ListPoliciesRequest; +import com.google.iam.v2.ListPoliciesResponse; +import com.google.iam.v2.Policy; +import com.google.iam.v2.PolicyOperationMetadata; +import com.google.iam.v2.UpdatePolicyRequest; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +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 Policies service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcPoliciesStub extends PoliciesStub { + private static final MethodDescriptor + listPoliciesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v2.Policies/ListPolicies") + .setRequestMarshaller(ProtoUtils.marshaller(ListPoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListPoliciesResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v2.Policies/GetPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + createPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v2.Policies/CreatePolicy") + .setRequestMarshaller(ProtoUtils.marshaller(CreatePolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updatePolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v2.Policies/UpdatePolicy") + .setRequestMarshaller(ProtoUtils.marshaller(UpdatePolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deletePolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v2.Policies/DeletePolicy") + .setRequestMarshaller(ProtoUtils.marshaller(DeletePolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor< + ListApplicablePoliciesRequest, ListApplicablePoliciesResponse> + listApplicablePoliciesMethodDescriptor = + MethodDescriptor + .newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v2.Policies/ListApplicablePolicies") + .setRequestMarshaller( + ProtoUtils.marshaller(ListApplicablePoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListApplicablePoliciesResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable listPoliciesCallable; + private final UnaryCallable + listPoliciesPagedCallable; + private final UnaryCallable getPolicyCallable; + private final UnaryCallable createPolicyCallable; + private final OperationCallable + createPolicyOperationCallable; + private final UnaryCallable updatePolicyCallable; + private final OperationCallable + updatePolicyOperationCallable; + private final UnaryCallable deletePolicyCallable; + private final OperationCallable + deletePolicyOperationCallable; + private final UnaryCallable + listApplicablePoliciesCallable; + private final UnaryCallable + listApplicablePoliciesPagedCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcPoliciesStub create(PoliciesStubSettings settings) throws IOException { + return new GrpcPoliciesStub(settings, ClientContext.create(settings)); + } + + public static final GrpcPoliciesStub create(ClientContext clientContext) throws IOException { + return new GrpcPoliciesStub(PoliciesStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcPoliciesStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcPoliciesStub( + PoliciesStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcPoliciesStub, 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 GrpcPoliciesStub(PoliciesStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcPoliciesCallableFactory()); + } + + /** + * Constructs an instance of GrpcPoliciesStub, 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 GrpcPoliciesStub( + PoliciesStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings listPoliciesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listPoliciesMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings getPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings createPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings updatePolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updatePolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("policy.name", String.valueOf(request.getPolicy().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings deletePolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deletePolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + listApplicablePoliciesTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(listApplicablePoliciesMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("attachment_point", String.valueOf(request.getAttachmentPoint())); + return params.build(); + }) + .build(); + + this.listPoliciesCallable = + callableFactory.createUnaryCallable( + listPoliciesTransportSettings, settings.listPoliciesSettings(), clientContext); + this.listPoliciesPagedCallable = + callableFactory.createPagedCallable( + listPoliciesTransportSettings, settings.listPoliciesSettings(), clientContext); + this.getPolicyCallable = + callableFactory.createUnaryCallable( + getPolicyTransportSettings, settings.getPolicySettings(), clientContext); + this.createPolicyCallable = + callableFactory.createUnaryCallable( + createPolicyTransportSettings, settings.createPolicySettings(), clientContext); + this.createPolicyOperationCallable = + callableFactory.createOperationCallable( + createPolicyTransportSettings, + settings.createPolicyOperationSettings(), + clientContext, + operationsStub); + this.updatePolicyCallable = + callableFactory.createUnaryCallable( + updatePolicyTransportSettings, settings.updatePolicySettings(), clientContext); + this.updatePolicyOperationCallable = + callableFactory.createOperationCallable( + updatePolicyTransportSettings, + settings.updatePolicyOperationSettings(), + clientContext, + operationsStub); + this.deletePolicyCallable = + callableFactory.createUnaryCallable( + deletePolicyTransportSettings, settings.deletePolicySettings(), clientContext); + this.deletePolicyOperationCallable = + callableFactory.createOperationCallable( + deletePolicyTransportSettings, + settings.deletePolicyOperationSettings(), + clientContext, + operationsStub); + this.listApplicablePoliciesCallable = + callableFactory.createUnaryCallable( + listApplicablePoliciesTransportSettings, + settings.listApplicablePoliciesSettings(), + clientContext); + this.listApplicablePoliciesPagedCallable = + callableFactory.createPagedCallable( + listApplicablePoliciesTransportSettings, + settings.listApplicablePoliciesSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable listPoliciesCallable() { + return listPoliciesCallable; + } + + @Override + public UnaryCallable listPoliciesPagedCallable() { + return listPoliciesPagedCallable; + } + + @Override + public UnaryCallable getPolicyCallable() { + return getPolicyCallable; + } + + @Override + public UnaryCallable createPolicyCallable() { + return createPolicyCallable; + } + + @Override + public OperationCallable + createPolicyOperationCallable() { + return createPolicyOperationCallable; + } + + @Override + public UnaryCallable updatePolicyCallable() { + return updatePolicyCallable; + } + + @Override + public OperationCallable + updatePolicyOperationCallable() { + return updatePolicyOperationCallable; + } + + @Override + public UnaryCallable deletePolicyCallable() { + return deletePolicyCallable; + } + + @Override + public OperationCallable + deletePolicyOperationCallable() { + return deletePolicyOperationCallable; + } + + @Override + public UnaryCallable + listApplicablePoliciesCallable() { + return listApplicablePoliciesCallable; + } + + @Override + public UnaryCallable + listApplicablePoliciesPagedCallable() { + return listApplicablePoliciesPagedCallable; + } + + @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/google-iam-policy/src/main/java/com/google/iam/v2/stub/HttpJsonPoliciesCallableFactory.java b/google-iam-policy/src/main/java/com/google/iam/v2/stub/HttpJsonPoliciesCallableFactory.java new file mode 100644 index 00000000..27bd9b72 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/stub/HttpJsonPoliciesCallableFactory.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.iam.v2.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 Policies service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonPoliciesCallableFactory + 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/google-iam-policy/src/main/java/com/google/iam/v2/stub/HttpJsonPoliciesStub.java b/google-iam-policy/src/main/java/com/google/iam/v2/stub/HttpJsonPoliciesStub.java new file mode 100644 index 00000000..6370f750 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/stub/HttpJsonPoliciesStub.java @@ -0,0 +1,552 @@ +/* + * 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.iam.v2.stub; + +import static com.google.iam.v2.PoliciesClient.ListApplicablePoliciesPagedResponse; +import static com.google.iam.v2.PoliciesClient.ListPoliciesPagedResponse; + +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.HttpJsonOperationSnapshot; +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.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.iam.v2.CreatePolicyRequest; +import com.google.iam.v2.DeletePolicyRequest; +import com.google.iam.v2.GetPolicyRequest; +import com.google.iam.v2.ListApplicablePoliciesRequest; +import com.google.iam.v2.ListApplicablePoliciesResponse; +import com.google.iam.v2.ListPoliciesRequest; +import com.google.iam.v2.ListPoliciesResponse; +import com.google.iam.v2.Policy; +import com.google.iam.v2.PolicyOperationMetadata; +import com.google.iam.v2.UpdatePolicyRequest; +import com.google.longrunning.Operation; +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 Policies service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonPoliciesStub extends PoliciesStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(PolicyOperationMetadata.getDescriptor()) + .add(Policy.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + listPoliciesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v2.Policies/ListPolicies") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=policies/*/*}", + 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, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListPoliciesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor getPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v2.Policies/GetPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=policies/*/*/*}", + 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(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v2.Policies/CreatePolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=policies/*/*}", + 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, "policyId", request.getPolicyId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("policy", request.getPolicy(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreatePolicyRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updatePolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v2.Policies/UpdatePolicy") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{policy.name=policies/*/*/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "policy.name", request.getPolicy().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("policy", request.getPolicy(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdatePolicyRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deletePolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v2.Policies/DeletePolicy") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=policies/*/*/*}", + 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, "etag", request.getEtag()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeletePolicyRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + ListApplicablePoliciesRequest, ListApplicablePoliciesResponse> + listApplicablePoliciesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.iam.v2.Policies/ListApplicablePolicies") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{attachmentPoint=*}:listApplicablePolicies", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "attachmentPoint", request.getAttachmentPoint()); + 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()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListApplicablePoliciesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable listPoliciesCallable; + private final UnaryCallable + listPoliciesPagedCallable; + private final UnaryCallable getPolicyCallable; + private final UnaryCallable createPolicyCallable; + private final OperationCallable + createPolicyOperationCallable; + private final UnaryCallable updatePolicyCallable; + private final OperationCallable + updatePolicyOperationCallable; + private final UnaryCallable deletePolicyCallable; + private final OperationCallable + deletePolicyOperationCallable; + private final UnaryCallable + listApplicablePoliciesCallable; + private final UnaryCallable + listApplicablePoliciesPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonPoliciesStub create(PoliciesStubSettings settings) + throws IOException { + return new HttpJsonPoliciesStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonPoliciesStub create(ClientContext clientContext) throws IOException { + return new HttpJsonPoliciesStub( + PoliciesStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonPoliciesStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonPoliciesStub( + PoliciesStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonPoliciesStub, 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 HttpJsonPoliciesStub(PoliciesStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonPoliciesCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonPoliciesStub, 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 HttpJsonPoliciesStub( + PoliciesStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings listPoliciesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listPoliciesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updatePolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updatePolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deletePolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deletePolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listApplicablePoliciesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listApplicablePoliciesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.listPoliciesCallable = + callableFactory.createUnaryCallable( + listPoliciesTransportSettings, settings.listPoliciesSettings(), clientContext); + this.listPoliciesPagedCallable = + callableFactory.createPagedCallable( + listPoliciesTransportSettings, settings.listPoliciesSettings(), clientContext); + this.getPolicyCallable = + callableFactory.createUnaryCallable( + getPolicyTransportSettings, settings.getPolicySettings(), clientContext); + this.createPolicyCallable = + callableFactory.createUnaryCallable( + createPolicyTransportSettings, settings.createPolicySettings(), clientContext); + this.createPolicyOperationCallable = + callableFactory.createOperationCallable( + createPolicyTransportSettings, + settings.createPolicyOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updatePolicyCallable = + callableFactory.createUnaryCallable( + updatePolicyTransportSettings, settings.updatePolicySettings(), clientContext); + this.updatePolicyOperationCallable = + callableFactory.createOperationCallable( + updatePolicyTransportSettings, + settings.updatePolicyOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deletePolicyCallable = + callableFactory.createUnaryCallable( + deletePolicyTransportSettings, settings.deletePolicySettings(), clientContext); + this.deletePolicyOperationCallable = + callableFactory.createOperationCallable( + deletePolicyTransportSettings, + settings.deletePolicyOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listApplicablePoliciesCallable = + callableFactory.createUnaryCallable( + listApplicablePoliciesTransportSettings, + settings.listApplicablePoliciesSettings(), + clientContext); + this.listApplicablePoliciesPagedCallable = + callableFactory.createPagedCallable( + listApplicablePoliciesTransportSettings, + settings.listApplicablePoliciesSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(listPoliciesMethodDescriptor); + methodDescriptors.add(getPolicyMethodDescriptor); + methodDescriptors.add(createPolicyMethodDescriptor); + methodDescriptors.add(updatePolicyMethodDescriptor); + methodDescriptors.add(deletePolicyMethodDescriptor); + methodDescriptors.add(listApplicablePoliciesMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable listPoliciesCallable() { + return listPoliciesCallable; + } + + @Override + public UnaryCallable listPoliciesPagedCallable() { + return listPoliciesPagedCallable; + } + + @Override + public UnaryCallable getPolicyCallable() { + return getPolicyCallable; + } + + @Override + public UnaryCallable createPolicyCallable() { + return createPolicyCallable; + } + + @Override + public OperationCallable + createPolicyOperationCallable() { + return createPolicyOperationCallable; + } + + @Override + public UnaryCallable updatePolicyCallable() { + return updatePolicyCallable; + } + + @Override + public OperationCallable + updatePolicyOperationCallable() { + return updatePolicyOperationCallable; + } + + @Override + public UnaryCallable deletePolicyCallable() { + return deletePolicyCallable; + } + + @Override + public OperationCallable + deletePolicyOperationCallable() { + return deletePolicyOperationCallable; + } + + @Override + public UnaryCallable + listApplicablePoliciesCallable() { + return listApplicablePoliciesCallable; + } + + @Override + public UnaryCallable + listApplicablePoliciesPagedCallable() { + return listApplicablePoliciesPagedCallable; + } + + @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/google-iam-policy/src/main/java/com/google/iam/v2/stub/PoliciesStub.java b/google-iam-policy/src/main/java/com/google/iam/v2/stub/PoliciesStub.java new file mode 100644 index 00000000..f00f4af8 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/stub/PoliciesStub.java @@ -0,0 +1,108 @@ +/* + * 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.iam.v2.stub; + +import static com.google.iam.v2.PoliciesClient.ListApplicablePoliciesPagedResponse; +import static com.google.iam.v2.PoliciesClient.ListPoliciesPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.iam.v2.CreatePolicyRequest; +import com.google.iam.v2.DeletePolicyRequest; +import com.google.iam.v2.GetPolicyRequest; +import com.google.iam.v2.ListApplicablePoliciesRequest; +import com.google.iam.v2.ListApplicablePoliciesResponse; +import com.google.iam.v2.ListPoliciesRequest; +import com.google.iam.v2.ListPoliciesResponse; +import com.google.iam.v2.Policy; +import com.google.iam.v2.PolicyOperationMetadata; +import com.google.iam.v2.UpdatePolicyRequest; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Policies service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class PoliciesStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + + public UnaryCallable listPoliciesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listPoliciesPagedCallable()"); + } + + public UnaryCallable listPoliciesCallable() { + throw new UnsupportedOperationException("Not implemented: listPoliciesCallable()"); + } + + public UnaryCallable getPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getPolicyCallable()"); + } + + public OperationCallable + createPolicyOperationCallable() { + throw new UnsupportedOperationException("Not implemented: createPolicyOperationCallable()"); + } + + public UnaryCallable createPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: createPolicyCallable()"); + } + + public OperationCallable + updatePolicyOperationCallable() { + throw new UnsupportedOperationException("Not implemented: updatePolicyOperationCallable()"); + } + + public UnaryCallable updatePolicyCallable() { + throw new UnsupportedOperationException("Not implemented: updatePolicyCallable()"); + } + + public OperationCallable + deletePolicyOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deletePolicyOperationCallable()"); + } + + public UnaryCallable deletePolicyCallable() { + throw new UnsupportedOperationException("Not implemented: deletePolicyCallable()"); + } + + public UnaryCallable + listApplicablePoliciesPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listApplicablePoliciesPagedCallable()"); + } + + public UnaryCallable + listApplicablePoliciesCallable() { + throw new UnsupportedOperationException("Not implemented: listApplicablePoliciesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-iam-policy/src/main/java/com/google/iam/v2/stub/PoliciesStubSettings.java b/google-iam-policy/src/main/java/com/google/iam/v2/stub/PoliciesStubSettings.java new file mode 100644 index 00000000..3a7ffe92 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/stub/PoliciesStubSettings.java @@ -0,0 +1,738 @@ +/* + * 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.iam.v2.stub; + +import static com.google.iam.v2.PoliciesClient.ListApplicablePoliciesPagedResponse; +import static com.google.iam.v2.PoliciesClient.ListPoliciesPagedResponse; + +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.grpc.ProtoOperationTransformers; +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.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +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.OperationCallSettings; +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.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.v2.CreatePolicyRequest; +import com.google.iam.v2.DeletePolicyRequest; +import com.google.iam.v2.GetPolicyRequest; +import com.google.iam.v2.ListApplicablePoliciesRequest; +import com.google.iam.v2.ListApplicablePoliciesResponse; +import com.google.iam.v2.ListPoliciesRequest; +import com.google.iam.v2.ListPoliciesResponse; +import com.google.iam.v2.Policy; +import com.google.iam.v2.PolicyOperationMetadata; +import com.google.iam.v2.UpdatePolicyRequest; +import com.google.longrunning.Operation; +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 PoliciesStub}. + * + *

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

    + *
  • The default service address (iam.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 getPolicy 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
+ * PoliciesStubSettings.Builder policiesSettingsBuilder = PoliciesStubSettings.newBuilder();
+ * policiesSettingsBuilder
+ *     .getPolicySettings()
+ *     .setRetrySettings(
+ *         policiesSettingsBuilder.getPolicySettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * PoliciesStubSettings policiesSettings = policiesSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class PoliciesStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final PagedCallSettings< + ListPoliciesRequest, ListPoliciesResponse, ListPoliciesPagedResponse> + listPoliciesSettings; + private final UnaryCallSettings getPolicySettings; + private final UnaryCallSettings createPolicySettings; + private final OperationCallSettings + createPolicyOperationSettings; + private final UnaryCallSettings updatePolicySettings; + private final OperationCallSettings + updatePolicyOperationSettings; + private final UnaryCallSettings deletePolicySettings; + private final OperationCallSettings + deletePolicyOperationSettings; + private final PagedCallSettings< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + ListApplicablePoliciesPagedResponse> + listApplicablePoliciesSettings; + + private static final PagedListDescriptor + LIST_POLICIES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListPoliciesRequest injectToken(ListPoliciesRequest payload, String token) { + return ListPoliciesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListPoliciesRequest injectPageSize(ListPoliciesRequest payload, int pageSize) { + return ListPoliciesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListPoliciesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListPoliciesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListPoliciesResponse payload) { + return payload.getPoliciesList() == null + ? ImmutableList.of() + : payload.getPoliciesList(); + } + }; + + private static final PagedListDescriptor< + ListApplicablePoliciesRequest, ListApplicablePoliciesResponse, Policy> + LIST_APPLICABLE_POLICIES_PAGE_STR_DESC = + new PagedListDescriptor< + ListApplicablePoliciesRequest, ListApplicablePoliciesResponse, Policy>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListApplicablePoliciesRequest injectToken( + ListApplicablePoliciesRequest payload, String token) { + return ListApplicablePoliciesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListApplicablePoliciesRequest injectPageSize( + ListApplicablePoliciesRequest payload, int pageSize) { + return ListApplicablePoliciesRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListApplicablePoliciesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListApplicablePoliciesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListApplicablePoliciesResponse payload) { + return payload.getPoliciesList() == null + ? ImmutableList.of() + : payload.getPoliciesList(); + } + }; + + private static final PagedListResponseFactory< + ListPoliciesRequest, ListPoliciesResponse, ListPoliciesPagedResponse> + LIST_POLICIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListPoliciesRequest, ListPoliciesResponse, ListPoliciesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListPoliciesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_POLICIES_PAGE_STR_DESC, request, context); + return ListPoliciesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + ListApplicablePoliciesPagedResponse> + LIST_APPLICABLE_POLICIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + ListApplicablePoliciesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListApplicablePoliciesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_APPLICABLE_POLICIES_PAGE_STR_DESC, request, context); + return ListApplicablePoliciesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to listPolicies. */ + public PagedCallSettings + listPoliciesSettings() { + return listPoliciesSettings; + } + + /** Returns the object with the settings used for calls to getPolicy. */ + public UnaryCallSettings getPolicySettings() { + return getPolicySettings; + } + + /** Returns the object with the settings used for calls to createPolicy. */ + public UnaryCallSettings createPolicySettings() { + return createPolicySettings; + } + + /** Returns the object with the settings used for calls to createPolicy. */ + public OperationCallSettings + createPolicyOperationSettings() { + return createPolicyOperationSettings; + } + + /** Returns the object with the settings used for calls to updatePolicy. */ + public UnaryCallSettings updatePolicySettings() { + return updatePolicySettings; + } + + /** Returns the object with the settings used for calls to updatePolicy. */ + public OperationCallSettings + updatePolicyOperationSettings() { + return updatePolicyOperationSettings; + } + + /** Returns the object with the settings used for calls to deletePolicy. */ + public UnaryCallSettings deletePolicySettings() { + return deletePolicySettings; + } + + /** Returns the object with the settings used for calls to deletePolicy. */ + public OperationCallSettings + deletePolicyOperationSettings() { + return deletePolicyOperationSettings; + } + + /** Returns the object with the settings used for calls to listApplicablePolicies. */ + public PagedCallSettings< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + ListApplicablePoliciesPagedResponse> + listApplicablePoliciesSettings() { + return listApplicablePoliciesSettings; + } + + public PoliciesStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcPoliciesStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonPoliciesStub.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 "iam.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "iam.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(PoliciesStubSettings.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(PoliciesStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return PoliciesStubSettings.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 PoliciesStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listPoliciesSettings = settingsBuilder.listPoliciesSettings().build(); + getPolicySettings = settingsBuilder.getPolicySettings().build(); + createPolicySettings = settingsBuilder.createPolicySettings().build(); + createPolicyOperationSettings = settingsBuilder.createPolicyOperationSettings().build(); + updatePolicySettings = settingsBuilder.updatePolicySettings().build(); + updatePolicyOperationSettings = settingsBuilder.updatePolicyOperationSettings().build(); + deletePolicySettings = settingsBuilder.deletePolicySettings().build(); + deletePolicyOperationSettings = settingsBuilder.deletePolicyOperationSettings().build(); + listApplicablePoliciesSettings = settingsBuilder.listApplicablePoliciesSettings().build(); + } + + /** Builder for PoliciesStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final PagedCallSettings.Builder< + ListPoliciesRequest, ListPoliciesResponse, ListPoliciesPagedResponse> + listPoliciesSettings; + private final UnaryCallSettings.Builder getPolicySettings; + private final UnaryCallSettings.Builder createPolicySettings; + private final OperationCallSettings.Builder< + CreatePolicyRequest, Policy, PolicyOperationMetadata> + createPolicyOperationSettings; + private final UnaryCallSettings.Builder updatePolicySettings; + private final OperationCallSettings.Builder< + UpdatePolicyRequest, Policy, PolicyOperationMetadata> + updatePolicyOperationSettings; + private final UnaryCallSettings.Builder deletePolicySettings; + private final OperationCallSettings.Builder< + DeletePolicyRequest, Policy, PolicyOperationMetadata> + deletePolicyOperationSettings; + private final PagedCallSettings.Builder< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + ListApplicablePoliciesPagedResponse> + listApplicablePoliciesSettings; + 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))); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + 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); + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + listPoliciesSettings = PagedCallSettings.newBuilder(LIST_POLICIES_PAGE_STR_FACT); + getPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createPolicyOperationSettings = OperationCallSettings.newBuilder(); + updatePolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updatePolicyOperationSettings = OperationCallSettings.newBuilder(); + deletePolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deletePolicyOperationSettings = OperationCallSettings.newBuilder(); + listApplicablePoliciesSettings = + PagedCallSettings.newBuilder(LIST_APPLICABLE_POLICIES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listPoliciesSettings, + getPolicySettings, + createPolicySettings, + updatePolicySettings, + deletePolicySettings, + listApplicablePoliciesSettings); + initDefaults(this); + } + + protected Builder(PoliciesStubSettings settings) { + super(settings); + + listPoliciesSettings = settings.listPoliciesSettings.toBuilder(); + getPolicySettings = settings.getPolicySettings.toBuilder(); + createPolicySettings = settings.createPolicySettings.toBuilder(); + createPolicyOperationSettings = settings.createPolicyOperationSettings.toBuilder(); + updatePolicySettings = settings.updatePolicySettings.toBuilder(); + updatePolicyOperationSettings = settings.updatePolicyOperationSettings.toBuilder(); + deletePolicySettings = settings.deletePolicySettings.toBuilder(); + deletePolicyOperationSettings = settings.deletePolicyOperationSettings.toBuilder(); + listApplicablePoliciesSettings = settings.listApplicablePoliciesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listPoliciesSettings, + getPolicySettings, + createPolicySettings, + updatePolicySettings, + deletePolicySettings, + listApplicablePoliciesSettings); + } + + 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 + .listPoliciesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .createPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .updatePolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .deletePolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .listApplicablePoliciesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .createPolicyOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Policy.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(PolicyOperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .updatePolicyOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Policy.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(PolicyOperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .deletePolicyOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Policy.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(PolicyOperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + 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 listPolicies. */ + public PagedCallSettings.Builder< + ListPoliciesRequest, ListPoliciesResponse, ListPoliciesPagedResponse> + listPoliciesSettings() { + return listPoliciesSettings; + } + + /** Returns the builder for the settings used for calls to getPolicy. */ + public UnaryCallSettings.Builder getPolicySettings() { + return getPolicySettings; + } + + /** Returns the builder for the settings used for calls to createPolicy. */ + public UnaryCallSettings.Builder createPolicySettings() { + return createPolicySettings; + } + + /** Returns the builder for the settings used for calls to createPolicy. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createPolicyOperationSettings() { + return createPolicyOperationSettings; + } + + /** Returns the builder for the settings used for calls to updatePolicy. */ + public UnaryCallSettings.Builder updatePolicySettings() { + return updatePolicySettings; + } + + /** Returns the builder for the settings used for calls to updatePolicy. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updatePolicyOperationSettings() { + return updatePolicyOperationSettings; + } + + /** Returns the builder for the settings used for calls to deletePolicy. */ + public UnaryCallSettings.Builder deletePolicySettings() { + return deletePolicySettings; + } + + /** Returns the builder for the settings used for calls to deletePolicy. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deletePolicyOperationSettings() { + return deletePolicyOperationSettings; + } + + /** Returns the builder for the settings used for calls to listApplicablePolicies. */ + public PagedCallSettings.Builder< + ListApplicablePoliciesRequest, + ListApplicablePoliciesResponse, + ListApplicablePoliciesPagedResponse> + listApplicablePoliciesSettings() { + return listApplicablePoliciesSettings; + } + + @Override + public PoliciesStubSettings build() throws IOException { + return new PoliciesStubSettings(this); + } + } +} diff --git a/google-iam-policy/src/test/java/com/google/iam/v2/MockPolicies.java b/google-iam-policy/src/test/java/com/google/iam/v2/MockPolicies.java new file mode 100644 index 00000000..52054775 --- /dev/null +++ b/google-iam-policy/src/test/java/com/google/iam/v2/MockPolicies.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.iam.v2; + +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 MockPolicies implements MockGrpcService { + private final MockPoliciesImpl serviceImpl; + + public MockPolicies() { + serviceImpl = new MockPoliciesImpl(); + } + + @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/google-iam-policy/src/test/java/com/google/iam/v2/MockPoliciesImpl.java b/google-iam-policy/src/test/java/com/google/iam/v2/MockPoliciesImpl.java new file mode 100644 index 00000000..1abaf30f --- /dev/null +++ b/google-iam-policy/src/test/java/com/google/iam/v2/MockPoliciesImpl.java @@ -0,0 +1,187 @@ +/* + * 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.iam.v2; + +import com.google.api.core.BetaApi; +import com.google.iam.v2.PoliciesGrpc.PoliciesImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +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 MockPoliciesImpl extends PoliciesImplBase { + private List requests; + private Queue responses; + + public MockPoliciesImpl() { + 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 listPolicies( + ListPoliciesRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListPoliciesResponse) { + requests.add(request); + responseObserver.onNext(((ListPoliciesResponse) 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 ListPolicies, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListPoliciesResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getPolicy(GetPolicyRequest 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 GetPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void createPolicy( + CreatePolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) 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 CreatePolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updatePolicy( + UpdatePolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) 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 UpdatePolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deletePolicy( + DeletePolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) 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 DeletePolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listApplicablePolicies( + ListApplicablePoliciesRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListApplicablePoliciesResponse) { + requests.add(request); + responseObserver.onNext(((ListApplicablePoliciesResponse) 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 ListApplicablePolicies, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListApplicablePoliciesResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/google-iam-policy/src/test/java/com/google/iam/v2/PoliciesClientHttpJsonTest.java b/google-iam-policy/src/test/java/com/google/iam/v2/PoliciesClientHttpJsonTest.java new file mode 100644 index 00000000..e6534c85 --- /dev/null +++ b/google-iam-policy/src/test/java/com/google/iam/v2/PoliciesClientHttpJsonTest.java @@ -0,0 +1,451 @@ +/* + * 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.iam.v2; + +import static com.google.iam.v2.PoliciesClient.ListApplicablePoliciesPagedResponse; +import static com.google.iam.v2.PoliciesClient.ListPoliciesPagedResponse; + +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.common.collect.Lists; +import com.google.iam.v2.stub.HttpJsonPoliciesStub; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +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 PoliciesClientHttpJsonTest { + private static MockHttpService mockService; + private static PoliciesClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonPoliciesStub.getMethodDescriptors(), PoliciesSettings.getDefaultEndpoint()); + PoliciesSettings settings = + PoliciesSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + PoliciesSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = PoliciesClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void listPoliciesTest() throws Exception { + Policy responsesElement = Policy.newBuilder().build(); + ListPoliciesResponse expectedResponse = + ListPoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllPolicies(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "policies/policie-1456/policie-1456"; + + ListPoliciesPagedResponse pagedListResponse = client.listPolicies(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPoliciesList().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 listPoliciesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "policies/policie-1456/policie-1456"; + client.listPolicies(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName("name3373707") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build(); + mockService.addResponse(expectedResponse); + + String name = "policies/policie-3260/policie-3260/policie-3260"; + + Policy actualResponse = client.getPolicy(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 getPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "policies/policie-3260/policie-3260/policie-3260"; + client.getPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName("name3373707") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPolicyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "policies/policie-1456/policie-1456"; + Policy policy = Policy.newBuilder().build(); + String policyId = "policyId546908653"; + + Policy actualResponse = client.createPolicyAsync(parent, policy, policyId).get(); + 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 createPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "policies/policie-1456/policie-1456"; + Policy policy = Policy.newBuilder().build(); + String policyId = "policyId546908653"; + client.createPolicyAsync(parent, policy, policyId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updatePolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName("name3373707") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updatePolicyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + UpdatePolicyRequest request = + UpdatePolicyRequest.newBuilder() + .setPolicy( + Policy.newBuilder() + .setName("policies/policie-3260/policie-3260/policie-3260") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build()) + .build(); + + Policy actualResponse = client.updatePolicyAsync(request).get(); + 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 updatePolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + UpdatePolicyRequest request = + UpdatePolicyRequest.newBuilder() + .setPolicy( + Policy.newBuilder() + .setName("policies/policie-3260/policie-3260/policie-3260") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build()) + .build(); + client.updatePolicyAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deletePolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName("name3373707") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePolicyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "policies/policie-3260/policie-3260/policie-3260"; + + Policy actualResponse = client.deletePolicyAsync(name).get(); + 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 deletePolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "policies/policie-3260/policie-3260/policie-3260"; + client.deletePolicyAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listApplicablePoliciesTest() throws Exception { + Policy responsesElement = Policy.newBuilder().build(); + ListApplicablePoliciesResponse expectedResponse = + ListApplicablePoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllPolicies(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String attachmentPoint = "attachmentPoint-4653"; + + ListApplicablePoliciesPagedResponse pagedListResponse = + client.listApplicablePolicies(attachmentPoint); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPoliciesList().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 listApplicablePoliciesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String attachmentPoint = "attachmentPoint-4653"; + client.listApplicablePolicies(attachmentPoint); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-iam-policy/src/test/java/com/google/iam/v2/PoliciesClientTest.java b/google-iam-policy/src/test/java/com/google/iam/v2/PoliciesClientTest.java new file mode 100644 index 00000000..5001a4d2 --- /dev/null +++ b/google-iam-policy/src/test/java/com/google/iam/v2/PoliciesClientTest.java @@ -0,0 +1,402 @@ +/* + * 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.iam.v2; + +import static com.google.iam.v2.PoliciesClient.ListApplicablePoliciesPagedResponse; +import static com.google.iam.v2.PoliciesClient.ListPoliciesPagedResponse; + +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.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +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 PoliciesClientTest { + private static MockPolicies mockPolicies; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private PoliciesClient client; + + @BeforeClass + public static void startStaticServer() { + mockPolicies = new MockPolicies(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockPolicies)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + PoliciesSettings settings = + PoliciesSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = PoliciesClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void listPoliciesTest() throws Exception { + Policy responsesElement = Policy.newBuilder().build(); + ListPoliciesResponse expectedResponse = + ListPoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllPolicies(Arrays.asList(responsesElement)) + .build(); + mockPolicies.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListPoliciesPagedResponse pagedListResponse = client.listPolicies(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPoliciesList().get(0), resources.get(0)); + + List actualRequests = mockPolicies.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListPoliciesRequest actualRequest = ((ListPoliciesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listPoliciesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPolicies.addException(exception); + + try { + String parent = "parent-995424086"; + client.listPolicies(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName("name3373707") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build(); + mockPolicies.addResponse(expectedResponse); + + String name = "name3373707"; + + Policy actualResponse = client.getPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPolicies.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetPolicyRequest actualRequest = ((GetPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPolicies.addException(exception); + + try { + String name = "name3373707"; + client.getPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName("name3373707") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createPolicyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockPolicies.addResponse(resultOperation); + + String parent = "parent-995424086"; + Policy policy = Policy.newBuilder().build(); + String policyId = "policyId546908653"; + + Policy actualResponse = client.createPolicyAsync(parent, policy, policyId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPolicies.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreatePolicyRequest actualRequest = ((CreatePolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertEquals(policyId, actualRequest.getPolicyId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPolicies.addException(exception); + + try { + String parent = "parent-995424086"; + Policy policy = Policy.newBuilder().build(); + String policyId = "policyId546908653"; + client.createPolicyAsync(parent, policy, policyId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void updatePolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName("name3373707") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updatePolicyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockPolicies.addResponse(resultOperation); + + UpdatePolicyRequest request = + UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build(); + + Policy actualResponse = client.updatePolicyAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPolicies.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdatePolicyRequest actualRequest = ((UpdatePolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updatePolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPolicies.addException(exception); + + try { + UpdatePolicyRequest request = + UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build(); + client.updatePolicyAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deletePolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName("name3373707") + .setUid("uid115792") + .setKind("kind3292052") + .setDisplayName("displayName1714148973") + .putAllAnnotations(new HashMap()) + .setEtag("etag3123477") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .addAllRules(new ArrayList()) + .setManagingAuthority("managingAuthority867537025") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePolicyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockPolicies.addResponse(resultOperation); + + String name = "name3373707"; + + Policy actualResponse = client.deletePolicyAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPolicies.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeletePolicyRequest actualRequest = ((DeletePolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deletePolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPolicies.addException(exception); + + try { + String name = "name3373707"; + client.deletePolicyAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listApplicablePoliciesTest() throws Exception { + Policy responsesElement = Policy.newBuilder().build(); + ListApplicablePoliciesResponse expectedResponse = + ListApplicablePoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllPolicies(Arrays.asList(responsesElement)) + .build(); + mockPolicies.addResponse(expectedResponse); + + String attachmentPoint = "attachmentPoint-686994899"; + + ListApplicablePoliciesPagedResponse pagedListResponse = + client.listApplicablePolicies(attachmentPoint); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPoliciesList().get(0), resources.get(0)); + + List actualRequests = mockPolicies.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListApplicablePoliciesRequest actualRequest = + ((ListApplicablePoliciesRequest) actualRequests.get(0)); + + Assert.assertEquals(attachmentPoint, actualRequest.getAttachmentPoint()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listApplicablePoliciesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPolicies.addException(exception); + + try { + String attachmentPoint = "attachmentPoint-686994899"; + client.listApplicablePolicies(attachmentPoint); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/grpc-google-iam-v2/pom.xml b/grpc-google-iam-v2/pom.xml new file mode 100644 index 00000000..adc16a23 --- /dev/null +++ b/grpc-google-iam-v2/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-iam-v2 + 1.5.3-SNAPSHOT + grpc-google-iam-v2 + GRPC library for proto-google-iam-v1 + + com.google.api.grpc + proto-google-iam-v1-parent + 1.5.3-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-iam-v2 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/grpc-google-iam-v2/src/main/java/com/google/iam/v2/PoliciesGrpc.java b/grpc-google-iam-v2/src/main/java/com/google/iam/v2/PoliciesGrpc.java new file mode 100644 index 00000000..b5b34c76 --- /dev/null +++ b/grpc-google-iam-v2/src/main/java/com/google/iam/v2/PoliciesGrpc.java @@ -0,0 +1,971 @@ +/* + * 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.iam.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * An interface for managing Identity and Access Management (IAM) policies.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/iam/v2/policy.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class PoliciesGrpc { + + private PoliciesGrpc() {} + + public static final String SERVICE_NAME = "google.iam.v2.Policies"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2.ListPoliciesRequest, com.google.iam.v2.ListPoliciesResponse> + getListPoliciesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListPolicies", + requestType = com.google.iam.v2.ListPoliciesRequest.class, + responseType = com.google.iam.v2.ListPoliciesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2.ListPoliciesRequest, com.google.iam.v2.ListPoliciesResponse> + getListPoliciesMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2.ListPoliciesRequest, com.google.iam.v2.ListPoliciesResponse> + getListPoliciesMethod; + if ((getListPoliciesMethod = PoliciesGrpc.getListPoliciesMethod) == null) { + synchronized (PoliciesGrpc.class) { + if ((getListPoliciesMethod = PoliciesGrpc.getListPoliciesMethod) == null) { + PoliciesGrpc.getListPoliciesMethod = + getListPoliciesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListPolicies")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.ListPoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.ListPoliciesResponse.getDefaultInstance())) + .setSchemaDescriptor(new PoliciesMethodDescriptorSupplier("ListPolicies")) + .build(); + } + } + } + return getListPoliciesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2.GetPolicyRequest, com.google.iam.v2.Policy> + getGetPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetPolicy", + requestType = com.google.iam.v2.GetPolicyRequest.class, + responseType = com.google.iam.v2.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2.GetPolicyRequest, com.google.iam.v2.Policy> + getGetPolicyMethod() { + io.grpc.MethodDescriptor + getGetPolicyMethod; + if ((getGetPolicyMethod = PoliciesGrpc.getGetPolicyMethod) == null) { + synchronized (PoliciesGrpc.class) { + if ((getGetPolicyMethod = PoliciesGrpc.getGetPolicyMethod) == null) { + PoliciesGrpc.getGetPolicyMethod = + getGetPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.GetPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.Policy.getDefaultInstance())) + .setSchemaDescriptor(new PoliciesMethodDescriptorSupplier("GetPolicy")) + .build(); + } + } + } + return getGetPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2.CreatePolicyRequest, com.google.longrunning.Operation> + getCreatePolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreatePolicy", + requestType = com.google.iam.v2.CreatePolicyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2.CreatePolicyRequest, com.google.longrunning.Operation> + getCreatePolicyMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2.CreatePolicyRequest, com.google.longrunning.Operation> + getCreatePolicyMethod; + if ((getCreatePolicyMethod = PoliciesGrpc.getCreatePolicyMethod) == null) { + synchronized (PoliciesGrpc.class) { + if ((getCreatePolicyMethod = PoliciesGrpc.getCreatePolicyMethod) == null) { + PoliciesGrpc.getCreatePolicyMethod = + getCreatePolicyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreatePolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.CreatePolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new PoliciesMethodDescriptorSupplier("CreatePolicy")) + .build(); + } + } + } + return getCreatePolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2.UpdatePolicyRequest, com.google.longrunning.Operation> + getUpdatePolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdatePolicy", + requestType = com.google.iam.v2.UpdatePolicyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2.UpdatePolicyRequest, com.google.longrunning.Operation> + getUpdatePolicyMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2.UpdatePolicyRequest, com.google.longrunning.Operation> + getUpdatePolicyMethod; + if ((getUpdatePolicyMethod = PoliciesGrpc.getUpdatePolicyMethod) == null) { + synchronized (PoliciesGrpc.class) { + if ((getUpdatePolicyMethod = PoliciesGrpc.getUpdatePolicyMethod) == null) { + PoliciesGrpc.getUpdatePolicyMethod = + getUpdatePolicyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdatePolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.UpdatePolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new PoliciesMethodDescriptorSupplier("UpdatePolicy")) + .build(); + } + } + } + return getUpdatePolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2.DeletePolicyRequest, com.google.longrunning.Operation> + getDeletePolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeletePolicy", + requestType = com.google.iam.v2.DeletePolicyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2.DeletePolicyRequest, com.google.longrunning.Operation> + getDeletePolicyMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2.DeletePolicyRequest, com.google.longrunning.Operation> + getDeletePolicyMethod; + if ((getDeletePolicyMethod = PoliciesGrpc.getDeletePolicyMethod) == null) { + synchronized (PoliciesGrpc.class) { + if ((getDeletePolicyMethod = PoliciesGrpc.getDeletePolicyMethod) == null) { + PoliciesGrpc.getDeletePolicyMethod = + getDeletePolicyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeletePolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.DeletePolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new PoliciesMethodDescriptorSupplier("DeletePolicy")) + .build(); + } + } + } + return getDeletePolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2.ListApplicablePoliciesRequest, + com.google.iam.v2.ListApplicablePoliciesResponse> + getListApplicablePoliciesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListApplicablePolicies", + requestType = com.google.iam.v2.ListApplicablePoliciesRequest.class, + responseType = com.google.iam.v2.ListApplicablePoliciesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2.ListApplicablePoliciesRequest, + com.google.iam.v2.ListApplicablePoliciesResponse> + getListApplicablePoliciesMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2.ListApplicablePoliciesRequest, + com.google.iam.v2.ListApplicablePoliciesResponse> + getListApplicablePoliciesMethod; + if ((getListApplicablePoliciesMethod = PoliciesGrpc.getListApplicablePoliciesMethod) == null) { + synchronized (PoliciesGrpc.class) { + if ((getListApplicablePoliciesMethod = PoliciesGrpc.getListApplicablePoliciesMethod) + == null) { + PoliciesGrpc.getListApplicablePoliciesMethod = + getListApplicablePoliciesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ListApplicablePolicies")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.ListApplicablePoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2.ListApplicablePoliciesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PoliciesMethodDescriptorSupplier("ListApplicablePolicies")) + .build(); + } + } + } + return getListApplicablePoliciesMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static PoliciesStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PoliciesStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PoliciesStub(channel, callOptions); + } + }; + return PoliciesStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static PoliciesBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PoliciesBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PoliciesBlockingStub(channel, callOptions); + } + }; + return PoliciesBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static PoliciesFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PoliciesFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PoliciesFutureStub(channel, callOptions); + } + }; + return PoliciesFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * An interface for managing Identity and Access Management (IAM) policies.
+   * 
+ */ + public abstract static class PoliciesImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Retrieves the policies of the specified kind that are attached to a
+     * resource.
+     * The response lists only policy metadata. In particular, policy rules are
+     * omitted.
+     * 
+ */ + public void listPolicies( + com.google.iam.v2.ListPoliciesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListPoliciesMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets a policy.
+     * 
+ */ + public void getPolicy( + com.google.iam.v2.GetPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Creates a policy.
+     * 
+ */ + public void createPolicy( + com.google.iam.v2.CreatePolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreatePolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the specified policy.
+     * You can update only the rules and the display name for the policy.
+     * To update a policy, you should use a read-modify-write loop:
+     * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current
+     * version of the policy.
+     * 2. Modify the policy as needed.
+     * 3. Use `UpdatePolicy` to write the updated policy.
+     * This pattern helps prevent conflicts between concurrent updates.
+     * 
+ */ + public void updatePolicy( + com.google.iam.v2.UpdatePolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdatePolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a policy. This action is permanent.
+     * 
+ */ + public void deletePolicy( + com.google.iam.v2.DeletePolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeletePolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Retrieves all the policies that are attached to the specified resource,
+     * or anywhere in the ancestry of the resource. For example, for a project
+     * this endpoint would return all the `denyPolicy` kind policies attached to
+     * the project, its parent folder (if any), and its parent organization (if
+     * any).
+     * The endpoint requires the same permissions that it would take to call
+     * `ListPolicies` or `GetPolicy`.
+     * The main reason to use this endpoint is as a policy admin to debug access
+     * issues for a resource.
+     * 
+ */ + public void listApplicablePolicies( + com.google.iam.v2.ListApplicablePoliciesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListApplicablePoliciesMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getListPoliciesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2.ListPoliciesRequest, + com.google.iam.v2.ListPoliciesResponse>(this, METHODID_LIST_POLICIES))) + .addMethod( + getGetPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + this, METHODID_GET_POLICY))) + .addMethod( + getCreatePolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2.CreatePolicyRequest, com.google.longrunning.Operation>( + this, METHODID_CREATE_POLICY))) + .addMethod( + getUpdatePolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2.UpdatePolicyRequest, com.google.longrunning.Operation>( + this, METHODID_UPDATE_POLICY))) + .addMethod( + getDeletePolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2.DeletePolicyRequest, com.google.longrunning.Operation>( + this, METHODID_DELETE_POLICY))) + .addMethod( + getListApplicablePoliciesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2.ListApplicablePoliciesRequest, + com.google.iam.v2.ListApplicablePoliciesResponse>( + this, METHODID_LIST_APPLICABLE_POLICIES))) + .build(); + } + } + + /** + * + * + *
+   * An interface for managing Identity and Access Management (IAM) policies.
+   * 
+ */ + public static final class PoliciesStub extends io.grpc.stub.AbstractAsyncStub { + private PoliciesStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PoliciesStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PoliciesStub(channel, callOptions); + } + + /** + * + * + *
+     * Retrieves the policies of the specified kind that are attached to a
+     * resource.
+     * The response lists only policy metadata. In particular, policy rules are
+     * omitted.
+     * 
+ */ + public void listPolicies( + com.google.iam.v2.ListPoliciesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListPoliciesMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets a policy.
+     * 
+ */ + public void getPolicy( + com.google.iam.v2.GetPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetPolicyMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Creates a policy.
+     * 
+ */ + public void createPolicy( + com.google.iam.v2.CreatePolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreatePolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the specified policy.
+     * You can update only the rules and the display name for the policy.
+     * To update a policy, you should use a read-modify-write loop:
+     * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current
+     * version of the policy.
+     * 2. Modify the policy as needed.
+     * 3. Use `UpdatePolicy` to write the updated policy.
+     * This pattern helps prevent conflicts between concurrent updates.
+     * 
+ */ + public void updatePolicy( + com.google.iam.v2.UpdatePolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdatePolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a policy. This action is permanent.
+     * 
+ */ + public void deletePolicy( + com.google.iam.v2.DeletePolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeletePolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Retrieves all the policies that are attached to the specified resource,
+     * or anywhere in the ancestry of the resource. For example, for a project
+     * this endpoint would return all the `denyPolicy` kind policies attached to
+     * the project, its parent folder (if any), and its parent organization (if
+     * any).
+     * The endpoint requires the same permissions that it would take to call
+     * `ListPolicies` or `GetPolicy`.
+     * The main reason to use this endpoint is as a policy admin to debug access
+     * issues for a resource.
+     * 
+ */ + public void listApplicablePolicies( + com.google.iam.v2.ListApplicablePoliciesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListApplicablePoliciesMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * An interface for managing Identity and Access Management (IAM) policies.
+   * 
+ */ + public static final class PoliciesBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private PoliciesBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PoliciesBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PoliciesBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Retrieves the policies of the specified kind that are attached to a
+     * resource.
+     * The response lists only policy metadata. In particular, policy rules are
+     * omitted.
+     * 
+ */ + public com.google.iam.v2.ListPoliciesResponse listPolicies( + com.google.iam.v2.ListPoliciesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListPoliciesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets a policy.
+     * 
+ */ + public com.google.iam.v2.Policy getPolicy(com.google.iam.v2.GetPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates a policy.
+     * 
+ */ + public com.google.longrunning.Operation createPolicy( + com.google.iam.v2.CreatePolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreatePolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the specified policy.
+     * You can update only the rules and the display name for the policy.
+     * To update a policy, you should use a read-modify-write loop:
+     * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current
+     * version of the policy.
+     * 2. Modify the policy as needed.
+     * 3. Use `UpdatePolicy` to write the updated policy.
+     * This pattern helps prevent conflicts between concurrent updates.
+     * 
+ */ + public com.google.longrunning.Operation updatePolicy( + com.google.iam.v2.UpdatePolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdatePolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a policy. This action is permanent.
+     * 
+ */ + public com.google.longrunning.Operation deletePolicy( + com.google.iam.v2.DeletePolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeletePolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Retrieves all the policies that are attached to the specified resource,
+     * or anywhere in the ancestry of the resource. For example, for a project
+     * this endpoint would return all the `denyPolicy` kind policies attached to
+     * the project, its parent folder (if any), and its parent organization (if
+     * any).
+     * The endpoint requires the same permissions that it would take to call
+     * `ListPolicies` or `GetPolicy`.
+     * The main reason to use this endpoint is as a policy admin to debug access
+     * issues for a resource.
+     * 
+ */ + public com.google.iam.v2.ListApplicablePoliciesResponse listApplicablePolicies( + com.google.iam.v2.ListApplicablePoliciesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListApplicablePoliciesMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * An interface for managing Identity and Access Management (IAM) policies.
+   * 
+ */ + public static final class PoliciesFutureStub + extends io.grpc.stub.AbstractFutureStub { + private PoliciesFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PoliciesFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PoliciesFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Retrieves the policies of the specified kind that are attached to a
+     * resource.
+     * The response lists only policy metadata. In particular, policy rules are
+     * omitted.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.iam.v2.ListPoliciesResponse> + listPolicies(com.google.iam.v2.ListPoliciesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListPoliciesMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets a policy.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getPolicy( + com.google.iam.v2.GetPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Creates a policy.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createPolicy(com.google.iam.v2.CreatePolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreatePolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the specified policy.
+     * You can update only the rules and the display name for the policy.
+     * To update a policy, you should use a read-modify-write loop:
+     * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current
+     * version of the policy.
+     * 2. Modify the policy as needed.
+     * 3. Use `UpdatePolicy` to write the updated policy.
+     * This pattern helps prevent conflicts between concurrent updates.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updatePolicy(com.google.iam.v2.UpdatePolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdatePolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a policy. This action is permanent.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deletePolicy(com.google.iam.v2.DeletePolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeletePolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Retrieves all the policies that are attached to the specified resource,
+     * or anywhere in the ancestry of the resource. For example, for a project
+     * this endpoint would return all the `denyPolicy` kind policies attached to
+     * the project, its parent folder (if any), and its parent organization (if
+     * any).
+     * The endpoint requires the same permissions that it would take to call
+     * `ListPolicies` or `GetPolicy`.
+     * The main reason to use this endpoint is as a policy admin to debug access
+     * issues for a resource.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.iam.v2.ListApplicablePoliciesResponse> + listApplicablePolicies(com.google.iam.v2.ListApplicablePoliciesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListApplicablePoliciesMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_LIST_POLICIES = 0; + private static final int METHODID_GET_POLICY = 1; + private static final int METHODID_CREATE_POLICY = 2; + private static final int METHODID_UPDATE_POLICY = 3; + private static final int METHODID_DELETE_POLICY = 4; + private static final int METHODID_LIST_APPLICABLE_POLICIES = 5; + + 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 PoliciesImplBase serviceImpl; + private final int methodId; + + MethodHandlers(PoliciesImplBase 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_LIST_POLICIES: + serviceImpl.listPolicies( + (com.google.iam.v2.ListPoliciesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_POLICY: + serviceImpl.getPolicy( + (com.google.iam.v2.GetPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_POLICY: + serviceImpl.createPolicy( + (com.google.iam.v2.CreatePolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_POLICY: + serviceImpl.updatePolicy( + (com.google.iam.v2.UpdatePolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_POLICY: + serviceImpl.deletePolicy( + (com.google.iam.v2.DeletePolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_APPLICABLE_POLICIES: + serviceImpl.listApplicablePolicies( + (com.google.iam.v2.ListApplicablePoliciesRequest) 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 PoliciesBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + PoliciesBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.iam.v2.PolicyProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Policies"); + } + } + + private static final class PoliciesFileDescriptorSupplier extends PoliciesBaseDescriptorSupplier { + PoliciesFileDescriptorSupplier() {} + } + + private static final class PoliciesMethodDescriptorSupplier extends PoliciesBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + PoliciesMethodDescriptorSupplier(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 (PoliciesGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new PoliciesFileDescriptorSupplier()) + .addMethod(getListPoliciesMethod()) + .addMethod(getGetPolicyMethod()) + .addMethod(getCreatePolicyMethod()) + .addMethod(getUpdatePolicyMethod()) + .addMethod(getDeletePolicyMethod()) + .addMethod(getListApplicablePoliciesMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/pom.xml b/pom.xml index 9e9123a6..21d1d301 100644 --- a/pom.xml +++ b/pom.xml @@ -74,6 +74,16 @@ pom import + + com.google.api.grpc + proto-google-iam-v2 + 1.5.3-SNAPSHOT + + + com.google.api.grpc + grpc-google-iam-v2 + 1.5.3-SNAPSHOT + com.google.cloud google-iam-policy @@ -112,7 +122,9 @@ proto-google-iam-v1 grpc-google-iam-v2beta + grpc-google-iam-v2 proto-google-iam-v2beta + proto-google-iam-v2 grpc-google-iam-v1 google-iam-policy diff --git a/proto-google-iam-v2/clirr-ignored-differences.xml b/proto-google-iam-v2/clirr-ignored-differences.xml new file mode 100644 index 00000000..f9346449 --- /dev/null +++ b/proto-google-iam-v2/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/iam/v2/*OrBuilder + * get*(*) + + + 7012 + com/google/iam/v2/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/iam/v2/*OrBuilder + boolean has*(*) + + diff --git a/proto-google-iam-v2/pom.xml b/proto-google-iam-v2/pom.xml new file mode 100644 index 00000000..d099af45 --- /dev/null +++ b/proto-google-iam-v2/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-iam-v2 + 1.5.3-SNAPSHOT + proto-google-iam-v2 + Proto library for proto-google-iam-v1 + + com.google.api.grpc + proto-google-iam-v1-parent + 1.5.3-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 + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/CreatePolicyRequest.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/CreatePolicyRequest.java new file mode 100644 index 00000000..3a88d070 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/CreatePolicyRequest.java @@ -0,0 +1,1148 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Request message for `CreatePolicy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2.CreatePolicyRequest} + */ +public final class CreatePolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.CreatePolicyRequest) + CreatePolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreatePolicyRequest.newBuilder() to construct. + private CreatePolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreatePolicyRequest() { + parent_ = ""; + policyId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreatePolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreatePolicyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.iam.v2.Policy.Builder subBuilder = null; + if (policy_ != null) { + subBuilder = policy_.toBuilder(); + } + policy_ = input.readMessage(com.google.iam.v2.Policy.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(policy_); + policy_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + policyId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_CreatePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_CreatePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.CreatePolicyRequest.class, + com.google.iam.v2.CreatePolicyRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The resource that the policy is attached to, along with the kind
+   * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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. The resource that the policy is attached to, along with the kind
+   * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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 POLICY_FIELD_NUMBER = 2; + private com.google.iam.v2.Policy policy_; + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the policy field is set. + */ + @java.lang.Override + public boolean hasPolicy() { + return policy_ != null; + } + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + @java.lang.Override + public com.google.iam.v2.Policy getPolicy() { + return policy_ == null ? com.google.iam.v2.Policy.getDefaultInstance() : policy_; + } + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.iam.v2.PolicyOrBuilder getPolicyOrBuilder() { + return getPolicy(); + } + + public static final int POLICY_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object policyId_; + /** + * + * + *
+   * The ID to use for this policy, which will become the final component of
+   * the policy's resource name. The ID must contain 3 to 63 characters. It can
+   * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+   * (`.`). The first character must be a lowercase letter.
+   * 
+ * + * string policy_id = 3; + * + * @return The policyId. + */ + @java.lang.Override + public java.lang.String getPolicyId() { + java.lang.Object ref = policyId_; + 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(); + policyId_ = s; + return s; + } + } + /** + * + * + *
+   * The ID to use for this policy, which will become the final component of
+   * the policy's resource name. The ID must contain 3 to 63 characters. It can
+   * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+   * (`.`). The first character must be a lowercase letter.
+   * 
+ * + * string policy_id = 3; + * + * @return The bytes for policyId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPolicyIdBytes() { + java.lang.Object ref = policyId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + policyId_ = 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 (policy_ != null) { + output.writeMessage(2, getPolicy()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(policyId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, policyId_); + } + unknownFields.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 (policy_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getPolicy()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(policyId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, policyId_); + } + size += unknownFields.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.iam.v2.CreatePolicyRequest)) { + return super.equals(obj); + } + com.google.iam.v2.CreatePolicyRequest other = (com.google.iam.v2.CreatePolicyRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasPolicy() != other.hasPolicy()) return false; + if (hasPolicy()) { + if (!getPolicy().equals(other.getPolicy())) return false; + } + if (!getPolicyId().equals(other.getPolicyId())) return false; + if (!unknownFields.equals(other.unknownFields)) 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 (hasPolicy()) { + hash = (37 * hash) + POLICY_FIELD_NUMBER; + hash = (53 * hash) + getPolicy().hashCode(); + } + hash = (37 * hash) + POLICY_ID_FIELD_NUMBER; + hash = (53 * hash) + getPolicyId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.CreatePolicyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.CreatePolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.CreatePolicyRequest parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.CreatePolicyRequest 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.iam.v2.CreatePolicyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.CreatePolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.CreatePolicyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.CreatePolicyRequest 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.iam.v2.CreatePolicyRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.CreatePolicyRequest 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.iam.v2.CreatePolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.CreatePolicyRequest 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.iam.v2.CreatePolicyRequest 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 `CreatePolicy`.
+   * 
+ * + * Protobuf type {@code google.iam.v2.CreatePolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.CreatePolicyRequest) + com.google.iam.v2.CreatePolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_CreatePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_CreatePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.CreatePolicyRequest.class, + com.google.iam.v2.CreatePolicyRequest.Builder.class); + } + + // Construct using com.google.iam.v2.CreatePolicyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (policyBuilder_ == null) { + policy_ = null; + } else { + policy_ = null; + policyBuilder_ = null; + } + policyId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_CreatePolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.CreatePolicyRequest getDefaultInstanceForType() { + return com.google.iam.v2.CreatePolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.CreatePolicyRequest build() { + com.google.iam.v2.CreatePolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.CreatePolicyRequest buildPartial() { + com.google.iam.v2.CreatePolicyRequest result = + new com.google.iam.v2.CreatePolicyRequest(this); + result.parent_ = parent_; + if (policyBuilder_ == null) { + result.policy_ = policy_; + } else { + result.policy_ = policyBuilder_.build(); + } + result.policyId_ = policyId_; + 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.iam.v2.CreatePolicyRequest) { + return mergeFrom((com.google.iam.v2.CreatePolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.CreatePolicyRequest other) { + if (other == com.google.iam.v2.CreatePolicyRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasPolicy()) { + mergePolicy(other.getPolicy()); + } + if (!other.getPolicyId().isEmpty()) { + policyId_ = other.policyId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.CreatePolicyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.CreatePolicyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The resource that the policy is attached to, along with the kind
+     * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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. The resource that the policy is attached to, along with the kind
+     * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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. The resource that the policy is attached to, along with the kind
+     * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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. The resource that the policy is attached to, along with the kind
+     * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource that the policy is attached to, along with the kind
+     * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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.iam.v2.Policy policy_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder> + policyBuilder_; + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the policy field is set. + */ + public boolean hasPolicy() { + return policyBuilder_ != null || policy_ != null; + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + public com.google.iam.v2.Policy getPolicy() { + if (policyBuilder_ == null) { + return policy_ == null ? com.google.iam.v2.Policy.getDefaultInstance() : policy_; + } else { + return policyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPolicy(com.google.iam.v2.Policy value) { + if (policyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + policy_ = value; + onChanged(); + } else { + policyBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPolicy(com.google.iam.v2.Policy.Builder builderForValue) { + if (policyBuilder_ == null) { + policy_ = builderForValue.build(); + onChanged(); + } else { + policyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergePolicy(com.google.iam.v2.Policy value) { + if (policyBuilder_ == null) { + if (policy_ != null) { + policy_ = com.google.iam.v2.Policy.newBuilder(policy_).mergeFrom(value).buildPartial(); + } else { + policy_ = value; + } + onChanged(); + } else { + policyBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearPolicy() { + if (policyBuilder_ == null) { + policy_ = null; + onChanged(); + } else { + policy_ = null; + policyBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.iam.v2.Policy.Builder getPolicyBuilder() { + + onChanged(); + return getPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.iam.v2.PolicyOrBuilder getPolicyOrBuilder() { + if (policyBuilder_ != null) { + return policyBuilder_.getMessageOrBuilder(); + } else { + return policy_ == null ? com.google.iam.v2.Policy.getDefaultInstance() : policy_; + } + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder> + getPolicyFieldBuilder() { + if (policyBuilder_ == null) { + policyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder>(getPolicy(), getParentForChildren(), isClean()); + policy_ = null; + } + return policyBuilder_; + } + + private java.lang.Object policyId_ = ""; + /** + * + * + *
+     * The ID to use for this policy, which will become the final component of
+     * the policy's resource name. The ID must contain 3 to 63 characters. It can
+     * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+     * (`.`). The first character must be a lowercase letter.
+     * 
+ * + * string policy_id = 3; + * + * @return The policyId. + */ + public java.lang.String getPolicyId() { + java.lang.Object ref = policyId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + policyId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The ID to use for this policy, which will become the final component of
+     * the policy's resource name. The ID must contain 3 to 63 characters. It can
+     * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+     * (`.`). The first character must be a lowercase letter.
+     * 
+ * + * string policy_id = 3; + * + * @return The bytes for policyId. + */ + public com.google.protobuf.ByteString getPolicyIdBytes() { + java.lang.Object ref = policyId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + policyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The ID to use for this policy, which will become the final component of
+     * the policy's resource name. The ID must contain 3 to 63 characters. It can
+     * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+     * (`.`). The first character must be a lowercase letter.
+     * 
+ * + * string policy_id = 3; + * + * @param value The policyId to set. + * @return This builder for chaining. + */ + public Builder setPolicyId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + policyId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The ID to use for this policy, which will become the final component of
+     * the policy's resource name. The ID must contain 3 to 63 characters. It can
+     * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+     * (`.`). The first character must be a lowercase letter.
+     * 
+ * + * string policy_id = 3; + * + * @return This builder for chaining. + */ + public Builder clearPolicyId() { + + policyId_ = getDefaultInstance().getPolicyId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The ID to use for this policy, which will become the final component of
+     * the policy's resource name. The ID must contain 3 to 63 characters. It can
+     * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+     * (`.`). The first character must be a lowercase letter.
+     * 
+ * + * string policy_id = 3; + * + * @param value The bytes for policyId to set. + * @return This builder for chaining. + */ + public Builder setPolicyIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + policyId_ = 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.iam.v2.CreatePolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.CreatePolicyRequest) + private static final com.google.iam.v2.CreatePolicyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.CreatePolicyRequest(); + } + + public static com.google.iam.v2.CreatePolicyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreatePolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreatePolicyRequest(input, extensionRegistry); + } + }; + + 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.iam.v2.CreatePolicyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/CreatePolicyRequestOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/CreatePolicyRequestOrBuilder.java new file mode 100644 index 00000000..35cbef4d --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/CreatePolicyRequestOrBuilder.java @@ -0,0 +1,130 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface CreatePolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.CreatePolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource that the policy is attached to, along with the kind
+   * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The resource that the policy is attached to, along with the kind
+   * of policy to create. Format: `policies/{attachment_point}/denypolicies`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the policy field is set. + */ + boolean hasPolicy(); + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + com.google.iam.v2.Policy getPolicy(); + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.iam.v2.PolicyOrBuilder getPolicyOrBuilder(); + + /** + * + * + *
+   * The ID to use for this policy, which will become the final component of
+   * the policy's resource name. The ID must contain 3 to 63 characters. It can
+   * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+   * (`.`). The first character must be a lowercase letter.
+   * 
+ * + * string policy_id = 3; + * + * @return The policyId. + */ + java.lang.String getPolicyId(); + /** + * + * + *
+   * The ID to use for this policy, which will become the final component of
+   * the policy's resource name. The ID must contain 3 to 63 characters. It can
+   * contain lowercase letters and numbers, as well as dashes (`-`) and periods
+   * (`.`). The first character must be a lowercase letter.
+   * 
+ * + * string policy_id = 3; + * + * @return The bytes for policyId. + */ + com.google.protobuf.ByteString getPolicyIdBytes(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/DeletePolicyRequest.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DeletePolicyRequest.java new file mode 100644 index 00000000..44d2147b --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DeletePolicyRequest.java @@ -0,0 +1,883 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Request message for `DeletePolicy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2.DeletePolicyRequest} + */ +public final class DeletePolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.DeletePolicyRequest) + DeletePolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeletePolicyRequest.newBuilder() to construct. + private DeletePolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeletePolicyRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeletePolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeletePolicyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_DeletePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_DeletePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.DeletePolicyRequest.class, + com.google.iam.v2.DeletePolicyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the policy to delete. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * Use the URL-encoded full resource name, which means that the forward-slash
+   * character, `/`, must be written as `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric 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. The resource name of the policy to delete. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * Use the URL-encoded full resource name, which means that the forward-slash
+   * character, `/`, must be written as `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric 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 ETAG_FIELD_NUMBER = 2; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Optional. The expected `etag` of the policy to delete. If the value does
+   * not match the value that is stored in IAM, the request fails with a `409`
+   * error code and `ABORTED` status.
+   * If you omit this field, the policy is deleted regardless of its current
+   * `etag`.
+   * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + 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(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The expected `etag` of the policy to delete. If the value does
+   * not match the value that is stored in IAM, the request fails with a `409`
+   * error code and `ABORTED` status.
+   * If you omit this field, the policy is deleted regardless of its current
+   * `etag`.
+   * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = 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(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, etag_); + } + unknownFields.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(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, etag_); + } + size += unknownFields.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.iam.v2.DeletePolicyRequest)) { + return super.equals(obj); + } + com.google.iam.v2.DeletePolicyRequest other = (com.google.iam.v2.DeletePolicyRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.DeletePolicyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.DeletePolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.DeletePolicyRequest parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.DeletePolicyRequest 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.iam.v2.DeletePolicyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.DeletePolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.DeletePolicyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.DeletePolicyRequest 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.iam.v2.DeletePolicyRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.DeletePolicyRequest 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.iam.v2.DeletePolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.DeletePolicyRequest 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.iam.v2.DeletePolicyRequest 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 `DeletePolicy`.
+   * 
+ * + * Protobuf type {@code google.iam.v2.DeletePolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.DeletePolicyRequest) + com.google.iam.v2.DeletePolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_DeletePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_DeletePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.DeletePolicyRequest.class, + com.google.iam.v2.DeletePolicyRequest.Builder.class); + } + + // Construct using com.google.iam.v2.DeletePolicyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_DeletePolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.DeletePolicyRequest getDefaultInstanceForType() { + return com.google.iam.v2.DeletePolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.DeletePolicyRequest build() { + com.google.iam.v2.DeletePolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.DeletePolicyRequest buildPartial() { + com.google.iam.v2.DeletePolicyRequest result = + new com.google.iam.v2.DeletePolicyRequest(this); + result.name_ = name_; + result.etag_ = etag_; + 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.iam.v2.DeletePolicyRequest) { + return mergeFrom((com.google.iam.v2.DeletePolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.DeletePolicyRequest other) { + if (other == com.google.iam.v2.DeletePolicyRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.DeletePolicyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.DeletePolicyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the policy to delete. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric 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. The resource name of the policy to delete. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric 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. The resource name of the policy to delete. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric 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. The resource name of the policy to delete. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the policy to delete. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric 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 etag_ = ""; + /** + * + * + *
+     * Optional. The expected `etag` of the policy to delete. If the value does
+     * not match the value that is stored in IAM, the request fails with a `409`
+     * error code and `ABORTED` status.
+     * If you omit this field, the policy is deleted regardless of its current
+     * `etag`.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The expected `etag` of the policy to delete. If the value does
+     * not match the value that is stored in IAM, the request fails with a `409`
+     * error code and `ABORTED` status.
+     * If you omit this field, the policy is deleted regardless of its current
+     * `etag`.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The expected `etag` of the policy to delete. If the value does
+     * not match the value that is stored in IAM, the request fails with a `409`
+     * error code and `ABORTED` status.
+     * If you omit this field, the policy is deleted regardless of its current
+     * `etag`.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The expected `etag` of the policy to delete. If the value does
+     * not match the value that is stored in IAM, the request fails with a `409`
+     * error code and `ABORTED` status.
+     * If you omit this field, the policy is deleted regardless of its current
+     * `etag`.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The expected `etag` of the policy to delete. If the value does
+     * not match the value that is stored in IAM, the request fails with a `409`
+     * error code and `ABORTED` status.
+     * If you omit this field, the policy is deleted regardless of its current
+     * `etag`.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = 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.iam.v2.DeletePolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.DeletePolicyRequest) + private static final com.google.iam.v2.DeletePolicyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.DeletePolicyRequest(); + } + + public static com.google.iam.v2.DeletePolicyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeletePolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeletePolicyRequest(input, extensionRegistry); + } + }; + + 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.iam.v2.DeletePolicyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/DeletePolicyRequestOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DeletePolicyRequestOrBuilder.java new file mode 100644 index 00000000..a0d077f2 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DeletePolicyRequestOrBuilder.java @@ -0,0 +1,95 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface DeletePolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.DeletePolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the policy to delete. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * Use the URL-encoded full resource name, which means that the forward-slash
+   * character, `/`, must be written as `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the policy to delete. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * Use the URL-encoded full resource name, which means that the forward-slash
+   * character, `/`, must be written as `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Optional. The expected `etag` of the policy to delete. If the value does
+   * not match the value that is stored in IAM, the request fails with a `409`
+   * error code and `ABORTED` status.
+   * If you omit this field, the policy is deleted regardless of its current
+   * `etag`.
+   * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Optional. The expected `etag` of the policy to delete. If the value does
+   * not match the value that is stored in IAM, the request fails with a `409`
+   * error code and `ABORTED` status.
+   * If you omit this field, the policy is deleted regardless of its current
+   * `etag`.
+   * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRule.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRule.java new file mode 100644 index 00000000..61475584 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRule.java @@ -0,0 +1,2504 @@ +/* + * 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/iam/v2/deny.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * A deny rule in an IAM deny policy.
+ * 
+ * + * Protobuf type {@code google.iam.v2.DenyRule} + */ +public final class DenyRule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.DenyRule) + DenyRuleOrBuilder { + private static final long serialVersionUID = 0L; + // Use DenyRule.newBuilder() to construct. + private DenyRule(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DenyRule() { + deniedPrincipals_ = com.google.protobuf.LazyStringArrayList.EMPTY; + exceptionPrincipals_ = com.google.protobuf.LazyStringArrayList.EMPTY; + deniedPermissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + exceptionPermissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DenyRule(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DenyRule( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + deniedPrincipals_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + deniedPrincipals_.add(s); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + exceptionPrincipals_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + exceptionPrincipals_.add(s); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + deniedPermissions_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + deniedPermissions_.add(s); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + exceptionPermissions_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000008; + } + exceptionPermissions_.add(s); + break; + } + case 42: + { + com.google.type.Expr.Builder subBuilder = null; + if (denialCondition_ != null) { + subBuilder = denialCondition_.toBuilder(); + } + denialCondition_ = + input.readMessage(com.google.type.Expr.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(denialCondition_); + denialCondition_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + deniedPrincipals_ = deniedPrincipals_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + exceptionPrincipals_ = exceptionPrincipals_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000004) != 0)) { + deniedPermissions_ = deniedPermissions_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000008) != 0)) { + exceptionPermissions_ = exceptionPermissions_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.DenyRuleProto.internal_static_google_iam_v2_DenyRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.DenyRuleProto.internal_static_google_iam_v2_DenyRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.DenyRule.class, com.google.iam.v2.DenyRule.Builder.class); + } + + public static final int DENIED_PRINCIPALS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList deniedPrincipals_; + /** + * + * + *
+   * The identities that are prevented from using one or more permissions on
+   * Google Cloud resources. This field can contain the following values:
+   * * `principalSet://goog/public:all`: A special identifier that represents
+   *   any principal that is on the internet, even if they do not have a Google
+   *   Account or are not logged in.
+   * * `principal://goog/subject/{email_id}`: A specific Google Account.
+   *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+   *   example, `principal://goog/subject/alice@example.com`.
+   * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+   *   Google Account that was deleted recently. For example,
+   *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+   *   the Google Account is recovered, this identifier reverts to the standard
+   *   identifier for a Google Account.
+   * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+   *   `principalSet://goog/group/admins@example.com`.
+   * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+   *   that was deleted recently. For example,
+   *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+   *   the Google group is restored, this identifier reverts to the standard
+   *   identifier for a Google group.
+   * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+   *   A Google Cloud service account. For example,
+   *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+   * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+   *   A Google Cloud service account that was deleted recently. For example,
+   *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+   *   If the service account is undeleted, this identifier reverts to the
+   *   standard identifier for a service account.
+   * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+   *   principals associated with the specified Google Workspace or Cloud
+   *   Identity customer ID. For example,
+   *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+   * 
+ * + * repeated string denied_principals = 1; + * + * @return A list containing the deniedPrincipals. + */ + public com.google.protobuf.ProtocolStringList getDeniedPrincipalsList() { + return deniedPrincipals_; + } + /** + * + * + *
+   * The identities that are prevented from using one or more permissions on
+   * Google Cloud resources. This field can contain the following values:
+   * * `principalSet://goog/public:all`: A special identifier that represents
+   *   any principal that is on the internet, even if they do not have a Google
+   *   Account or are not logged in.
+   * * `principal://goog/subject/{email_id}`: A specific Google Account.
+   *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+   *   example, `principal://goog/subject/alice@example.com`.
+   * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+   *   Google Account that was deleted recently. For example,
+   *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+   *   the Google Account is recovered, this identifier reverts to the standard
+   *   identifier for a Google Account.
+   * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+   *   `principalSet://goog/group/admins@example.com`.
+   * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+   *   that was deleted recently. For example,
+   *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+   *   the Google group is restored, this identifier reverts to the standard
+   *   identifier for a Google group.
+   * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+   *   A Google Cloud service account. For example,
+   *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+   * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+   *   A Google Cloud service account that was deleted recently. For example,
+   *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+   *   If the service account is undeleted, this identifier reverts to the
+   *   standard identifier for a service account.
+   * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+   *   principals associated with the specified Google Workspace or Cloud
+   *   Identity customer ID. For example,
+   *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+   * 
+ * + * repeated string denied_principals = 1; + * + * @return The count of deniedPrincipals. + */ + public int getDeniedPrincipalsCount() { + return deniedPrincipals_.size(); + } + /** + * + * + *
+   * The identities that are prevented from using one or more permissions on
+   * Google Cloud resources. This field can contain the following values:
+   * * `principalSet://goog/public:all`: A special identifier that represents
+   *   any principal that is on the internet, even if they do not have a Google
+   *   Account or are not logged in.
+   * * `principal://goog/subject/{email_id}`: A specific Google Account.
+   *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+   *   example, `principal://goog/subject/alice@example.com`.
+   * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+   *   Google Account that was deleted recently. For example,
+   *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+   *   the Google Account is recovered, this identifier reverts to the standard
+   *   identifier for a Google Account.
+   * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+   *   `principalSet://goog/group/admins@example.com`.
+   * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+   *   that was deleted recently. For example,
+   *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+   *   the Google group is restored, this identifier reverts to the standard
+   *   identifier for a Google group.
+   * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+   *   A Google Cloud service account. For example,
+   *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+   * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+   *   A Google Cloud service account that was deleted recently. For example,
+   *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+   *   If the service account is undeleted, this identifier reverts to the
+   *   standard identifier for a service account.
+   * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+   *   principals associated with the specified Google Workspace or Cloud
+   *   Identity customer ID. For example,
+   *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+   * 
+ * + * repeated string denied_principals = 1; + * + * @param index The index of the element to return. + * @return The deniedPrincipals at the given index. + */ + public java.lang.String getDeniedPrincipals(int index) { + return deniedPrincipals_.get(index); + } + /** + * + * + *
+   * The identities that are prevented from using one or more permissions on
+   * Google Cloud resources. This field can contain the following values:
+   * * `principalSet://goog/public:all`: A special identifier that represents
+   *   any principal that is on the internet, even if they do not have a Google
+   *   Account or are not logged in.
+   * * `principal://goog/subject/{email_id}`: A specific Google Account.
+   *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+   *   example, `principal://goog/subject/alice@example.com`.
+   * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+   *   Google Account that was deleted recently. For example,
+   *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+   *   the Google Account is recovered, this identifier reverts to the standard
+   *   identifier for a Google Account.
+   * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+   *   `principalSet://goog/group/admins@example.com`.
+   * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+   *   that was deleted recently. For example,
+   *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+   *   the Google group is restored, this identifier reverts to the standard
+   *   identifier for a Google group.
+   * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+   *   A Google Cloud service account. For example,
+   *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+   * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+   *   A Google Cloud service account that was deleted recently. For example,
+   *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+   *   If the service account is undeleted, this identifier reverts to the
+   *   standard identifier for a service account.
+   * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+   *   principals associated with the specified Google Workspace or Cloud
+   *   Identity customer ID. For example,
+   *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+   * 
+ * + * repeated string denied_principals = 1; + * + * @param index The index of the value to return. + * @return The bytes of the deniedPrincipals at the given index. + */ + public com.google.protobuf.ByteString getDeniedPrincipalsBytes(int index) { + return deniedPrincipals_.getByteString(index); + } + + public static final int EXCEPTION_PRINCIPALS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList exceptionPrincipals_; + /** + * + * + *
+   * The identities that are excluded from the deny rule, even if they are
+   * listed in the `denied_principals`. For example, you could add a Google
+   * group to the `denied_principals`, then exclude specific users who belong to
+   * that group.
+   * This field can contain the same values as the `denied_principals` field,
+   * excluding `principalSet://goog/public:all`, which represents all users on
+   * the internet.
+   * 
+ * + * repeated string exception_principals = 2; + * + * @return A list containing the exceptionPrincipals. + */ + public com.google.protobuf.ProtocolStringList getExceptionPrincipalsList() { + return exceptionPrincipals_; + } + /** + * + * + *
+   * The identities that are excluded from the deny rule, even if they are
+   * listed in the `denied_principals`. For example, you could add a Google
+   * group to the `denied_principals`, then exclude specific users who belong to
+   * that group.
+   * This field can contain the same values as the `denied_principals` field,
+   * excluding `principalSet://goog/public:all`, which represents all users on
+   * the internet.
+   * 
+ * + * repeated string exception_principals = 2; + * + * @return The count of exceptionPrincipals. + */ + public int getExceptionPrincipalsCount() { + return exceptionPrincipals_.size(); + } + /** + * + * + *
+   * The identities that are excluded from the deny rule, even if they are
+   * listed in the `denied_principals`. For example, you could add a Google
+   * group to the `denied_principals`, then exclude specific users who belong to
+   * that group.
+   * This field can contain the same values as the `denied_principals` field,
+   * excluding `principalSet://goog/public:all`, which represents all users on
+   * the internet.
+   * 
+ * + * repeated string exception_principals = 2; + * + * @param index The index of the element to return. + * @return The exceptionPrincipals at the given index. + */ + public java.lang.String getExceptionPrincipals(int index) { + return exceptionPrincipals_.get(index); + } + /** + * + * + *
+   * The identities that are excluded from the deny rule, even if they are
+   * listed in the `denied_principals`. For example, you could add a Google
+   * group to the `denied_principals`, then exclude specific users who belong to
+   * that group.
+   * This field can contain the same values as the `denied_principals` field,
+   * excluding `principalSet://goog/public:all`, which represents all users on
+   * the internet.
+   * 
+ * + * repeated string exception_principals = 2; + * + * @param index The index of the value to return. + * @return The bytes of the exceptionPrincipals at the given index. + */ + public com.google.protobuf.ByteString getExceptionPrincipalsBytes(int index) { + return exceptionPrincipals_.getByteString(index); + } + + public static final int DENIED_PERMISSIONS_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList deniedPermissions_; + /** + * + * + *
+   * The permissions that are explicitly denied by this rule. Each permission
+   * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+   * is the fully qualified domain name for the service. For example,
+   * `iam.googleapis.com/roles.list`.
+   * 
+ * + * repeated string denied_permissions = 3; + * + * @return A list containing the deniedPermissions. + */ + public com.google.protobuf.ProtocolStringList getDeniedPermissionsList() { + return deniedPermissions_; + } + /** + * + * + *
+   * The permissions that are explicitly denied by this rule. Each permission
+   * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+   * is the fully qualified domain name for the service. For example,
+   * `iam.googleapis.com/roles.list`.
+   * 
+ * + * repeated string denied_permissions = 3; + * + * @return The count of deniedPermissions. + */ + public int getDeniedPermissionsCount() { + return deniedPermissions_.size(); + } + /** + * + * + *
+   * The permissions that are explicitly denied by this rule. Each permission
+   * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+   * is the fully qualified domain name for the service. For example,
+   * `iam.googleapis.com/roles.list`.
+   * 
+ * + * repeated string denied_permissions = 3; + * + * @param index The index of the element to return. + * @return The deniedPermissions at the given index. + */ + public java.lang.String getDeniedPermissions(int index) { + return deniedPermissions_.get(index); + } + /** + * + * + *
+   * The permissions that are explicitly denied by this rule. Each permission
+   * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+   * is the fully qualified domain name for the service. For example,
+   * `iam.googleapis.com/roles.list`.
+   * 
+ * + * repeated string denied_permissions = 3; + * + * @param index The index of the value to return. + * @return The bytes of the deniedPermissions at the given index. + */ + public com.google.protobuf.ByteString getDeniedPermissionsBytes(int index) { + return deniedPermissions_.getByteString(index); + } + + public static final int EXCEPTION_PERMISSIONS_FIELD_NUMBER = 4; + private com.google.protobuf.LazyStringList exceptionPermissions_; + /** + * + * + *
+   * Specifies the permissions that this rule excludes from the set of denied
+   * permissions given by `denied_permissions`. If a permission appears in
+   * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+   * denied.
+   * The excluded permissions can be specified using the same syntax as
+   * `denied_permissions`.
+   * 
+ * + * repeated string exception_permissions = 4; + * + * @return A list containing the exceptionPermissions. + */ + public com.google.protobuf.ProtocolStringList getExceptionPermissionsList() { + return exceptionPermissions_; + } + /** + * + * + *
+   * Specifies the permissions that this rule excludes from the set of denied
+   * permissions given by `denied_permissions`. If a permission appears in
+   * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+   * denied.
+   * The excluded permissions can be specified using the same syntax as
+   * `denied_permissions`.
+   * 
+ * + * repeated string exception_permissions = 4; + * + * @return The count of exceptionPermissions. + */ + public int getExceptionPermissionsCount() { + return exceptionPermissions_.size(); + } + /** + * + * + *
+   * Specifies the permissions that this rule excludes from the set of denied
+   * permissions given by `denied_permissions`. If a permission appears in
+   * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+   * denied.
+   * The excluded permissions can be specified using the same syntax as
+   * `denied_permissions`.
+   * 
+ * + * repeated string exception_permissions = 4; + * + * @param index The index of the element to return. + * @return The exceptionPermissions at the given index. + */ + public java.lang.String getExceptionPermissions(int index) { + return exceptionPermissions_.get(index); + } + /** + * + * + *
+   * Specifies the permissions that this rule excludes from the set of denied
+   * permissions given by `denied_permissions`. If a permission appears in
+   * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+   * denied.
+   * The excluded permissions can be specified using the same syntax as
+   * `denied_permissions`.
+   * 
+ * + * repeated string exception_permissions = 4; + * + * @param index The index of the value to return. + * @return The bytes of the exceptionPermissions at the given index. + */ + public com.google.protobuf.ByteString getExceptionPermissionsBytes(int index) { + return exceptionPermissions_.getByteString(index); + } + + public static final int DENIAL_CONDITION_FIELD_NUMBER = 5; + private com.google.type.Expr denialCondition_; + /** + * + * + *
+   * The condition that determines whether this deny rule applies to a request.
+   * If the condition expression evaluates to `true`, then the deny rule is
+   * applied; otherwise, the deny rule is not applied.
+   * Each deny rule is evaluated independently. If this deny rule does not apply
+   * to a request, other deny rules might still apply.
+   * The condition can use CEL functions that evaluate
+   * [resource
+   * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+   * functions and operators are not supported.
+   * 
+ * + * .google.type.Expr denial_condition = 5; + * + * @return Whether the denialCondition field is set. + */ + @java.lang.Override + public boolean hasDenialCondition() { + return denialCondition_ != null; + } + /** + * + * + *
+   * The condition that determines whether this deny rule applies to a request.
+   * If the condition expression evaluates to `true`, then the deny rule is
+   * applied; otherwise, the deny rule is not applied.
+   * Each deny rule is evaluated independently. If this deny rule does not apply
+   * to a request, other deny rules might still apply.
+   * The condition can use CEL functions that evaluate
+   * [resource
+   * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+   * functions and operators are not supported.
+   * 
+ * + * .google.type.Expr denial_condition = 5; + * + * @return The denialCondition. + */ + @java.lang.Override + public com.google.type.Expr getDenialCondition() { + return denialCondition_ == null ? com.google.type.Expr.getDefaultInstance() : denialCondition_; + } + /** + * + * + *
+   * The condition that determines whether this deny rule applies to a request.
+   * If the condition expression evaluates to `true`, then the deny rule is
+   * applied; otherwise, the deny rule is not applied.
+   * Each deny rule is evaluated independently. If this deny rule does not apply
+   * to a request, other deny rules might still apply.
+   * The condition can use CEL functions that evaluate
+   * [resource
+   * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+   * functions and operators are not supported.
+   * 
+ * + * .google.type.Expr denial_condition = 5; + */ + @java.lang.Override + public com.google.type.ExprOrBuilder getDenialConditionOrBuilder() { + return getDenialCondition(); + } + + 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 < deniedPrincipals_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, deniedPrincipals_.getRaw(i)); + } + for (int i = 0; i < exceptionPrincipals_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, exceptionPrincipals_.getRaw(i)); + } + for (int i = 0; i < deniedPermissions_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, deniedPermissions_.getRaw(i)); + } + for (int i = 0; i < exceptionPermissions_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 4, exceptionPermissions_.getRaw(i)); + } + if (denialCondition_ != null) { + output.writeMessage(5, getDenialCondition()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < deniedPrincipals_.size(); i++) { + dataSize += computeStringSizeNoTag(deniedPrincipals_.getRaw(i)); + } + size += dataSize; + size += 1 * getDeniedPrincipalsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < exceptionPrincipals_.size(); i++) { + dataSize += computeStringSizeNoTag(exceptionPrincipals_.getRaw(i)); + } + size += dataSize; + size += 1 * getExceptionPrincipalsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < deniedPermissions_.size(); i++) { + dataSize += computeStringSizeNoTag(deniedPermissions_.getRaw(i)); + } + size += dataSize; + size += 1 * getDeniedPermissionsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < exceptionPermissions_.size(); i++) { + dataSize += computeStringSizeNoTag(exceptionPermissions_.getRaw(i)); + } + size += dataSize; + size += 1 * getExceptionPermissionsList().size(); + } + if (denialCondition_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getDenialCondition()); + } + size += unknownFields.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.iam.v2.DenyRule)) { + return super.equals(obj); + } + com.google.iam.v2.DenyRule other = (com.google.iam.v2.DenyRule) obj; + + if (!getDeniedPrincipalsList().equals(other.getDeniedPrincipalsList())) return false; + if (!getExceptionPrincipalsList().equals(other.getExceptionPrincipalsList())) return false; + if (!getDeniedPermissionsList().equals(other.getDeniedPermissionsList())) return false; + if (!getExceptionPermissionsList().equals(other.getExceptionPermissionsList())) return false; + if (hasDenialCondition() != other.hasDenialCondition()) return false; + if (hasDenialCondition()) { + if (!getDenialCondition().equals(other.getDenialCondition())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getDeniedPrincipalsCount() > 0) { + hash = (37 * hash) + DENIED_PRINCIPALS_FIELD_NUMBER; + hash = (53 * hash) + getDeniedPrincipalsList().hashCode(); + } + if (getExceptionPrincipalsCount() > 0) { + hash = (37 * hash) + EXCEPTION_PRINCIPALS_FIELD_NUMBER; + hash = (53 * hash) + getExceptionPrincipalsList().hashCode(); + } + if (getDeniedPermissionsCount() > 0) { + hash = (37 * hash) + DENIED_PERMISSIONS_FIELD_NUMBER; + hash = (53 * hash) + getDeniedPermissionsList().hashCode(); + } + if (getExceptionPermissionsCount() > 0) { + hash = (37 * hash) + EXCEPTION_PERMISSIONS_FIELD_NUMBER; + hash = (53 * hash) + getExceptionPermissionsList().hashCode(); + } + if (hasDenialCondition()) { + hash = (37 * hash) + DENIAL_CONDITION_FIELD_NUMBER; + hash = (53 * hash) + getDenialCondition().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.DenyRule parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.DenyRule parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.DenyRule parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.DenyRule 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.iam.v2.DenyRule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.DenyRule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.DenyRule parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.DenyRule 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.iam.v2.DenyRule parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.DenyRule 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.iam.v2.DenyRule parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.DenyRule 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.iam.v2.DenyRule 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; + } + /** + * + * + *
+   * A deny rule in an IAM deny policy.
+   * 
+ * + * Protobuf type {@code google.iam.v2.DenyRule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.DenyRule) + com.google.iam.v2.DenyRuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.DenyRuleProto.internal_static_google_iam_v2_DenyRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.DenyRuleProto + .internal_static_google_iam_v2_DenyRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.DenyRule.class, com.google.iam.v2.DenyRule.Builder.class); + } + + // Construct using com.google.iam.v2.DenyRule.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + deniedPrincipals_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + exceptionPrincipals_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + deniedPermissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + exceptionPermissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + if (denialConditionBuilder_ == null) { + denialCondition_ = null; + } else { + denialCondition_ = null; + denialConditionBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.DenyRuleProto.internal_static_google_iam_v2_DenyRule_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.DenyRule getDefaultInstanceForType() { + return com.google.iam.v2.DenyRule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.DenyRule build() { + com.google.iam.v2.DenyRule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.DenyRule buildPartial() { + com.google.iam.v2.DenyRule result = new com.google.iam.v2.DenyRule(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + deniedPrincipals_ = deniedPrincipals_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.deniedPrincipals_ = deniedPrincipals_; + if (((bitField0_ & 0x00000002) != 0)) { + exceptionPrincipals_ = exceptionPrincipals_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.exceptionPrincipals_ = exceptionPrincipals_; + if (((bitField0_ & 0x00000004) != 0)) { + deniedPermissions_ = deniedPermissions_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.deniedPermissions_ = deniedPermissions_; + if (((bitField0_ & 0x00000008) != 0)) { + exceptionPermissions_ = exceptionPermissions_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.exceptionPermissions_ = exceptionPermissions_; + if (denialConditionBuilder_ == null) { + result.denialCondition_ = denialCondition_; + } else { + result.denialCondition_ = denialConditionBuilder_.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.iam.v2.DenyRule) { + return mergeFrom((com.google.iam.v2.DenyRule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.DenyRule other) { + if (other == com.google.iam.v2.DenyRule.getDefaultInstance()) return this; + if (!other.deniedPrincipals_.isEmpty()) { + if (deniedPrincipals_.isEmpty()) { + deniedPrincipals_ = other.deniedPrincipals_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureDeniedPrincipalsIsMutable(); + deniedPrincipals_.addAll(other.deniedPrincipals_); + } + onChanged(); + } + if (!other.exceptionPrincipals_.isEmpty()) { + if (exceptionPrincipals_.isEmpty()) { + exceptionPrincipals_ = other.exceptionPrincipals_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureExceptionPrincipalsIsMutable(); + exceptionPrincipals_.addAll(other.exceptionPrincipals_); + } + onChanged(); + } + if (!other.deniedPermissions_.isEmpty()) { + if (deniedPermissions_.isEmpty()) { + deniedPermissions_ = other.deniedPermissions_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureDeniedPermissionsIsMutable(); + deniedPermissions_.addAll(other.deniedPermissions_); + } + onChanged(); + } + if (!other.exceptionPermissions_.isEmpty()) { + if (exceptionPermissions_.isEmpty()) { + exceptionPermissions_ = other.exceptionPermissions_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureExceptionPermissionsIsMutable(); + exceptionPermissions_.addAll(other.exceptionPermissions_); + } + onChanged(); + } + if (other.hasDenialCondition()) { + mergeDenialCondition(other.getDenialCondition()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.DenyRule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.DenyRule) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList deniedPrincipals_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureDeniedPrincipalsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + deniedPrincipals_ = new com.google.protobuf.LazyStringArrayList(deniedPrincipals_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @return A list containing the deniedPrincipals. + */ + public com.google.protobuf.ProtocolStringList getDeniedPrincipalsList() { + return deniedPrincipals_.getUnmodifiableView(); + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @return The count of deniedPrincipals. + */ + public int getDeniedPrincipalsCount() { + return deniedPrincipals_.size(); + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @param index The index of the element to return. + * @return The deniedPrincipals at the given index. + */ + public java.lang.String getDeniedPrincipals(int index) { + return deniedPrincipals_.get(index); + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @param index The index of the value to return. + * @return The bytes of the deniedPrincipals at the given index. + */ + public com.google.protobuf.ByteString getDeniedPrincipalsBytes(int index) { + return deniedPrincipals_.getByteString(index); + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @param index The index to set the value at. + * @param value The deniedPrincipals to set. + * @return This builder for chaining. + */ + public Builder setDeniedPrincipals(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDeniedPrincipalsIsMutable(); + deniedPrincipals_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @param value The deniedPrincipals to add. + * @return This builder for chaining. + */ + public Builder addDeniedPrincipals(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDeniedPrincipalsIsMutable(); + deniedPrincipals_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @param values The deniedPrincipals to add. + * @return This builder for chaining. + */ + public Builder addAllDeniedPrincipals(java.lang.Iterable values) { + ensureDeniedPrincipalsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deniedPrincipals_); + onChanged(); + return this; + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @return This builder for chaining. + */ + public Builder clearDeniedPrincipals() { + deniedPrincipals_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * The identities that are prevented from using one or more permissions on
+     * Google Cloud resources. This field can contain the following values:
+     * * `principalSet://goog/public:all`: A special identifier that represents
+     *   any principal that is on the internet, even if they do not have a Google
+     *   Account or are not logged in.
+     * * `principal://goog/subject/{email_id}`: A specific Google Account.
+     *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+     *   example, `principal://goog/subject/alice@example.com`.
+     * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+     *   Google Account that was deleted recently. For example,
+     *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+     *   the Google Account is recovered, this identifier reverts to the standard
+     *   identifier for a Google Account.
+     * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+     *   `principalSet://goog/group/admins@example.com`.
+     * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+     *   that was deleted recently. For example,
+     *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+     *   the Google group is restored, this identifier reverts to the standard
+     *   identifier for a Google group.
+     * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+     *   A Google Cloud service account. For example,
+     *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+     * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+     *   A Google Cloud service account that was deleted recently. For example,
+     *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+     *   If the service account is undeleted, this identifier reverts to the
+     *   standard identifier for a service account.
+     * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+     *   principals associated with the specified Google Workspace or Cloud
+     *   Identity customer ID. For example,
+     *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+     * 
+ * + * repeated string denied_principals = 1; + * + * @param value The bytes of the deniedPrincipals to add. + * @return This builder for chaining. + */ + public Builder addDeniedPrincipalsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureDeniedPrincipalsIsMutable(); + deniedPrincipals_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList exceptionPrincipals_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureExceptionPrincipalsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + exceptionPrincipals_ = new com.google.protobuf.LazyStringArrayList(exceptionPrincipals_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @return A list containing the exceptionPrincipals. + */ + public com.google.protobuf.ProtocolStringList getExceptionPrincipalsList() { + return exceptionPrincipals_.getUnmodifiableView(); + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @return The count of exceptionPrincipals. + */ + public int getExceptionPrincipalsCount() { + return exceptionPrincipals_.size(); + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @param index The index of the element to return. + * @return The exceptionPrincipals at the given index. + */ + public java.lang.String getExceptionPrincipals(int index) { + return exceptionPrincipals_.get(index); + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @param index The index of the value to return. + * @return The bytes of the exceptionPrincipals at the given index. + */ + public com.google.protobuf.ByteString getExceptionPrincipalsBytes(int index) { + return exceptionPrincipals_.getByteString(index); + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @param index The index to set the value at. + * @param value The exceptionPrincipals to set. + * @return This builder for chaining. + */ + public Builder setExceptionPrincipals(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureExceptionPrincipalsIsMutable(); + exceptionPrincipals_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @param value The exceptionPrincipals to add. + * @return This builder for chaining. + */ + public Builder addExceptionPrincipals(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureExceptionPrincipalsIsMutable(); + exceptionPrincipals_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @param values The exceptionPrincipals to add. + * @return This builder for chaining. + */ + public Builder addAllExceptionPrincipals(java.lang.Iterable values) { + ensureExceptionPrincipalsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, exceptionPrincipals_); + onChanged(); + return this; + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @return This builder for chaining. + */ + public Builder clearExceptionPrincipals() { + exceptionPrincipals_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * The identities that are excluded from the deny rule, even if they are
+     * listed in the `denied_principals`. For example, you could add a Google
+     * group to the `denied_principals`, then exclude specific users who belong to
+     * that group.
+     * This field can contain the same values as the `denied_principals` field,
+     * excluding `principalSet://goog/public:all`, which represents all users on
+     * the internet.
+     * 
+ * + * repeated string exception_principals = 2; + * + * @param value The bytes of the exceptionPrincipals to add. + * @return This builder for chaining. + */ + public Builder addExceptionPrincipalsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureExceptionPrincipalsIsMutable(); + exceptionPrincipals_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList deniedPermissions_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureDeniedPermissionsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + deniedPermissions_ = new com.google.protobuf.LazyStringArrayList(deniedPermissions_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @return A list containing the deniedPermissions. + */ + public com.google.protobuf.ProtocolStringList getDeniedPermissionsList() { + return deniedPermissions_.getUnmodifiableView(); + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @return The count of deniedPermissions. + */ + public int getDeniedPermissionsCount() { + return deniedPermissions_.size(); + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @param index The index of the element to return. + * @return The deniedPermissions at the given index. + */ + public java.lang.String getDeniedPermissions(int index) { + return deniedPermissions_.get(index); + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @param index The index of the value to return. + * @return The bytes of the deniedPermissions at the given index. + */ + public com.google.protobuf.ByteString getDeniedPermissionsBytes(int index) { + return deniedPermissions_.getByteString(index); + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @param index The index to set the value at. + * @param value The deniedPermissions to set. + * @return This builder for chaining. + */ + public Builder setDeniedPermissions(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDeniedPermissionsIsMutable(); + deniedPermissions_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @param value The deniedPermissions to add. + * @return This builder for chaining. + */ + public Builder addDeniedPermissions(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDeniedPermissionsIsMutable(); + deniedPermissions_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @param values The deniedPermissions to add. + * @return This builder for chaining. + */ + public Builder addAllDeniedPermissions(java.lang.Iterable values) { + ensureDeniedPermissionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deniedPermissions_); + onChanged(); + return this; + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @return This builder for chaining. + */ + public Builder clearDeniedPermissions() { + deniedPermissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * The permissions that are explicitly denied by this rule. Each permission
+     * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+     * is the fully qualified domain name for the service. For example,
+     * `iam.googleapis.com/roles.list`.
+     * 
+ * + * repeated string denied_permissions = 3; + * + * @param value The bytes of the deniedPermissions to add. + * @return This builder for chaining. + */ + public Builder addDeniedPermissionsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureDeniedPermissionsIsMutable(); + deniedPermissions_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList exceptionPermissions_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureExceptionPermissionsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + exceptionPermissions_ = new com.google.protobuf.LazyStringArrayList(exceptionPermissions_); + bitField0_ |= 0x00000008; + } + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @return A list containing the exceptionPermissions. + */ + public com.google.protobuf.ProtocolStringList getExceptionPermissionsList() { + return exceptionPermissions_.getUnmodifiableView(); + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @return The count of exceptionPermissions. + */ + public int getExceptionPermissionsCount() { + return exceptionPermissions_.size(); + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @param index The index of the element to return. + * @return The exceptionPermissions at the given index. + */ + public java.lang.String getExceptionPermissions(int index) { + return exceptionPermissions_.get(index); + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @param index The index of the value to return. + * @return The bytes of the exceptionPermissions at the given index. + */ + public com.google.protobuf.ByteString getExceptionPermissionsBytes(int index) { + return exceptionPermissions_.getByteString(index); + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @param index The index to set the value at. + * @param value The exceptionPermissions to set. + * @return This builder for chaining. + */ + public Builder setExceptionPermissions(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureExceptionPermissionsIsMutable(); + exceptionPermissions_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @param value The exceptionPermissions to add. + * @return This builder for chaining. + */ + public Builder addExceptionPermissions(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureExceptionPermissionsIsMutable(); + exceptionPermissions_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @param values The exceptionPermissions to add. + * @return This builder for chaining. + */ + public Builder addAllExceptionPermissions(java.lang.Iterable values) { + ensureExceptionPermissionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, exceptionPermissions_); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @return This builder for chaining. + */ + public Builder clearExceptionPermissions() { + exceptionPermissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the permissions that this rule excludes from the set of denied
+     * permissions given by `denied_permissions`. If a permission appears in
+     * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+     * denied.
+     * The excluded permissions can be specified using the same syntax as
+     * `denied_permissions`.
+     * 
+ * + * repeated string exception_permissions = 4; + * + * @param value The bytes of the exceptionPermissions to add. + * @return This builder for chaining. + */ + public Builder addExceptionPermissionsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureExceptionPermissionsIsMutable(); + exceptionPermissions_.add(value); + onChanged(); + return this; + } + + private com.google.type.Expr denialCondition_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder> + denialConditionBuilder_; + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + * + * @return Whether the denialCondition field is set. + */ + public boolean hasDenialCondition() { + return denialConditionBuilder_ != null || denialCondition_ != null; + } + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + * + * @return The denialCondition. + */ + public com.google.type.Expr getDenialCondition() { + if (denialConditionBuilder_ == null) { + return denialCondition_ == null + ? com.google.type.Expr.getDefaultInstance() + : denialCondition_; + } else { + return denialConditionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + */ + public Builder setDenialCondition(com.google.type.Expr value) { + if (denialConditionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + denialCondition_ = value; + onChanged(); + } else { + denialConditionBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + */ + public Builder setDenialCondition(com.google.type.Expr.Builder builderForValue) { + if (denialConditionBuilder_ == null) { + denialCondition_ = builderForValue.build(); + onChanged(); + } else { + denialConditionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + */ + public Builder mergeDenialCondition(com.google.type.Expr value) { + if (denialConditionBuilder_ == null) { + if (denialCondition_ != null) { + denialCondition_ = + com.google.type.Expr.newBuilder(denialCondition_).mergeFrom(value).buildPartial(); + } else { + denialCondition_ = value; + } + onChanged(); + } else { + denialConditionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + */ + public Builder clearDenialCondition() { + if (denialConditionBuilder_ == null) { + denialCondition_ = null; + onChanged(); + } else { + denialCondition_ = null; + denialConditionBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + */ + public com.google.type.Expr.Builder getDenialConditionBuilder() { + + onChanged(); + return getDenialConditionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + */ + public com.google.type.ExprOrBuilder getDenialConditionOrBuilder() { + if (denialConditionBuilder_ != null) { + return denialConditionBuilder_.getMessageOrBuilder(); + } else { + return denialCondition_ == null + ? com.google.type.Expr.getDefaultInstance() + : denialCondition_; + } + } + /** + * + * + *
+     * The condition that determines whether this deny rule applies to a request.
+     * If the condition expression evaluates to `true`, then the deny rule is
+     * applied; otherwise, the deny rule is not applied.
+     * Each deny rule is evaluated independently. If this deny rule does not apply
+     * to a request, other deny rules might still apply.
+     * The condition can use CEL functions that evaluate
+     * [resource
+     * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+     * functions and operators are not supported.
+     * 
+ * + * .google.type.Expr denial_condition = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder> + getDenialConditionFieldBuilder() { + if (denialConditionBuilder_ == null) { + denialConditionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder>( + getDenialCondition(), getParentForChildren(), isClean()); + denialCondition_ = null; + } + return denialConditionBuilder_; + } + + @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.iam.v2.DenyRule) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.DenyRule) + private static final com.google.iam.v2.DenyRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.DenyRule(); + } + + public static com.google.iam.v2.DenyRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DenyRule parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DenyRule(input, extensionRegistry); + } + }; + + 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.iam.v2.DenyRule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRuleOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRuleOrBuilder.java new file mode 100644 index 00000000..1d35367f --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRuleOrBuilder.java @@ -0,0 +1,468 @@ +/* + * 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/iam/v2/deny.proto + +package com.google.iam.v2; + +public interface DenyRuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.DenyRule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The identities that are prevented from using one or more permissions on
+   * Google Cloud resources. This field can contain the following values:
+   * * `principalSet://goog/public:all`: A special identifier that represents
+   *   any principal that is on the internet, even if they do not have a Google
+   *   Account or are not logged in.
+   * * `principal://goog/subject/{email_id}`: A specific Google Account.
+   *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+   *   example, `principal://goog/subject/alice@example.com`.
+   * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+   *   Google Account that was deleted recently. For example,
+   *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+   *   the Google Account is recovered, this identifier reverts to the standard
+   *   identifier for a Google Account.
+   * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+   *   `principalSet://goog/group/admins@example.com`.
+   * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+   *   that was deleted recently. For example,
+   *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+   *   the Google group is restored, this identifier reverts to the standard
+   *   identifier for a Google group.
+   * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+   *   A Google Cloud service account. For example,
+   *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+   * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+   *   A Google Cloud service account that was deleted recently. For example,
+   *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+   *   If the service account is undeleted, this identifier reverts to the
+   *   standard identifier for a service account.
+   * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+   *   principals associated with the specified Google Workspace or Cloud
+   *   Identity customer ID. For example,
+   *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+   * 
+ * + * repeated string denied_principals = 1; + * + * @return A list containing the deniedPrincipals. + */ + java.util.List getDeniedPrincipalsList(); + /** + * + * + *
+   * The identities that are prevented from using one or more permissions on
+   * Google Cloud resources. This field can contain the following values:
+   * * `principalSet://goog/public:all`: A special identifier that represents
+   *   any principal that is on the internet, even if they do not have a Google
+   *   Account or are not logged in.
+   * * `principal://goog/subject/{email_id}`: A specific Google Account.
+   *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+   *   example, `principal://goog/subject/alice@example.com`.
+   * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+   *   Google Account that was deleted recently. For example,
+   *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+   *   the Google Account is recovered, this identifier reverts to the standard
+   *   identifier for a Google Account.
+   * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+   *   `principalSet://goog/group/admins@example.com`.
+   * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+   *   that was deleted recently. For example,
+   *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+   *   the Google group is restored, this identifier reverts to the standard
+   *   identifier for a Google group.
+   * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+   *   A Google Cloud service account. For example,
+   *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+   * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+   *   A Google Cloud service account that was deleted recently. For example,
+   *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+   *   If the service account is undeleted, this identifier reverts to the
+   *   standard identifier for a service account.
+   * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+   *   principals associated with the specified Google Workspace or Cloud
+   *   Identity customer ID. For example,
+   *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+   * 
+ * + * repeated string denied_principals = 1; + * + * @return The count of deniedPrincipals. + */ + int getDeniedPrincipalsCount(); + /** + * + * + *
+   * The identities that are prevented from using one or more permissions on
+   * Google Cloud resources. This field can contain the following values:
+   * * `principalSet://goog/public:all`: A special identifier that represents
+   *   any principal that is on the internet, even if they do not have a Google
+   *   Account or are not logged in.
+   * * `principal://goog/subject/{email_id}`: A specific Google Account.
+   *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+   *   example, `principal://goog/subject/alice@example.com`.
+   * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+   *   Google Account that was deleted recently. For example,
+   *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+   *   the Google Account is recovered, this identifier reverts to the standard
+   *   identifier for a Google Account.
+   * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+   *   `principalSet://goog/group/admins@example.com`.
+   * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+   *   that was deleted recently. For example,
+   *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+   *   the Google group is restored, this identifier reverts to the standard
+   *   identifier for a Google group.
+   * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+   *   A Google Cloud service account. For example,
+   *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+   * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+   *   A Google Cloud service account that was deleted recently. For example,
+   *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+   *   If the service account is undeleted, this identifier reverts to the
+   *   standard identifier for a service account.
+   * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+   *   principals associated with the specified Google Workspace or Cloud
+   *   Identity customer ID. For example,
+   *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+   * 
+ * + * repeated string denied_principals = 1; + * + * @param index The index of the element to return. + * @return The deniedPrincipals at the given index. + */ + java.lang.String getDeniedPrincipals(int index); + /** + * + * + *
+   * The identities that are prevented from using one or more permissions on
+   * Google Cloud resources. This field can contain the following values:
+   * * `principalSet://goog/public:all`: A special identifier that represents
+   *   any principal that is on the internet, even if they do not have a Google
+   *   Account or are not logged in.
+   * * `principal://goog/subject/{email_id}`: A specific Google Account.
+   *   Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
+   *   example, `principal://goog/subject/alice@example.com`.
+   * * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
+   *   Google Account that was deleted recently. For example,
+   *   `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
+   *   the Google Account is recovered, this identifier reverts to the standard
+   *   identifier for a Google Account.
+   * * `principalSet://goog/group/{group_id}`: A Google group. For example,
+   *   `principalSet://goog/group/admins@example.com`.
+   * * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
+   *   that was deleted recently. For example,
+   *   `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
+   *   the Google group is restored, this identifier reverts to the standard
+   *   identifier for a Google group.
+   * * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
+   *   A Google Cloud service account. For example,
+   *   `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
+   * * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
+   *   A Google Cloud service account that was deleted recently. For example,
+   *   `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
+   *   If the service account is undeleted, this identifier reverts to the
+   *   standard identifier for a service account.
+   * * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
+   *   principals associated with the specified Google Workspace or Cloud
+   *   Identity customer ID. For example,
+   *   `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
+   * 
+ * + * repeated string denied_principals = 1; + * + * @param index The index of the value to return. + * @return The bytes of the deniedPrincipals at the given index. + */ + com.google.protobuf.ByteString getDeniedPrincipalsBytes(int index); + + /** + * + * + *
+   * The identities that are excluded from the deny rule, even if they are
+   * listed in the `denied_principals`. For example, you could add a Google
+   * group to the `denied_principals`, then exclude specific users who belong to
+   * that group.
+   * This field can contain the same values as the `denied_principals` field,
+   * excluding `principalSet://goog/public:all`, which represents all users on
+   * the internet.
+   * 
+ * + * repeated string exception_principals = 2; + * + * @return A list containing the exceptionPrincipals. + */ + java.util.List getExceptionPrincipalsList(); + /** + * + * + *
+   * The identities that are excluded from the deny rule, even if they are
+   * listed in the `denied_principals`. For example, you could add a Google
+   * group to the `denied_principals`, then exclude specific users who belong to
+   * that group.
+   * This field can contain the same values as the `denied_principals` field,
+   * excluding `principalSet://goog/public:all`, which represents all users on
+   * the internet.
+   * 
+ * + * repeated string exception_principals = 2; + * + * @return The count of exceptionPrincipals. + */ + int getExceptionPrincipalsCount(); + /** + * + * + *
+   * The identities that are excluded from the deny rule, even if they are
+   * listed in the `denied_principals`. For example, you could add a Google
+   * group to the `denied_principals`, then exclude specific users who belong to
+   * that group.
+   * This field can contain the same values as the `denied_principals` field,
+   * excluding `principalSet://goog/public:all`, which represents all users on
+   * the internet.
+   * 
+ * + * repeated string exception_principals = 2; + * + * @param index The index of the element to return. + * @return The exceptionPrincipals at the given index. + */ + java.lang.String getExceptionPrincipals(int index); + /** + * + * + *
+   * The identities that are excluded from the deny rule, even if they are
+   * listed in the `denied_principals`. For example, you could add a Google
+   * group to the `denied_principals`, then exclude specific users who belong to
+   * that group.
+   * This field can contain the same values as the `denied_principals` field,
+   * excluding `principalSet://goog/public:all`, which represents all users on
+   * the internet.
+   * 
+ * + * repeated string exception_principals = 2; + * + * @param index The index of the value to return. + * @return The bytes of the exceptionPrincipals at the given index. + */ + com.google.protobuf.ByteString getExceptionPrincipalsBytes(int index); + + /** + * + * + *
+   * The permissions that are explicitly denied by this rule. Each permission
+   * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+   * is the fully qualified domain name for the service. For example,
+   * `iam.googleapis.com/roles.list`.
+   * 
+ * + * repeated string denied_permissions = 3; + * + * @return A list containing the deniedPermissions. + */ + java.util.List getDeniedPermissionsList(); + /** + * + * + *
+   * The permissions that are explicitly denied by this rule. Each permission
+   * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+   * is the fully qualified domain name for the service. For example,
+   * `iam.googleapis.com/roles.list`.
+   * 
+ * + * repeated string denied_permissions = 3; + * + * @return The count of deniedPermissions. + */ + int getDeniedPermissionsCount(); + /** + * + * + *
+   * The permissions that are explicitly denied by this rule. Each permission
+   * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+   * is the fully qualified domain name for the service. For example,
+   * `iam.googleapis.com/roles.list`.
+   * 
+ * + * repeated string denied_permissions = 3; + * + * @param index The index of the element to return. + * @return The deniedPermissions at the given index. + */ + java.lang.String getDeniedPermissions(int index); + /** + * + * + *
+   * The permissions that are explicitly denied by this rule. Each permission
+   * uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
+   * is the fully qualified domain name for the service. For example,
+   * `iam.googleapis.com/roles.list`.
+   * 
+ * + * repeated string denied_permissions = 3; + * + * @param index The index of the value to return. + * @return The bytes of the deniedPermissions at the given index. + */ + com.google.protobuf.ByteString getDeniedPermissionsBytes(int index); + + /** + * + * + *
+   * Specifies the permissions that this rule excludes from the set of denied
+   * permissions given by `denied_permissions`. If a permission appears in
+   * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+   * denied.
+   * The excluded permissions can be specified using the same syntax as
+   * `denied_permissions`.
+   * 
+ * + * repeated string exception_permissions = 4; + * + * @return A list containing the exceptionPermissions. + */ + java.util.List getExceptionPermissionsList(); + /** + * + * + *
+   * Specifies the permissions that this rule excludes from the set of denied
+   * permissions given by `denied_permissions`. If a permission appears in
+   * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+   * denied.
+   * The excluded permissions can be specified using the same syntax as
+   * `denied_permissions`.
+   * 
+ * + * repeated string exception_permissions = 4; + * + * @return The count of exceptionPermissions. + */ + int getExceptionPermissionsCount(); + /** + * + * + *
+   * Specifies the permissions that this rule excludes from the set of denied
+   * permissions given by `denied_permissions`. If a permission appears in
+   * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+   * denied.
+   * The excluded permissions can be specified using the same syntax as
+   * `denied_permissions`.
+   * 
+ * + * repeated string exception_permissions = 4; + * + * @param index The index of the element to return. + * @return The exceptionPermissions at the given index. + */ + java.lang.String getExceptionPermissions(int index); + /** + * + * + *
+   * Specifies the permissions that this rule excludes from the set of denied
+   * permissions given by `denied_permissions`. If a permission appears in
+   * `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
+   * denied.
+   * The excluded permissions can be specified using the same syntax as
+   * `denied_permissions`.
+   * 
+ * + * repeated string exception_permissions = 4; + * + * @param index The index of the value to return. + * @return The bytes of the exceptionPermissions at the given index. + */ + com.google.protobuf.ByteString getExceptionPermissionsBytes(int index); + + /** + * + * + *
+   * The condition that determines whether this deny rule applies to a request.
+   * If the condition expression evaluates to `true`, then the deny rule is
+   * applied; otherwise, the deny rule is not applied.
+   * Each deny rule is evaluated independently. If this deny rule does not apply
+   * to a request, other deny rules might still apply.
+   * The condition can use CEL functions that evaluate
+   * [resource
+   * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+   * functions and operators are not supported.
+   * 
+ * + * .google.type.Expr denial_condition = 5; + * + * @return Whether the denialCondition field is set. + */ + boolean hasDenialCondition(); + /** + * + * + *
+   * The condition that determines whether this deny rule applies to a request.
+   * If the condition expression evaluates to `true`, then the deny rule is
+   * applied; otherwise, the deny rule is not applied.
+   * Each deny rule is evaluated independently. If this deny rule does not apply
+   * to a request, other deny rules might still apply.
+   * The condition can use CEL functions that evaluate
+   * [resource
+   * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+   * functions and operators are not supported.
+   * 
+ * + * .google.type.Expr denial_condition = 5; + * + * @return The denialCondition. + */ + com.google.type.Expr getDenialCondition(); + /** + * + * + *
+   * The condition that determines whether this deny rule applies to a request.
+   * If the condition expression evaluates to `true`, then the deny rule is
+   * applied; otherwise, the deny rule is not applied.
+   * Each deny rule is evaluated independently. If this deny rule does not apply
+   * to a request, other deny rules might still apply.
+   * The condition can use CEL functions that evaluate
+   * [resource
+   * tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
+   * functions and operators are not supported.
+   * 
+ * + * .google.type.Expr denial_condition = 5; + */ + com.google.type.ExprOrBuilder getDenialConditionOrBuilder(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRuleProto.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRuleProto.java new file mode 100644 index 00000000..55a5ff75 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/DenyRuleProto.java @@ -0,0 +1,75 @@ +/* + * 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/iam/v2/deny.proto + +package com.google.iam.v2; + +public final class DenyRuleProto { + private DenyRuleProto() {} + + 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_iam_v2_DenyRule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_DenyRule_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\030google/iam/v2/deny.proto\022\rgoogle.iam.v" + + "2\032\026google/type/expr.proto\"\253\001\n\010DenyRule\022\031" + + "\n\021denied_principals\030\001 \003(\t\022\034\n\024exception_p" + + "rincipals\030\002 \003(\t\022\032\n\022denied_permissions\030\003 " + + "\003(\t\022\035\n\025exception_permissions\030\004 \003(\t\022+\n\020de" + + "nial_condition\030\005 \001(\0132\021.google.type.ExprB" + + "\202\001\n\021com.google.iam.v2B\rDenyRuleProtoP\001Z0" + + "google.golang.org/genproto/googleapis/ia" + + "m/v2;iam\252\002\023Google.Cloud.Iam.V2\312\002\023Google\\" + + "Cloud\\Iam\\V2b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.type.ExprProto.getDescriptor(), + }); + internal_static_google_iam_v2_DenyRule_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_google_iam_v2_DenyRule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_DenyRule_descriptor, + new java.lang.String[] { + "DeniedPrincipals", + "ExceptionPrincipals", + "DeniedPermissions", + "ExceptionPermissions", + "DenialCondition", + }); + com.google.type.ExprProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/GetPolicyRequest.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/GetPolicyRequest.java new file mode 100644 index 00000000..89594074 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/GetPolicyRequest.java @@ -0,0 +1,674 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Request message for `GetPolicy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2.GetPolicyRequest} + */ +public final class GetPolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.GetPolicyRequest) + GetPolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetPolicyRequest.newBuilder() to construct. + private GetPolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetPolicyRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetPolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetPolicyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_GetPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_GetPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.GetPolicyRequest.class, + com.google.iam.v2.GetPolicyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the policy to retrieve. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * Use the URL-encoded full resource name, which means that the forward-slash
+   * character, `/`, must be written as `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric 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. The resource name of the policy to retrieve. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * Use the URL-encoded full resource name, which means that the forward-slash
+   * character, `/`, must be written as `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric 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; + } + } + + 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_); + } + unknownFields.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 += unknownFields.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.iam.v2.GetPolicyRequest)) { + return super.equals(obj); + } + com.google.iam.v2.GetPolicyRequest other = (com.google.iam.v2.GetPolicyRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.GetPolicyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.GetPolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.GetPolicyRequest parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.GetPolicyRequest 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.iam.v2.GetPolicyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.GetPolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.GetPolicyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.GetPolicyRequest 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.iam.v2.GetPolicyRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.GetPolicyRequest 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.iam.v2.GetPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.GetPolicyRequest 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.iam.v2.GetPolicyRequest 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 `GetPolicy`.
+   * 
+ * + * Protobuf type {@code google.iam.v2.GetPolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.GetPolicyRequest) + com.google.iam.v2.GetPolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_GetPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_GetPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.GetPolicyRequest.class, + com.google.iam.v2.GetPolicyRequest.Builder.class); + } + + // Construct using com.google.iam.v2.GetPolicyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_GetPolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.GetPolicyRequest getDefaultInstanceForType() { + return com.google.iam.v2.GetPolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.GetPolicyRequest build() { + com.google.iam.v2.GetPolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.GetPolicyRequest buildPartial() { + com.google.iam.v2.GetPolicyRequest result = new com.google.iam.v2.GetPolicyRequest(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.iam.v2.GetPolicyRequest) { + return mergeFrom((com.google.iam.v2.GetPolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.GetPolicyRequest other) { + if (other == com.google.iam.v2.GetPolicyRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.GetPolicyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.GetPolicyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the policy to retrieve. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric 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. The resource name of the policy to retrieve. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric 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. The resource name of the policy to retrieve. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric 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. The resource name of the policy to retrieve. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the policy to retrieve. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * Use the URL-encoded full resource name, which means that the forward-slash
+     * character, `/`, must be written as `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric 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; + } + + @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.iam.v2.GetPolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.GetPolicyRequest) + private static final com.google.iam.v2.GetPolicyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.GetPolicyRequest(); + } + + public static com.google.iam.v2.GetPolicyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetPolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetPolicyRequest(input, extensionRegistry); + } + }; + + 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.iam.v2.GetPolicyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/GetPolicyRequestOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/GetPolicyRequestOrBuilder.java new file mode 100644 index 00000000..6f293a32 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/GetPolicyRequestOrBuilder.java @@ -0,0 +1,62 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface GetPolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.GetPolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the policy to retrieve. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * Use the URL-encoded full resource name, which means that the forward-slash
+   * character, `/`, must be written as `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the policy to retrieve. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * Use the URL-encoded full resource name, which means that the forward-slash
+   * character, `/`, must be written as `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesRequest.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesRequest.java new file mode 100644 index 00000000..fad84f5d --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesRequest.java @@ -0,0 +1,1207 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * `ListApplicablePoliciesRequest` represents the Request message for the
+ * `ListApplicablePolicies` method. It provides the input for a filterable query
+ * of Policies that apply to a certain GCP Resource, specified by the field
+ * `attachment_point`, found on this message.
+ * Example:
+ * ```
+ * {
+ *    attachment_point:
+ *    'cloudresourcemanager.googleapis.com%2Forganizations%2F212345678901'
+ *    filter: 'kind:denyPolicies'
+ * }
+ * ```
+ * 
+ * + * Protobuf type {@code google.iam.v2.ListApplicablePoliciesRequest} + */ +public final class ListApplicablePoliciesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.ListApplicablePoliciesRequest) + ListApplicablePoliciesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListApplicablePoliciesRequest.newBuilder() to construct. + private ListApplicablePoliciesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListApplicablePoliciesRequest() { + attachmentPoint_ = ""; + filter_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListApplicablePoliciesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListApplicablePoliciesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + attachmentPoint_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 32: + { + pageSize_ = input.readInt32(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.ListApplicablePoliciesRequest.class, + com.google.iam.v2.ListApplicablePoliciesRequest.Builder.class); + } + + public static final int ATTACHMENT_POINT_FIELD_NUMBER = 1; + private volatile java.lang.Object attachmentPoint_; + /** + * + * + *
+   * Required. The Cloud resource at which the applicable policies are to be
+   * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+   * name, which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+   * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The attachmentPoint. + */ + @java.lang.Override + public java.lang.String getAttachmentPoint() { + java.lang.Object ref = attachmentPoint_; + 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(); + attachmentPoint_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The Cloud resource at which the applicable policies are to be
+   * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+   * name, which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+   * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for attachmentPoint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAttachmentPointBytes() { + java.lang.Object ref = attachmentPoint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attachmentPoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 2; + private volatile java.lang.Object filter_; + /** + * + * + *
+   * Filtering currently only supports the kind of policies to return, and
+   * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+   * policy kinds may be added in the future without notice.
+   * Example value: “kind:denyPolicies”
+   * 
+ * + * string filter = 2; + * + * @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; + } + } + /** + * + * + *
+   * Filtering currently only supports the kind of policies to return, and
+   * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+   * policy kinds may be added in the future without notice.
+   * Example value: “kind:denyPolicies”
+   * 
+ * + * string filter = 2; + * + * @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; + } + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * If present, then retrieve the batch of results following the results from
+   * the preceding call to this method.  `page_token` must be the value of
+   * `next_page_token`
+   * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+   * from the previous response.  The values of other method parameters should
+   * be identical to those in the previous call.
+   * 
+ * + * 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; + } + } + /** + * + * + *
+   * If present, then retrieve the batch of results following the results from
+   * the preceding call to this method.  `page_token` must be the value of
+   * `next_page_token`
+   * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+   * from the previous response.  The values of other method parameters should
+   * be identical to those in the previous call.
+   * 
+ * + * 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 PAGE_SIZE_FIELD_NUMBER = 4; + private int pageSize_; + /** + * + * + *
+   * Limit on the number of policies to include in the response.
+   * Further policies can subsequently be obtained by including the
+   * [ListApplicablePoliciesResponse.next_page_token][google.iam.admin.v1.ListApplicablePoliciesResponse.next_page_token]
+   * in a subsequent request.
+   * The minimum is 25, and the maximum is 100.
+   * 
+ * + * int32 page_size = 4; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + 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(attachmentPoint_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, attachmentPoint_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (pageSize_ != 0) { + output.writeInt32(4, pageSize_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attachmentPoint_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, attachmentPoint_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, filter_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, pageSize_); + } + size += unknownFields.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.iam.v2.ListApplicablePoliciesRequest)) { + return super.equals(obj); + } + com.google.iam.v2.ListApplicablePoliciesRequest other = + (com.google.iam.v2.ListApplicablePoliciesRequest) obj; + + if (!getAttachmentPoint().equals(other.getAttachmentPoint())) return false; + if (!getFilter().equals(other.getFilter())) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + ATTACHMENT_POINT_FIELD_NUMBER; + hash = (53 * hash) + getAttachmentPoint().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest 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.iam.v2.ListApplicablePoliciesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest 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.iam.v2.ListApplicablePoliciesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest 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.iam.v2.ListApplicablePoliciesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest 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.iam.v2.ListApplicablePoliciesRequest 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; + } + /** + * + * + *
+   * `ListApplicablePoliciesRequest` represents the Request message for the
+   * `ListApplicablePolicies` method. It provides the input for a filterable query
+   * of Policies that apply to a certain GCP Resource, specified by the field
+   * `attachment_point`, found on this message.
+   * Example:
+   * ```
+   * {
+   *    attachment_point:
+   *    'cloudresourcemanager.googleapis.com%2Forganizations%2F212345678901'
+   *    filter: 'kind:denyPolicies'
+   * }
+   * ```
+   * 
+ * + * Protobuf type {@code google.iam.v2.ListApplicablePoliciesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.ListApplicablePoliciesRequest) + com.google.iam.v2.ListApplicablePoliciesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.ListApplicablePoliciesRequest.class, + com.google.iam.v2.ListApplicablePoliciesRequest.Builder.class); + } + + // Construct using com.google.iam.v2.ListApplicablePoliciesRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + attachmentPoint_ = ""; + + filter_ = ""; + + pageToken_ = ""; + + pageSize_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.ListApplicablePoliciesRequest getDefaultInstanceForType() { + return com.google.iam.v2.ListApplicablePoliciesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.ListApplicablePoliciesRequest build() { + com.google.iam.v2.ListApplicablePoliciesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.ListApplicablePoliciesRequest buildPartial() { + com.google.iam.v2.ListApplicablePoliciesRequest result = + new com.google.iam.v2.ListApplicablePoliciesRequest(this); + result.attachmentPoint_ = attachmentPoint_; + result.filter_ = filter_; + result.pageToken_ = pageToken_; + result.pageSize_ = pageSize_; + 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.iam.v2.ListApplicablePoliciesRequest) { + return mergeFrom((com.google.iam.v2.ListApplicablePoliciesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.ListApplicablePoliciesRequest other) { + if (other == com.google.iam.v2.ListApplicablePoliciesRequest.getDefaultInstance()) + return this; + if (!other.getAttachmentPoint().isEmpty()) { + attachmentPoint_ = other.attachmentPoint_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.ListApplicablePoliciesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.ListApplicablePoliciesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object attachmentPoint_ = ""; + /** + * + * + *
+     * Required. The Cloud resource at which the applicable policies are to be
+     * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+     * name, which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+     * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The attachmentPoint. + */ + public java.lang.String getAttachmentPoint() { + java.lang.Object ref = attachmentPoint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attachmentPoint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The Cloud resource at which the applicable policies are to be
+     * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+     * name, which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+     * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for attachmentPoint. + */ + public com.google.protobuf.ByteString getAttachmentPointBytes() { + java.lang.Object ref = attachmentPoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attachmentPoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The Cloud resource at which the applicable policies are to be
+     * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+     * name, which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+     * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The attachmentPoint to set. + * @return This builder for chaining. + */ + public Builder setAttachmentPoint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + attachmentPoint_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Cloud resource at which the applicable policies are to be
+     * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+     * name, which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+     * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearAttachmentPoint() { + + attachmentPoint_ = getDefaultInstance().getAttachmentPoint(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Cloud resource at which the applicable policies are to be
+     * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+     * name, which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+     * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for attachmentPoint to set. + * @return This builder for chaining. + */ + public Builder setAttachmentPointBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + attachmentPoint_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Filtering currently only supports the kind of policies to return, and
+     * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+     * policy kinds may be added in the future without notice.
+     * Example value: “kind:denyPolicies”
+     * 
+ * + * string filter = 2; + * + * @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; + } + } + /** + * + * + *
+     * Filtering currently only supports the kind of policies to return, and
+     * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+     * policy kinds may be added in the future without notice.
+     * Example value: “kind:denyPolicies”
+     * 
+ * + * string filter = 2; + * + * @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; + } + } + /** + * + * + *
+     * Filtering currently only supports the kind of policies to return, and
+     * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+     * policy kinds may be added in the future without notice.
+     * Example value: “kind:denyPolicies”
+     * 
+ * + * string filter = 2; + * + * @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; + } + /** + * + * + *
+     * Filtering currently only supports the kind of policies to return, and
+     * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+     * policy kinds may be added in the future without notice.
+     * Example value: “kind:denyPolicies”
+     * 
+ * + * string filter = 2; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+     * Filtering currently only supports the kind of policies to return, and
+     * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+     * policy kinds may be added in the future without notice.
+     * Example value: “kind:denyPolicies”
+     * 
+ * + * string filter = 2; + * + * @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; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * If present, then retrieve the batch of results following the results from
+     * the preceding call to this method.  `page_token` must be the value of
+     * `next_page_token`
+     * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+     * from the previous response.  The values of other method parameters should
+     * be identical to those in the previous call.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * If present, then retrieve the batch of results following the results from
+     * the preceding call to this method.  `page_token` must be the value of
+     * `next_page_token`
+     * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+     * from the previous response.  The values of other method parameters should
+     * be identical to those in the previous call.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * If present, then retrieve the batch of results following the results from
+     * the preceding call to this method.  `page_token` must be the value of
+     * `next_page_token`
+     * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+     * from the previous response.  The values of other method parameters should
+     * be identical to those in the previous call.
+     * 
+ * + * 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; + } + /** + * + * + *
+     * If present, then retrieve the batch of results following the results from
+     * the preceding call to this method.  `page_token` must be the value of
+     * `next_page_token`
+     * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+     * from the previous response.  The values of other method parameters should
+     * be identical to those in the previous call.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * If present, then retrieve the batch of results following the results from
+     * the preceding call to this method.  `page_token` must be the value of
+     * `next_page_token`
+     * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+     * from the previous response.  The values of other method parameters should
+     * be identical to those in the previous call.
+     * 
+ * + * 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 int pageSize_; + /** + * + * + *
+     * Limit on the number of policies to include in the response.
+     * Further policies can subsequently be obtained by including the
+     * [ListApplicablePoliciesResponse.next_page_token][google.iam.admin.v1.ListApplicablePoliciesResponse.next_page_token]
+     * in a subsequent request.
+     * The minimum is 25, and the maximum is 100.
+     * 
+ * + * int32 page_size = 4; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Limit on the number of policies to include in the response.
+     * Further policies can subsequently be obtained by including the
+     * [ListApplicablePoliciesResponse.next_page_token][google.iam.admin.v1.ListApplicablePoliciesResponse.next_page_token]
+     * in a subsequent request.
+     * The minimum is 25, and the maximum is 100.
+     * 
+ * + * int32 page_size = 4; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Limit on the number of policies to include in the response.
+     * Further policies can subsequently be obtained by including the
+     * [ListApplicablePoliciesResponse.next_page_token][google.iam.admin.v1.ListApplicablePoliciesResponse.next_page_token]
+     * in a subsequent request.
+     * The minimum is 25, and the maximum is 100.
+     * 
+ * + * int32 page_size = 4; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + 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.iam.v2.ListApplicablePoliciesRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.ListApplicablePoliciesRequest) + private static final com.google.iam.v2.ListApplicablePoliciesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.ListApplicablePoliciesRequest(); + } + + public static com.google.iam.v2.ListApplicablePoliciesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListApplicablePoliciesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListApplicablePoliciesRequest(input, extensionRegistry); + } + }; + + 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.iam.v2.ListApplicablePoliciesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesRequestOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesRequestOrBuilder.java new file mode 100644 index 00000000..b4b91808 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesRequestOrBuilder.java @@ -0,0 +1,141 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface ListApplicablePoliciesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.ListApplicablePoliciesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Cloud resource at which the applicable policies are to be
+   * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+   * name, which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+   * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The attachmentPoint. + */ + java.lang.String getAttachmentPoint(); + /** + * + * + *
+   * Required. The Cloud resource at which the applicable policies are to be
+   * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
+   * name, which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+   * 
+ * + * string attachment_point = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for attachmentPoint. + */ + com.google.protobuf.ByteString getAttachmentPointBytes(); + + /** + * + * + *
+   * Filtering currently only supports the kind of policies to return, and
+   * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+   * policy kinds may be added in the future without notice.
+   * Example value: “kind:denyPolicies”
+   * 
+ * + * string filter = 2; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Filtering currently only supports the kind of policies to return, and
+   * must be in the format “kind:[policyKind1] OR kind:[policyKind2]”.  New
+   * policy kinds may be added in the future without notice.
+   * Example value: “kind:denyPolicies”
+   * 
+ * + * string filter = 2; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); + + /** + * + * + *
+   * If present, then retrieve the batch of results following the results from
+   * the preceding call to this method.  `page_token` must be the value of
+   * `next_page_token`
+   * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+   * from the previous response.  The values of other method parameters should
+   * be identical to those in the previous call.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * If present, then retrieve the batch of results following the results from
+   * the preceding call to this method.  `page_token` must be the value of
+   * `next_page_token`
+   * [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token]
+   * from the previous response.  The values of other method parameters should
+   * be identical to those in the previous call.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Limit on the number of policies to include in the response.
+   * Further policies can subsequently be obtained by including the
+   * [ListApplicablePoliciesResponse.next_page_token][google.iam.admin.v1.ListApplicablePoliciesResponse.next_page_token]
+   * in a subsequent request.
+   * The minimum is 25, and the maximum is 100.
+   * 
+ * + * int32 page_size = 4; + * + * @return The pageSize. + */ + int getPageSize(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesResponse.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesResponse.java new file mode 100644 index 00000000..6c31b640 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesResponse.java @@ -0,0 +1,1503 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Response message for [ListApplicablePolicies][] method.
+ * 
+ * + * Protobuf type {@code google.iam.v2.ListApplicablePoliciesResponse} + */ +public final class ListApplicablePoliciesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.ListApplicablePoliciesResponse) + ListApplicablePoliciesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListApplicablePoliciesResponse.newBuilder() to construct. + private ListApplicablePoliciesResponse( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListApplicablePoliciesResponse() { + policies_ = java.util.Collections.emptyList(); + inaccessible_ = com.google.protobuf.LazyStringArrayList.EMPTY; + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListApplicablePoliciesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListApplicablePoliciesResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + policies_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + policies_.add( + input.readMessage(com.google.iam.v2.Policy.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + inaccessible_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + inaccessible_.add(s); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + policies_ = java.util.Collections.unmodifiableList(policies_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + inaccessible_ = inaccessible_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.ListApplicablePoliciesResponse.class, + com.google.iam.v2.ListApplicablePoliciesResponse.Builder.class); + } + + public static final int POLICIES_FIELD_NUMBER = 1; + private java.util.List policies_; + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public java.util.List getPoliciesList() { + return policies_; + } + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public java.util.List getPoliciesOrBuilderList() { + return policies_; + } + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public int getPoliciesCount() { + return policies_.size(); + } + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public com.google.iam.v2.Policy getPolicies(int index) { + return policies_.get(index); + } + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public com.google.iam.v2.PolicyOrBuilder getPoliciesOrBuilder(int index) { + return policies_.get(index); + } + + public static final int INACCESSIBLE_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList inaccessible_; + /** + * + * + *
+   * A list of resources that the caller does not have permission to retrieve.
+   * List or Get can be used to get detailed error messages.
+   * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+   * List: `policies/{attachment-point}/denypolicies`
+   * 
+ * + * repeated string inaccessible = 2; + * + * @return A list containing the inaccessible. + */ + public com.google.protobuf.ProtocolStringList getInaccessibleList() { + return inaccessible_; + } + /** + * + * + *
+   * A list of resources that the caller does not have permission to retrieve.
+   * List or Get can be used to get detailed error messages.
+   * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+   * List: `policies/{attachment-point}/denypolicies`
+   * 
+ * + * repeated string inaccessible = 2; + * + * @return The count of inaccessible. + */ + public int getInaccessibleCount() { + return inaccessible_.size(); + } + /** + * + * + *
+   * A list of resources that the caller does not have permission to retrieve.
+   * List or Get can be used to get detailed error messages.
+   * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+   * List: `policies/{attachment-point}/denypolicies`
+   * 
+ * + * repeated string inaccessible = 2; + * + * @param index The index of the element to return. + * @return The inaccessible at the given index. + */ + public java.lang.String getInaccessible(int index) { + return inaccessible_.get(index); + } + /** + * + * + *
+   * A list of resources that the caller does not have permission to retrieve.
+   * List or Get can be used to get detailed error messages.
+   * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+   * List: `policies/{attachment-point}/denypolicies`
+   * 
+ * + * repeated string inaccessible = 2; + * + * @param index The index of the value to return. + * @return The bytes of the inaccessible at the given index. + */ + public com.google.protobuf.ByteString getInaccessibleBytes(int index) { + return inaccessible_.getByteString(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A page token that can be used in a
+   * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+   * to retrieve the next page. If this field is blank, there are no additional
+   * pages.
+   * 
+ * + * string next_page_token = 3; + * + * @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; + } + } + /** + * + * + *
+   * A page token that can be used in a
+   * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+   * to retrieve the next page. If this field is blank, there are no additional
+   * pages.
+   * 
+ * + * string next_page_token = 3; + * + * @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 < policies_.size(); i++) { + output.writeMessage(1, policies_.get(i)); + } + for (int i = 0; i < inaccessible_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, inaccessible_.getRaw(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < policies_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, policies_.get(i)); + } + { + int dataSize = 0; + for (int i = 0; i < inaccessible_.size(); i++) { + dataSize += computeStringSizeNoTag(inaccessible_.getRaw(i)); + } + size += dataSize; + size += 1 * getInaccessibleList().size(); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, nextPageToken_); + } + size += unknownFields.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.iam.v2.ListApplicablePoliciesResponse)) { + return super.equals(obj); + } + com.google.iam.v2.ListApplicablePoliciesResponse other = + (com.google.iam.v2.ListApplicablePoliciesResponse) obj; + + if (!getPoliciesList().equals(other.getPoliciesList())) return false; + if (!getInaccessibleList().equals(other.getInaccessibleList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getPoliciesCount() > 0) { + hash = (37 * hash) + POLICIES_FIELD_NUMBER; + hash = (53 * hash) + getPoliciesList().hashCode(); + } + if (getInaccessibleCount() > 0) { + hash = (37 * hash) + INACCESSIBLE_FIELD_NUMBER; + hash = (53 * hash) + getInaccessibleList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse 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.iam.v2.ListApplicablePoliciesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse 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.iam.v2.ListApplicablePoliciesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse 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.iam.v2.ListApplicablePoliciesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse 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.iam.v2.ListApplicablePoliciesResponse 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 [ListApplicablePolicies][] method.
+   * 
+ * + * Protobuf type {@code google.iam.v2.ListApplicablePoliciesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.ListApplicablePoliciesResponse) + com.google.iam.v2.ListApplicablePoliciesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.ListApplicablePoliciesResponse.class, + com.google.iam.v2.ListApplicablePoliciesResponse.Builder.class); + } + + // Construct using com.google.iam.v2.ListApplicablePoliciesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getPoliciesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (policiesBuilder_ == null) { + policies_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + policiesBuilder_.clear(); + } + inaccessible_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListApplicablePoliciesResponse_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.ListApplicablePoliciesResponse getDefaultInstanceForType() { + return com.google.iam.v2.ListApplicablePoliciesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.ListApplicablePoliciesResponse build() { + com.google.iam.v2.ListApplicablePoliciesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.ListApplicablePoliciesResponse buildPartial() { + com.google.iam.v2.ListApplicablePoliciesResponse result = + new com.google.iam.v2.ListApplicablePoliciesResponse(this); + int from_bitField0_ = bitField0_; + if (policiesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + policies_ = java.util.Collections.unmodifiableList(policies_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.policies_ = policies_; + } else { + result.policies_ = policiesBuilder_.build(); + } + if (((bitField0_ & 0x00000002) != 0)) { + inaccessible_ = inaccessible_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.inaccessible_ = inaccessible_; + 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.iam.v2.ListApplicablePoliciesResponse) { + return mergeFrom((com.google.iam.v2.ListApplicablePoliciesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.ListApplicablePoliciesResponse other) { + if (other == com.google.iam.v2.ListApplicablePoliciesResponse.getDefaultInstance()) + return this; + if (policiesBuilder_ == null) { + if (!other.policies_.isEmpty()) { + if (policies_.isEmpty()) { + policies_ = other.policies_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePoliciesIsMutable(); + policies_.addAll(other.policies_); + } + onChanged(); + } + } else { + if (!other.policies_.isEmpty()) { + if (policiesBuilder_.isEmpty()) { + policiesBuilder_.dispose(); + policiesBuilder_ = null; + policies_ = other.policies_; + bitField0_ = (bitField0_ & ~0x00000001); + policiesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getPoliciesFieldBuilder() + : null; + } else { + policiesBuilder_.addAllMessages(other.policies_); + } + } + } + if (!other.inaccessible_.isEmpty()) { + if (inaccessible_.isEmpty()) { + inaccessible_ = other.inaccessible_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureInaccessibleIsMutable(); + inaccessible_.addAll(other.inaccessible_); + } + onChanged(); + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.ListApplicablePoliciesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.ListApplicablePoliciesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List policies_ = java.util.Collections.emptyList(); + + private void ensurePoliciesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + policies_ = new java.util.ArrayList(policies_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder> + policiesBuilder_; + + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public java.util.List getPoliciesList() { + if (policiesBuilder_ == null) { + return java.util.Collections.unmodifiableList(policies_); + } else { + return policiesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public int getPoliciesCount() { + if (policiesBuilder_ == null) { + return policies_.size(); + } else { + return policiesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.Policy getPolicies(int index) { + if (policiesBuilder_ == null) { + return policies_.get(index); + } else { + return policiesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder setPolicies(int index, com.google.iam.v2.Policy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.set(index, value); + onChanged(); + } else { + policiesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder setPolicies(int index, com.google.iam.v2.Policy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.set(index, builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addPolicies(com.google.iam.v2.Policy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.add(value); + onChanged(); + } else { + policiesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addPolicies(int index, com.google.iam.v2.Policy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.add(index, value); + onChanged(); + } else { + policiesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addPolicies(com.google.iam.v2.Policy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.add(builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addPolicies(int index, com.google.iam.v2.Policy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.add(index, builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addAllPolicies(java.lang.Iterable values) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, policies_); + onChanged(); + } else { + policiesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder clearPolicies() { + if (policiesBuilder_ == null) { + policies_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + policiesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder removePolicies(int index) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.remove(index); + onChanged(); + } else { + policiesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.Policy.Builder getPoliciesBuilder(int index) { + return getPoliciesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.PolicyOrBuilder getPoliciesOrBuilder(int index) { + if (policiesBuilder_ == null) { + return policies_.get(index); + } else { + return policiesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public java.util.List getPoliciesOrBuilderList() { + if (policiesBuilder_ != null) { + return policiesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(policies_); + } + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.Policy.Builder addPoliciesBuilder() { + return getPoliciesFieldBuilder().addBuilder(com.google.iam.v2.Policy.getDefaultInstance()); + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.Policy.Builder addPoliciesBuilder(int index) { + return getPoliciesFieldBuilder() + .addBuilder(index, com.google.iam.v2.Policy.getDefaultInstance()); + } + /** + * + * + *
+     * Ordered list starting from the resource on which this API was called
+     * then proceeding up the hierarchy. Policies for the same attachment point
+     * will be grouped, but no further ordering is guaranteed.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public java.util.List getPoliciesBuilderList() { + return getPoliciesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder> + getPoliciesFieldBuilder() { + if (policiesBuilder_ == null) { + policiesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder>( + policies_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + policies_ = null; + } + return policiesBuilder_; + } + + private com.google.protobuf.LazyStringList inaccessible_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureInaccessibleIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + inaccessible_ = new com.google.protobuf.LazyStringArrayList(inaccessible_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @return A list containing the inaccessible. + */ + public com.google.protobuf.ProtocolStringList getInaccessibleList() { + return inaccessible_.getUnmodifiableView(); + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @return The count of inaccessible. + */ + public int getInaccessibleCount() { + return inaccessible_.size(); + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @param index The index of the element to return. + * @return The inaccessible at the given index. + */ + public java.lang.String getInaccessible(int index) { + return inaccessible_.get(index); + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @param index The index of the value to return. + * @return The bytes of the inaccessible at the given index. + */ + public com.google.protobuf.ByteString getInaccessibleBytes(int index) { + return inaccessible_.getByteString(index); + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @param index The index to set the value at. + * @param value The inaccessible to set. + * @return This builder for chaining. + */ + public Builder setInaccessible(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureInaccessibleIsMutable(); + inaccessible_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @param value The inaccessible to add. + * @return This builder for chaining. + */ + public Builder addInaccessible(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureInaccessibleIsMutable(); + inaccessible_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @param values The inaccessible to add. + * @return This builder for chaining. + */ + public Builder addAllInaccessible(java.lang.Iterable values) { + ensureInaccessibleIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, inaccessible_); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @return This builder for chaining. + */ + public Builder clearInaccessible() { + inaccessible_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of resources that the caller does not have permission to retrieve.
+     * List or Get can be used to get detailed error messages.
+     * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+     * List: `policies/{attachment-point}/denypolicies`
+     * 
+ * + * repeated string inaccessible = 2; + * + * @param value The bytes of the inaccessible to add. + * @return This builder for chaining. + */ + public Builder addInaccessibleBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureInaccessibleIsMutable(); + inaccessible_.add(value); + onChanged(); + return this; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A page token that can be used in a
+     * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+     * to retrieve the next page. If this field is blank, there are no additional
+     * pages.
+     * 
+ * + * string next_page_token = 3; + * + * @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; + } + } + /** + * + * + *
+     * A page token that can be used in a
+     * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+     * to retrieve the next page. If this field is blank, there are no additional
+     * pages.
+     * 
+ * + * string next_page_token = 3; + * + * @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; + } + } + /** + * + * + *
+     * A page token that can be used in a
+     * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+     * to retrieve the next page. If this field is blank, there are no additional
+     * pages.
+     * 
+ * + * string next_page_token = 3; + * + * @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; + } + /** + * + * + *
+     * A page token that can be used in a
+     * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+     * to retrieve the next page. If this field is blank, there are no additional
+     * pages.
+     * 
+ * + * string next_page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token that can be used in a
+     * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+     * to retrieve the next page. If this field is blank, there are no additional
+     * pages.
+     * 
+ * + * string next_page_token = 3; + * + * @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.iam.v2.ListApplicablePoliciesResponse) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.ListApplicablePoliciesResponse) + private static final com.google.iam.v2.ListApplicablePoliciesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.ListApplicablePoliciesResponse(); + } + + public static com.google.iam.v2.ListApplicablePoliciesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListApplicablePoliciesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListApplicablePoliciesResponse(input, extensionRegistry); + } + }; + + 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.iam.v2.ListApplicablePoliciesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesResponseOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesResponseOrBuilder.java new file mode 100644 index 00000000..f83bbeda --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListApplicablePoliciesResponseOrBuilder.java @@ -0,0 +1,180 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface ListApplicablePoliciesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.ListApplicablePoliciesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + java.util.List getPoliciesList(); + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + com.google.iam.v2.Policy getPolicies(int index); + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + int getPoliciesCount(); + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + java.util.List getPoliciesOrBuilderList(); + /** + * + * + *
+   * Ordered list starting from the resource on which this API was called
+   * then proceeding up the hierarchy. Policies for the same attachment point
+   * will be grouped, but no further ordering is guaranteed.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + com.google.iam.v2.PolicyOrBuilder getPoliciesOrBuilder(int index); + + /** + * + * + *
+   * A list of resources that the caller does not have permission to retrieve.
+   * List or Get can be used to get detailed error messages.
+   * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+   * List: `policies/{attachment-point}/denypolicies`
+   * 
+ * + * repeated string inaccessible = 2; + * + * @return A list containing the inaccessible. + */ + java.util.List getInaccessibleList(); + /** + * + * + *
+   * A list of resources that the caller does not have permission to retrieve.
+   * List or Get can be used to get detailed error messages.
+   * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+   * List: `policies/{attachment-point}/denypolicies`
+   * 
+ * + * repeated string inaccessible = 2; + * + * @return The count of inaccessible. + */ + int getInaccessibleCount(); + /** + * + * + *
+   * A list of resources that the caller does not have permission to retrieve.
+   * List or Get can be used to get detailed error messages.
+   * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+   * List: `policies/{attachment-point}/denypolicies`
+   * 
+ * + * repeated string inaccessible = 2; + * + * @param index The index of the element to return. + * @return The inaccessible at the given index. + */ + java.lang.String getInaccessible(int index); + /** + * + * + *
+   * A list of resources that the caller does not have permission to retrieve.
+   * List or Get can be used to get detailed error messages.
+   * Get: `policies/{attachment-point}/denypolicies/{policy-id}`
+   * List: `policies/{attachment-point}/denypolicies`
+   * 
+ * + * repeated string inaccessible = 2; + * + * @param index The index of the value to return. + * @return The bytes of the inaccessible at the given index. + */ + com.google.protobuf.ByteString getInaccessibleBytes(int index); + + /** + * + * + *
+   * A page token that can be used in a
+   * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+   * to retrieve the next page. If this field is blank, there are no additional
+   * pages.
+   * 
+ * + * string next_page_token = 3; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A page token that can be used in a
+   * [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest]
+   * to retrieve the next page. If this field is blank, there are no additional
+   * pages.
+   * 
+ * + * string next_page_token = 3; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesRequest.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesRequest.java new file mode 100644 index 00000000..5665c5b7 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesRequest.java @@ -0,0 +1,970 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Request message for `ListPolicies`.
+ * 
+ * + * Protobuf type {@code google.iam.v2.ListPoliciesRequest} + */ +public final class ListPoliciesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.ListPoliciesRequest) + ListPoliciesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListPoliciesRequest.newBuilder() to construct. + private ListPoliciesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListPoliciesRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListPoliciesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListPoliciesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.ListPoliciesRequest.class, + com.google.iam.v2.ListPoliciesRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The resource that the policy is attached to, along with the kind
+   * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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. The resource that the policy is attached to, along with the kind
+   * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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 policies to return. IAM ignores this value and uses
+   * the value 1000.
+   * 
+ * + * 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_; + /** + * + * + *
+   * A page token received in a
+   * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+   * token to retrieve the next page.
+   * 
+ * + * 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; + } + } + /** + * + * + *
+   * A page token received in a
+   * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+   * token to retrieve the next page.
+   * 
+ * + * 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; + } + } + + 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_); + } + unknownFields.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_); + } + size += unknownFields.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.iam.v2.ListPoliciesRequest)) { + return super.equals(obj); + } + com.google.iam.v2.ListPoliciesRequest other = (com.google.iam.v2.ListPoliciesRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) 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 = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.ListPoliciesRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListPoliciesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.ListPoliciesRequest parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListPoliciesRequest 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.iam.v2.ListPoliciesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListPoliciesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.ListPoliciesRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListPoliciesRequest 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.iam.v2.ListPoliciesRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListPoliciesRequest 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.iam.v2.ListPoliciesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListPoliciesRequest 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.iam.v2.ListPoliciesRequest 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 `ListPolicies`.
+   * 
+ * + * Protobuf type {@code google.iam.v2.ListPoliciesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.ListPoliciesRequest) + com.google.iam.v2.ListPoliciesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.ListPoliciesRequest.class, + com.google.iam.v2.ListPoliciesRequest.Builder.class); + } + + // Construct using com.google.iam.v2.ListPoliciesRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.ListPoliciesRequest getDefaultInstanceForType() { + return com.google.iam.v2.ListPoliciesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.ListPoliciesRequest build() { + com.google.iam.v2.ListPoliciesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.ListPoliciesRequest buildPartial() { + com.google.iam.v2.ListPoliciesRequest result = + new com.google.iam.v2.ListPoliciesRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + 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.iam.v2.ListPoliciesRequest) { + return mergeFrom((com.google.iam.v2.ListPoliciesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.ListPoliciesRequest other) { + if (other == com.google.iam.v2.ListPoliciesRequest.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(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.ListPoliciesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.ListPoliciesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The resource that the policy is attached to, along with the kind
+     * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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. The resource that the policy is attached to, along with the kind
+     * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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. The resource that the policy is attached to, along with the kind
+     * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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. The resource that the policy is attached to, along with the kind
+     * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource that the policy is attached to, along with the kind
+     * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, you can use the alphanumeric or the numeric ID.
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @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 policies to return. IAM ignores this value and uses
+     * the value 1000.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * The maximum number of policies to return. IAM ignores this value and uses
+     * the value 1000.
+     * 
+ * + * 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 policies to return. IAM ignores this value and uses
+     * the value 1000.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token received in a
+     * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+     * token to retrieve the next page.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * A page token received in a
+     * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+     * token to retrieve the next page.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * A page token received in a
+     * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+     * token to retrieve the next page.
+     * 
+ * + * 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; + } + /** + * + * + *
+     * A page token received in a
+     * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+     * token to retrieve the next page.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token received in a
+     * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+     * token to retrieve the next page.
+     * 
+ * + * 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; + } + + @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.iam.v2.ListPoliciesRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.ListPoliciesRequest) + private static final com.google.iam.v2.ListPoliciesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.ListPoliciesRequest(); + } + + public static com.google.iam.v2.ListPoliciesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListPoliciesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListPoliciesRequest(input, extensionRegistry); + } + }; + + 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.iam.v2.ListPoliciesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesRequestOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesRequestOrBuilder.java new file mode 100644 index 00000000..5ccf0c27 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesRequestOrBuilder.java @@ -0,0 +1,107 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface ListPoliciesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.ListPoliciesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource that the policy is attached to, along with the kind
+   * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The resource that the policy is attached to, along with the kind
+   * of policy to list. Format: `policies/{attachment_point}/denypolicies`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, you can use the alphanumeric or the numeric ID.
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The maximum number of policies to return. IAM ignores this value and uses
+   * the value 1000.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token received in a
+   * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+   * token to retrieve the next page.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token received in a
+   * [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this
+   * token to retrieve the next page.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesResponse.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesResponse.java new file mode 100644 index 00000000..fa2820bd --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesResponse.java @@ -0,0 +1,1132 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Response message for `ListPolicies`.
+ * 
+ * + * Protobuf type {@code google.iam.v2.ListPoliciesResponse} + */ +public final class ListPoliciesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.ListPoliciesResponse) + ListPoliciesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListPoliciesResponse.newBuilder() to construct. + private ListPoliciesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListPoliciesResponse() { + policies_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListPoliciesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListPoliciesResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + policies_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + policies_.add( + input.readMessage(com.google.iam.v2.Policy.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + policies_ = java.util.Collections.unmodifiableList(policies_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.ListPoliciesResponse.class, + com.google.iam.v2.ListPoliciesResponse.Builder.class); + } + + public static final int POLICIES_FIELD_NUMBER = 1; + private java.util.List policies_; + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public java.util.List getPoliciesList() { + return policies_; + } + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public java.util.List getPoliciesOrBuilderList() { + return policies_; + } + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public int getPoliciesCount() { + return policies_.size(); + } + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public com.google.iam.v2.Policy getPolicies(int index) { + return policies_.get(index); + } + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + @java.lang.Override + public com.google.iam.v2.PolicyOrBuilder getPoliciesOrBuilder(int index) { + return policies_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A page token that you can use in a
+   * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+   * next page. If this field is omitted, there are no additional pages.
+   * 
+ * + * 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; + } + } + /** + * + * + *
+   * A page token that you can use in a
+   * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+   * next page. If this field is omitted, there are no additional pages.
+   * 
+ * + * 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 < policies_.size(); i++) { + output.writeMessage(1, policies_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < policies_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, policies_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.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.iam.v2.ListPoliciesResponse)) { + return super.equals(obj); + } + com.google.iam.v2.ListPoliciesResponse other = (com.google.iam.v2.ListPoliciesResponse) obj; + + if (!getPoliciesList().equals(other.getPoliciesList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getPoliciesCount() > 0) { + hash = (37 * hash) + POLICIES_FIELD_NUMBER; + hash = (53 * hash) + getPoliciesList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.ListPoliciesResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListPoliciesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.ListPoliciesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListPoliciesResponse 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.iam.v2.ListPoliciesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.ListPoliciesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.ListPoliciesResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListPoliciesResponse 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.iam.v2.ListPoliciesResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListPoliciesResponse 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.iam.v2.ListPoliciesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.ListPoliciesResponse 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.iam.v2.ListPoliciesResponse 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 `ListPolicies`.
+   * 
+ * + * Protobuf type {@code google.iam.v2.ListPoliciesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.ListPoliciesResponse) + com.google.iam.v2.ListPoliciesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.ListPoliciesResponse.class, + com.google.iam.v2.ListPoliciesResponse.Builder.class); + } + + // Construct using com.google.iam.v2.ListPoliciesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getPoliciesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (policiesBuilder_ == null) { + policies_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + policiesBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_ListPoliciesResponse_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.ListPoliciesResponse getDefaultInstanceForType() { + return com.google.iam.v2.ListPoliciesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.ListPoliciesResponse build() { + com.google.iam.v2.ListPoliciesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.ListPoliciesResponse buildPartial() { + com.google.iam.v2.ListPoliciesResponse result = + new com.google.iam.v2.ListPoliciesResponse(this); + int from_bitField0_ = bitField0_; + if (policiesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + policies_ = java.util.Collections.unmodifiableList(policies_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.policies_ = policies_; + } else { + result.policies_ = policiesBuilder_.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.iam.v2.ListPoliciesResponse) { + return mergeFrom((com.google.iam.v2.ListPoliciesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.ListPoliciesResponse other) { + if (other == com.google.iam.v2.ListPoliciesResponse.getDefaultInstance()) return this; + if (policiesBuilder_ == null) { + if (!other.policies_.isEmpty()) { + if (policies_.isEmpty()) { + policies_ = other.policies_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePoliciesIsMutable(); + policies_.addAll(other.policies_); + } + onChanged(); + } + } else { + if (!other.policies_.isEmpty()) { + if (policiesBuilder_.isEmpty()) { + policiesBuilder_.dispose(); + policiesBuilder_ = null; + policies_ = other.policies_; + bitField0_ = (bitField0_ & ~0x00000001); + policiesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getPoliciesFieldBuilder() + : null; + } else { + policiesBuilder_.addAllMessages(other.policies_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.ListPoliciesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.ListPoliciesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List policies_ = java.util.Collections.emptyList(); + + private void ensurePoliciesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + policies_ = new java.util.ArrayList(policies_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder> + policiesBuilder_; + + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public java.util.List getPoliciesList() { + if (policiesBuilder_ == null) { + return java.util.Collections.unmodifiableList(policies_); + } else { + return policiesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public int getPoliciesCount() { + if (policiesBuilder_ == null) { + return policies_.size(); + } else { + return policiesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.Policy getPolicies(int index) { + if (policiesBuilder_ == null) { + return policies_.get(index); + } else { + return policiesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder setPolicies(int index, com.google.iam.v2.Policy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.set(index, value); + onChanged(); + } else { + policiesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder setPolicies(int index, com.google.iam.v2.Policy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.set(index, builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addPolicies(com.google.iam.v2.Policy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.add(value); + onChanged(); + } else { + policiesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addPolicies(int index, com.google.iam.v2.Policy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.add(index, value); + onChanged(); + } else { + policiesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addPolicies(com.google.iam.v2.Policy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.add(builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addPolicies(int index, com.google.iam.v2.Policy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.add(index, builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder addAllPolicies(java.lang.Iterable values) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, policies_); + onChanged(); + } else { + policiesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder clearPolicies() { + if (policiesBuilder_ == null) { + policies_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + policiesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public Builder removePolicies(int index) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.remove(index); + onChanged(); + } else { + policiesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.Policy.Builder getPoliciesBuilder(int index) { + return getPoliciesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.PolicyOrBuilder getPoliciesOrBuilder(int index) { + if (policiesBuilder_ == null) { + return policies_.get(index); + } else { + return policiesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public java.util.List getPoliciesOrBuilderList() { + if (policiesBuilder_ != null) { + return policiesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(policies_); + } + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.Policy.Builder addPoliciesBuilder() { + return getPoliciesFieldBuilder().addBuilder(com.google.iam.v2.Policy.getDefaultInstance()); + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public com.google.iam.v2.Policy.Builder addPoliciesBuilder(int index) { + return getPoliciesFieldBuilder() + .addBuilder(index, com.google.iam.v2.Policy.getDefaultInstance()); + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + public java.util.List getPoliciesBuilderList() { + return getPoliciesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder> + getPoliciesFieldBuilder() { + if (policiesBuilder_ == null) { + policiesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder>( + policies_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + policies_ = null; + } + return policiesBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A page token that you can use in a
+     * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+     * next page. If this field is omitted, there are no additional pages.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * A page token that you can use in a
+     * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+     * next page. If this field is omitted, there are no additional pages.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * A page token that you can use in a
+     * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+     * next page. If this field is omitted, there are no additional pages.
+     * 
+ * + * 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; + } + /** + * + * + *
+     * A page token that you can use in a
+     * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+     * next page. If this field is omitted, there are no additional pages.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token that you can use in a
+     * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+     * next page. If this field is omitted, there are no additional pages.
+     * 
+ * + * 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.iam.v2.ListPoliciesResponse) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.ListPoliciesResponse) + private static final com.google.iam.v2.ListPoliciesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.ListPoliciesResponse(); + } + + public static com.google.iam.v2.ListPoliciesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListPoliciesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListPoliciesResponse(input, extensionRegistry); + } + }; + + 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.iam.v2.ListPoliciesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesResponseOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesResponseOrBuilder.java new file mode 100644 index 00000000..54a77f75 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/ListPoliciesResponseOrBuilder.java @@ -0,0 +1,105 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface ListPoliciesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.ListPoliciesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + java.util.List getPoliciesList(); + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + com.google.iam.v2.Policy getPolicies(int index); + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + int getPoliciesCount(); + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + java.util.List getPoliciesOrBuilderList(); + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2.Policy policies = 1; + */ + com.google.iam.v2.PolicyOrBuilder getPoliciesOrBuilder(int index); + + /** + * + * + *
+   * A page token that you can use in a
+   * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+   * next page. If this field is omitted, there are no additional pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A page token that you can use in a
+   * [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
+   * next page. If this field is omitted, there are no additional pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/Policy.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/Policy.java new file mode 100644 index 00000000..2de2078e --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/Policy.java @@ -0,0 +1,3369 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Data for an IAM policy.
+ * 
+ * + * Protobuf type {@code google.iam.v2.Policy} + */ +public final class Policy extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.Policy) + PolicyOrBuilder { + private static final long serialVersionUID = 0L; + // Use Policy.newBuilder() to construct. + private Policy(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Policy() { + name_ = ""; + uid_ = ""; + kind_ = ""; + displayName_ = ""; + etag_ = ""; + rules_ = java.util.Collections.emptyList(); + managingAuthority_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Policy(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Policy( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + uid_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + kind_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 42: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + annotations_ = + com.google.protobuf.MapField.newMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + annotations_.getMutableMap().put(annotations__.getKey(), annotations__.getValue()); + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + case 58: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 66: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 74: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (deleteTime_ != null) { + subBuilder = deleteTime_.toBuilder(); + } + deleteTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(deleteTime_); + deleteTime_ = subBuilder.buildPartial(); + } + + break; + } + case 82: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + rules_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + rules_.add( + input.readMessage(com.google.iam.v2.PolicyRule.parser(), extensionRegistry)); + break; + } + case 90: + { + java.lang.String s = input.readStringRequireUtf8(); + + managingAuthority_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) != 0)) { + rules_ = java.util.Collections.unmodifiableList(rules_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_Policy_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 5: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_Policy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.Policy.class, com.google.iam.v2.Policy.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Immutable. The resource name of the `Policy`, which must be unique. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, requests can use the alphanumeric or the numeric ID.
+   * Responses always contain the numeric ID.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @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; + } + } + /** + * + * + *
+   * Immutable. The resource name of the `Policy`, which must be unique. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, requests can use the alphanumeric or the numeric ID.
+   * Responses always contain the numeric ID.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @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 UID_FIELD_NUMBER = 2; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+   * when the `Policy` is created.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + 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(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+   * when the `Policy` is created.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KIND_FIELD_NUMBER = 3; + private volatile java.lang.Object kind_; + /** + * + * + *
+   * Output only. The kind of the `Policy`. Always contains the value
+   * `DenyPolicy`.
+   * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The kind. + */ + @java.lang.Override + public java.lang.String getKind() { + java.lang.Object ref = kind_; + 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(); + kind_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The kind of the `Policy`. Always contains the value
+   * `DenyPolicy`.
+   * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for kind. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKindBytes() { + java.lang.Object ref = kind_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kind_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 4; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * A user-specified description of the `Policy`. This value can be up to 63
+   * characters.
+   * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + 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(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * A user-specified description of the `Policy`. This value can be up to 63
+   * characters.
+   * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 5; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_Policy_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ETAG_FIELD_NUMBER = 6; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * An opaque tag that identifies the current version of the `Policy`. IAM uses
+   * this value to help manage concurrent updates, so they do not cause one
+   * update to be overwritten by another.
+   * If this field is present in a [CreatePolicy][] request, the value is
+   * ignored.
+   * 
+ * + * string etag = 6; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + 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(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * An opaque tag that identifies the current version of the `Policy`. IAM uses
+   * this value to help manage concurrent updates, so they do not cause one
+   * update to be overwritten by another.
+   * If this field is present in a [CreatePolicy][] request, the value is
+   * ignored.
+   * 
+ * + * string etag = 6; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. The time when the `Policy` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. The time when the `Policy` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. The time when the `Policy` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The time when the `Policy` was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The time when the `Policy` was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The time when the `Policy` was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int DELETE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp deleteTime_; + /** + * + * + *
+   * Output only. The time when the `Policy` was deleted. Empty if the policy is
+   * not deleted.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + @java.lang.Override + public boolean hasDeleteTime() { + return deleteTime_ != null; + } + /** + * + * + *
+   * Output only. The time when the `Policy` was deleted. Empty if the policy is
+   * not deleted.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getDeleteTime() { + return deleteTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : deleteTime_; + } + /** + * + * + *
+   * Output only. The time when the `Policy` was deleted. Empty if the policy is
+   * not deleted.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + return getDeleteTime(); + } + + public static final int RULES_FIELD_NUMBER = 10; + private java.util.List rules_; + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + @java.lang.Override + public java.util.List getRulesList() { + return rules_; + } + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + @java.lang.Override + public java.util.List getRulesOrBuilderList() { + return rules_; + } + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + @java.lang.Override + public int getRulesCount() { + return rules_.size(); + } + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + @java.lang.Override + public com.google.iam.v2.PolicyRule getRules(int index) { + return rules_.get(index); + } + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + @java.lang.Override + public com.google.iam.v2.PolicyRuleOrBuilder getRulesOrBuilder(int index) { + return rules_.get(index); + } + + public static final int MANAGING_AUTHORITY_FIELD_NUMBER = 11; + private volatile java.lang.Object managingAuthority_; + /** + * + * + *
+   * Immutable. Specifies that this policy is managed by an authority and can
+   * only be modified by that authority. Usage is restricted.
+   * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The managingAuthority. + */ + @java.lang.Override + public java.lang.String getManagingAuthority() { + java.lang.Object ref = managingAuthority_; + 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(); + managingAuthority_ = s; + return s; + } + } + /** + * + * + *
+   * Immutable. Specifies that this policy is managed by an authority and can
+   * only be modified by that authority. Usage is restricted.
+   * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for managingAuthority. + */ + @java.lang.Override + public com.google.protobuf.ByteString getManagingAuthorityBytes() { + java.lang.Object ref = managingAuthority_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + managingAuthority_ = 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(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kind_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, kind_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, displayName_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 5); + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, etag_); + } + if (createTime_ != null) { + output.writeMessage(7, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(8, getUpdateTime()); + } + if (deleteTime_ != null) { + output.writeMessage(9, getDeleteTime()); + } + for (int i = 0; i < rules_.size(); i++) { + output.writeMessage(10, rules_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(managingAuthority_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, managingAuthority_); + } + unknownFields.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(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(kind_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, kind_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, displayName_); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, annotations__); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, etag_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getUpdateTime()); + } + if (deleteTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getDeleteTime()); + } + for (int i = 0; i < rules_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, rules_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(managingAuthority_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, managingAuthority_); + } + size += unknownFields.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.iam.v2.Policy)) { + return super.equals(obj); + } + com.google.iam.v2.Policy other = (com.google.iam.v2.Policy) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (!getKind().equals(other.getKind())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasDeleteTime() != other.hasDeleteTime()) return false; + if (hasDeleteTime()) { + if (!getDeleteTime().equals(other.getDeleteTime())) return false; + } + if (!getRulesList().equals(other.getRulesList())) return false; + if (!getManagingAuthority().equals(other.getManagingAuthority())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + hash = (37 * hash) + KIND_FIELD_NUMBER; + hash = (53 * hash) + getKind().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasDeleteTime()) { + hash = (37 * hash) + DELETE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDeleteTime().hashCode(); + } + if (getRulesCount() > 0) { + hash = (37 * hash) + RULES_FIELD_NUMBER; + hash = (53 * hash) + getRulesList().hashCode(); + } + hash = (37 * hash) + MANAGING_AUTHORITY_FIELD_NUMBER; + hash = (53 * hash) + getManagingAuthority().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.Policy parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.Policy parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.Policy parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.Policy 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.iam.v2.Policy parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.Policy parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.Policy parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.Policy 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.iam.v2.Policy parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.Policy 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.iam.v2.Policy parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.Policy 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.iam.v2.Policy 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; + } + /** + * + * + *
+   * Data for an IAM policy.
+   * 
+ * + * Protobuf type {@code google.iam.v2.Policy} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.Policy) + com.google.iam.v2.PolicyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_Policy_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 5: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 5: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_Policy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.Policy.class, com.google.iam.v2.Policy.Builder.class); + } + + // Construct using com.google.iam.v2.Policy.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getRulesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + kind_ = ""; + + displayName_ = ""; + + internalGetMutableAnnotations().clear(); + etag_ = ""; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + if (rulesBuilder_ == null) { + rules_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + rulesBuilder_.clear(); + } + managingAuthority_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_Policy_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.Policy getDefaultInstanceForType() { + return com.google.iam.v2.Policy.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.Policy build() { + com.google.iam.v2.Policy result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.Policy buildPartial() { + com.google.iam.v2.Policy result = new com.google.iam.v2.Policy(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + result.kind_ = kind_; + result.displayName_ = displayName_; + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + result.etag_ = etag_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (deleteTimeBuilder_ == null) { + result.deleteTime_ = deleteTime_; + } else { + result.deleteTime_ = deleteTimeBuilder_.build(); + } + if (rulesBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + rules_ = java.util.Collections.unmodifiableList(rules_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.rules_ = rules_; + } else { + result.rules_ = rulesBuilder_.build(); + } + result.managingAuthority_ = managingAuthority_; + 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.iam.v2.Policy) { + return mergeFrom((com.google.iam.v2.Policy) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.Policy other) { + if (other == com.google.iam.v2.Policy.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (!other.getKind().isEmpty()) { + kind_ = other.kind_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasDeleteTime()) { + mergeDeleteTime(other.getDeleteTime()); + } + if (rulesBuilder_ == null) { + if (!other.rules_.isEmpty()) { + if (rules_.isEmpty()) { + rules_ = other.rules_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureRulesIsMutable(); + rules_.addAll(other.rules_); + } + onChanged(); + } + } else { + if (!other.rules_.isEmpty()) { + if (rulesBuilder_.isEmpty()) { + rulesBuilder_.dispose(); + rulesBuilder_ = null; + rules_ = other.rules_; + bitField0_ = (bitField0_ & ~0x00000002); + rulesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getRulesFieldBuilder() + : null; + } else { + rulesBuilder_.addAllMessages(other.rules_); + } + } + } + if (!other.getManagingAuthority().isEmpty()) { + managingAuthority_ = other.managingAuthority_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.Policy parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.Policy) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Immutable. The resource name of the `Policy`, which must be unique. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, requests can use the alphanumeric or the numeric ID.
+     * Responses always contain the numeric ID.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @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; + } + } + /** + * + * + *
+     * Immutable. The resource name of the `Policy`, which must be unique. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, requests can use the alphanumeric or the numeric ID.
+     * Responses always contain the numeric ID.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @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; + } + } + /** + * + * + *
+     * Immutable. The resource name of the `Policy`, which must be unique. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, requests can use the alphanumeric or the numeric ID.
+     * Responses always contain the numeric ID.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @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; + } + /** + * + * + *
+     * Immutable. The resource name of the `Policy`, which must be unique. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, requests can use the alphanumeric or the numeric ID.
+     * Responses always contain the numeric ID.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The resource name of the `Policy`, which must be unique. Format:
+     * `policies/{attachment_point}/denypolicies/{policy_id}`
+     * The attachment point is identified by its URL-encoded full resource name,
+     * which means that the forward-slash character, `/`, must be written as
+     * `%2F`. For example,
+     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+     * For organizations and folders, use the numeric ID in the full resource
+     * name. For projects, requests can use the alphanumeric or the numeric ID.
+     * Responses always contain the numeric ID.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @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 uid_ = ""; + /** + * + * + *
+     * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+     * when the `Policy` is created.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+     * when the `Policy` is created.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+     * when the `Policy` is created.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+     * when the `Policy` is created.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+     * when the `Policy` is created.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private java.lang.Object kind_ = ""; + /** + * + * + *
+     * Output only. The kind of the `Policy`. Always contains the value
+     * `DenyPolicy`.
+     * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The kind. + */ + public java.lang.String getKind() { + java.lang.Object ref = kind_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kind_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The kind of the `Policy`. Always contains the value
+     * `DenyPolicy`.
+     * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for kind. + */ + public com.google.protobuf.ByteString getKindBytes() { + java.lang.Object ref = kind_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kind_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The kind of the `Policy`. Always contains the value
+     * `DenyPolicy`.
+     * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The kind to set. + * @return This builder for chaining. + */ + public Builder setKind(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + kind_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The kind of the `Policy`. Always contains the value
+     * `DenyPolicy`.
+     * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearKind() { + + kind_ = getDefaultInstance().getKind(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The kind of the `Policy`. Always contains the value
+     * `DenyPolicy`.
+     * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for kind to set. + * @return This builder for chaining. + */ + public Builder setKindBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + kind_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * A user-specified description of the `Policy`. This value can be up to 63
+     * characters.
+     * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A user-specified description of the `Policy`. This value can be up to 63
+     * characters.
+     * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A user-specified description of the `Policy`. This value can be up to 63
+     * characters.
+     * 
+ * + * string display_name = 4; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A user-specified description of the `Policy`. This value can be up to 63
+     * characters.
+     * 
+ * + * string display_name = 4; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * A user-specified description of the `Policy`. This value can be up to 63
+     * characters.
+     * 
+ * + * string display_name = 4; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * A key-value map to store arbitrary metadata for the `Policy`. Keys
+     * can be up to 63 characters. Values can be up to 255 characters.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * A key-value map to store arbitrary metadata for the `Policy`. Keys
+     * can be up to 63 characters. Values can be up to 255 characters.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * A key-value map to store arbitrary metadata for the `Policy`. Keys
+     * can be up to 63 characters. Values can be up to 255 characters.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * A key-value map to store arbitrary metadata for the `Policy`. Keys
+     * can be up to 63 characters. Values can be up to 255 characters.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * A key-value map to store arbitrary metadata for the `Policy`. Keys
+     * can be up to 63 characters. Values can be up to 255 characters.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * A key-value map to store arbitrary metadata for the `Policy`. Keys
+     * can be up to 63 characters. Values can be up to 255 characters.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * A key-value map to store arbitrary metadata for the `Policy`. Keys
+     * can be up to 63 characters. Values can be up to 255 characters.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * An opaque tag that identifies the current version of the `Policy`. IAM uses
+     * this value to help manage concurrent updates, so they do not cause one
+     * update to be overwritten by another.
+     * If this field is present in a [CreatePolicy][] request, the value is
+     * ignored.
+     * 
+ * + * string etag = 6; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * An opaque tag that identifies the current version of the `Policy`. IAM uses
+     * this value to help manage concurrent updates, so they do not cause one
+     * update to be overwritten by another.
+     * If this field is present in a [CreatePolicy][] request, the value is
+     * ignored.
+     * 
+ * + * string etag = 6; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * An opaque tag that identifies the current version of the `Policy`. IAM uses
+     * this value to help manage concurrent updates, so they do not cause one
+     * update to be overwritten by another.
+     * If this field is present in a [CreatePolicy][] request, the value is
+     * ignored.
+     * 
+ * + * string etag = 6; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * An opaque tag that identifies the current version of the `Policy`. IAM uses
+     * this value to help manage concurrent updates, so they do not cause one
+     * update to be overwritten by another.
+     * If this field is present in a [CreatePolicy][] request, the value is
+     * ignored.
+     * 
+ * + * string etag = 6; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * An opaque tag that identifies the current version of the `Policy`. IAM uses
+     * this value to help manage concurrent updates, so they do not cause one
+     * update to be overwritten by another.
+     * If this field is present in a [CreatePolicy][] request, the value is
+     * ignored.
+     * 
+ * + * string etag = 6; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. The time when the `Policy` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The time when the `Policy` was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp deleteTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + deleteTimeBuilder_; + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + public boolean hasDeleteTime() { + return deleteTimeBuilder_ != null || deleteTime_ != null; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + public com.google.protobuf.Timestamp getDeleteTime() { + if (deleteTimeBuilder_ == null) { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } else { + return deleteTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deleteTime_ = value; + onChanged(); + } else { + deleteTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (deleteTimeBuilder_ == null) { + deleteTime_ = builderForValue.build(); + onChanged(); + } else { + deleteTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (deleteTime_ != null) { + deleteTime_ = + com.google.protobuf.Timestamp.newBuilder(deleteTime_).mergeFrom(value).buildPartial(); + } else { + deleteTime_ = value; + } + onChanged(); + } else { + deleteTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDeleteTime() { + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + onChanged(); + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getDeleteTimeBuilder() { + + onChanged(); + return getDeleteTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + if (deleteTimeBuilder_ != null) { + return deleteTimeBuilder_.getMessageOrBuilder(); + } else { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } + } + /** + * + * + *
+     * Output only. The time when the `Policy` was deleted. Empty if the policy is
+     * not deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getDeleteTimeFieldBuilder() { + if (deleteTimeBuilder_ == null) { + deleteTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getDeleteTime(), getParentForChildren(), isClean()); + deleteTime_ = null; + } + return deleteTimeBuilder_; + } + + private java.util.List rules_ = java.util.Collections.emptyList(); + + private void ensureRulesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + rules_ = new java.util.ArrayList(rules_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.PolicyRule, + com.google.iam.v2.PolicyRule.Builder, + com.google.iam.v2.PolicyRuleOrBuilder> + rulesBuilder_; + + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public java.util.List getRulesList() { + if (rulesBuilder_ == null) { + return java.util.Collections.unmodifiableList(rules_); + } else { + return rulesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public int getRulesCount() { + if (rulesBuilder_ == null) { + return rules_.size(); + } else { + return rulesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public com.google.iam.v2.PolicyRule getRules(int index) { + if (rulesBuilder_ == null) { + return rules_.get(index); + } else { + return rulesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder setRules(int index, com.google.iam.v2.PolicyRule value) { + if (rulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRulesIsMutable(); + rules_.set(index, value); + onChanged(); + } else { + rulesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder setRules(int index, com.google.iam.v2.PolicyRule.Builder builderForValue) { + if (rulesBuilder_ == null) { + ensureRulesIsMutable(); + rules_.set(index, builderForValue.build()); + onChanged(); + } else { + rulesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder addRules(com.google.iam.v2.PolicyRule value) { + if (rulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRulesIsMutable(); + rules_.add(value); + onChanged(); + } else { + rulesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder addRules(int index, com.google.iam.v2.PolicyRule value) { + if (rulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRulesIsMutable(); + rules_.add(index, value); + onChanged(); + } else { + rulesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder addRules(com.google.iam.v2.PolicyRule.Builder builderForValue) { + if (rulesBuilder_ == null) { + ensureRulesIsMutable(); + rules_.add(builderForValue.build()); + onChanged(); + } else { + rulesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder addRules(int index, com.google.iam.v2.PolicyRule.Builder builderForValue) { + if (rulesBuilder_ == null) { + ensureRulesIsMutable(); + rules_.add(index, builderForValue.build()); + onChanged(); + } else { + rulesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder addAllRules(java.lang.Iterable values) { + if (rulesBuilder_ == null) { + ensureRulesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, rules_); + onChanged(); + } else { + rulesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder clearRules() { + if (rulesBuilder_ == null) { + rules_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + rulesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public Builder removeRules(int index) { + if (rulesBuilder_ == null) { + ensureRulesIsMutable(); + rules_.remove(index); + onChanged(); + } else { + rulesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public com.google.iam.v2.PolicyRule.Builder getRulesBuilder(int index) { + return getRulesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public com.google.iam.v2.PolicyRuleOrBuilder getRulesOrBuilder(int index) { + if (rulesBuilder_ == null) { + return rules_.get(index); + } else { + return rulesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public java.util.List getRulesOrBuilderList() { + if (rulesBuilder_ != null) { + return rulesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(rules_); + } + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public com.google.iam.v2.PolicyRule.Builder addRulesBuilder() { + return getRulesFieldBuilder().addBuilder(com.google.iam.v2.PolicyRule.getDefaultInstance()); + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public com.google.iam.v2.PolicyRule.Builder addRulesBuilder(int index) { + return getRulesFieldBuilder() + .addBuilder(index, com.google.iam.v2.PolicyRule.getDefaultInstance()); + } + /** + * + * + *
+     * A list of rules that specify the behavior of the `Policy`. All of the rules
+     * should be of the `kind` specified in the `Policy`.
+     * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + public java.util.List getRulesBuilderList() { + return getRulesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.PolicyRule, + com.google.iam.v2.PolicyRule.Builder, + com.google.iam.v2.PolicyRuleOrBuilder> + getRulesFieldBuilder() { + if (rulesBuilder_ == null) { + rulesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2.PolicyRule, + com.google.iam.v2.PolicyRule.Builder, + com.google.iam.v2.PolicyRuleOrBuilder>( + rules_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + rules_ = null; + } + return rulesBuilder_; + } + + private java.lang.Object managingAuthority_ = ""; + /** + * + * + *
+     * Immutable. Specifies that this policy is managed by an authority and can
+     * only be modified by that authority. Usage is restricted.
+     * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The managingAuthority. + */ + public java.lang.String getManagingAuthority() { + java.lang.Object ref = managingAuthority_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + managingAuthority_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Immutable. Specifies that this policy is managed by an authority and can
+     * only be modified by that authority. Usage is restricted.
+     * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for managingAuthority. + */ + public com.google.protobuf.ByteString getManagingAuthorityBytes() { + java.lang.Object ref = managingAuthority_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + managingAuthority_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Immutable. Specifies that this policy is managed by an authority and can
+     * only be modified by that authority. Usage is restricted.
+     * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The managingAuthority to set. + * @return This builder for chaining. + */ + public Builder setManagingAuthority(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + managingAuthority_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. Specifies that this policy is managed by an authority and can
+     * only be modified by that authority. Usage is restricted.
+     * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearManagingAuthority() { + + managingAuthority_ = getDefaultInstance().getManagingAuthority(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. Specifies that this policy is managed by an authority and can
+     * only be modified by that authority. Usage is restricted.
+     * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The bytes for managingAuthority to set. + * @return This builder for chaining. + */ + public Builder setManagingAuthorityBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + managingAuthority_ = 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.iam.v2.Policy) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.Policy) + private static final com.google.iam.v2.Policy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.Policy(); + } + + public static com.google.iam.v2.Policy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Policy parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Policy(input, extensionRegistry); + } + }; + + 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.iam.v2.Policy getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOperationMetadata.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOperationMetadata.java new file mode 100644 index 00000000..3f3b95fc --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOperationMetadata.java @@ -0,0 +1,728 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Metadata for long-running `Policy` operations.
+ * 
+ * + * Protobuf type {@code google.iam.v2.PolicyOperationMetadata} + */ +public final class PolicyOperationMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.PolicyOperationMetadata) + PolicyOperationMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use PolicyOperationMetadata.newBuilder() to construct. + private PolicyOperationMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PolicyOperationMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PolicyOperationMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PolicyOperationMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_PolicyOperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_PolicyOperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.PolicyOperationMetadata.class, + com.google.iam.v2.PolicyOperationMetadata.Builder.class); + } + + public static final int CREATE_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Timestamp when the `google.longrunning.Operation` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Timestamp when the `google.longrunning.Operation` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Timestamp when the `google.longrunning.Operation` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + 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 (createTime_ != null) { + output.writeMessage(1, getCreateTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCreateTime()); + } + size += unknownFields.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.iam.v2.PolicyOperationMetadata)) { + return super.equals(obj); + } + com.google.iam.v2.PolicyOperationMetadata other = + (com.google.iam.v2.PolicyOperationMetadata) obj; + + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.PolicyOperationMetadata parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.PolicyOperationMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.PolicyOperationMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.PolicyOperationMetadata 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.iam.v2.PolicyOperationMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.PolicyOperationMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.PolicyOperationMetadata parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.PolicyOperationMetadata 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.iam.v2.PolicyOperationMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.PolicyOperationMetadata 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.iam.v2.PolicyOperationMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.PolicyOperationMetadata 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.iam.v2.PolicyOperationMetadata 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; + } + /** + * + * + *
+   * Metadata for long-running `Policy` operations.
+   * 
+ * + * Protobuf type {@code google.iam.v2.PolicyOperationMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.PolicyOperationMetadata) + com.google.iam.v2.PolicyOperationMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_PolicyOperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_PolicyOperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.PolicyOperationMetadata.class, + com.google.iam.v2.PolicyOperationMetadata.Builder.class); + } + + // Construct using com.google.iam.v2.PolicyOperationMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_PolicyOperationMetadata_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.PolicyOperationMetadata getDefaultInstanceForType() { + return com.google.iam.v2.PolicyOperationMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.PolicyOperationMetadata build() { + com.google.iam.v2.PolicyOperationMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.PolicyOperationMetadata buildPartial() { + com.google.iam.v2.PolicyOperationMetadata result = + new com.google.iam.v2.PolicyOperationMetadata(this); + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.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.iam.v2.PolicyOperationMetadata) { + return mergeFrom((com.google.iam.v2.PolicyOperationMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.PolicyOperationMetadata other) { + if (other == com.google.iam.v2.PolicyOperationMetadata.getDefaultInstance()) return this; + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.PolicyOperationMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.PolicyOperationMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Timestamp when the `google.longrunning.Operation` was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + @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.iam.v2.PolicyOperationMetadata) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.PolicyOperationMetadata) + private static final com.google.iam.v2.PolicyOperationMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.PolicyOperationMetadata(); + } + + public static com.google.iam.v2.PolicyOperationMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PolicyOperationMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PolicyOperationMetadata(input, extensionRegistry); + } + }; + + 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.iam.v2.PolicyOperationMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOperationMetadataOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOperationMetadataOrBuilder.java new file mode 100644 index 00000000..902e8200 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOperationMetadataOrBuilder.java @@ -0,0 +1,60 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface PolicyOperationMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.PolicyOperationMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Timestamp when the `google.longrunning.Operation` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Timestamp when the `google.longrunning.Operation` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Timestamp when the `google.longrunning.Operation` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOrBuilder.java new file mode 100644 index 00000000..276617f9 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyOrBuilder.java @@ -0,0 +1,444 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface PolicyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.Policy) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Immutable. The resource name of the `Policy`, which must be unique. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, requests can use the alphanumeric or the numeric ID.
+   * Responses always contain the numeric ID.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Immutable. The resource name of the `Policy`, which must be unique. Format:
+   * `policies/{attachment_point}/denypolicies/{policy_id}`
+   * The attachment point is identified by its URL-encoded full resource name,
+   * which means that the forward-slash character, `/`, must be written as
+   * `%2F`. For example,
+   * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
+   * For organizations and folders, use the numeric ID in the full resource
+   * name. For projects, requests can use the alphanumeric or the numeric ID.
+   * Responses always contain the numeric ID.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+   * when the `Policy` is created.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Immutable. The globally unique ID of the `Policy`. Assigned automatically
+   * when the `Policy` is created.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * Output only. The kind of the `Policy`. Always contains the value
+   * `DenyPolicy`.
+   * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The kind. + */ + java.lang.String getKind(); + /** + * + * + *
+   * Output only. The kind of the `Policy`. Always contains the value
+   * `DenyPolicy`.
+   * 
+ * + * string kind = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for kind. + */ + com.google.protobuf.ByteString getKindBytes(); + + /** + * + * + *
+   * A user-specified description of the `Policy`. This value can be up to 63
+   * characters.
+   * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * A user-specified description of the `Policy`. This value can be up to 63
+   * characters.
+   * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * A key-value map to store arbitrary metadata for the `Policy`. Keys
+   * can be up to 63 characters. Values can be up to 255 characters.
+   * 
+ * + * map<string, string> annotations = 5; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * An opaque tag that identifies the current version of the `Policy`. IAM uses
+   * this value to help manage concurrent updates, so they do not cause one
+   * update to be overwritten by another.
+   * If this field is present in a [CreatePolicy][] request, the value is
+   * ignored.
+   * 
+ * + * string etag = 6; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * An opaque tag that identifies the current version of the `Policy`. IAM uses
+   * this value to help manage concurrent updates, so they do not cause one
+   * update to be overwritten by another.
+   * If this field is present in a [CreatePolicy][] request, the value is
+   * ignored.
+   * 
+ * + * string etag = 6; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); + + /** + * + * + *
+   * Output only. The time when the `Policy` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. The time when the `Policy` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. The time when the `Policy` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time when the `Policy` was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The time when the `Policy` was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The time when the `Policy` was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time when the `Policy` was deleted. Empty if the policy is
+   * not deleted.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + boolean hasDeleteTime(); + /** + * + * + *
+   * Output only. The time when the `Policy` was deleted. Empty if the policy is
+   * not deleted.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + com.google.protobuf.Timestamp getDeleteTime(); + /** + * + * + *
+   * Output only. The time when the `Policy` was deleted. Empty if the policy is
+   * not deleted.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder(); + + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + java.util.List getRulesList(); + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + com.google.iam.v2.PolicyRule getRules(int index); + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + int getRulesCount(); + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + java.util.List getRulesOrBuilderList(); + /** + * + * + *
+   * A list of rules that specify the behavior of the `Policy`. All of the rules
+   * should be of the `kind` specified in the `Policy`.
+   * 
+ * + * repeated .google.iam.v2.PolicyRule rules = 10; + */ + com.google.iam.v2.PolicyRuleOrBuilder getRulesOrBuilder(int index); + + /** + * + * + *
+   * Immutable. Specifies that this policy is managed by an authority and can
+   * only be modified by that authority. Usage is restricted.
+   * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The managingAuthority. + */ + java.lang.String getManagingAuthority(); + /** + * + * + *
+   * Immutable. Specifies that this policy is managed by an authority and can
+   * only be modified by that authority. Usage is restricted.
+   * 
+ * + * string managing_authority = 11 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for managingAuthority. + */ + com.google.protobuf.ByteString getManagingAuthorityBytes(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyProto.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyProto.java new file mode 100644 index 00000000..7b921a99 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyProto.java @@ -0,0 +1,290 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public final class PolicyProto { + private PolicyProto() {} + + 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_iam_v2_Policy_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_Policy_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_Policy_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_Policy_AnnotationsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_PolicyRule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_PolicyRule_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_ListPoliciesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_ListPoliciesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_ListPoliciesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_ListPoliciesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_GetPolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_GetPolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_CreatePolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_CreatePolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_UpdatePolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_UpdatePolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_DeletePolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_DeletePolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_ListApplicablePoliciesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_ListApplicablePoliciesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_ListApplicablePoliciesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_ListApplicablePoliciesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2_PolicyOperationMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2_PolicyOperationMetadata_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\032google/iam/v2/policy.proto\022\rgoogle.iam" + + ".v2\032\034google/api/annotations.proto\032\027googl" + + "e/api/client.proto\032\037google/api/field_beh" + + "avior.proto\032\030google/iam/v2/deny.proto\032#g" + + "oogle/longrunning/operations.proto\032\037goog" + + "le/protobuf/timestamp.proto\"\302\003\n\006Policy\022\021" + + "\n\004name\030\001 \001(\tB\003\340A\005\022\020\n\003uid\030\002 \001(\tB\003\340A\005\022\021\n\004k" + + "ind\030\003 \001(\tB\003\340A\003\022\024\n\014display_name\030\004 \001(\t\022;\n\013" + + "annotations\030\005 \003(\0132&.google.iam.v2.Policy" + + ".AnnotationsEntry\022\014\n\004etag\030\006 \001(\t\0224\n\013creat" + + "e_time\030\007 \001(\0132\032.google.protobuf.Timestamp" + + "B\003\340A\003\0224\n\013update_time\030\010 \001(\0132\032.google.prot" + + "obuf.TimestampB\003\340A\003\0224\n\013delete_time\030\t \001(\013" + + "2\032.google.protobuf.TimestampB\003\340A\003\022(\n\005rul" + + "es\030\n \003(\0132\031.google.iam.v2.PolicyRule\022\037\n\022m" + + "anaging_authority\030\013 \001(\tB\003\340A\005\0322\n\020Annotati" + + "onsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001" + + "\"W\n\nPolicyRule\022,\n\tdeny_rule\030\002 \001(\0132\027.goog" + + "le.iam.v2.DenyRuleH\000\022\023\n\013description\030\001 \001(" + + "\tB\006\n\004kind\"Q\n\023ListPoliciesRequest\022\023\n\006pare" + + "nt\030\001 \001(\tB\003\340A\002\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage" + + "_token\030\003 \001(\t\"X\n\024ListPoliciesResponse\022\'\n\010" + + "policies\030\001 \003(\0132\025.google.iam.v2.Policy\022\027\n" + + "\017next_page_token\030\002 \001(\t\"%\n\020GetPolicyReque" + + "st\022\021\n\004name\030\001 \001(\tB\003\340A\002\"i\n\023CreatePolicyReq" + + "uest\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022*\n\006policy\030\002 \001(" + + "\0132\025.google.iam.v2.PolicyB\003\340A\002\022\021\n\tpolicy_" + + "id\030\003 \001(\t\"A\n\023UpdatePolicyRequest\022*\n\006polic" + + "y\030\001 \001(\0132\025.google.iam.v2.PolicyB\003\340A\002\";\n\023D" + + "eletePolicyRequest\022\021\n\004name\030\001 \001(\tB\003\340A\002\022\021\n" + + "\004etag\030\002 \001(\tB\003\340A\001\"u\n\035ListApplicablePolici" + + "esRequest\022\035\n\020attachment_point\030\001 \001(\tB\003\340A\002" + + "\022\016\n\006filter\030\002 \001(\t\022\022\n\npage_token\030\003 \001(\t\022\021\n\t" + + "page_size\030\004 \001(\005\"x\n\036ListApplicablePolicie" + + "sResponse\022\'\n\010policies\030\001 \003(\0132\025.google.iam" + + ".v2.Policy\022\024\n\014inaccessible\030\002 \003(\t\022\027\n\017next" + + "_page_token\030\003 \001(\t\"J\n\027PolicyOperationMeta" + + "data\022/\n\013create_time\030\001 \001(\0132\032.google.proto" + + "buf.Timestamp2\224\010\n\010Policies\022\203\001\n\014ListPolic" + + "ies\022\".google.iam.v2.ListPoliciesRequest\032" + + "#.google.iam.v2.ListPoliciesResponse\"*\202\323" + + "\344\223\002\033\022\031/v2/{parent=policies/*/*}\332A\006parent" + + "\022m\n\tGetPolicy\022\037.google.iam.v2.GetPolicyR" + + "equest\032\025.google.iam.v2.Policy\"(\202\323\344\223\002\033\022\031/" + + "v2/{name=policies/*/*/*}\332A\004name\022\272\001\n\014Crea" + + "tePolicy\022\".google.iam.v2.CreatePolicyReq" + + "uest\032\035.google.longrunning.Operation\"g\202\323\344" + + "\223\002#\"\031/v2/{parent=policies/*/*}:\006policy\332A" + + "\027parent,policy,policy_id\312A!\n\006Policy\022\027Pol" + + "icyOperationMetadata\022\247\001\n\014UpdatePolicy\022\"." + + "google.iam.v2.UpdatePolicyRequest\032\035.goog" + + "le.longrunning.Operation\"T\202\323\344\223\002*\032 /v2/{p" + + "olicy.name=policies/*/*/*}:\006policy\312A!\n\006P" + + "olicy\022\027PolicyOperationMetadata\022\237\001\n\014Delet" + + "ePolicy\022\".google.iam.v2.DeletePolicyRequ" + + "est\032\035.google.longrunning.Operation\"L\202\323\344\223" + + "\002\033*\031/v2/{name=policies/*/*/*}\332A\004name\312A!\n" + + "\006Policy\022\027PolicyOperationMetadata\022\301\001\n\026Lis" + + "tApplicablePolicies\022,.google.iam.v2.List" + + "ApplicablePoliciesRequest\032-.google.iam.v" + + "2.ListApplicablePoliciesResponse\"J\202\323\344\223\0021" + + "\022//v2/{attachment_point=*}:listApplicabl" + + "ePolicies\332A\020attachment_point\032F\312A\022iam.goo" + + "gleapis.com\322A.https://www.googleapis.com" + + "/auth/cloud-platformB\200\001\n\021com.google.iam." + + "v2B\013PolicyProtoP\001Z0google.golang.org/gen" + + "proto/googleapis/iam/v2;iam\252\002\023Google.Clo" + + "ud.Iam.V2\312\002\023Google\\Cloud\\Iam\\V2b\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.iam.v2.DenyRuleProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_iam_v2_Policy_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_google_iam_v2_Policy_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_Policy_descriptor, + new java.lang.String[] { + "Name", + "Uid", + "Kind", + "DisplayName", + "Annotations", + "Etag", + "CreateTime", + "UpdateTime", + "DeleteTime", + "Rules", + "ManagingAuthority", + }); + internal_static_google_iam_v2_Policy_AnnotationsEntry_descriptor = + internal_static_google_iam_v2_Policy_descriptor.getNestedTypes().get(0); + internal_static_google_iam_v2_Policy_AnnotationsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_Policy_AnnotationsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_iam_v2_PolicyRule_descriptor = getDescriptor().getMessageTypes().get(1); + internal_static_google_iam_v2_PolicyRule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_PolicyRule_descriptor, + new java.lang.String[] { + "DenyRule", "Description", "Kind", + }); + internal_static_google_iam_v2_ListPoliciesRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_iam_v2_ListPoliciesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_ListPoliciesRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", + }); + internal_static_google_iam_v2_ListPoliciesResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_iam_v2_ListPoliciesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_ListPoliciesResponse_descriptor, + new java.lang.String[] { + "Policies", "NextPageToken", + }); + internal_static_google_iam_v2_GetPolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_iam_v2_GetPolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_GetPolicyRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_iam_v2_CreatePolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_iam_v2_CreatePolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_CreatePolicyRequest_descriptor, + new java.lang.String[] { + "Parent", "Policy", "PolicyId", + }); + internal_static_google_iam_v2_UpdatePolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_iam_v2_UpdatePolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_UpdatePolicyRequest_descriptor, + new java.lang.String[] { + "Policy", + }); + internal_static_google_iam_v2_DeletePolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_iam_v2_DeletePolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_DeletePolicyRequest_descriptor, + new java.lang.String[] { + "Name", "Etag", + }); + internal_static_google_iam_v2_ListApplicablePoliciesRequest_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_iam_v2_ListApplicablePoliciesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_ListApplicablePoliciesRequest_descriptor, + new java.lang.String[] { + "AttachmentPoint", "Filter", "PageToken", "PageSize", + }); + internal_static_google_iam_v2_ListApplicablePoliciesResponse_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_iam_v2_ListApplicablePoliciesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_ListApplicablePoliciesResponse_descriptor, + new java.lang.String[] { + "Policies", "Inaccessible", "NextPageToken", + }); + internal_static_google_iam_v2_PolicyOperationMetadata_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_iam_v2_PolicyOperationMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2_PolicyOperationMetadata_descriptor, + new java.lang.String[] { + "CreateTime", + }); + 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.longrunning.OperationsProto.operationInfo); + 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.iam.v2.DenyRuleProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyRule.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyRule.java new file mode 100644 index 00000000..c1de50c9 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyRule.java @@ -0,0 +1,1007 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * A single rule in a `Policy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2.PolicyRule} + */ +public final class PolicyRule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.PolicyRule) + PolicyRuleOrBuilder { + private static final long serialVersionUID = 0L; + // Use PolicyRule.newBuilder() to construct. + private PolicyRule(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PolicyRule() { + description_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PolicyRule(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PolicyRule( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + description_ = s; + break; + } + case 18: + { + com.google.iam.v2.DenyRule.Builder subBuilder = null; + if (kindCase_ == 2) { + subBuilder = ((com.google.iam.v2.DenyRule) kind_).toBuilder(); + } + kind_ = input.readMessage(com.google.iam.v2.DenyRule.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.iam.v2.DenyRule) kind_); + kind_ = subBuilder.buildPartial(); + } + kindCase_ = 2; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_PolicyRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_PolicyRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.PolicyRule.class, com.google.iam.v2.PolicyRule.Builder.class); + } + + private int kindCase_ = 0; + private java.lang.Object kind_; + + public enum KindCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + DENY_RULE(2), + KIND_NOT_SET(0); + private final int value; + + private KindCase(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 KindCase valueOf(int value) { + return forNumber(value); + } + + public static KindCase forNumber(int value) { + switch (value) { + case 2: + return DENY_RULE; + case 0: + return KIND_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public KindCase getKindCase() { + return KindCase.forNumber(kindCase_); + } + + public static final int DENY_RULE_FIELD_NUMBER = 2; + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + * + * @return Whether the denyRule field is set. + */ + @java.lang.Override + public boolean hasDenyRule() { + return kindCase_ == 2; + } + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + * + * @return The denyRule. + */ + @java.lang.Override + public com.google.iam.v2.DenyRule getDenyRule() { + if (kindCase_ == 2) { + return (com.google.iam.v2.DenyRule) kind_; + } + return com.google.iam.v2.DenyRule.getDefaultInstance(); + } + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + @java.lang.Override + public com.google.iam.v2.DenyRuleOrBuilder getDenyRuleOrBuilder() { + if (kindCase_ == 2) { + return (com.google.iam.v2.DenyRule) kind_; + } + return com.google.iam.v2.DenyRule.getDefaultInstance(); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + private volatile java.lang.Object description_; + /** + * + * + *
+   * A user-specified description of the rule. This value can be up to 256
+   * characters.
+   * 
+ * + * string description = 1; + * + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + 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(); + description_ = s; + return s; + } + } + /** + * + * + *
+   * A user-specified description of the rule. This value can be up to 256
+   * characters.
+   * 
+ * + * string description = 1; + * + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + description_ = 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(description_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, description_); + } + if (kindCase_ == 2) { + output.writeMessage(2, (com.google.iam.v2.DenyRule) kind_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, description_); + } + if (kindCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.iam.v2.DenyRule) kind_); + } + size += unknownFields.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.iam.v2.PolicyRule)) { + return super.equals(obj); + } + com.google.iam.v2.PolicyRule other = (com.google.iam.v2.PolicyRule) obj; + + if (!getDescription().equals(other.getDescription())) return false; + if (!getKindCase().equals(other.getKindCase())) return false; + switch (kindCase_) { + case 2: + if (!getDenyRule().equals(other.getDenyRule())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) 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) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + switch (kindCase_) { + case 2: + hash = (37 * hash) + DENY_RULE_FIELD_NUMBER; + hash = (53 * hash) + getDenyRule().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.PolicyRule parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.PolicyRule parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.PolicyRule parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.PolicyRule 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.iam.v2.PolicyRule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.PolicyRule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.PolicyRule parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.PolicyRule 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.iam.v2.PolicyRule parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.PolicyRule 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.iam.v2.PolicyRule parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.PolicyRule 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.iam.v2.PolicyRule 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; + } + /** + * + * + *
+   * A single rule in a `Policy`.
+   * 
+ * + * Protobuf type {@code google.iam.v2.PolicyRule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.PolicyRule) + com.google.iam.v2.PolicyRuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_PolicyRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_PolicyRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.PolicyRule.class, com.google.iam.v2.PolicyRule.Builder.class); + } + + // Construct using com.google.iam.v2.PolicyRule.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + description_ = ""; + + kindCase_ = 0; + kind_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto.internal_static_google_iam_v2_PolicyRule_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.PolicyRule getDefaultInstanceForType() { + return com.google.iam.v2.PolicyRule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.PolicyRule build() { + com.google.iam.v2.PolicyRule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.PolicyRule buildPartial() { + com.google.iam.v2.PolicyRule result = new com.google.iam.v2.PolicyRule(this); + if (kindCase_ == 2) { + if (denyRuleBuilder_ == null) { + result.kind_ = kind_; + } else { + result.kind_ = denyRuleBuilder_.build(); + } + } + result.description_ = description_; + result.kindCase_ = kindCase_; + 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.iam.v2.PolicyRule) { + return mergeFrom((com.google.iam.v2.PolicyRule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.PolicyRule other) { + if (other == com.google.iam.v2.PolicyRule.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + onChanged(); + } + switch (other.getKindCase()) { + case DENY_RULE: + { + mergeDenyRule(other.getDenyRule()); + break; + } + case KIND_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.PolicyRule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.PolicyRule) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int kindCase_ = 0; + private java.lang.Object kind_; + + public KindCase getKindCase() { + return KindCase.forNumber(kindCase_); + } + + public Builder clearKind() { + kindCase_ = 0; + kind_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.DenyRule, + com.google.iam.v2.DenyRule.Builder, + com.google.iam.v2.DenyRuleOrBuilder> + denyRuleBuilder_; + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + * + * @return Whether the denyRule field is set. + */ + @java.lang.Override + public boolean hasDenyRule() { + return kindCase_ == 2; + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + * + * @return The denyRule. + */ + @java.lang.Override + public com.google.iam.v2.DenyRule getDenyRule() { + if (denyRuleBuilder_ == null) { + if (kindCase_ == 2) { + return (com.google.iam.v2.DenyRule) kind_; + } + return com.google.iam.v2.DenyRule.getDefaultInstance(); + } else { + if (kindCase_ == 2) { + return denyRuleBuilder_.getMessage(); + } + return com.google.iam.v2.DenyRule.getDefaultInstance(); + } + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + public Builder setDenyRule(com.google.iam.v2.DenyRule value) { + if (denyRuleBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + kind_ = value; + onChanged(); + } else { + denyRuleBuilder_.setMessage(value); + } + kindCase_ = 2; + return this; + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + public Builder setDenyRule(com.google.iam.v2.DenyRule.Builder builderForValue) { + if (denyRuleBuilder_ == null) { + kind_ = builderForValue.build(); + onChanged(); + } else { + denyRuleBuilder_.setMessage(builderForValue.build()); + } + kindCase_ = 2; + return this; + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + public Builder mergeDenyRule(com.google.iam.v2.DenyRule value) { + if (denyRuleBuilder_ == null) { + if (kindCase_ == 2 && kind_ != com.google.iam.v2.DenyRule.getDefaultInstance()) { + kind_ = + com.google.iam.v2.DenyRule.newBuilder((com.google.iam.v2.DenyRule) kind_) + .mergeFrom(value) + .buildPartial(); + } else { + kind_ = value; + } + onChanged(); + } else { + if (kindCase_ == 2) { + denyRuleBuilder_.mergeFrom(value); + } else { + denyRuleBuilder_.setMessage(value); + } + } + kindCase_ = 2; + return this; + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + public Builder clearDenyRule() { + if (denyRuleBuilder_ == null) { + if (kindCase_ == 2) { + kindCase_ = 0; + kind_ = null; + onChanged(); + } + } else { + if (kindCase_ == 2) { + kindCase_ = 0; + kind_ = null; + } + denyRuleBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + public com.google.iam.v2.DenyRule.Builder getDenyRuleBuilder() { + return getDenyRuleFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + @java.lang.Override + public com.google.iam.v2.DenyRuleOrBuilder getDenyRuleOrBuilder() { + if ((kindCase_ == 2) && (denyRuleBuilder_ != null)) { + return denyRuleBuilder_.getMessageOrBuilder(); + } else { + if (kindCase_ == 2) { + return (com.google.iam.v2.DenyRule) kind_; + } + return com.google.iam.v2.DenyRule.getDefaultInstance(); + } + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.DenyRule, + com.google.iam.v2.DenyRule.Builder, + com.google.iam.v2.DenyRuleOrBuilder> + getDenyRuleFieldBuilder() { + if (denyRuleBuilder_ == null) { + if (!(kindCase_ == 2)) { + kind_ = com.google.iam.v2.DenyRule.getDefaultInstance(); + } + denyRuleBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.DenyRule, + com.google.iam.v2.DenyRule.Builder, + com.google.iam.v2.DenyRuleOrBuilder>( + (com.google.iam.v2.DenyRule) kind_, getParentForChildren(), isClean()); + kind_ = null; + } + kindCase_ = 2; + onChanged(); + ; + return denyRuleBuilder_; + } + + private java.lang.Object description_ = ""; + /** + * + * + *
+     * A user-specified description of the rule. This value can be up to 256
+     * characters.
+     * 
+ * + * string description = 1; + * + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A user-specified description of the rule. This value can be up to 256
+     * characters.
+     * 
+ * + * string description = 1; + * + * @return The bytes for description. + */ + public com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A user-specified description of the rule. This value can be up to 256
+     * characters.
+     * 
+ * + * string description = 1; + * + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + description_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A user-specified description of the rule. This value can be up to 256
+     * characters.
+     * 
+ * + * string description = 1; + * + * @return This builder for chaining. + */ + public Builder clearDescription() { + + description_ = getDefaultInstance().getDescription(); + onChanged(); + return this; + } + /** + * + * + *
+     * A user-specified description of the rule. This value can be up to 256
+     * characters.
+     * 
+ * + * string description = 1; + * + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + description_ = 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.iam.v2.PolicyRule) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.PolicyRule) + private static final com.google.iam.v2.PolicyRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.PolicyRule(); + } + + public static com.google.iam.v2.PolicyRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PolicyRule parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PolicyRule(input, extensionRegistry); + } + }; + + 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.iam.v2.PolicyRule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyRuleOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyRuleOrBuilder.java new file mode 100644 index 00000000..712ec072 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/PolicyRuleOrBuilder.java @@ -0,0 +1,89 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface PolicyRuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.PolicyRule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + * + * @return Whether the denyRule field is set. + */ + boolean hasDenyRule(); + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + * + * @return The denyRule. + */ + com.google.iam.v2.DenyRule getDenyRule(); + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2.DenyRule deny_rule = 2; + */ + com.google.iam.v2.DenyRuleOrBuilder getDenyRuleOrBuilder(); + + /** + * + * + *
+   * A user-specified description of the rule. This value can be up to 256
+   * characters.
+   * 
+ * + * string description = 1; + * + * @return The description. + */ + java.lang.String getDescription(); + /** + * + * + *
+   * A user-specified description of the rule. This value can be up to 256
+   * characters.
+   * 
+ * + * string description = 1; + * + * @return The bytes for description. + */ + com.google.protobuf.ByteString getDescriptionBytes(); + + public com.google.iam.v2.PolicyRule.KindCase getKindCase(); +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/UpdatePolicyRequest.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/UpdatePolicyRequest.java new file mode 100644 index 00000000..d9f857e3 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/UpdatePolicyRequest.java @@ -0,0 +1,755 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +/** + * + * + *
+ * Request message for `UpdatePolicy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2.UpdatePolicyRequest} + */ +public final class UpdatePolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2.UpdatePolicyRequest) + UpdatePolicyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdatePolicyRequest.newBuilder() to construct. + private UpdatePolicyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdatePolicyRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdatePolicyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdatePolicyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.iam.v2.Policy.Builder subBuilder = null; + if (policy_ != null) { + subBuilder = policy_.toBuilder(); + } + policy_ = input.readMessage(com.google.iam.v2.Policy.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(policy_); + policy_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_UpdatePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_UpdatePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.UpdatePolicyRequest.class, + com.google.iam.v2.UpdatePolicyRequest.Builder.class); + } + + public static final int POLICY_FIELD_NUMBER = 1; + private com.google.iam.v2.Policy policy_; + /** + * + * + *
+   * Required. The policy to update.
+   * To prevent conflicting updates, the `etag` value must match the value that
+   * is stored in IAM. If the `etag` values do not match, the request fails with
+   * a `409` error code and `ABORTED` status.
+   * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the policy field is set. + */ + @java.lang.Override + public boolean hasPolicy() { + return policy_ != null; + } + /** + * + * + *
+   * Required. The policy to update.
+   * To prevent conflicting updates, the `etag` value must match the value that
+   * is stored in IAM. If the `etag` values do not match, the request fails with
+   * a `409` error code and `ABORTED` status.
+   * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + @java.lang.Override + public com.google.iam.v2.Policy getPolicy() { + return policy_ == null ? com.google.iam.v2.Policy.getDefaultInstance() : policy_; + } + /** + * + * + *
+   * Required. The policy to update.
+   * To prevent conflicting updates, the `etag` value must match the value that
+   * is stored in IAM. If the `etag` values do not match, the request fails with
+   * a `409` error code and `ABORTED` status.
+   * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.iam.v2.PolicyOrBuilder getPolicyOrBuilder() { + return getPolicy(); + } + + 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 (policy_ != null) { + output.writeMessage(1, getPolicy()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (policy_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getPolicy()); + } + size += unknownFields.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.iam.v2.UpdatePolicyRequest)) { + return super.equals(obj); + } + com.google.iam.v2.UpdatePolicyRequest other = (com.google.iam.v2.UpdatePolicyRequest) obj; + + if (hasPolicy() != other.hasPolicy()) return false; + if (hasPolicy()) { + if (!getPolicy().equals(other.getPolicy())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasPolicy()) { + hash = (37 * hash) + POLICY_FIELD_NUMBER; + hash = (53 * hash) + getPolicy().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2.UpdatePolicyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.UpdatePolicyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.UpdatePolicyRequest parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.UpdatePolicyRequest 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.iam.v2.UpdatePolicyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2.UpdatePolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2.UpdatePolicyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.UpdatePolicyRequest 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.iam.v2.UpdatePolicyRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2.UpdatePolicyRequest 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.iam.v2.UpdatePolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2.UpdatePolicyRequest 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.iam.v2.UpdatePolicyRequest 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 `UpdatePolicy`.
+   * 
+ * + * Protobuf type {@code google.iam.v2.UpdatePolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2.UpdatePolicyRequest) + com.google.iam.v2.UpdatePolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_UpdatePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_UpdatePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2.UpdatePolicyRequest.class, + com.google.iam.v2.UpdatePolicyRequest.Builder.class); + } + + // Construct using com.google.iam.v2.UpdatePolicyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (policyBuilder_ == null) { + policy_ = null; + } else { + policy_ = null; + policyBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2.PolicyProto + .internal_static_google_iam_v2_UpdatePolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2.UpdatePolicyRequest getDefaultInstanceForType() { + return com.google.iam.v2.UpdatePolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2.UpdatePolicyRequest build() { + com.google.iam.v2.UpdatePolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2.UpdatePolicyRequest buildPartial() { + com.google.iam.v2.UpdatePolicyRequest result = + new com.google.iam.v2.UpdatePolicyRequest(this); + if (policyBuilder_ == null) { + result.policy_ = policy_; + } else { + result.policy_ = policyBuilder_.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.iam.v2.UpdatePolicyRequest) { + return mergeFrom((com.google.iam.v2.UpdatePolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2.UpdatePolicyRequest other) { + if (other == com.google.iam.v2.UpdatePolicyRequest.getDefaultInstance()) return this; + if (other.hasPolicy()) { + mergePolicy(other.getPolicy()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.iam.v2.UpdatePolicyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2.UpdatePolicyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.iam.v2.Policy policy_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder> + policyBuilder_; + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the policy field is set. + */ + public boolean hasPolicy() { + return policyBuilder_ != null || policy_ != null; + } + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + public com.google.iam.v2.Policy getPolicy() { + if (policyBuilder_ == null) { + return policy_ == null ? com.google.iam.v2.Policy.getDefaultInstance() : policy_; + } else { + return policyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPolicy(com.google.iam.v2.Policy value) { + if (policyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + policy_ = value; + onChanged(); + } else { + policyBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPolicy(com.google.iam.v2.Policy.Builder builderForValue) { + if (policyBuilder_ == null) { + policy_ = builderForValue.build(); + onChanged(); + } else { + policyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergePolicy(com.google.iam.v2.Policy value) { + if (policyBuilder_ == null) { + if (policy_ != null) { + policy_ = com.google.iam.v2.Policy.newBuilder(policy_).mergeFrom(value).buildPartial(); + } else { + policy_ = value; + } + onChanged(); + } else { + policyBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearPolicy() { + if (policyBuilder_ == null) { + policy_ = null; + onChanged(); + } else { + policy_ = null; + policyBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.iam.v2.Policy.Builder getPolicyBuilder() { + + onChanged(); + return getPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.iam.v2.PolicyOrBuilder getPolicyOrBuilder() { + if (policyBuilder_ != null) { + return policyBuilder_.getMessageOrBuilder(); + } else { + return policy_ == null ? com.google.iam.v2.Policy.getDefaultInstance() : policy_; + } + } + /** + * + * + *
+     * Required. The policy to update.
+     * To prevent conflicting updates, the `etag` value must match the value that
+     * is stored in IAM. If the `etag` values do not match, the request fails with
+     * a `409` error code and `ABORTED` status.
+     * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder> + getPolicyFieldBuilder() { + if (policyBuilder_ == null) { + policyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2.Policy, + com.google.iam.v2.Policy.Builder, + com.google.iam.v2.PolicyOrBuilder>(getPolicy(), getParentForChildren(), isClean()); + policy_ = null; + } + return policyBuilder_; + } + + @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.iam.v2.UpdatePolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2.UpdatePolicyRequest) + private static final com.google.iam.v2.UpdatePolicyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2.UpdatePolicyRequest(); + } + + public static com.google.iam.v2.UpdatePolicyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdatePolicyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdatePolicyRequest(input, extensionRegistry); + } + }; + + 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.iam.v2.UpdatePolicyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2/src/main/java/com/google/iam/v2/UpdatePolicyRequestOrBuilder.java b/proto-google-iam-v2/src/main/java/com/google/iam/v2/UpdatePolicyRequestOrBuilder.java new file mode 100644 index 00000000..fa20ec03 --- /dev/null +++ b/proto-google-iam-v2/src/main/java/com/google/iam/v2/UpdatePolicyRequestOrBuilder.java @@ -0,0 +1,69 @@ +/* + * 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/iam/v2/policy.proto + +package com.google.iam.v2; + +public interface UpdatePolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2.UpdatePolicyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The policy to update.
+   * To prevent conflicting updates, the `etag` value must match the value that
+   * is stored in IAM. If the `etag` values do not match, the request fails with
+   * a `409` error code and `ABORTED` status.
+   * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the policy field is set. + */ + boolean hasPolicy(); + /** + * + * + *
+   * Required. The policy to update.
+   * To prevent conflicting updates, the `etag` value must match the value that
+   * is stored in IAM. If the `etag` values do not match, the request fails with
+   * a `409` error code and `ABORTED` status.
+   * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + com.google.iam.v2.Policy getPolicy(); + /** + * + * + *
+   * Required. The policy to update.
+   * To prevent conflicting updates, the `etag` value must match the value that
+   * is stored in IAM. If the `etag` values do not match, the request fails with
+   * a `409` error code and `ABORTED` status.
+   * 
+ * + * .google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.iam.v2.PolicyOrBuilder getPolicyOrBuilder(); +} diff --git a/proto-google-iam-v2/src/main/proto/google/iam/v2/deny.proto b/proto-google-iam-v2/src/main/proto/google/iam/v2/deny.proto new file mode 100644 index 00000000..db9f15f8 --- /dev/null +++ b/proto-google-iam-v2/src/main/proto/google/iam/v2/deny.proto @@ -0,0 +1,109 @@ +// 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.iam.v2; + +import "google/type/expr.proto"; + +option csharp_namespace = "Google.Cloud.Iam.V2"; +option go_package = "google.golang.org/genproto/googleapis/iam/v2;iam"; +option java_multiple_files = true; +option java_outer_classname = "DenyRuleProto"; +option java_package = "com.google.iam.v2"; +option php_namespace = "Google\\Cloud\\Iam\\V2"; + +// A deny rule in an IAM deny policy. +message DenyRule { + // The identities that are prevented from using one or more permissions on + // Google Cloud resources. This field can contain the following values: + // + // * `principalSet://goog/public:all`: A special identifier that represents + // any principal that is on the internet, even if they do not have a Google + // Account or are not logged in. + // + // * `principal://goog/subject/{email_id}`: A specific Google Account. + // Includes Gmail, Cloud Identity, and Google Workspace user accounts. For + // example, `principal://goog/subject/alice@example.com`. + // + // * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific + // Google Account that was deleted recently. For example, + // `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If + // the Google Account is recovered, this identifier reverts to the standard + // identifier for a Google Account. + // + // * `principalSet://goog/group/{group_id}`: A Google group. For example, + // `principalSet://goog/group/admins@example.com`. + // + // * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group + // that was deleted recently. For example, + // `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If + // the Google group is restored, this identifier reverts to the standard + // identifier for a Google group. + // + // * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`: + // A Google Cloud service account. For example, + // `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`. + // + // * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`: + // A Google Cloud service account that was deleted recently. For example, + // `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`. + // If the service account is undeleted, this identifier reverts to the + // standard identifier for a service account. + // + // * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the + // principals associated with the specified Google Workspace or Cloud + // Identity customer ID. For example, + // `principalSet://goog/cloudIdentityCustomerId/C01Abc35`. + repeated string denied_principals = 1; + + // The identities that are excluded from the deny rule, even if they are + // listed in the `denied_principals`. For example, you could add a Google + // group to the `denied_principals`, then exclude specific users who belong to + // that group. + // + // This field can contain the same values as the `denied_principals` field, + // excluding `principalSet://goog/public:all`, which represents all users on + // the internet. + repeated string exception_principals = 2; + + // The permissions that are explicitly denied by this rule. Each permission + // uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}` + // is the fully qualified domain name for the service. For example, + // `iam.googleapis.com/roles.list`. + repeated string denied_permissions = 3; + + // Specifies the permissions that this rule excludes from the set of denied + // permissions given by `denied_permissions`. If a permission appears in + // `denied_permissions` _and_ in `exception_permissions` then it will _not_ be + // denied. + // + // The excluded permissions can be specified using the same syntax as + // `denied_permissions`. + repeated string exception_permissions = 4; + + // The condition that determines whether this deny rule applies to a request. + // If the condition expression evaluates to `true`, then the deny rule is + // applied; otherwise, the deny rule is not applied. + // + // Each deny rule is evaluated independently. If this deny rule does not apply + // to a request, other deny rules might still apply. + // + // The condition can use CEL functions that evaluate + // [resource + // tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other + // functions and operators are not supported. + google.type.Expr denial_condition = 5; +} diff --git a/proto-google-iam-v2/src/main/proto/google/iam/v2/policy.proto b/proto-google-iam-v2/src/main/proto/google/iam/v2/policy.proto new file mode 100644 index 00000000..b21d44fa --- /dev/null +++ b/proto-google-iam-v2/src/main/proto/google/iam/v2/policy.proto @@ -0,0 +1,376 @@ +// 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.iam.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/iam/v2/deny.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Iam.V2"; +option go_package = "google.golang.org/genproto/googleapis/iam/v2;iam"; +option java_multiple_files = true; +option java_outer_classname = "PolicyProto"; +option java_package = "com.google.iam.v2"; +option php_namespace = "Google\\Cloud\\Iam\\V2"; + +// An interface for managing Identity and Access Management (IAM) policies. +service Policies { + option (google.api.default_host) = "iam.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Retrieves the policies of the specified kind that are attached to a + // resource. + // + // The response lists only policy metadata. In particular, policy rules are + // omitted. + rpc ListPolicies(ListPoliciesRequest) returns (ListPoliciesResponse) { + option (google.api.http) = { + get: "/v2/{parent=policies/*/*}" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a policy. + rpc GetPolicy(GetPolicyRequest) returns (Policy) { + option (google.api.http) = { + get: "/v2/{name=policies/*/*/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a policy. + rpc CreatePolicy(CreatePolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=policies/*/*}" + body: "policy" + }; + option (google.api.method_signature) = "parent,policy,policy_id"; + option (google.longrunning.operation_info) = { + response_type: "Policy" + metadata_type: "PolicyOperationMetadata" + }; + } + + // Updates the specified policy. + // + // You can update only the rules and the display name for the policy. + // + // To update a policy, you should use a read-modify-write loop: + // + // 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current + // version of the policy. + // 2. Modify the policy as needed. + // 3. Use `UpdatePolicy` to write the updated policy. + // + // This pattern helps prevent conflicts between concurrent updates. + rpc UpdatePolicy(UpdatePolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + put: "/v2/{policy.name=policies/*/*/*}" + body: "policy" + }; + option (google.longrunning.operation_info) = { + response_type: "Policy" + metadata_type: "PolicyOperationMetadata" + }; + } + + // Deletes a policy. This action is permanent. + rpc DeletePolicy(DeletePolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=policies/*/*/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Policy" + metadata_type: "PolicyOperationMetadata" + }; + } + + // Retrieves all the policies that are attached to the specified resource, + // or anywhere in the ancestry of the resource. For example, for a project + // this endpoint would return all the `denyPolicy` kind policies attached to + // the project, its parent folder (if any), and its parent organization (if + // any). + // The endpoint requires the same permissions that it would take to call + // `ListPolicies` or `GetPolicy`. + // + // The main reason to use this endpoint is as a policy admin to debug access + // issues for a resource. + rpc ListApplicablePolicies(ListApplicablePoliciesRequest) + returns (ListApplicablePoliciesResponse) { + option (google.api.http) = { + get: "/v2/{attachment_point=*}:listApplicablePolicies" + }; + option (google.api.method_signature) = "attachment_point"; + } +} + +// Data for an IAM policy. +message Policy { + // Immutable. The resource name of the `Policy`, which must be unique. Format: + // `policies/{attachment_point}/denypolicies/{policy_id}` + // + // + // The attachment point is identified by its URL-encoded full resource name, + // which means that the forward-slash character, `/`, must be written as + // `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, requests can use the alphanumeric or the numeric ID. + // Responses always contain the numeric ID. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The globally unique ID of the `Policy`. Assigned automatically + // when the `Policy` is created. + string uid = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The kind of the `Policy`. Always contains the value + // `DenyPolicy`. + string kind = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-specified description of the `Policy`. This value can be up to 63 + // characters. + string display_name = 4; + + // A key-value map to store arbitrary metadata for the `Policy`. Keys + // can be up to 63 characters. Values can be up to 255 characters. + map annotations = 5; + + // An opaque tag that identifies the current version of the `Policy`. IAM uses + // this value to help manage concurrent updates, so they do not cause one + // update to be overwritten by another. + // + // If this field is present in a [CreatePolicy][] request, the value is + // ignored. + string etag = 6; + + // Output only. The time when the `Policy` was created. + google.protobuf.Timestamp create_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the `Policy` was last updated. + google.protobuf.Timestamp update_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the `Policy` was deleted. Empty if the policy is + // not deleted. + google.protobuf.Timestamp delete_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A list of rules that specify the behavior of the `Policy`. All of the rules + // should be of the `kind` specified in the `Policy`. + repeated PolicyRule rules = 10; + + // Immutable. Specifies that this policy is managed by an authority and can + // only be modified by that authority. Usage is restricted. + string managing_authority = 11 [(google.api.field_behavior) = IMMUTABLE]; +} + +// A single rule in a `Policy`. +message PolicyRule { + oneof kind { + // A rule for a deny policy. + DenyRule deny_rule = 2; + } + + // A user-specified description of the rule. This value can be up to 256 + // characters. + string description = 1; +} + +// Request message for `ListPolicies`. +message ListPoliciesRequest { + // Required. The resource that the policy is attached to, along with the kind + // of policy to list. Format: `policies/{attachment_point}/denypolicies` + // + // + // The attachment point is identified by its URL-encoded full resource name, + // which means that the forward-slash character, `/`, must be written as + // `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, you can use the alphanumeric or the numeric ID. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of policies to return. IAM ignores this value and uses + // the value 1000. + int32 page_size = 2; + + // A page token received in a + // [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this + // token to retrieve the next page. + string page_token = 3; +} + +// Response message for `ListPolicies`. +message ListPoliciesResponse { + // Metadata for the policies that are attached to the resource. + repeated Policy policies = 1; + + // A page token that you can use in a + // [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the + // next page. If this field is omitted, there are no additional pages. + string next_page_token = 2; +} + +// Request message for `GetPolicy`. +message GetPolicyRequest { + // Required. The resource name of the policy to retrieve. Format: + // `policies/{attachment_point}/denypolicies/{policy_id}` + // + // + // Use the URL-encoded full resource name, which means that the forward-slash + // character, `/`, must be written as `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, you can use the alphanumeric or the numeric ID. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `CreatePolicy`. +message CreatePolicyRequest { + // Required. The resource that the policy is attached to, along with the kind + // of policy to create. Format: `policies/{attachment_point}/denypolicies` + // + // + // The attachment point is identified by its URL-encoded full resource name, + // which means that the forward-slash character, `/`, must be written as + // `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, you can use the alphanumeric or the numeric ID. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The policy to create. + Policy policy = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for this policy, which will become the final component of + // the policy's resource name. The ID must contain 3 to 63 characters. It can + // contain lowercase letters and numbers, as well as dashes (`-`) and periods + // (`.`). The first character must be a lowercase letter. + string policy_id = 3; +} + +// Request message for `UpdatePolicy`. +message UpdatePolicyRequest { + // Required. The policy to update. + // + // To prevent conflicting updates, the `etag` value must match the value that + // is stored in IAM. If the `etag` values do not match, the request fails with + // a `409` error code and `ABORTED` status. + Policy policy = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `DeletePolicy`. +message DeletePolicyRequest { + // Required. The resource name of the policy to delete. Format: + // `policies/{attachment_point}/denypolicies/{policy_id}` + // + // + // Use the URL-encoded full resource name, which means that the forward-slash + // character, `/`, must be written as `%2F`. For example, + // `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + // + // For organizations and folders, use the numeric ID in the full resource + // name. For projects, you can use the alphanumeric or the numeric ID. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The expected `etag` of the policy to delete. If the value does + // not match the value that is stored in IAM, the request fails with a `409` + // error code and `ABORTED` status. + // + // If you omit this field, the policy is deleted regardless of its current + // `etag`. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// `ListApplicablePoliciesRequest` represents the Request message for the +// `ListApplicablePolicies` method. It provides the input for a filterable query +// of Policies that apply to a certain GCP Resource, specified by the field +// `attachment_point`, found on this message. +// Example: +// ``` +// { +// attachment_point: +// 'cloudresourcemanager.googleapis.com%2Forganizations%2F212345678901' +// filter: 'kind:denyPolicies' +// } +// ``` +message ListApplicablePoliciesRequest { + // Required. The Cloud resource at which the applicable policies are to be + // retrieved. Format: `{attachment-point}` Use the URL-encoded full resource + // name, which means that the forward-slash character, `/`, must be written as + // `%2F`. For example, + // `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`. + string attachment_point = 1 [(google.api.field_behavior) = REQUIRED]; + + // Filtering currently only supports the kind of policies to return, and + // must be in the format “kind:[policyKind1] OR kind:[policyKind2]”. New + // policy kinds may be added in the future without notice. + // + // Example value: “kind:denyPolicies” + string filter = 2; + + // If present, then retrieve the batch of results following the results from + // the preceding call to this method. `page_token` must be the value of + // `next_page_token` + // [ListApplicablePoliciesResponse.next_page_token][google.iam.v2.ListApplicablePoliciesResponse.next_page_token] + // from the previous response. The values of other method parameters should + // be identical to those in the previous call. + string page_token = 3; + + // Limit on the number of policies to include in the response. + // Further policies can subsequently be obtained by including the + // [ListApplicablePoliciesResponse.next_page_token][google.iam.admin.v1.ListApplicablePoliciesResponse.next_page_token] + // in a subsequent request. + // The minimum is 25, and the maximum is 100. + int32 page_size = 4; +} + +// Response message for [ListApplicablePolicies][] method. +message ListApplicablePoliciesResponse { + // Ordered list starting from the resource on which this API was called + // then proceeding up the hierarchy. Policies for the same attachment point + // will be grouped, but no further ordering is guaranteed. + repeated Policy policies = 1; + + // A list of resources that the caller does not have permission to retrieve. + // List or Get can be used to get detailed error messages. + // Get: `policies/{attachment-point}/denypolicies/{policy-id}` + // List: `policies/{attachment-point}/denypolicies` + repeated string inaccessible = 2; + + // A page token that can be used in a + // [ListApplicablePoliciesRequest][google.iam.v2.ListApplicablePoliciesRequest] + // to retrieve the next page. If this field is blank, there are no additional + // pages. + string next_page_token = 3; +} + +// Metadata for long-running `Policy` operations. +message PolicyOperationMetadata { + // Timestamp when the `google.longrunning.Operation` was created. + google.protobuf.Timestamp create_time = 1; +} diff --git a/versions.txt b/versions.txt index 8f0502c0..e7048b1c 100644 --- a/versions.txt +++ b/versions.txt @@ -6,3 +6,5 @@ grpc-google-iam-v1:1.5.2:1.5.3-SNAPSHOT proto-google-iam-v2beta:1.5.2:1.5.3-SNAPSHOT grpc-google-iam-v2beta:1.5.2:1.5.3-SNAPSHOT google-iam-policy:1.5.2:1.5.3-SNAPSHOT +proto-google-iam-v2:1.5.2:1.5.3-SNAPSHOT +grpc-google-iam-v2:1.5.2:1.5.3-SNAPSHOT From 2912ab6769454820ca90808d39c545f71bd9e8f1 Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Mon, 12 Sep 2022 19:48:45 +0000 Subject: [PATCH 3/8] chore: fix generated pom.xml for proto and grpc --- grpc-google-iam-v2/pom.xml | 4 ++-- proto-google-iam-v2/pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grpc-google-iam-v2/pom.xml b/grpc-google-iam-v2/pom.xml index adc16a23..6b0d3cf2 100644 --- a/grpc-google-iam-v2/pom.xml +++ b/grpc-google-iam-v2/pom.xml @@ -8,8 +8,8 @@ grpc-google-iam-v2 GRPC library for proto-google-iam-v1 - com.google.api.grpc - proto-google-iam-v1-parent + com.google.cloud + google-iam-parent 1.5.3-SNAPSHOT diff --git a/proto-google-iam-v2/pom.xml b/proto-google-iam-v2/pom.xml index d099af45..c01e4420 100644 --- a/proto-google-iam-v2/pom.xml +++ b/proto-google-iam-v2/pom.xml @@ -8,8 +8,8 @@ proto-google-iam-v2 Proto library for proto-google-iam-v1 - com.google.api.grpc - proto-google-iam-v1-parent + com.google.cloud + google-iam-parent 1.5.3-SNAPSHOT From 71f8b19aff0e9516ccea6faec9890bc47bd2d9eb Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Mon, 12 Sep 2022 19:40:43 +0000 Subject: [PATCH 4/8] chore: add v2 dependencies to google-iam-policy/pom.xml --- google-iam-policy/pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/google-iam-policy/pom.xml b/google-iam-policy/pom.xml index d720bd06..7b320083 100644 --- a/google-iam-policy/pom.xml +++ b/google-iam-policy/pom.xml @@ -46,6 +46,10 @@ com.google.api.grpc proto-google-iam-v2beta
+ + com.google.api.grpc + proto-google-iam-v2 + com.google.guava guava @@ -80,6 +84,11 @@ grpc-google-iam-v2beta test + + com.google.api.grpc + grpc-google-iam-v2 + test + com.google.api From 7d2eec7834a38aab9fbb9ccd42e44105053464a1 Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Mon, 12 Sep 2022 20:03:50 +0000 Subject: [PATCH 5/8] chore: fix undeclared but used deps --- proto-google-iam-v2beta/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proto-google-iam-v2beta/pom.xml b/proto-google-iam-v2beta/pom.xml index d2d43f45..06e5941d 100644 --- a/proto-google-iam-v2beta/pom.xml +++ b/proto-google-iam-v2beta/pom.xml @@ -21,6 +21,18 @@ 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 + From 9a9b7d7713543cbc5899881d16b0ef9eb5ba17ea Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Tue, 13 Sep 2022 19:24:33 +0000 Subject: [PATCH 6/8] chore: revert changes to proto-google-iam-v2beta/pom.xml --- proto-google-iam-v2beta/pom.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/proto-google-iam-v2beta/pom.xml b/proto-google-iam-v2beta/pom.xml index 06e5941d..d2d43f45 100644 --- a/proto-google-iam-v2beta/pom.xml +++ b/proto-google-iam-v2beta/pom.xml @@ -21,18 +21,6 @@ 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 - From b25da9110b58ad972cda23262536399713fe4435 Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Wed, 14 Sep 2022 02:19:05 +0000 Subject: [PATCH 7/8] fix --- grpc-google-iam-v2/pom.xml | 2 +- proto-google-iam-v2/pom.xml | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/grpc-google-iam-v2/pom.xml b/grpc-google-iam-v2/pom.xml index 6b0d3cf2..25ca35fc 100644 --- a/grpc-google-iam-v2/pom.xml +++ b/grpc-google-iam-v2/pom.xml @@ -6,7 +6,7 @@ grpc-google-iam-v2 1.5.3-SNAPSHOT grpc-google-iam-v2 - GRPC library for proto-google-iam-v1 + GRPC library for proto-google-iam-v2 com.google.cloud google-iam-parent diff --git a/proto-google-iam-v2/pom.xml b/proto-google-iam-v2/pom.xml index c01e4420..55b0666e 100644 --- a/proto-google-iam-v2/pom.xml +++ b/proto-google-iam-v2/pom.xml @@ -21,18 +21,6 @@ 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 - From 909ae7d30587fc6ef3d3fcb5621d6fc79c4b37a0 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 14 Sep 2022 02:22:10 +0000 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .github/CODEOWNERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 30fdb7b9..db2d8ad1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,3 +8,6 @@ # The java-samples-reviewers team is the default owner for samples changes samples/**/*.java @googleapis/java-samples-reviewers + +# Generated snippets should not be owned by samples reviewers +samples/snippets/generated/ @googleapis/yoshi-java