Skip to content

Commit 9caae4d

Browse files
feat: [cloudtasks] increase timeout of RPC methods to 20s for v2 (#9646)
* feat: increase timeout of RPC methods to 20s for v2 feat: add YAML config for GetLocation and ListLocation for v2 feat: add UploadQueueYaml, BufferTask RPC method for CloudTasks service for v2beta2 feat: set deadline for GetLocation, ListLocations and UploadQueueYaml RPCs for v2beta2 feat: add BufferTask RPC method for CloudTasks service for v2beta3 feat: add YAML config for GetLocation and ListLocations for v2beta3 PiperOrigin-RevId: 548738528 Source-Link: googleapis/googleapis@4d98ffc Source-Link: https://github.com/googleapis/googleapis-gen/commit/183d6bc4ee3c1890b1d24f9dc855041f497d5d5b Copy-Tag: eyJwIjoiamF2YS10YXNrcy8uT3dsQm90LnlhbWwiLCJoIjoiMTgzZDZiYzRlZTNjMTg5MGIxZDI0ZjlkYzg1NTA0MWY0OTdkNWQ1YiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Add in locations grpc --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Lawrence Qiu <[email protected]>
1 parent c7c7860 commit 9caae4d

File tree

185 files changed

+38601
-2684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+38601
-2684
lines changed

java-tasks/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
2020
<dependency>
2121
<groupId>com.google.cloud</groupId>
2222
<artifactId>libraries-bom</artifactId>
23-
<version>26.16.0</version>
23+
<version>26.18.0</version>
2424
<type>pom</type>
2525
<scope>import</scope>
2626
</dependency>
@@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
195195
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
196196
[stability-image]: https://img.shields.io/badge/stability-stable-green
197197
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-tasks.svg
198-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-tasks/2.19.0
198+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-tasks/2.21.0
199199
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
200200
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
201201
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

java-tasks/google-cloud-tasks/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,10 @@
123123
<classifier>testlib</classifier>
124124
<scope>test</scope>
125125
</dependency>
126+
<dependency>
127+
<groupId>com.google.api.grpc</groupId>
128+
<artifactId>grpc-google-common-protos</artifactId>
129+
<scope>test</scope>
130+
</dependency>
126131
</dependencies>
127132
</project>

java-tasks/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/CloudTasksClient.java

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
import com.google.api.gax.rpc.PageContext;
2626
import com.google.api.gax.rpc.UnaryCallable;
2727
import com.google.api.resourcenames.ResourceName;
28+
import com.google.cloud.location.GetLocationRequest;
29+
import com.google.cloud.location.ListLocationsRequest;
30+
import com.google.cloud.location.ListLocationsResponse;
31+
import com.google.cloud.location.Location;
2832
import com.google.cloud.tasks.v2.stub.CloudTasksStub;
2933
import com.google.cloud.tasks.v2.stub.CloudTasksStubSettings;
3034
import com.google.common.util.concurrent.MoreExecutors;
@@ -2583,6 +2587,161 @@ public final UnaryCallable<RunTaskRequest, Task> runTaskCallable() {
25832587
return stub.runTaskCallable();
25842588
}
25852589

2590+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2591+
/**
2592+
* Lists information about the supported locations for this service.
2593+
*
2594+
* <p>Sample code:
2595+
*
2596+
* <pre>{@code
2597+
* // This snippet has been automatically generated and should be regarded as a code template only.
2598+
* // It will require modifications to work:
2599+
* // - It may require correct/in-range values for request initialization.
2600+
* // - It may require specifying regional endpoints when creating the service client as shown in
2601+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2602+
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
2603+
* ListLocationsRequest request =
2604+
* ListLocationsRequest.newBuilder()
2605+
* .setName("name3373707")
2606+
* .setFilter("filter-1274492040")
2607+
* .setPageSize(883849137)
2608+
* .setPageToken("pageToken873572522")
2609+
* .build();
2610+
* for (Location element : cloudTasksClient.listLocations(request).iterateAll()) {
2611+
* // doThingsWith(element);
2612+
* }
2613+
* }
2614+
* }</pre>
2615+
*
2616+
* @param request The request object containing all of the parameters for the API call.
2617+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
2618+
*/
2619+
public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
2620+
return listLocationsPagedCallable().call(request);
2621+
}
2622+
2623+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2624+
/**
2625+
* Lists information about the supported locations for this service.
2626+
*
2627+
* <p>Sample code:
2628+
*
2629+
* <pre>{@code
2630+
* // This snippet has been automatically generated and should be regarded as a code template only.
2631+
* // It will require modifications to work:
2632+
* // - It may require correct/in-range values for request initialization.
2633+
* // - It may require specifying regional endpoints when creating the service client as shown in
2634+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2635+
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
2636+
* ListLocationsRequest request =
2637+
* ListLocationsRequest.newBuilder()
2638+
* .setName("name3373707")
2639+
* .setFilter("filter-1274492040")
2640+
* .setPageSize(883849137)
2641+
* .setPageToken("pageToken873572522")
2642+
* .build();
2643+
* ApiFuture<Location> future =
2644+
* cloudTasksClient.listLocationsPagedCallable().futureCall(request);
2645+
* // Do something.
2646+
* for (Location element : future.get().iterateAll()) {
2647+
* // doThingsWith(element);
2648+
* }
2649+
* }
2650+
* }</pre>
2651+
*/
2652+
public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
2653+
listLocationsPagedCallable() {
2654+
return stub.listLocationsPagedCallable();
2655+
}
2656+
2657+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2658+
/**
2659+
* Lists information about the supported locations for this service.
2660+
*
2661+
* <p>Sample code:
2662+
*
2663+
* <pre>{@code
2664+
* // This snippet has been automatically generated and should be regarded as a code template only.
2665+
* // It will require modifications to work:
2666+
* // - It may require correct/in-range values for request initialization.
2667+
* // - It may require specifying regional endpoints when creating the service client as shown in
2668+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2669+
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
2670+
* ListLocationsRequest request =
2671+
* ListLocationsRequest.newBuilder()
2672+
* .setName("name3373707")
2673+
* .setFilter("filter-1274492040")
2674+
* .setPageSize(883849137)
2675+
* .setPageToken("pageToken873572522")
2676+
* .build();
2677+
* while (true) {
2678+
* ListLocationsResponse response = cloudTasksClient.listLocationsCallable().call(request);
2679+
* for (Location element : response.getLocationsList()) {
2680+
* // doThingsWith(element);
2681+
* }
2682+
* String nextPageToken = response.getNextPageToken();
2683+
* if (!Strings.isNullOrEmpty(nextPageToken)) {
2684+
* request = request.toBuilder().setPageToken(nextPageToken).build();
2685+
* } else {
2686+
* break;
2687+
* }
2688+
* }
2689+
* }
2690+
* }</pre>
2691+
*/
2692+
public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
2693+
return stub.listLocationsCallable();
2694+
}
2695+
2696+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2697+
/**
2698+
* Gets information about a location.
2699+
*
2700+
* <p>Sample code:
2701+
*
2702+
* <pre>{@code
2703+
* // This snippet has been automatically generated and should be regarded as a code template only.
2704+
* // It will require modifications to work:
2705+
* // - It may require correct/in-range values for request initialization.
2706+
* // - It may require specifying regional endpoints when creating the service client as shown in
2707+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2708+
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
2709+
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
2710+
* Location response = cloudTasksClient.getLocation(request);
2711+
* }
2712+
* }</pre>
2713+
*
2714+
* @param request The request object containing all of the parameters for the API call.
2715+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
2716+
*/
2717+
public final Location getLocation(GetLocationRequest request) {
2718+
return getLocationCallable().call(request);
2719+
}
2720+
2721+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2722+
/**
2723+
* Gets information about a location.
2724+
*
2725+
* <p>Sample code:
2726+
*
2727+
* <pre>{@code
2728+
* // This snippet has been automatically generated and should be regarded as a code template only.
2729+
* // It will require modifications to work:
2730+
* // - It may require correct/in-range values for request initialization.
2731+
* // - It may require specifying regional endpoints when creating the service client as shown in
2732+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2733+
* try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
2734+
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
2735+
* ApiFuture<Location> future = cloudTasksClient.getLocationCallable().futureCall(request);
2736+
* // Do something.
2737+
* Location response = future.get();
2738+
* }
2739+
* }</pre>
2740+
*/
2741+
public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
2742+
return stub.getLocationCallable();
2743+
}
2744+
25862745
@Override
25872746
public final void close() {
25882747
stub.close();
@@ -2750,4 +2909,80 @@ protected ListTasksFixedSizeCollection createCollection(
27502909
return new ListTasksFixedSizeCollection(pages, collectionSize);
27512910
}
27522911
}
2912+
2913+
public static class ListLocationsPagedResponse
2914+
extends AbstractPagedListResponse<
2915+
ListLocationsRequest,
2916+
ListLocationsResponse,
2917+
Location,
2918+
ListLocationsPage,
2919+
ListLocationsFixedSizeCollection> {
2920+
2921+
public static ApiFuture<ListLocationsPagedResponse> createAsync(
2922+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2923+
ApiFuture<ListLocationsResponse> futureResponse) {
2924+
ApiFuture<ListLocationsPage> futurePage =
2925+
ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
2926+
return ApiFutures.transform(
2927+
futurePage,
2928+
input -> new ListLocationsPagedResponse(input),
2929+
MoreExecutors.directExecutor());
2930+
}
2931+
2932+
private ListLocationsPagedResponse(ListLocationsPage page) {
2933+
super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
2934+
}
2935+
}
2936+
2937+
public static class ListLocationsPage
2938+
extends AbstractPage<
2939+
ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
2940+
2941+
private ListLocationsPage(
2942+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2943+
ListLocationsResponse response) {
2944+
super(context, response);
2945+
}
2946+
2947+
private static ListLocationsPage createEmptyPage() {
2948+
return new ListLocationsPage(null, null);
2949+
}
2950+
2951+
@Override
2952+
protected ListLocationsPage createPage(
2953+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2954+
ListLocationsResponse response) {
2955+
return new ListLocationsPage(context, response);
2956+
}
2957+
2958+
@Override
2959+
public ApiFuture<ListLocationsPage> createPageAsync(
2960+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2961+
ApiFuture<ListLocationsResponse> futureResponse) {
2962+
return super.createPageAsync(context, futureResponse);
2963+
}
2964+
}
2965+
2966+
public static class ListLocationsFixedSizeCollection
2967+
extends AbstractFixedSizeCollection<
2968+
ListLocationsRequest,
2969+
ListLocationsResponse,
2970+
Location,
2971+
ListLocationsPage,
2972+
ListLocationsFixedSizeCollection> {
2973+
2974+
private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
2975+
super(pages, collectionSize);
2976+
}
2977+
2978+
private static ListLocationsFixedSizeCollection createEmptyCollection() {
2979+
return new ListLocationsFixedSizeCollection(null, 0);
2980+
}
2981+
2982+
@Override
2983+
protected ListLocationsFixedSizeCollection createCollection(
2984+
List<ListLocationsPage> pages, int collectionSize) {
2985+
return new ListLocationsFixedSizeCollection(pages, collectionSize);
2986+
}
2987+
}
27532988
}

