Skip to content

Commit

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

* feat: generating GAPIC libraries for Google Cloud Functions v2beta

PiperOrigin-RevId: 454900284

Source-Link: googleapis/googleapis@05576c8

Source-Link: https://github.com/googleapis/googleapis-gen/commit/5b2f0e36d27aa58fbde15d1e7ab7138cf5ea837a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWIyZjBlMzZkMjdhYTU4ZmJkZTE1ZDFlN2FiNzEzOGNmNWVhODM3YSJ9

feat: generating GAPIC libraries for Google Cloud Functions v2alpha

PiperOrigin-RevId: 454899846

Source-Link: googleapis/googleapis@7088e38

Source-Link: https://github.com/googleapis/googleapis-gen/commit/c3673f892c803b9c3f17841bcdee7db6b3179444
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzM2NzNmODkyYzgwM2I5YzNmMTc4NDFiY2RlZTdkYjZiMzE3OTQ0NCJ9

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

feat: added support for CMEK
docs: clarified wording around quota usage

Clients can now specify the docker registry to use for storing function Docker images and KMS crypto keys for function source code objects.

PiperOrigin-RevId: 453234231

Source-Link: googleapis/googleapis@d180952

Source-Link: https://github.com/googleapis/googleapis-gen/commit/836ff24b7e881ef46acd17836c46ed1a9832b195
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODM2ZmYyNGI3ZTg4MWVmNDZhY2QxNzgzNmM0NmVkMWE5ODMyYjE5NSJ9

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

* 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

* 🦉 Updates from OwlBot post-processor

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

* chore: add grpc-google-iam-v1

* chore: remove unused dependency

* 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

* remove proto-google-iam-v1 dependency

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Neenu Shaji <[email protected]>
Co-authored-by: Neenu1995 <[email protected]>
Co-authored-by: Vadym Matsishevskyi <[email protected]>
  • Loading branch information
5 people authored Jun 30, 2022
1 parent ca31847 commit 898dfd9
Show file tree
Hide file tree
Showing 224 changed files with 118,578 additions and 254 deletions.
20 changes: 20 additions & 0 deletions java-functions/google-cloud-functions-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,31 @@
<artifactId>grpc-google-cloud-functions-v1</artifactId>
<version>2.4.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-functions-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-functions-v2beta</artifactId>
<version>2.4.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-functions-v2beta:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-functions-v2alpha</artifactId>
<version>2.4.2-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-functions-v2alpha:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-functions-v1</artifactId>
<version>2.4.2-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-functions-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-functions-v2beta</artifactId>
<version>2.4.2-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-functions-v2beta:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-functions-v2alpha</artifactId>
<version>2.4.2-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-functions-v2alpha:current} -->
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
43 changes: 43 additions & 0 deletions java-functions/google-cloud-functions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,24 @@
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v1</artifactId>
</dependency>


