diff --git a/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistryClient.java b/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistryClient.java index 0622acae..68066965 100644 --- a/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistryClient.java +++ b/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistryClient.java @@ -16,7 +16,6 @@ package com.google.devtools.artifactregistry.v1beta2; -import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; @@ -1740,7 +1739,7 @@ public final UnaryCallable deleteTagCallable() { * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { * SetIamPolicyRequest request = * SetIamPolicyRequest.newBuilder() - * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + * .setResource("SetIamPolicyRequest1223629066".toString()) * .setPolicy(Policy.newBuilder().build()) * .build(); * Policy response = artifactRegistryClient.setIamPolicy(request); @@ -1764,7 +1763,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { * SetIamPolicyRequest request = * SetIamPolicyRequest.newBuilder() - * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + * .setResource("SetIamPolicyRequest1223629066".toString()) * .setPolicy(Policy.newBuilder().build()) * .build(); * ApiFuture future = artifactRegistryClient.setIamPolicyCallable().futureCall(request); @@ -1787,7 +1786,7 @@ public final UnaryCallable setIamPolicyCallable() { * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { * GetIamPolicyRequest request = * GetIamPolicyRequest.newBuilder() - * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + * .setResource("GetIamPolicyRequest-1527610370".toString()) * .setOptions(GetPolicyOptions.newBuilder().build()) * .build(); * Policy response = artifactRegistryClient.getIamPolicy(request); @@ -1811,7 +1810,7 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { * GetIamPolicyRequest request = * GetIamPolicyRequest.newBuilder() - * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + * .setResource("GetIamPolicyRequest-1527610370".toString()) * .setOptions(GetPolicyOptions.newBuilder().build()) * .build(); * ApiFuture future = artifactRegistryClient.getIamPolicyCallable().futureCall(request); @@ -1834,7 +1833,7 @@ public final UnaryCallable getIamPolicyCallable() { * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { * TestIamPermissionsRequest request = * TestIamPermissionsRequest.newBuilder() - * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + * .setResource("TestIamPermissionsRequest942398222".toString()) * .addAllPermissions(new ArrayList()) * .build(); * TestIamPermissionsResponse response = artifactRegistryClient.testIamPermissions(request); @@ -1858,7 +1857,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { * TestIamPermissionsRequest request = * TestIamPermissionsRequest.newBuilder() - * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + * .setResource("TestIamPermissionsRequest942398222".toString()) * .addAllPermissions(new ArrayList()) * .build(); * ApiFuture future = @@ -1918,12 +1917,7 @@ public static ApiFuture createAsync( ListRepositoriesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListRepositoriesPagedResponse apply(ListRepositoriesPage input) { - return new ListRepositoriesPagedResponse(input); - } - }, + input -> new ListRepositoriesPagedResponse(input), MoreExecutors.directExecutor()); } @@ -2000,12 +1994,7 @@ public static ApiFuture createAsync( ListPackagesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListPackagesPagedResponse apply(ListPackagesPage input) { - return new ListPackagesPagedResponse(input); - } - }, + input -> new ListPackagesPagedResponse(input), MoreExecutors.directExecutor()); } @@ -2080,12 +2069,7 @@ public static ApiFuture createAsync( ListVersionsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListVersionsPagedResponse apply(ListVersionsPage input) { - return new ListVersionsPagedResponse(input); - } - }, + input -> new ListVersionsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -2155,14 +2139,7 @@ public static ApiFuture createAsync( ApiFuture futurePage = ListFilesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( - futurePage, - new ApiFunction() { - @Override - public ListFilesPagedResponse apply(ListFilesPage input) { - return new ListFilesPagedResponse(input); - } - }, - MoreExecutors.directExecutor()); + futurePage, input -> new ListFilesPagedResponse(input), MoreExecutors.directExecutor()); } private ListFilesPagedResponse(ListFilesPage page) { @@ -2227,14 +2204,7 @@ public static ApiFuture createAsync( ApiFuture futurePage = ListTagsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( - futurePage, - new ApiFunction() { - @Override - public ListTagsPagedResponse apply(ListTagsPage input) { - return new ListTagsPagedResponse(input); - } - }, - MoreExecutors.directExecutor()); + futurePage, input -> new ListTagsPagedResponse(input), MoreExecutors.directExecutor()); } private ListTagsPagedResponse(ListTagsPage page) { diff --git a/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistrySettings.java b/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistrySettings.java index 683389f1..a4bff373 100644 --- a/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistrySettings.java +++ b/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistrySettings.java @@ -304,14 +304,13 @@ public ArtifactRegistryStubSettings.Builder getStubSettingsBuilder() { return ((ArtifactRegistryStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; diff --git a/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/stub/ArtifactRegistryStubSettings.java b/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/stub/ArtifactRegistryStubSettings.java index 8c6ff53f..970b44fc 100644 --- a/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/stub/ArtifactRegistryStubSettings.java +++ b/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/stub/ArtifactRegistryStubSettings.java @@ -1103,14 +1103,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } diff --git a/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/stub/GrpcArtifactRegistryStub.java b/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/stub/GrpcArtifactRegistryStub.java index 0439dd66..895bd8f1 100644 --- a/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/stub/GrpcArtifactRegistryStub.java +++ b/google-cloud-artifact-registry/src/main/java/com/google/devtools/artifactregistry/v1beta2/stub/GrpcArtifactRegistryStub.java @@ -29,7 +29,6 @@ import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; import com.google.common.collect.ImmutableMap; import com.google.devtools.artifactregistry.v1beta2.CreateRepositoryRequest; @@ -72,7 +71,6 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -380,261 +378,200 @@ protected GrpcArtifactRegistryStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(listRepositoriesMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListRepositoriesRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings getRepositoryTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getRepositoryMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetRepositoryRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings createRepositoryTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createRepositoryMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateRepositoryRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings updateRepositoryTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateRepositoryMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateRepositoryRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "repository.name", String.valueOf(request.getRepository().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("repository.name", String.valueOf(request.getRepository().getName())); + return params.build(); }) .build(); GrpcCallSettings deleteRepositoryTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteRepositoryMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteRepositoryRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listPackagesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listPackagesMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListPackagesRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings getPackageTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getPackageMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetPackageRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings deletePackageTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deletePackageMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeletePackageRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listVersionsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listVersionsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListVersionsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings getVersionTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getVersionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetVersionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings deleteVersionTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteVersionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteVersionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listFilesTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listFilesMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListFilesRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings getFileTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getFileMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetFileRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listTagsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listTagsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListTagsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings getTagTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getTagMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetTagRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings createTagTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createTagMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateTagRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings updateTagTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateTagMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateTagRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("tag.name", String.valueOf(request.getTag().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("tag.name", String.valueOf(request.getTag().getName())); + return params.build(); }) .build(); GrpcCallSettings deleteTagTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteTagMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteTagRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings setIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(setIamPolicyMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(SetIamPolicyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); }) .build(); GrpcCallSettings getIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getIamPolicyMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetIamPolicyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); }) .build(); GrpcCallSettings @@ -642,13 +579,10 @@ public Map extract(GetIamPolicyRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(testIamPermissionsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(TestIamPermissionsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); }) .build(); @@ -924,7 +858,13 @@ public UnaryCallable getIamPolicyCallable() { @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-artifact-registry/src/test/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistryClientTest.java b/google-cloud-artifact-registry/src/test/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistryClientTest.java index a4c0d70b..bbbc82da 100644 --- a/google-cloud-artifact-registry/src/test/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistryClientTest.java +++ b/google-cloud-artifact-registry/src/test/java/com/google/devtools/artifactregistry/v1beta2/ArtifactRegistryClientTest.java @@ -147,7 +147,7 @@ public void listRepositoriesExceptionTest() throws Exception { public void getRepositoryTest() throws Exception { Repository expectedResponse = Repository.newBuilder() - .setName(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setName("name3373707") .setDescription("description-1724546052") .putAllLabels(new HashMap()) .setCreateTime(Timestamp.newBuilder().build()) @@ -190,7 +190,7 @@ public void getRepositoryExceptionTest() throws Exception { public void createRepositoryTest() throws Exception { Repository expectedResponse = Repository.newBuilder() - .setName(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setName("name3373707") .setDescription("description-1724546052") .putAllLabels(new HashMap()) .setCreateTime(Timestamp.newBuilder().build()) @@ -248,7 +248,7 @@ public void createRepositoryExceptionTest() throws Exception { public void updateRepositoryTest() throws Exception { Repository expectedResponse = Repository.newBuilder() - .setName(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setName("name3373707") .setDescription("description-1724546052") .putAllLabels(new HashMap()) .setCreateTime(Timestamp.newBuilder().build()) @@ -635,7 +635,7 @@ public void listFilesExceptionTest() throws Exception { public void getFileTest() throws Exception { File expectedResponse = File.newBuilder() - .setName(FileName.of("[PROJECT]", "[LOCATION]", "[REPO]", "[FILE]").toString()) + .setName("name3373707") .setSizeBytes(-1796325715) .addAllHashes(new ArrayList()) .setCreateTime(Timestamp.newBuilder().build()) @@ -881,7 +881,7 @@ public void setIamPolicyTest() throws Exception { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() - .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setResource("SetIamPolicyRequest1223629066".toString()) .setPolicy(Policy.newBuilder().build()) .build(); @@ -908,7 +908,7 @@ public void setIamPolicyExceptionTest() throws Exception { try { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() - .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setResource("SetIamPolicyRequest1223629066".toString()) .setPolicy(Policy.newBuilder().build()) .build(); client.setIamPolicy(request); @@ -930,7 +930,7 @@ public void getIamPolicyTest() throws Exception { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() - .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setResource("GetIamPolicyRequest-1527610370".toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); @@ -957,7 +957,7 @@ public void getIamPolicyExceptionTest() throws Exception { try { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() - .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setResource("GetIamPolicyRequest-1527610370".toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); @@ -975,7 +975,7 @@ public void testIamPermissionsTest() throws Exception { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() - .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setResource("TestIamPermissionsRequest942398222".toString()) .addAllPermissions(new ArrayList()) .build(); @@ -1002,7 +1002,7 @@ public void testIamPermissionsExceptionTest() throws Exception { try { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() - .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString()) + .setResource("TestIamPermissionsRequest942398222".toString()) .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); diff --git a/proto-google-cloud-artifact-registry-v1beta2/clirr-ignored-differences.xml b/proto-google-cloud-artifact-registry-v1beta2/clirr-ignored-differences.xml index 466e46fd..72079e9d 100644 --- a/proto-google-cloud-artifact-registry-v1beta2/clirr-ignored-differences.xml +++ b/proto-google-cloud-artifact-registry-v1beta2/clirr-ignored-differences.xml @@ -16,4 +16,12 @@ com/google/devtools/artifactregistry/v1beta2/*OrBuilder boolean has*(*) + + 8001 + com/google/devtools/artifactregistry/v1beta2/FileName* + + + 8001 + com/google/devtools/artifactregistry/v1beta2/RepositoryName* + diff --git a/proto-google-cloud-artifact-registry-v1beta2/pom.xml b/proto-google-cloud-artifact-registry-v1beta2/pom.xml index 414fc1b5..4e58e678 100644 --- a/proto-google-cloud-artifact-registry-v1beta2/pom.xml +++ b/proto-google-cloud-artifact-registry-v1beta2/pom.xml @@ -17,10 +17,6 @@ com.google.protobuf protobuf-java - - com.google.guava - guava - com.google.api.grpc proto-google-iam-v1 @@ -29,10 +25,6 @@ com.google.api.grpc proto-google-common-protos - - com.google.api - api-common - diff --git a/proto-google-cloud-artifact-registry-v1beta2/src/main/java/com/google/devtools/artifactregistry/v1beta2/FileName.java b/proto-google-cloud-artifact-registry-v1beta2/src/main/java/com/google/devtools/artifactregistry/v1beta2/FileName.java deleted file mode 100644 index 8702ca15..00000000 --- a/proto-google-cloud-artifact-registry-v1beta2/src/main/java/com/google/devtools/artifactregistry/v1beta2/FileName.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 2021 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.devtools.artifactregistry.v1beta2; - -import com.google.api.pathtemplate.PathTemplate; -import com.google.api.resourcenames.ResourceName; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -@Generated("by gapic-generator-java") -public class FileName implements ResourceName { - private static final PathTemplate PROJECT_LOCATION_REPO_FILE = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/repositories/{repo}/files/{file}"); - private volatile Map fieldValuesMap; - private final String project; - private final String location; - private final String repo; - private final String file; - - @Deprecated - protected FileName() { - project = null; - location = null; - repo = null; - file = null; - } - - private FileName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - repo = Preconditions.checkNotNull(builder.getRepo()); - file = Preconditions.checkNotNull(builder.getFile()); - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getRepo() { - return repo; - } - - public String getFile() { - return file; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static FileName of(String project, String location, String repo, String file) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setRepo(repo) - .setFile(file) - .build(); - } - - public static String format(String project, String location, String repo, String file) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setRepo(repo) - .setFile(file) - .build() - .toString(); - } - - public static FileName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_LOCATION_REPO_FILE.validatedMatch( - formattedString, "FileName.parse: formattedString not in valid format"); - return of( - matchMap.get("project"), - matchMap.get("location"), - matchMap.get("repo"), - matchMap.get("file")); - } - - public static List parseList(List formattedStrings) { - List list = new ArrayList<>(formattedStrings.size()); - for (String formattedString : formattedStrings) { - list.add(parse(formattedString)); - } - return list; - } - - public static List toStringList(List values) { - List list = new ArrayList<>(values.size()); - for (FileName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_REPO_FILE.matches(formattedString); - } - - @Override - public Map getFieldValuesMap() { - if (fieldValuesMap == null) { - synchronized (this) { - if (fieldValuesMap == null) { - ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - if (project != null) { - fieldMapBuilder.put("project", project); - } - if (location != null) { - fieldMapBuilder.put("location", location); - } - if (repo != null) { - fieldMapBuilder.put("repo", repo); - } - if (file != null) { - fieldMapBuilder.put("file", file); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_LOCATION_REPO_FILE.instantiate( - "project", project, "location", location, "repo", repo, "file", file); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - FileName that = ((FileName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.location, that.location) - && Objects.equals(this.repo, that.repo) - && Objects.equals(this.file, that.file); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(repo); - h *= 1000003; - h ^= Objects.hashCode(file); - return h; - } - - /** Builder for projects/{project}/locations/{location}/repositories/{repo}/files/{file}. */ - public static class Builder { - private String project; - private String location; - private String repo; - private String file; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getRepo() { - return repo; - } - - public String getFile() { - return file; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setRepo(String repo) { - this.repo = repo; - return this; - } - - public Builder setFile(String file) { - this.file = file; - return this; - } - - private Builder(FileName fileName) { - this.project = fileName.project; - this.location = fileName.location; - this.repo = fileName.repo; - this.file = fileName.file; - } - - public FileName build() { - return new FileName(this); - } - } -} diff --git a/proto-google-cloud-artifact-registry-v1beta2/src/main/java/com/google/devtools/artifactregistry/v1beta2/RepositoryName.java b/proto-google-cloud-artifact-registry-v1beta2/src/main/java/com/google/devtools/artifactregistry/v1beta2/RepositoryName.java deleted file mode 100644 index 269d646a..00000000 --- a/proto-google-cloud-artifact-registry-v1beta2/src/main/java/com/google/devtools/artifactregistry/v1beta2/RepositoryName.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2021 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.devtools.artifactregistry.v1beta2; - -import com.google.api.pathtemplate.PathTemplate; -import com.google.api.resourcenames.ResourceName; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -@Generated("by gapic-generator-java") -public class RepositoryName implements ResourceName { - private static final PathTemplate PROJECT_LOCATION_REPOSITORY = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/repositories/{repository}"); - private volatile Map fieldValuesMap; - private final String project; - private final String location; - private final String repository; - - @Deprecated - protected RepositoryName() { - project = null; - location = null; - repository = null; - } - - private RepositoryName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - repository = Preconditions.checkNotNull(builder.getRepository()); - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getRepository() { - return repository; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static RepositoryName of(String project, String location, String repository) { - return newBuilder().setProject(project).setLocation(location).setRepository(repository).build(); - } - - public static String format(String project, String location, String repository) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setRepository(repository) - .build() - .toString(); - } - - public static RepositoryName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_LOCATION_REPOSITORY.validatedMatch( - formattedString, "RepositoryName.parse: formattedString not in valid format"); - return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("repository")); - } - - public static List parseList(List formattedStrings) { - List list = new ArrayList<>(formattedStrings.size()); - for (String formattedString : formattedStrings) { - list.add(parse(formattedString)); - } - return list; - } - - public static List toStringList(List values) { - List list = new ArrayList<>(values.size()); - for (RepositoryName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_REPOSITORY.matches(formattedString); - } - - @Override - public Map getFieldValuesMap() { - if (fieldValuesMap == null) { - synchronized (this) { - if (fieldValuesMap == null) { - ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - if (project != null) { - fieldMapBuilder.put("project", project); - } - if (location != null) { - fieldMapBuilder.put("location", location); - } - if (repository != null) { - fieldMapBuilder.put("repository", repository); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_LOCATION_REPOSITORY.instantiate( - "project", project, "location", location, "repository", repository); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - RepositoryName that = ((RepositoryName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.location, that.location) - && Objects.equals(this.repository, that.repository); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(repository); - return h; - } - - /** Builder for projects/{project}/locations/{location}/repositories/{repository}. */ - public static class Builder { - private String project; - private String location; - private String repository; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getRepository() { - return repository; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setRepository(String repository) { - this.repository = repository; - return this; - } - - private Builder(RepositoryName repositoryName) { - this.project = repositoryName.project; - this.location = repositoryName.location; - this.repository = repositoryName.repository; - } - - public RepositoryName build() { - return new RepositoryName(this); - } - } -}