Class NodeTemplatesClient (1.50.0)

GitHub RepositoryProduct Reference

Service Description: The NodeTemplates API.

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().

Methods
MethodDescriptionMethod 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.

  • aggregatedList(AggregatedListNodeTemplatesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • aggregatedList(String project)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • aggregatedListPagedCallable()

  • aggregatedListCallable()

Delete

Deletes the specified NodeTemplate resource.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteAsync(DeleteNodeTemplateRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteAsync(String project, String region, String nodeTemplate)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteOperationCallable()

  • deleteCallable()

Get

Returns the specified node template.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • get(GetNodeTemplateRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • get(String project, String region, String nodeTemplate)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCallable()

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.

  • getIamPolicy(GetIamPolicyNodeTemplateRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getIamPolicy(String project, String region, String resource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIamPolicyCallable()

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.

  • insertAsync(InsertNodeTemplateRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • insertAsync(String project, String region, NodeTemplate nodeTemplateResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • insertOperationCallable()

  • insertCallable()

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.

  • list(ListNodeTemplatesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • list(String project, String region)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPagedCallable()

  • listCallable()

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.

  • setIamPolicy(SetIamPolicyNodeTemplateRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setIamPolicyCallable()

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.

  • testIamPermissions(TestIamPermissionsNodeTemplateRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • testIamPermissionsCallable()

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.

Inheritance

java.lang.Object > NodeTemplatesClient

Static Methods

create()

public static final NodeTemplatesClient create()

Constructs an instance of NodeTemplatesClient with default settings.

Returns
TypeDescription
NodeTemplatesClient
Exceptions
TypeDescription
IOException

create(NodeTemplatesSettings settings)

public static final NodeTemplatesClient create(NodeTemplatesSettings settings)

Constructs an instance of NodeTemplatesClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsNodeTemplatesSettings
Returns
TypeDescription
NodeTemplatesClient
Exceptions
TypeDescription
IOException

create(NodeTemplatesStub stub)

public static final NodeTemplatesClient create(NodeTemplatesStub stub)

Constructs an instance of NodeTemplatesClient, using the given stub for making calls. This is for advanced usage - prefer using create(NodeTemplatesSettings).

Parameter
NameDescription
stubNodeTemplatesStub
Returns
TypeDescription
NodeTemplatesClient

Constructors

NodeTemplatesClient(NodeTemplatesSettings settings)

protected NodeTemplatesClient(NodeTemplatesSettings settings)

Constructs an instance of NodeTemplatesClient, 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.

Parameter
NameDescription
settingsNodeTemplatesSettings

NodeTemplatesClient(NodeTemplatesStub stub)

protected NodeTemplatesClient(NodeTemplatesStub stub)
Parameter
NameDescription
stubNodeTemplatesStub

Methods

aggregatedList(AggregatedListNodeTemplatesRequest request)

public final NodeTemplatesClient.AggregatedListPagedResponse aggregatedList(AggregatedListNodeTemplatesRequest request)

Retrieves an aggregated list of node templates. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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);
   }
 }
 
Parameter
NameDescription
requestAggregatedListNodeTemplatesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
NodeTemplatesClient.AggregatedListPagedResponse

aggregatedList(String project)

public final NodeTemplatesClient.AggregatedListPagedResponse aggregatedList(String project)

Retrieves an aggregated list of node templates. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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);
   }
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
NodeTemplatesClient.AggregatedListPagedResponse

aggregatedListCallable()

public final UnaryCallable<AggregatedListNodeTemplatesRequest,NodeTemplateAggregatedList> aggregatedListCallable()

Retrieves an aggregated list of node templates. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListNodeTemplatesRequest,NodeTemplateAggregatedList>

aggregatedListPagedCallable()

public final UnaryCallable<AggregatedListNodeTemplatesRequest,NodeTemplatesClient.AggregatedListPagedResponse> aggregatedListPagedCallable()

Retrieves an aggregated list of node templates. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListNodeTemplatesRequest,AggregatedListPagedResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

deleteAsync(DeleteNodeTemplateRequest request)

public final OperationFuture<Operation,Operation> deleteAsync(DeleteNodeTemplateRequest request)

Deletes the specified NodeTemplate 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()) {
   DeleteNodeTemplateRequest request =
       DeleteNodeTemplateRequest.newBuilder()
           .setNodeTemplate("nodeTemplate2118368412")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .build();
   Operation response = nodeTemplatesClient.deleteAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteNodeTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String project, String region, String nodeTemplate)

public final OperationFuture<Operation,Operation> deleteAsync(String project, String region, String nodeTemplate)

Deletes the specified NodeTemplate 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 nodeTemplate = "nodeTemplate2118368412";
   Operation response = nodeTemplatesClient.deleteAsync(project, region, nodeTemplate).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

nodeTemplateString

Name of the NodeTemplate resource to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteNodeTemplateRequest,Operation> deleteCallable()

Deletes the specified NodeTemplate 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()) {
   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();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteNodeTemplateRequest,Operation>

deleteOperationCallable()

public final OperationCallable<DeleteNodeTemplateRequest,Operation,Operation> deleteOperationCallable()

Deletes the specified NodeTemplate 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()) {
   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();
 }
 
Returns
TypeDescription
OperationCallable<DeleteNodeTemplateRequest,Operation,Operation>

get(GetNodeTemplateRequest request)

public final NodeTemplate get(GetNodeTemplateRequest request)

Returns the specified node template.

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);
 }
 
Parameter
NameDescription
requestGetNodeTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
NodeTemplate

get(String project, String region, String nodeTemplate)

public final NodeTemplate get(String project, String region, String nodeTemplate)

Returns the specified node template.

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);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

