@Generated(value="by gapic-generator") @BetaApi public class NodeTypeClient 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 (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
ProjectZoneNodeTypeName nodeType = ProjectZoneNodeTypeName.of("[PROJECT]", "[ZONE]", "[NODE_TYPE]");
NodeType response = nodeTypeClient.getNodeType(nodeType);
}
Note: close() needs to be called on the nodeTypeClient 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 NodeTypeSettings to create(). For example:
To customize credentials:
NodeTypeSettings nodeTypeSettings =
NodeTypeSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NodeTypeClient nodeTypeClient =
NodeTypeClient.create(nodeTypeSettings);
To customize the endpoint:
NodeTypeSettings nodeTypeSettings =
NodeTypeSettings.newBuilder().setEndpoint(myEndpoint).build();
NodeTypeClient nodeTypeClient =
NodeTypeClient.create(nodeTypeSettings);
Modifier and Type | Class and Description |
---|---|
static class |
NodeTypeClient.AggregatedListNodeTypesFixedSizeCollection |
static class |
NodeTypeClient.AggregatedListNodeTypesPage |
static class |
NodeTypeClient.AggregatedListNodeTypesPagedResponse |
static class |
NodeTypeClient.ListNodeTypesFixedSizeCollection |
static class |
NodeTypeClient.ListNodeTypesPage |
static class |
NodeTypeClient.ListNodeTypesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
NodeTypeClient(NodeTypeSettings settings)
Constructs an instance of NodeTypeClient, using the given settings.
|
protected |
NodeTypeClient(NodeTypeStub stub) |
Modifier and Type | Method and Description |
---|---|
NodeTypeClient.AggregatedListNodeTypesPagedResponse |
aggregatedListNodeTypes(AggregatedListNodeTypesHttpRequest request)
Retrieves an aggregated list of node types.
|
NodeTypeClient.AggregatedListNodeTypesPagedResponse |
aggregatedListNodeTypes(ProjectName project)
Retrieves an aggregated list of node types.
|
NodeTypeClient.AggregatedListNodeTypesPagedResponse |
aggregatedListNodeTypes(String project)
Retrieves an aggregated list of node types.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTypesHttpRequest,NodeTypeAggregatedList> |
aggregatedListNodeTypesCallable()
Retrieves an aggregated list of node types.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTypesHttpRequest,NodeTypeClient.AggregatedListNodeTypesPagedResponse> |
aggregatedListNodeTypesPagedCallable()
Retrieves an aggregated list of node types.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static NodeTypeClient |
create()
Constructs an instance of NodeTypeClient with default settings.
|
static NodeTypeClient |
create(NodeTypeSettings settings)
Constructs an instance of NodeTypeClient, using the given settings.
|
static NodeTypeClient |
create(NodeTypeStub stub)
Constructs an instance of NodeTypeClient, using the given stub for making calls.
|
NodeType |
getNodeType(GetNodeTypeHttpRequest request)
Returns the specified node type.
|
NodeType |
getNodeType(ProjectZoneNodeTypeName nodeType)
Returns the specified node type.
|
NodeType |
getNodeType(String nodeType)
Returns the specified node type.
|
com.google.api.gax.rpc.UnaryCallable<GetNodeTypeHttpRequest,NodeType> |
getNodeTypeCallable()
Returns the specified node type.
|
NodeTypeSettings |
getSettings() |
NodeTypeStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
NodeTypeClient.ListNodeTypesPagedResponse |
listNodeTypes(ListNodeTypesHttpRequest request)
Retrieves a list of node types available to the specified project.
|
NodeTypeClient.ListNodeTypesPagedResponse |
listNodeTypes(ProjectZoneName zone)
Retrieves a list of node types available to the specified project.
|
NodeTypeClient.ListNodeTypesPagedResponse |
listNodeTypes(String zone)
Retrieves a list of node types available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListNodeTypesHttpRequest,NodeTypeList> |
listNodeTypesCallable()
Retrieves a list of node types available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListNodeTypesHttpRequest,NodeTypeClient.ListNodeTypesPagedResponse> |
listNodeTypesPagedCallable()
Retrieves a list of node types available to the specified project.
|
void |
shutdown() |
void |
shutdownNow() |
protected NodeTypeClient(NodeTypeSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected NodeTypeClient(NodeTypeStub stub)
public static final NodeTypeClient create() throws IOException
IOException
public static final NodeTypeClient create(NodeTypeSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final NodeTypeClient create(NodeTypeStub stub)
public final NodeTypeSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public NodeTypeStub getStub()
@BetaApi public final NodeTypeClient.AggregatedListNodeTypesPagedResponse aggregatedListNodeTypes(ProjectName project)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (NodeTypesScopedList element : nodeTypeClient.aggregatedListNodeTypes(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTypeClient.AggregatedListNodeTypesPagedResponse aggregatedListNodeTypes(String project)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (NodeTypesScopedList element : nodeTypeClient.aggregatedListNodeTypes(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 NodeTypeClient.AggregatedListNodeTypesPagedResponse aggregatedListNodeTypes(AggregatedListNodeTypesHttpRequest request)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNodeTypesHttpRequest request = AggregatedListNodeTypesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (NodeTypesScopedList element : nodeTypeClient.aggregatedListNodeTypes(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<AggregatedListNodeTypesHttpRequest,NodeTypeClient.AggregatedListNodeTypesPagedResponse> aggregatedListNodeTypesPagedCallable()
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNodeTypesHttpRequest request = AggregatedListNodeTypesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListNodeTypesPagedResponse> future = nodeTypeClient.aggregatedListNodeTypesPagedCallable().futureCall(request);
// Do something
for (NodeTypesScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListNodeTypesHttpRequest,NodeTypeAggregatedList> aggregatedListNodeTypesCallable()
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNodeTypesHttpRequest request = AggregatedListNodeTypesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
NodeTypeAggregatedList response = nodeTypeClient.aggregatedListNodeTypesCallable().call(request);
for (NodeTypesScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final NodeType getNodeType(ProjectZoneNodeTypeName nodeType)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
ProjectZoneNodeTypeName nodeType = ProjectZoneNodeTypeName.of("[PROJECT]", "[ZONE]", "[NODE_TYPE]");
NodeType response = nodeTypeClient.getNodeType(nodeType);
}
nodeType
- Name of the node type to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeType getNodeType(String nodeType)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
ProjectZoneNodeTypeName nodeType = ProjectZoneNodeTypeName.of("[PROJECT]", "[ZONE]", "[NODE_TYPE]");
NodeType response = nodeTypeClient.getNodeType(nodeType.toString());
}
nodeType
- Name of the node type to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeType getNodeType(GetNodeTypeHttpRequest request)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
String formattedNodeType = ProjectZoneNodeTypeName.format("[PROJECT]", "[ZONE]", "[NODE_TYPE]");
GetNodeTypeHttpRequest request = GetNodeTypeHttpRequest.newBuilder()
.setNodeType(formattedNodeType)
.build();
NodeType response = nodeTypeClient.getNodeType(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<GetNodeTypeHttpRequest,NodeType> getNodeTypeCallable()
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
String formattedNodeType = ProjectZoneNodeTypeName.format("[PROJECT]", "[ZONE]", "[NODE_TYPE]");
GetNodeTypeHttpRequest request = GetNodeTypeHttpRequest.newBuilder()
.setNodeType(formattedNodeType)
.build();
ApiFuture<NodeType> future = nodeTypeClient.getNodeTypeCallable().futureCall(request);
// Do something
NodeType response = future.get();
}
@BetaApi public final NodeTypeClient.ListNodeTypesPagedResponse listNodeTypes(ProjectZoneName zone)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (NodeType element : nodeTypeClient.listNodeTypes(zone).iterateAll()) {
// doThingsWith(element);
}
}
zone
- The name of the zone for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTypeClient.ListNodeTypesPagedResponse listNodeTypes(String zone)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (NodeType element : nodeTypeClient.listNodeTypes(zone.toString()).iterateAll()) {
// doThingsWith(element);
}
}
zone
- The name of the zone for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final NodeTypeClient.ListNodeTypesPagedResponse listNodeTypes(ListNodeTypesHttpRequest request)
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListNodeTypesHttpRequest request = ListNodeTypesHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
for (NodeType element : nodeTypeClient.listNodeTypes(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<ListNodeTypesHttpRequest,NodeTypeClient.ListNodeTypesPagedResponse> listNodeTypesPagedCallable()
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListNodeTypesHttpRequest request = ListNodeTypesHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
ApiFuture<ListNodeTypesPagedResponse> future = nodeTypeClient.listNodeTypesPagedCallable().futureCall(request);
// Do something
for (NodeType element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListNodeTypesHttpRequest,NodeTypeList> listNodeTypesCallable()
Sample code:
try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListNodeTypesHttpRequest request = ListNodeTypesHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
while (true) {
NodeTypeList response = nodeTypeClient.listNodeTypesCallable().call(request);
for (NodeType element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
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.