Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

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

Merged
merged 10 commits into from Jun 28, 2022
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-appengine-admin</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
</dependency>
```

If you are using Gradle without BOM, add this to your dependencies

```Groovy
implementation 'com.google.cloud:google-cloud-appengine-admin:2.2.0'
implementation 'com.google.cloud:google-cloud-appengine-admin:2.3.0'
```

If you are using SBT, add this to your dependencies

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-appengine-admin" % "2.2.0"
libraryDependencies += "com.google.cloud" % "google-cloud-appengine-admin" % "2.3.0"
```

## Authentication
Expand Down
16 changes: 16 additions & 0 deletions google-cloud-appengine-admin/pom.xml
Expand Up @@ -58,6 +58,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 All @@ -77,12 +81,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
Expand Up @@ -16,15 +16,14 @@

package com.google.appengine.v1;

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.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.appengine.v1.stub.ApplicationsStub;
import com.google.appengine.v1.stub.ApplicationsStubSettings;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
Expand Down Expand Up @@ -93,13 +92,28 @@
* ApplicationsClient applicationsClient = ApplicationsClient.create(applicationsSettings);
* }</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.
* ApplicationsSettings applicationsSettings =
* ApplicationsSettings.newBuilder()
* .setTransportChannelProvider(
* ApplicationsSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* ApplicationsClient applicationsClient = ApplicationsClient.create(applicationsSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class ApplicationsClient implements BackgroundResource {
private final ApplicationsSettings settings;
private final ApplicationsStub stub;
private final OperationsClient operationsClient;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;

/** Constructs an instance of ApplicationsClient with default settings. */
public static final ApplicationsClient create() throws IOException {
Expand All @@ -118,7 +132,6 @@ public static final ApplicationsClient create(ApplicationsSettings settings) thr
* Constructs an instance of ApplicationsClient, using the given stub for making calls. This is
* for advanced usage - prefer using create(ApplicationsSettings).
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final ApplicationsClient create(ApplicationsStub stub) {
return new ApplicationsClient(stub);
}
Expand All @@ -131,21 +144,23 @@ public static final ApplicationsClient create(ApplicationsStub stub) {
protected ApplicationsClient(ApplicationsSettings settings) throws IOException {
this.settings = settings;
this.stub = ((ApplicationsStubSettings) 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 ApplicationsClient(ApplicationsStub 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 ApplicationsSettings getSettings() {
return settings;
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public ApplicationsStub getStub() {
return stub;
}
Expand All @@ -154,10 +169,18 @@ public ApplicationsStub 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.
*/
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about an application.
Expand Down
Expand Up @@ -21,6 +21,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 @@ -132,11 +133,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return ApplicationsStubSettings.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 ApplicationsStubSettings.defaultGrpcTransportProviderBuilder();
}

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

public static TransportChannelProvider defaultTransportChannelProvider() {
return ApplicationsStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -146,11 +154,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return ApplicationsStubSettings.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 @@ -188,6 +202,11 @@ private static Builder createDefault() {
return new Builder(ApplicationsStubSettings.newBuilder());
}

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

public ApplicationsStubSettings.Builder getStubSettingsBuilder() {
return ((ApplicationsStubSettings.Builder) getStubSettings());
}
Expand Down
Expand Up @@ -18,7 +18,6 @@

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
Expand Down Expand Up @@ -108,6 +107,21 @@
* AuthorizedCertificatesClient.create(authorizedCertificatesSettings);
* }</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.
* AuthorizedCertificatesSettings authorizedCertificatesSettings =
* AuthorizedCertificatesSettings.newBuilder()
* .setTransportChannelProvider(
* AuthorizedCertificatesSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* AuthorizedCertificatesClient authorizedCertificatesClient =
* AuthorizedCertificatesClient.create(authorizedCertificatesSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
Expand All @@ -133,7 +147,6 @@ public static final AuthorizedCertificatesClient create(AuthorizedCertificatesSe
* Constructs an instance of AuthorizedCertificatesClient, using the given stub for making calls.
* This is for advanced usage - prefer using create(AuthorizedCertificatesSettings).
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final AuthorizedCertificatesClient create(AuthorizedCertificatesStub stub) {
return new AuthorizedCertificatesClient(stub);
}
Expand All @@ -149,7 +162,6 @@ protected AuthorizedCertificatesClient(AuthorizedCertificatesSettings settings)
this.stub = ((AuthorizedCertificatesStubSettings) settings.getStubSettings()).createStub();
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected AuthorizedCertificatesClient(AuthorizedCertificatesStub stub) {
this.settings = null;
this.stub = stub;
Expand All @@ -159,7 +171,6 @@ public final AuthorizedCertificatesSettings getSettings() {
return settings;
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public AuthorizedCertificatesStub getStub() {
return stub;
}
Expand Down Expand Up @@ -253,7 +264,7 @@ public final ListAuthorizedCertificatesPagedResponse listAuthorizedCertificates(
* while (true) {
* ListAuthorizedCertificatesResponse response =
* authorizedCertificatesClient.listAuthorizedCertificatesCallable().call(request);
* for (AuthorizedCertificate element : response.getResponsesList()) {
* for (AuthorizedCertificate element : response.getCertificatesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down
Expand Up @@ -23,6 +23,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 @@ -136,11 +137,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return AuthorizedCertificatesStubSettings.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 AuthorizedCertificatesStubSettings.defaultGrpcTransportProviderBuilder();
}

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

public static TransportChannelProvider defaultTransportChannelProvider() {
return AuthorizedCertificatesStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -150,11 +158,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return AuthorizedCertificatesStubSettings.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 @@ -193,6 +207,11 @@ private static Builder createDefault() {
return new Builder(AuthorizedCertificatesStubSettings.newBuilder());
}

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

public AuthorizedCertificatesStubSettings.Builder getStubSettingsBuilder() {
return ((AuthorizedCertificatesStubSettings.Builder) getStubSettings());
}
Expand Down