Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

feat: add ListSavedQueries rpc to aiplatform v1 dataset_service.proto #975

Merged
merged 5 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,167 @@ public final UnaryCallable<ListDataItemsRequest, ListDataItemsResponse> listData
return stub.listDataItemsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists SavedQueries in a Dataset.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) {
* DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
* for (SavedQuery element : datasetServiceClient.listSavedQueries(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. The resource name of the Dataset to list SavedQueries from. Format:
* `projects/{project}/locations/{location}/datasets/{dataset}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListSavedQueriesPagedResponse listSavedQueries(DatasetName parent) {
ListSavedQueriesRequest request =
ListSavedQueriesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listSavedQueries(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists SavedQueries in a Dataset.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) {
* String parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
* for (SavedQuery element : datasetServiceClient.listSavedQueries(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. The resource name of the Dataset to list SavedQueries from. Format:
* `projects/{project}/locations/{location}/datasets/{dataset}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListSavedQueriesPagedResponse listSavedQueries(String parent) {
ListSavedQueriesRequest request =
ListSavedQueriesRequest.newBuilder().setParent(parent).build();
return listSavedQueries(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists SavedQueries in a Dataset.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) {
* ListSavedQueriesRequest request =
* ListSavedQueriesRequest.newBuilder()
* .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setReadMask(FieldMask.newBuilder().build())
* .setOrderBy("orderBy-1207110587")
* .build();
* for (SavedQuery element : datasetServiceClient.listSavedQueries(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @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
*/
public final ListSavedQueriesPagedResponse listSavedQueries(ListSavedQueriesRequest request) {
return listSavedQueriesPagedCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists SavedQueries in a Dataset.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) {
* ListSavedQueriesRequest request =
* ListSavedQueriesRequest.newBuilder()
* .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setReadMask(FieldMask.newBuilder().build())
* .setOrderBy("orderBy-1207110587")
* .build();
* ApiFuture<SavedQuery> future =
* datasetServiceClient.listSavedQueriesPagedCallable().futureCall(request);
* // Do something.
* for (SavedQuery element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListSavedQueriesRequest, ListSavedQueriesPagedResponse>
listSavedQueriesPagedCallable() {
return stub.listSavedQueriesPagedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists SavedQueries in a Dataset.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create()) {
* ListSavedQueriesRequest request =
* ListSavedQueriesRequest.newBuilder()
* .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setReadMask(FieldMask.newBuilder().build())
* .setOrderBy("orderBy-1207110587")
* .build();
* while (true) {
* ListSavedQueriesResponse response =
* datasetServiceClient.listSavedQueriesCallable().call(request);
* for (SavedQuery element : response.getSavedQueriesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListSavedQueriesRequest, ListSavedQueriesResponse>
listSavedQueriesCallable() {
return stub.listSavedQueriesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets an AnnotationSpec.
Expand Down Expand Up @@ -1992,6 +2153,83 @@ protected ListDataItemsFixedSizeCollection createCollection(
}
}

public static class ListSavedQueriesPagedResponse
extends AbstractPagedListResponse<
ListSavedQueriesRequest,
ListSavedQueriesResponse,
SavedQuery,
ListSavedQueriesPage,
ListSavedQueriesFixedSizeCollection> {

public static ApiFuture<ListSavedQueriesPagedResponse> createAsync(
PageContext<ListSavedQueriesRequest, ListSavedQueriesResponse, SavedQuery> context,
ApiFuture<ListSavedQueriesResponse> futureResponse) {
ApiFuture<ListSavedQueriesPage> futurePage =
ListSavedQueriesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListSavedQueriesPagedResponse(input),
MoreExecutors.directExecutor());
}

private ListSavedQueriesPagedResponse(ListSavedQueriesPage page) {
super(page, ListSavedQueriesFixedSizeCollection.createEmptyCollection());
}
}

public static class ListSavedQueriesPage
extends AbstractPage<
ListSavedQueriesRequest, ListSavedQueriesResponse, SavedQuery, ListSavedQueriesPage> {

private ListSavedQueriesPage(
PageContext<ListSavedQueriesRequest, ListSavedQueriesResponse, SavedQuery> context,
ListSavedQueriesResponse response) {
super(context, response);
}

private static ListSavedQueriesPage createEmptyPage() {
return new ListSavedQueriesPage(null, null);
}

@Override
protected ListSavedQueriesPage createPage(
PageContext<ListSavedQueriesRequest, ListSavedQueriesResponse, SavedQuery> context,
ListSavedQueriesResponse response) {
return new ListSavedQueriesPage(context, response);
}

@Override
public ApiFuture<ListSavedQueriesPage> createPageAsync(
PageContext<ListSavedQueriesRequest, ListSavedQueriesResponse, SavedQuery> context,
ApiFuture<ListSavedQueriesResponse> futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}

public static class ListSavedQueriesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListSavedQueriesRequest,
ListSavedQueriesResponse,
SavedQuery,
ListSavedQueriesPage,
ListSavedQueriesFixedSizeCollection> {

private ListSavedQueriesFixedSizeCollection(
List<ListSavedQueriesPage> pages, int collectionSize) {
super(pages, collectionSize);
}

private static ListSavedQueriesFixedSizeCollection createEmptyCollection() {
return new ListSavedQueriesFixedSizeCollection(null, 0);
}

@Override
protected ListSavedQueriesFixedSizeCollection createCollection(
List<ListSavedQueriesPage> pages, int collectionSize) {
return new ListSavedQueriesFixedSizeCollection(pages, collectionSize);
}
}

public static class ListAnnotationsPagedResponse
extends AbstractPagedListResponse<
ListAnnotationsRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListDataItemsPagedResponse;
import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListDatasetsPagedResponse;
import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListSavedQueriesPagedResponse;

import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
Expand Down Expand Up @@ -152,6 +153,13 @@ public UnaryCallSettings<ExportDataRequest, Operation> exportDataSettings() {
return ((DatasetServiceStubSettings) getStubSettings()).listDataItemsSettings();
}

/** Returns the object with the settings used for calls to listSavedQueries. */
public PagedCallSettings<
ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse>
listSavedQueriesSettings() {
return ((DatasetServiceStubSettings) getStubSettings()).listSavedQueriesSettings();
}

/** Returns the object with the settings used for calls to getAnnotationSpec. */
public UnaryCallSettings<GetAnnotationSpecRequest, AnnotationSpec> getAnnotationSpecSettings() {
return ((DatasetServiceStubSettings) getStubSettings()).getAnnotationSpecSettings();
Expand Down Expand Up @@ -359,6 +367,13 @@ public UnaryCallSettings.Builder<ExportDataRequest, Operation> exportDataSetting
return getStubSettingsBuilder().listDataItemsSettings();
}

/** Returns the builder for the settings used for calls to listSavedQueries. */
public PagedCallSettings.Builder<
ListSavedQueriesRequest, ListSavedQueriesResponse, ListSavedQueriesPagedResponse>
listSavedQueriesSettings() {
return getStubSettingsBuilder().listSavedQueriesSettings();
}

/** Returns the builder for the settings used for calls to getAnnotationSpec. */
public UnaryCallSettings.Builder<GetAnnotationSpecRequest, AnnotationSpec>
getAnnotationSpecSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"ListLocations": {
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
},
"ListSavedQueries": {
"methods": ["listSavedQueries", "listSavedQueries", "listSavedQueries", "listSavedQueriesPagedCallable", "listSavedQueriesCallable"]
},
"SetIamPolicy": {
"methods": ["setIamPolicy", "setIamPolicyCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListDataItemsPagedResponse;
import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListDatasetsPagedResponse;
import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.aiplatform.v1.DatasetServiceClient.ListSavedQueriesPagedResponse;

import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
Expand All @@ -44,6 +45,8 @@
import com.google.cloud.aiplatform.v1.ListDataItemsResponse;
import com.google.cloud.aiplatform.v1.ListDatasetsRequest;
import com.google.cloud.aiplatform.v1.ListDatasetsResponse;
import com.google.cloud.aiplatform.v1.ListSavedQueriesRequest;
import com.google.cloud.aiplatform.v1.ListSavedQueriesResponse;
import com.google.cloud.aiplatform.v1.UpdateDatasetRequest;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
Expand Down Expand Up @@ -133,6 +136,16 @@ public UnaryCallable<ListDataItemsRequest, ListDataItemsResponse> listDataItemsC
throw new UnsupportedOperationException("Not implemented: listDataItemsCallable()");
}

public UnaryCallable<ListSavedQueriesRequest, ListSavedQueriesPagedResponse>
listSavedQueriesPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listSavedQueriesPagedCallable()");
}

public UnaryCallable<ListSavedQueriesRequest, ListSavedQueriesResponse>
listSavedQueriesCallable() {
throw new UnsupportedOperationException("Not implemented: listSavedQueriesCallable()");
}

public UnaryCallable<GetAnnotationSpecRequest, AnnotationSpec> getAnnotationSpecCallable() {
throw new UnsupportedOperationException("Not implemented: getAnnotationSpecCallable()");
}
Expand Down
Loading