@Generated(value="by gapic-generator-java") public class SessionTemplateControllerClient 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
SessionTemplate sessionTemplate = SessionTemplate.newBuilder().build();
SessionTemplate response =
sessionTemplateControllerClient.createSessionTemplate(parent, sessionTemplate);
}
Note: close() needs to be called on the SessionTemplateControllerClient 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 |
|---|---|---|
CreateSessionTemplate |
Create a session template synchronously. |
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.
|
UpdateSessionTemplate |
Updates the session template synchronously. |
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.
|
GetSessionTemplate |
Gets the resource representation for a session template. |
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.
|
ListSessionTemplates |
Lists session templates. |
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.
|
DeleteSessionTemplate |
Deletes a session template. |
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.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
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.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
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.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
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 SessionTemplateControllerSettings 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
SessionTemplateControllerSettings sessionTemplateControllerSettings =
SessionTemplateControllerSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create(sessionTemplateControllerSettings);
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
SessionTemplateControllerSettings sessionTemplateControllerSettings =
SessionTemplateControllerSettings.newBuilder().setEndpoint(myEndpoint).build();
SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create(sessionTemplateControllerSettings);
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
SessionTemplateControllerSettings sessionTemplateControllerSettings =
SessionTemplateControllerSettings.newHttpJsonBuilder().build();
SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create(sessionTemplateControllerSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
SessionTemplateControllerClient.ListSessionTemplatesFixedSizeCollection |
static class |
SessionTemplateControllerClient.ListSessionTemplatesPage |
static class |
SessionTemplateControllerClient.ListSessionTemplatesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
SessionTemplateControllerClient(SessionTemplateControllerSettings settings)
Constructs an instance of SessionTemplateControllerClient, using the given settings.
|
protected |
SessionTemplateControllerClient(SessionTemplateControllerStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static SessionTemplateControllerClient |
create()
Constructs an instance of SessionTemplateControllerClient with default settings.
|
static SessionTemplateControllerClient |
create(SessionTemplateControllerSettings settings)
Constructs an instance of SessionTemplateControllerClient, using the given settings.
|
static SessionTemplateControllerClient |
create(SessionTemplateControllerStub stub)
Constructs an instance of SessionTemplateControllerClient, using the given stub for making
calls.
|
SessionTemplate |
createSessionTemplate(CreateSessionTemplateRequest request)
Create a session template synchronously.
|
SessionTemplate |
createSessionTemplate(LocationName parent,
SessionTemplate sessionTemplate)
Create a session template synchronously.
|
SessionTemplate |
createSessionTemplate(String parent,
SessionTemplate sessionTemplate)
Create a session template synchronously.
|
com.google.api.gax.rpc.UnaryCallable<CreateSessionTemplateRequest,SessionTemplate> |
createSessionTemplateCallable()
Create a session template synchronously.
|
void |
deleteSessionTemplate(DeleteSessionTemplateRequest request)
Deletes a session template.
|
void |
deleteSessionTemplate(SessionTemplateName name)
Deletes a session template.
|
void |
deleteSessionTemplate(String name)
Deletes a session template.
|
com.google.api.gax.rpc.UnaryCallable<DeleteSessionTemplateRequest,com.google.protobuf.Empty> |
deleteSessionTemplateCallable()
Deletes a session template.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
SessionTemplate |
getSessionTemplate(GetSessionTemplateRequest request)
Gets the resource representation for a session template.
|
SessionTemplate |
getSessionTemplate(SessionTemplateName name)
Gets the resource representation for a session template.
|
SessionTemplate |
getSessionTemplate(String name)
Gets the resource representation for a session template.
|
com.google.api.gax.rpc.UnaryCallable<GetSessionTemplateRequest,SessionTemplate> |
getSessionTemplateCallable()
Gets the resource representation for a session template.
|
SessionTemplateControllerSettings |
getSettings() |
SessionTemplateControllerStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
SessionTemplateControllerClient.ListSessionTemplatesPagedResponse |
listSessionTemplates(ListSessionTemplatesRequest request)
Lists session templates.
|
SessionTemplateControllerClient.ListSessionTemplatesPagedResponse |
listSessionTemplates(LocationName parent)
Lists session templates.
|
SessionTemplateControllerClient.ListSessionTemplatesPagedResponse |
listSessionTemplates(String parent)
Lists session templates.
|
com.google.api.gax.rpc.UnaryCallable<ListSessionTemplatesRequest,ListSessionTemplatesResponse> |
listSessionTemplatesCallable()
Lists session templates.
|
com.google.api.gax.rpc.UnaryCallable<ListSessionTemplatesRequest,SessionTemplateControllerClient.ListSessionTemplatesPagedResponse> |
listSessionTemplatesPagedCallable()
Lists session templates.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
SessionTemplate |
updateSessionTemplate(SessionTemplate sessionTemplate)
Updates the session template synchronously.
|
SessionTemplate |
updateSessionTemplate(UpdateSessionTemplateRequest request)
Updates the session template synchronously.
|
com.google.api.gax.rpc.UnaryCallable<UpdateSessionTemplateRequest,SessionTemplate> |
updateSessionTemplateCallable()
Updates the session template synchronously.
|
protected SessionTemplateControllerClient(SessionTemplateControllerSettings settings) throws IOException
IOExceptionprotected SessionTemplateControllerClient(SessionTemplateControllerStub stub)
public static final SessionTemplateControllerClient create() throws IOException
IOExceptionpublic static final SessionTemplateControllerClient create(SessionTemplateControllerSettings settings) throws IOException
IOExceptionpublic static final SessionTemplateControllerClient create(SessionTemplateControllerStub stub)
public final SessionTemplateControllerSettings getSettings()
public SessionTemplateControllerStub getStub()
public final SessionTemplate createSessionTemplate(LocationName parent, SessionTemplate sessionTemplate)
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
SessionTemplate sessionTemplate = SessionTemplate.newBuilder().build();
SessionTemplate response =
sessionTemplateControllerClient.createSessionTemplate(parent, sessionTemplate);
}
parent - Required. The parent resource where this session template will be created.sessionTemplate - Required. The session template to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionTemplate createSessionTemplate(String parent, SessionTemplate sessionTemplate)
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
SessionTemplate sessionTemplate = SessionTemplate.newBuilder().build();
SessionTemplate response =
sessionTemplateControllerClient.createSessionTemplate(parent, sessionTemplate);
}
parent - Required. The parent resource where this session template will be created.sessionTemplate - Required. The session template to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionTemplate createSessionTemplate(CreateSessionTemplateRequest 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
CreateSessionTemplateRequest request =
CreateSessionTemplateRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSessionTemplate(SessionTemplate.newBuilder().build())
.build();
SessionTemplate response = sessionTemplateControllerClient.createSessionTemplate(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<CreateSessionTemplateRequest,SessionTemplate> createSessionTemplateCallable()
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
CreateSessionTemplateRequest request =
CreateSessionTemplateRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSessionTemplate(SessionTemplate.newBuilder().build())
.build();
ApiFuture<SessionTemplate> future =
sessionTemplateControllerClient.createSessionTemplateCallable().futureCall(request);
// Do something.
SessionTemplate response = future.get();
}
public final SessionTemplate updateSessionTemplate(SessionTemplate sessionTemplate)
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
SessionTemplate sessionTemplate = SessionTemplate.newBuilder().build();
SessionTemplate response =
sessionTemplateControllerClient.updateSessionTemplate(sessionTemplate);
}
sessionTemplate - Required. The updated session template.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionTemplate updateSessionTemplate(UpdateSessionTemplateRequest 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
UpdateSessionTemplateRequest request =
UpdateSessionTemplateRequest.newBuilder()
.setSessionTemplate(SessionTemplate.newBuilder().build())
.build();
SessionTemplate response = sessionTemplateControllerClient.updateSessionTemplate(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<UpdateSessionTemplateRequest,SessionTemplate> updateSessionTemplateCallable()
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
UpdateSessionTemplateRequest request =
UpdateSessionTemplateRequest.newBuilder()
.setSessionTemplate(SessionTemplate.newBuilder().build())
.build();
ApiFuture<SessionTemplate> future =
sessionTemplateControllerClient.updateSessionTemplateCallable().futureCall(request);
// Do something.
SessionTemplate response = future.get();
}
public final SessionTemplate getSessionTemplate(SessionTemplateName 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
SessionTemplateName name = SessionTemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]");
SessionTemplate response = sessionTemplateControllerClient.getSessionTemplate(name);
}
name - Required. The name of the session template to retrieve.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionTemplate getSessionTemplate(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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
String name = SessionTemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString();
SessionTemplate response = sessionTemplateControllerClient.getSessionTemplate(name);
}
name - Required. The name of the session template to retrieve.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionTemplate getSessionTemplate(GetSessionTemplateRequest 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
GetSessionTemplateRequest request =
GetSessionTemplateRequest.newBuilder()
.setName(SessionTemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.build();
SessionTemplate response = sessionTemplateControllerClient.getSessionTemplate(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<GetSessionTemplateRequest,SessionTemplate> getSessionTemplateCallable()
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
GetSessionTemplateRequest request =
GetSessionTemplateRequest.newBuilder()
.setName(SessionTemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.build();
ApiFuture<SessionTemplate> future =
sessionTemplateControllerClient.getSessionTemplateCallable().futureCall(request);
// Do something.
SessionTemplate response = future.get();
}
public final SessionTemplateControllerClient.ListSessionTemplatesPagedResponse listSessionTemplates(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (SessionTemplate element :
sessionTemplateControllerClient.listSessionTemplates(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent that owns this collection of session templates.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionTemplateControllerClient.ListSessionTemplatesPagedResponse listSessionTemplates(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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (SessionTemplate element :
sessionTemplateControllerClient.listSessionTemplates(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent that owns this collection of session templates.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SessionTemplateControllerClient.ListSessionTemplatesPagedResponse listSessionTemplates(ListSessionTemplatesRequest 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
ListSessionTemplatesRequest request =
ListSessionTemplatesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (SessionTemplate element :
sessionTemplateControllerClient.listSessionTemplates(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<ListSessionTemplatesRequest,SessionTemplateControllerClient.ListSessionTemplatesPagedResponse> listSessionTemplatesPagedCallable()
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
ListSessionTemplatesRequest request =
ListSessionTemplatesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<SessionTemplate> future =
sessionTemplateControllerClient.listSessionTemplatesPagedCallable().futureCall(request);
// Do something.
for (SessionTemplate element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListSessionTemplatesRequest,ListSessionTemplatesResponse> listSessionTemplatesCallable()
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
ListSessionTemplatesRequest request =
ListSessionTemplatesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListSessionTemplatesResponse response =
sessionTemplateControllerClient.listSessionTemplatesCallable().call(request);
for (SessionTemplate element : response.getSessionTemplatesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void deleteSessionTemplate(SessionTemplateName 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
SessionTemplateName name = SessionTemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]");
sessionTemplateControllerClient.deleteSessionTemplate(name);
}
name - Required. The name of the session template resource to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSessionTemplate(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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
String name = SessionTemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString();
sessionTemplateControllerClient.deleteSessionTemplate(name);
}
name - Required. The name of the session template resource to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSessionTemplate(DeleteSessionTemplateRequest 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
DeleteSessionTemplateRequest request =
DeleteSessionTemplateRequest.newBuilder()
.setName(SessionTemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.build();
sessionTemplateControllerClient.deleteSessionTemplate(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<DeleteSessionTemplateRequest,com.google.protobuf.Empty> deleteSessionTemplateCallable()
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
DeleteSessionTemplateRequest request =
DeleteSessionTemplateRequest.newBuilder()
.setName(SessionTemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.build();
ApiFuture<Empty> future =
sessionTemplateControllerClient.deleteSessionTemplateCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
"[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = sessionTemplateControllerClient.setIamPolicy(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.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
"[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future =
sessionTemplateControllerClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest 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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
"[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = sessionTemplateControllerClient.getIamPolicy(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.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
"[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future =
sessionTemplateControllerClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
"[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response =
sessionTemplateControllerClient.testIamPermissions(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.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (SessionTemplateControllerClient sessionTemplateControllerClient =
SessionTemplateControllerClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName(
"[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
sessionTemplateControllerClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse 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 © 2024 Google LLC. All rights reserved.