com.google.api
api-common
diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlClient.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlClient.java
index ac92b59071..485abea93f 100644
--- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlClient.java
+++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlClient.java
@@ -28,7 +28,13 @@
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.api.resourcenames.ResourceName;
import com.google.common.util.concurrent.MoreExecutors;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
@@ -509,6 +515,63 @@
*
*
*
+ *
+ * GetIamPolicy |
+ * Gets the IAM policy for a specified bucket. The `resource` field in the request should be `projects/_/buckets/{bucket}` for a bucket, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call.
+ *
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
+ *
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
+ *
+ * |
+ *
+ *
+ * SetIamPolicy |
+ * Updates an IAM policy for the specified bucket. The `resource` field in the request should be `projects/_/buckets/{bucket}` for a bucket, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call.
+ *
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
+ *
+ * setIamPolicy(ResourceName resource, Policy policy)
+ * setIamPolicy(String resource, Policy policy)
+ *
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
+ *
+ * |
+ *
+ *
+ * TestIamPermissions |
+ * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any, are held by the caller. The `resource` field in the request should be `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call.
+ *
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
+ *
+ * testIamPermissions(ResourceName resource, List<String> permissions)
+ * testIamPermissions(String resource, List<String> permissions)
+ *
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
+ *
+ * |
+ *
*
*
* See the individual methods for example code.
@@ -3656,6 +3719,420 @@ public final IntelligenceConfig updateOrganizationIntelligenceConfig(
return stub.updateOrganizationIntelligenceConfigCallable();
}
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the IAM policy for a specified bucket. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, or
+ * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder.
+ *
+ *
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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+ * Policy response = storageControlClient.getIamPolicy(resource);
+ * }
+ * }
+ *
+ * @param resource REQUIRED: The resource for which the policy is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy getIamPolicy(ResourceName resource) {
+ GetIamPolicyRequest request =
+ GetIamPolicyRequest.newBuilder()
+ .setResource(resource == null ? null : resource.toString())
+ .build();
+ return getIamPolicy(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the IAM policy for a specified bucket. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, or
+ * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * String resource =
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString();
+ * Policy response = storageControlClient.getIamPolicy(resource);
+ * }
+ * }
+ *
+ * @param resource REQUIRED: The resource for which the policy is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy getIamPolicy(String resource) {
+ GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build();
+ return getIamPolicy(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the IAM policy for a specified bucket. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, or
+ * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * Policy response = storageControlClient.getIamPolicy(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy getIamPolicy(GetIamPolicyRequest request) {
+ return getIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the IAM policy for a specified bucket. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, or
+ * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * ApiFuture future = storageControlClient.getIamPolicyCallable().futureCall(request);
+ * // Do something.
+ * Policy response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getIamPolicyCallable() {
+ return stub.getIamPolicyCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an IAM policy for the specified bucket. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, or
+ * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+ * Policy policy = Policy.newBuilder().build();
+ * Policy response = storageControlClient.setIamPolicy(resource, policy);
+ * }
+ * }
+ *
+ * @param resource REQUIRED: The resource for which the policy is being specified. See the
+ * operation documentation for the appropriate value for this field.
+ * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
+ * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
+ * Platform services (such as Projects) might reject them.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy setIamPolicy(ResourceName resource, Policy policy) {
+ SetIamPolicyRequest request =
+ SetIamPolicyRequest.newBuilder()
+ .setResource(resource == null ? null : resource.toString())
+ .setPolicy(policy)
+ .build();
+ return setIamPolicy(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an IAM policy for the specified bucket. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, or
+ * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * String resource =
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString();
+ * Policy policy = Policy.newBuilder().build();
+ * Policy response = storageControlClient.setIamPolicy(resource, policy);
+ * }
+ * }
+ *
+ * @param resource REQUIRED: The resource for which the policy is being specified. See the
+ * operation documentation for the appropriate value for this field.
+ * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
+ * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
+ * Platform services (such as Projects) might reject them.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy setIamPolicy(String resource, Policy policy) {
+ SetIamPolicyRequest request =
+ SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build();
+ return setIamPolicy(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an IAM policy for the specified bucket. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, or
+ * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * Policy response = storageControlClient.setIamPolicy(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy setIamPolicy(SetIamPolicyRequest request) {
+ return setIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an IAM policy for the specified bucket. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, or
+ * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future = storageControlClient.setIamPolicyCallable().futureCall(request);
+ * // Do something.
+ * Policy response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable setIamPolicyCallable() {
+ return stub.setIamPolicyCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any,
+ * are held by the caller. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for
+ * an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed
+ * folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+ * List permissions = new ArrayList<>();
+ * TestIamPermissionsResponse response =
+ * storageControlClient.testIamPermissions(resource, permissions);
+ * }
+ * }
+ *
+ * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @param permissions The set of permissions to check for the `resource`. Permissions with
+ * wildcards (such as '*' or 'storage.*') are not allowed. For more information see
+ * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final TestIamPermissionsResponse testIamPermissions(
+ ResourceName resource, List permissions) {
+ TestIamPermissionsRequest request =
+ TestIamPermissionsRequest.newBuilder()
+ .setResource(resource == null ? null : resource.toString())
+ .addAllPermissions(permissions)
+ .build();
+ return testIamPermissions(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any,
+ * are held by the caller. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for
+ * an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed
+ * folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * String resource =
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString();
+ * List permissions = new ArrayList<>();
+ * TestIamPermissionsResponse response =
+ * storageControlClient.testIamPermissions(resource, permissions);
+ * }
+ * }
+ *
+ * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @param permissions The set of permissions to check for the `resource`. Permissions with
+ * wildcards (such as '*' or 'storage.*') are not allowed. For more information see
+ * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final TestIamPermissionsResponse testIamPermissions(
+ String resource, List permissions) {
+ TestIamPermissionsRequest request =
+ TestIamPermissionsRequest.newBuilder()
+ .setResource(resource)
+ .addAllPermissions(permissions)
+ .build();
+ return testIamPermissions(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any,
+ * are held by the caller. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for
+ * an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed
+ * folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+ * .addAllPermissions(new ArrayList())
+ * .build();
+ * TestIamPermissionsResponse response = storageControlClient.testIamPermissions(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
+ return testIamPermissionsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any,
+ * are held by the caller. The `resource` field in the request should be
+ * `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for
+ * an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed
+ * folder.
+ *
+ * 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 (StorageControlClient storageControlClient = StorageControlClient.create()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(
+ * AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+ * .addAllPermissions(new ArrayList())
+ * .build();
+ * ApiFuture future =
+ * storageControlClient.testIamPermissionsCallable().futureCall(request);
+ * // Do something.
+ * TestIamPermissionsResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ testIamPermissionsCallable() {
+ return stub.testIamPermissionsCallable();
+ }
+
@Override
public final void close() {
stub.close();
diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlSettings.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlSettings.java
index 286869bcc9..191f0f6526 100644
--- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlSettings.java
+++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlSettings.java
@@ -33,6 +33,11 @@
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.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.storage.control.v2.stub.StorageControlStubSettings;
@@ -274,6 +279,22 @@ public UnaryCallSettings getAnywhereCach
.updateOrganizationIntelligenceConfigSettings();
}
+ /** Returns the object with the settings used for calls to getIamPolicy. */
+ public UnaryCallSettings getIamPolicySettings() {
+ return ((StorageControlStubSettings) getStubSettings()).getIamPolicySettings();
+ }
+
+ /** Returns the object with the settings used for calls to setIamPolicy. */
+ public UnaryCallSettings setIamPolicySettings() {
+ return ((StorageControlStubSettings) getStubSettings()).setIamPolicySettings();
+ }
+
+ /** Returns the object with the settings used for calls to testIamPermissions. */
+ public UnaryCallSettings
+ testIamPermissionsSettings() {
+ return ((StorageControlStubSettings) getStubSettings()).testIamPermissionsSettings();
+ }
+
public static final StorageControlSettings create(StorageControlStubSettings stub)
throws IOException {
return new StorageControlSettings.Builder(stub.toBuilder()).build();
@@ -546,6 +567,22 @@ public UnaryCallSettings.Builder renameFolderSet
return getStubSettingsBuilder().updateOrganizationIntelligenceConfigSettings();
}
+ /** Returns the builder for the settings used for calls to getIamPolicy. */
+ public UnaryCallSettings.Builder getIamPolicySettings() {
+ return getStubSettingsBuilder().getIamPolicySettings();
+ }
+
+ /** Returns the builder for the settings used for calls to setIamPolicy. */
+ public UnaryCallSettings.Builder setIamPolicySettings() {
+ return getStubSettingsBuilder().setIamPolicySettings();
+ }
+
+ /** Returns the builder for the settings used for calls to testIamPermissions. */
+ public UnaryCallSettings.Builder
+ testIamPermissionsSettings() {
+ return getStubSettingsBuilder().testIamPermissionsSettings();
+ }
+
@Override
public StorageControlSettings build() throws IOException {
return new StorageControlSettings(this);
diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/gapic_metadata.json b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/gapic_metadata.json
index 308c596131..f86f4c1c4b 100644
--- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/gapic_metadata.json
+++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/gapic_metadata.json
@@ -37,6 +37,9 @@
"GetFolderIntelligenceConfig": {
"methods": ["getFolderIntelligenceConfig", "getFolderIntelligenceConfig", "getFolderIntelligenceConfig", "getFolderIntelligenceConfigCallable"]
},
+ "GetIamPolicy": {
+ "methods": ["getIamPolicy", "getIamPolicy", "getIamPolicy", "getIamPolicyCallable"]
+ },
"GetManagedFolder": {
"methods": ["getManagedFolder", "getManagedFolder", "getManagedFolder", "getManagedFolderCallable"]
},
@@ -67,6 +70,12 @@
"ResumeAnywhereCache": {
"methods": ["resumeAnywhereCache", "resumeAnywhereCache", "resumeAnywhereCache", "resumeAnywhereCacheCallable"]
},
+ "SetIamPolicy": {
+ "methods": ["setIamPolicy", "setIamPolicy", "setIamPolicy", "setIamPolicyCallable"]
+ },
+ "TestIamPermissions": {
+ "methods": ["testIamPermissions", "testIamPermissions", "testIamPermissions", "testIamPermissionsCallable"]
+ },
"UpdateAnywhereCache": {
"methods": ["updateAnywhereCacheAsync", "updateAnywhereCacheAsync", "updateAnywhereCacheOperationCallable", "updateAnywhereCacheCallable"]
},
diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/GrpcStorageControlStub.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/GrpcStorageControlStub.java
index 19f8d1916a..5778eaffc5 100644
--- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/GrpcStorageControlStub.java
+++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/GrpcStorageControlStub.java
@@ -30,6 +30,11 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.api.pathtemplate.PathTemplate;
import com.google.common.base.Strings;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
@@ -343,6 +348,36 @@ public class GrpcStorageControlStub extends StorageControlStub {
.setSampledToLocalTracing(true)
.build();
+ private static final MethodDescriptor getIamPolicyMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.storage.control.v2.StorageControl/GetIamPolicy")
+ .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance()))
+ .setSampledToLocalTracing(true)
+ .build();
+
+ private static final MethodDescriptor setIamPolicyMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.storage.control.v2.StorageControl/SetIamPolicy")
+ .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance()))
+ .setSampledToLocalTracing(true)
+ .build();
+
+ private static final MethodDescriptor
+ testIamPermissionsMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.storage.control.v2.StorageControl/TestIamPermissions")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance()))
+ .setSampledToLocalTracing(true)
+ .build();
+
private final UnaryCallable createFolderCallable;
private final UnaryCallable deleteFolderCallable;
private final UnaryCallable getFolderCallable;
@@ -391,6 +426,10 @@ public class GrpcStorageControlStub extends StorageControlStub {
getOrganizationIntelligenceConfigCallable;
private final UnaryCallable
updateOrganizationIntelligenceConfigCallable;
+ private final UnaryCallable getIamPolicyCallable;
+ private final UnaryCallable setIamPolicyCallable;
+ private final UnaryCallable
+ testIamPermissionsCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
@@ -430,6 +469,20 @@ public class GrpcStorageControlStub extends StorageControlStub {
PathTemplate.create("{bucket=projects/*/buckets/*}/**");
private static final PathTemplate LIST_ANYWHERE_CACHES_0_PATH_TEMPLATE =
PathTemplate.create("{bucket=**}");
+ private static final PathTemplate GET_IAM_POLICY_0_PATH_TEMPLATE =
+ PathTemplate.create("{bucket=**}");
+ private static final PathTemplate GET_IAM_POLICY_1_PATH_TEMPLATE =
+ PathTemplate.create("{bucket=projects/*/buckets/*}/**");
+ private static final PathTemplate SET_IAM_POLICY_0_PATH_TEMPLATE =
+ PathTemplate.create("{bucket=**}");
+ private static final PathTemplate SET_IAM_POLICY_1_PATH_TEMPLATE =
+ PathTemplate.create("{bucket=projects/*/buckets/*}/**");
+ private static final PathTemplate TEST_IAM_PERMISSIONS_0_PATH_TEMPLATE =
+ PathTemplate.create("{bucket=**}");
+ private static final PathTemplate TEST_IAM_PERMISSIONS_1_PATH_TEMPLATE =
+ PathTemplate.create("{bucket=projects/*/buckets/*}/objects/**");
+ private static final PathTemplate TEST_IAM_PERMISSIONS_2_PATH_TEMPLATE =
+ PathTemplate.create("{bucket=projects/*/buckets/*}/managedFolders/**");
public static final GrpcStorageControlStub create(StorageControlStubSettings settings)
throws IOException {
@@ -859,6 +912,44 @@ protected GrpcStorageControlStub(
return builder.build();
})
.build();
+ GrpcCallSettings getIamPolicyTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(getIamPolicyMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add(request.getResource(), "bucket", GET_IAM_POLICY_0_PATH_TEMPLATE);
+ builder.add(request.getResource(), "bucket", GET_IAM_POLICY_1_PATH_TEMPLATE);
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings setIamPolicyTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(setIamPolicyMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add(request.getResource(), "bucket", SET_IAM_POLICY_0_PATH_TEMPLATE);
+ builder.add(request.getResource(), "bucket", SET_IAM_POLICY_1_PATH_TEMPLATE);
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings
+ testIamPermissionsTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(testIamPermissionsMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add(
+ request.getResource(), "bucket", TEST_IAM_PERMISSIONS_0_PATH_TEMPLATE);
+ builder.add(
+ request.getResource(), "bucket", TEST_IAM_PERMISSIONS_1_PATH_TEMPLATE);
+ builder.add(
+ request.getResource(), "bucket", TEST_IAM_PERMISSIONS_2_PATH_TEMPLATE);
+ return builder.build();
+ })
+ .build();
this.createFolderCallable =
callableFactory.createUnaryCallable(
@@ -990,6 +1081,17 @@ protected GrpcStorageControlStub(
updateOrganizationIntelligenceConfigTransportSettings,
settings.updateOrganizationIntelligenceConfigSettings(),
clientContext);
+ this.getIamPolicyCallable =
+ callableFactory.createUnaryCallable(
+ getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext);
+ this.setIamPolicyCallable =
+ callableFactory.createUnaryCallable(
+ setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext);
+ this.testIamPermissionsCallable =
+ callableFactory.createUnaryCallable(
+ testIamPermissionsTransportSettings,
+ settings.testIamPermissionsSettings(),
+ clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
@@ -1157,6 +1259,22 @@ public UnaryCallable getAnywhereCacheCal
return updateOrganizationIntelligenceConfigCallable;
}
+ @Override
+ public UnaryCallable getIamPolicyCallable() {
+ return getIamPolicyCallable;
+ }
+
+ @Override
+ public UnaryCallable setIamPolicyCallable() {
+ return setIamPolicyCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ testIamPermissionsCallable() {
+ return testIamPermissionsCallable;
+ }
+
@Override
public final void close() {
try {
diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/HttpJsonStorageControlStub.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/HttpJsonStorageControlStub.java
index 9aed10cfce..a878e2155b 100644
--- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/HttpJsonStorageControlStub.java
+++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/HttpJsonStorageControlStub.java
@@ -29,6 +29,11 @@
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.TypeRegistry;
@@ -689,6 +694,28 @@ public UnaryCallable getAnywhereCacheCal
+ " method yet.");
}
+ @Override
+ public UnaryCallable getIamPolicyCallable() {
+ throw new UnsupportedOperationException(
+ "Not implemented: getIamPolicyCallable(). REST transport is not implemented for this method"
+ + " yet.");
+ }
+
+ @Override
+ public UnaryCallable setIamPolicyCallable() {
+ throw new UnsupportedOperationException(
+ "Not implemented: setIamPolicyCallable(). REST transport is not implemented for this method"
+ + " yet.");
+ }
+
+ @Override
+ public UnaryCallable
+ testIamPermissionsCallable() {
+ throw new UnsupportedOperationException(
+ "Not implemented: testIamPermissionsCallable(). REST transport is not implemented for this"
+ + " method yet.");
+ }
+
@Override
public final void close() {
try {
diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStub.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStub.java
index 5bab8877f0..8a44f5c389 100644
--- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStub.java
+++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStub.java
@@ -23,6 +23,11 @@
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.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import com.google.protobuf.Empty;
@@ -216,6 +221,19 @@ public UnaryCallable getAnywhereCacheCal
"Not implemented: updateOrganizationIntelligenceConfigCallable()");
}
+ public UnaryCallable getIamPolicyCallable() {
+ throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()");
+ }
+
+ public UnaryCallable setIamPolicyCallable() {
+ throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()");
+ }
+
+ public UnaryCallable
+ testIamPermissionsCallable() {
+ throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()");
+ }
+
@Override
public abstract void close();
}
diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStubSettings.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStubSettings.java
index d0191ad465..b72c48f76f 100644
--- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStubSettings.java
+++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStubSettings.java
@@ -54,6 +54,11 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.storage.control.v2.AnywhereCache;
@@ -231,6 +236,10 @@ public class StorageControlStubSettings extends StubSettings
updateOrganizationIntelligenceConfigSettings;
+ private final UnaryCallSettings getIamPolicySettings;
+ private final UnaryCallSettings setIamPolicySettings;
+ private final UnaryCallSettings
+ testIamPermissionsSettings;
private static final PagedListDescriptor
LIST_FOLDERS_PAGE_STR_DESC =
@@ -552,6 +561,22 @@ public UnaryCallSettings getAnywhereCach
return updateOrganizationIntelligenceConfigSettings;
}
+ /** Returns the object with the settings used for calls to getIamPolicy. */
+ public UnaryCallSettings getIamPolicySettings() {
+ return getIamPolicySettings;
+ }
+
+ /** Returns the object with the settings used for calls to setIamPolicy. */
+ public UnaryCallSettings setIamPolicySettings() {
+ return setIamPolicySettings;
+ }
+
+ /** Returns the object with the settings used for calls to testIamPermissions. */
+ public UnaryCallSettings
+ testIamPermissionsSettings() {
+ return testIamPermissionsSettings;
+ }
+
public StorageControlStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
@@ -697,6 +722,9 @@ protected StorageControlStubSettings(Builder settingsBuilder) throws IOException
settingsBuilder.getOrganizationIntelligenceConfigSettings().build();
updateOrganizationIntelligenceConfigSettings =
settingsBuilder.updateOrganizationIntelligenceConfigSettings().build();
+ getIamPolicySettings = settingsBuilder.getIamPolicySettings().build();
+ setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
+ testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build();
}
/** Builder for StorageControlStubSettings. */
@@ -759,6 +787,10 @@ public static class Builder extends StubSettings.Builder
updateOrganizationIntelligenceConfigSettings;
+ private final UnaryCallSettings.Builder getIamPolicySettings;
+ private final UnaryCallSettings.Builder setIamPolicySettings;
+ private final UnaryCallSettings.Builder
+ testIamPermissionsSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -840,6 +872,9 @@ protected Builder(ClientContext clientContext) {
getOrganizationIntelligenceConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateOrganizationIntelligenceConfigSettings =
UnaryCallSettings.newUnaryCallSettingsBuilder();
+ getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
@@ -865,7 +900,10 @@ protected Builder(ClientContext clientContext) {
getFolderIntelligenceConfigSettings,
updateFolderIntelligenceConfigSettings,
getOrganizationIntelligenceConfigSettings,
- updateOrganizationIntelligenceConfigSettings);
+ updateOrganizationIntelligenceConfigSettings,
+ getIamPolicySettings,
+ setIamPolicySettings,
+ testIamPermissionsSettings);
initDefaults(this);
}
@@ -906,6 +944,9 @@ protected Builder(StorageControlStubSettings settings) {
settings.getOrganizationIntelligenceConfigSettings.toBuilder();
updateOrganizationIntelligenceConfigSettings =
settings.updateOrganizationIntelligenceConfigSettings.toBuilder();
+ getIamPolicySettings = settings.getIamPolicySettings.toBuilder();
+ setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
+ testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
@@ -931,7 +972,10 @@ protected Builder(StorageControlStubSettings settings) {
getFolderIntelligenceConfigSettings,
updateFolderIntelligenceConfigSettings,
getOrganizationIntelligenceConfigSettings,
- updateOrganizationIntelligenceConfigSettings);
+ updateOrganizationIntelligenceConfigSettings,
+ getIamPolicySettings,
+ setIamPolicySettings,
+ testIamPermissionsSettings);
}
private static Builder createDefault() {
@@ -1074,6 +1118,21 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+ builder
+ .getIamPolicySettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
+ builder
+ .setIamPolicySettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
+ builder
+ .testIamPermissionsSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
builder
.renameFolderOperationSettings()
.setInitialCallSettings(
@@ -1326,6 +1385,22 @@ public UnaryCallSettings.Builder renameFolderSet
return updateOrganizationIntelligenceConfigSettings;
}
+ /** Returns the builder for the settings used for calls to getIamPolicy. */
+ public UnaryCallSettings.Builder getIamPolicySettings() {
+ return getIamPolicySettings;
+ }
+
+ /** Returns the builder for the settings used for calls to setIamPolicy. */
+ public UnaryCallSettings.Builder setIamPolicySettings() {
+ return setIamPolicySettings;
+ }
+
+ /** Returns the builder for the settings used for calls to testIamPermissions. */
+ public UnaryCallSettings.Builder
+ testIamPermissionsSettings() {
+ return testIamPermissionsSettings;
+ }
+
@Override
public StorageControlStubSettings build() throws IOException {
return new StorageControlStubSettings(this);
diff --git a/google-cloud-storage-control/src/main/resources/META-INF/native-image/com.google.storage.control.v2/reflect-config.json b/google-cloud-storage-control/src/main/resources/META-INF/native-image/com.google.storage.control.v2/reflect-config.json
index fddda0a6dd..5353fcc369 100644
--- a/google-cloud-storage-control/src/main/resources/META-INF/native-image/com.google.storage.control.v2/reflect-config.json
+++ b/google-cloud-storage-control/src/main/resources/META-INF/native-image/com.google.storage.control.v2/reflect-config.json
@@ -494,6 +494,249 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.iam.v1.AuditConfig",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.AuditConfig$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.AuditConfigDelta",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.AuditConfigDelta$Action",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.AuditConfigDelta$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.AuditLogConfig",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.AuditLogConfig$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.AuditLogConfig$LogType",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.Binding",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.Binding$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.BindingDelta",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.BindingDelta$Action",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.BindingDelta$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.GetIamPolicyRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.GetIamPolicyRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.GetPolicyOptions",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.GetPolicyOptions$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.Policy",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.Policy$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.PolicyDelta",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.PolicyDelta$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.SetIamPolicyRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.SetIamPolicyRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.TestIamPermissionsRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.TestIamPermissionsRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.TestIamPermissionsResponse",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.iam.v1.TestIamPermissionsResponse$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.longrunning.CancelOperationRequest",
"queryAllDeclaredConstructors": true,
@@ -2266,5 +2509,23 @@
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
+ },
+ {
+ "name": "com.google.type.Expr",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.type.Expr$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
}
]
\ No newline at end of file
diff --git a/google-cloud-storage-control/src/main/resources/com/google/storage/control/v2/gapic_metadata.json b/google-cloud-storage-control/src/main/resources/com/google/storage/control/v2/gapic_metadata.json
index 308c596131..f86f4c1c4b 100644
--- a/google-cloud-storage-control/src/main/resources/com/google/storage/control/v2/gapic_metadata.json
+++ b/google-cloud-storage-control/src/main/resources/com/google/storage/control/v2/gapic_metadata.json
@@ -37,6 +37,9 @@
"GetFolderIntelligenceConfig": {
"methods": ["getFolderIntelligenceConfig", "getFolderIntelligenceConfig", "getFolderIntelligenceConfig", "getFolderIntelligenceConfigCallable"]
},
+ "GetIamPolicy": {
+ "methods": ["getIamPolicy", "getIamPolicy", "getIamPolicy", "getIamPolicyCallable"]
+ },
"GetManagedFolder": {
"methods": ["getManagedFolder", "getManagedFolder", "getManagedFolder", "getManagedFolderCallable"]
},
@@ -67,6 +70,12 @@
"ResumeAnywhereCache": {
"methods": ["resumeAnywhereCache", "resumeAnywhereCache", "resumeAnywhereCache", "resumeAnywhereCacheCallable"]
},
+ "SetIamPolicy": {
+ "methods": ["setIamPolicy", "setIamPolicy", "setIamPolicy", "setIamPolicyCallable"]
+ },
+ "TestIamPermissions": {
+ "methods": ["testIamPermissions", "testIamPermissions", "testIamPermissions", "testIamPermissionsCallable"]
+ },
"UpdateAnywhereCache": {
"methods": ["updateAnywhereCacheAsync", "updateAnywhereCacheAsync", "updateAnywhereCacheOperationCallable", "updateAnywhereCacheCallable"]
},
diff --git a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/MockStorageControlImpl.java b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/MockStorageControlImpl.java
index e98b47a499..069a922359 100644
--- a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/MockStorageControlImpl.java
+++ b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/MockStorageControlImpl.java
@@ -17,6 +17,11 @@
package com.google.storage.control.v2;
import com.google.api.core.BetaApi;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Empty;
@@ -554,4 +559,66 @@ public void updateOrganizationIntelligenceConfig(
Exception.class.getName())));
}
}
+
+ @Override
+ public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof Policy) {
+ requests.add(request);
+ responseObserver.onNext(((Policy) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method GetIamPolicy, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ Policy.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
+ @Override
+ public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof Policy) {
+ requests.add(request);
+ responseObserver.onNext(((Policy) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method SetIamPolicy, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ Policy.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
+ @Override
+ public void testIamPermissions(
+ TestIamPermissionsRequest request,
+ StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof TestIamPermissionsResponse) {
+ requests.add(request);
+ responseObserver.onNext(((TestIamPermissionsResponse) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method TestIamPermissions, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ TestIamPermissionsResponse.class.getName(),
+ Exception.class.getName())));
+ }
+ }
}
diff --git a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientHttpJsonTest.java b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientHttpJsonTest.java
index e2769bba9c..10eda32485 100644
--- a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientHttpJsonTest.java
+++ b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientHttpJsonTest.java
@@ -687,4 +687,22 @@ public void updateOrganizationIntelligenceConfigExceptionTest() throws Exception
// Expected exception.
}
}
+
+ @Test
+ public void getIamPolicyUnsupportedMethodTest() throws Exception {
+ // The getIamPolicy() method is not supported in REST transport.
+ // This empty test is generated for technical reasons.
+ }
+
+ @Test
+ public void setIamPolicyUnsupportedMethodTest() throws Exception {
+ // The setIamPolicy() method is not supported in REST transport.
+ // This empty test is generated for technical reasons.
+ }
+
+ @Test
+ public void testIamPermissionsUnsupportedMethodTest() throws Exception {
+ // The testIamPermissions() method is not supported in REST transport.
+ // This empty test is generated for technical reasons.
+ }
}
diff --git a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientTest.java b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientTest.java
index a0ab3fe3dd..ea1e9bc7dc 100644
--- a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientTest.java
+++ b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientTest.java
@@ -28,16 +28,26 @@
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.api.gax.rpc.StatusCode;
+import com.google.api.resourcenames.ResourceName;
import com.google.common.collect.Lists;
+import com.google.iam.v1.AuditConfig;
+import com.google.iam.v1.Binding;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Any;
+import com.google.protobuf.ByteString;
import com.google.protobuf.Duration;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Timestamp;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
@@ -1983,4 +1993,252 @@ public void updateOrganizationIntelligenceConfigExceptionTest() throws Exception
// Expected exception.
}
}
+
+ @Test
+ public void getIamPolicyTest() throws Exception {
+ Policy expectedResponse =
+ Policy.newBuilder()
+ .setVersion(351608024)
+ .addAllBindings(new ArrayList())
+ .addAllAuditConfigs(new ArrayList())
+ .setEtag(ByteString.EMPTY)
+ .build();
+ mockStorageControl.addResponse(expectedResponse);
+
+ ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+
+ Policy actualResponse = client.getIamPolicy(resource);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockStorageControl.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0));
+
+ Assert.assertEquals(resource.toString(), actualRequest.getResource());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void getIamPolicyExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockStorageControl.addException(exception);
+
+ try {
+ ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+ client.getIamPolicy(resource);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getIamPolicyTest2() throws Exception {
+ Policy expectedResponse =
+ Policy.newBuilder()
+ .setVersion(351608024)
+ .addAllBindings(new ArrayList())
+ .addAllAuditConfigs(new ArrayList())
+ .setEtag(ByteString.EMPTY)
+ .build();
+ mockStorageControl.addResponse(expectedResponse);
+
+ String resource = "resource-341064690";
+
+ Policy actualResponse = client.getIamPolicy(resource);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockStorageControl.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0));
+
+ Assert.assertEquals(resource, actualRequest.getResource());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void getIamPolicyExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockStorageControl.addException(exception);
+
+ try {
+ String resource = "resource-341064690";
+ client.getIamPolicy(resource);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void setIamPolicyTest() throws Exception {
+ Policy expectedResponse =
+ Policy.newBuilder()
+ .setVersion(351608024)
+ .addAllBindings(new ArrayList())
+ .addAllAuditConfigs(new ArrayList())
+ .setEtag(ByteString.EMPTY)
+ .build();
+ mockStorageControl.addResponse(expectedResponse);
+
+ ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+ Policy policy = Policy.newBuilder().build();
+
+ Policy actualResponse = client.setIamPolicy(resource, policy);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockStorageControl.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0));
+
+ Assert.assertEquals(resource.toString(), actualRequest.getResource());
+ Assert.assertEquals(policy, actualRequest.getPolicy());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void setIamPolicyExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockStorageControl.addException(exception);
+
+ try {
+ ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+ Policy policy = Policy.newBuilder().build();
+ client.setIamPolicy(resource, policy);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void setIamPolicyTest2() throws Exception {
+ Policy expectedResponse =
+ Policy.newBuilder()
+ .setVersion(351608024)
+ .addAllBindings(new ArrayList())
+ .addAllAuditConfigs(new ArrayList())
+ .setEtag(ByteString.EMPTY)
+ .build();
+ mockStorageControl.addResponse(expectedResponse);
+
+ String resource = "resource-341064690";
+ Policy policy = Policy.newBuilder().build();
+
+ Policy actualResponse = client.setIamPolicy(resource, policy);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockStorageControl.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0));
+
+ Assert.assertEquals(resource, actualRequest.getResource());
+ Assert.assertEquals(policy, actualRequest.getPolicy());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void setIamPolicyExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockStorageControl.addException(exception);
+
+ try {
+ String resource = "resource-341064690";
+ Policy policy = Policy.newBuilder().build();
+ client.setIamPolicy(resource, policy);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void testIamPermissionsTest() throws Exception {
+ TestIamPermissionsResponse expectedResponse =
+ TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build();
+ mockStorageControl.addResponse(expectedResponse);
+
+ ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+ List permissions = new ArrayList<>();
+
+ TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockStorageControl.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0));
+
+ Assert.assertEquals(resource.toString(), actualRequest.getResource());
+ Assert.assertEquals(permissions, actualRequest.getPermissionsList());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void testIamPermissionsExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockStorageControl.addException(exception);
+
+ try {
+ ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+ List permissions = new ArrayList<>();
+ client.testIamPermissions(resource, permissions);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void testIamPermissionsTest2() throws Exception {
+ TestIamPermissionsResponse expectedResponse =
+ TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build();
+ mockStorageControl.addResponse(expectedResponse);
+
+ String resource = "resource-341064690";
+ List permissions = new ArrayList<>();
+
+ TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockStorageControl.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0));
+
+ Assert.assertEquals(resource, actualRequest.getResource());
+ Assert.assertEquals(permissions, actualRequest.getPermissionsList());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void testIamPermissionsExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockStorageControl.addException(exception);
+
+ try {
+ String resource = "resource-341064690";
+ List permissions = new ArrayList<>();
+ client.testIamPermissions(resource, permissions);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
}
diff --git a/grpc-google-cloud-storage-control-v2/pom.xml b/grpc-google-cloud-storage-control-v2/pom.xml
index 9599414f4e..5b59cbb287 100644
--- a/grpc-google-cloud-storage-control-v2/pom.xml
+++ b/grpc-google-cloud-storage-control-v2/pom.xml
@@ -41,6 +41,10 @@
com.google.guava
guava
+