@Generated(value="by gapic-generator") @BetaApi public class NodeTemplateClient 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:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateName nodeTemplate = ProjectRegionNodeTemplateName.of("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
Operation response = nodeTemplateClient.deleteNodeTemplate(nodeTemplate);
}
Note: close() needs to be called on the nodeTemplateClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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 NodeTemplateSettings to create(). For example:
To customize credentials:
NodeTemplateSettings nodeTemplateSettings =
NodeTemplateSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NodeTemplateClient nodeTemplateClient =
NodeTemplateClient.create(nodeTemplateSettings);
To customize the endpoint:
NodeTemplateSettings nodeTemplateSettings =
NodeTemplateSettings.newBuilder().setEndpoint(myEndpoint).build();
NodeTemplateClient nodeTemplateClient =
NodeTemplateClient.create(nodeTemplateSettings);
Modifier and Type | Class and Description |
---|---|
static class |
NodeTemplateClient.AggregatedListNodeTemplatesFixedSizeCollection |
static class |
NodeTemplateClient.AggregatedListNodeTemplatesPage |
static class |
NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse |
static class |
NodeTemplateClient.ListNodeTemplatesFixedSizeCollection |
static class |
NodeTemplateClient.ListNodeTemplatesPage |
static class |
NodeTemplateClient.ListNodeTemplatesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
NodeTemplateClient(NodeTemplateSettings settings)
Constructs an instance of NodeTemplateClient, using the given settings.
|
protected |
NodeTemplateClient(NodeTemplateStub stub) |
Modifier and Type | Method and Description |
---|---|
NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse |
aggregatedListNodeTemplates(AggregatedListNodeTemplatesHttpRequest request)
Retrieves an aggregated list of node templates.
|
NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse |
aggregatedListNodeTemplates(ProjectName project)
Retrieves an aggregated list of node templates.
|
NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse |
aggregatedListNodeTemplates(String project)
Retrieves an aggregated list of node templates.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTemplatesHttpRequest,NodeTemplateAggregatedList> |
aggregatedListNodeTemplatesCallable()
Retrieves an aggregated list of node templates.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTemplatesHttpRequest,NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse> |
aggregatedListNodeTemplatesPagedCallable()
Retrieves an aggregated list of node templates.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static NodeTemplateClient |
create()
Constructs an instance of NodeTemplateClient with default settings.
|
static NodeTemplateClient |
create(NodeTemplateSettings settings)
Constructs an instance of NodeTemplateClient, using the given settings.
|
static NodeTemplateClient |
create(NodeTemplateStub stub)
Constructs an instance of NodeTemplateClient, using the given stub for making calls.
|
Operation |
deleteNodeTemplate(DeleteNodeTemplateHttpRequest request)
Deletes the specified NodeTemplate resource.
|
Operation |
deleteNodeTemplate(ProjectRegionNodeTemplateName nodeTemplate)
Deletes the specified NodeTemplate resource.
|
Operation |
deleteNodeTemplate(String nodeTemplate)
Deletes the specified NodeTemplate resource.
|
com.google.api.gax.rpc.UnaryCallable<DeleteNodeTemplateHttpRequest,Operation> |
deleteNodeTemplateCallable()
Deletes the specified NodeTemplate resource.
|
Policy |
getIamPolicyNodeTemplate(GetIamPolicyNodeTemplateHttpRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyNodeTemplate(ProjectRegionNodeTemplateResourceName resource)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyNodeTemplate(String resource)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<GetIamPolicyNodeTemplateHttpRequest,Policy> |
getIamPolicyNodeTemplateCallable()
Gets the access control policy for a resource.
|
NodeTemplate |
getNodeTemplate(GetNodeTemplateHttpRequest request)
Returns the specified node template.
|
NodeTemplate |
getNodeTemplate(ProjectRegionNodeTemplateName nodeTemplate)
Returns the specified node template.
|
NodeTemplate |
getNodeTemplate(String nodeTemplate)
Returns the specified node template.
|
com.google.api.gax.rpc.UnaryCallable<GetNodeTemplateHttpRequest,NodeTemplate> |
getNodeTemplateCallable()
Returns the specified node template.
|
NodeTemplateSettings |
getSettings() |
NodeTemplateStub |
getStub() |
Operation |
insertNodeTemplate(InsertNodeTemplateHttpRequest request)
Creates a NodeTemplate resource in the specified project using the data included in the
request.
|
Operation |
insertNodeTemplate(ProjectRegionName region,
NodeTemplate nodeTemplateResource)
Creates a NodeTemplate resource in the specified project using the data included in the
request.
|
Operation |
insertNodeTemplate(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<InsertNodeTemplateHttpRequest,Operation> |
insertNodeTemplateCallable()
Creates a NodeTemplate resource in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
NodeTemplateClient.ListNodeTemplatesPagedResponse |
listNodeTemplates(ListNodeTemplatesHttpRequest request)
Retrieves a list of node templates available to the specified project.
|
NodeTemplateClient.ListNodeTemplatesPagedResponse |
listNodeTemplates(ProjectRegionName region)
Retrieves a list of node templates available to the specified project.
|
NodeTemplateClient.ListNodeTemplatesPagedResponse |
listNodeTemplates(String region)
Retrieves a list of node templates available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListNodeTemplatesHttpRequest,NodeTemplateList> |
listNodeTemplatesCallable()
Retrieves a list of node templates available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListNodeTemplatesHttpRequest,NodeTemplateClient.ListNodeTemplatesPagedResponse> |
listNodeTemplatesPagedCallable()
Retrieves a list of node templates available to the specified project.
|
Policy |
setIamPolicyNodeTemplate(ProjectRegionNodeTemplateResourceName resource,
RegionSetPolicyRequest regionSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyNodeTemplate(SetIamPolicyNodeTemplateHttpRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyNodeTemplate(String resource,
RegionSetPolicyRequest regionSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<SetIamPolicyNodeTemplateHttpRequest,Policy> |
setIamPolicyNodeTemplateCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissionsNodeTemplate(ProjectRegionNodeTemplateResourceName resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsNodeTemplate(String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsNodeTemplate(TestIamPermissionsNodeTemplateHttpRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsNodeTemplateHttpRequest,TestPermissionsResponse> |
testIamPermissionsNodeTemplateCallable()
Returns permissions that a caller has on the specified resource.
|
protected NodeTemplateClient(NodeTemplateSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected NodeTemplateClient(NodeTemplateStub stub)
public static final NodeTemplateClient create() throws IOException
IOException
public static final NodeTemplateClient create(NodeTemplateSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final NodeTemplateClient create(NodeTemplateStub stub)
public final NodeTemplateSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public NodeTemplateStub getStub()
@BetaApi public final NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse aggregatedListNodeTemplates(ProjectName project)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (NodeTemplatesScopedList element : nodeTemplateClient.aggregatedListNodeTemplates(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse aggregatedListNodeTemplates(String project)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (NodeTemplatesScopedList element : nodeTemplateClient.aggregatedListNodeTemplates(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse aggregatedListNodeTemplates(AggregatedListNodeTemplatesHttpRequest request)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNodeTemplatesHttpRequest request = AggregatedListNodeTemplatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (NodeTemplatesScopedList element : nodeTemplateClient.aggregatedListNodeTemplates(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 fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTemplatesHttpRequest,NodeTemplateClient.AggregatedListNodeTemplatesPagedResponse> aggregatedListNodeTemplatesPagedCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNodeTemplatesHttpRequest request = AggregatedListNodeTemplatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListNodeTemplatesPagedResponse> future = nodeTemplateClient.aggregatedListNodeTemplatesPagedCallable().futureCall(request);
// Do something
for (NodeTemplatesScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTemplatesHttpRequest,NodeTemplateAggregatedList> aggregatedListNodeTemplatesCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNodeTemplatesHttpRequest request = AggregatedListNodeTemplatesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
NodeTemplateAggregatedList response = nodeTemplateClient.aggregatedListNodeTemplatesCallable().call(request);
for (NodeTemplatesScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteNodeTemplate(ProjectRegionNodeTemplateName nodeTemplate)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateName nodeTemplate = ProjectRegionNodeTemplateName.of("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
Operation response = nodeTemplateClient.deleteNodeTemplate(nodeTemplate);
}
nodeTemplate
- Name of the NodeTemplate resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteNodeTemplate(String nodeTemplate)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateName nodeTemplate = ProjectRegionNodeTemplateName.of("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
Operation response = nodeTemplateClient.deleteNodeTemplate(nodeTemplate.toString());
}
nodeTemplate
- Name of the NodeTemplate resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteNodeTemplate(DeleteNodeTemplateHttpRequest request)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedNodeTemplate = ProjectRegionNodeTemplateName.format("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
DeleteNodeTemplateHttpRequest request = DeleteNodeTemplateHttpRequest.newBuilder()
.setNodeTemplate(formattedNodeTemplate)
.build();
Operation response = nodeTemplateClient.deleteNodeTemplate(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteNodeTemplateHttpRequest,Operation> deleteNodeTemplateCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedNodeTemplate = ProjectRegionNodeTemplateName.format("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
DeleteNodeTemplateHttpRequest request = DeleteNodeTemplateHttpRequest.newBuilder()
.setNodeTemplate(formattedNodeTemplate)
.build();
ApiFuture<Operation> future = nodeTemplateClient.deleteNodeTemplateCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final NodeTemplate getNodeTemplate(ProjectRegionNodeTemplateName nodeTemplate)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateName nodeTemplate = ProjectRegionNodeTemplateName.of("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
NodeTemplate response = nodeTemplateClient.getNodeTemplate(nodeTemplate);
}
nodeTemplate
- Name of the node template to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTemplate getNodeTemplate(String nodeTemplate)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateName nodeTemplate = ProjectRegionNodeTemplateName.of("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
NodeTemplate response = nodeTemplateClient.getNodeTemplate(nodeTemplate.toString());
}
nodeTemplate
- Name of the node template to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTemplate getNodeTemplate(GetNodeTemplateHttpRequest request)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedNodeTemplate = ProjectRegionNodeTemplateName.format("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
GetNodeTemplateHttpRequest request = GetNodeTemplateHttpRequest.newBuilder()
.setNodeTemplate(formattedNodeTemplate)
.build();
NodeTemplate response = nodeTemplateClient.getNodeTemplate(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetNodeTemplateHttpRequest,NodeTemplate> getNodeTemplateCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedNodeTemplate = ProjectRegionNodeTemplateName.format("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
GetNodeTemplateHttpRequest request = GetNodeTemplateHttpRequest.newBuilder()
.setNodeTemplate(formattedNodeTemplate)
.build();
ApiFuture<NodeTemplate> future = nodeTemplateClient.getNodeTemplateCallable().futureCall(request);
// Do something
NodeTemplate response = future.get();
}
@BetaApi public final Policy getIamPolicyNodeTemplate(ProjectRegionNodeTemplateResourceName resource)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateResourceName resource = ProjectRegionNodeTemplateResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
Policy response = nodeTemplateClient.getIamPolicyNodeTemplate(resource);
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyNodeTemplate(String resource)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateResourceName resource = ProjectRegionNodeTemplateResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
Policy response = nodeTemplateClient.getIamPolicyNodeTemplate(resource.toString());
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyNodeTemplate(GetIamPolicyNodeTemplateHttpRequest request)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedResource = ProjectRegionNodeTemplateResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
GetIamPolicyNodeTemplateHttpRequest request = GetIamPolicyNodeTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
Policy response = nodeTemplateClient.getIamPolicyNodeTemplate(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetIamPolicyNodeTemplateHttpRequest,Policy> getIamPolicyNodeTemplateCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedResource = ProjectRegionNodeTemplateResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
GetIamPolicyNodeTemplateHttpRequest request = GetIamPolicyNodeTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
ApiFuture<Policy> future = nodeTemplateClient.getIamPolicyNodeTemplateCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final Operation insertNodeTemplate(ProjectRegionName region, NodeTemplate nodeTemplateResource)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
NodeTemplate nodeTemplateResource = NodeTemplate.newBuilder().build();
Operation response = nodeTemplateClient.insertNodeTemplate(region, nodeTemplateResource);
}
region
- The name of the region for this request.nodeTemplateResource
- Represent a sole-tenant Node Template resource.
You can use a template to define properties for nodes in a node group. For more information, read Creating node groups and instances. (== resource_for beta.nodeTemplates ==) (== resource_for v1.nodeTemplates ==) (== NextID: 16 ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertNodeTemplate(String region, NodeTemplate nodeTemplateResource)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
NodeTemplate nodeTemplateResource = NodeTemplate.newBuilder().build();
Operation response = nodeTemplateClient.insertNodeTemplate(region.toString(), nodeTemplateResource);
}
region
- The name of the region for this request.nodeTemplateResource
- Represent a sole-tenant Node Template resource.
You can use a template to define properties for nodes in a node group. For more information, read Creating node groups and instances. (== resource_for beta.nodeTemplates ==) (== resource_for v1.nodeTemplates ==) (== NextID: 16 ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertNodeTemplate(InsertNodeTemplateHttpRequest request)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
NodeTemplate nodeTemplateResource = NodeTemplate.newBuilder().build();
InsertNodeTemplateHttpRequest request = InsertNodeTemplateHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setNodeTemplateResource(nodeTemplateResource)
.build();
Operation response = nodeTemplateClient.insertNodeTemplate(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertNodeTemplateHttpRequest,Operation> insertNodeTemplateCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
NodeTemplate nodeTemplateResource = NodeTemplate.newBuilder().build();
InsertNodeTemplateHttpRequest request = InsertNodeTemplateHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setNodeTemplateResource(nodeTemplateResource)
.build();
ApiFuture<Operation> future = nodeTemplateClient.insertNodeTemplateCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final NodeTemplateClient.ListNodeTemplatesPagedResponse listNodeTemplates(ProjectRegionName region)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (NodeTemplate element : nodeTemplateClient.listNodeTemplates(region).iterateAll()) {
// doThingsWith(element);
}
}
region
- The name of the region for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTemplateClient.ListNodeTemplatesPagedResponse listNodeTemplates(String region)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (NodeTemplate element : nodeTemplateClient.listNodeTemplates(region.toString()).iterateAll()) {
// doThingsWith(element);
}
}
region
- The name of the region for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTemplateClient.ListNodeTemplatesPagedResponse listNodeTemplates(ListNodeTemplatesHttpRequest request)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListNodeTemplatesHttpRequest request = ListNodeTemplatesHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (NodeTemplate element : nodeTemplateClient.listNodeTemplates(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 fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListNodeTemplatesHttpRequest,NodeTemplateClient.ListNodeTemplatesPagedResponse> listNodeTemplatesPagedCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListNodeTemplatesHttpRequest request = ListNodeTemplatesHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListNodeTemplatesPagedResponse> future = nodeTemplateClient.listNodeTemplatesPagedCallable().futureCall(request);
// Do something
for (NodeTemplate element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListNodeTemplatesHttpRequest,NodeTemplateList> listNodeTemplatesCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListNodeTemplatesHttpRequest request = ListNodeTemplatesHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
NodeTemplateList response = nodeTemplateClient.listNodeTemplatesCallable().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;
}
}
}
@BetaApi public final Policy setIamPolicyNodeTemplate(ProjectRegionNodeTemplateResourceName resource, RegionSetPolicyRequest regionSetPolicyRequestResource)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateResourceName resource = ProjectRegionNodeTemplateResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetPolicyRequest regionSetPolicyRequestResource = RegionSetPolicyRequest.newBuilder().build();
Policy response = nodeTemplateClient.setIamPolicyNodeTemplate(resource, regionSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.regionSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyNodeTemplate(String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateResourceName resource = ProjectRegionNodeTemplateResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetPolicyRequest regionSetPolicyRequestResource = RegionSetPolicyRequest.newBuilder().build();
Policy response = nodeTemplateClient.setIamPolicyNodeTemplate(resource.toString(), regionSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.regionSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyNodeTemplate(SetIamPolicyNodeTemplateHttpRequest request)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedResource = ProjectRegionNodeTemplateResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetPolicyRequest regionSetPolicyRequestResource = RegionSetPolicyRequest.newBuilder().build();
SetIamPolicyNodeTemplateHttpRequest request = SetIamPolicyNodeTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.setRegionSetPolicyRequestResource(regionSetPolicyRequestResource)
.build();
Policy response = nodeTemplateClient.setIamPolicyNodeTemplate(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetIamPolicyNodeTemplateHttpRequest,Policy> setIamPolicyNodeTemplateCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedResource = ProjectRegionNodeTemplateResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetPolicyRequest regionSetPolicyRequestResource = RegionSetPolicyRequest.newBuilder().build();
SetIamPolicyNodeTemplateHttpRequest request = SetIamPolicyNodeTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.setRegionSetPolicyRequestResource(regionSetPolicyRequestResource)
.build();
ApiFuture<Policy> future = nodeTemplateClient.setIamPolicyNodeTemplateCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final TestPermissionsResponse testIamPermissionsNodeTemplate(ProjectRegionNodeTemplateResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateResourceName resource = ProjectRegionNodeTemplateResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = nodeTemplateClient.testIamPermissionsNodeTemplate(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsNodeTemplate(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
ProjectRegionNodeTemplateResourceName resource = ProjectRegionNodeTemplateResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = nodeTemplateClient.testIamPermissionsNodeTemplate(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsNodeTemplate(TestIamPermissionsNodeTemplateHttpRequest request)
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedResource = ProjectRegionNodeTemplateResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsNodeTemplateHttpRequest request = TestIamPermissionsNodeTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = nodeTemplateClient.testIamPermissionsNodeTemplate(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsNodeTemplateHttpRequest,TestPermissionsResponse> testIamPermissionsNodeTemplateCallable()
Sample code:
try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
String formattedResource = ProjectRegionNodeTemplateResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsNodeTemplateHttpRequest request = TestIamPermissionsNodeTemplateHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = nodeTemplateClient.testIamPermissionsNodeTemplateCallable().futureCall(request);
// Do something
TestPermissionsResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.