@Generated(value="by gapic-generator-java") public class NodeTemplatesClient 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String nodeTemplate = "nodeTemplate2118368412";
NodeTemplate response = nodeTemplatesClient.get(project, region, nodeTemplate);
}
Note: close() needs to be called on the NodeTemplatesClient 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 |
|---|---|---|
AggregatedList |
Retrieves an aggregated list of node templates. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. |
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.
|
Delete |
Deletes the specified NodeTemplate resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Get |
Returns the specified node 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.
|
GetIamPolicy |
Gets the access control policy for a resource. May be empty if no such policy or resource exists. |
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.
|
Insert |
Creates a NodeTemplate resource in the specified project using the data included in the request. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
List |
Retrieves a list of node templates available to the specified project. |
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. Replaces any existing policy. |
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.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of NodeTemplatesSettings 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
NodeTemplatesSettings nodeTemplatesSettings =
NodeTemplatesSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create(nodeTemplatesSettings);
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
NodeTemplatesSettings nodeTemplatesSettings =
NodeTemplatesSettings.newBuilder().setEndpoint(myEndpoint).build();
NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create(nodeTemplatesSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
NodeTemplatesClient.AggregatedListFixedSizeCollection |
static class |
NodeTemplatesClient.AggregatedListPage |
static class |
NodeTemplatesClient.AggregatedListPagedResponse |
static class |
NodeTemplatesClient.ListFixedSizeCollection |
static class |
NodeTemplatesClient.ListPage |
static class |
NodeTemplatesClient.ListPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
NodeTemplatesClient(NodeTemplatesSettings settings)
Constructs an instance of NodeTemplatesClient, using the given settings.
|
protected |
NodeTemplatesClient(NodeTemplatesStub stub) |
| Modifier and Type | Method and Description |
|---|---|
NodeTemplatesClient.AggregatedListPagedResponse |
aggregatedList(AggregatedListNodeTemplatesRequest request)
Retrieves an aggregated list of node templates.
|
NodeTemplatesClient.AggregatedListPagedResponse |
aggregatedList(String project)
Retrieves an aggregated list of node templates.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTemplatesRequest,NodeTemplateAggregatedList> |
aggregatedListCallable()
Retrieves an aggregated list of node templates.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTemplatesRequest,NodeTemplatesClient.AggregatedListPagedResponse> |
aggregatedListPagedCallable()
Retrieves an aggregated list of node templates.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static NodeTemplatesClient |
create()
Constructs an instance of NodeTemplatesClient with default settings.
|
static NodeTemplatesClient |
create(NodeTemplatesSettings settings)
Constructs an instance of NodeTemplatesClient, using the given settings.
|
static NodeTemplatesClient |
create(NodeTemplatesStub stub)
Constructs an instance of NodeTemplatesClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(DeleteNodeTemplateRequest request)
Deletes the specified NodeTemplate resource.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(String project,
String region,
String nodeTemplate)
Deletes the specified NodeTemplate resource.
|
com.google.api.gax.rpc.UnaryCallable<DeleteNodeTemplateRequest,Operation> |
deleteCallable()
Deletes the specified NodeTemplate resource.
|
com.google.api.gax.rpc.OperationCallable<DeleteNodeTemplateRequest,Operation,Operation> |
deleteOperationCallable()
Deletes the specified NodeTemplate resource.
|
NodeTemplate |
get(GetNodeTemplateRequest request)
Returns the specified node template.
|
NodeTemplate |
get(String project,
String region,
String nodeTemplate)
Returns the specified node template.
|
com.google.api.gax.rpc.UnaryCallable<GetNodeTemplateRequest,NodeTemplate> |
getCallable()
Returns the specified node template.
|
Policy |
getIamPolicy(GetIamPolicyNodeTemplateRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicy(String project,
String region,
String resource)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<GetIamPolicyNodeTemplateRequest,Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
NodeTemplatesSettings |
getSettings() |
NodeTemplatesStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(InsertNodeTemplateRequest request)
Creates a NodeTemplate resource in the specified project using the data included in the
request.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(String project,
String region,
NodeTemplate nodeTemplateResource)
Creates a NodeTemplate resource in the specified project using the data included in the
request.
|
com.google.api.gax.rpc.UnaryCallable<InsertNodeTemplateRequest,Operation> |
insertCallable()
Creates a NodeTemplate resource in the specified project using the data included in the
request.
|
com.google.api.gax.rpc.OperationCallable<InsertNodeTemplateRequest,Operation,Operation> |
insertOperationCallable()
Creates a NodeTemplate resource in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
NodeTemplatesClient.ListPagedResponse |
list(ListNodeTemplatesRequest request)
Retrieves a list of node templates available to the specified project.
|
NodeTemplatesClient.ListPagedResponse |
list(String project,
String region)
Retrieves a list of node templates available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListNodeTemplatesRequest,NodeTemplateList> |
listCallable()
Retrieves a list of node templates available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListNodeTemplatesRequest,NodeTemplatesClient.ListPagedResponse> |
listPagedCallable()
Retrieves a list of node templates available to the specified project.
|
Policy |
setIamPolicy(SetIamPolicyNodeTemplateRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicy(String project,
String region,
String resource,
RegionSetPolicyRequest regionSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<SetIamPolicyNodeTemplateRequest,Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissions(String project,
String region,
String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissions(TestIamPermissionsNodeTemplateRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsNodeTemplateRequest,TestPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
protected NodeTemplatesClient(NodeTemplatesSettings settings) throws IOException
IOExceptionprotected NodeTemplatesClient(NodeTemplatesStub stub)
public static final NodeTemplatesClient create() throws IOException
IOExceptionpublic static final NodeTemplatesClient create(NodeTemplatesSettings settings) throws IOException
IOExceptionpublic static final NodeTemplatesClient create(NodeTemplatesStub stub)
public final NodeTemplatesSettings getSettings()
public NodeTemplatesStub getStub()
public final NodeTemplatesClient.AggregatedListPagedResponse aggregatedList(String project)
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
for (Map.Entry<String, NodeTemplatesScopedList> element :
nodeTemplatesClient.aggregatedList(project).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final NodeTemplatesClient.AggregatedListPagedResponse aggregatedList(AggregatedListNodeTemplatesRequest 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
AggregatedListNodeTemplatesRequest request =
AggregatedListNodeTemplatesRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
for (Map.Entry<String, NodeTemplatesScopedList> element :
nodeTemplatesClient.aggregatedList(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<AggregatedListNodeTemplatesRequest,NodeTemplatesClient.AggregatedListPagedResponse> aggregatedListPagedCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
AggregatedListNodeTemplatesRequest request =
AggregatedListNodeTemplatesRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
ApiFuture<Map.Entry<String, NodeTemplatesScopedList>> future =
nodeTemplatesClient.aggregatedListPagedCallable().futureCall(request);
// Do something.
for (Map.Entry<String, NodeTemplatesScopedList> element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTemplatesRequest,NodeTemplateAggregatedList> aggregatedListCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
AggregatedListNodeTemplatesRequest request =
AggregatedListNodeTemplatesRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
while (true) {
NodeTemplateAggregatedList response =
nodeTemplatesClient.aggregatedListCallable().call(request);
for (Map.Entry<String, NodeTemplatesScopedList> element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(String project, String region, String nodeTemplate)
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String nodeTemplate = "nodeTemplate2118368412";
Operation response = nodeTemplatesClient.deleteAsync(project, region, nodeTemplate).get();
}
project - Project ID for this request.region - The name of the region for this request.nodeTemplate - Name of the NodeTemplate resource to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(DeleteNodeTemplateRequest 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
DeleteNodeTemplateRequest request =
DeleteNodeTemplateRequest.newBuilder()
.setNodeTemplate("nodeTemplate2118368412")
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.build();
Operation response = nodeTemplatesClient.deleteAsync(request).get();
}
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.OperationCallable<DeleteNodeTemplateRequest,Operation,Operation> deleteOperationCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
DeleteNodeTemplateRequest request =
DeleteNodeTemplateRequest.newBuilder()
.setNodeTemplate("nodeTemplate2118368412")
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.build();
OperationFuture<Operation, Operation> future =
nodeTemplatesClient.deleteOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteNodeTemplateRequest,Operation> deleteCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
DeleteNodeTemplateRequest request =
DeleteNodeTemplateRequest.newBuilder()
.setNodeTemplate("nodeTemplate2118368412")
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = nodeTemplatesClient.deleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final NodeTemplate get(String project, String region, String nodeTemplate)
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String nodeTemplate = "nodeTemplate2118368412";
NodeTemplate response = nodeTemplatesClient.get(project, region, nodeTemplate);
}
project - Project ID for this request.region - The name of the region for this request.nodeTemplate - Name of the node template to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final NodeTemplate get(GetNodeTemplateRequest 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
GetNodeTemplateRequest request =
GetNodeTemplateRequest.newBuilder()
.setNodeTemplate("nodeTemplate2118368412")
.setProject("project-309310695")
.setRegion("region-934795532")
.build();
NodeTemplate response = nodeTemplatesClient.get(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<GetNodeTemplateRequest,NodeTemplate> getCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
GetNodeTemplateRequest request =
GetNodeTemplateRequest.newBuilder()
.setNodeTemplate("nodeTemplate2118368412")
.setProject("project-309310695")
.setRegion("region-934795532")
.build();
ApiFuture<NodeTemplate> future = nodeTemplatesClient.getCallable().futureCall(request);
// Do something.
NodeTemplate response = future.get();
}
public final Policy getIamPolicy(String project, String region, String resource)
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resource = "resource-341064690";
Policy response = nodeTemplatesClient.getIamPolicy(project, region, resource);
}
project - Project ID for this request.region - The name of the region for this request.resource - Name or id of the resource for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Policy getIamPolicy(GetIamPolicyNodeTemplateRequest 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
GetIamPolicyNodeTemplateRequest request =
GetIamPolicyNodeTemplateRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.build();
Policy response = nodeTemplatesClient.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<GetIamPolicyNodeTemplateRequest,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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
GetIamPolicyNodeTemplateRequest request =
GetIamPolicyNodeTemplateRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.build();
ApiFuture<Policy> future = nodeTemplatesClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(String project, String region, NodeTemplate nodeTemplateResource)
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
NodeTemplate nodeTemplateResource = NodeTemplate.newBuilder().build();
Operation response =
nodeTemplatesClient.insertAsync(project, region, nodeTemplateResource).get();
}
project - Project ID for this request.region - The name of the region for this request.nodeTemplateResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(InsertNodeTemplateRequest 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
InsertNodeTemplateRequest request =
InsertNodeTemplateRequest.newBuilder()
.setNodeTemplateResource(NodeTemplate.newBuilder().build())
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.build();
Operation response = nodeTemplatesClient.insertAsync(request).get();
}
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.OperationCallable<InsertNodeTemplateRequest,Operation,Operation> insertOperationCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
InsertNodeTemplateRequest request =
InsertNodeTemplateRequest.newBuilder()
.setNodeTemplateResource(NodeTemplate.newBuilder().build())
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.build();
OperationFuture<Operation, Operation> future =
nodeTemplatesClient.insertOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<InsertNodeTemplateRequest,Operation> insertCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
InsertNodeTemplateRequest request =
InsertNodeTemplateRequest.newBuilder()
.setNodeTemplateResource(NodeTemplate.newBuilder().build())
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = nodeTemplatesClient.insertCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final NodeTemplatesClient.ListPagedResponse list(String project, String region)
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
for (NodeTemplate element : nodeTemplatesClient.list(project, region).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.region - The name of the region for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final NodeTemplatesClient.ListPagedResponse list(ListNodeTemplatesRequest 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
ListNodeTemplatesRequest request =
ListNodeTemplatesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
for (NodeTemplate element : nodeTemplatesClient.list(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<ListNodeTemplatesRequest,NodeTemplatesClient.ListPagedResponse> listPagedCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
ListNodeTemplatesRequest request =
ListNodeTemplatesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
ApiFuture<NodeTemplate> future = nodeTemplatesClient.listPagedCallable().futureCall(request);
// Do something.
for (NodeTemplate element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListNodeTemplatesRequest,NodeTemplateList> listCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
ListNodeTemplatesRequest request =
ListNodeTemplatesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
while (true) {
NodeTemplateList response = nodeTemplatesClient.listCallable().call(request);
for (NodeTemplate element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Policy setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resource = "resource-341064690";
RegionSetPolicyRequest regionSetPolicyRequestResource =
RegionSetPolicyRequest.newBuilder().build();
Policy response =
nodeTemplatesClient.setIamPolicy(
project, region, resource, regionSetPolicyRequestResource);
}
project - Project ID for this request.region - The name of the region for this request.resource - Name or id of the resource for this request.regionSetPolicyRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final Policy setIamPolicy(SetIamPolicyNodeTemplateRequest 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
SetIamPolicyNodeTemplateRequest request =
SetIamPolicyNodeTemplateRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build())
.setResource("resource-341064690")
.build();
Policy response = nodeTemplatesClient.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<SetIamPolicyNodeTemplateRequest,Policy> setIamPolicyCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
SetIamPolicyNodeTemplateRequest request =
SetIamPolicyNodeTemplateRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build())
.setResource("resource-341064690")
.build();
ApiFuture<Policy> future = nodeTemplatesClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final TestPermissionsResponse testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resource = "resource-341064690";
TestPermissionsRequest testPermissionsRequestResource =
TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response =
nodeTemplatesClient.testIamPermissions(
project, region, resource, testPermissionsRequestResource);
}
project - Project ID for this request.region - The name of the region for this request.resource - Name or id of the resource for this request.testPermissionsRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final TestPermissionsResponse testIamPermissions(TestIamPermissionsNodeTemplateRequest 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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
TestIamPermissionsNodeTemplateRequest request =
TestIamPermissionsNodeTemplateRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.build();
TestPermissionsResponse response = nodeTemplatesClient.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<TestIamPermissionsNodeTemplateRequest,TestPermissionsResponse> testIamPermissionsCallable()
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 (NodeTemplatesClient nodeTemplatesClient = NodeTemplatesClient.create()) {
TestIamPermissionsNodeTemplateRequest request =
TestIamPermissionsNodeTemplateRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.build();
ApiFuture<TestPermissionsResponse> future =
nodeTemplatesClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestPermissionsResponse 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.