nodeTemplateString

Name of the node template to return.

Returns
TypeDescription
NodeTemplate

getCallable()

public final UnaryCallable<GetNodeTemplateRequest,NodeTemplate> getCallable()

Returns the specified node template.

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();
 }
 
Returns
TypeDescription
UnaryCallable<GetNodeTemplateRequest,NodeTemplate>

getIamPolicy(GetIamPolicyNodeTemplateRequest request)

public final Policy getIamPolicy(GetIamPolicyNodeTemplateRequest request)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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);
 }
 
Parameter
NameDescription
requestGetIamPolicyNodeTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Policy

getIamPolicy(String project, String region, String resource)

public final Policy getIamPolicy(String project, String region, String resource)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

resourceString

Name or id of the resource for this request.

Returns
TypeDescription
Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyNodeTemplateRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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();
 }
 
Returns
TypeDescription
UnaryCallable<GetIamPolicyNodeTemplateRequest,Policy>

getSettings()

public final NodeTemplatesSettings getSettings()
Returns
TypeDescription
NodeTemplatesSettings

getStub()

public NodeTemplatesStub getStub()
Returns
TypeDescription
NodeTemplatesStub

insertAsync(InsertNodeTemplateRequest request)

public final OperationFuture<Operation,Operation> insertAsync(InsertNodeTemplateRequest request)

Creates a NodeTemplate resource in the specified project using the data included in the 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();
 }
 
Parameter
NameDescription
requestInsertNodeTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String project, String region, NodeTemplate nodeTemplateResource)

public final 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.

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();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

nodeTemplateResourceNodeTemplate

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertNodeTemplateRequest,Operation> insertCallable()

Creates a NodeTemplate resource in the specified project using the data included in the 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();
   ApiFuture<Operation> future = nodeTemplatesClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InsertNodeTemplateRequest,Operation>

insertOperationCallable()

public final OperationCallable<InsertNodeTemplateRequest,Operation,Operation> insertOperationCallable()

Creates a NodeTemplate resource in the specified project using the data included in the 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();
   OperationFuture<Operation, Operation> future =
       nodeTemplatesClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<InsertNodeTemplateRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list(ListNodeTemplatesRequest request)

public final NodeTemplatesClient.ListPagedResponse list(ListNodeTemplatesRequest request)

Retrieves a list of node templates available to the specified 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()) {
   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);
   }
 }
 
Parameter
NameDescription
requestListNodeTemplatesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
NodeTemplatesClient.ListPagedResponse

list(String project, String region)

public final NodeTemplatesClient.ListPagedResponse list(String project, String region)

Retrieves a list of node templates available to the specified 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";
   String region = "region-934795532";
   for (NodeTemplate element : nodeTemplatesClient.list(project, region).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

Returns
TypeDescription
NodeTemplatesClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListNodeTemplatesRequest,NodeTemplateList> listCallable()

Retrieves a list of node templates available to the specified 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()) {
   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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListNodeTemplatesRequest,NodeTemplateList>

listPagedCallable()

public final UnaryCallable<ListNodeTemplatesRequest,NodeTemplatesClient.ListPagedResponse> listPagedCallable()

Retrieves a list of node templates available to the specified 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()) {
   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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListNodeTemplatesRequest,ListPagedResponse>

setIamPolicy(SetIamPolicyNodeTemplateRequest request)

public final Policy setIamPolicy(SetIamPolicyNodeTemplateRequest request)

Sets the access control policy on the specified resource. Replaces any existing policy.

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);
 }
 
Parameter
NameDescription
requestSetIamPolicyNodeTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Policy

setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)

public final Policy setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)

Sets the access control policy on the specified resource. Replaces any existing policy.

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);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

resourceString

Name or id of the resource for this request.

regionSetPolicyRequestResourceRegionSetPolicyRequest

The body resource for this request

Returns
TypeDescription
Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyNodeTemplateRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replaces any existing policy.

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();
 }
 
Returns
TypeDescription
UnaryCallable<SetIamPolicyNodeTemplateRequest,Policy>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsNodeTemplateRequest request)

public final TestPermissionsResponse testIamPermissions(TestIamPermissionsNodeTemplateRequest request)

Returns permissions that a caller has on the specified 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()) {
   TestIamPermissionsNodeTemplateRequest request =
       TestIamPermissionsNodeTemplateRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .build();
   TestPermissionsResponse response = nodeTemplatesClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestTestIamPermissionsNodeTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestPermissionsResponse

testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

public final TestPermissionsResponse testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

Returns permissions that a caller has on the specified 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";
   TestPermissionsRequest testPermissionsRequestResource =
       TestPermissionsRequest.newBuilder().build();
   TestPermissionsResponse response =
       nodeTemplatesClient.testIamPermissions(
           project, region, resource, testPermissionsRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

Returns
TypeDescription
TestPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsNodeTemplateRequest,TestPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified 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()) {
   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();
 }
 
Returns
TypeDescription
UnaryCallable<TestIamPermissionsNodeTemplateRequest,TestPermissionsResponse>