<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-functions-v2alpha</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-functions-v2beta</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-functions-v1</artifactId>
Expand All @@ -58,6 +75,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 @@ -79,13 +100,35 @@
<artifactId>grpc-google-cloud-functions-v1</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-functions-v2alpha</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-functions-v2beta</artifactId>
<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 java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -111,13 +111,29 @@
* CloudFunctionsServiceClient.create(cloudFunctionsServiceSettings);
* }</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.
* CloudFunctionsServiceSettings cloudFunctionsServiceSettings =
* CloudFunctionsServiceSettings.newBuilder()
* .setTransportChannelProvider(
* CloudFunctionsServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* CloudFunctionsServiceClient cloudFunctionsServiceClient =
* CloudFunctionsServiceClient.create(cloudFunctionsServiceSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class CloudFunctionsServiceClient implements BackgroundResource {
private final CloudFunctionsServiceSettings settings;
private final CloudFunctionsServiceStub stub;
private final OperationsClient operationsClient;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;

/** Constructs an instance of CloudFunctionsServiceClient with default settings. */
public static final CloudFunctionsServiceClient create() throws IOException {
Expand All @@ -137,7 +153,6 @@ public static final CloudFunctionsServiceClient create(CloudFunctionsServiceSett
* Constructs an instance of CloudFunctionsServiceClient, using the given stub for making calls.
* This is for advanced usage - prefer using create(CloudFunctionsServiceSettings).
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final CloudFunctionsServiceClient create(CloudFunctionsServiceStub stub) {
return new CloudFunctionsServiceClient(stub);
}
Expand All @@ -150,21 +165,23 @@ public static final CloudFunctionsServiceClient create(CloudFunctionsServiceStub
protected CloudFunctionsServiceClient(CloudFunctionsServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((CloudFunctionsServiceStubSettings) 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 CloudFunctionsServiceClient(CloudFunctionsServiceStub 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 CloudFunctionsServiceSettings getSettings() {
return settings;
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public CloudFunctionsServiceStub getStub() {
return stub;
}
Expand All @@ -173,10 +190,19 @@ public CloudFunctionsServiceStub 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.
/**
* Returns a list of functions that belong to the requested project.
Expand Down Expand Up @@ -259,7 +285,7 @@ public final ListFunctionsPagedResponse listFunctions(ListFunctionsRequest reque
* while (true) {
* ListFunctionsResponse response =
* cloudFunctionsServiceClient.listFunctionsCallable().call(request);
* for (CloudFunction element : response.getResponsesList()) {
* for (CloudFunction element : response.getFunctionsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -930,7 +956,12 @@ public final UnaryCallable<CallFunctionRequest, CallFunctionResponse> callFuncti
* try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
* CloudFunctionsServiceClient.create()) {
* GenerateUploadUrlRequest request =
* GenerateUploadUrlRequest.newBuilder().setParent("parent-995424086").build();
* GenerateUploadUrlRequest.newBuilder()
* .setParent("parent-995424086")
* .setKmsKeyName(
* CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
* .toString())
* .build();
* GenerateUploadUrlResponse response = cloudFunctionsServiceClient.generateUploadUrl(request);
* }
* }</pre>
Expand Down Expand Up @@ -981,7 +1012,12 @@ public final GenerateUploadUrlResponse generateUploadUrl(GenerateUploadUrlReques
* try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
* CloudFunctionsServiceClient.create()) {
* GenerateUploadUrlRequest request =
* GenerateUploadUrlRequest.newBuilder().setParent("parent-995424086").build();
* GenerateUploadUrlRequest.newBuilder()
* .setParent("parent-995424086")
* .setKmsKeyName(
* CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
* .toString())
* .build();
* ApiFuture<GenerateUploadUrlResponse> future =
* cloudFunctionsServiceClient.generateUploadUrlCallable().futureCall(request);
* // Do something.
Expand Down
Original file line number Diff line number Diff line change
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 @@ -186,11 +187,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return CloudFunctionsServiceStubSettings.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 CloudFunctionsServiceStubSettings.defaultGrpcTransportProviderBuilder();
}

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

public static TransportChannelProvider defaultTransportChannelProvider() {
return CloudFunctionsServiceStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -200,11 +208,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return CloudFunctionsServiceStubSettings.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 @@ -243,6 +257,11 @@ private static Builder createDefault() {
return new Builder(CloudFunctionsServiceStubSettings.newBuilder());
}

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

public CloudFunctionsServiceStubSettings.Builder getStubSettingsBuilder() {
return ((CloudFunctionsServiceStubSettings.Builder) getStubSettings());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

/**
* The interfaces provided are listed below, along with usage samples.
* A client to Cloud Functions API
*
* <p>The interfaces provided are listed below, along with usage samples.
*
* <p>======================= CloudFunctionsServiceClient =======================
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@
public abstract class CloudFunctionsServiceStub 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<ListFunctionsRequest, ListFunctionsPagedResponse>
Expand Down
Loading

0 comments on commit 898dfd9

Please sign in to comment.