Skip to content

Commit

Permalink
feat!: [analyticshub] update BigQuery Analytics Hub API v1beta1 client (
Browse files Browse the repository at this point in the history
#8263)

- [ ] Regenerate this pull request now.

BREAKING CHANGE: refresh current dataexchange/v1beta1/* directory to include recent change in protos. Removed common directory and use local enum Category
fix!: refactor references to Category message
docs: improve proto documentation.

PiperOrigin-RevId: 471349319

Source-Link: googleapis/googleapis@8495024

Source-Link: https://github.com/googleapis/googleapis-gen/commit/2d8c38b90a5a198d71eb1a8eb43e0ce56127ac0d
Copy-Tag: eyJwIjoiamF2YS1iaWdxdWVyeS1kYXRhLWV4Y2hhbmdlLy5Pd2xCb3QueWFtbCIsImgiOiIyZDhjMzhiOTBhNWExOThkNzFlYjFhOGViNDNlMGNlNTYxMjdhYzBkIn0=
  • Loading branch information
gcf-owl-bot[bot] authored Sep 2, 2022
1 parent 013c75d commit 3301e6d
Show file tree
Hide file tree
Showing 51 changed files with 2,865 additions and 1,687 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListDataExchangesPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListListingsPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListOrgDataExchangesPagedResponse;

import com.google.api.core.ApiFunction;
Expand All @@ -33,6 +34,10 @@
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.bigquery.dataexchange.v1beta1.stub.AnalyticsHubServiceStubSettings;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
Expand Down Expand Up @@ -166,6 +171,17 @@ public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() {
return ((AnalyticsHubServiceStubSettings) getStubSettings()).testIamPermissionsSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
return ((AnalyticsHubServiceStubSettings) getStubSettings()).listLocationsSettings();
}

/** Returns the object with the settings used for calls to getLocation. */
public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
return ((AnalyticsHubServiceStubSettings) getStubSettings()).getLocationSettings();
}

public static final AnalyticsHubServiceSettings create(AnalyticsHubServiceStubSettings stub)
throws IOException {
return new AnalyticsHubServiceSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -370,6 +386,18 @@ public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettin
return getStubSettingsBuilder().testIamPermissionsSettings();
}

/** 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 getLocation. */
public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
return getStubSettingsBuilder().getLocationSettings();
}

@Override
public AnalyticsHubServiceSettings build() throws IOException {
return new AnalyticsHubServiceSettings(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@
"GetListing": {
"methods": ["getListing", "getListing", "getListing", "getListingCallable"]
},
"GetLocation": {
"methods": ["getLocation", "getLocationCallable"]
},
"ListDataExchanges": {
"methods": ["listDataExchanges", "listDataExchanges", "listDataExchanges", "listDataExchangesPagedCallable", "listDataExchangesCallable"]
},
"ListListings": {
"methods": ["listListings", "listListings", "listListings", "listListingsPagedCallable", "listListingsCallable"]
},
"ListLocations": {
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
},
"ListOrgDataExchanges": {
"methods": ["listOrgDataExchanges", "listOrgDataExchanges", "listOrgDataExchangesPagedCallable", "listOrgDataExchangesCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
*
* <p>======================= AnalyticsHubServiceClient =======================
*
* <p>Service Description: The AnalyticsHubService API facilitates data sharing within and across
* organizations. It allows data providers to publish Listings --- a discoverable and searchable SKU
* representing a dataset. Data consumers can subscribe to Listings. Upon subscription, AnalyticsHub
* provisions a "Linked Datasets" surfacing the data in the consumer's project.
* <p>Service Description: The `AnalyticsHubService` API facilitates data sharing within and across
* organizations. It allows data providers to publish listings that reference shared datasets. With
* Analytics Hub, users can discover and search for listings that they have access to. Subscribers
* can view and subscribe to listings. When you subscribe to a listing, Analytics Hub creates a
* linked dataset in your project.
*
* <p>Sample for AnalyticsHubServiceClient:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListDataExchangesPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListListingsPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListOrgDataExchangesPagedResponse;

import com.google.api.core.BetaApi;
Expand All @@ -41,6 +42,10 @@
import com.google.cloud.bigquery.dataexchange.v1beta1.SubscribeListingResponse;
import com.google.cloud.bigquery.dataexchange.v1beta1.UpdateDataExchangeRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.UpdateListingRequest;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
Expand Down Expand Up @@ -137,6 +142,19 @@ public UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsCallable()");
}

public UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
throw new UnsupportedOperationException("Not implemented: getLocationCallable()");
}

@Override
public abstract void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListDataExchangesPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListListingsPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListOrgDataExchangesPagedResponse;

import com.google.api.core.ApiFunction;
Expand Down Expand Up @@ -63,6 +64,10 @@
import com.google.cloud.bigquery.dataexchange.v1beta1.SubscribeListingResponse;
import com.google.cloud.bigquery.dataexchange.v1beta1.UpdateDataExchangeRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.UpdateListingRequest;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -150,6 +155,10 @@ public class AnalyticsHubServiceStubSettings extends StubSettings<AnalyticsHubSe
private final UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings;
private final UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse>
testIamPermissionsSettings;
private final PagedCallSettings<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
private final UnaryCallSettings<GetLocationRequest, Location> getLocationSettings;

private static final PagedListDescriptor<
ListDataExchangesRequest, ListDataExchangesResponse, DataExchange>
Expand Down Expand Up @@ -267,6 +276,42 @@ public Iterable<Listing> extractResources(ListListingsResponse payload) {
}
};

private static final PagedListDescriptor<ListLocationsRequest, ListLocationsResponse, Location>
LIST_LOCATIONS_PAGE_STR_DESC =
new PagedListDescriptor<ListLocationsRequest, ListLocationsResponse, Location>() {
@Override
public String emptyToken() {
return "";
}

@Override
public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) {
return ListLocationsRequest.newBuilder(payload).setPageToken(token).build();
}

@Override
public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) {
return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build();
}

