com.google.cloud.dialogflow.cx.v3beta1.PlaybooksClient Maven / Gradle / Ivy
Show all versions of google-cloud-dialogflow-cx Show documentation
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.dialogflow.cx.v3beta1;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.dialogflow.cx.v3beta1.stub.PlaybooksStub;
import com.google.cloud.dialogflow.cx.v3beta1.stub.PlaybooksStubSettings;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service for managing
* [Playbooks][google.cloud.dialogflow.cx.v3beta1.Playbook].
*
* 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:
*
*
{@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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
* Playbook playbook = Playbook.newBuilder().build();
* Playbook response = playbooksClient.createPlaybook(parent, playbook);
* }
* }
*
* Note: close() needs to be called on the PlaybooksClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
*
* Methods
*
* Method
* Description
* Method Variants
*
*
* CreatePlaybook
* Creates a playbook in a specified agent.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* createPlaybook(CreatePlaybookRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* createPlaybook(AgentName parent, Playbook playbook)
*
createPlaybook(String parent, Playbook playbook)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createPlaybookCallable()
*
*
*
*
* DeletePlaybook
* Deletes a specified playbook.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deletePlaybook(DeletePlaybookRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* deletePlaybook(PlaybookName name)
*
deletePlaybook(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deletePlaybookCallable()
*
*
*
*
* ListPlaybooks
* Returns a list of playbooks in the specified agent.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listPlaybooks(ListPlaybooksRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listPlaybooks(AgentName parent)
*
listPlaybooks(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listPlaybooksPagedCallable()
*
listPlaybooksCallable()
*
*
*
*
* GetPlaybook
* Retrieves the specified Playbook.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getPlaybook(GetPlaybookRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getPlaybook(PlaybookName name)
*
getPlaybook(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getPlaybookCallable()
*
*
*
*
* UpdatePlaybook
* Updates the specified Playbook.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* updatePlaybook(UpdatePlaybookRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* updatePlaybook(Playbook playbook, FieldMask updateMask)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updatePlaybookCallable()
*
*
*
*
* CreatePlaybookVersion
* Creates a version for the specified Playbook.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* createPlaybookVersion(CreatePlaybookVersionRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* createPlaybookVersion(PlaybookName parent, PlaybookVersion playbookVersion)
*
createPlaybookVersion(String parent, PlaybookVersion playbookVersion)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createPlaybookVersionCallable()
*
*
*
*
* GetPlaybookVersion
* Retrieves the specified version of the Playbook.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getPlaybookVersion(GetPlaybookVersionRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getPlaybookVersion(PlaybookVersionName name)
*
getPlaybookVersion(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getPlaybookVersionCallable()
*
*
*
*
* ListPlaybookVersions
* Lists versions for the specified Playbook.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listPlaybookVersions(ListPlaybookVersionsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listPlaybookVersions(PlaybookName parent)
*
listPlaybookVersions(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listPlaybookVersionsPagedCallable()
*
listPlaybookVersionsCallable()
*
*
*
*
* DeletePlaybookVersion
* Deletes the specified version of the Playbook.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deletePlaybookVersion(DeletePlaybookVersionRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* deletePlaybookVersion(PlaybookVersionName name)
*
deletePlaybookVersion(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deletePlaybookVersionCallable()
*
*
*
*
* 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.
*
* listLocations(ListLocationsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listLocationsPagedCallable()
*
listLocationsCallable()
*
*
*
*
* GetLocation
* Gets information about a location.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getLocation(GetLocationRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getLocationCallable()
*
*
*
*
*
* 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 PlaybooksSettings to create().
* For example:
*
*
To customize credentials:
*
*
{@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
* PlaybooksSettings playbooksSettings =
* PlaybooksSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* PlaybooksClient playbooksClient = PlaybooksClient.create(playbooksSettings);
* }
*
* To customize the endpoint:
*
*
{@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
* PlaybooksSettings playbooksSettings =
* PlaybooksSettings.newBuilder().setEndpoint(myEndpoint).build();
* PlaybooksClient playbooksClient = PlaybooksClient.create(playbooksSettings);
* }
*
* To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
*
{@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
* PlaybooksSettings playbooksSettings = PlaybooksSettings.newHttpJsonBuilder().build();
* PlaybooksClient playbooksClient = PlaybooksClient.create(playbooksSettings);
* }
*
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
@Generated("by gapic-generator-java")
public class PlaybooksClient implements BackgroundResource {
private final PlaybooksSettings settings;
private final PlaybooksStub stub;
/** Constructs an instance of PlaybooksClient with default settings. */
public static final PlaybooksClient create() throws IOException {
return create(PlaybooksSettings.newBuilder().build());
}
/**
* Constructs an instance of PlaybooksClient, using the given settings. The channels are created
* based on the settings passed in, or defaults for any settings that are not set.
*/
public static final PlaybooksClient create(PlaybooksSettings settings) throws IOException {
return new PlaybooksClient(settings);
}
/**
* Constructs an instance of PlaybooksClient, using the given stub for making calls. This is for
* advanced usage - prefer using create(PlaybooksSettings).
*/
public static final PlaybooksClient create(PlaybooksStub stub) {
return new PlaybooksClient(stub);
}
/**
* Constructs an instance of PlaybooksClient, using the given settings. This is protected so that
* it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
*/
protected PlaybooksClient(PlaybooksSettings settings) throws IOException {
this.settings = settings;
this.stub = ((PlaybooksStubSettings) settings.getStubSettings()).createStub();
}
protected PlaybooksClient(PlaybooksStub stub) {
this.settings = null;
this.stub = stub;
}
public final PlaybooksSettings getSettings() {
return settings;
}
public PlaybooksStub getStub() {
return stub;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a playbook in a specified agent.
*
*
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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
* Playbook playbook = Playbook.newBuilder().build();
* Playbook response = playbooksClient.createPlaybook(parent, playbook);
* }
* }
*
* @param parent Required. The agent to create a playbook for. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.
* @param playbook Required. The playbook to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Playbook createPlaybook(AgentName parent, Playbook playbook) {
CreatePlaybookRequest request =
CreatePlaybookRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setPlaybook(playbook)
.build();
return createPlaybook(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a playbook in a specified agent.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
* Playbook playbook = Playbook.newBuilder().build();
* Playbook response = playbooksClient.createPlaybook(parent, playbook);
* }
* }
*
* @param parent Required. The agent to create a playbook for. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.
* @param playbook Required. The playbook to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Playbook createPlaybook(String parent, Playbook playbook) {
CreatePlaybookRequest request =
CreatePlaybookRequest.newBuilder().setParent(parent).setPlaybook(playbook).build();
return createPlaybook(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a playbook in a specified agent.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* CreatePlaybookRequest request =
* CreatePlaybookRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .setPlaybook(Playbook.newBuilder().build())
* .build();
* Playbook response = playbooksClient.createPlaybook(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Playbook createPlaybook(CreatePlaybookRequest request) {
return createPlaybookCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a playbook in a specified agent.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* CreatePlaybookRequest request =
* CreatePlaybookRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .setPlaybook(Playbook.newBuilder().build())
* .build();
* ApiFuture future = playbooksClient.createPlaybookCallable().futureCall(request);
* // Do something.
* Playbook response = future.get();
* }
* }
*/
public final UnaryCallable createPlaybookCallable() {
return stub.createPlaybookCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a specified playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* PlaybookName name = PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]");
* playbooksClient.deletePlaybook(name);
* }
* }
*
* @param name Required. The name of the playbook to delete. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deletePlaybook(PlaybookName name) {
DeletePlaybookRequest request =
DeletePlaybookRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deletePlaybook(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a specified playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* String name = PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString();
* playbooksClient.deletePlaybook(name);
* }
* }
*
* @param name Required. The name of the playbook to delete. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deletePlaybook(String name) {
DeletePlaybookRequest request = DeletePlaybookRequest.newBuilder().setName(name).build();
deletePlaybook(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a specified playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* DeletePlaybookRequest request =
* DeletePlaybookRequest.newBuilder()
* .setName(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .build();
* playbooksClient.deletePlaybook(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deletePlaybook(DeletePlaybookRequest request) {
deletePlaybookCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a specified playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* DeletePlaybookRequest request =
* DeletePlaybookRequest.newBuilder()
* .setName(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .build();
* ApiFuture future = playbooksClient.deletePlaybookCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deletePlaybookCallable() {
return stub.deletePlaybookCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a list of playbooks in the specified agent.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
* for (Playbook element : playbooksClient.listPlaybooks(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The agent to list playbooks from. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPlaybooksPagedResponse listPlaybooks(AgentName parent) {
ListPlaybooksRequest request =
ListPlaybooksRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listPlaybooks(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a list of playbooks in the specified agent.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
* for (Playbook element : playbooksClient.listPlaybooks(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The agent to list playbooks from. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPlaybooksPagedResponse listPlaybooks(String parent) {
ListPlaybooksRequest request = ListPlaybooksRequest.newBuilder().setParent(parent).build();
return listPlaybooks(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a list of playbooks in the specified agent.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListPlaybooksRequest request =
* ListPlaybooksRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Playbook element : playbooksClient.listPlaybooks(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPlaybooksPagedResponse listPlaybooks(ListPlaybooksRequest request) {
return listPlaybooksPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a list of playbooks in the specified agent.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListPlaybooksRequest request =
* ListPlaybooksRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future = playbooksClient.listPlaybooksPagedCallable().futureCall(request);
* // Do something.
* for (Playbook element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listPlaybooksPagedCallable() {
return stub.listPlaybooksPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns a list of playbooks in the specified agent.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListPlaybooksRequest request =
* ListPlaybooksRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListPlaybooksResponse response = playbooksClient.listPlaybooksCallable().call(request);
* for (Playbook element : response.getPlaybooksList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listPlaybooksCallable() {
return stub.listPlaybooksCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* PlaybookName name = PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]");
* Playbook response = playbooksClient.getPlaybook(name);
* }
* }
*
* @param name Required. The name of the playbook. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Playbook getPlaybook(PlaybookName name) {
GetPlaybookRequest request =
GetPlaybookRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getPlaybook(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* String name = PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString();
* Playbook response = playbooksClient.getPlaybook(name);
* }
* }
*
* @param name Required. The name of the playbook. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Playbook getPlaybook(String name) {
GetPlaybookRequest request = GetPlaybookRequest.newBuilder().setName(name).build();
return getPlaybook(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* GetPlaybookRequest request =
* GetPlaybookRequest.newBuilder()
* .setName(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .build();
* Playbook response = playbooksClient.getPlaybook(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Playbook getPlaybook(GetPlaybookRequest request) {
return getPlaybookCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* GetPlaybookRequest request =
* GetPlaybookRequest.newBuilder()
* .setName(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .build();
* ApiFuture future = playbooksClient.getPlaybookCallable().futureCall(request);
* // Do something.
* Playbook response = future.get();
* }
* }
*/
public final UnaryCallable getPlaybookCallable() {
return stub.getPlaybookCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* Playbook playbook = Playbook.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* Playbook response = playbooksClient.updatePlaybook(playbook, updateMask);
* }
* }
*
* @param playbook Required. The playbook to update.
* @param updateMask The mask to control which fields get updated. If the mask is not present, all
* fields will be updated.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Playbook updatePlaybook(Playbook playbook, FieldMask updateMask) {
UpdatePlaybookRequest request =
UpdatePlaybookRequest.newBuilder().setPlaybook(playbook).setUpdateMask(updateMask).build();
return updatePlaybook(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* UpdatePlaybookRequest request =
* UpdatePlaybookRequest.newBuilder()
* .setPlaybook(Playbook.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* Playbook response = playbooksClient.updatePlaybook(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Playbook updatePlaybook(UpdatePlaybookRequest request) {
return updatePlaybookCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* UpdatePlaybookRequest request =
* UpdatePlaybookRequest.newBuilder()
* .setPlaybook(Playbook.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture future = playbooksClient.updatePlaybookCallable().futureCall(request);
* // Do something.
* Playbook response = future.get();
* }
* }
*/
public final UnaryCallable updatePlaybookCallable() {
return stub.updatePlaybookCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a version for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* PlaybookName parent = PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]");
* PlaybookVersion playbookVersion = PlaybookVersion.newBuilder().build();
* PlaybookVersion response = playbooksClient.createPlaybookVersion(parent, playbookVersion);
* }
* }
*
* @param parent Required. The playbook to create a version for. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`.
* @param playbookVersion Required. The playbook version to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PlaybookVersion createPlaybookVersion(
PlaybookName parent, PlaybookVersion playbookVersion) {
CreatePlaybookVersionRequest request =
CreatePlaybookVersionRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setPlaybookVersion(playbookVersion)
.build();
return createPlaybookVersion(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a version for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* String parent =
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString();
* PlaybookVersion playbookVersion = PlaybookVersion.newBuilder().build();
* PlaybookVersion response = playbooksClient.createPlaybookVersion(parent, playbookVersion);
* }
* }
*
* @param parent Required. The playbook to create a version for. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`.
* @param playbookVersion Required. The playbook version to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PlaybookVersion createPlaybookVersion(
String parent, PlaybookVersion playbookVersion) {
CreatePlaybookVersionRequest request =
CreatePlaybookVersionRequest.newBuilder()
.setParent(parent)
.setPlaybookVersion(playbookVersion)
.build();
return createPlaybookVersion(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a version for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* CreatePlaybookVersionRequest request =
* CreatePlaybookVersionRequest.newBuilder()
* .setParent(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .setPlaybookVersion(PlaybookVersion.newBuilder().build())
* .build();
* PlaybookVersion response = playbooksClient.createPlaybookVersion(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PlaybookVersion createPlaybookVersion(CreatePlaybookVersionRequest request) {
return createPlaybookVersionCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a version for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* CreatePlaybookVersionRequest request =
* CreatePlaybookVersionRequest.newBuilder()
* .setParent(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .setPlaybookVersion(PlaybookVersion.newBuilder().build())
* .build();
* ApiFuture future =
* playbooksClient.createPlaybookVersionCallable().futureCall(request);
* // Do something.
* PlaybookVersion response = future.get();
* }
* }
*/
public final UnaryCallable
createPlaybookVersionCallable() {
return stub.createPlaybookVersionCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified version of the Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* PlaybookVersionName name =
* PlaybookVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]", "[VERSION]");
* PlaybookVersion response = playbooksClient.getPlaybookVersion(name);
* }
* }
*
* @param name Required. The name of the playbook version. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/versions/<VersionID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PlaybookVersion getPlaybookVersion(PlaybookVersionName name) {
GetPlaybookVersionRequest request =
GetPlaybookVersionRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return getPlaybookVersion(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified version of the Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* String name =
* PlaybookVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]", "[VERSION]")
* .toString();
* PlaybookVersion response = playbooksClient.getPlaybookVersion(name);
* }
* }
*
* @param name Required. The name of the playbook version. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/versions/<VersionID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PlaybookVersion getPlaybookVersion(String name) {
GetPlaybookVersionRequest request =
GetPlaybookVersionRequest.newBuilder().setName(name).build();
return getPlaybookVersion(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified version of the Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* GetPlaybookVersionRequest request =
* GetPlaybookVersionRequest.newBuilder()
* .setName(
* PlaybookVersionName.of(
* "[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]", "[VERSION]")
* .toString())
* .build();
* PlaybookVersion response = playbooksClient.getPlaybookVersion(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PlaybookVersion getPlaybookVersion(GetPlaybookVersionRequest request) {
return getPlaybookVersionCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the specified version of the Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* GetPlaybookVersionRequest request =
* GetPlaybookVersionRequest.newBuilder()
* .setName(
* PlaybookVersionName.of(
* "[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]", "[VERSION]")
* .toString())
* .build();
* ApiFuture future =
* playbooksClient.getPlaybookVersionCallable().futureCall(request);
* // Do something.
* PlaybookVersion response = future.get();
* }
* }
*/
public final UnaryCallable
getPlaybookVersionCallable() {
return stub.getPlaybookVersionCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists versions for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* PlaybookName parent = PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]");
* for (PlaybookVersion element : playbooksClient.listPlaybookVersions(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The playbook to list versions for. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPlaybookVersionsPagedResponse listPlaybookVersions(PlaybookName parent) {
ListPlaybookVersionsRequest request =
ListPlaybookVersionsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listPlaybookVersions(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists versions for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* String parent =
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString();
* for (PlaybookVersion element : playbooksClient.listPlaybookVersions(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The playbook to list versions for. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPlaybookVersionsPagedResponse listPlaybookVersions(String parent) {
ListPlaybookVersionsRequest request =
ListPlaybookVersionsRequest.newBuilder().setParent(parent).build();
return listPlaybookVersions(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists versions for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListPlaybookVersionsRequest request =
* ListPlaybookVersionsRequest.newBuilder()
* .setParent(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (PlaybookVersion element : playbooksClient.listPlaybookVersions(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPlaybookVersionsPagedResponse listPlaybookVersions(
ListPlaybookVersionsRequest request) {
return listPlaybookVersionsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists versions for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListPlaybookVersionsRequest request =
* ListPlaybookVersionsRequest.newBuilder()
* .setParent(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* playbooksClient.listPlaybookVersionsPagedCallable().futureCall(request);
* // Do something.
* for (PlaybookVersion element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listPlaybookVersionsPagedCallable() {
return stub.listPlaybookVersionsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists versions for the specified Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListPlaybookVersionsRequest request =
* ListPlaybookVersionsRequest.newBuilder()
* .setParent(
* PlaybookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListPlaybookVersionsResponse response =
* playbooksClient.listPlaybookVersionsCallable().call(request);
* for (PlaybookVersion element : response.getPlaybookVersionsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable
listPlaybookVersionsCallable() {
return stub.listPlaybookVersionsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the specified version of the Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* PlaybookVersionName name =
* PlaybookVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]", "[VERSION]");
* playbooksClient.deletePlaybookVersion(name);
* }
* }
*
* @param name Required. The name of the playbook version to delete. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/versions/<VersionID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deletePlaybookVersion(PlaybookVersionName name) {
DeletePlaybookVersionRequest request =
DeletePlaybookVersionRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
deletePlaybookVersion(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the specified version of the Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* String name =
* PlaybookVersionName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]", "[VERSION]")
* .toString();
* playbooksClient.deletePlaybookVersion(name);
* }
* }
*
* @param name Required. The name of the playbook version to delete. Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/versions/<VersionID>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deletePlaybookVersion(String name) {
DeletePlaybookVersionRequest request =
DeletePlaybookVersionRequest.newBuilder().setName(name).build();
deletePlaybookVersion(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the specified version of the Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* DeletePlaybookVersionRequest request =
* DeletePlaybookVersionRequest.newBuilder()
* .setName(
* PlaybookVersionName.of(
* "[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]", "[VERSION]")
* .toString())
* .build();
* playbooksClient.deletePlaybookVersion(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deletePlaybookVersion(DeletePlaybookVersionRequest request) {
deletePlaybookVersionCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the specified version of the Playbook.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* DeletePlaybookVersionRequest request =
* DeletePlaybookVersionRequest.newBuilder()
* .setName(
* PlaybookVersionName.of(
* "[PROJECT]", "[LOCATION]", "[AGENT]", "[PLAYBOOK]", "[VERSION]")
* .toString())
* .build();
* ApiFuture future = playbooksClient.deletePlaybookVersionCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deletePlaybookVersionCallable() {
return stub.deletePlaybookVersionCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Location element : playbooksClient.listLocations(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
return listLocationsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future = playbooksClient.listLocationsPagedCallable().futureCall(request);
* // Do something.
* for (Location element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listLocationsPagedCallable() {
return stub.listLocationsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListLocationsResponse response = playbooksClient.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 UnaryCallable listLocationsCallable() {
return stub.listLocationsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
* Location response = playbooksClient.getLocation(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Location getLocation(GetLocationRequest request) {
return getLocationCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* 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 (PlaybooksClient playbooksClient = PlaybooksClient.create()) {
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
* ApiFuture future = playbooksClient.getLocationCallable().futureCall(request);
* // Do something.
* Location response = future.get();
* }
* }
*/
public final UnaryCallable getLocationCallable() {
return stub.getLocationCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListPlaybooksPagedResponse
extends AbstractPagedListResponse<
ListPlaybooksRequest,
ListPlaybooksResponse,
Playbook,
ListPlaybooksPage,
ListPlaybooksFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListPlaybooksPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListPlaybooksPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListPlaybooksPagedResponse(ListPlaybooksPage page) {
super(page, ListPlaybooksFixedSizeCollection.createEmptyCollection());
}
}
public static class ListPlaybooksPage
extends AbstractPage<
ListPlaybooksRequest, ListPlaybooksResponse, Playbook, ListPlaybooksPage> {
private ListPlaybooksPage(
PageContext context,
ListPlaybooksResponse response) {
super(context, response);
}
private static ListPlaybooksPage createEmptyPage() {
return new ListPlaybooksPage(null, null);
}
@Override
protected ListPlaybooksPage createPage(
PageContext context,
ListPlaybooksResponse response) {
return new ListPlaybooksPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListPlaybooksFixedSizeCollection
extends AbstractFixedSizeCollection<
ListPlaybooksRequest,
ListPlaybooksResponse,
Playbook,
ListPlaybooksPage,
ListPlaybooksFixedSizeCollection> {
private ListPlaybooksFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListPlaybooksFixedSizeCollection createEmptyCollection() {
return new ListPlaybooksFixedSizeCollection(null, 0);
}
@Override
protected ListPlaybooksFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListPlaybooksFixedSizeCollection(pages, collectionSize);
}
}
public static class ListPlaybookVersionsPagedResponse
extends AbstractPagedListResponse<
ListPlaybookVersionsRequest,
ListPlaybookVersionsResponse,
PlaybookVersion,
ListPlaybookVersionsPage,
ListPlaybookVersionsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext
context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListPlaybookVersionsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListPlaybookVersionsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListPlaybookVersionsPagedResponse(ListPlaybookVersionsPage page) {
super(page, ListPlaybookVersionsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListPlaybookVersionsPage
extends AbstractPage<
ListPlaybookVersionsRequest,
ListPlaybookVersionsResponse,
PlaybookVersion,
ListPlaybookVersionsPage> {
private ListPlaybookVersionsPage(
PageContext
context,
ListPlaybookVersionsResponse response) {
super(context, response);
}
private static ListPlaybookVersionsPage createEmptyPage() {
return new ListPlaybookVersionsPage(null, null);
}
@Override
protected ListPlaybookVersionsPage createPage(
PageContext
context,
ListPlaybookVersionsResponse response) {
return new ListPlaybookVersionsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext
context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListPlaybookVersionsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListPlaybookVersionsRequest,
ListPlaybookVersionsResponse,
PlaybookVersion,
ListPlaybookVersionsPage,
ListPlaybookVersionsFixedSizeCollection> {
private ListPlaybookVersionsFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListPlaybookVersionsFixedSizeCollection createEmptyCollection() {
return new ListPlaybookVersionsFixedSizeCollection(null, 0);
}
@Override
protected ListPlaybookVersionsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListPlaybookVersionsFixedSizeCollection(pages, collectionSize);
}
}
public static class ListLocationsPagedResponse
extends AbstractPagedListResponse<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListLocationsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListLocationsPagedResponse(ListLocationsPage page) {
super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListLocationsPage
extends AbstractPage<
ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
private ListLocationsPage(
PageContext context,
ListLocationsResponse response) {
super(context, response);
}
private static ListLocationsPage createEmptyPage() {
return new ListLocationsPage(null, null);
}
@Override
protected ListLocationsPage createPage(
PageContext context,
ListLocationsResponse response) {
return new ListLocationsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListLocationsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
private ListLocationsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListLocationsFixedSizeCollection createEmptyCollection() {
return new ListLocationsFixedSizeCollection(null, 0);
}
@Override
protected ListLocationsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListLocationsFixedSizeCollection(pages, collectionSize);
}
}
}