java-tasks/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/CloudTasksSettings.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.tasks.v2;
1818

19+
import static com.google.cloud.tasks.v2.CloudTasksClient.ListLocationsPagedResponse;
1920
import static com.google.cloud.tasks.v2.CloudTasksClient.ListQueuesPagedResponse;
2021
import static com.google.cloud.tasks.v2.CloudTasksClient.ListTasksPagedResponse;
2122

@@ -31,6 +32,10 @@
3132
import com.google.api.gax.rpc.PagedCallSettings;
3233
import com.google.api.gax.rpc.TransportChannelProvider;
3334
import com.google.api.gax.rpc.UnaryCallSettings;
35+
import com.google.cloud.location.GetLocationRequest;
36+
import com.google.cloud.location.ListLocationsRequest;
37+
import com.google.cloud.location.ListLocationsResponse;
38+
import com.google.cloud.location.Location;
3439
import com.google.cloud.tasks.v2.stub.CloudTasksStubSettings;
3540
import com.google.iam.v1.GetIamPolicyRequest;
3641
import com.google.iam.v1.Policy;
@@ -164,6 +169,17 @@ public UnaryCallSettings<RunTaskRequest, Task> runTaskSettings() {
164169
return ((CloudTasksStubSettings) getStubSettings()).runTaskSettings();
165170
}
166171

