@BetaApi @Generated(value="by gapic-generator-java") public class PagesClient 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 (PagesClient pagesClient = PagesClient.create()) {
PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
Page response = pagesClient.getPage(name);
}
Note: close() needs to be called on the PagesClient 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 |
|---|---|---|
ListPages |
Returns the list of all pages in the specified flow. |
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.
|
GetPage |
Retrieves the specified page. |
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.
|
CreatePage |
Creates a page in the specified flow. |
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.
|
UpdatePage |
Updates the specified page. |
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.
|
DeletePage |
Deletes the specified page. |
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 PagesSettings 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
PagesSettings pagesSettings =
PagesSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
PagesClient pagesClient = PagesClient.create(pagesSettings);
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
PagesSettings pagesSettings = PagesSettings.newBuilder().setEndpoint(myEndpoint).build();
PagesClient pagesClient = PagesClient.create(pagesSettings);
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
PagesSettings pagesSettings = PagesSettings.newHttpJsonBuilder().build();
PagesClient pagesClient = PagesClient.create(pagesSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
PagesClient.ListLocationsFixedSizeCollection |
static class |
PagesClient.ListLocationsPage |
static class |
PagesClient.ListLocationsPagedResponse |
static class |
PagesClient.ListPagesFixedSizeCollection |
static class |
PagesClient.ListPagesPage |
static class |
PagesClient.ListPagesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
PagesClient(PagesSettings settings)
Constructs an instance of PagesClient, using the given settings.
|
protected |
PagesClient(PagesStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static PagesClient |
create()
Constructs an instance of PagesClient with default settings.
|
static PagesClient |
create(PagesSettings settings)
Constructs an instance of PagesClient, using the given settings.
|
static PagesClient |
create(PagesStub stub)
Constructs an instance of PagesClient, using the given stub for making calls.
|
Page |
createPage(CreatePageRequest request)
Creates a page in the specified flow.
|
Page |
createPage(FlowName parent,
Page page)
Creates a page in the specified flow.
|
Page |
createPage(String parent,
Page page)
Creates a page in the specified flow.
|
com.google.api.gax.rpc.UnaryCallable<CreatePageRequest,Page> |
createPageCallable()
Creates a page in the specified flow.
|
void |
deletePage(DeletePageRequest request)
Deletes the specified page.
|
void |
deletePage(PageName name)
Deletes the specified page.
|
void |
deletePage(String name)
Deletes the specified page.
|
com.google.api.gax.rpc.UnaryCallable<DeletePageRequest,com.google.protobuf.Empty> |
deletePageCallable()
Deletes the specified page.
|
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.
|
Page |
getPage(GetPageRequest request)
Retrieves the specified page.
|
Page |
getPage(PageName name)
Retrieves the specified page.
|
Page |
getPage(String name)
Retrieves the specified page.
|
com.google.api.gax.rpc.UnaryCallable<GetPageRequest,Page> |
getPageCallable()
Retrieves the specified page.
|
PagesSettings |
getSettings() |
PagesStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
PagesClient.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,PagesClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
PagesClient.ListPagesPagedResponse |
listPages(FlowName parent)
Returns the list of all pages in the specified flow.
|
PagesClient.ListPagesPagedResponse |
listPages(ListPagesRequest request)
Returns the list of all pages in the specified flow.
|
PagesClient.ListPagesPagedResponse |
listPages(String parent)
Returns the list of all pages in the specified flow.
|
com.google.api.gax.rpc.UnaryCallable<ListPagesRequest,ListPagesResponse> |
listPagesCallable()
Returns the list of all pages in the specified flow.
|
com.google.api.gax.rpc.UnaryCallable<ListPagesRequest,PagesClient.ListPagesPagedResponse> |
listPagesPagedCallable()
Returns the list of all pages in the specified flow.
|
void |
shutdown() |
void |
shutdownNow() |
Page |
updatePage(Page page,
com.google.protobuf.FieldMask updateMask)
Updates the specified page.
|
Page |
updatePage(UpdatePageRequest request)
Updates the specified page.
|
com.google.api.gax.rpc.UnaryCallable<UpdatePageRequest,Page> |
updatePageCallable()
Updates the specified page.
|
protected PagesClient(PagesSettings settings) throws IOException
IOExceptionprotected PagesClient(PagesStub stub)
public static final PagesClient create() throws IOException
IOExceptionpublic static final PagesClient create(PagesSettings settings) throws IOException
IOExceptionpublic static final PagesClient create(PagesStub stub)
public final PagesSettings getSettings()
public PagesStub getStub()
public final PagesClient.ListPagesPagedResponse listPages(FlowName 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 (PagesClient pagesClient = PagesClient.create()) {
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
for (Page element : pagesClient.listPages(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The flow to list all pages for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PagesClient.ListPagesPagedResponse listPages(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 (PagesClient pagesClient = PagesClient.create()) {
String parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
for (Page element : pagesClient.listPages(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The flow to list all pages for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PagesClient.ListPagesPagedResponse listPages(ListPagesRequest 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 (PagesClient pagesClient = PagesClient.create()) {
ListPagesRequest request =
ListPagesRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Page element : pagesClient.listPages(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<ListPagesRequest,PagesClient.ListPagesPagedResponse> listPagesPagedCallable()
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 (PagesClient pagesClient = PagesClient.create()) {
ListPagesRequest request =
ListPagesRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Page> future = pagesClient.listPagesPagedCallable().futureCall(request);
// Do something.
for (Page element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListPagesRequest,ListPagesResponse> listPagesCallable()
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 (PagesClient pagesClient = PagesClient.create()) {
ListPagesRequest request =
ListPagesRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListPagesResponse response = pagesClient.listPagesCallable().call(request);
for (Page element : response.getPagesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Page getPage(PageName 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 (PagesClient pagesClient = PagesClient.create()) {
PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
Page response = pagesClient.getPage(name);
}
name - Required. The name of the page. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/pages/<PageID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Page getPage(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 (PagesClient pagesClient = PagesClient.create()) {
String name =
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString();
Page response = pagesClient.getPage(name);
}
name - Required. The name of the page. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/pages/<PageID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Page getPage(GetPageRequest 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 (PagesClient pagesClient = PagesClient.create()) {
GetPageRequest request =
GetPageRequest.newBuilder()
.setName(
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
Page response = pagesClient.getPage(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<GetPageRequest,Page> getPageCallable()
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 (PagesClient pagesClient = PagesClient.create()) {
GetPageRequest request =
GetPageRequest.newBuilder()
.setName(
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Page> future = pagesClient.getPageCallable().futureCall(request);
// Do something.
Page response = future.get();
}
public final Page createPage(FlowName parent, Page page)
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 (PagesClient pagesClient = PagesClient.create()) {
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
Page page = Page.newBuilder().build();
Page response = pagesClient.createPage(parent, page);
}
parent - Required. The flow to create a page for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>`.page - Required. The page to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Page createPage(String parent, Page page)
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 (PagesClient pagesClient = PagesClient.create()) {
String parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
Page page = Page.newBuilder().build();
Page response = pagesClient.createPage(parent, page);
}
parent - Required. The flow to create a page for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>`.page - Required. The page to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Page createPage(CreatePageRequest 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 (PagesClient pagesClient = PagesClient.create()) {
CreatePageRequest request =
CreatePageRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setPage(Page.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
Page response = pagesClient.createPage(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<CreatePageRequest,Page> createPageCallable()
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 (PagesClient pagesClient = PagesClient.create()) {
CreatePageRequest request =
CreatePageRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setPage(Page.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Page> future = pagesClient.createPageCallable().futureCall(request);
// Do something.
Page response = future.get();
}
public final Page updatePage(Page page, 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 (PagesClient pagesClient = PagesClient.create()) {
Page page = Page.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Page response = pagesClient.updatePage(page, updateMask);
}
page - Required. The page 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 Page updatePage(UpdatePageRequest 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 (PagesClient pagesClient = PagesClient.create()) {
UpdatePageRequest request =
UpdatePageRequest.newBuilder()
.setPage(Page.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Page response = pagesClient.updatePage(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<UpdatePageRequest,Page> updatePageCallable()
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 (PagesClient pagesClient = PagesClient.create()) {
UpdatePageRequest request =
UpdatePageRequest.newBuilder()
.setPage(Page.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Page> future = pagesClient.updatePageCallable().futureCall(request);
// Do something.
Page response = future.get();
}
public final void deletePage(PageName 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 (PagesClient pagesClient = PagesClient.create()) {
PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
pagesClient.deletePage(name);
}
name - Required. The name of the page to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/Flows/<flowID>/pages/<PageID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deletePage(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 (PagesClient pagesClient = PagesClient.create()) {
String name =
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString();
pagesClient.deletePage(name);
}
name - Required. The name of the page to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/Flows/<flowID>/pages/<PageID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deletePage(DeletePageRequest 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 (PagesClient pagesClient = PagesClient.create()) {
DeletePageRequest request =
DeletePageRequest.newBuilder()
.setName(
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString())
.setForce(true)
.build();
pagesClient.deletePage(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<DeletePageRequest,com.google.protobuf.Empty> deletePageCallable()
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 (PagesClient pagesClient = PagesClient.create()) {
DeletePageRequest request =
DeletePageRequest.newBuilder()
.setName(
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString())
.setForce(true)
.build();
ApiFuture<Empty> future = pagesClient.deletePageCallable().futureCall(request);
// Do something.
future.get();
}
public final PagesClient.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 (PagesClient pagesClient = PagesClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : pagesClient.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,PagesClient.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 (PagesClient pagesClient = PagesClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future = pagesClient.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 (PagesClient pagesClient = PagesClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = pagesClient.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 (PagesClient pagesClient = PagesClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = pagesClient.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 (PagesClient pagesClient = PagesClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = pagesClient.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.