diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index 683ca1d7..b7d331d4 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -33,3 +33,5 @@ deep-copy-regex: 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 diff --git a/.repo-metadata.json b/.repo-metadata.json index bb9e05ae..c8064171 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -12,6 +12,6 @@ "repo_short": "java-iam", "library_type": "OTHER", "distribution_name": "com.google.api.grpc:proto-google-iam-v1", - "excluded_poms": "proto-google-iam-v1-bom", + "excluded_poms": "proto-google-iam-v1-bom,google-iam-policy,proto-google-iam-v1", "excluded_dependencies": "grpc-google-iam-v1" } diff --git a/google-iam-policy/pom.xml b/google-iam-policy/pom.xml new file mode 100644 index 00000000..bae1eb08 --- /dev/null +++ b/google-iam-policy/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + com.google.cloud + google-iam-policy + 1.4.2-SNAPSHOT + jar + Google IAM Policy + https://github.com/googleapis/java-eventarc + Eventarc lets you asynchronously deliver events from Google services, SaaS, and your own apps using loosely coupled services that react to state changes. + + com.google.cloud + google-iam-parent + 1.4.2-SNAPSHOT + + + google-iam-policy + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-iam-v2beta + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + + + junit + junit + test + 4.13.2 + + + + com.google.api.grpc + grpc-google-iam-v2beta + test + + + + com.google.api + gax-grpc + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/google-iam-policy/src/main/java/com/google/iam/v2beta/PoliciesClient.java b/google-iam-policy/src/main/java/com/google/iam/v2beta/PoliciesClient.java new file mode 100644 index 00000000..582c71e4 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2beta/PoliciesClient.java @@ -0,0 +1,865 @@ +/* + * 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.v2beta; + +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.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.v2beta.stub.PoliciesStub; +import com.google.iam.v2beta.stub.PoliciesStubSettings; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +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 for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ *   PolicyName name = PolicyName.of("[POLICY]");
+ *   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 for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * 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 for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * PoliciesSettings policiesSettings =
+ *     PoliciesSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * PoliciesClient policiesClient = PoliciesClient.create(policiesSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class PoliciesClient implements BackgroundResource { + private final PoliciesSettings settings; + private final PoliciesStub stub; + private final 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 = OperationsClient.create(this.stub.getOperationsStub()); + } + + protected PoliciesClient(PoliciesStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + 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 OperationsClient getOperationsClient() { + return operationsClient; + } + + // 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   PolicyName name = PolicyName.of("[POLICY]");
+   *   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(PolicyName name) { + GetPolicyRequest request = + GetPolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   String name = PolicyName.of("[POLICY]").toString();
+   *   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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   GetPolicyRequest request =
+   *       GetPolicyRequest.newBuilder().setName(PolicyName.of("[POLICY]").toString()).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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   GetPolicyRequest request =
+   *       GetPolicyRequest.newBuilder().setName(PolicyName.of("[POLICY]").toString()).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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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.v2beta.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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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.v2beta.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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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.v2beta.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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * 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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   PolicyName name = PolicyName.of("[POLICY]");
+   *   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(PolicyName name) { + DeletePolicyRequest request = + DeletePolicyRequest.newBuilder().setName(name == null ? null : name.toString()).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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   String name = PolicyName.of("[POLICY]").toString();
+   *   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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   DeletePolicyRequest request =
+   *       DeletePolicyRequest.newBuilder()
+   *           .setName(PolicyName.of("[POLICY]").toString())
+   *           .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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   DeletePolicyRequest request =
+   *       DeletePolicyRequest.newBuilder()
+   *           .setName(PolicyName.of("[POLICY]").toString())
+   *           .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 for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+   *   DeletePolicyRequest request =
+   *       DeletePolicyRequest.newBuilder()
+   *           .setName(PolicyName.of("[POLICY]").toString())
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = policiesClient.deletePolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deletePolicyCallable() { + return stub.deletePolicyCallable(); + } + + @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); + } + } +} diff --git a/google-iam-policy/src/main/java/com/google/iam/v2beta/PoliciesSettings.java b/google-iam-policy/src/main/java/com/google/iam/v2beta/PoliciesSettings.java new file mode 100644 index 00000000..82677a3f --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2beta/PoliciesSettings.java @@ -0,0 +1,266 @@ +/* + * 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.v2beta; + +import static com.google.iam.v2beta.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.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.v2beta.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 for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * PoliciesSettings.Builder policiesSettingsBuilder = PoliciesSettings.newBuilder();
+ * policiesSettingsBuilder
+ *     .getPolicySettings()
+ *     .setRetrySettings(
+ *         policiesSettingsBuilder
+ *             .getPolicySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * PoliciesSettings policiesSettings = policiesSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@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(); + } + + 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 ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return PoliciesStubSettings.defaultGrpcTransportProviderBuilder(); + } + + 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 builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** 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()); + } + + 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(); + } + + @Override + public PoliciesSettings build() throws IOException { + return new PoliciesSettings(this); + } + } +} diff --git a/google-iam-policy/src/main/java/com/google/iam/v2beta/gapic_metadata.json b/google-iam-policy/src/main/java/com/google/iam/v2beta/gapic_metadata.json new file mode 100644 index 00000000..a68bf924 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2beta/gapic_metadata.json @@ -0,0 +1,33 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.iam.v2beta", + "libraryPackage": "com.google.iam.v2beta", + "services": { + "Policies": { + "clients": { + "grpc": { + "libraryClient": "PoliciesClient", + "rpcs": { + "CreatePolicy": { + "methods": ["createPolicyAsync", "createPolicyAsync", "createPolicyOperationCallable", "createPolicyCallable"] + }, + "DeletePolicy": { + "methods": ["deletePolicyAsync", "deletePolicyAsync", "deletePolicyAsync", "deletePolicyOperationCallable", "deletePolicyCallable"] + }, + "GetPolicy": { + "methods": ["getPolicy", "getPolicy", "getPolicy", "getPolicyCallable"] + }, + "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/v2beta/package-info.java b/google-iam-policy/src/main/java/com/google/iam/v2beta/package-info.java new file mode 100644 index 00000000..1a342b28 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2beta/package-info.java @@ -0,0 +1,40 @@ +/* + * 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 for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ *   PolicyName name = PolicyName.of("[POLICY]");
+ *   Policy response = policiesClient.getPolicy(name);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.iam.v2beta; + +import javax.annotation.Generated; diff --git a/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/GrpcPoliciesCallableFactory.java b/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/GrpcPoliciesCallableFactory.java new file mode 100644 index 00000000..d2ee2059 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/GrpcPoliciesCallableFactory.java @@ -0,0 +1,115 @@ +/* + * 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.v2beta.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +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. + */ +@BetaApi +@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/v2beta/stub/GrpcPoliciesStub.java b/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/GrpcPoliciesStub.java new file mode 100644 index 00000000..0e139631 --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/GrpcPoliciesStub.java @@ -0,0 +1,332 @@ +/* + * 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.v2beta.stub; + +import static com.google.iam.v2beta.PoliciesClient.ListPoliciesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +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.v2beta.CreatePolicyRequest; +import com.google.iam.v2beta.DeletePolicyRequest; +import com.google.iam.v2beta.GetPolicyRequest; +import com.google.iam.v2beta.ListPoliciesRequest; +import com.google.iam.v2beta.ListPoliciesResponse; +import com.google.iam.v2beta.Policy; +import com.google.iam.v2beta.PolicyOperationMetadata; +import com.google.iam.v2beta.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. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcPoliciesStub extends PoliciesStub { + private static final MethodDescriptor + listPoliciesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.Policies/DeletePolicy") + .setRequestMarshaller(ProtoUtils.marshaller(DeletePolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.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 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(); + + 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.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 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/v2beta/stub/PoliciesStub.java b/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/PoliciesStub.java new file mode 100644 index 00000000..9b6fcaff --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/PoliciesStub.java @@ -0,0 +1,92 @@ +/* + * 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.v2beta.stub; + +import static com.google.iam.v2beta.PoliciesClient.ListPoliciesPagedResponse; + +import com.google.api.core.BetaApi; +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.v2beta.CreatePolicyRequest; +import com.google.iam.v2beta.DeletePolicyRequest; +import com.google.iam.v2beta.GetPolicyRequest; +import com.google.iam.v2beta.ListPoliciesRequest; +import com.google.iam.v2beta.ListPoliciesResponse; +import com.google.iam.v2beta.Policy; +import com.google.iam.v2beta.PolicyOperationMetadata; +import com.google.iam.v2beta.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. + */ +@BetaApi +@Generated("by gapic-generator-java") +public abstract class PoliciesStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + } + + 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()"); + } + + @Override + public abstract void close(); +} diff --git a/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/PoliciesStubSettings.java b/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/PoliciesStubSettings.java new file mode 100644 index 00000000..ce17087d --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2beta/stub/PoliciesStubSettings.java @@ -0,0 +1,582 @@ +/* + * 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.v2beta.stub; + +import static com.google.iam.v2beta.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.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.v2beta.CreatePolicyRequest; +import com.google.iam.v2beta.DeletePolicyRequest; +import com.google.iam.v2beta.GetPolicyRequest; +import com.google.iam.v2beta.ListPoliciesRequest; +import com.google.iam.v2beta.ListPoliciesResponse; +import com.google.iam.v2beta.Policy; +import com.google.iam.v2beta.PolicyOperationMetadata; +import com.google.iam.v2beta.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 for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * PoliciesStubSettings.Builder policiesSettingsBuilder = PoliciesStubSettings.newBuilder();
+ * policiesSettingsBuilder
+ *     .getPolicySettings()
+ *     .setRetrySettings(
+ *         policiesSettingsBuilder
+ *             .getPolicySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * PoliciesStubSettings policiesSettings = policiesSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@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 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 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); + } + }; + + /** 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; + } + + public PoliciesStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcPoliciesStub.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 ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + 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 defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(PoliciesStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** 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(); + } + + /** 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 static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(10000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + 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(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listPoliciesSettings, + getPolicySettings, + createPolicySettings, + updatePolicySettings, + deletePolicySettings); + 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(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listPoliciesSettings, + getPolicySettings, + createPolicySettings, + updatePolicySettings, + deletePolicySettings); + } + + 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 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 + .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; + } + + @Override + public PoliciesStubSettings build() throws IOException { + return new PoliciesStubSettings(this); + } + } +} diff --git a/google-iam-policy/src/test/java/com/google/iam/v2beta/MockPolicies.java b/google-iam-policy/src/test/java/com/google/iam/v2beta/MockPolicies.java new file mode 100644 index 00000000..d68e4921 --- /dev/null +++ b/google-iam-policy/src/test/java/com/google/iam/v2beta/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.v2beta; + +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/v2beta/MockPoliciesImpl.java b/google-iam-policy/src/test/java/com/google/iam/v2beta/MockPoliciesImpl.java new file mode 100644 index 00000000..645a7a86 --- /dev/null +++ b/google-iam-policy/src/test/java/com/google/iam/v2beta/MockPoliciesImpl.java @@ -0,0 +1,165 @@ +/* + * 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.v2beta; + +import com.google.api.core.BetaApi; +import com.google.iam.v2beta.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()))); + } + } +} diff --git a/google-iam-policy/src/test/java/com/google/iam/v2beta/PoliciesClientTest.java b/google-iam-policy/src/test/java/com/google/iam/v2beta/PoliciesClientTest.java new file mode 100644 index 00000000..419e7677 --- /dev/null +++ b/google-iam-policy/src/test/java/com/google/iam/v2beta/PoliciesClientTest.java @@ -0,0 +1,453 @@ +/* + * 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.v2beta; + +import static com.google.iam.v2beta.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(PolicyName.of("[POLICY]").toString()) + .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()) + .build(); + mockPolicies.addResponse(expectedResponse); + + PolicyName name = PolicyName.of("[POLICY]"); + + 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.toString(), 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 { + PolicyName name = PolicyName.of("[POLICY]"); + client.getPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName(PolicyName.of("[POLICY]").toString()) + .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()) + .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 getPolicyExceptionTest2() 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(PolicyName.of("[POLICY]").toString()) + .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()) + .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(PolicyName.of("[POLICY]").toString()) + .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()) + .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(PolicyName.of("[POLICY]").toString()) + .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()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deletePolicyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockPolicies.addResponse(resultOperation); + + PolicyName name = PolicyName.of("[POLICY]"); + + 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.toString(), 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 { + PolicyName name = PolicyName.of("[POLICY]"); + 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 deletePolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName(PolicyName.of("[POLICY]").toString()) + .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()) + .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 deletePolicyExceptionTest2() 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()); + } + } +} diff --git a/grpc-google-iam-v2beta/pom.xml b/grpc-google-iam-v2beta/pom.xml new file mode 100644 index 00000000..4bcdd27a --- /dev/null +++ b/grpc-google-iam-v2beta/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-iam-v2beta + 1.4.2-SNAPSHOT + grpc-google-iam-v2beta + GRPC library for proto-google-iam-v1 + + com.google.cloud + google-iam-parent + 1.4.2-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-v2beta + + + 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-v2beta/src/main/java/com/google/iam/v2beta/PoliciesGrpc.java b/grpc-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PoliciesGrpc.java new file mode 100644 index 00000000..57458d9e --- /dev/null +++ b/grpc-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PoliciesGrpc.java @@ -0,0 +1,815 @@ +/* + * 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.v2beta; + +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/v2beta/policy.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class PoliciesGrpc { + + private PoliciesGrpc() {} + + public static final String SERVICE_NAME = "google.iam.v2beta.Policies"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2beta.ListPoliciesRequest, com.google.iam.v2beta.ListPoliciesResponse> + getListPoliciesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListPolicies", + requestType = com.google.iam.v2beta.ListPoliciesRequest.class, + responseType = com.google.iam.v2beta.ListPoliciesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2beta.ListPoliciesRequest, com.google.iam.v2beta.ListPoliciesResponse> + getListPoliciesMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2beta.ListPoliciesRequest, com.google.iam.v2beta.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.v2beta.ListPoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2beta.ListPoliciesResponse.getDefaultInstance())) + .setSchemaDescriptor(new PoliciesMethodDescriptorSupplier("ListPolicies")) + .build(); + } + } + } + return getListPoliciesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2beta.GetPolicyRequest, com.google.iam.v2beta.Policy> + getGetPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetPolicy", + requestType = com.google.iam.v2beta.GetPolicyRequest.class, + responseType = com.google.iam.v2beta.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2beta.GetPolicyRequest, com.google.iam.v2beta.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.v2beta.GetPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v2beta.Policy.getDefaultInstance())) + .setSchemaDescriptor(new PoliciesMethodDescriptorSupplier("GetPolicy")) + .build(); + } + } + } + return getGetPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v2beta.CreatePolicyRequest, com.google.longrunning.Operation> + getCreatePolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreatePolicy", + requestType = com.google.iam.v2beta.CreatePolicyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2beta.CreatePolicyRequest, com.google.longrunning.Operation> + getCreatePolicyMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2beta.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.v2beta.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.v2beta.UpdatePolicyRequest, com.google.longrunning.Operation> + getUpdatePolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdatePolicy", + requestType = com.google.iam.v2beta.UpdatePolicyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2beta.UpdatePolicyRequest, com.google.longrunning.Operation> + getUpdatePolicyMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2beta.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.v2beta.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.v2beta.DeletePolicyRequest, com.google.longrunning.Operation> + getDeletePolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeletePolicy", + requestType = com.google.iam.v2beta.DeletePolicyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v2beta.DeletePolicyRequest, com.google.longrunning.Operation> + getDeletePolicyMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v2beta.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.v2beta.DeletePolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new PoliciesMethodDescriptorSupplier("DeletePolicy")) + .build(); + } + } + } + return getDeletePolicyMethod; + } + + /** 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.v2beta.ListPoliciesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListPoliciesMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets a policy.
+     * 
+ */ + public void getPolicy( + com.google.iam.v2beta.GetPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Creates a policy.
+     * 
+ */ + public void createPolicy( + com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.DeletePolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeletePolicyMethod(), 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.v2beta.ListPoliciesRequest, + com.google.iam.v2beta.ListPoliciesResponse>(this, METHODID_LIST_POLICIES))) + .addMethod( + getGetPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2beta.GetPolicyRequest, com.google.iam.v2beta.Policy>( + this, METHODID_GET_POLICY))) + .addMethod( + getCreatePolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2beta.CreatePolicyRequest, com.google.longrunning.Operation>( + this, METHODID_CREATE_POLICY))) + .addMethod( + getUpdatePolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2beta.UpdatePolicyRequest, com.google.longrunning.Operation>( + this, METHODID_UPDATE_POLICY))) + .addMethod( + getDeletePolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v2beta.DeletePolicyRequest, com.google.longrunning.Operation>( + this, METHODID_DELETE_POLICY))) + .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.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.DeletePolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeletePolicyMethod(), 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.v2beta.ListPoliciesResponse listPolicies( + com.google.iam.v2beta.ListPoliciesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListPoliciesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets a policy.
+     * 
+ */ + public com.google.iam.v2beta.Policy getPolicy(com.google.iam.v2beta.GetPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates a policy.
+     * 
+ */ + public com.google.longrunning.Operation createPolicy( + com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.DeletePolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeletePolicyMethod(), 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.v2beta.ListPoliciesResponse> + listPolicies(com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.DeletePolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeletePolicyMethod(), 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 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.v2beta.ListPoliciesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_POLICY: + serviceImpl.getPolicy( + (com.google.iam.v2beta.GetPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_POLICY: + serviceImpl.createPolicy( + (com.google.iam.v2beta.CreatePolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_POLICY: + serviceImpl.updatePolicy( + (com.google.iam.v2beta.UpdatePolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_POLICY: + serviceImpl.deletePolicy( + (com.google.iam.v2beta.DeletePolicyRequest) 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.v2beta.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()) + .build(); + } + } + } + return result; + } +} diff --git a/pom.xml b/pom.xml index 33c1f6c4..82587543 100644 --- a/pom.xml +++ b/pom.xml @@ -74,6 +74,26 @@ pom import + + com.google.cloud + google-iam-policy + 1.4.2-SNAPSHOT + + + com.google.api.grpc + proto-google-iam-v2beta + 1.4.2-SNAPSHOT + + + com.google.api.grpc + grpc-google-iam-v1 + 1.4.2-SNAPSHOT + + + com.google.api.grpc + grpc-google-iam-v2beta + 1.4.2-SNAPSHOT + com.google.api.grpc proto-google-iam-v1 @@ -91,7 +111,10 @@ proto-google-iam-v1 + grpc-google-iam-v2beta + proto-google-iam-v2beta grpc-google-iam-v1 + google-iam-policy diff --git a/proto-google-iam-v1/pom.xml b/proto-google-iam-v1/pom.xml index b414d0a2..120c3702 100644 --- a/proto-google-iam-v1/pom.xml +++ b/proto-google-iam-v1/pom.xml @@ -21,7 +21,6 @@ proto-google-common-protos - diff --git a/proto-google-iam-v2beta/clirr-ignored-differences.xml b/proto-google-iam-v2beta/clirr-ignored-differences.xml new file mode 100644 index 00000000..136c027b --- /dev/null +++ b/proto-google-iam-v2beta/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/iam/v2beta/*OrBuilder + * get*(*) + + + 7012 + com/google/iam/v2beta/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/iam/v2beta/*OrBuilder + boolean has*(*) + + diff --git a/proto-google-iam-v2beta/pom.xml b/proto-google-iam-v2beta/pom.xml new file mode 100644 index 00000000..3a2b037b --- /dev/null +++ b/proto-google-iam-v2beta/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + com.google.api.grpc + proto-google-iam-v2beta + 1.4.2-SNAPSHOT + proto-google-iam-v2beta + Proto library for proto-google-iam-v1 + + com.google.cloud + google-iam-parent + 1.4.2-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/CreatePolicyRequest.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/CreatePolicyRequest.java new file mode 100644 index 00000000..dc8b15da --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/CreatePolicyRequest.java @@ -0,0 +1,1152 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * Request message for `CreatePolicy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.CreatePolicyRequest} + */ +public final class CreatePolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.Policy.Builder subBuilder = null; + if (policy_ != null) { + subBuilder = policy_.toBuilder(); + } + policy_ = input.readMessage(com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_CreatePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_CreatePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.CreatePolicyRequest.class, + com.google.iam.v2beta.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.v2beta.Policy policy_; + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2beta.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.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + @java.lang.Override + public com.google.iam.v2beta.Policy getPolicy() { + return policy_ == null ? com.google.iam.v2beta.Policy.getDefaultInstance() : policy_; + } + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.iam.v2beta.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.v2beta.CreatePolicyRequest)) { + return super.equals(obj); + } + com.google.iam.v2beta.CreatePolicyRequest other = + (com.google.iam.v2beta.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.v2beta.CreatePolicyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.CreatePolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.CreatePolicyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.CreatePolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.CreatePolicyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.CreatePolicyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.CreatePolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.CreatePolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.CreatePolicyRequest) + com.google.iam.v2beta.CreatePolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_CreatePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_CreatePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.CreatePolicyRequest.class, + com.google.iam.v2beta.CreatePolicyRequest.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_CreatePolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.CreatePolicyRequest getDefaultInstanceForType() { + return com.google.iam.v2beta.CreatePolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.CreatePolicyRequest build() { + com.google.iam.v2beta.CreatePolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.CreatePolicyRequest buildPartial() { + com.google.iam.v2beta.CreatePolicyRequest result = + new com.google.iam.v2beta.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.v2beta.CreatePolicyRequest) { + return mergeFrom((com.google.iam.v2beta.CreatePolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.CreatePolicyRequest other) { + if (other == com.google.iam.v2beta.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.v2beta.CreatePolicyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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.v2beta.Policy policy_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.PolicyOrBuilder> + policyBuilder_; + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2beta.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.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + public com.google.iam.v2beta.Policy getPolicy() { + if (policyBuilder_ == null) { + return policy_ == null ? com.google.iam.v2beta.Policy.getDefaultInstance() : policy_; + } else { + return policyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPolicy(com.google.iam.v2beta.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.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPolicy(com.google.iam.v2beta.Policy.Builder builderForValue) { + if (policyBuilder_ == null) { + policy_ = builderForValue.build(); + onChanged(); + } else { + policyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergePolicy(com.google.iam.v2beta.Policy value) { + if (policyBuilder_ == null) { + if (policy_ != null) { + policy_ = + com.google.iam.v2beta.Policy.newBuilder(policy_).mergeFrom(value).buildPartial(); + } else { + policy_ = value; + } + onChanged(); + } else { + policyBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2beta.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.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.iam.v2beta.Policy.Builder getPolicyBuilder() { + + onChanged(); + return getPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.iam.v2beta.PolicyOrBuilder getPolicyOrBuilder() { + if (policyBuilder_ != null) { + return policyBuilder_.getMessageOrBuilder(); + } else { + return policy_ == null ? com.google.iam.v2beta.Policy.getDefaultInstance() : policy_; + } + } + /** + * + * + *
+     * Required. The policy to create.
+     * 
+ * + * .google.iam.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.PolicyOrBuilder> + getPolicyFieldBuilder() { + if (policyBuilder_ == null) { + policyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.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.v2beta.CreatePolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.CreatePolicyRequest) + private static final com.google.iam.v2beta.CreatePolicyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.CreatePolicyRequest(); + } + + public static com.google.iam.v2beta.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.v2beta.CreatePolicyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/CreatePolicyRequestOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/CreatePolicyRequestOrBuilder.java new file mode 100644 index 00000000..24c4fc2f --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface CreatePolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.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.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the policy field is set. + */ + boolean hasPolicy(); + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + com.google.iam.v2beta.Policy getPolicy(); + /** + * + * + *
+   * Required. The policy to create.
+   * 
+ * + * .google.iam.v2beta.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.iam.v2beta.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-v2beta/src/main/java/com/google/iam/v2beta/DeletePolicyRequest.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DeletePolicyRequest.java new file mode 100644 index 00000000..a89ed24d --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DeletePolicyRequest.java @@ -0,0 +1,899 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * Request message for `DeletePolicy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.DeletePolicyRequest} + */ +public final class DeletePolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_DeletePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_DeletePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.DeletePolicyRequest.class, + com.google.iam.v2beta.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, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + 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.v2beta.DeletePolicyRequest)) { + return super.equals(obj); + } + com.google.iam.v2beta.DeletePolicyRequest other = + (com.google.iam.v2beta.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.v2beta.DeletePolicyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.DeletePolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.DeletePolicyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.DeletePolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.DeletePolicyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.DeletePolicyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.DeletePolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.DeletePolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.DeletePolicyRequest) + com.google.iam.v2beta.DeletePolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_DeletePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_DeletePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.DeletePolicyRequest.class, + com.google.iam.v2beta.DeletePolicyRequest.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_DeletePolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.DeletePolicyRequest getDefaultInstanceForType() { + return com.google.iam.v2beta.DeletePolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.DeletePolicyRequest build() { + com.google.iam.v2beta.DeletePolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.DeletePolicyRequest buildPartial() { + com.google.iam.v2beta.DeletePolicyRequest result = + new com.google.iam.v2beta.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.v2beta.DeletePolicyRequest) { + return mergeFrom((com.google.iam.v2beta.DeletePolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.DeletePolicyRequest other) { + if (other == com.google.iam.v2beta.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.v2beta.DeletePolicyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. 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, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. 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, (.google.api.resource_reference) = { ... } + * + * + * @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, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + 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.v2beta.DeletePolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.DeletePolicyRequest) + private static final com.google.iam.v2beta.DeletePolicyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.DeletePolicyRequest(); + } + + public static com.google.iam.v2beta.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.v2beta.DeletePolicyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DeletePolicyRequestOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DeletePolicyRequestOrBuilder.java new file mode 100644 index 00000000..265e0906 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DeletePolicyRequestOrBuilder.java @@ -0,0 +1,99 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface DeletePolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.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, (.google.api.resource_reference) = { ... } + * + * + * @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, (.google.api.resource_reference) = { ... } + * + * + * @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-v2beta/src/main/java/com/google/iam/v2beta/DenyRule.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DenyRule.java new file mode 100644 index 00000000..45707bd1 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DenyRule.java @@ -0,0 +1,2508 @@ +/* + * 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/v2beta/deny.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * A deny rule in an IAM deny policy.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.DenyRule} + */ +public final class DenyRule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.DenyRuleProto + .internal_static_google_iam_v2beta_DenyRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.DenyRuleProto + .internal_static_google_iam_v2beta_DenyRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.DenyRule.class, com.google.iam.v2beta.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 user who 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 user who 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 user who 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 user who 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.v2beta.DenyRule)) { + return super.equals(obj); + } + com.google.iam.v2beta.DenyRule other = (com.google.iam.v2beta.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.v2beta.DenyRule parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.DenyRule parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.DenyRule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.DenyRule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.DenyRule parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.DenyRule parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.DenyRule parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.DenyRule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.DenyRule) + com.google.iam.v2beta.DenyRuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.DenyRuleProto + .internal_static_google_iam_v2beta_DenyRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.DenyRuleProto + .internal_static_google_iam_v2beta_DenyRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.DenyRule.class, com.google.iam.v2beta.DenyRule.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.DenyRuleProto + .internal_static_google_iam_v2beta_DenyRule_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.DenyRule getDefaultInstanceForType() { + return com.google.iam.v2beta.DenyRule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.DenyRule build() { + com.google.iam.v2beta.DenyRule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.DenyRule buildPartial() { + com.google.iam.v2beta.DenyRule result = new com.google.iam.v2beta.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.v2beta.DenyRule) { + return mergeFrom((com.google.iam.v2beta.DenyRule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.DenyRule other) { + if (other == com.google.iam.v2beta.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.v2beta.DenyRule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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 user who 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 user who 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 user who 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 user who 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 user who 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 user who 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 user who 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 user who 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 user who 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.v2beta.DenyRule) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.DenyRule) + private static final com.google.iam.v2beta.DenyRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.DenyRule(); + } + + public static com.google.iam.v2beta.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.v2beta.DenyRule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DenyRuleOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DenyRuleOrBuilder.java new file mode 100644 index 00000000..1e318bc7 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/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/v2beta/deny.proto + +package com.google.iam.v2beta; + +public interface DenyRuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.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 user who 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 user who 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 user who 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 user who 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-v2beta/src/main/java/com/google/iam/v2beta/DenyRuleProto.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/DenyRuleProto.java new file mode 100644 index 00000000..9aa4e3a5 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/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/v2beta/deny.proto + +package com.google.iam.v2beta; + +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_v2beta_DenyRule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_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\034google/iam/v2beta/deny.proto\022\021google.i" + + "am.v2beta\032\026google/type/expr.proto\"\253\001\n\010De" + + "nyRule\022\031\n\021denied_principals\030\001 \003(\t\022\034\n\024exc" + + "eption_principals\030\002 \003(\t\022\032\n\022denied_permis" + + "sions\030\003 \003(\t\022\035\n\025exception_permissions\030\004 \003" + + "(\t\022+\n\020denial_condition\030\005 \001(\0132\021.google.ty" + + "pe.ExprB^\n\025com.google.iam.v2betaB\rDenyRu" + + "leProtoP\001Z4google.golang.org/genproto/go" + + "ogleapis/iam/v2beta;iamb\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.type.ExprProto.getDescriptor(), + }); + internal_static_google_iam_v2beta_DenyRule_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_iam_v2beta_DenyRule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_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-v2beta/src/main/java/com/google/iam/v2beta/GetPolicyRequest.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/GetPolicyRequest.java new file mode 100644 index 00000000..e082377e --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/GetPolicyRequest.java @@ -0,0 +1,691 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * Request message for `GetPolicy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.GetPolicyRequest} + */ +public final class GetPolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_GetPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_GetPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.GetPolicyRequest.class, + com.google.iam.v2beta.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, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + 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.v2beta.GetPolicyRequest)) { + return super.equals(obj); + } + com.google.iam.v2beta.GetPolicyRequest other = (com.google.iam.v2beta.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.v2beta.GetPolicyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.GetPolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.GetPolicyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.GetPolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.GetPolicyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.GetPolicyRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.GetPolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.GetPolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.GetPolicyRequest) + com.google.iam.v2beta.GetPolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_GetPolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_GetPolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.GetPolicyRequest.class, + com.google.iam.v2beta.GetPolicyRequest.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_GetPolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.GetPolicyRequest getDefaultInstanceForType() { + return com.google.iam.v2beta.GetPolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.GetPolicyRequest build() { + com.google.iam.v2beta.GetPolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.GetPolicyRequest buildPartial() { + com.google.iam.v2beta.GetPolicyRequest result = + new com.google.iam.v2beta.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.v2beta.GetPolicyRequest) { + return mergeFrom((com.google.iam.v2beta.GetPolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.GetPolicyRequest other) { + if (other == com.google.iam.v2beta.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.v2beta.GetPolicyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. 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, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. 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, (.google.api.resource_reference) = { ... } + * + * + * @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, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.iam.v2beta.GetPolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.GetPolicyRequest) + private static final com.google.iam.v2beta.GetPolicyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.GetPolicyRequest(); + } + + public static com.google.iam.v2beta.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.v2beta.GetPolicyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/GetPolicyRequestOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/GetPolicyRequestOrBuilder.java new file mode 100644 index 00000000..483d9ef3 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/GetPolicyRequestOrBuilder.java @@ -0,0 +1,66 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface GetPolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.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, (.google.api.resource_reference) = { ... } + * + * + * @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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesRequest.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesRequest.java new file mode 100644 index 00000000..5f6f150c --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesRequest.java @@ -0,0 +1,972 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * Request message for `ListPolicies`.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.ListPoliciesRequest} + */ +public final class ListPoliciesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.ListPoliciesRequest.class, + com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.ListPoliciesRequest)) { + return super.equals(obj); + } + com.google.iam.v2beta.ListPoliciesRequest other = + (com.google.iam.v2beta.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.v2beta.ListPoliciesRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.ListPoliciesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.ListPoliciesRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.ListPoliciesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.ListPoliciesRequest) + com.google.iam.v2beta.ListPoliciesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.ListPoliciesRequest.class, + com.google.iam.v2beta.ListPoliciesRequest.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.ListPoliciesRequest getDefaultInstanceForType() { + return com.google.iam.v2beta.ListPoliciesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.ListPoliciesRequest build() { + com.google.iam.v2beta.ListPoliciesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.ListPoliciesRequest buildPartial() { + com.google.iam.v2beta.ListPoliciesRequest result = + new com.google.iam.v2beta.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.v2beta.ListPoliciesRequest) { + return mergeFrom((com.google.iam.v2beta.ListPoliciesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.ListPoliciesRequest other) { + if (other == com.google.iam.v2beta.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.v2beta.ListPoliciesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.ListPoliciesRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.ListPoliciesRequest) + private static final com.google.iam.v2beta.ListPoliciesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.ListPoliciesRequest(); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesRequestOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesRequestOrBuilder.java new file mode 100644 index 00000000..3090b502 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface ListPoliciesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.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.v2beta.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.v2beta.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-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesResponse.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesResponse.java new file mode 100644 index 00000000..68ede72d --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesResponse.java @@ -0,0 +1,1131 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * Response message for `ListPolicies`.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.ListPoliciesResponse} + */ +public final class ListPoliciesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.ListPoliciesResponse.class, + com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.Policy policies = 1; + */ + @java.lang.Override + public com.google.iam.v2beta.Policy getPolicies(int index) { + return policies_.get(index); + } + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + @java.lang.Override + public com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.ListPoliciesResponse)) { + return super.equals(obj); + } + com.google.iam.v2beta.ListPoliciesResponse other = + (com.google.iam.v2beta.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.v2beta.ListPoliciesResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.ListPoliciesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.ListPoliciesResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.ListPoliciesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.ListPoliciesResponse) + com.google.iam.v2beta.ListPoliciesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.ListPoliciesResponse.class, + com.google.iam.v2beta.ListPoliciesResponse.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_ListPoliciesResponse_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.ListPoliciesResponse getDefaultInstanceForType() { + return com.google.iam.v2beta.ListPoliciesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.ListPoliciesResponse build() { + com.google.iam.v2beta.ListPoliciesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.ListPoliciesResponse buildPartial() { + com.google.iam.v2beta.ListPoliciesResponse result = + new com.google.iam.v2beta.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.v2beta.ListPoliciesResponse) { + return mergeFrom((com.google.iam.v2beta.ListPoliciesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.ListPoliciesResponse other) { + if (other == com.google.iam.v2beta.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.v2beta.ListPoliciesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.PolicyOrBuilder> + policiesBuilder_; + + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2beta.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.v2beta.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.v2beta.Policy policies = 1; + */ + public com.google.iam.v2beta.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.v2beta.Policy policies = 1; + */ + public Builder setPolicies(int index, com.google.iam.v2beta.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.v2beta.Policy policies = 1; + */ + public Builder setPolicies(int index, com.google.iam.v2beta.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.v2beta.Policy policies = 1; + */ + public Builder addPolicies(com.google.iam.v2beta.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.v2beta.Policy policies = 1; + */ + public Builder addPolicies(int index, com.google.iam.v2beta.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.v2beta.Policy policies = 1; + */ + public Builder addPolicies(com.google.iam.v2beta.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.v2beta.Policy policies = 1; + */ + public Builder addPolicies(int index, com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.Policy policies = 1; + */ + public com.google.iam.v2beta.Policy.Builder getPoliciesBuilder(int index) { + return getPoliciesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + public com.google.iam.v2beta.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.v2beta.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.v2beta.Policy policies = 1; + */ + public com.google.iam.v2beta.Policy.Builder addPoliciesBuilder() { + return getPoliciesFieldBuilder() + .addBuilder(com.google.iam.v2beta.Policy.getDefaultInstance()); + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + public com.google.iam.v2beta.Policy.Builder addPoliciesBuilder(int index) { + return getPoliciesFieldBuilder() + .addBuilder(index, com.google.iam.v2beta.Policy.getDefaultInstance()); + } + /** + * + * + *
+     * Metadata for the policies that are attached to the resource.
+     * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + public java.util.List getPoliciesBuilderList() { + return getPoliciesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.PolicyOrBuilder> + getPoliciesFieldBuilder() { + if (policiesBuilder_ == null) { + policiesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.ListPoliciesResponse) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.ListPoliciesResponse) + private static final com.google.iam.v2beta.ListPoliciesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.ListPoliciesResponse(); + } + + public static com.google.iam.v2beta.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.v2beta.ListPoliciesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesResponseOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesResponseOrBuilder.java new file mode 100644 index 00000000..51d88d35 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/ListPoliciesResponseOrBuilder.java @@ -0,0 +1,103 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface ListPoliciesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.ListPoliciesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + java.util.List getPoliciesList(); + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + com.google.iam.v2beta.Policy getPolicies(int index); + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + int getPoliciesCount(); + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + java.util.List getPoliciesOrBuilderList(); + /** + * + * + *
+   * Metadata for the policies that are attached to the resource.
+   * 
+ * + * repeated .google.iam.v2beta.Policy policies = 1; + */ + com.google.iam.v2beta.PolicyOrBuilder getPoliciesOrBuilder(int index); + + /** + * + * + *
+   * A page token that you can use in a [ListPoliciesRequest][google.iam.v2beta.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.v2beta.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-v2beta/src/main/java/com/google/iam/v2beta/Policy.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/Policy.java new file mode 100644 index 00000000..08ae40c8 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/Policy.java @@ -0,0 +1,3171 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * Data for an IAM policy.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.Policy} + */ +public final class Policy extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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(); + } + + @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.v2beta.PolicyRule.parser(), extensionRegistry)); + 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.v2beta.PolicyProto.internal_static_google_iam_v2beta_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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_Policy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.Policy.class, com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_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.v2beta.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.v2beta.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.v2beta.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.v2beta.PolicyRule rules = 10; + */ + @java.lang.Override + public com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + @java.lang.Override + public com.google.iam.v2beta.PolicyRuleOrBuilder getRulesOrBuilder(int index) { + return rules_.get(index); + } + + 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)); + } + 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)); + } + 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.v2beta.Policy)) { + return super.equals(obj); + } + com.google.iam.v2beta.Policy other = (com.google.iam.v2beta.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 (!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 = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.iam.v2beta.Policy parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.Policy parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.Policy parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.Policy parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.Policy parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.Policy parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.Policy parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.Policy} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.Policy) + com.google.iam.v2beta.PolicyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto.internal_static_google_iam_v2beta_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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_Policy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.Policy.class, com.google.iam.v2beta.Policy.Builder.class); + } + + // Construct using com.google.iam.v2beta.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(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.iam.v2beta.PolicyProto.internal_static_google_iam_v2beta_Policy_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.Policy getDefaultInstanceForType() { + return com.google.iam.v2beta.Policy.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.Policy build() { + com.google.iam.v2beta.Policy result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.Policy buildPartial() { + com.google.iam.v2beta.Policy result = new com.google.iam.v2beta.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(); + } + 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.v2beta.Policy) { + return mergeFrom((com.google.iam.v2beta.Policy) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.Policy other) { + if (other == com.google.iam.v2beta.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_); + } + } + } + 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.v2beta.Policy parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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.v2beta.PolicyRule, + com.google.iam.v2beta.PolicyRule.Builder, + com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public Builder setRules(int index, com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public Builder setRules(int index, com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public Builder addRules(com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public Builder addRules(int index, com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public Builder addRules(com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public Builder addRules(int index, com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public com.google.iam.v2beta.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.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public com.google.iam.v2beta.PolicyRule.Builder addRulesBuilder() { + return getRulesFieldBuilder() + .addBuilder(com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public com.google.iam.v2beta.PolicyRule.Builder addRulesBuilder(int index) { + return getRulesFieldBuilder() + .addBuilder(index, com.google.iam.v2beta.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.v2beta.PolicyRule rules = 10; + */ + public java.util.List getRulesBuilderList() { + return getRulesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2beta.PolicyRule, + com.google.iam.v2beta.PolicyRule.Builder, + com.google.iam.v2beta.PolicyRuleOrBuilder> + getRulesFieldBuilder() { + if (rulesBuilder_ == null) { + rulesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.iam.v2beta.PolicyRule, + com.google.iam.v2beta.PolicyRule.Builder, + com.google.iam.v2beta.PolicyRuleOrBuilder>( + rules_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + rules_ = null; + } + return rulesBuilder_; + } + + @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.v2beta.Policy) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.Policy) + private static final com.google.iam.v2beta.Policy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.Policy(); + } + + public static com.google.iam.v2beta.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.v2beta.Policy getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyName.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyName.java new file mode 100644 index 00000000..15b7c14a --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyName.java @@ -0,0 +1,168 @@ +/* + * 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.v2beta; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class PolicyName implements ResourceName { + private static final PathTemplate POLICY = + PathTemplate.createWithoutUrlEncoding("policies/{policy}"); + private volatile Map fieldValuesMap; + private final String policy; + + @Deprecated + protected PolicyName() { + policy = null; + } + + private PolicyName(Builder builder) { + policy = Preconditions.checkNotNull(builder.getPolicy()); + } + + public String getPolicy() { + return policy; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static PolicyName of(String policy) { + return newBuilder().setPolicy(policy).build(); + } + + public static String format(String policy) { + return newBuilder().setPolicy(policy).build().toString(); + } + + public static PolicyName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + POLICY.validatedMatch( + formattedString, "PolicyName.parse: formattedString not in valid format"); + return of(matchMap.get("policy")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (PolicyName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return POLICY.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (policy != null) { + fieldMapBuilder.put("policy", policy); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return POLICY.instantiate("policy", policy); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + PolicyName that = ((PolicyName) o); + return Objects.equals(this.policy, that.policy); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(policy); + return h; + } + + /** Builder for policies/{policy}. */ + public static class Builder { + private String policy; + + protected Builder() {} + + public String getPolicy() { + return policy; + } + + public Builder setPolicy(String policy) { + this.policy = policy; + return this; + } + + private Builder(PolicyName policyName) { + this.policy = policyName.policy; + } + + public PolicyName build() { + return new PolicyName(this); + } + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyOperationMetadata.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyOperationMetadata.java new file mode 100644 index 00000000..c1bdb7b3 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * Metadata for long-running `Policy` operations.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.PolicyOperationMetadata} + */ +public final class PolicyOperationMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyOperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyOperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.PolicyOperationMetadata.class, + com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata)) { + return super.equals(obj); + } + com.google.iam.v2beta.PolicyOperationMetadata other = + (com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.PolicyOperationMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.PolicyOperationMetadata parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.PolicyOperationMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.PolicyOperationMetadata) + com.google.iam.v2beta.PolicyOperationMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyOperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyOperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.PolicyOperationMetadata.class, + com.google.iam.v2beta.PolicyOperationMetadata.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyOperationMetadata_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.PolicyOperationMetadata getDefaultInstanceForType() { + return com.google.iam.v2beta.PolicyOperationMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.PolicyOperationMetadata build() { + com.google.iam.v2beta.PolicyOperationMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.PolicyOperationMetadata buildPartial() { + com.google.iam.v2beta.PolicyOperationMetadata result = + new com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata) { + return mergeFrom((com.google.iam.v2beta.PolicyOperationMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.PolicyOperationMetadata other) { + if (other == com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.PolicyOperationMetadata) + private static final com.google.iam.v2beta.PolicyOperationMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.PolicyOperationMetadata(); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyOperationMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyOperationMetadataOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyOperationMetadataOrBuilder.java new file mode 100644 index 00000000..11fc1dca --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface PolicyOperationMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.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-v2beta/src/main/java/com/google/iam/v2beta/PolicyOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyOrBuilder.java new file mode 100644 index 00000000..fdfbab33 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyOrBuilder.java @@ -0,0 +1,412 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface PolicyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.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.v2beta.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.v2beta.PolicyRule rules = 10; + */ + com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.PolicyRule rules = 10; + */ + com.google.iam.v2beta.PolicyRuleOrBuilder getRulesOrBuilder(int index); +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyProto.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyProto.java new file mode 100644 index 00000000..de498bc2 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyProto.java @@ -0,0 +1,263 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +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_v2beta_Policy_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_Policy_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_Policy_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_Policy_AnnotationsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_PolicyRule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_PolicyRule_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_ListPoliciesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_ListPoliciesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_ListPoliciesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_ListPoliciesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_GetPolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_GetPolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_CreatePolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_CreatePolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_UpdatePolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_UpdatePolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_DeletePolicyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_DeletePolicyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_iam_v2beta_PolicyOperationMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_iam_v2beta_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\036google/iam/v2beta/policy.proto\022\021google" + + ".iam.v2beta\032\034google/api/annotations.prot" + + "o\032\027google/api/client.proto\032\037google/api/f" + + "ield_behavior.proto\032\031google/api/resource" + + ".proto\032\034google/iam/v2beta/deny.proto\032#go" + + "ogle/longrunning/operations.proto\032\037googl" + + "e/protobuf/timestamp.proto\"\334\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\004ki" + + "nd\030\003 \001(\tB\003\340A\003\022\024\n\014display_name\030\004 \001(\t\022?\n\013a" + + "nnotations\030\005 \003(\0132*.google.iam.v2beta.Pol" + + "icy.AnnotationsEntry\022\014\n\004etag\030\006 \001(\t\0224\n\013cr" + + "eate_time\030\007 \001(\0132\032.google.protobuf.Timest" + + "ampB\003\340A\003\0224\n\013update_time\030\010 \001(\0132\032.google.p" + + "rotobuf.TimestampB\003\340A\003\0224\n\013delete_time\030\t " + + "\001(\0132\032.google.protobuf.TimestampB\003\340A\003\022,\n\005" + + "rules\030\n \003(\0132\035.google.iam.v2beta.PolicyRu" + + "le\0322\n\020AnnotationsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005v" + + "alue\030\002 \001(\t:\0028\001:1\352A.\n\031iam.googleapis.com/" + + "Policy\022\021policies/{policy}\"[\n\nPolicyRule\022" + + "0\n\tdeny_rule\030\002 \001(\0132\033.google.iam.v2beta.D" + + "enyRuleH\000\022\023\n\013description\030\001 \001(\tB\006\n\004kind\"Q" + + "\n\023ListPoliciesRequest\022\023\n\006parent\030\001 \001(\tB\003\340" + + "A\002\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(" + + "\t\"\\\n\024ListPoliciesResponse\022+\n\010policies\030\001 " + + "\003(\0132\031.google.iam.v2beta.Policy\022\027\n\017next_p" + + "age_token\030\002 \001(\t\"C\n\020GetPolicyRequest\022/\n\004n" + + "ame\030\001 \001(\tB!\340A\002\372A\033\n\031iam.googleapis.com/Po" + + "licy\"m\n\023CreatePolicyRequest\022\023\n\006parent\030\001 " + + "\001(\tB\003\340A\002\022.\n\006policy\030\002 \001(\0132\031.google.iam.v2" + + "beta.PolicyB\003\340A\002\022\021\n\tpolicy_id\030\003 \001(\t\"E\n\023U" + + "pdatePolicyRequest\022.\n\006policy\030\001 \001(\0132\031.goo" + + "gle.iam.v2beta.PolicyB\003\340A\002\"Y\n\023DeletePoli" + + "cyRequest\022/\n\004name\030\001 \001(\tB!\340A\002\372A\033\n\031iam.goo" + + "gleapis.com/Policy\022\021\n\004etag\030\002 \001(\tB\003\340A\001\"J\n" + + "\027PolicyOperationMetadata\022/\n\013create_time\030" + + "\001 \001(\0132\032.google.protobuf.Timestamp2\200\007\n\010Po" + + "licies\022\217\001\n\014ListPolicies\022&.google.iam.v2b" + + "eta.ListPoliciesRequest\032\'.google.iam.v2b" + + "eta.ListPoliciesResponse\".\202\323\344\223\002\037\022\035/v2bet" + + "a/{parent=policies/*/*}\332A\006parent\022y\n\tGetP" + + "olicy\022#.google.iam.v2beta.GetPolicyReque" + + "st\032\031.google.iam.v2beta.Policy\",\202\323\344\223\002\037\022\035/" + + "v2beta/{name=policies/*/*/*}\332A\004name\022\302\001\n\014" + + "CreatePolicy\022&.google.iam.v2beta.CreateP" + + "olicyRequest\032\035.google.longrunning.Operat" + + "ion\"k\202\323\344\223\002\'\"\035/v2beta/{parent=policies/*/" + + "*}:\006policy\332A\027parent,policy,policy_id\312A!\n" + + "\006Policy\022\027PolicyOperationMetadata\022\257\001\n\014Upd" + + "atePolicy\022&.google.iam.v2beta.UpdatePoli" + + "cyRequest\032\035.google.longrunning.Operation" + + "\"X\202\323\344\223\002.\032$/v2beta/{policy.name=policies/" + + "*/*/*}:\006policy\312A!\n\006Policy\022\027PolicyOperati" + + "onMetadata\022\247\001\n\014DeletePolicy\022&.google.iam" + + ".v2beta.DeletePolicyRequest\032\035.google.lon" + + "grunning.Operation\"P\202\323\344\223\002\037*\035/v2beta/{nam" + + "e=policies/*/*/*}\332A\004name\312A!\n\006Policy\022\027Pol" + + "icyOperationMetadata\032F\312A\022iam.googleapis." + + "com\322A.https://www.googleapis.com/auth/cl" + + "oud-platformB\\\n\025com.google.iam.v2betaB\013P" + + "olicyProtoP\001Z4google.golang.org/genproto" + + "/googleapis/iam/v2beta;iamb\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.iam.v2beta.DenyRuleProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_iam_v2beta_Policy_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_google_iam_v2beta_Policy_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_Policy_descriptor, + new java.lang.String[] { + "Name", + "Uid", + "Kind", + "DisplayName", + "Annotations", + "Etag", + "CreateTime", + "UpdateTime", + "DeleteTime", + "Rules", + }); + internal_static_google_iam_v2beta_Policy_AnnotationsEntry_descriptor = + internal_static_google_iam_v2beta_Policy_descriptor.getNestedTypes().get(0); + internal_static_google_iam_v2beta_Policy_AnnotationsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_Policy_AnnotationsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_iam_v2beta_PolicyRule_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_iam_v2beta_PolicyRule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_PolicyRule_descriptor, + new java.lang.String[] { + "DenyRule", "Description", "Kind", + }); + internal_static_google_iam_v2beta_ListPoliciesRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_iam_v2beta_ListPoliciesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_ListPoliciesRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", + }); + internal_static_google_iam_v2beta_ListPoliciesResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_iam_v2beta_ListPoliciesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_ListPoliciesResponse_descriptor, + new java.lang.String[] { + "Policies", "NextPageToken", + }); + internal_static_google_iam_v2beta_GetPolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_iam_v2beta_GetPolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_GetPolicyRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_iam_v2beta_CreatePolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_iam_v2beta_CreatePolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_CreatePolicyRequest_descriptor, + new java.lang.String[] { + "Parent", "Policy", "PolicyId", + }); + internal_static_google_iam_v2beta_UpdatePolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_iam_v2beta_UpdatePolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_UpdatePolicyRequest_descriptor, + new java.lang.String[] { + "Policy", + }); + internal_static_google_iam_v2beta_DeletePolicyRequest_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_iam_v2beta_DeletePolicyRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_DeletePolicyRequest_descriptor, + new java.lang.String[] { + "Name", "Etag", + }); + internal_static_google_iam_v2beta_PolicyOperationMetadata_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_iam_v2beta_PolicyOperationMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_iam_v2beta_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.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + 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.api.ResourceProto.getDescriptor(); + com.google.iam.v2beta.DenyRuleProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyRule.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyRule.java new file mode 100644 index 00000000..d58b2590 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyRule.java @@ -0,0 +1,1012 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * A single rule in a `Policy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.PolicyRule} + */ +public final class PolicyRule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.DenyRule.Builder subBuilder = null; + if (kindCase_ == 2) { + subBuilder = ((com.google.iam.v2beta.DenyRule) kind_).toBuilder(); + } + kind_ = input.readMessage(com.google.iam.v2beta.DenyRule.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.PolicyRule.class, com.google.iam.v2beta.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.v2beta.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.v2beta.DenyRule deny_rule = 2; + * + * @return The denyRule. + */ + @java.lang.Override + public com.google.iam.v2beta.DenyRule getDenyRule() { + if (kindCase_ == 2) { + return (com.google.iam.v2beta.DenyRule) kind_; + } + return com.google.iam.v2beta.DenyRule.getDefaultInstance(); + } + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2beta.DenyRule deny_rule = 2; + */ + @java.lang.Override + public com.google.iam.v2beta.DenyRuleOrBuilder getDenyRuleOrBuilder() { + if (kindCase_ == 2) { + return (com.google.iam.v2beta.DenyRule) kind_; + } + return com.google.iam.v2beta.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.v2beta.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.v2beta.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.v2beta.PolicyRule)) { + return super.equals(obj); + } + com.google.iam.v2beta.PolicyRule other = (com.google.iam.v2beta.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.v2beta.PolicyRule parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyRule parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyRule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.PolicyRule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.PolicyRule parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyRule parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyRule parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.PolicyRule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.PolicyRule) + com.google.iam.v2beta.PolicyRuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.PolicyRule.class, + com.google.iam.v2beta.PolicyRule.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_PolicyRule_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.PolicyRule getDefaultInstanceForType() { + return com.google.iam.v2beta.PolicyRule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.PolicyRule build() { + com.google.iam.v2beta.PolicyRule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.PolicyRule buildPartial() { + com.google.iam.v2beta.PolicyRule result = new com.google.iam.v2beta.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.v2beta.PolicyRule) { + return mergeFrom((com.google.iam.v2beta.PolicyRule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.PolicyRule other) { + if (other == com.google.iam.v2beta.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.v2beta.PolicyRule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.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.v2beta.DenyRule, + com.google.iam.v2beta.DenyRule.Builder, + com.google.iam.v2beta.DenyRuleOrBuilder> + denyRuleBuilder_; + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2beta.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.v2beta.DenyRule deny_rule = 2; + * + * @return The denyRule. + */ + @java.lang.Override + public com.google.iam.v2beta.DenyRule getDenyRule() { + if (denyRuleBuilder_ == null) { + if (kindCase_ == 2) { + return (com.google.iam.v2beta.DenyRule) kind_; + } + return com.google.iam.v2beta.DenyRule.getDefaultInstance(); + } else { + if (kindCase_ == 2) { + return denyRuleBuilder_.getMessage(); + } + return com.google.iam.v2beta.DenyRule.getDefaultInstance(); + } + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2beta.DenyRule deny_rule = 2; + */ + public Builder setDenyRule(com.google.iam.v2beta.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.v2beta.DenyRule deny_rule = 2; + */ + public Builder setDenyRule(com.google.iam.v2beta.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.v2beta.DenyRule deny_rule = 2; + */ + public Builder mergeDenyRule(com.google.iam.v2beta.DenyRule value) { + if (denyRuleBuilder_ == null) { + if (kindCase_ == 2 && kind_ != com.google.iam.v2beta.DenyRule.getDefaultInstance()) { + kind_ = + com.google.iam.v2beta.DenyRule.newBuilder((com.google.iam.v2beta.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.v2beta.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.v2beta.DenyRule deny_rule = 2; + */ + public com.google.iam.v2beta.DenyRule.Builder getDenyRuleBuilder() { + return getDenyRuleFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2beta.DenyRule deny_rule = 2; + */ + @java.lang.Override + public com.google.iam.v2beta.DenyRuleOrBuilder getDenyRuleOrBuilder() { + if ((kindCase_ == 2) && (denyRuleBuilder_ != null)) { + return denyRuleBuilder_.getMessageOrBuilder(); + } else { + if (kindCase_ == 2) { + return (com.google.iam.v2beta.DenyRule) kind_; + } + return com.google.iam.v2beta.DenyRule.getDefaultInstance(); + } + } + /** + * + * + *
+     * A rule for a deny policy.
+     * 
+ * + * .google.iam.v2beta.DenyRule deny_rule = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2beta.DenyRule, + com.google.iam.v2beta.DenyRule.Builder, + com.google.iam.v2beta.DenyRuleOrBuilder> + getDenyRuleFieldBuilder() { + if (denyRuleBuilder_ == null) { + if (!(kindCase_ == 2)) { + kind_ = com.google.iam.v2beta.DenyRule.getDefaultInstance(); + } + denyRuleBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2beta.DenyRule, + com.google.iam.v2beta.DenyRule.Builder, + com.google.iam.v2beta.DenyRuleOrBuilder>( + (com.google.iam.v2beta.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.v2beta.PolicyRule) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.PolicyRule) + private static final com.google.iam.v2beta.PolicyRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.PolicyRule(); + } + + public static com.google.iam.v2beta.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.v2beta.PolicyRule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyRuleOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/PolicyRuleOrBuilder.java new file mode 100644 index 00000000..1c71f86b --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface PolicyRuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.PolicyRule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2beta.DenyRule deny_rule = 2; + * + * @return Whether the denyRule field is set. + */ + boolean hasDenyRule(); + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2beta.DenyRule deny_rule = 2; + * + * @return The denyRule. + */ + com.google.iam.v2beta.DenyRule getDenyRule(); + /** + * + * + *
+   * A rule for a deny policy.
+   * 
+ * + * .google.iam.v2beta.DenyRule deny_rule = 2; + */ + com.google.iam.v2beta.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.v2beta.PolicyRule.KindCase getKindCase(); +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/UpdatePolicyRequest.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/UpdatePolicyRequest.java new file mode 100644 index 00000000..5904fc84 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/UpdatePolicyRequest.java @@ -0,0 +1,759 @@ +/* + * 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/v2beta/policy.proto + +package com.google.iam.v2beta; + +/** + * + * + *
+ * Request message for `UpdatePolicy`.
+ * 
+ * + * Protobuf type {@code google.iam.v2beta.UpdatePolicyRequest} + */ +public final class UpdatePolicyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.iam.v2beta.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.v2beta.Policy.Builder subBuilder = null; + if (policy_ != null) { + subBuilder = policy_.toBuilder(); + } + policy_ = input.readMessage(com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_UpdatePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_UpdatePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.UpdatePolicyRequest.class, + com.google.iam.v2beta.UpdatePolicyRequest.Builder.class); + } + + public static final int POLICY_FIELD_NUMBER = 1; + private com.google.iam.v2beta.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.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + @java.lang.Override + public com.google.iam.v2beta.Policy getPolicy() { + return policy_ == null ? com.google.iam.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest)) { + return super.equals(obj); + } + com.google.iam.v2beta.UpdatePolicyRequest other = + (com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.iam.v2beta.UpdatePolicyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.iam.v2beta.UpdatePolicyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.iam.v2beta.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.v2beta.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.v2beta.UpdatePolicyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.iam.v2beta.UpdatePolicyRequest) + com.google.iam.v2beta.UpdatePolicyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_UpdatePolicyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.iam.v2beta.PolicyProto + .internal_static_google_iam_v2beta_UpdatePolicyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.iam.v2beta.UpdatePolicyRequest.class, + com.google.iam.v2beta.UpdatePolicyRequest.Builder.class); + } + + // Construct using com.google.iam.v2beta.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.v2beta.PolicyProto + .internal_static_google_iam_v2beta_UpdatePolicyRequest_descriptor; + } + + @java.lang.Override + public com.google.iam.v2beta.UpdatePolicyRequest getDefaultInstanceForType() { + return com.google.iam.v2beta.UpdatePolicyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.iam.v2beta.UpdatePolicyRequest build() { + com.google.iam.v2beta.UpdatePolicyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.iam.v2beta.UpdatePolicyRequest buildPartial() { + com.google.iam.v2beta.UpdatePolicyRequest result = + new com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest) { + return mergeFrom((com.google.iam.v2beta.UpdatePolicyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.iam.v2beta.UpdatePolicyRequest other) { + if (other == com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.iam.v2beta.UpdatePolicyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.iam.v2beta.Policy policy_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.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.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + public com.google.iam.v2beta.Policy getPolicy() { + if (policyBuilder_ == null) { + return policy_ == null ? com.google.iam.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPolicy(com.google.iam.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPolicy(com.google.iam.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergePolicy(com.google.iam.v2beta.Policy value) { + if (policyBuilder_ == null) { + if (policy_ != null) { + policy_ = + com.google.iam.v2beta.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.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.iam.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.iam.v2beta.PolicyOrBuilder getPolicyOrBuilder() { + if (policyBuilder_ != null) { + return policyBuilder_.getMessageOrBuilder(); + } else { + return policy_ == null ? com.google.iam.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.PolicyOrBuilder> + getPolicyFieldBuilder() { + if (policyBuilder_ == null) { + policyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v2beta.Policy, + com.google.iam.v2beta.Policy.Builder, + com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest) + } + + // @@protoc_insertion_point(class_scope:google.iam.v2beta.UpdatePolicyRequest) + private static final com.google.iam.v2beta.UpdatePolicyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.iam.v2beta.UpdatePolicyRequest(); + } + + public static com.google.iam.v2beta.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.v2beta.UpdatePolicyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/UpdatePolicyRequestOrBuilder.java b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/UpdatePolicyRequestOrBuilder.java new file mode 100644 index 00000000..ffbd2892 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/java/com/google/iam/v2beta/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/v2beta/policy.proto + +package com.google.iam.v2beta; + +public interface UpdatePolicyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.iam.v2beta.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.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The policy. + */ + com.google.iam.v2beta.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.v2beta.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.iam.v2beta.PolicyOrBuilder getPolicyOrBuilder(); +} diff --git a/proto-google-iam-v2beta/src/main/proto/google/iam/v2beta/deny.proto b/proto-google-iam-v2beta/src/main/proto/google/iam/v2beta/deny.proto new file mode 100644 index 00000000..74444927 --- /dev/null +++ b/proto-google-iam-v2beta/src/main/proto/google/iam/v2beta/deny.proto @@ -0,0 +1,107 @@ +// 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.v2beta; + +import "google/type/expr.proto"; + +option go_package = "google.golang.org/genproto/googleapis/iam/v2beta;iam"; +option java_multiple_files = true; +option java_outer_classname = "DenyRuleProto"; +option java_package = "com.google.iam.v2beta"; + +// 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 user who 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-v2beta/src/main/proto/google/iam/v2beta/policy.proto b/proto-google-iam-v2beta/src/main/proto/google/iam/v2beta/policy.proto new file mode 100644 index 00000000..b3cba55e --- /dev/null +++ b/proto-google-iam-v2beta/src/main/proto/google/iam/v2beta/policy.proto @@ -0,0 +1,297 @@ +// 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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/iam/v2beta/deny.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/iam/v2beta;iam"; +option java_multiple_files = true; +option java_outer_classname = "PolicyProto"; +option java_package = "com.google.iam.v2beta"; + +// 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: "/v2beta/{parent=policies/*/*}" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a policy. + rpc GetPolicy(GetPolicyRequest) returns (Policy) { + option (google.api.http) = { + get: "/v2beta/{name=policies/*/*/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a policy. + rpc CreatePolicy(CreatePolicyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{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.v2beta.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: "/v2beta/{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: "/v2beta/{name=policies/*/*/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Policy" + metadata_type: "PolicyOperationMetadata" + }; + } +} + +// Data for an IAM policy. +message Policy { + option (google.api.resource) = { + type: "iam.googleapis.com/Policy" + pattern: "policies/{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; +} + +// 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.v2beta.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.v2beta.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, + (google.api.resource_reference) = { + type: "iam.googleapis.com/Policy" + } + ]; +} + +// 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, + (google.api.resource_reference) = { + type: "iam.googleapis.com/Policy" + } + ]; + + // 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]; +} + +// 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 d0b4362c..a423417f 100644 --- a/versions.txt +++ b/versions.txt @@ -3,3 +3,6 @@ proto-google-iam-v1:1.4.1:1.4.2-SNAPSHOT grpc-google-iam-v1:1.4.1:1.4.2-SNAPSHOT +proto-google-iam-v2beta:1.4.1:1.4.2-SNAPSHOT +grpc-google-iam-v2beta:1.4.1:1.4.2-SNAPSHOT +google-iam-policy:1.4.1:1.4.2-SNAPSHOT