@BetaApi @Generated(value="by gapic-generator-java") public class SampleQuerySetServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
SampleQuerySetName name =
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]");
SampleQuerySet response = sampleQuerySetServiceClient.getSampleQuerySet(name);
}
Note: close() needs to be called on the SampleQuerySetServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetSampleQuerySet |
Gets a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListSampleQuerySets |
Gets a list of [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateSampleQuerySet |
Creates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet] |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateSampleQuerySet |
Updates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteSampleQuerySet |
Deletes a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of SampleQuerySetServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SampleQuerySetServiceSettings sampleQuerySetServiceSettings =
SampleQuerySetServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create(sampleQuerySetServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SampleQuerySetServiceSettings sampleQuerySetServiceSettings =
SampleQuerySetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create(sampleQuerySetServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SampleQuerySetServiceSettings sampleQuerySetServiceSettings =
SampleQuerySetServiceSettings.newHttpJsonBuilder().build();
SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create(sampleQuerySetServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
SampleQuerySetServiceClient.ListSampleQuerySetsFixedSizeCollection |
static class |
SampleQuerySetServiceClient.ListSampleQuerySetsPage |
static class |
SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
SampleQuerySetServiceClient(SampleQuerySetServiceSettings settings)
Constructs an instance of SampleQuerySetServiceClient, using the given settings.
|
protected |
SampleQuerySetServiceClient(SampleQuerySetServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static SampleQuerySetServiceClient |
create()
Constructs an instance of SampleQuerySetServiceClient with default settings.
|
static SampleQuerySetServiceClient |
create(SampleQuerySetServiceSettings settings)
Constructs an instance of SampleQuerySetServiceClient, using the given settings.
|
static SampleQuerySetServiceClient |
create(SampleQuerySetServiceStub stub)
Constructs an instance of SampleQuerySetServiceClient, using the given stub for making calls.
|
SampleQuerySet |
createSampleQuerySet(CreateSampleQuerySetRequest request)
Creates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
CreateSampleQuerySetRequest request =
CreateSampleQuerySetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSampleQuerySet(SampleQuerySet.newBuilder().build())
.setSampleQuerySetId("sampleQuerySetId1320431231")
.build();
SampleQuerySet response = sampleQuerySetServiceClient.createSampleQuerySet(request);
}
|
SampleQuerySet |
createSampleQuerySet(LocationName parent,
SampleQuerySet sampleQuerySet,
String sampleQuerySetId)
Creates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
SampleQuerySet sampleQuerySet = SampleQuerySet.newBuilder().build();
String sampleQuerySetId = "sampleQuerySetId1320431231";
SampleQuerySet response =
sampleQuerySetServiceClient.createSampleQuerySet(
parent, sampleQuerySet, sampleQuerySetId);
}
|
SampleQuerySet |
createSampleQuerySet(String parent,
SampleQuerySet sampleQuerySet,
String sampleQuerySetId)
Creates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
SampleQuerySet sampleQuerySet = SampleQuerySet.newBuilder().build();
String sampleQuerySetId = "sampleQuerySetId1320431231";
SampleQuerySet response =
sampleQuerySetServiceClient.createSampleQuerySet(
parent, sampleQuerySet, sampleQuerySetId);
}
|
com.google.api.gax.rpc.UnaryCallable<CreateSampleQuerySetRequest,SampleQuerySet> |
createSampleQuerySetCallable()
Creates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]
Sample code:
{@code
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
CreateSampleQuerySetRequest request =
CreateSampleQuerySetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSampleQuerySet(SampleQuerySet.newBuilder().build())
.setSampleQuerySetId("sampleQuerySetId1320431231")
.build();
ApiFuture
|
void |
deleteSampleQuerySet(DeleteSampleQuerySetRequest request)
Deletes a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
void |
deleteSampleQuerySet(SampleQuerySetName name)
Deletes a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
void |
deleteSampleQuerySet(String name)
Deletes a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
com.google.api.gax.rpc.UnaryCallable<DeleteSampleQuerySetRequest,com.google.protobuf.Empty> |
deleteSampleQuerySetCallable()
Deletes a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
SampleQuerySet |
getSampleQuerySet(GetSampleQuerySetRequest request)
Gets a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
SampleQuerySet |
getSampleQuerySet(SampleQuerySetName name)
Gets a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
SampleQuerySet |
getSampleQuerySet(String name)
Gets a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
com.google.api.gax.rpc.UnaryCallable<GetSampleQuerySetRequest,SampleQuerySet> |
getSampleQuerySetCallable()
Gets a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
SampleQuerySetServiceSettings |
getSettings() |
SampleQuerySetServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse |
listSampleQuerySets(ListSampleQuerySetsRequest request)
Gets a list of [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s.
|
SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse |
listSampleQuerySets(LocationName parent)
Gets a list of [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s.
|
SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse |
listSampleQuerySets(String parent)
Gets a list of [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s.
|
com.google.api.gax.rpc.UnaryCallable<ListSampleQuerySetsRequest,ListSampleQuerySetsResponse> |
listSampleQuerySetsCallable()
Gets a list of [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s.
|
com.google.api.gax.rpc.UnaryCallable<ListSampleQuerySetsRequest,SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse> |
listSampleQuerySetsPagedCallable()
Gets a list of [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s.
|
void |
shutdown() |
void |
shutdownNow() |
SampleQuerySet |
updateSampleQuerySet(SampleQuerySet sampleQuerySet,
com.google.protobuf.FieldMask updateMask)
Updates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
SampleQuerySet |
updateSampleQuerySet(UpdateSampleQuerySetRequest request)
Updates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
com.google.api.gax.rpc.UnaryCallable<UpdateSampleQuerySetRequest,SampleQuerySet> |
updateSampleQuerySetCallable()
Updates a [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
|
protected SampleQuerySetServiceClient(SampleQuerySetServiceSettings settings) throws IOException
IOExceptionprotected SampleQuerySetServiceClient(SampleQuerySetServiceStub stub)
public static final SampleQuerySetServiceClient create() throws IOException
IOExceptionpublic static final SampleQuerySetServiceClient create(SampleQuerySetServiceSettings settings) throws IOException
IOExceptionpublic static final SampleQuerySetServiceClient create(SampleQuerySetServiceStub stub)
public final SampleQuerySetServiceSettings getSettings()
public SampleQuerySetServiceStub getStub()
public final SampleQuerySet getSampleQuerySet(SampleQuerySetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
SampleQuerySetName name =
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]");
SampleQuerySet response = sampleQuerySetServiceClient.getSampleQuerySet(name);
}
name - Required. Full resource name of
[SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], such as
`projects/{project}/locations/{location}/sampleQuerySets/{sample_query_set}`.
If the caller does not have permission to access the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the requested [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet] does not exist, a NOT_FOUND error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final SampleQuerySet getSampleQuerySet(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
String name =
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]").toString();
SampleQuerySet response = sampleQuerySetServiceClient.getSampleQuerySet(name);
}
name - Required. Full resource name of
[SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], such as
`projects/{project}/locations/{location}/sampleQuerySets/{sample_query_set}`.
If the caller does not have permission to access the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the requested [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet] does not exist, a NOT_FOUND error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final SampleQuerySet getSampleQuerySet(GetSampleQuerySetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
GetSampleQuerySetRequest request =
GetSampleQuerySetRequest.newBuilder()
.setName(
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]").toString())
.build();
SampleQuerySet response = sampleQuerySetServiceClient.getSampleQuerySet(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetSampleQuerySetRequest,SampleQuerySet> getSampleQuerySetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
GetSampleQuerySetRequest request =
GetSampleQuerySetRequest.newBuilder()
.setName(
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]").toString())
.build();
ApiFuture<SampleQuerySet> future =
sampleQuerySetServiceClient.getSampleQuerySetCallable().futureCall(request);
// Do something.
SampleQuerySet response = future.get();
}
public final SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse listSampleQuerySets(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (SampleQuerySet element :
sampleQuerySetServiceClient.listSampleQuerySets(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent location resource name, such as
`projects/{project}/locations/{location}`.
If the caller does not have permission to list [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s under this location, regardless of whether or not this location exists, a `PERMISSION_DENIED` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse listSampleQuerySets(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (SampleQuerySet element :
sampleQuerySetServiceClient.listSampleQuerySets(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent location resource name, such as
`projects/{project}/locations/{location}`.
If the caller does not have permission to list [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s under this location, regardless of whether or not this location exists, a `PERMISSION_DENIED` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse listSampleQuerySets(ListSampleQuerySetsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
ListSampleQuerySetsRequest request =
ListSampleQuerySetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (SampleQuerySet element :
sampleQuerySetServiceClient.listSampleQuerySets(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListSampleQuerySetsRequest,SampleQuerySetServiceClient.ListSampleQuerySetsPagedResponse> listSampleQuerySetsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
ListSampleQuerySetsRequest request =
ListSampleQuerySetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<SampleQuerySet> future =
sampleQuerySetServiceClient.listSampleQuerySetsPagedCallable().futureCall(request);
// Do something.
for (SampleQuerySet element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListSampleQuerySetsRequest,ListSampleQuerySetsResponse> listSampleQuerySetsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
ListSampleQuerySetsRequest request =
ListSampleQuerySetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListSampleQuerySetsResponse response =
sampleQuerySetServiceClient.listSampleQuerySetsCallable().call(request);
for (SampleQuerySet element : response.getSampleQuerySetsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final SampleQuerySet createSampleQuerySet(LocationName parent, SampleQuerySet sampleQuerySet, String sampleQuerySetId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
SampleQuerySet sampleQuerySet = SampleQuerySet.newBuilder().build();
String sampleQuerySetId = "sampleQuerySetId1320431231";
SampleQuerySet response =
sampleQuerySetServiceClient.createSampleQuerySet(
parent, sampleQuerySet, sampleQuerySetId);
}
parent - Required. The parent resource name, such as
`projects/{project}/locations/{location}`.sampleQuerySet - Required. The
[SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet] to create.sampleQuerySetId - Required. The ID to use for the
[SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], which will become
the final component of the
[SampleQuerySet.name][google.cloud.discoveryengine.v1alpha.SampleQuerySet.name].
If the caller does not have permission to create the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
This field must be unique among all [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s with the same [parent][google.cloud.discoveryengine.v1alpha.CreateSampleQuerySetRequest.parent]. Otherwise, an `ALREADY_EXISTS` error is returned.
This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final SampleQuerySet createSampleQuerySet(String parent, SampleQuerySet sampleQuerySet, String sampleQuerySetId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
SampleQuerySet sampleQuerySet = SampleQuerySet.newBuilder().build();
String sampleQuerySetId = "sampleQuerySetId1320431231";
SampleQuerySet response =
sampleQuerySetServiceClient.createSampleQuerySet(
parent, sampleQuerySet, sampleQuerySetId);
}
parent - Required. The parent resource name, such as
`projects/{project}/locations/{location}`.sampleQuerySet - Required. The
[SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet] to create.sampleQuerySetId - Required. The ID to use for the
[SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], which will become
the final component of the
[SampleQuerySet.name][google.cloud.discoveryengine.v1alpha.SampleQuerySet.name].
If the caller does not have permission to create the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
This field must be unique among all [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]s with the same [parent][google.cloud.discoveryengine.v1alpha.CreateSampleQuerySetRequest.parent]. Otherwise, an `ALREADY_EXISTS` error is returned.
This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final SampleQuerySet createSampleQuerySet(CreateSampleQuerySetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
CreateSampleQuerySetRequest request =
CreateSampleQuerySetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSampleQuerySet(SampleQuerySet.newBuilder().build())
.setSampleQuerySetId("sampleQuerySetId1320431231")
.build();
SampleQuerySet response = sampleQuerySetServiceClient.createSampleQuerySet(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateSampleQuerySetRequest,SampleQuerySet> createSampleQuerySetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
CreateSampleQuerySetRequest request =
CreateSampleQuerySetRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSampleQuerySet(SampleQuerySet.newBuilder().build())
.setSampleQuerySetId("sampleQuerySetId1320431231")
.build();
ApiFuture<SampleQuerySet> future =
sampleQuerySetServiceClient.createSampleQuerySetCallable().futureCall(request);
// Do something.
SampleQuerySet response = future.get();
}
public final SampleQuerySet updateSampleQuerySet(SampleQuerySet sampleQuerySet, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
SampleQuerySet sampleQuerySet = SampleQuerySet.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
SampleQuerySet response =
sampleQuerySetServiceClient.updateSampleQuerySet(sampleQuerySet, updateMask);
}
sampleQuerySet - Required. The sample query set to update.
If the caller does not have permission to update the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
If the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet] to update does not exist a `NOT_FOUND` error is returned.
updateMask - Indicates which fields in the provided imported 'sample query set' to update.
If not set, will by default update all fields.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SampleQuerySet updateSampleQuerySet(UpdateSampleQuerySetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
UpdateSampleQuerySetRequest request =
UpdateSampleQuerySetRequest.newBuilder()
.setSampleQuerySet(SampleQuerySet.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
SampleQuerySet response = sampleQuerySetServiceClient.updateSampleQuerySet(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateSampleQuerySetRequest,SampleQuerySet> updateSampleQuerySetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
UpdateSampleQuerySetRequest request =
UpdateSampleQuerySetRequest.newBuilder()
.setSampleQuerySet(SampleQuerySet.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<SampleQuerySet> future =
sampleQuerySetServiceClient.updateSampleQuerySetCallable().futureCall(request);
// Do something.
SampleQuerySet response = future.get();
}
public final void deleteSampleQuerySet(SampleQuerySetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
SampleQuerySetName name =
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]");
sampleQuerySetServiceClient.deleteSampleQuerySet(name);
}
name - Required. Full resource name of
[SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], such as
`projects/{project}/locations/{location}/sampleQuerySets/{sample_query_set}`.
If the caller does not have permission to delete the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
If the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet] to delete does not exist, a `NOT_FOUND` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSampleQuerySet(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
String name =
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]").toString();
sampleQuerySetServiceClient.deleteSampleQuerySet(name);
}
name - Required. Full resource name of
[SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], such as
`projects/{project}/locations/{location}/sampleQuerySets/{sample_query_set}`.
If the caller does not have permission to delete the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
If the [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet] to delete does not exist, a `NOT_FOUND` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSampleQuerySet(DeleteSampleQuerySetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
DeleteSampleQuerySetRequest request =
DeleteSampleQuerySetRequest.newBuilder()
.setName(
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]").toString())
.build();
sampleQuerySetServiceClient.deleteSampleQuerySet(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteSampleQuerySetRequest,com.google.protobuf.Empty> deleteSampleQuerySetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SampleQuerySetServiceClient sampleQuerySetServiceClient =
SampleQuerySetServiceClient.create()) {
DeleteSampleQuerySetRequest request =
DeleteSampleQuerySetRequest.newBuilder()
.setName(
SampleQuerySetName.of("[PROJECT]", "[LOCATION]", "[SAMPLE_QUERY_SET]").toString())
.build();
ApiFuture<Empty> future =
sampleQuerySetServiceClient.deleteSampleQuerySetCallable().futureCall(request);
// Do something.
future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.