From 51076a87eae57ec6763bdbfa20dcc390b688fc82 Mon Sep 17 00:00:00 2001 From: BenWhitehead Date: Mon, 23 Sep 2024 13:29:04 -0400 Subject: [PATCH] fix: remove server unimplemented GrpcStorageImpl#getServiceAccount (#2718) Partial revert of 96b6330297a7206da199ed13905beb10883efb59 --- .../com/google/cloud/storage/GrpcStorageImpl.java | 13 +------------ .../main/java/com/google/cloud/storage/Storage.java | 2 +- .../conformance/retry/RpcMethodMappings.java | 1 + .../cloud/storage/it/ITServiceAccountTest.java | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageImpl.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageImpl.java index 21ef5b0d6..f01d4f761 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageImpl.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageImpl.java @@ -26,7 +26,6 @@ import static com.google.cloud.storage.StorageV2ProtoUtils.objectAclEntityOrAltEq; import static com.google.cloud.storage.Utils.bucketNameCodec; import static com.google.cloud.storage.Utils.ifNonNull; -import static com.google.cloud.storage.Utils.projectNameCodec; import static com.google.common.base.MoreObjects.firstNonNull; import static java.util.Objects.requireNonNull; @@ -90,7 +89,6 @@ import com.google.storage.v2.GetBucketRequest; import com.google.storage.v2.GetNotificationConfigRequest; import com.google.storage.v2.GetObjectRequest; -import com.google.storage.v2.GetServiceAccountRequest; import com.google.storage.v2.ListBucketsRequest; import com.google.storage.v2.ListNotificationConfigsRequest; import com.google.storage.v2.ListNotificationConfigsResponse; @@ -1390,16 +1388,7 @@ public List testIamPermissions( @Override public ServiceAccount getServiceAccount(String projectId) { - GetServiceAccountRequest req = - GetServiceAccountRequest.newBuilder() - .setProject(projectNameCodec.encode(projectId)) - .build(); - GrpcCallContext retryContext = Retrying.newCallContext(); - return Retrying.run( - getOptions(), - retryAlgorithmManager.getFor(req), - () -> storageClient.getServiceAccountCallable().call(req, retryContext), - codecs.serviceAccount()); + return CrossTransportUtils.throwHttpJsonOnly(Storage.class, "getServiceAccount"); } @Override diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java index ca55582a0..5bb3c15d4 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java @@ -4781,7 +4781,7 @@ List testIamPermissions( * @return the service account associated with this project * @throws StorageException upon failure */ - @TransportCompatibility({Transport.HTTP, Transport.GRPC}) + @TransportCompatibility({Transport.HTTP}) ServiceAccount getServiceAccount(String projectId); /** diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/conformance/retry/RpcMethodMappings.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/conformance/retry/RpcMethodMappings.java index 2288563e0..7db8c2cf1 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/conformance/retry/RpcMethodMappings.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/conformance/retry/RpcMethodMappings.java @@ -2114,6 +2114,7 @@ static final class ServiceAccount { private static void get(ArrayList a) { a.add( RpcMethodMapping.newBuilder(59, serviceaccount.get) + .withApplicable(TestRetryConformance.transportIs(Transport.HTTP)) .withTest( (ctx, c) -> ctx.map( diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITServiceAccountTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITServiceAccountTest.java index e5d91313b..2141334c9 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITServiceAccountTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITServiceAccountTest.java @@ -32,7 +32,7 @@ @RunWith(StorageITRunner.class) @CrossRun( backends = {Backend.PROD}, - transports = {Transport.HTTP, Transport.GRPC}) + transports = {Transport.HTTP}) public class ITServiceAccountTest { private static final String SERVICE_ACCOUNT_EMAIL_SUFFIX =