Skip to content

Commit d9c7ee5

Browse files
feat: [cloudscheduler] Location API methods (#9181)
* feat: Location API methods docs: updated comments chore: proto formatting PiperOrigin-RevId: 513582719 Source-Link: googleapis/googleapis@822476c Source-Link: https://github.com/googleapis/googleapis-gen/commit/39ca52760199d113b51ad8bdca75cea9e11a9e98 Copy-Tag: eyJwIjoiamF2YS1zY2hlZHVsZXIvLk93bEJvdC55YW1sIiwiaCI6IjM5Y2E1Mjc2MDE5OWQxMTNiNTFhZDhiZGNhNzVjZWE5ZTExYTllOTgifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 51bca7c commit d9c7ee5

45 files changed

Lines changed: 2539 additions & 739 deletions

Some content is hidden

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

java-scheduler/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Java idiomatic client for [Google Cloud Scheduler][product-docs].
1414

1515
If you are using Maven, add this to your pom.xml file:
1616

17-
<!--- {x-version-update-start:google-cloud-scheduler:released} -->
1817

1918
```xml
2019
<dependency>
@@ -35,7 +34,6 @@ If you are using SBT, add this to your dependencies:
3534
```Scala
3635
libraryDependencies += "com.google.cloud" % "google-cloud-scheduler" % "2.12.0"
3736
```
38-
<!--- {x-version-update-end} -->
3937

4038
## Authentication
4139

java-scheduler/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/CloudSchedulerClient.java

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
import com.google.api.gax.paging.AbstractPagedListResponse;
2525
import com.google.api.gax.rpc.PageContext;
2626
import com.google.api.gax.rpc.UnaryCallable;
27+
import com.google.cloud.location.GetLocationRequest;
28+
import com.google.cloud.location.ListLocationsRequest;
29+
import com.google.cloud.location.ListLocationsResponse;
30+
import com.google.cloud.location.Location;
2731
import com.google.cloud.scheduler.v1.stub.CloudSchedulerStub;
2832
import com.google.cloud.scheduler.v1.stub.CloudSchedulerStubSettings;
2933
import com.google.common.util.concurrent.MoreExecutors;
@@ -1184,6 +1188,161 @@ public final UnaryCallable<RunJobRequest, Job> runJobCallable() {
11841188
return stub.runJobCallable();
11851189
}
11861190

1191+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1192+
/**
1193+
* Lists information about the supported locations for this service.
1194+
*
1195+
* <p>Sample code:
1196+
*
1197+
* <pre>{@code
1198+
* // This snippet has been automatically generated and should be regarded as a code template only.
1199+
* // It will require modifications to work:
1200+
* // - It may require correct/in-range values for request initialization.
1201+
* // - It may require specifying regional endpoints when creating the service client as shown in
1202+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1203+
* try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
1204+
* ListLocationsRequest request =
1205+
* ListLocationsRequest.newBuilder()
1206+
* .setName("name3373707")
1207+
* .setFilter("filter-1274492040")
1208+
* .setPageSize(883849137)
1209+
* .setPageToken("pageToken873572522")
1210+
* .build();
1211+
* for (Location element : cloudSchedulerClient.listLocations(request).iterateAll()) {
1212+
* // doThingsWith(element);
1213+
* }
1214+
* }
1215+
* }</pre>
1216+
*
1217+
* @param request The request object containing all of the parameters for the API call.
1218+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1219+
*/
1220+
public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
1221+
return listLocationsPagedCallable().call(request);
1222+
}
1223+
1224+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1225+
/**
1226+
* Lists information about the supported locations for this service.
1227+
*
1228+
* <p>Sample code:
1229+
*
1230+
* <pre>{@code
1231+
* // This snippet has been automatically generated and should be regarded as a code template only.
1232+
* // It will require modifications to work:
1233+
* // - It may require correct/in-range values for request initialization.
1234+
* // - It may require specifying regional endpoints when creating the service client as shown in
1235+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1236+
* try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
1237+
* ListLocationsRequest request =
1238+
* ListLocationsRequest.newBuilder()
1239+
* .setName("name3373707")
1240+
* .setFilter("filter-1274492040")
1241+
* .setPageSize(883849137)
1242+
* .setPageToken("pageToken873572522")
1243+
* .build();
1244+
* ApiFuture<Location> future =
1245+
* cloudSchedulerClient.listLocationsPagedCallable().futureCall(request);
1246+
* // Do something.
1247+
* for (Location element : future.get().iterateAll()) {
1248+
* // doThingsWith(element);
1249+
* }
1250+
* }
1251+
* }</pre>
1252+
*/
1253+
public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
1254+
listLocationsPagedCallable() {
1255+
return stub.listLocationsPagedCallable();
1256+
}
1257+
1258+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1259+
/**
1260+
* Lists information about the supported locations for this service.
1261+
*
1262+
* <p>Sample code:
1263+
*
1264+
* <pre>{@code
1265+
* // This snippet has been automatically generated and should be regarded as a code template only.
1266+
* // It will require modifications to work:
1267+
* // - It may require correct/in-range values for request initialization.
1268+
* // - It may require specifying regional endpoints when creating the service client as shown in
1269+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1270+
* try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
1271+
* ListLocationsRequest request =
1272+
* ListLocationsRequest.newBuilder()
1273+
* .setName("name3373707")
1274+
* .setFilter("filter-1274492040")
1275+
* .setPageSize(883849137)
1276+
* .setPageToken("pageToken873572522")
1277+
* .build();
1278+
* while (true) {
1279+
* ListLocationsResponse response = cloudSchedulerClient.listLocationsCallable().call(request);
1280+
* for (Location element : response.getLocationsList()) {
1281+
* // doThingsWith(element);
1282+
* }
1283+
* String nextPageToken = response.getNextPageToken();
1284+
* if (!Strings.isNullOrEmpty(nextPageToken)) {
1285+
* request = request.toBuilder().setPageToken(nextPageToken).build();
1286+
* } else {
1287+
* break;
1288+
* }
1289+
* }
1290+
* }
1291+
* }</pre>
1292+
*/
1293+
public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
1294+
return stub.listLocationsCallable();
1295+
}
1296+
1297+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1298+
/**
1299+
* Gets information about a location.
1300+
*
1301+
* <p>Sample code:
1302+
*
1303+
* <pre>{@code
1304+
* // This snippet has been automatically generated and should be regarded as a code template only.
1305+
* // It will require modifications to work:
1306+
* // - It may require correct/in-range values for request initialization.
1307+
* // - It may require specifying regional endpoints when creating the service client as shown in
1308+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1309+
* try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
1310+
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1311+
* Location response = cloudSchedulerClient.getLocation(request);
1312+
* }
1313+
* }</pre>
1314+
*
1315+
* @param request The request object containing all of the parameters for the API call.
1316+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1317+
*/
1318+
public final Location getLocation(GetLocationRequest request) {
1319+
return getLocationCallable().call(request);
1320+
}
1321+
1322+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1323+
/**
1324+
* Gets information about a location.
1325+
*
1326+
* <p>Sample code:
1327+
*
1328+
* <pre>{@code
1329+
* // This snippet has been automatically generated and should be regarded as a code template only.
1330+
* // It will require modifications to work:
1331+
* // - It may require correct/in-range values for request initialization.
1332+
* // - It may require specifying regional endpoints when creating the service client as shown in
1333+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1334+
* try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
1335+
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
1336+
* ApiFuture<Location> future = cloudSchedulerClient.getLocationCallable().futureCall(request);
1337+
* // Do something.
1338+
* Location response = future.get();
1339+
* }
1340+
* }</pre>
1341+
*/
1342+
public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
1343+
return stub.getLocationCallable();
1344+
}
1345+
11871346
@Override
11881347
public final void close() {
11891348
stub.close();
@@ -1276,4 +1435,80 @@ protected ListJobsFixedSizeCollection createCollection(
12761435
return new ListJobsFixedSizeCollection(pages, collectionSize);
12771436
}
12781437
}
1438+
1439+
public static class ListLocationsPagedResponse
1440+
extends AbstractPagedListResponse<
1441+
ListLocationsRequest,
1442+
ListLocationsResponse,
1443+
Location,
1444+
ListLocationsPage,
1445+
ListLocationsFixedSizeCollection> {
1446+
1447+
public static ApiFuture<ListLocationsPagedResponse> createAsync(
1448+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1449+
ApiFuture<ListLocationsResponse> futureResponse) {
1450+
ApiFuture<ListLocationsPage> futurePage =
1451+
ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
1452+
return ApiFutures.transform(
1453+
futurePage,
1454+
input -> new ListLocationsPagedResponse(input),
1455+
MoreExecutors.directExecutor());
1456+
}
1457+
1458+
private ListLocationsPagedResponse(ListLocationsPage page) {
1459+
super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
1460+
}
1461+
}
1462+
1463+
public static class ListLocationsPage
1464+
extends AbstractPage<
1465+
ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
1466+
1467+
private ListLocationsPage(
1468+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1469+
ListLocationsResponse response) {
1470+
super(context, response);
1471+
}
1472+
1473+
private static ListLocationsPage createEmptyPage() {
1474+
return new ListLocationsPage(null, null);
1475+
}
1476+
1477+
@Override
1478+
protected ListLocationsPage createPage(
1479+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1480+
ListLocationsResponse response) {
1481+
return new ListLocationsPage(context, response);
1482+
}
1483+
1484+
@Override
1485+
public ApiFuture<ListLocationsPage> createPageAsync(
1486+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
1487+
ApiFuture<ListLocationsResponse> futureResponse) {
1488+
return super.createPageAsync(context, futureResponse);
1489+
}
1490+
}
1491+
1492+
public static class ListLocationsFixedSizeCollection
1493+
extends AbstractFixedSizeCollection<
1494+
ListLocationsRequest,
1495+
ListLocationsResponse,
1496+
Location,
1497+
ListLocationsPage,
1498+
ListLocationsFixedSizeCollection> {
1499+
1500+
private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
1501+
super(pages, collectionSize);
1502+
}
1503+
1504+
private static ListLocationsFixedSizeCollection createEmptyCollection() {
1505+
return new ListLocationsFixedSizeCollection(null, 0);
1506+
}
1507+
1508+
@Override
1509+
protected ListLocationsFixedSizeCollection createCollection(
1510+
List<ListLocationsPage> pages, int collectionSize) {
1511+
return new ListLocationsFixedSizeCollection(pages, collectionSize);
1512+
}
1513+
}
12791514
}

java-scheduler/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/CloudSchedulerSettings.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.cloud.scheduler.v1;
1818

1919
import static com.google.cloud.scheduler.v1.CloudSchedulerClient.ListJobsPagedResponse;
20+
import static com.google.cloud.scheduler.v1.CloudSchedulerClient.ListLocationsPagedResponse;
2021

2122
import com.google.api.core.ApiFunction;
2223
import com.google.api.core.BetaApi;
@@ -30,6 +31,10 @@
3031
import com.google.api.gax.rpc.PagedCallSettings;
3132
import com.google.api.gax.rpc.TransportChannelProvider;
3233
import com.google.api.gax.rpc.UnaryCallSettings;
34+
import com.google.cloud.location.GetLocationRequest;
35+
import com.google.cloud.location.ListLocationsRequest;
36+
import com.google.cloud.location.ListLocationsResponse;
37+
import com.google.cloud.location.Location;
3338
import com.google.cloud.scheduler.v1.stub.CloudSchedulerStubSettings;
3439
import com.google.protobuf.Empty;
3540
import java.io.IOException;
@@ -118,6 +123,17 @@ public UnaryCallSettings<RunJobRequest, Job> runJobSettings() {
118123
return ((CloudSchedulerStubSettings) getStubSettings()).runJobSettings();
119124
}
120125

126+
/** Returns the object with the settings used for calls to listLocations. */
127+
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
128+
listLocationsSettings() {
129+
return ((CloudSchedulerStubSettings) getStubSettings()).listLocationsSettings();
130+
}
131+
132+
/** Returns the object with the settings used for calls to getLocation. */
133+
public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
134+
return ((CloudSchedulerStubSettings) getStubSettings()).getLocationSettings();
135+
}
136+
121137
public static final CloudSchedulerSettings create(CloudSchedulerStubSettings stub)
122138
throws IOException {
123139
return new CloudSchedulerSettings.Builder(stub.toBuilder()).build();
@@ -274,6 +290,18 @@ public UnaryCallSettings.Builder<RunJobRequest, Job> runJobSettings() {
274290
return getStubSettingsBuilder().runJobSettings();
275291
}
276292

293+
/** Returns the builder for the settings used for calls to listLocations. */
294+
public PagedCallSettings.Builder<
295+
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
296+
listLocationsSettings() {
297+
return getStubSettingsBuilder().listLocationsSettings();
298+
}
299+
300+
/** Returns the builder for the settings used for calls to getLocation. */
301+
public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
302+
return getStubSettingsBuilder().getLocationSettings();
303+
}
304+
277305
@Override
278306
public CloudSchedulerSettings build() throws IOException {
279307
return new CloudSchedulerSettings(this);

java-scheduler/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/gapic_metadata.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@
1919
"GetJob": {
2020
"methods": ["getJob", "getJob", "getJob", "getJobCallable"]
2121
},
22+
"GetLocation": {
23+
"methods": ["getLocation", "getLocationCallable"]
24+
},
2225
"ListJobs": {
2326
"methods": ["listJobs", "listJobs", "listJobs", "listJobsPagedCallable", "listJobsCallable"]
2427
},
28+
"ListLocations": {
29+
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
30+
},
2531
"PauseJob": {
2632
"methods": ["pauseJob", "pauseJob", "pauseJob", "pauseJobCallable"]
2733
},

java-scheduler/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/stub/CloudSchedulerStub.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
package com.google.cloud.scheduler.v1.stub;
1818

1919
import static com.google.cloud.scheduler.v1.CloudSchedulerClient.ListJobsPagedResponse;
20+
import static com.google.cloud.scheduler.v1.CloudSchedulerClient.ListLocationsPagedResponse;
2021

2122
import com.google.api.gax.core.BackgroundResource;
2223
import com.google.api.gax.rpc.UnaryCallable;
24+
import com.google.cloud.location.GetLocationRequest;
25+
import com.google.cloud.location.ListLocationsRequest;
26+
import com.google.cloud.location.ListLocationsResponse;
27+
import com.google.cloud.location.Location;
2328
import com.google.cloud.scheduler.v1.CreateJobRequest;
2429
import com.google.cloud.scheduler.v1.DeleteJobRequest;
2530
import com.google.cloud.scheduler.v1.GetJobRequest;
@@ -78,6 +83,19 @@ public UnaryCallable<RunJobRequest, Job> runJobCallable() {
7883
throw new UnsupportedOperationException("Not implemented: runJobCallable()");
7984
}
8085

86+
public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
87+
listLocationsPagedCallable() {
88+
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
89+
}
90+
91+
public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
92+
throw new UnsupportedOperationException("Not implemented: listLocationsCallable()");
93+
}
94+
95+
public UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
96+
throw new UnsupportedOperationException("Not implemented: getLocationCallable()");
97+
}
98+
8199
@Override
82100
public abstract void close();
83101
}

0 commit comments

Comments
 (0)