diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index b7d331d4..138c4090 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -34,4 +34,10 @@ deep-copy-regex: - 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 + dest: "/owl-bot-staging/v2beta/google-iam-policy/src" +- source: "/google/iam/v2beta/google-cloud-iam-v2-java/grpc-google-cloud-iam-v2-java/src" + dest: "/owl-bot-staging/v2/grpc-google-iam-v2/src" +- source: "/google/iam/v2/google-cloud-iam-v2-java/proto-google-cloud-iam-v2-java/src" + dest: "/owl-bot-staging/v2/proto-google-iam-v2/src" +- source: "/google/iam/v2/google-cloud-iam-v2-java/gapic-google-cloud-iam-v2-java/src" + dest: "/owl-bot-staging/v2/google-iam-policy/src" \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index db2d8ad1..30fdb7b9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,6 +8,3 @@ # The java-samples-reviewers team is the default owner for samples changes samples/**/*.java @googleapis/java-samples-reviewers - -# Generated snippets should not be owned by samples reviewers -samples/snippets/generated/ @googleapis/yoshi-java diff --git a/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesClient.java b/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesClient.java new file mode 100644 index 00000000..b7e40fcd --- /dev/null +++ b/google-iam-policy/src/main/java/com/google/iam/v2/PoliciesClient.java @@ -0,0 +1,1136 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.iam.v2; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.iam.v2.stub.PoliciesStub; +import com.google.iam.v2.stub.PoliciesStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: An interface for managing Identity and Access Management (IAM) policies. + * + *
This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * String name = "name3373707"; + * Policy response = policiesClient.getPolicy(name); + * } + * }+ * + *
Note: close() needs to be called on the PoliciesClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *
The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of PoliciesSettings to create(). + * For example: + * + *
To customize credentials: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * PoliciesSettings policiesSettings = + * PoliciesSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * PoliciesClient policiesClient = PoliciesClient.create(policiesSettings); + * }+ * + *
To customize the endpoint: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * PoliciesSettings policiesSettings = + * PoliciesSettings.newBuilder().setEndpoint(myEndpoint).build(); + * PoliciesClient policiesClient = PoliciesClient.create(policiesSettings); + * }+ * + *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * PoliciesSettings policiesSettings = + * PoliciesSettings.newBuilder() + * .setTransportChannelProvider( + * PoliciesSettings.defaultHttpJsonTransportProviderBuilder().build()) + * .build(); + * PoliciesClient policiesClient = PoliciesClient.create(policiesSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class PoliciesClient implements BackgroundResource { + private final PoliciesSettings settings; + private final PoliciesStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of PoliciesClient with default settings. */ + public static final PoliciesClient create() throws IOException { + return create(PoliciesSettings.newBuilder().build()); + } + + /** + * Constructs an instance of PoliciesClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final PoliciesClient create(PoliciesSettings settings) throws IOException { + return new PoliciesClient(settings); + } + + /** + * Constructs an instance of PoliciesClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(PoliciesSettings). + */ + public static final PoliciesClient create(PoliciesStub stub) { + return new PoliciesClient(stub); + } + + /** + * Constructs an instance of PoliciesClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected PoliciesClient(PoliciesSettings settings) throws IOException { + this.settings = settings; + this.stub = ((PoliciesStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected PoliciesClient(PoliciesStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final PoliciesSettings getSettings() { + return settings; + } + + public PoliciesStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the policies of the specified kind that are attached to a resource. + * + *
The response lists only policy metadata. In particular, policy rules are omitted. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * String parent = "parent-995424086"; + * for (Policy element : policiesClient.listPolicies(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The resource that the policy is attached to, along with the kind of + * policy to list. Format: `policies/{attachment_point}/denypolicies` + *
The attachment point is identified by its URL-encoded full resource name, which means + * that the forward-slash character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + *
For organizations and folders, use the numeric ID in the full resource name. For + * projects, you can use the alphanumeric or the numeric ID. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListPoliciesPagedResponse listPolicies(String parent) { + ListPoliciesRequest request = ListPoliciesRequest.newBuilder().setParent(parent).build(); + return listPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the policies of the specified kind that are attached to a resource. + * + *
The response lists only policy metadata. In particular, policy rules are omitted. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * ListPoliciesRequest request = + * ListPoliciesRequest.newBuilder() + * .setParent("parent-995424086") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Policy element : policiesClient.listPolicies(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListPoliciesPagedResponse listPolicies(ListPoliciesRequest request) { + return listPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the policies of the specified kind that are attached to a resource. + * + *
The response lists only policy metadata. In particular, policy rules are omitted. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * ListPoliciesRequest request = + * ListPoliciesRequest.newBuilder() + * .setParent("parent-995424086") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = policiesClient.listPoliciesPagedCallable().futureCall(request); + * // Do something. + * for (Policy element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
The response lists only policy metadata. In particular, policy rules are omitted. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * ListPoliciesRequest request = + * ListPoliciesRequest.newBuilder() + * .setParent("parent-995424086") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListPoliciesResponse response = policiesClient.listPoliciesCallable().call(request); + * for (Policy element : response.getPoliciesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * String name = "name3373707"; + * Policy response = policiesClient.getPolicy(name); + * } + * }+ * + * @param name Required. The resource name of the policy to retrieve. Format: + * `policies/{attachment_point}/denypolicies/{policy_id}` + *
Use the URL-encoded full resource name, which means that the forward-slash character, + * `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. + *
For organizations and folders, use the numeric ID in the full resource name. For + * projects, you can use the alphanumeric or the numeric ID. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getPolicy(String name) { + GetPolicyRequest request = GetPolicyRequest.newBuilder().setName(name).build(); + return getPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a policy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * GetPolicyRequest request = GetPolicyRequest.newBuilder().setName("name3373707").build(); + * Policy response = policiesClient.getPolicy(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getPolicy(GetPolicyRequest request) { + return getPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a policy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * GetPolicyRequest request = GetPolicyRequest.newBuilder().setName("name3373707").build(); + * ApiFuture+ */ + public final UnaryCallablefuture = policiesClient.getPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (PoliciesClient policiesClient = PoliciesClient.create()) { + * String parent = "parent-995424086"; + * Policy policy = Policy.newBuilder().build(); + * String policyId = "policyId546908653"; + * Policy response = policiesClient.createPolicyAsync(parent, policy, policyId).get(); + * } + * }+ * + * @param parent Required. The resource that the policy is attached to, along with the kind of + * policy to create. Format: `policies/{attachment_point}/denypolicies` + *
The attachment point is identified by its URL-encoded full resource name, which means + * that the forward-slash character, `/`, must be written as `%2F`. For example, + * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. + *
For organizations and folders, use the numeric ID in the full resource name. For
+ * projects, you can use the alphanumeric or the numeric ID.
+ * @param policy Required. The policy to create.
+ * @param policyId The ID to use for this policy, which will become the final component of the
+ * policy's resource name. The ID must contain 3 to 63 characters. It can contain lowercase
+ * letters and numbers, as well as dashes (`-`) and periods (`.`). The first character must be
+ * a lowercase letter.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * You can update only the rules and the display name for the policy.
+ *
+ * To update a policy, you should use a read-modify-write loop:
+ *
+ * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the
+ * policy. 2. Modify the policy as needed. 3. Use `UpdatePolicy` to write the updated policy.
+ *
+ * This pattern helps prevent conflicts between concurrent updates.
+ *
+ * Sample code:
+ *
+ * You can update only the rules and the display name for the policy.
+ *
+ * To update a policy, you should use a read-modify-write loop:
+ *
+ * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the
+ * policy. 2. Modify the policy as needed. 3. Use `UpdatePolicy` to write the updated policy.
+ *
+ * This pattern helps prevent conflicts between concurrent updates.
+ *
+ * Sample code:
+ *
+ * You can update only the rules and the display name for the policy.
+ *
+ * To update a policy, you should use a read-modify-write loop:
+ *
+ * 1. Use [GetPolicy][google.iam.v2.Policies.GetPolicy] to read the current version of the
+ * policy. 2. Modify the policy as needed. 3. Use `UpdatePolicy` to write the updated policy.
+ *
+ * This pattern helps prevent conflicts between concurrent updates.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * 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 Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The main reason to use this endpoint is as a policy admin to debug access issues for a
+ * resource.
+ *
+ * Sample code:
+ *
+ * The main reason to use this endpoint is as a policy admin to debug access issues for a
+ * resource.
+ *
+ * Sample code:
+ *
+ * The main reason to use this endpoint is as a policy admin to debug access issues for a
+ * resource.
+ *
+ * Sample code:
+ *
+ * The main reason to use this endpoint is as a policy admin to debug access issues for a
+ * resource.
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * 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:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcPoliciesCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcPoliciesStub extends PoliciesStub {
+ private static final MethodDescriptor This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonPoliciesCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonPoliciesStub extends PoliciesStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(PolicyOperationMetadata.getDescriptor())
+ .add(Policy.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class PoliciesStub implements BackgroundResource {
+
+ public OperationsStub getOperationsStub() {
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
+ }
+
+ public UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * CreatePolicyRequest request =
+ * CreatePolicyRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setPolicy(Policy.newBuilder().build())
+ * .setPolicyId("policyId546908653")
+ * .build();
+ * Policy response = policiesClient.createPolicyAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * CreatePolicyRequest request =
+ * CreatePolicyRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setPolicy(Policy.newBuilder().build())
+ * .setPolicyId("policyId546908653")
+ * .build();
+ * OperationFuture
+ */
+ public final OperationCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * CreatePolicyRequest request =
+ * CreatePolicyRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setPolicy(Policy.newBuilder().build())
+ * .setPolicyId("policyId546908653")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * UpdatePolicyRequest request =
+ * UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build();
+ * Policy response = policiesClient.updatePolicyAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * UpdatePolicyRequest request =
+ * UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build();
+ * OperationFuture
+ */
+ public final OperationCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * UpdatePolicyRequest request =
+ * UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * String name = "name3373707";
+ * Policy response = policiesClient.deletePolicyAsync(name).get();
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the policy to delete. Format:
+ * `policies/{attachment_point}/denypolicies/{policy_id}`
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * DeletePolicyRequest request =
+ * DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
+ * Policy response = policiesClient.deletePolicyAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * DeletePolicyRequest request =
+ * DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
+ * OperationFuture
+ */
+ public final OperationCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * DeletePolicyRequest request =
+ * DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * String attachmentPoint = "attachmentPoint-686994899";
+ * for (Policy element : policiesClient.listApplicablePolicies(attachmentPoint).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param attachmentPoint Required. The Cloud resource at which the applicable policies are to be
+ * retrieved. Format: `{attachment-point}` Use the URL-encoded full resource name, which means
+ * that the forward-slash character, `/`, must be written as `%2F`. For example,
+ * `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListApplicablePoliciesPagedResponse listApplicablePolicies(String attachmentPoint) {
+ ListApplicablePoliciesRequest request =
+ ListApplicablePoliciesRequest.newBuilder().setAttachmentPoint(attachmentPoint).build();
+ return listApplicablePolicies(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves all the policies that are attached to the specified resource, or anywhere in the
+ * ancestry of the resource. For example, for a project this endpoint would return all the
+ * `denyPolicy` kind policies attached to the project, its parent folder (if any), and its parent
+ * organization (if any). The endpoint requires the same permissions that it would take to call
+ * `ListPolicies` or `GetPolicy`.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * ListApplicablePoliciesRequest request =
+ * ListApplicablePoliciesRequest.newBuilder()
+ * .setAttachmentPoint("attachmentPoint-686994899")
+ * .setFilter("filter-1274492040")
+ * .setPageToken("pageToken873572522")
+ * .setPageSize(883849137)
+ * .build();
+ * for (Policy element : policiesClient.listApplicablePolicies(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListApplicablePoliciesPagedResponse listApplicablePolicies(
+ ListApplicablePoliciesRequest request) {
+ return listApplicablePoliciesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves all the policies that are attached to the specified resource, or anywhere in the
+ * ancestry of the resource. For example, for a project this endpoint would return all the
+ * `denyPolicy` kind policies attached to the project, its parent folder (if any), and its parent
+ * organization (if any). The endpoint requires the same permissions that it would take to call
+ * `ListPolicies` or `GetPolicy`.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * ListApplicablePoliciesRequest request =
+ * ListApplicablePoliciesRequest.newBuilder()
+ * .setAttachmentPoint("attachmentPoint-686994899")
+ * .setFilter("filter-1274492040")
+ * .setPageToken("pageToken873572522")
+ * .setPageSize(883849137)
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * ListApplicablePoliciesRequest request =
+ * ListApplicablePoliciesRequest.newBuilder()
+ * .setAttachmentPoint("attachmentPoint-686994899")
+ * .setFilter("filter-1274492040")
+ * .setPageToken("pageToken873572522")
+ * .setPageSize(883849137)
+ * .build();
+ * while (true) {
+ * ListApplicablePoliciesResponse response =
+ * policiesClient.listApplicablePoliciesCallable().call(request);
+ * for (Policy element : response.getPoliciesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ *
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * PoliciesSettings.Builder policiesSettingsBuilder = PoliciesSettings.newBuilder();
+ * policiesSettingsBuilder
+ * .getPolicySettings()
+ * .setRetrySettings(
+ * policiesSettingsBuilder.getPolicySettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * PoliciesSettings policiesSettings = policiesSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class PoliciesSettings extends ClientSettings{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (PoliciesClient policiesClient = PoliciesClient.create()) {
+ * String name = "name3373707";
+ * Policy response = policiesClient.getPolicy(name);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.iam.v2;
+
+import javax.annotation.Generated;
diff --git a/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesCallableFactory.java b/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesCallableFactory.java
new file mode 100644
index 00000000..a09e6477
--- /dev/null
+++ b/google-iam-policy/src/main/java/com/google/iam/v2/stub/GrpcPoliciesCallableFactory.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.iam.v2.stub;
+
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the Policies service API.
+ *
+ *