172+
/** Returns the object with the settings used for calls to listLocations. */
173+
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
174+
listLocationsSettings() {
175+
return ((CloudTasksStubSettings) getStubSettings()).listLocationsSettings();
176+
}
177+
178+
/** Returns the object with the settings used for calls to getLocation. */
179+
public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
180+
return ((CloudTasksStubSettings) getStubSettings()).getLocationSettings();
181+
}
182+
167183
public static final CloudTasksSettings create(CloudTasksStubSettings stub) throws IOException {
168184
return new CloudTasksSettings.Builder(stub.toBuilder()).build();
169185
}
@@ -361,6 +377,18 @@ public UnaryCallSettings.Builder<RunTaskRequest, Task> runTaskSettings() {
361377
return getStubSettingsBuilder().runTaskSettings();
362378
}
363379

380+
/** Returns the builder for the settings used for calls to listLocations. */
381+
public PagedCallSettings.Builder<
382+
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
383+
listLocationsSettings() {
384+
return getStubSettingsBuilder().listLocationsSettings();
385+
}
386+
387+
/** Returns the builder for the settings used for calls to getLocation. */
388+
public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
389+
return getStubSettingsBuilder().getLocationSettings();
390+
}
391+
364392
@Override
365393
public CloudTasksSettings build() throws IOException {
366394
return new CloudTasksSettings(this);

java-tasks/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/gapic_metadata.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@
2525
"GetIamPolicy": {
2626
"methods": ["getIamPolicy", "getIamPolicy", "getIamPolicy", "getIamPolicyCallable"]
2727
},
28+
"GetLocation": {
29+
"methods": ["getLocation", "getLocationCallable"]
30+
},
2831
"GetQueue": {
2932
"methods": ["getQueue", "getQueue", "getQueue", "getQueueCallable"]
3033
},
3134
"GetTask": {
3235
"methods": ["getTask", "getTask", "getTask", "getTaskCallable"]
3336
},
37+
"ListLocations": {
38+
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
39+
},
3440
"ListQueues": {
3541
"methods": ["listQueues", "listQueues", "listQueues", "listQueuesPagedCallable", "listQueuesCallable"]
3642
},

java-tasks/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/stub/CloudTasksStub.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@
1616

1717
package com.google.cloud.tasks.v2.stub;
1818

19+
import static com.google.cloud.tasks.v2.CloudTasksClient.ListLocationsPagedResponse;
1920
import static com.google.cloud.tasks.v2.CloudTasksClient.ListQueuesPagedResponse;
2021
import static com.google.cloud.tasks.v2.CloudTasksClient.ListTasksPagedResponse;
2122

2223
import com.google.api.gax.core.BackgroundResource;
2324
import com.google.api.gax.rpc.UnaryCallable;
25+
import com.google.cloud.location.GetLocationRequest;
26+
import com.google.cloud.location.ListLocationsRequest;
27+
import com.google.cloud.location.ListLocationsResponse;
28+
import com.google.cloud.location.Location;
2429
import com.google.cloud.tasks.v2.CreateQueueRequest;
2530
import com.google.cloud.tasks.v2.CreateTaskRequest;
2631
import com.google.cloud.tasks.v2.DeleteQueueRequest;
@@ -128,6 +133,19 @@ public UnaryCallable<RunTaskRequest, Task> runTaskCallable() {
128133
throw new UnsupportedOperationException("Not implemented: runTaskCallable()");
129134
}
130135

136+
public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
137+
listLocationsPagedCallable() {
138+
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
139+
}
140+
141+
public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
142+
throw new UnsupportedOperationException("Not implemented: listLocationsCallable()");
143+
}
144+
145+
public UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
146+
throw new UnsupportedOperationException("Not implemented: getLocationCallable()");
147+
}
148+
131149
@Override
132150
public abstract void close();
133151
}

0 commit comments

Comments
 (0)