Skip to content

Commit 5117e77

Browse files
feat: [bigquerydatatransfer] Add location methods (#8945)
* feat: Add location methods PiperOrigin-RevId: 499272288 Source-Link: googleapis/googleapis@62c5867 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d1a5f9d4646e4cf78fdead068c3e8c064347ce45 Copy-Tag: eyJwIjoiamF2YS1iaWdxdWVyeWRhdGF0cmFuc2Zlci8uT3dsQm90LnlhbWwiLCJoIjoiZDFhNWY5ZDQ2NDZlNGNmNzhmZGVhZDA2OGMzZThjMDY0MzQ3Y2U0NSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add grpc dependency * change grpc dependency to test scope Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Joe Wang <[email protected]>
1 parent 4e89023 commit 5117e77

File tree

14 files changed

+998
-7
lines changed

14 files changed

+998
-7
lines changed

java-bigquerydatatransfer/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file:
1919
<dependency>
2020
<groupId>com.google.cloud</groupId>
2121
<artifactId>google-cloud-bigquerydatatransfer</artifactId>
22-
<version>2.6.0</version>
22+
<version>2.7.0</version>
2323
</dependency>
2424
```
2525

2626
If you are using Gradle without BOM, add this to your dependencies:
2727

2828
```Groovy
29-
implementation 'com.google.cloud:google-cloud-bigquerydatatransfer:2.6.0'
29+
implementation 'com.google.cloud:google-cloud-bigquerydatatransfer:2.7.0'
3030
```
3131

3232
If you are using SBT, add this to your dependencies:
3333

3434
```Scala
35-
libraryDependencies += "com.google.cloud" % "google-cloud-bigquerydatatransfer" % "2.6.0"
35+
libraryDependencies += "com.google.cloud" % "google-cloud-bigquerydatatransfer" % "2.7.0"
3636
```
3737

3838
## Authentication

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,10 @@
9696
<classifier>testlib</classifier>
9797
<scope>test</scope>
9898
</dependency>
99+
<dependency>
100+
<groupId>com.google.api.grpc</groupId>
101+
<artifactId>grpc-google-common-protos</artifactId>
102+
<scope>test</scope>
103+
</dependency>
99104
</dependencies>
100105
</project>

java-bigquerydatatransfer/google-cloud-bigquerydatatransfer/src/main/java/com/google/cloud/bigquery/datatransfer/v1/DataTransferServiceClient.java

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
import com.google.api.gax.rpc.UnaryCallable;
2727
import com.google.cloud.bigquery.datatransfer.v1.stub.DataTransferServiceStub;
2828
import com.google.cloud.bigquery.datatransfer.v1.stub.DataTransferServiceStubSettings;
29+
import com.google.cloud.location.GetLocationRequest;
30+
import com.google.cloud.location.ListLocationsRequest;
31+
import com.google.cloud.location.ListLocationsResponse;
32+
import com.google.cloud.location.Location;
2933
import com.google.common.util.concurrent.MoreExecutors;
3034
import com.google.protobuf.Empty;
3135
import com.google.protobuf.FieldMask;
@@ -2287,6 +2291,163 @@ public final UnaryCallable<EnrollDataSourcesRequest, Empty> enrollDataSourcesCal
22872291
return stub.enrollDataSourcesCallable();
22882292
}
22892293

2294+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2295+
/**
2296+
* Lists information about the supported locations for this service.
2297+
*
2298+
* <p>Sample code:
2299+
*
2300+
* <pre>{@code
2301+
* // This snippet has been automatically generated and should be regarded as a code template only.
2302+
* // It will require modifications to work:
2303+
* // - It may require correct/in-range values for request initialization.
2304+
* // - It may require specifying regional endpoints when creating the service client as shown in
2305+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2306+
* try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
2307+
* ListLocationsRequest request =
2308+
* ListLocationsRequest.newBuilder()
2309+
* .setName("name3373707")
2310+
* .setFilter("filter-1274492040")
2311+
* .setPageSize(883849137)
2312+
* .setPageToken("pageToken873572522")
2313+
* .build();
2314+
* for (Location element : dataTransferServiceClient.listLocations(request).iterateAll()) {
2315+
* // doThingsWith(element);
2316+
* }
2317+
* }
2318+
* }</pre>
2319+
*
2320+
* @param request The request object containing all of the parameters for the API call.
2321+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
2322+
*/
2323+
public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
2324+
return listLocationsPagedCallable().call(request);
2325+
}
2326+
2327+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2328+
/**
2329+
* Lists information about the supported locations for this service.
2330+
*
2331+
* <p>Sample code:
2332+
*
2333+
* <pre>{@code
2334+
* // This snippet has been automatically generated and should be regarded as a code template only.
2335+
* // It will require modifications to work:
2336+
* // - It may require correct/in-range values for request initialization.
2337+
* // - It may require specifying regional endpoints when creating the service client as shown in
2338+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2339+
* try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
2340+
* ListLocationsRequest request =
2341+
* ListLocationsRequest.newBuilder()
2342+
* .setName("name3373707")
2343+
* .setFilter("filter-1274492040")
2344+
* .setPageSize(883849137)
2345+
* .setPageToken("pageToken873572522")
2346+
* .build();
2347+
* ApiFuture<Location> future =
2348+
* dataTransferServiceClient.listLocationsPagedCallable().futureCall(request);
2349+
* // Do something.
2350+
* for (Location element : future.get().iterateAll()) {
2351+
* // doThingsWith(element);
2352+
* }
2353+
* }
2354+
* }</pre>
2355+
*/
2356+
public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
2357+
listLocationsPagedCallable() {
2358+
return stub.listLocationsPagedCallable();
2359+
}
2360+
2361+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2362+
/**
2363+
* Lists information about the supported locations for this service.
2364+
*
2365+
* <p>Sample code:
2366+
*
2367+
* <pre>{@code
2368+
* // This snippet has been automatically generated and should be regarded as a code template only.
2369+
* // It will require modifications to work:
2370+
* // - It may require correct/in-range values for request initialization.
2371+
* // - It may require specifying regional endpoints when creating the service client as shown in
2372+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2373+
* try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
2374+
* ListLocationsRequest request =
2375+
* ListLocationsRequest.newBuilder()
2376+
* .setName("name3373707")
2377+
* .setFilter("filter-1274492040")
2378+
* .setPageSize(883849137)
2379+
* .setPageToken("pageToken873572522")
2380+
* .build();
2381+
* while (true) {
2382+
* ListLocationsResponse response =
2383+
* dataTransferServiceClient.listLocationsCallable().call(request);
2384+
* for (Location element : response.getLocationsList()) {
2385+
* // doThingsWith(element);
2386+
* }
2387+
* String nextPageToken = response.getNextPageToken();
2388+
* if (!Strings.isNullOrEmpty(nextPageToken)) {
2389+
* request = request.toBuilder().setPageToken(nextPageToken).build();
2390+
* } else {
2391+
* break;
2392+
* }
2393+
* }
2394+
* }
2395+
* }</pre>
2396+
*/
2397+
public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
2398+
return stub.listLocationsCallable();
2399+
}
2400+
2401+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2402+
/**
2403+
* Gets information about a location.
2404+
*
2405+
* <p>Sample code:
2406+
*
2407+
* <pre>{@code
2408+
* // This snippet has been automatically generated and should be regarded as a code template only.
2409+
* // It will require modifications to work:
2410+
* // - It may require correct/in-range values for request initialization.
2411+
* // - It may require specifying regional endpoints when creating the service client as shown in
2412+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2413+
* try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
2414+
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
2415+
* Location response = dataTransferServiceClient.getLocation(request);
2416+
* }
2417+
* }</pre>
2418+
*
2419+
* @param request The request object containing all of the parameters for the API call.
2420+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
2421+
*/
2422+
public final Location getLocation(GetLocationRequest request) {
2423+
return getLocationCallable().call(request);
2424+
}
2425+
2426+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
2427+
/**
2428+
* Gets information about a location.
2429+
*
2430+
* <p>Sample code:
2431+
*
2432+
* <pre>{@code
2433+
* // This snippet has been automatically generated and should be regarded as a code template only.
2434+
* // It will require modifications to work:
2435+
* // - It may require correct/in-range values for request initialization.
2436+
* // - It may require specifying regional endpoints when creating the service client as shown in
2437+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2438+
* try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
2439+
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
2440+
* ApiFuture<Location> future =
2441+
* dataTransferServiceClient.getLocationCallable().futureCall(request);
2442+
* // Do something.
2443+
* Location response = future.get();
2444+
* }
2445+
* }</pre>
2446+
*/
2447+
public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
2448+
return stub.getLocationCallable();
2449+
}
2450+
22902451
@Override
22912452
public final void close() {
22922453
stub.close();
@@ -2634,4 +2795,80 @@ protected ListTransferLogsFixedSizeCollection createCollection(
26342795
return new ListTransferLogsFixedSizeCollection(pages, collectionSize);
26352796
}
26362797
}
2798+
2799+
public static class ListLocationsPagedResponse
2800+
extends AbstractPagedListResponse<
2801+
ListLocationsRequest,
2802+
ListLocationsResponse,
2803+
Location,
2804+
ListLocationsPage,
2805+
ListLocationsFixedSizeCollection> {
2806+
2807+
public static ApiFuture<ListLocationsPagedResponse> createAsync(
2808+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2809+
ApiFuture<ListLocationsResponse> futureResponse) {
2810+
ApiFuture<ListLocationsPage> futurePage =
2811+
ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
2812+
return ApiFutures.transform(
2813+
futurePage,
2814+
input -> new ListLocationsPagedResponse(input),
2815+
MoreExecutors.directExecutor());
2816+
}
2817+
2818+
private ListLocationsPagedResponse(ListLocationsPage page) {
2819+
super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
2820+
}
2821+
}
2822+
2823+
public static class ListLocationsPage
2824+
extends AbstractPage<
2825+
ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
2826+
2827+
private ListLocationsPage(
2828+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2829+
ListLocationsResponse response) {
2830+
super(context, response);
2831+
}
2832+
2833+
private static ListLocationsPage createEmptyPage() {
2834+
return new ListLocationsPage(null, null);
2835+
}
2836+
2837+
@Override
2838+
protected ListLocationsPage createPage(
2839+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2840+
ListLocationsResponse response) {
2841+
return new ListLocationsPage(context, response);
2842+
}
2843+
2844+
@Override
2845+
public ApiFuture<ListLocationsPage> createPageAsync(
2846+
PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2847+
ApiFuture<ListLocationsResponse> futureResponse) {
2848+
return super.createPageAsync(context, futureResponse);
2849+
}
2850+
}
2851+
2852+
public static class ListLocationsFixedSizeCollection
2853+
extends AbstractFixedSizeCollection<
2854+
ListLocationsRequest,
2855+
ListLocationsResponse,
2856+
Location,
2857+
ListLocationsPage,
2858+
ListLocationsFixedSizeCollection> {
2859+
2860+
private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
2861+
super(pages, collectionSize);
2862+
}
2863+
2864+
private static ListLocationsFixedSizeCollection createEmptyCollection() {
2865+
return new ListLocationsFixedSizeCollection(null, 0);
2866+
}
2867+
2868+
@Override
2869+
protected ListLocationsFixedSizeCollection createCollection(
2870+
List<ListLocationsPage> pages, int collectionSize) {
2871+
return new ListLocationsFixedSizeCollection(pages, collectionSize);
2872+
}
2873+
}
26372874
}

java-bigquerydatatransfer/google-cloud-bigquerydatatransfer/src/main/java/com/google/cloud/bigquery/datatransfer/v1/DataTransferServiceSettings.java

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

1919
import static com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListDataSourcesPagedResponse;
20+
import static com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListLocationsPagedResponse;
2021
import static com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferConfigsPagedResponse;
2122
import static com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferLogsPagedResponse;
2223
import static com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferRunsPagedResponse;
@@ -34,6 +35,10 @@
3435
import com.google.api.gax.rpc.TransportChannelProvider;
3536
import com.google.api.gax.rpc.UnaryCallSettings;
3637
import com.google.cloud.bigquery.datatransfer.v1.stub.DataTransferServiceStubSettings;
38+
import com.google.cloud.location.GetLocationRequest;
39+
import com.google.cloud.location.ListLocationsRequest;
40+
import com.google.cloud.location.ListLocationsResponse;
41+
import com.google.cloud.location.Location;
3742
import com.google.protobuf.Empty;
3843
import java.io.IOException;
3944
import java.util.List;
@@ -174,6 +179,17 @@ public UnaryCallSettings<EnrollDataSourcesRequest, Empty> enrollDataSourcesSetti
174179
return ((DataTransferServiceStubSettings) getStubSettings()).enrollDataSourcesSettings();
175180
}
176181

182+
/** Returns the object with the settings used for calls to listLocations. */
183+
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
184+
listLocationsSettings() {
185+
return ((DataTransferServiceStubSettings) getStubSettings()).listLocationsSettings();
186+
}
187+
188+
/** Returns the object with the settings used for calls to getLocation. */
189+
public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
190+
return ((DataTransferServiceStubSettings) getStubSettings()).getLocationSettings();
191+
}
192+
177193
public static final DataTransferServiceSettings create(DataTransferServiceStubSettings stub)
178194
throws IOException {
179195
return new DataTransferServiceSettings.Builder(stub.toBuilder()).build();
@@ -387,6 +403,18 @@ public UnaryCallSettings.Builder<EnrollDataSourcesRequest, Empty> enrollDataSour
387403
return getStubSettingsBuilder().enrollDataSourcesSettings();
388404
}
389405

406+
/** Returns the builder for the settings used for calls to listLocations. */
407+
public PagedCallSettings.Builder<
408+
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
409+
listLocationsSettings() {
410+
return getStubSettingsBuilder().listLocationsSettings();
411+
}
412+
413+
/** Returns the builder for the settings used for calls to getLocation. */
414+
public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
415+
return getStubSettingsBuilder().getLocationSettings();
416+
}
417+
390418
@Override
391419
public DataTransferServiceSettings build() throws IOException {
392420
return new DataTransferServiceSettings(this);

java-bigquerydatatransfer/google-cloud-bigquerydatatransfer/src/main/java/com/google/cloud/bigquery/datatransfer/v1/gapic_metadata.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"GetDataSource": {
2929
"methods": ["getDataSource", "getDataSource", "getDataSource", "getDataSourceCallable"]
3030
},
31+
"GetLocation": {
32+
"methods": ["getLocation", "getLocationCallable"]
33+
},
3134
"GetTransferConfig": {
3235
"methods": ["getTransferConfig", "getTransferConfig", "getTransferConfig", "getTransferConfigCallable"]
3336
},
@@ -37,6 +40,9 @@
3740
"ListDataSources": {
3841
"methods": ["listDataSources", "listDataSources", "listDataSources", "listDataSources", "listDataSourcesPagedCallable", "listDataSourcesCallable"]
3942
},
43+
"ListLocations": {
44+
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
45+
},
4046
"ListTransferConfigs": {
4147
"methods": ["listTransferConfigs", "listTransferConfigs", "listTransferConfigs", "listTransferConfigs", "listTransferConfigsPagedCallable", "listTransferConfigsCallable"]
4248
},

java-bigquerydatatransfer/google-cloud-bigquerydatatransfer/src/main/java/com/google/cloud/bigquery/datatransfer/v1/package-info.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616

1717
/**
18-
* The interfaces provided are listed below, along with usage samples.
18+
* A client to BigQuery Data Transfer API
19+
*
20+
* <p>The interfaces provided are listed below, along with usage samples.
1921
*
2022
* <p>======================= DataTransferServiceClient =======================
2123
*

0 commit comments

Comments
 (0)