diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceClient.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceClient.java
index e9d34b99..89cb411e 100644
--- a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceClient.java
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceClient.java
@@ -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;
@@ -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;
@@ -111,13 +111,29 @@
* CloudFunctionsServiceClient.create(cloudFunctionsServiceSettings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@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);
+ * }
+ *
* 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 {
@@ -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);
}
@@ -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;
}
@@ -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.
@@ -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();
@@ -930,7 +956,12 @@ public final UnaryCallable 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);
* }
* }
@@ -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 future =
* cloudFunctionsServiceClient.generateUploadUrlCallable().futureCall(request);
* // Do something.
diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceSettings.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceSettings.java
index 02e20d63..b7b948fe 100644
--- a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceSettings.java
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceSettings.java
@@ -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;
@@ -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();
}
@@ -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);
@@ -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());
}
diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/package-info.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/package-info.java
index 7a9060ac..2f0560c1 100644
--- a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/package-info.java
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/package-info.java
@@ -15,7 +15,9 @@
*/
/**
- * The interfaces provided are listed below, along with usage samples.
+ * A client to Cloud Functions API
+ *
+ * The interfaces provided are listed below, along with usage samples.
*
*
======================= CloudFunctionsServiceClient =======================
*
diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/CloudFunctionsServiceStub.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/CloudFunctionsServiceStub.java
index 9e279bca..5566507b 100644
--- a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/CloudFunctionsServiceStub.java
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/CloudFunctionsServiceStub.java
@@ -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
diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/CloudFunctionsServiceStubSettings.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/CloudFunctionsServiceStubSettings.java
index 537e8b50..b7280156 100644
--- a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/CloudFunctionsServiceStubSettings.java
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/CloudFunctionsServiceStubSettings.java
@@ -28,6 +28,9 @@
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
@@ -271,13 +274,17 @@ public UnaryCallSettings getIamPolicySettings() {
return testIamPermissionsSettings;
}
- @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public CloudFunctionsServiceStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcCloudFunctionsServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonCloudFunctionsServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -310,18 +317,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** 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 InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(CloudFunctionsServiceStubSettings.class))
@@ -329,11 +343,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(CloudFunctionsServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return CloudFunctionsServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -525,6 +558,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.listFunctionsSettings()
diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/HttpJsonCloudFunctionsServiceCallableFactory.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/HttpJsonCloudFunctionsServiceCallableFactory.java
new file mode 100644
index 00000000..a4deb7e0
--- /dev/null
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/HttpJsonCloudFunctionsServiceCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 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.cloud.functions.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the CloudFunctionsService service API.
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonCloudFunctionsServiceCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/HttpJsonCloudFunctionsServiceStub.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/HttpJsonCloudFunctionsServiceStub.java
new file mode 100644
index 00000000..2b76d736
--- /dev/null
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/stub/HttpJsonCloudFunctionsServiceStub.java
@@ -0,0 +1,817 @@
+/*
+ * Copyright 2022 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.cloud.functions.v1.stub;
+
+import static com.google.cloud.functions.v1.CloudFunctionsServiceClient.ListFunctionsPagedResponse;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.functions.v1.CallFunctionRequest;
+import com.google.cloud.functions.v1.CallFunctionResponse;
+import com.google.cloud.functions.v1.CloudFunction;
+import com.google.cloud.functions.v1.CreateFunctionRequest;
+import com.google.cloud.functions.v1.DeleteFunctionRequest;
+import com.google.cloud.functions.v1.GenerateDownloadUrlRequest;
+import com.google.cloud.functions.v1.GenerateDownloadUrlResponse;
+import com.google.cloud.functions.v1.GenerateUploadUrlRequest;
+import com.google.cloud.functions.v1.GenerateUploadUrlResponse;
+import com.google.cloud.functions.v1.GetFunctionRequest;
+import com.google.cloud.functions.v1.ListFunctionsRequest;
+import com.google.cloud.functions.v1.ListFunctionsResponse;
+import com.google.cloud.functions.v1.OperationMetadataV1;
+import com.google.cloud.functions.v1.UpdateFunctionRequest;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Empty;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the CloudFunctionsService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonCloudFunctionsServiceStub extends CloudFunctionsServiceStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(Empty.getDescriptor())
+ .add(CloudFunction.getDescriptor())
+ .add(OperationMetadataV1.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listFunctionsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.functions.v1.CloudFunctionsService/ListFunctions")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/functions",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListFunctionsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getFunctionMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.functions.v1.CloudFunctionsService/GetFunction")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/functions/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(CloudFunction.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createFunctionMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.functions.v1.CloudFunctionsService/CreateFunction")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{location=projects/*/locations/*}/functions",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "location", request.getLocation());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("function", request.getFunction()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (CreateFunctionRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateFunctionMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.functions.v1.CloudFunctionsService/UpdateFunction")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{function.name=projects/*/locations/*/functions/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "function.name", request.getFunction().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("function", request.getFunction()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (UpdateFunctionRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteFunctionMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.functions.v1.CloudFunctionsService/DeleteFunction")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/functions/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (DeleteFunctionRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ callFunctionMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.functions.v1.CloudFunctionsService/CallFunction")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/functions/*}:call",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearName().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(CallFunctionResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ generateUploadUrlMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.functions.v1.CloudFunctionsService/GenerateUploadUrl")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearParent().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(GenerateUploadUrlResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ generateDownloadUrlMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.functions.v1.CloudFunctionsService/GenerateDownloadUrl")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearName().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(GenerateDownloadUrlResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ setIamPolicyMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.functions.v1.CloudFunctionsService/SetIamPolicy")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "resource", request.getResource());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearResource().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Policy.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getIamPolicyMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.functions.v1.CloudFunctionsService/GetIamPolicy")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "resource", request.getResource());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "options", request.getOptions());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Policy.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ testIamPermissionsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.functions.v1.CloudFunctionsService/TestIamPermissions")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "resource", request.getResource());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearResource().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable listFunctionsCallable;
+ private final UnaryCallable
+ listFunctionsPagedCallable;
+ private final UnaryCallable getFunctionCallable;
+ private final UnaryCallable createFunctionCallable;
+ private final OperationCallable
+ createFunctionOperationCallable;
+ private final UnaryCallable updateFunctionCallable;
+ private final OperationCallable
+ updateFunctionOperationCallable;
+ private final UnaryCallable deleteFunctionCallable;
+ private final OperationCallable
+ deleteFunctionOperationCallable;
+ private final UnaryCallable callFunctionCallable;
+ private final UnaryCallable
+ generateUploadUrlCallable;
+ private final UnaryCallable
+ generateDownloadUrlCallable;
+ private final UnaryCallable setIamPolicyCallable;
+ private final UnaryCallable getIamPolicyCallable;
+ private final UnaryCallable
+ testIamPermissionsCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonOperationsStub httpJsonOperationsStub;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonCloudFunctionsServiceStub create(
+ CloudFunctionsServiceStubSettings settings) throws IOException {
+ return new HttpJsonCloudFunctionsServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonCloudFunctionsServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonCloudFunctionsServiceStub(
+ CloudFunctionsServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonCloudFunctionsServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonCloudFunctionsServiceStub(
+ CloudFunctionsServiceStubSettings.newHttpJsonBuilder().build(),
+ clientContext,
+ callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonCloudFunctionsServiceStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonCloudFunctionsServiceStub(
+ CloudFunctionsServiceStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonCloudFunctionsServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonCloudFunctionsServiceStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonCloudFunctionsServiceStub(
+ CloudFunctionsServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.httpJsonOperationsStub =
+ HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
+
+ HttpJsonCallSettings
+ listFunctionsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listFunctionsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getFunctionTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getFunctionMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createFunctionTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createFunctionMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateFunctionTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateFunctionMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteFunctionTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteFunctionMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings callFunctionTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(callFunctionMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ generateUploadUrlTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(generateUploadUrlMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ generateDownloadUrlTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(generateDownloadUrlMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings setIamPolicyTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(setIamPolicyMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getIamPolicyTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getIamPolicyMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ testIamPermissionsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(testIamPermissionsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.listFunctionsCallable =
+ callableFactory.createUnaryCallable(
+ listFunctionsTransportSettings, settings.listFunctionsSettings(), clientContext);
+ this.listFunctionsPagedCallable =
+ callableFactory.createPagedCallable(
+ listFunctionsTransportSettings, settings.listFunctionsSettings(), clientContext);
+ this.getFunctionCallable =
+ callableFactory.createUnaryCallable(
+ getFunctionTransportSettings, settings.getFunctionSettings(), clientContext);
+ this.createFunctionCallable =
+ callableFactory.createUnaryCallable(
+ createFunctionTransportSettings, settings.createFunctionSettings(), clientContext);
+ this.createFunctionOperationCallable =
+ callableFactory.createOperationCallable(
+ createFunctionTransportSettings,
+ settings.createFunctionOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.updateFunctionCallable =
+ callableFactory.createUnaryCallable(
+ updateFunctionTransportSettings, settings.updateFunctionSettings(), clientContext);
+ this.updateFunctionOperationCallable =
+ callableFactory.createOperationCallable(
+ updateFunctionTransportSettings,
+ settings.updateFunctionOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.deleteFunctionCallable =
+ callableFactory.createUnaryCallable(
+ deleteFunctionTransportSettings, settings.deleteFunctionSettings(), clientContext);
+ this.deleteFunctionOperationCallable =
+ callableFactory.createOperationCallable(
+ deleteFunctionTransportSettings,
+ settings.deleteFunctionOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.callFunctionCallable =
+ callableFactory.createUnaryCallable(
+ callFunctionTransportSettings, settings.callFunctionSettings(), clientContext);
+ this.generateUploadUrlCallable =
+ callableFactory.createUnaryCallable(
+ generateUploadUrlTransportSettings,
+ settings.generateUploadUrlSettings(),
+ clientContext);
+ this.generateDownloadUrlCallable =
+ callableFactory.createUnaryCallable(
+ generateDownloadUrlTransportSettings,
+ settings.generateDownloadUrlSettings(),
+ clientContext);
+ this.setIamPolicyCallable =
+ callableFactory.createUnaryCallable(
+ setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext);
+ this.getIamPolicyCallable =
+ callableFactory.createUnaryCallable(
+ getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext);
+ this.testIamPermissionsCallable =
+ callableFactory.createUnaryCallable(
+ testIamPermissionsTransportSettings,
+ settings.testIamPermissionsSettings(),
+ clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(listFunctionsMethodDescriptor);
+ methodDescriptors.add(getFunctionMethodDescriptor);
+ methodDescriptors.add(createFunctionMethodDescriptor);
+ methodDescriptors.add(updateFunctionMethodDescriptor);
+ methodDescriptors.add(deleteFunctionMethodDescriptor);
+ methodDescriptors.add(callFunctionMethodDescriptor);
+ methodDescriptors.add(generateUploadUrlMethodDescriptor);
+ methodDescriptors.add(generateDownloadUrlMethodDescriptor);
+ methodDescriptors.add(setIamPolicyMethodDescriptor);
+ methodDescriptors.add(getIamPolicyMethodDescriptor);
+ methodDescriptors.add(testIamPermissionsMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ public HttpJsonOperationsStub getHttpJsonOperationsStub() {
+ return httpJsonOperationsStub;
+ }
+
+ @Override
+ public UnaryCallable listFunctionsCallable() {
+ return listFunctionsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listFunctionsPagedCallable() {
+ return listFunctionsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable getFunctionCallable() {
+ return getFunctionCallable;
+ }
+
+ @Override
+ public UnaryCallable createFunctionCallable() {
+ return createFunctionCallable;
+ }
+
+ @Override
+ public OperationCallable
+ createFunctionOperationCallable() {
+ return createFunctionOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable updateFunctionCallable() {
+ return updateFunctionCallable;
+ }
+
+ @Override
+ public OperationCallable
+ updateFunctionOperationCallable() {
+ return updateFunctionOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteFunctionCallable() {
+ return deleteFunctionCallable;
+ }
+
+ @Override
+ public OperationCallable
+ deleteFunctionOperationCallable() {
+ return deleteFunctionOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable callFunctionCallable() {
+ return callFunctionCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ generateUploadUrlCallable() {
+ return generateUploadUrlCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ generateDownloadUrlCallable() {
+ return generateDownloadUrlCallable;
+ }
+
+ @Override
+ public UnaryCallable setIamPolicyCallable() {
+ return setIamPolicyCallable;
+ }
+
+ @Override
+ public UnaryCallable getIamPolicyCallable() {
+ return getIamPolicyCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ testIamPermissionsCallable() {
+ return testIamPermissionsCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v2alpha/FunctionServiceClient.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v2alpha/FunctionServiceClient.java
new file mode 100644
index 00000000..c4e4823a
--- /dev/null
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v2alpha/FunctionServiceClient.java
@@ -0,0 +1,1583 @@
+/*
+ * Copyright 2022 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.cloud.functions.v2alpha;
+
+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.httpjson.longrunning.OperationsClient;
+import com.google.api.gax.longrunning.OperationFuture;
+import com.google.api.gax.paging.AbstractFixedSizeCollection;
+import com.google.api.gax.paging.AbstractPage;
+import com.google.api.gax.paging.AbstractPagedListResponse;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PageContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.functions.v2alpha.stub.FunctionServiceStub;
+import com.google.cloud.functions.v2alpha.stub.FunctionServiceStubSettings;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Empty;
+import com.google.protobuf.FieldMask;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Service Description: Google Cloud Functions is used to deploy functions that are executed by
+ * Google in response to various events. Data connected with that event is passed to a function as
+ * the input data.
+ *
+ * A **function** is a resource which describes a function that should be
+ * executed and how it is triggered.
+ *
+ *
This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * FunctionName name = FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
+ * Function response = functionServiceClient.getFunction(name);
+ * }
+ * }
+ *
+ * Note: close() needs to be called on the FunctionServiceClient object to clean up resources
+ * such as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ *
+ * - A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available as
+ * parameters, and not every API method will have a flattened method entry point.
+ *
- A "request object" method. This type of method only takes one parameter, a request object,
+ * which must be constructed before the call. Not every API method will have a request object
+ * method.
+ *
- A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
+ *
+ *
+ * See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ *
This class can be customized by passing in a custom instance of FunctionServiceSettings to
+ * create(). For example:
+ *
+ *
To customize credentials:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * FunctionServiceSettings functionServiceSettings =
+ * FunctionServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * FunctionServiceClient functionServiceClient =
+ * FunctionServiceClient.create(functionServiceSettings);
+ * }
+ *
+ * To customize the endpoint:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * FunctionServiceSettings functionServiceSettings =
+ * FunctionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * FunctionServiceClient functionServiceClient =
+ * FunctionServiceClient.create(functionServiceSettings);
+ * }
+ *
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * FunctionServiceSettings functionServiceSettings =
+ * FunctionServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * FunctionServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * FunctionServiceClient functionServiceClient =
+ * FunctionServiceClient.create(functionServiceSettings);
+ * }
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class FunctionServiceClient implements BackgroundResource {
+ private final FunctionServiceSettings settings;
+ private final FunctionServiceStub stub;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
+
+ /** Constructs an instance of FunctionServiceClient with default settings. */
+ public static final FunctionServiceClient create() throws IOException {
+ return create(FunctionServiceSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of FunctionServiceClient, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final FunctionServiceClient create(FunctionServiceSettings settings)
+ throws IOException {
+ return new FunctionServiceClient(settings);
+ }
+
+ /**
+ * Constructs an instance of FunctionServiceClient, using the given stub for making calls. This is
+ * for advanced usage - prefer using create(FunctionServiceSettings).
+ */
+ public static final FunctionServiceClient create(FunctionServiceStub stub) {
+ return new FunctionServiceClient(stub);
+ }
+
+ /**
+ * Constructs an instance of FunctionServiceClient, using the given settings. This is protected so
+ * that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected FunctionServiceClient(FunctionServiceSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((FunctionServiceStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
+ }
+
+ protected FunctionServiceClient(FunctionServiceStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
+ }
+
+ public final FunctionServiceSettings getSettings() {
+ return settings;
+ }
+
+ public FunctionServiceStub getStub() {
+ return stub;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ 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 function with the given name from the requested project.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * FunctionName name = FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
+ * Function response = functionServiceClient.getFunction(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the function which details should be obtained.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Function getFunction(FunctionName name) {
+ GetFunctionRequest request =
+ GetFunctionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getFunction(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a function with the given name from the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * String name = FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
+ * Function response = functionServiceClient.getFunction(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the function which details should be obtained.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Function getFunction(String name) {
+ GetFunctionRequest request = GetFunctionRequest.newBuilder().setName(name).build();
+ return getFunction(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a function with the given name from the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * GetFunctionRequest request =
+ * GetFunctionRequest.newBuilder()
+ * .setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .build();
+ * Function response = functionServiceClient.getFunction(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Function getFunction(GetFunctionRequest request) {
+ return getFunctionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a function with the given name from the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * GetFunctionRequest request =
+ * GetFunctionRequest.newBuilder()
+ * .setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .build();
+ * ApiFuture future = functionServiceClient.getFunctionCallable().futureCall(request);
+ * // Do something.
+ * Function response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getFunctionCallable() {
+ return stub.getFunctionCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of functions that belong to the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (Function element : functionServiceClient.listFunctions(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The project and location from which the function should be listed,
+ * specified in the format `projects/*/locations/*` If you want to list functions in
+ * all locations, use "-" in place of a location. When listing functions in all locations, if
+ * one or more location(s) are unreachable, the response will contain functions from all
+ * reachable locations along with the names of any unreachable locations.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListFunctionsPagedResponse listFunctions(LocationName parent) {
+ ListFunctionsRequest request =
+ ListFunctionsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listFunctions(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of functions that belong to the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+ * for (Function element : functionServiceClient.listFunctions(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The project and location from which the function should be listed,
+ * specified in the format `projects/*/locations/*` If you want to list functions in
+ * all locations, use "-" in place of a location. When listing functions in all locations, if
+ * one or more location(s) are unreachable, the response will contain functions from all
+ * reachable locations along with the names of any unreachable locations.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListFunctionsPagedResponse listFunctions(String parent) {
+ ListFunctionsRequest request = ListFunctionsRequest.newBuilder().setParent(parent).build();
+ return listFunctions(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of functions that belong to the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * ListFunctionsRequest request =
+ * ListFunctionsRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * for (Function element : functionServiceClient.listFunctions(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListFunctionsPagedResponse listFunctions(ListFunctionsRequest request) {
+ return listFunctionsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of functions that belong to the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * ListFunctionsRequest request =
+ * ListFunctionsRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.listFunctionsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Function element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listFunctionsPagedCallable() {
+ return stub.listFunctionsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of functions that belong to the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * ListFunctionsRequest request =
+ * ListFunctionsRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * while (true) {
+ * ListFunctionsResponse response =
+ * functionServiceClient.listFunctionsCallable().call(request);
+ * for (Function element : response.getFunctionsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable listFunctionsCallable() {
+ return stub.listFunctionsCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new function. If a function with the given name already exists in the specified
+ * project, the long running operation will return `ALREADY_EXISTS` error.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * Function function = Function.newBuilder().build();
+ * String functionId = "functionId-62789869";
+ * Function response =
+ * functionServiceClient.createFunctionAsync(parent, function, functionId).get();
+ * }
+ * }
+ *
+ * @param parent Required. The project and location in which the function should be created,
+ * specified in the format `projects/*/locations/*`
+ * @param function Required. Function to be created.
+ * @param functionId The ID to use for the function, which will become the final component of the
+ * function's resource name.
+ * This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture createFunctionAsync(
+ LocationName parent, Function function, String functionId) {
+ CreateFunctionRequest request =
+ CreateFunctionRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setFunction(function)
+ .setFunctionId(functionId)
+ .build();
+ return createFunctionAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new function. If a function with the given name already exists in the specified
+ * project, the long running operation will return `ALREADY_EXISTS` error.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+ * Function function = Function.newBuilder().build();
+ * String functionId = "functionId-62789869";
+ * Function response =
+ * functionServiceClient.createFunctionAsync(parent, function, functionId).get();
+ * }
+ * }
+ *
+ * @param parent Required. The project and location in which the function should be created,
+ * specified in the format `projects/*/locations/*`
+ * @param function Required. Function to be created.
+ * @param functionId The ID to use for the function, which will become the final component of the
+ * function's resource name.
+ * This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture createFunctionAsync(
+ String parent, Function function, String functionId) {
+ CreateFunctionRequest request =
+ CreateFunctionRequest.newBuilder()
+ .setParent(parent)
+ .setFunction(function)
+ .setFunctionId(functionId)
+ .build();
+ return createFunctionAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new function. If a function with the given name already exists in the specified
+ * project, the long running operation will return `ALREADY_EXISTS` error.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * CreateFunctionRequest request =
+ * CreateFunctionRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setFunction(Function.newBuilder().build())
+ * .setFunctionId("functionId-62789869")
+ * .build();
+ * Function response = functionServiceClient.createFunctionAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture createFunctionAsync(
+ CreateFunctionRequest request) {
+ return createFunctionOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new function. If a function with the given name already exists in the specified
+ * project, the long running operation will return `ALREADY_EXISTS` error.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * CreateFunctionRequest request =
+ * CreateFunctionRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setFunction(Function.newBuilder().build())
+ * .setFunctionId("functionId-62789869")
+ * .build();
+ * OperationFuture future =
+ * functionServiceClient.createFunctionOperationCallable().futureCall(request);
+ * // Do something.
+ * Function response = future.get();
+ * }
+ * }
+ */
+ public final OperationCallable
+ createFunctionOperationCallable() {
+ return stub.createFunctionOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new function. If a function with the given name already exists in the specified
+ * project, the long running operation will return `ALREADY_EXISTS` error.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * CreateFunctionRequest request =
+ * CreateFunctionRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setFunction(Function.newBuilder().build())
+ * .setFunctionId("functionId-62789869")
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.createFunctionCallable().futureCall(request);
+ * // Do something.
+ * Operation response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable createFunctionCallable() {
+ return stub.createFunctionCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates existing function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * Function function = Function.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Function response = functionServiceClient.updateFunctionAsync(function, updateMask).get();
+ * }
+ * }
+ *
+ * @param function Required. New version of the function.
+ * @param updateMask The list of fields to be updated. If no field mask is provided, all provided
+ * fields in the request will be updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture updateFunctionAsync(
+ Function function, FieldMask updateMask) {
+ UpdateFunctionRequest request =
+ UpdateFunctionRequest.newBuilder().setFunction(function).setUpdateMask(updateMask).build();
+ return updateFunctionAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates existing function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * UpdateFunctionRequest request =
+ * UpdateFunctionRequest.newBuilder()
+ * .setFunction(Function.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * Function response = functionServiceClient.updateFunctionAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture updateFunctionAsync(
+ UpdateFunctionRequest request) {
+ return updateFunctionOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates existing function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * UpdateFunctionRequest request =
+ * UpdateFunctionRequest.newBuilder()
+ * .setFunction(Function.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * OperationFuture future =
+ * functionServiceClient.updateFunctionOperationCallable().futureCall(request);
+ * // Do something.
+ * Function response = future.get();
+ * }
+ * }
+ */
+ public final OperationCallable
+ updateFunctionOperationCallable() {
+ return stub.updateFunctionOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates existing function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * UpdateFunctionRequest request =
+ * UpdateFunctionRequest.newBuilder()
+ * .setFunction(Function.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.updateFunctionCallable().futureCall(request);
+ * // Do something.
+ * Operation response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable updateFunctionCallable() {
+ return stub.updateFunctionCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a function with the given name from the specified project. If the given function is
+ * used by some trigger, the trigger will be updated to remove this function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * FunctionName name = FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
+ * functionServiceClient.deleteFunctionAsync(name).get();
+ * }
+ * }
+ *
+ * @param name Required. The name of the function which should be deleted.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture deleteFunctionAsync(FunctionName name) {
+ DeleteFunctionRequest request =
+ DeleteFunctionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return deleteFunctionAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a function with the given name from the specified project. If the given function is
+ * used by some trigger, the trigger will be updated to remove this function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * String name = FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
+ * functionServiceClient.deleteFunctionAsync(name).get();
+ * }
+ * }
+ *
+ * @param name Required. The name of the function which should be deleted.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture deleteFunctionAsync(String name) {
+ DeleteFunctionRequest request = DeleteFunctionRequest.newBuilder().setName(name).build();
+ return deleteFunctionAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a function with the given name from the specified project. If the given function is
+ * used by some trigger, the trigger will be updated to remove this function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * DeleteFunctionRequest request =
+ * DeleteFunctionRequest.newBuilder()
+ * .setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .build();
+ * functionServiceClient.deleteFunctionAsync(request).get();
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture deleteFunctionAsync(
+ DeleteFunctionRequest request) {
+ return deleteFunctionOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a function with the given name from the specified project. If the given function is
+ * used by some trigger, the trigger will be updated to remove this function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * DeleteFunctionRequest request =
+ * DeleteFunctionRequest.newBuilder()
+ * .setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .build();
+ * OperationFuture future =
+ * functionServiceClient.deleteFunctionOperationCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final OperationCallable
+ deleteFunctionOperationCallable() {
+ return stub.deleteFunctionOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a function with the given name from the specified project. If the given function is
+ * used by some trigger, the trigger will be updated to remove this function.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * DeleteFunctionRequest request =
+ * DeleteFunctionRequest.newBuilder()
+ * .setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.deleteFunctionCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable deleteFunctionCallable() {
+ return stub.deleteFunctionCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a signed URL for uploading a function source code. For more information about the
+ * signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once
+ * the function source code upload is complete, the used signed URL should be provided in
+ * CreateFunction or UpdateFunction request as a reference to the function source code.
+ *
+ * When uploading source code to the generated signed URL, please follow these restrictions:
+ *
+ *
+ * - Source file type should be a zip file.
+ *
- No credentials should be attached - the signed URLs provide access to the target bucket
+ * using internal service identity; if credentials were attached, the identity from the
+ * credentials would be used, but that identity does not have permissions to upload files to
+ * the URL.
+ *
+ *
+ * When making a HTTP PUT request, these two headers need to be specified:
+ *
+ *
+ * - `content-type: application/zip`
+ *
+ *
+ * And this header SHOULD NOT be specified:
+ *
+ *
+ * - `Authorization: Bearer YOUR_TOKEN`
+ *
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * GenerateUploadUrlRequest request =
+ * GenerateUploadUrlRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .build();
+ * GenerateUploadUrlResponse response = functionServiceClient.generateUploadUrl(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final GenerateUploadUrlResponse generateUploadUrl(GenerateUploadUrlRequest request) {
+ return generateUploadUrlCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a signed URL for uploading a function source code. For more information about the
+ * signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once
+ * the function source code upload is complete, the used signed URL should be provided in
+ * CreateFunction or UpdateFunction request as a reference to the function source code.
+ *
+ * When uploading source code to the generated signed URL, please follow these restrictions:
+ *
+ *
+ * - Source file type should be a zip file.
+ *
- No credentials should be attached - the signed URLs provide access to the target bucket
+ * using internal service identity; if credentials were attached, the identity from the
+ * credentials would be used, but that identity does not have permissions to upload files to
+ * the URL.
+ *
+ *
+ * When making a HTTP PUT request, these two headers need to be specified:
+ *
+ *
+ * - `content-type: application/zip`
+ *
+ *
+ * And this header SHOULD NOT be specified:
+ *
+ *
+ * - `Authorization: Bearer YOUR_TOKEN`
+ *
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * GenerateUploadUrlRequest request =
+ * GenerateUploadUrlRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.generateUploadUrlCallable().futureCall(request);
+ * // Do something.
+ * GenerateUploadUrlResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ generateUploadUrlCallable() {
+ return stub.generateUploadUrlCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a signed URL for downloading deployed function source code. The URL is only valid for a
+ * limited period and should be used within 30 minutes of generation. For more information about
+ * the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * GenerateDownloadUrlRequest request =
+ * GenerateDownloadUrlRequest.newBuilder()
+ * .setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .build();
+ * GenerateDownloadUrlResponse response = functionServiceClient.generateDownloadUrl(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final GenerateDownloadUrlResponse generateDownloadUrl(GenerateDownloadUrlRequest request) {
+ return generateDownloadUrlCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a signed URL for downloading deployed function source code. The URL is only valid for a
+ * limited period and should be used within 30 minutes of generation. For more information about
+ * the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * GenerateDownloadUrlRequest request =
+ * GenerateDownloadUrlRequest.newBuilder()
+ * .setName(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.generateDownloadUrlCallable().futureCall(request);
+ * // Do something.
+ * GenerateDownloadUrlResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ generateDownloadUrlCallable() {
+ return stub.generateDownloadUrlCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of runtimes that are supported for the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListRuntimesResponse response = functionServiceClient.listRuntimes(parent);
+ * }
+ * }
+ *
+ * @param parent Required. The project and location from which the runtimes should be listed,
+ * specified in the format `projects/*/locations/*`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListRuntimesResponse listRuntimes(LocationName parent) {
+ ListRuntimesRequest request =
+ ListRuntimesRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listRuntimes(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of runtimes that are supported for the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+ * ListRuntimesResponse response = functionServiceClient.listRuntimes(parent);
+ * }
+ * }
+ *
+ * @param parent Required. The project and location from which the runtimes should be listed,
+ * specified in the format `projects/*/locations/*`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListRuntimesResponse listRuntimes(String parent) {
+ ListRuntimesRequest request = ListRuntimesRequest.newBuilder().setParent(parent).build();
+ return listRuntimes(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of runtimes that are supported for the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * ListRuntimesRequest request =
+ * ListRuntimesRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setFilter("filter-1274492040")
+ * .build();
+ * ListRuntimesResponse response = functionServiceClient.listRuntimes(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListRuntimesResponse listRuntimes(ListRuntimesRequest request) {
+ return listRuntimesCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns a list of runtimes that are supported for the requested project.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * ListRuntimesRequest request =
+ * ListRuntimesRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setFilter("filter-1274492040")
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.listRuntimesCallable().futureCall(request);
+ * // Do something.
+ * ListRuntimesResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable listRuntimesCallable() {
+ return stub.listRuntimesCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (Location element : functionServiceClient.listLocations(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
+ return listLocationsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.listLocationsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Location element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listLocationsPagedCallable() {
+ return stub.listLocationsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListLocationsResponse response =
+ * functionServiceClient.listLocationsCallable().call(request);
+ * for (Location element : response.getLocationsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable listLocationsCallable() {
+ return stub.listLocationsCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Sets the access control policy on the specified resource. Replacesany existing policy.
+ *
+ * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * Policy response = functionServiceClient.setIamPolicy(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy setIamPolicy(SetIamPolicyRequest request) {
+ return setIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Sets the access control policy on the specified resource. Replacesany existing policy.
+ *
+ * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future = functionServiceClient.setIamPolicyCallable().futureCall(request);
+ * // Do something.
+ * Policy response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable setIamPolicyCallable() {
+ return stub.setIamPolicyCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the access control policy for a resource. Returns an empty policyif the resource exists
+ * and does not have a policy set.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * Policy response = functionServiceClient.getIamPolicy(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy getIamPolicy(GetIamPolicyRequest request) {
+ return getIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the access control policy for a resource. Returns an empty policyif the resource exists
+ * and does not have a policy set.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * ApiFuture future = functionServiceClient.getIamPolicyCallable().futureCall(request);
+ * // Do something.
+ * Policy response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getIamPolicyCallable() {
+ return stub.getIamPolicyCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns permissions that a caller has on the specified resource. If theresource does not exist,
+ * this will return an empty set ofpermissions, not a `NOT_FOUND` error.
+ *
+ * Note: This operation is designed to be used for buildingpermission-aware UIs and
+ * command-line tools, not for authorizationchecking. This operation may "fail open" without
+ * warning.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .addAllPermissions(new ArrayList())
+ * .build();
+ * TestIamPermissionsResponse response = functionServiceClient.testIamPermissions(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
+ return testIamPermissionsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns permissions that a caller has on the specified resource. If theresource does not exist,
+ * this will return an empty set ofpermissions, not a `NOT_FOUND` error.
+ *
+ * Note: This operation is designed to be used for buildingpermission-aware UIs and
+ * command-line tools, not for authorizationchecking. This operation may "fail open" without
+ * warning.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (FunctionServiceClient functionServiceClient = FunctionServiceClient.create()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(FunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+ * .addAllPermissions(new ArrayList())
+ * .build();
+ * ApiFuture future =
+ * functionServiceClient.testIamPermissionsCallable().futureCall(request);
+ * // Do something.
+ * TestIamPermissionsResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ testIamPermissionsCallable() {
+ return stub.testIamPermissionsCallable();
+ }
+
+ @Override
+ public final void close() {
+ stub.close();
+ }
+
+ @Override
+ public void shutdown() {
+ stub.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return stub.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return stub.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ stub.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return stub.awaitTermination(duration, unit);
+ }
+
+ public static class ListFunctionsPagedResponse
+ extends AbstractPagedListResponse<
+ ListFunctionsRequest,
+ ListFunctionsResponse,
+ Function,
+ ListFunctionsPage,
+ ListFunctionsFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListFunctionsPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ input -> new ListFunctionsPagedResponse(input),
+ MoreExecutors.directExecutor());
+ }
+
+ private ListFunctionsPagedResponse(ListFunctionsPage page) {
+ super(page, ListFunctionsFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListFunctionsPage
+ extends AbstractPage<
+ ListFunctionsRequest, ListFunctionsResponse, Function, ListFunctionsPage> {
+
+ private ListFunctionsPage(
+ PageContext context,
+ ListFunctionsResponse response) {
+ super(context, response);
+ }
+
+ private static ListFunctionsPage createEmptyPage() {
+ return new ListFunctionsPage(null, null);
+ }
+
+ @Override
+ protected ListFunctionsPage createPage(
+ PageContext context,
+ ListFunctionsResponse response) {
+ return new ListFunctionsPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListFunctionsFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListFunctionsRequest,
+ ListFunctionsResponse,
+ Function,
+ ListFunctionsPage,
+ ListFunctionsFixedSizeCollection> {
+
+ private ListFunctionsFixedSizeCollection(List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListFunctionsFixedSizeCollection createEmptyCollection() {
+ return new ListFunctionsFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListFunctionsFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListFunctionsFixedSizeCollection(pages, collectionSize);
+ }
+ }
+
+ public static class ListLocationsPagedResponse
+ extends AbstractPagedListResponse<
+ ListLocationsRequest,
+ ListLocationsResponse,
+ Location,
+ ListLocationsPage,
+ ListLocationsFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ input -> new ListLocationsPagedResponse(input),
+ MoreExecutors.directExecutor());
+ }
+
+ private ListLocationsPagedResponse(ListLocationsPage page) {
+ super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListLocationsPage
+ extends AbstractPage<
+ ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
+
+ private ListLocationsPage(
+ PageContext context,
+ ListLocationsResponse response) {
+ super(context, response);
+ }
+
+ private static ListLocationsPage createEmptyPage() {
+ return new ListLocationsPage(null, null);
+ }
+
+ @Override
+ protected ListLocationsPage createPage(
+ PageContext context,
+ ListLocationsResponse response) {
+ return new ListLocationsPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListLocationsFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListLocationsRequest,
+ ListLocationsResponse,
+ Location,
+ ListLocationsPage,
+ ListLocationsFixedSizeCollection> {
+
+ private ListLocationsFixedSizeCollection(List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListLocationsFixedSizeCollection createEmptyCollection() {
+ return new ListLocationsFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListLocationsFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListLocationsFixedSizeCollection(pages, collectionSize);
+ }
+ }
+}
diff --git a/google-cloud-functions/src/main/java/com/google/cloud/functions/v2alpha/FunctionServiceSettings.java b/google-cloud-functions/src/main/java/com/google/cloud/functions/v2alpha/FunctionServiceSettings.java
new file mode 100644
index 00000000..e7cb6d98
--- /dev/null
+++ b/google-cloud-functions/src/main/java/com/google/cloud/functions/v2alpha/FunctionServiceSettings.java
@@ -0,0 +1,377 @@
+/*
+ * Copyright 2022 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.cloud.functions.v2alpha;
+
+import static com.google.cloud.functions.v2alpha.FunctionServiceClient.ListFunctionsPagedResponse;
+import static com.google.cloud.functions.v2alpha.FunctionServiceClient.ListLocationsPagedResponse;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.BetaApi;
+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;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.TransportChannelProvider;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.cloud.functions.v2alpha.stub.FunctionServiceStubSettings;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Empty;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Settings class to configure an instance of {@link FunctionServiceClient}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (cloudfunctions.googleapis.com) and default port (443) are
+ * used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ *
For example, to set the total timeout of getFunction to 30 seconds:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * FunctionServiceSettings.Builder functionServiceSettingsBuilder =
+ * FunctionServiceSettings.newBuilder();
+ * functionServiceSettingsBuilder
+ * .getFunctionSettings()
+ * .setRetrySettings(
+ * functionServiceSettingsBuilder
+ * .getFunctionSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * FunctionServiceSettings functionServiceSettings = functionServiceSettingsBuilder.build();
+ * }
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class FunctionServiceSettings extends ClientSettings {
+
+ /** Returns the object with the settings used for calls to getFunction. */
+ public UnaryCallSettings getFunctionSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).getFunctionSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listFunctions. */
+ public PagedCallSettings
+ listFunctionsSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).listFunctionsSettings();
+ }
+
+ /** Returns the object with the settings used for calls to createFunction. */
+ public UnaryCallSettings createFunctionSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).createFunctionSettings();
+ }
+
+ /** Returns the object with the settings used for calls to createFunction. */
+ public OperationCallSettings
+ createFunctionOperationSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).createFunctionOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to updateFunction. */
+ public UnaryCallSettings updateFunctionSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).updateFunctionSettings();
+ }
+
+ /** Returns the object with the settings used for calls to updateFunction. */
+ public OperationCallSettings
+ updateFunctionOperationSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).updateFunctionOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to deleteFunction. */
+ public UnaryCallSettings deleteFunctionSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).deleteFunctionSettings();
+ }
+
+ /** Returns the object with the settings used for calls to deleteFunction. */
+ public OperationCallSettings
+ deleteFunctionOperationSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).deleteFunctionOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to generateUploadUrl. */
+ public UnaryCallSettings
+ generateUploadUrlSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).generateUploadUrlSettings();
+ }
+
+ /** Returns the object with the settings used for calls to generateDownloadUrl. */
+ public UnaryCallSettings
+ generateDownloadUrlSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).generateDownloadUrlSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listRuntimes. */
+ public UnaryCallSettings listRuntimesSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).listRuntimesSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listLocations. */
+ public PagedCallSettings
+ listLocationsSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).listLocationsSettings();
+ }
+
+ /** Returns the object with the settings used for calls to setIamPolicy. */
+ public UnaryCallSettings setIamPolicySettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).setIamPolicySettings();
+ }
+
+ /** Returns the object with the settings used for calls to getIamPolicy. */
+ public UnaryCallSettings getIamPolicySettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).getIamPolicySettings();
+ }
+
+ /** Returns the object with the settings used for calls to testIamPermissions. */
+ public UnaryCallSettings
+ testIamPermissionsSettings() {
+ return ((FunctionServiceStubSettings) getStubSettings()).testIamPermissionsSettings();
+ }
+
+ public static final FunctionServiceSettings create(FunctionServiceStubSettings stub)
+ throws IOException {
+ return new FunctionServiceSettings.Builder(stub.toBuilder()).build();
+ }
+
+ /** Returns a builder for the default ExecutorProvider for this service. */
+ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
+ return FunctionServiceStubSettings.defaultExecutorProviderBuilder();
+ }
+
+ /** Returns the default service endpoint. */
+ public static String getDefaultEndpoint() {
+ return FunctionServiceStubSettings.getDefaultEndpoint();
+ }
+
+ /** Returns the default service scopes. */
+ public static List getDefaultServiceScopes() {
+ return FunctionServiceStubSettings.getDefaultServiceScopes();
+ }
+
+ /** Returns a builder for the default credentials for this service. */
+ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
+ return FunctionServiceStubSettings.defaultCredentialsProviderBuilder();
+ }
+
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
+ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
+ return FunctionServiceStubSettings.defaultGrpcTransportProviderBuilder();
+ }
+
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return FunctionServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
+ public static TransportChannelProvider defaultTransportChannelProvider() {
+ return FunctionServiceStubSettings.defaultTransportChannelProvider();
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return FunctionServiceStubSettings.defaultApiClientHeaderProviderBuilder();
+ }
+
+ /** 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);
+ }
+
+ /** Returns a builder containing all the values of this settings class. */
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ protected FunctionServiceSettings(Builder settingsBuilder) throws IOException {
+ super(settingsBuilder);
+ }
+
+ /** Builder for FunctionServiceSettings. */
+ public static class Builder extends ClientSettings.Builder {
+
+ protected Builder() throws IOException {
+ this(((ClientContext) null));
+ }
+
+ protected Builder(ClientContext clientContext) {
+ super(FunctionServiceStubSettings.newBuilder(clientContext));
+ }
+
+ protected Builder(FunctionServiceSettings settings) {
+ super(settings.getStubSettings().toBuilder());
+ }
+
+ protected Builder(FunctionServiceStubSettings.Builder stubSettings) {
+ super(stubSettings);
+ }
+
+ private static Builder createDefault() {
+ return new Builder(FunctionServiceStubSettings.newBuilder());
+ }
+
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(FunctionServiceStubSettings.newHttpJsonBuilder());
+ }
+
+ public FunctionServiceStubSettings.Builder getStubSettingsBuilder() {
+ return ((FunctionServiceStubSettings.Builder) getStubSettings());
+ }
+
+ /**
+ * 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) {
+ super.applyToAllUnaryMethods(
+ getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
+ return this;
+ }
+
+ /** Returns the builder for the settings used for calls to getFunction. */
+ public UnaryCallSettings.Builder getFunctionSettings() {
+ return getStubSettingsBuilder().getFunctionSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listFunctions. */
+ public PagedCallSettings.Builder<
+ ListFunctionsRequest, ListFunctionsResponse, ListFunctionsPagedResponse>
+ listFunctionsSettings() {
+ return getStubSettingsBuilder().listFunctionsSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to createFunction. */
+ public UnaryCallSettings.Builder createFunctionSettings() {
+ return getStubSettingsBuilder().createFunctionSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to createFunction. */
+ public OperationCallSettings.Builder
+ createFunctionOperationSettings() {
+ return getStubSettingsBuilder().createFunctionOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to updateFunction. */
+ public UnaryCallSettings.Builder updateFunctionSettings() {
+ return getStubSettingsBuilder().updateFunctionSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to updateFunction. */
+ public OperationCallSettings.Builder
+ updateFunctionOperationSettings() {
+ return getStubSettingsBuilder().updateFunctionOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to deleteFunction. */
+ public UnaryCallSettings.Builder deleteFunctionSettings() {
+ return getStubSettingsBuilder().deleteFunctionSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to deleteFunction. */
+ public OperationCallSettings.Builder
+ deleteFunctionOperationSettings() {
+ return getStubSettingsBuilder().deleteFunctionOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to generateUploadUrl. */
+ public UnaryCallSettings.Builder
+ generateUploadUrlSettings() {
+ return getStubSettingsBuilder().generateUploadUrlSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to generateDownloadUrl. */
+ public UnaryCallSettings.Builder
+ generateDownloadUrlSettings() {
+ return getStubSettingsBuilder().generateDownloadUrlSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listRuntimes. */
+ public UnaryCallSettings.Builder
+ listRuntimesSettings() {
+ return getStubSettingsBuilder().listRuntimesSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listLocations. */
+ public PagedCallSettings.Builder<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings() {
+ return getStubSettingsBuilder().listLocationsSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to setIamPolicy. */
+ public UnaryCallSettings.Builder