Skip to content

Commit

Permalink
fix: update gapic-generator-java with mock service generation fixes (g…
Browse files Browse the repository at this point in the history
…oogleapis#266)

* chore(deps): upgrade gapic-generator-java to 2.8.0 and update gax-java to 2.18.1

PiperOrigin-RevId: 450543911

Source-Link: googleapis/googleapis@5528344

Source-Link: https://github.com/googleapis/googleapis-gen/commit/9f6775cab1958982b88967a43e5e806af0f135db
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWY2Nzc1Y2FiMTk1ODk4MmI4ODk2N2E0M2U1ZTgwNmFmMGYxMzVkYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Integrate new gapic-generator-java and rules_gapic

PiperOrigin-RevId: 454027580

Source-Link: googleapis/googleapis@1b22277

Source-Link: https://github.com/googleapis/googleapis-gen/commit/e04cea20d0d12eb5c3bdb360a9e72b654edcb638
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTA0Y2VhMjBkMGQxMmViNWMzYmRiMzYwYTllNzJiNjU0ZWRjYjYzOCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Enable REST transport for most of Java and Go clients

PiperOrigin-RevId: 456641589

Source-Link: googleapis/googleapis@8a251f5

Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Update pom.xml

* fix: update gapic-generator-java with mock service generation fixes

PiperOrigin-RevId: 457524730

Source-Link: googleapis/googleapis@917e7f2

Source-Link: https://github.com/googleapis/googleapis-gen/commit/2497f9a069d3f6b2d6810d5a4e239cda1e7e5a39
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjQ5N2Y5YTA2OWQzZjZiMmQ2ODEwZDVhNGUyMzljZGExZTdlNWEzOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Neenu Shaji <[email protected]>
  • Loading branch information
3 people authored Jun 28, 2022
1 parent 7cb3c75 commit 69c179b
Show file tree
Hide file tree
Showing 17 changed files with 7,308 additions and 89 deletions.
16 changes: 16 additions & 0 deletions java-artifact-registry/google-cloud-artifact-registry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
Expand Down Expand Up @@ -90,12 +94,24 @@
<scope>test</scope>
</dependency>
<!-- Need testing utility classes for generated gRPC clients tests -->
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
Expand All @@ -36,7 +37,6 @@
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
Expand Down Expand Up @@ -125,13 +125,29 @@
* ArtifactRegistryClient.create(artifactRegistrySettings);
* }</pre>
*
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* ArtifactRegistrySettings artifactRegistrySettings =
* ArtifactRegistrySettings.newBuilder()
* .setTransportChannelProvider(
* ArtifactRegistrySettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* ArtifactRegistryClient artifactRegistryClient =
* ArtifactRegistryClient.create(artifactRegistrySettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class ArtifactRegistryClient implements BackgroundResource {
private final ArtifactRegistrySettings settings;
private final ArtifactRegistryStub stub;
private final OperationsClient operationsClient;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;

/** Constructs an instance of ArtifactRegistryClient with default settings. */
public static final ArtifactRegistryClient create() throws IOException {
Expand All @@ -151,7 +167,6 @@ public static final ArtifactRegistryClient create(ArtifactRegistrySettings setti
* Constructs an instance of ArtifactRegistryClient, using the given stub for making calls. This
* is for advanced usage - prefer using create(ArtifactRegistrySettings).
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final ArtifactRegistryClient create(ArtifactRegistryStub stub) {
return new ArtifactRegistryClient(stub);
}
Expand All @@ -164,21 +179,23 @@ public static final ArtifactRegistryClient create(ArtifactRegistryStub stub) {
protected ArtifactRegistryClient(ArtifactRegistrySettings settings) throws IOException {
this.settings = settings;
this.stub = ((ArtifactRegistryStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected ArtifactRegistryClient(ArtifactRegistryStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

public final ArtifactRegistrySettings getSettings() {
return settings;
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public ArtifactRegistryStub getStub() {
return stub;
}
Expand All @@ -187,10 +204,19 @@ public ArtifactRegistryStub getStub() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final OperationsClient getOperationsClient() {
public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}

/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists docker images.
Expand Down Expand Up @@ -295,7 +321,7 @@ public final ListDockerImagesPagedResponse listDockerImages(ListDockerImagesRequ
* while (true) {
* ListDockerImagesResponse response =
* artifactRegistryClient.listDockerImagesCallable().call(request);
* for (DockerImage element : response.getResponsesList()) {
* for (DockerImage element : response.getDockerImagesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -707,7 +733,7 @@ public final ListRepositoriesPagedResponse listRepositories(ListRepositoriesRequ
* while (true) {
* ListRepositoriesResponse response =
* artifactRegistryClient.listRepositoriesCallable().call(request);
* for (Repository element : response.getResponsesList()) {
* for (Repository element : response.getRepositoriesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -1297,7 +1323,7 @@ public final ListPackagesPagedResponse listPackages(ListPackagesRequest request)
* .build();
* while (true) {
* ListPackagesResponse response = artifactRegistryClient.listPackagesCallable().call(request);
* for (Package element : response.getResponsesList()) {
* for (Package element : response.getPackagesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -1586,7 +1612,7 @@ public final ListVersionsPagedResponse listVersions(ListVersionsRequest request)
* .build();
* while (true) {
* ListVersionsResponse response = artifactRegistryClient.listVersionsCallable().call(request);
* for (Version element : response.getResponsesList()) {
* for (Version element : response.getVersionsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -1882,7 +1908,7 @@ public final UnaryCallable<ListFilesRequest, ListFilesPagedResponse> listFilesPa
* .build();
* while (true) {
* ListFilesResponse response = artifactRegistryClient.listFilesCallable().call(request);
* for (File element : response.getResponsesList()) {
* for (File element : response.getFilesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -2068,7 +2094,7 @@ public final UnaryCallable<ListTagsRequest, ListTagsPagedResponse> listTagsPaged
* .build();
* while (true) {
* ListTagsResponse response = artifactRegistryClient.listTagsCallable().call(request);
* for (Tag element : response.getResponsesList()) {
* for (Tag element : response.getTagsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -2388,9 +2414,7 @@ public final UnaryCallable<DeleteTagRequest, Empty> deleteTagCallable() {
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* SetIamPolicyRequest request =
* SetIamPolicyRequest.newBuilder()
* .setResource(
* DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
* .toString())
* .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
* .setPolicy(Policy.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
Expand All @@ -2417,9 +2441,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* SetIamPolicyRequest request =
* SetIamPolicyRequest.newBuilder()
* .setResource(
* DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
* .toString())
* .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
* .setPolicy(Policy.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
Expand All @@ -2445,9 +2467,7 @@ public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* GetIamPolicyRequest request =
* GetIamPolicyRequest.newBuilder()
* .setResource(
* DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
* .toString())
* .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
* .setOptions(GetPolicyOptions.newBuilder().build())
* .build();
* Policy response = artifactRegistryClient.getIamPolicy(request);
Expand All @@ -2473,9 +2493,7 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* GetIamPolicyRequest request =
* GetIamPolicyRequest.newBuilder()
* .setResource(
* DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
* .toString())
* .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
* .setOptions(GetPolicyOptions.newBuilder().build())
* .build();
* ApiFuture<Policy> future = artifactRegistryClient.getIamPolicyCallable().futureCall(request);
Expand All @@ -2500,9 +2518,7 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* TestIamPermissionsRequest request =
* TestIamPermissionsRequest.newBuilder()
* .setResource(
* DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
* .toString())
* .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
* .addAllPermissions(new ArrayList<String>())
* .build();
* TestIamPermissionsResponse response = artifactRegistryClient.testIamPermissions(request);
Expand All @@ -2528,9 +2544,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* TestIamPermissionsRequest request =
* TestIamPermissionsRequest.newBuilder()
* .setResource(
* DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
* .toString())
* .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
* .addAllPermissions(new ArrayList<String>())
* .build();
* ApiFuture<TestIamPermissionsResponse> future =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
Expand Down Expand Up @@ -294,11 +295,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return ArtifactRegistryStubSettings.defaultCredentialsProviderBuilder();
}

/** Returns a builder for the default ChannelProvider for this service. */
/** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return ArtifactRegistryStubSettings.defaultGrpcTransportProviderBuilder();
}

/** Returns a builder for the default REST ChannelProvider for this service. */
@BetaApi
public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder() {
return ArtifactRegistryStubSettings.defaultHttpJsonTransportProviderBuilder();
}

public static TransportChannelProvider defaultTransportChannelProvider() {
return ArtifactRegistryStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -308,11 +316,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return ArtifactRegistryStubSettings.defaultApiClientHeaderProviderBuilder();
}

/** Returns a new builder for this class. */
/** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}

/** Returns a new REST builder for this class. */
@BetaApi
public static Builder newHttpJsonBuilder() {
return Builder.createHttpJsonDefault();
}

/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
Expand Down Expand Up @@ -350,6 +364,11 @@ private static Builder createDefault() {
return new Builder(ArtifactRegistryStubSettings.newBuilder());
}

@BetaApi
private static Builder createHttpJsonDefault() {
return new Builder(ArtifactRegistryStubSettings.newHttpJsonBuilder());
}

public ArtifactRegistryStubSettings.Builder getStubSettingsBuilder() {
return ((ArtifactRegistryStubSettings.Builder) getStubSettings());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@
public abstract class ArtifactRegistryStub implements BackgroundResource {

public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
return null;
}

public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
return null;
}

public UnaryCallable<ListDockerImagesRequest, ListDockerImagesPagedResponse>
Expand Down
Loading

0 comments on commit 69c179b

Please sign in to comment.