From 77440a61a1a25c72cf3ce4dda0b50e41801371b6 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 8 Feb 2021 16:46:12 -0800 Subject: [PATCH] docs: generate sample code in the Java microgenerator (#135) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/83d27b1b-599d-4795-9959-95d65d1baad5/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 356341083 Source-Link: https://github.com/googleapis/googleapis/commit/8d8c008e56f1af31d57f75561e0f1848ffb29eeb --- .../v1/CloudFunctionsServiceClient.java | 484 ++++++++++++++++++ .../cloud/functions/v1/package-info.java | 8 + synth.metadata | 6 +- 3 files changed, 495 insertions(+), 3 deletions(-) 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 6b1f8071..e54bdb68 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 @@ -51,6 +51,14 @@ *

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
+ * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+ *     CloudFunctionsServiceClient.create()) {
+ *   CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
+ *   CloudFunction response = cloudFunctionsServiceClient.getFunction(name);
+ * }
+ * }
+ * *

Note: close() needs to be called on the CloudFunctionsServiceClient object to clean up * resources such as threads. In the example above, try-with-resources is used, which automatically * calls close(). @@ -168,6 +176,24 @@ public final OperationsClient getOperationsClient() { /** * Returns a list of functions that belong to the requested project. * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   ListFunctionsRequest request =
+   *       ListFunctionsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (CloudFunction element :
+   *       cloudFunctionsServiceClient.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 */ @@ -180,6 +206,24 @@ public final ListFunctionsPagedResponse listFunctions(ListFunctionsRequest reque * Returns a list of functions that belong to the requested project. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   ListFunctionsRequest request =
+   *       ListFunctionsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       cloudFunctionsServiceClient.listFunctionsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (CloudFunction element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listFunctionsPagedCallable() { @@ -191,6 +235,25 @@ public final ListFunctionsPagedResponse listFunctions(ListFunctionsRequest reque * Returns a list of functions that belong to the requested project. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   while (true) {
+   *     ListFunctionsResponse response =
+   *         cloudFunctionsServiceClient.listFunctionsCallable().call(request);
+   *     for (CloudFunction element : response.getResponsesList()) {
+   *       // 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(); @@ -200,6 +263,16 @@ public final UnaryCallable listFunc /** * Returns a function with the given name from the requested project. * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
+   *   CloudFunction response = cloudFunctionsServiceClient.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 */ @@ -213,6 +286,16 @@ public final CloudFunction getFunction(CloudFunctionName name) { /** * Returns a function with the given name from the requested project. * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
+   *   CloudFunction response = cloudFunctionsServiceClient.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 */ @@ -225,6 +308,19 @@ public final CloudFunction getFunction(String name) { /** * Returns a function with the given name from the requested project. * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   GetFunctionRequest request =
+   *       GetFunctionRequest.newBuilder()
+   *           .setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+   *           .build();
+   *   CloudFunction response = cloudFunctionsServiceClient.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 */ @@ -237,6 +333,20 @@ public final CloudFunction getFunction(GetFunctionRequest request) { * Returns a function with the given name from the requested project. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   GetFunctionRequest request =
+   *       GetFunctionRequest.newBuilder()
+   *           .setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       cloudFunctionsServiceClient.getFunctionCallable().futureCall(request);
+   *   // Do something.
+   *   CloudFunction response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getFunctionCallable() { return stub.getFunctionCallable(); @@ -247,6 +357,18 @@ public final UnaryCallable getFunctionCallabl * 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
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   CloudFunction function = CloudFunction.newBuilder().build();
+   *   CloudFunction response =
+   *       cloudFunctionsServiceClient.createFunctionAsync(location, function).get();
+   * }
+   * }
+ * * @param location 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. @@ -267,6 +389,18 @@ public final OperationFuture createFunctionA * 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
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   String location = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   CloudFunction function = CloudFunction.newBuilder().build();
+   *   CloudFunction response =
+   *       cloudFunctionsServiceClient.createFunctionAsync(location, function).get();
+   * }
+   * }
+ * * @param location 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. @@ -284,6 +418,20 @@ public final OperationFuture createFunctionA * 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
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CreateFunctionRequest request =
+   *       CreateFunctionRequest.newBuilder()
+   *           .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFunction(CloudFunction.newBuilder().build())
+   *           .build();
+   *   CloudFunction response = cloudFunctionsServiceClient.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 */ @@ -298,6 +446,21 @@ public final OperationFuture createFunctionA * project, the long running operation will return `ALREADY_EXISTS` error. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CreateFunctionRequest request =
+   *       CreateFunctionRequest.newBuilder()
+   *           .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFunction(CloudFunction.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       cloudFunctionsServiceClient.createFunctionOperationCallable().futureCall(request);
+   *   // Do something.
+   *   CloudFunction response = future.get();
+   * }
+   * }
*/ public final OperationCallable createFunctionOperationCallable() { @@ -310,6 +473,21 @@ public final OperationFuture createFunctionA * project, the long running operation will return `ALREADY_EXISTS` error. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CreateFunctionRequest request =
+   *       CreateFunctionRequest.newBuilder()
+   *           .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setFunction(CloudFunction.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       cloudFunctionsServiceClient.createFunctionCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createFunctionCallable() { return stub.createFunctionCallable(); @@ -319,6 +497,16 @@ public final UnaryCallable createFunctionCalla /** * Updates existing function. * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CloudFunction function = CloudFunction.newBuilder().build();
+   *   CloudFunction response = cloudFunctionsServiceClient.updateFunctionAsync(function).get();
+   * }
+   * }
+ * * @param function Required. New version of the function. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -333,6 +521,20 @@ public final OperationFuture updateFunctionA /** * Updates existing function. * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   UpdateFunctionRequest request =
+   *       UpdateFunctionRequest.newBuilder()
+   *           .setFunction(CloudFunction.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   CloudFunction response = cloudFunctionsServiceClient.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 */ @@ -346,6 +548,21 @@ public final OperationFuture updateFunctionA * Updates existing function. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   UpdateFunctionRequest request =
+   *       UpdateFunctionRequest.newBuilder()
+   *           .setFunction(CloudFunction.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       cloudFunctionsServiceClient.updateFunctionOperationCallable().futureCall(request);
+   *   // Do something.
+   *   CloudFunction response = future.get();
+   * }
+   * }
*/ public final OperationCallable updateFunctionOperationCallable() { @@ -357,6 +574,21 @@ public final OperationFuture updateFunctionA * Updates existing function. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   UpdateFunctionRequest request =
+   *       UpdateFunctionRequest.newBuilder()
+   *           .setFunction(CloudFunction.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       cloudFunctionsServiceClient.updateFunctionCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateFunctionCallable() { return stub.updateFunctionCallable(); @@ -367,6 +599,16 @@ public final UnaryCallable updateFunctionCalla * 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
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
+   *   cloudFunctionsServiceClient.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 */ @@ -382,6 +624,16 @@ public final OperationFuture deleteFunctionAsync( * 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
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
+   *   cloudFunctionsServiceClient.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 */ @@ -395,6 +647,19 @@ public final OperationFuture deleteFunctionAsync(Str * 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
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   DeleteFunctionRequest request =
+   *       DeleteFunctionRequest.newBuilder()
+   *           .setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+   *           .build();
+   *   cloudFunctionsServiceClient.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 */ @@ -409,6 +674,20 @@ public final OperationFuture deleteFunctionAsync( * used by some trigger, the trigger will be updated to remove this function. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   DeleteFunctionRequest request =
+   *       DeleteFunctionRequest.newBuilder()
+   *           .setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       cloudFunctionsServiceClient.deleteFunctionOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final OperationCallable deleteFunctionOperationCallable() { @@ -421,6 +700,20 @@ public final OperationFuture deleteFunctionAsync( * used by some trigger, the trigger will be updated to remove this function. * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   DeleteFunctionRequest request =
+   *       DeleteFunctionRequest.newBuilder()
+   *           .setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       cloudFunctionsServiceClient.deleteFunctionCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteFunctionCallable() { return stub.deleteFunctionCallable(); @@ -432,6 +725,17 @@ public final UnaryCallable deleteFunctionCalla * limited traffic is allowed. For more information on the actual limits, refer to [Rate * Limits](https://cloud.google.com/functions/quotas#rate_limits). * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
+   *   String data = "data3076010";
+   *   CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(name, data);
+   * }
+   * }
+ * * @param name Required. The name of the function to be called. * @param data Required. Input to be passed to the function. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -451,6 +755,17 @@ public final CallFunctionResponse callFunction(CloudFunctionName name, String da * limited traffic is allowed. For more information on the actual limits, refer to [Rate * Limits](https://cloud.google.com/functions/quotas#rate_limits). * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   String name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString();
+   *   String data = "data3076010";
+   *   CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(name, data);
+   * }
+   * }
+ * * @param name Required. The name of the function to be called. * @param data Required. Input to be passed to the function. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -467,6 +782,20 @@ public final CallFunctionResponse callFunction(String name, String data) { * limited traffic is allowed. For more information on the actual limits, refer to [Rate * Limits](https://cloud.google.com/functions/quotas#rate_limits). * + *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CallFunctionRequest request =
+   *       CallFunctionRequest.newBuilder()
+   *           .setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+   *           .setData("data3076010")
+   *           .build();
+   *   CallFunctionResponse response = cloudFunctionsServiceClient.callFunction(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 */ @@ -481,6 +810,21 @@ public final CallFunctionResponse callFunction(CallFunctionRequest request) { * Limits](https://cloud.google.com/functions/quotas#rate_limits). * *

Sample code: + * + *

{@code
+   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
+   *     CloudFunctionsServiceClient.create()) {
+   *   CallFunctionRequest request =
+   *       CallFunctionRequest.newBuilder()
+   *           .setName(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
+   *           .setData("data3076010")
+   *           .build();
+   *   ApiFuture future =
+   *       cloudFunctionsServiceClient.callFunctionCallable().futureCall(request);
+   *   // Do something.
+   *   CallFunctionResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable callFunctionCallable() { return stub.callFunctionCallable(); @@ -517,6 +861,17 @@ public final UnaryCallable callFuncti *
  • `Authorization: Bearer YOUR_TOKEN` * * + *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   GenerateUploadUrlRequest request =
    +   *       GenerateUploadUrlRequest.newBuilder().setParent("parent-995424086").build();
    +   *   GenerateUploadUrlResponse response = cloudFunctionsServiceClient.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 */ @@ -556,6 +911,18 @@ public final GenerateUploadUrlResponse generateUploadUrl(GenerateUploadUrlReques * * *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   GenerateUploadUrlRequest request =
    +   *       GenerateUploadUrlRequest.newBuilder().setParent("parent-995424086").build();
    +   *   ApiFuture future =
    +   *       cloudFunctionsServiceClient.generateUploadUrlCallable().futureCall(request);
    +   *   // Do something.
    +   *   GenerateUploadUrlResponse response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable generateUploadUrlCallable() { @@ -568,6 +935,21 @@ public final GenerateUploadUrlResponse generateUploadUrl(GenerateUploadUrlReques * limited period and should be used within minutes after generation. For more information about * the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls * + *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   GenerateDownloadUrlRequest request =
    +   *       GenerateDownloadUrlRequest.newBuilder()
    +   *           .setName("name3373707")
    +   *           .setVersionId(-670497310)
    +   *           .build();
    +   *   GenerateDownloadUrlResponse response =
    +   *       cloudFunctionsServiceClient.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 */ @@ -582,6 +964,21 @@ public final GenerateDownloadUrlResponse generateDownloadUrl(GenerateDownloadUrl * the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls * *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   GenerateDownloadUrlRequest request =
    +   *       GenerateDownloadUrlRequest.newBuilder()
    +   *           .setName("name3373707")
    +   *           .setVersionId(-670497310)
    +   *           .build();
    +   *   ApiFuture future =
    +   *       cloudFunctionsServiceClient.generateDownloadUrlCallable().futureCall(request);
    +   *   // Do something.
    +   *   GenerateDownloadUrlResponse response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable generateDownloadUrlCallable() { @@ -592,6 +989,20 @@ public final GenerateDownloadUrlResponse generateDownloadUrl(GenerateDownloadUrl /** * Sets the IAM access control policy on the specified function. Replaces any existing policy. * + *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   SetIamPolicyRequest request =
    +   *       SetIamPolicyRequest.newBuilder()
    +   *           .setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
    +   *           .setPolicy(Policy.newBuilder().build())
    +   *           .build();
    +   *   Policy response = cloudFunctionsServiceClient.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 */ @@ -604,6 +1015,21 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { * Sets the IAM access control policy on the specified function. Replaces any existing policy. * *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   SetIamPolicyRequest request =
    +   *       SetIamPolicyRequest.newBuilder()
    +   *           .setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
    +   *           .setPolicy(Policy.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       cloudFunctionsServiceClient.setIamPolicyCallable().futureCall(request);
    +   *   // Do something.
    +   *   Policy response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); @@ -614,6 +1040,20 @@ public final UnaryCallable setIamPolicyCallable() { * Gets the IAM access control policy for a function. Returns an empty policy if the function * exists and does not have a policy set. * + *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   GetIamPolicyRequest request =
    +   *       GetIamPolicyRequest.newBuilder()
    +   *           .setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
    +   *           .setOptions(GetPolicyOptions.newBuilder().build())
    +   *           .build();
    +   *   Policy response = cloudFunctionsServiceClient.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 */ @@ -627,6 +1067,21 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { * exists and does not have a policy set. * *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   GetIamPolicyRequest request =
    +   *       GetIamPolicyRequest.newBuilder()
    +   *           .setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
    +   *           .setOptions(GetPolicyOptions.newBuilder().build())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       cloudFunctionsServiceClient.getIamPolicyCallable().futureCall(request);
    +   *   // Do something.
    +   *   Policy response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); @@ -637,6 +1092,20 @@ public final UnaryCallable getIamPolicyCallable() { * Tests the specified permissions against the IAM access control policy for a function. If the * function does not exist, this will return an empty set of permissions, not a NOT_FOUND error. * + *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   TestIamPermissionsRequest request =
    +   *       TestIamPermissionsRequest.newBuilder()
    +   *           .setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
    +   *           .addAllPermissions(new ArrayList())
    +   *           .build();
    +   *   TestIamPermissionsResponse response = cloudFunctionsServiceClient.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 */ @@ -650,6 +1119,21 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * function does not exist, this will return an empty set of permissions, not a NOT_FOUND error. * *

    Sample code: + * + *

    {@code
    +   * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    +   *     CloudFunctionsServiceClient.create()) {
    +   *   TestIamPermissionsRequest request =
    +   *       TestIamPermissionsRequest.newBuilder()
    +   *           .setResource(CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]").toString())
    +   *           .addAllPermissions(new ArrayList())
    +   *           .build();
    +   *   ApiFuture future =
    +   *       cloudFunctionsServiceClient.testIamPermissionsCallable().futureCall(request);
    +   *   // Do something.
    +   *   TestIamPermissionsResponse response = future.get();
    +   * }
    +   * }
    */ public final UnaryCallable testIamPermissionsCallable() { 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 5e9e48c0..414df439 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 @@ -22,6 +22,14 @@ *

    Service Description: A service that application uses to manipulate triggers and functions. * *

    Sample for CloudFunctionsServiceClient: + * + *

    {@code
    + * try (CloudFunctionsServiceClient cloudFunctionsServiceClient =
    + *     CloudFunctionsServiceClient.create()) {
    + *   CloudFunctionName name = CloudFunctionName.of("[PROJECT]", "[LOCATION]", "[FUNCTION]");
    + *   CloudFunction response = cloudFunctionsServiceClient.getFunction(name);
    + * }
    + * }
    */ @Generated("by gapic-generator-java") package com.google.cloud.functions.v1; diff --git a/synth.metadata b/synth.metadata index ea12b581..c56b64f0 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-functions.git", - "sha": "cd3684ab4ac4f2eba3c9a5dc300a4114d3a7b5ac" + "sha": "fad1c8c02950103b09488de6c106aa51124f9508" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {