@BetaApi @Generated(value="by gapic-generator-java") public class GeneratorsClient 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
GeneratorName name = GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]");
Generator response = generatorsClient.getGenerator(name);
}
Note: close() needs to be called on the GeneratorsClient 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 |
|---|---|---|
ListGenerators |
Returns the list of all generators in the specified agent. |
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.
|
GetGenerator |
Retrieves the specified generator. |
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.
|
CreateGenerator |
Creates a generator in the specified agent. |
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.
|
UpdateGenerator |
Update the specified generator. |
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.
|
DeleteGenerator |
Deletes the specified generators. |
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.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
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 GeneratorsSettings 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
GeneratorsSettings generatorsSettings =
GeneratorsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
GeneratorsClient generatorsClient = GeneratorsClient.create(generatorsSettings);
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
GeneratorsSettings generatorsSettings =
GeneratorsSettings.newBuilder().setEndpoint(myEndpoint).build();
GeneratorsClient generatorsClient = GeneratorsClient.create(generatorsSettings);
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
GeneratorsSettings generatorsSettings = GeneratorsSettings.newHttpJsonBuilder().build();
GeneratorsClient generatorsClient = GeneratorsClient.create(generatorsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
GeneratorsClient.ListGeneratorsFixedSizeCollection |
static class |
GeneratorsClient.ListGeneratorsPage |
static class |
GeneratorsClient.ListGeneratorsPagedResponse |
static class |
GeneratorsClient.ListLocationsFixedSizeCollection |
static class |
GeneratorsClient.ListLocationsPage |
static class |
GeneratorsClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
GeneratorsClient(GeneratorsSettings settings)
Constructs an instance of GeneratorsClient, using the given settings.
|
protected |
GeneratorsClient(GeneratorsStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static GeneratorsClient |
create()
Constructs an instance of GeneratorsClient with default settings.
|
static GeneratorsClient |
create(GeneratorsSettings settings)
Constructs an instance of GeneratorsClient, using the given settings.
|
static GeneratorsClient |
create(GeneratorsStub stub)
Constructs an instance of GeneratorsClient, using the given stub for making calls.
|
Generator |
createGenerator(AgentName parent,
Generator generator)
Creates a generator in the specified agent.
|
Generator |
createGenerator(CreateGeneratorRequest request)
Creates a generator in the specified agent.
|
Generator |
createGenerator(String parent,
Generator generator)
Creates a generator in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<CreateGeneratorRequest,Generator> |
createGeneratorCallable()
Creates a generator in the specified agent.
|
void |
deleteGenerator(DeleteGeneratorRequest request)
Deletes the specified generators.
|
void |
deleteGenerator(GeneratorName name)
Deletes the specified generators.
|
void |
deleteGenerator(String name)
Deletes the specified generators.
|
com.google.api.gax.rpc.UnaryCallable<DeleteGeneratorRequest,com.google.protobuf.Empty> |
deleteGeneratorCallable()
Deletes the specified generators.
|
Generator |
getGenerator(GeneratorName name)
Retrieves the specified generator.
|
Generator |
getGenerator(GetGeneratorRequest request)
Retrieves the specified generator.
|
Generator |
getGenerator(String name)
Retrieves the specified generator.
|
com.google.api.gax.rpc.UnaryCallable<GetGeneratorRequest,Generator> |
getGeneratorCallable()
Retrieves the specified generator.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
GeneratorsSettings |
getSettings() |
GeneratorsStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
GeneratorsClient.ListGeneratorsPagedResponse |
listGenerators(AgentName parent)
Returns the list of all generators in the specified agent.
|
GeneratorsClient.ListGeneratorsPagedResponse |
listGenerators(ListGeneratorsRequest request)
Returns the list of all generators in the specified agent.
|
GeneratorsClient.ListGeneratorsPagedResponse |
listGenerators(String parent)
Returns the list of all generators in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<ListGeneratorsRequest,ListGeneratorsResponse> |
listGeneratorsCallable()
Returns the list of all generators in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<ListGeneratorsRequest,GeneratorsClient.ListGeneratorsPagedResponse> |
listGeneratorsPagedCallable()
Returns the list of all generators in the specified agent.
|
GeneratorsClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,GeneratorsClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
void |
shutdown() |
void |
shutdownNow() |
Generator |
updateGenerator(Generator generator,
com.google.protobuf.FieldMask updateMask)
Update the specified generator.
|
Generator |
updateGenerator(UpdateGeneratorRequest request)
Update the specified generator.
|
com.google.api.gax.rpc.UnaryCallable<UpdateGeneratorRequest,Generator> |
updateGeneratorCallable()
Update the specified generator.
|
protected GeneratorsClient(GeneratorsSettings settings) throws IOException
IOExceptionprotected GeneratorsClient(GeneratorsStub stub)
public static final GeneratorsClient create() throws IOException
IOExceptionpublic static final GeneratorsClient create(GeneratorsSettings settings) throws IOException
IOExceptionpublic static final GeneratorsClient create(GeneratorsStub stub)
public final GeneratorsSettings getSettings()
public GeneratorsStub getStub()
public final GeneratorsClient.ListGeneratorsPagedResponse listGenerators(AgentName 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
for (Generator element : generatorsClient.listGenerators(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The agent to list all generators for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final GeneratorsClient.ListGeneratorsPagedResponse listGenerators(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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
for (Generator element : generatorsClient.listGenerators(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The agent to list all generators for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final GeneratorsClient.ListGeneratorsPagedResponse listGenerators(ListGeneratorsRequest 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
ListGeneratorsRequest request =
ListGeneratorsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Generator element : generatorsClient.listGenerators(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<ListGeneratorsRequest,GeneratorsClient.ListGeneratorsPagedResponse> listGeneratorsPagedCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
ListGeneratorsRequest request =
ListGeneratorsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Generator> future =
generatorsClient.listGeneratorsPagedCallable().futureCall(request);
// Do something.
for (Generator element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListGeneratorsRequest,ListGeneratorsResponse> listGeneratorsCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
ListGeneratorsRequest request =
ListGeneratorsRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListGeneratorsResponse response = generatorsClient.listGeneratorsCallable().call(request);
for (Generator element : response.getGeneratorsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Generator getGenerator(GeneratorName 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
GeneratorName name = GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]");
Generator response = generatorsClient.getGenerator(name);
}
name - Required. The name of the generator. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/generators/<GeneratorID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Generator getGenerator(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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
String name =
GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString();
Generator response = generatorsClient.getGenerator(name);
}
name - Required. The name of the generator. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/generators/<GeneratorID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Generator getGenerator(GetGeneratorRequest 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
GetGeneratorRequest request =
GetGeneratorRequest.newBuilder()
.setName(
GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
Generator response = generatorsClient.getGenerator(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<GetGeneratorRequest,Generator> getGeneratorCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
GetGeneratorRequest request =
GetGeneratorRequest.newBuilder()
.setName(
GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Generator> future = generatorsClient.getGeneratorCallable().futureCall(request);
// Do something.
Generator response = future.get();
}
public final Generator createGenerator(AgentName parent, Generator generator)
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
Generator generator = Generator.newBuilder().build();
Generator response = generatorsClient.createGenerator(parent, generator);
}
parent - Required. The agent to create a generator for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.generator - Required. The generator to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Generator createGenerator(String parent, Generator generator)
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
Generator generator = Generator.newBuilder().build();
Generator response = generatorsClient.createGenerator(parent, generator);
}
parent - Required. The agent to create a generator for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.generator - Required. The generator to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Generator createGenerator(CreateGeneratorRequest 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
CreateGeneratorRequest request =
CreateGeneratorRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setGenerator(Generator.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
Generator response = generatorsClient.createGenerator(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<CreateGeneratorRequest,Generator> createGeneratorCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
CreateGeneratorRequest request =
CreateGeneratorRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setGenerator(Generator.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Generator> future = generatorsClient.createGeneratorCallable().futureCall(request);
// Do something.
Generator response = future.get();
}
public final Generator updateGenerator(Generator generator, 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
Generator generator = Generator.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Generator response = generatorsClient.updateGenerator(generator, updateMask);
}
generator - Required. The generator to update.updateMask - The mask to control which fields get updated. If the mask is not present, all
fields will be updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Generator updateGenerator(UpdateGeneratorRequest 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
UpdateGeneratorRequest request =
UpdateGeneratorRequest.newBuilder()
.setGenerator(Generator.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Generator response = generatorsClient.updateGenerator(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<UpdateGeneratorRequest,Generator> updateGeneratorCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
UpdateGeneratorRequest request =
UpdateGeneratorRequest.newBuilder()
.setGenerator(Generator.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Generator> future = generatorsClient.updateGeneratorCallable().futureCall(request);
// Do something.
Generator response = future.get();
}
public final void deleteGenerator(GeneratorName 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
GeneratorName name = GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]");
generatorsClient.deleteGenerator(name);
}
name - Required. The name of the generator to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/generators/<GeneratorID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteGenerator(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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
String name =
GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString();
generatorsClient.deleteGenerator(name);
}
name - Required. The name of the generator to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/generators/<GeneratorID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteGenerator(DeleteGeneratorRequest 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
DeleteGeneratorRequest request =
DeleteGeneratorRequest.newBuilder()
.setName(
GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString())
.setForce(true)
.build();
generatorsClient.deleteGenerator(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<DeleteGeneratorRequest,com.google.protobuf.Empty> deleteGeneratorCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
DeleteGeneratorRequest request =
DeleteGeneratorRequest.newBuilder()
.setName(
GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString())
.setForce(true)
.build();
ApiFuture<Empty> future = generatorsClient.deleteGeneratorCallable().futureCall(request);
// Do something.
future.get();
}
public final GeneratorsClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : generatorsClient.listLocations(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<com.google.cloud.location.ListLocationsRequest,GeneratorsClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
generatorsClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = generatorsClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = generatorsClient.getLocation(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<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = generatorsClient.getLocationCallable().futureCall(request);
// Do something.
Location response = 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 © 2025 Google LLC. All rights reserved.