@Override
public Integer extractPageSize(ListLocationsRequest payload) {
return payload.getPageSize();
}

@Override
public String extractNextToken(ListLocationsResponse payload) {
return payload.getNextPageToken();
}

@Override
public Iterable<Location> extractResources(ListLocationsResponse payload) {
return payload.getLocationsList() == null
? ImmutableList.<Location>of()
: payload.getLocationsList();
}
};

private static final PagedListResponseFactory<
ListDataExchangesRequest, ListDataExchangesResponse, ListDataExchangesPagedResponse>
LIST_DATA_EXCHANGES_PAGE_STR_FACT =
Expand Down Expand Up @@ -328,6 +373,23 @@ public ApiFuture<ListListingsPagedResponse> getFuturePagedResponse(
}
};

private static final PagedListResponseFactory<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
LIST_LOCATIONS_PAGE_STR_FACT =
new PagedListResponseFactory<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() {
@Override
public ApiFuture<ListLocationsPagedResponse> getFuturePagedResponse(
UnaryCallable<ListLocationsRequest, ListLocationsResponse> callable,
ListLocationsRequest request,
ApiCallContext context,
ApiFuture<ListLocationsResponse> futureResponse) {
PageContext<ListLocationsRequest, ListLocationsResponse, Location> pageContext =
PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context);
return ListLocationsPagedResponse.createAsync(pageContext, futureResponse);
}
};

/** Returns the object with the settings used for calls to listDataExchanges. */
public PagedCallSettings<
ListDataExchangesRequest, ListDataExchangesResponse, ListDataExchangesPagedResponse>
Expand Down Expand Up @@ -412,6 +474,17 @@ public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() {
return testIamPermissionsSettings;
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
return listLocationsSettings;
}

/** Returns the object with the settings used for calls to getLocation. */
public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
return getLocationSettings;
}

public AnalyticsHubServiceStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
Expand Down Expand Up @@ -533,6 +606,8 @@ protected AnalyticsHubServiceStubSettings(Builder settingsBuilder) throws IOExce
getIamPolicySettings = settingsBuilder.getIamPolicySettings().build();
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build();
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
getLocationSettings = settingsBuilder.getLocationSettings().build();
}

/** Builder for AnalyticsHubServiceStubSettings. */
Expand Down Expand Up @@ -568,6 +643,10 @@ public static class Builder
private final UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings;
private final UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse>
testIamPermissionsSettings;
private final PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
private final UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings;
private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;

Expand Down Expand Up @@ -624,6 +703,8 @@ protected Builder(ClientContext clientContext) {
getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
Expand All @@ -641,7 +722,9 @@ protected Builder(ClientContext clientContext) {
subscribeListingSettings,
getIamPolicySettings,
setIamPolicySettings,
testIamPermissionsSettings);
testIamPermissionsSettings,
listLocationsSettings,
getLocationSettings);
initDefaults(this);
}

Expand All @@ -663,6 +746,8 @@ protected Builder(AnalyticsHubServiceStubSettings settings) {
getIamPolicySettings = settings.getIamPolicySettings.toBuilder();
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder();
listLocationsSettings = settings.listLocationsSettings.toBuilder();
getLocationSettings = settings.getLocationSettings.toBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
Expand All @@ -680,7 +765,9 @@ protected Builder(AnalyticsHubServiceStubSettings settings) {
subscribeListingSettings,
getIamPolicySettings,
setIamPolicySettings,
testIamPermissionsSettings);
testIamPermissionsSettings,
listLocationsSettings,
getLocationSettings);
}

private static Builder createDefault() {
Expand Down Expand Up @@ -785,6 +872,16 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.listLocationsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.getLocationSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

return builder;
}

Expand Down Expand Up @@ -892,6 +989,18 @@ public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettin
return testIamPermissionsSettings;
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
return listLocationsSettings;
}

/** Returns the builder for the settings used for calls to getLocation. */
public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
return getLocationSettings;
}

@Override
public AnalyticsHubServiceStubSettings build() throws IOException {
return new AnalyticsHubServiceStubSettings(this);
Expand Down
Loading

0 comments on commit 3301e6d

Please sign in to comment.