Class TpuClient
- java.lang.Object
-
- com.google.cloud.tpu.v2alpha1.TpuClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@BetaApi @Generated("by gapic-generator-java") public class TpuClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Manages TPU nodes and other resourcesTPU API v2alpha1
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 (TpuClient tpuClient = TpuClient.create()) { NodeName name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]"); Node response = tpuClient.getNode(name); }
Note: close() needs to be called on the TpuClient 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of TpuSettings 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 TpuSettings tpuSettings = TpuSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); TpuClient tpuClient = TpuClient.create(tpuSettings);
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 TpuSettings tpuSettings = TpuSettings.newBuilder().setEndpoint(myEndpoint).build(); TpuClient tpuClient = TpuClient.create(tpuSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TpuClient.ListAcceleratorTypesFixedSizeCollection
static class
TpuClient.ListAcceleratorTypesPage
static class
TpuClient.ListAcceleratorTypesPagedResponse
static class
TpuClient.ListLocationsFixedSizeCollection
static class
TpuClient.ListLocationsPage
static class
TpuClient.ListLocationsPagedResponse
static class
TpuClient.ListNodesFixedSizeCollection
static class
TpuClient.ListNodesPage
static class
TpuClient.ListNodesPagedResponse
static class
TpuClient.ListQueuedResourcesFixedSizeCollection
static class
TpuClient.ListQueuedResourcesPage
static class
TpuClient.ListQueuedResourcesPagedResponse
static class
TpuClient.ListRuntimeVersionsFixedSizeCollection
static class
TpuClient.ListRuntimeVersionsPage
static class
TpuClient.ListRuntimeVersionsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
TpuClient(TpuStub stub)
protected
TpuClient(TpuSettings settings)
Constructs an instance of TpuClient, using the given settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static TpuClient
create()
Constructs an instance of TpuClient with default settings.static TpuClient
create(TpuStub stub)
Constructs an instance of TpuClient, using the given stub for making calls.static TpuClient
create(TpuSettings settings)
Constructs an instance of TpuClient, using the given settings.com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata>
createNodeAsync(CreateNodeRequest request)
Creates a node.com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata>
createNodeAsync(LocationName parent, Node node, String nodeId)
Creates a node.com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata>
createNodeAsync(String parent, Node node, String nodeId)
Creates a node.com.google.api.gax.rpc.UnaryCallable<CreateNodeRequest,com.google.longrunning.Operation>
createNodeCallable()
Creates a node.com.google.api.gax.rpc.OperationCallable<CreateNodeRequest,Node,OperationMetadata>
createNodeOperationCallable()
Creates a node.com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
createQueuedResourceAsync(CreateQueuedResourceRequest request)
Creates a QueuedResource TPU instance.com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
createQueuedResourceAsync(LocationName parent, QueuedResource queuedResource, String queuedResourceId)
Creates a QueuedResource TPU instance.com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
createQueuedResourceAsync(String parent, QueuedResource queuedResource, String queuedResourceId)
Creates a QueuedResource TPU instance.com.google.api.gax.rpc.UnaryCallable<CreateQueuedResourceRequest,com.google.longrunning.Operation>
createQueuedResourceCallable()
Creates a QueuedResource TPU instance.com.google.api.gax.rpc.OperationCallable<CreateQueuedResourceRequest,QueuedResource,OperationMetadata>
createQueuedResourceOperationCallable()
Creates a QueuedResource TPU instance.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata>
deleteNodeAsync(DeleteNodeRequest request)
Deletes a node.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata>
deleteNodeAsync(NodeName name)
Deletes a node.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata>
deleteNodeAsync(String name)
Deletes a node.com.google.api.gax.rpc.UnaryCallable<DeleteNodeRequest,com.google.longrunning.Operation>
deleteNodeCallable()
Deletes a node.com.google.api.gax.rpc.OperationCallable<DeleteNodeRequest,com.google.protobuf.Empty,OperationMetadata>
deleteNodeOperationCallable()
Deletes a node.com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
deleteQueuedResourceAsync(DeleteQueuedResourceRequest request)
Deletes a QueuedResource TPU instance.com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
deleteQueuedResourceAsync(QueuedResourceName name)
Deletes a QueuedResource TPU instance.com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
deleteQueuedResourceAsync(String name)
Deletes a QueuedResource TPU instance.com.google.api.gax.rpc.UnaryCallable<DeleteQueuedResourceRequest,com.google.longrunning.Operation>
deleteQueuedResourceCallable()
Deletes a QueuedResource TPU instance.com.google.api.gax.rpc.OperationCallable<DeleteQueuedResourceRequest,QueuedResource,OperationMetadata>
deleteQueuedResourceOperationCallable()
Deletes a QueuedResource TPU instance.GenerateServiceIdentityResponse
generateServiceIdentity(GenerateServiceIdentityRequest request)
Generates the Cloud TPU service identity for the project.com.google.api.gax.rpc.UnaryCallable<GenerateServiceIdentityRequest,GenerateServiceIdentityResponse>
generateServiceIdentityCallable()
Generates the Cloud TPU service identity for the project.AcceleratorType
getAcceleratorType(AcceleratorTypeName name)
Gets AcceleratorType.AcceleratorType
getAcceleratorType(GetAcceleratorTypeRequest request)
Gets AcceleratorType.AcceleratorType
getAcceleratorType(String name)
Gets AcceleratorType.com.google.api.gax.rpc.UnaryCallable<GetAcceleratorTypeRequest,AcceleratorType>
getAcceleratorTypeCallable()
Gets AcceleratorType.GetGuestAttributesResponse
getGuestAttributes(GetGuestAttributesRequest request)
Retrieves the guest attributes for the node.com.google.api.gax.rpc.UnaryCallable<GetGuestAttributesRequest,GetGuestAttributesResponse>
getGuestAttributesCallable()
Retrieves the guest attributes for the node.com.google.cloud.location.Location
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>
getLocationCallable()
Gets information about a location.Node
getNode(GetNodeRequest request)
Gets the details of a node.Node
getNode(NodeName name)
Gets the details of a node.Node
getNode(String name)
Gets the details of a node.com.google.api.gax.rpc.UnaryCallable<GetNodeRequest,Node>
getNodeCallable()
Gets the details of a node.com.google.longrunning.OperationsClient
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.QueuedResource
getQueuedResource(GetQueuedResourceRequest request)
Gets details of a queued resource.QueuedResource
getQueuedResource(QueuedResourceName name)
Gets details of a queued resource.QueuedResource
getQueuedResource(String name)
Gets details of a queued resource.com.google.api.gax.rpc.UnaryCallable<GetQueuedResourceRequest,QueuedResource>
getQueuedResourceCallable()
Gets details of a queued resource.RuntimeVersion
getRuntimeVersion(GetRuntimeVersionRequest request)
Gets a runtime version.RuntimeVersion
getRuntimeVersion(RuntimeVersionName name)
Gets a runtime version.RuntimeVersion
getRuntimeVersion(String name)
Gets a runtime version.com.google.api.gax.rpc.UnaryCallable<GetRuntimeVersionRequest,RuntimeVersion>
getRuntimeVersionCallable()
Gets a runtime version.TpuSettings
getSettings()
TpuStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
TpuClient.ListAcceleratorTypesPagedResponse
listAcceleratorTypes(ListAcceleratorTypesRequest request)
Lists accelerator types supported by this API.TpuClient.ListAcceleratorTypesPagedResponse
listAcceleratorTypes(LocationName parent)
Lists accelerator types supported by this API.TpuClient.ListAcceleratorTypesPagedResponse
listAcceleratorTypes(String parent)
Lists accelerator types supported by this API.com.google.api.gax.rpc.UnaryCallable<ListAcceleratorTypesRequest,ListAcceleratorTypesResponse>
listAcceleratorTypesCallable()
Lists accelerator types supported by this API.com.google.api.gax.rpc.UnaryCallable<ListAcceleratorTypesRequest,TpuClient.ListAcceleratorTypesPagedResponse>
listAcceleratorTypesPagedCallable()
Lists accelerator types supported by this API.TpuClient.ListLocationsPagedResponse
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>
listLocationsCallable()
Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,TpuClient.ListLocationsPagedResponse>
listLocationsPagedCallable()
Lists information about the supported locations for this service.TpuClient.ListNodesPagedResponse
listNodes(ListNodesRequest request)
Lists nodes.TpuClient.ListNodesPagedResponse
listNodes(LocationName parent)
Lists nodes.TpuClient.ListNodesPagedResponse
listNodes(String parent)
Lists nodes.com.google.api.gax.rpc.UnaryCallable<ListNodesRequest,ListNodesResponse>
listNodesCallable()
Lists nodes.com.google.api.gax.rpc.UnaryCallable<ListNodesRequest,TpuClient.ListNodesPagedResponse>
listNodesPagedCallable()
Lists nodes.TpuClient.ListQueuedResourcesPagedResponse
listQueuedResources(ListQueuedResourcesRequest request)
Lists queued resources.TpuClient.ListQueuedResourcesPagedResponse
listQueuedResources(LocationName parent)
Lists queued resources.TpuClient.ListQueuedResourcesPagedResponse
listQueuedResources(String parent)
Lists queued resources.com.google.api.gax.rpc.UnaryCallable<ListQueuedResourcesRequest,ListQueuedResourcesResponse>
listQueuedResourcesCallable()
Lists queued resources.com.google.api.gax.rpc.UnaryCallable<ListQueuedResourcesRequest,TpuClient.ListQueuedResourcesPagedResponse>
listQueuedResourcesPagedCallable()
Lists queued resources.TpuClient.ListRuntimeVersionsPagedResponse
listRuntimeVersions(ListRuntimeVersionsRequest request)
Lists runtime versions supported by this API.TpuClient.ListRuntimeVersionsPagedResponse
listRuntimeVersions(LocationName parent)
Lists runtime versions supported by this API.TpuClient.ListRuntimeVersionsPagedResponse
listRuntimeVersions(String parent)
Lists runtime versions supported by this API.com.google.api.gax.rpc.UnaryCallable<ListRuntimeVersionsRequest,ListRuntimeVersionsResponse>
listRuntimeVersionsCallable()
Lists runtime versions supported by this API.com.google.api.gax.rpc.UnaryCallable<ListRuntimeVersionsRequest,TpuClient.ListRuntimeVersionsPagedResponse>
listRuntimeVersionsPagedCallable()
Lists runtime versions supported by this API.com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
resetQueuedResourceAsync(QueuedResourceName name)
Resets a QueuedResource TPU instancecom.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
resetQueuedResourceAsync(ResetQueuedResourceRequest request)
Resets a QueuedResource TPU instancecom.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata>
resetQueuedResourceAsync(String name)
Resets a QueuedResource TPU instancecom.google.api.gax.rpc.UnaryCallable<ResetQueuedResourceRequest,com.google.longrunning.Operation>
resetQueuedResourceCallable()
Resets a QueuedResource TPU instancecom.google.api.gax.rpc.OperationCallable<ResetQueuedResourceRequest,QueuedResource,OperationMetadata>
resetQueuedResourceOperationCallable()
Resets a QueuedResource TPU instancevoid
shutdown()
void
shutdownNow()
com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata>
simulateMaintenanceEventAsync(SimulateMaintenanceEventRequest request)
Simulates a maintenance event.com.google.api.gax.rpc.UnaryCallable<SimulateMaintenanceEventRequest,com.google.longrunning.Operation>
simulateMaintenanceEventCallable()
Simulates a maintenance event.com.google.api.gax.rpc.OperationCallable<SimulateMaintenanceEventRequest,Node,OperationMetadata>
simulateMaintenanceEventOperationCallable()
Simulates a maintenance event.com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata>
startNodeAsync(StartNodeRequest request)
Starts a node.com.google.api.gax.rpc.UnaryCallable<StartNodeRequest,com.google.longrunning.Operation>
startNodeCallable()
Starts a node.com.google.api.gax.rpc.OperationCallable<StartNodeRequest,Node,OperationMetadata>
startNodeOperationCallable()
Starts a node.com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata>
stopNodeAsync(StopNodeRequest request)
Stops a node.com.google.api.gax.rpc.UnaryCallable<StopNodeRequest,com.google.longrunning.Operation>
stopNodeCallable()
Stops a node.com.google.api.gax.rpc.OperationCallable<StopNodeRequest,Node,OperationMetadata>
stopNodeOperationCallable()
Stops a node.com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata>
updateNodeAsync(Node node, com.google.protobuf.FieldMask updateMask)
Updates the configurations of a node.com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata>
updateNodeAsync(UpdateNodeRequest request)
Updates the configurations of a node.com.google.api.gax.rpc.UnaryCallable<UpdateNodeRequest,com.google.longrunning.Operation>
updateNodeCallable()
Updates the configurations of a node.com.google.api.gax.rpc.OperationCallable<UpdateNodeRequest,Node,OperationMetadata>
updateNodeOperationCallable()
Updates the configurations of a node.
-
-
-
Constructor Detail
-
TpuClient
protected TpuClient(TpuSettings settings) throws IOException
Constructs an instance of TpuClient, 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.- Throws:
IOException
-
TpuClient
protected TpuClient(TpuStub stub)
-
-
Method Detail
-
create
public static final TpuClient create() throws IOException
Constructs an instance of TpuClient with default settings.- Throws:
IOException
-
create
public static final TpuClient create(TpuSettings settings) throws IOException
Constructs an instance of TpuClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
public static final TpuClient create(TpuStub stub)
Constructs an instance of TpuClient, using the given stub for making calls. This is for advanced usage - prefer using create(TpuSettings).
-
getSettings
public final TpuSettings getSettings()
-
getStub
public TpuStub getStub()
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
listNodes
public final TpuClient.ListNodesPagedResponse listNodes(LocationName parent)
Lists nodes.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 (TpuClient tpuClient = TpuClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Node element : tpuClient.listNodes(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listNodes
public final TpuClient.ListNodesPagedResponse listNodes(String parent)
Lists nodes.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 (TpuClient tpuClient = TpuClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Node element : tpuClient.listNodes(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listNodes
public final TpuClient.ListNodesPagedResponse listNodes(ListNodesRequest request)
Lists nodes.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 (TpuClient tpuClient = TpuClient.create()) { ListNodesRequest request = ListNodesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Node element : tpuClient.listNodes(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listNodesPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListNodesRequest,TpuClient.ListNodesPagedResponse> listNodesPagedCallable()
Lists nodes.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 (TpuClient tpuClient = TpuClient.create()) { ListNodesRequest request = ListNodesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Node> future = tpuClient.listNodesPagedCallable().futureCall(request); // Do something. for (Node element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listNodesCallable
public final com.google.api.gax.rpc.UnaryCallable<ListNodesRequest,ListNodesResponse> listNodesCallable()
Lists nodes.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 (TpuClient tpuClient = TpuClient.create()) { ListNodesRequest request = ListNodesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListNodesResponse response = tpuClient.listNodesCallable().call(request); for (Node element : response.getNodesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getNode
public final Node getNode(NodeName name)
Gets the details of a node.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 (TpuClient tpuClient = TpuClient.create()) { NodeName name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]"); Node response = tpuClient.getNode(name); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getNode
public final Node getNode(String name)
Gets the details of a node.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 (TpuClient tpuClient = TpuClient.create()) { String name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString(); Node response = tpuClient.getNode(name); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getNode
public final Node getNode(GetNodeRequest request)
Gets the details of a node.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 (TpuClient tpuClient = TpuClient.create()) { GetNodeRequest request = GetNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .build(); Node response = tpuClient.getNode(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getNodeCallable
public final com.google.api.gax.rpc.UnaryCallable<GetNodeRequest,Node> getNodeCallable()
Gets the details of a node.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 (TpuClient tpuClient = TpuClient.create()) { GetNodeRequest request = GetNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .build(); ApiFuture<Node> future = tpuClient.getNodeCallable().futureCall(request); // Do something. Node response = future.get(); }
-
createNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata> createNodeAsync(LocationName parent, Node node, String nodeId)
Creates a node.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 (TpuClient tpuClient = TpuClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Node node = Node.newBuilder().build(); String nodeId = "nodeId-1040171331"; Node response = tpuClient.createNodeAsync(parent, node, nodeId).get(); }
- Parameters:
parent
- Required. The parent resource name.node
- Required. The node.nodeId
- The unqualified resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata> createNodeAsync(String parent, Node node, String nodeId)
Creates a node.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 (TpuClient tpuClient = TpuClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Node node = Node.newBuilder().build(); String nodeId = "nodeId-1040171331"; Node response = tpuClient.createNodeAsync(parent, node, nodeId).get(); }
- Parameters:
parent
- Required. The parent resource name.node
- Required. The node.nodeId
- The unqualified resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata> createNodeAsync(CreateNodeRequest request)
Creates a node.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 (TpuClient tpuClient = TpuClient.create()) { CreateNodeRequest request = CreateNodeRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setNodeId("nodeId-1040171331") .setNode(Node.newBuilder().build()) .setRequestId("requestId693933066") .build(); Node response = tpuClient.createNodeAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createNodeOperationCallable
public final com.google.api.gax.rpc.OperationCallable<CreateNodeRequest,Node,OperationMetadata> createNodeOperationCallable()
Creates a node.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 (TpuClient tpuClient = TpuClient.create()) { CreateNodeRequest request = CreateNodeRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setNodeId("nodeId-1040171331") .setNode(Node.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Node, OperationMetadata> future = tpuClient.createNodeOperationCallable().futureCall(request); // Do something. Node response = future.get(); }
-
createNodeCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateNodeRequest,com.google.longrunning.Operation> createNodeCallable()
Creates a node.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 (TpuClient tpuClient = TpuClient.create()) { CreateNodeRequest request = CreateNodeRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setNodeId("nodeId-1040171331") .setNode(Node.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = tpuClient.createNodeCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
deleteNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteNodeAsync(NodeName name)
Deletes a node.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 (TpuClient tpuClient = TpuClient.create()) { NodeName name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]"); tpuClient.deleteNodeAsync(name).get(); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteNodeAsync(String name)
Deletes a node.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 (TpuClient tpuClient = TpuClient.create()) { String name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString(); tpuClient.deleteNodeAsync(name).get(); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteNodeAsync(DeleteNodeRequest request)
Deletes a node.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 (TpuClient tpuClient = TpuClient.create()) { DeleteNodeRequest request = DeleteNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .setRequestId("requestId693933066") .build(); tpuClient.deleteNodeAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteNodeOperationCallable
public final com.google.api.gax.rpc.OperationCallable<DeleteNodeRequest,com.google.protobuf.Empty,OperationMetadata> deleteNodeOperationCallable()
Deletes a node.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 (TpuClient tpuClient = TpuClient.create()) { DeleteNodeRequest request = DeleteNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .setRequestId("requestId693933066") .build(); OperationFuture<Empty, OperationMetadata> future = tpuClient.deleteNodeOperationCallable().futureCall(request); // Do something. future.get(); }
-
deleteNodeCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteNodeRequest,com.google.longrunning.Operation> deleteNodeCallable()
Deletes a node.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 (TpuClient tpuClient = TpuClient.create()) { DeleteNodeRequest request = DeleteNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = tpuClient.deleteNodeCallable().futureCall(request); // Do something. future.get(); }
-
stopNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata> stopNodeAsync(StopNodeRequest request)
Stops a node. This operation is only available with single TPU nodes.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 (TpuClient tpuClient = TpuClient.create()) { StopNodeRequest request = StopNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .build(); Node response = tpuClient.stopNodeAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
stopNodeOperationCallable
public final com.google.api.gax.rpc.OperationCallable<StopNodeRequest,Node,OperationMetadata> stopNodeOperationCallable()
Stops a node. This operation is only available with single TPU nodes.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 (TpuClient tpuClient = TpuClient.create()) { StopNodeRequest request = StopNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .build(); OperationFuture<Node, OperationMetadata> future = tpuClient.stopNodeOperationCallable().futureCall(request); // Do something. Node response = future.get(); }
-
stopNodeCallable
public final com.google.api.gax.rpc.UnaryCallable<StopNodeRequest,com.google.longrunning.Operation> stopNodeCallable()
Stops a node. This operation is only available with single TPU nodes.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 (TpuClient tpuClient = TpuClient.create()) { StopNodeRequest request = StopNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .build(); ApiFuture<Operation> future = tpuClient.stopNodeCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
startNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata> startNodeAsync(StartNodeRequest request)
Starts a node.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 (TpuClient tpuClient = TpuClient.create()) { StartNodeRequest request = StartNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .build(); Node response = tpuClient.startNodeAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
startNodeOperationCallable
public final com.google.api.gax.rpc.OperationCallable<StartNodeRequest,Node,OperationMetadata> startNodeOperationCallable()
Starts a node.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 (TpuClient tpuClient = TpuClient.create()) { StartNodeRequest request = StartNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .build(); OperationFuture<Node, OperationMetadata> future = tpuClient.startNodeOperationCallable().futureCall(request); // Do something. Node response = future.get(); }
-
startNodeCallable
public final com.google.api.gax.rpc.UnaryCallable<StartNodeRequest,com.google.longrunning.Operation> startNodeCallable()
Starts a node.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 (TpuClient tpuClient = TpuClient.create()) { StartNodeRequest request = StartNodeRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .build(); ApiFuture<Operation> future = tpuClient.startNodeCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
updateNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata> updateNodeAsync(Node node, com.google.protobuf.FieldMask updateMask)
Updates the configurations of a node.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 (TpuClient tpuClient = TpuClient.create()) { Node node = Node.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Node response = tpuClient.updateNodeAsync(node, updateMask).get(); }
- Parameters:
node
- Required. The node. Only fields specified in update_mask are updated.updateMask
- Required. Mask of fields from [Node][Tpu.Node] to update. Supported fields: [description, tags, labels, metadata, network_config.enable_external_ips].- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateNodeAsync
public final com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata> updateNodeAsync(UpdateNodeRequest request)
Updates the configurations of a node.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 (TpuClient tpuClient = TpuClient.create()) { UpdateNodeRequest request = UpdateNodeRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setNode(Node.newBuilder().build()) .build(); Node response = tpuClient.updateNodeAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateNodeOperationCallable
public final com.google.api.gax.rpc.OperationCallable<UpdateNodeRequest,Node,OperationMetadata> updateNodeOperationCallable()
Updates the configurations of a node.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 (TpuClient tpuClient = TpuClient.create()) { UpdateNodeRequest request = UpdateNodeRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setNode(Node.newBuilder().build()) .build(); OperationFuture<Node, OperationMetadata> future = tpuClient.updateNodeOperationCallable().futureCall(request); // Do something. Node response = future.get(); }
-
updateNodeCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateNodeRequest,com.google.longrunning.Operation> updateNodeCallable()
Updates the configurations of a node.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 (TpuClient tpuClient = TpuClient.create()) { UpdateNodeRequest request = UpdateNodeRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setNode(Node.newBuilder().build()) .build(); ApiFuture<Operation> future = tpuClient.updateNodeCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
listQueuedResources
public final TpuClient.ListQueuedResourcesPagedResponse listQueuedResources(LocationName parent)
Lists queued resources.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 (TpuClient tpuClient = TpuClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (QueuedResource element : tpuClient.listQueuedResources(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listQueuedResources
public final TpuClient.ListQueuedResourcesPagedResponse listQueuedResources(String parent)
Lists queued resources.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 (TpuClient tpuClient = TpuClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (QueuedResource element : tpuClient.listQueuedResources(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listQueuedResources
public final TpuClient.ListQueuedResourcesPagedResponse listQueuedResources(ListQueuedResourcesRequest request)
Lists queued resources.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 (TpuClient tpuClient = TpuClient.create()) { ListQueuedResourcesRequest request = ListQueuedResourcesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (QueuedResource element : tpuClient.listQueuedResources(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listQueuedResourcesPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListQueuedResourcesRequest,TpuClient.ListQueuedResourcesPagedResponse> listQueuedResourcesPagedCallable()
Lists queued resources.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 (TpuClient tpuClient = TpuClient.create()) { ListQueuedResourcesRequest request = ListQueuedResourcesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<QueuedResource> future = tpuClient.listQueuedResourcesPagedCallable().futureCall(request); // Do something. for (QueuedResource element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listQueuedResourcesCallable
public final com.google.api.gax.rpc.UnaryCallable<ListQueuedResourcesRequest,ListQueuedResourcesResponse> listQueuedResourcesCallable()
Lists queued resources.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 (TpuClient tpuClient = TpuClient.create()) { ListQueuedResourcesRequest request = ListQueuedResourcesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListQueuedResourcesResponse response = tpuClient.listQueuedResourcesCallable().call(request); for (QueuedResource element : response.getQueuedResourcesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getQueuedResource
public final QueuedResource getQueuedResource(QueuedResourceName name)
Gets details of a queued 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 (TpuClient tpuClient = TpuClient.create()) { QueuedResourceName name = QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]"); QueuedResource response = tpuClient.getQueuedResource(name); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getQueuedResource
public final QueuedResource getQueuedResource(String name)
Gets details of a queued 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 (TpuClient tpuClient = TpuClient.create()) { String name = QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString(); QueuedResource response = tpuClient.getQueuedResource(name); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getQueuedResource
public final QueuedResource getQueuedResource(GetQueuedResourceRequest request)
Gets details of a queued 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 (TpuClient tpuClient = TpuClient.create()) { GetQueuedResourceRequest request = GetQueuedResourceRequest.newBuilder() .setName( QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString()) .build(); QueuedResource response = tpuClient.getQueuedResource(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getQueuedResourceCallable
public final com.google.api.gax.rpc.UnaryCallable<GetQueuedResourceRequest,QueuedResource> getQueuedResourceCallable()
Gets details of a queued 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 (TpuClient tpuClient = TpuClient.create()) { GetQueuedResourceRequest request = GetQueuedResourceRequest.newBuilder() .setName( QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString()) .build(); ApiFuture<QueuedResource> future = tpuClient.getQueuedResourceCallable().futureCall(request); // Do something. QueuedResource response = future.get(); }
-
createQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> createQueuedResourceAsync(LocationName parent, QueuedResource queuedResource, String queuedResourceId)
Creates a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); QueuedResource queuedResource = QueuedResource.newBuilder().build(); String queuedResourceId = "queuedResourceId437646236"; QueuedResource response = tpuClient.createQueuedResourceAsync(parent, queuedResource, queuedResourceId).get(); }
- Parameters:
parent
- Required. The parent resource name.queuedResource
- Required. The queued resource.queuedResourceId
- The unqualified resource name. Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> createQueuedResourceAsync(String parent, QueuedResource queuedResource, String queuedResourceId)
Creates a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); QueuedResource queuedResource = QueuedResource.newBuilder().build(); String queuedResourceId = "queuedResourceId437646236"; QueuedResource response = tpuClient.createQueuedResourceAsync(parent, queuedResource, queuedResourceId).get(); }
- Parameters:
parent
- Required. The parent resource name.queuedResource
- Required. The queued resource.queuedResourceId
- The unqualified resource name. Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> createQueuedResourceAsync(CreateQueuedResourceRequest request)
Creates a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { CreateQueuedResourceRequest request = CreateQueuedResourceRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setQueuedResourceId("queuedResourceId437646236") .setQueuedResource(QueuedResource.newBuilder().build()) .setRequestId("requestId693933066") .build(); QueuedResource response = tpuClient.createQueuedResourceAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createQueuedResourceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<CreateQueuedResourceRequest,QueuedResource,OperationMetadata> createQueuedResourceOperationCallable()
Creates a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { CreateQueuedResourceRequest request = CreateQueuedResourceRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setQueuedResourceId("queuedResourceId437646236") .setQueuedResource(QueuedResource.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<QueuedResource, OperationMetadata> future = tpuClient.createQueuedResourceOperationCallable().futureCall(request); // Do something. QueuedResource response = future.get(); }
-
createQueuedResourceCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateQueuedResourceRequest,com.google.longrunning.Operation> createQueuedResourceCallable()
Creates a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { CreateQueuedResourceRequest request = CreateQueuedResourceRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setQueuedResourceId("queuedResourceId437646236") .setQueuedResource(QueuedResource.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = tpuClient.createQueuedResourceCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
deleteQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> deleteQueuedResourceAsync(QueuedResourceName name)
Deletes a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { QueuedResourceName name = QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]"); QueuedResource response = tpuClient.deleteQueuedResourceAsync(name).get(); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> deleteQueuedResourceAsync(String name)
Deletes a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { String name = QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString(); QueuedResource response = tpuClient.deleteQueuedResourceAsync(name).get(); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> deleteQueuedResourceAsync(DeleteQueuedResourceRequest request)
Deletes a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { DeleteQueuedResourceRequest request = DeleteQueuedResourceRequest.newBuilder() .setName( QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString()) .setRequestId("requestId693933066") .setForce(true) .build(); QueuedResource response = tpuClient.deleteQueuedResourceAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteQueuedResourceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<DeleteQueuedResourceRequest,QueuedResource,OperationMetadata> deleteQueuedResourceOperationCallable()
Deletes a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { DeleteQueuedResourceRequest request = DeleteQueuedResourceRequest.newBuilder() .setName( QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString()) .setRequestId("requestId693933066") .setForce(true) .build(); OperationFuture<QueuedResource, OperationMetadata> future = tpuClient.deleteQueuedResourceOperationCallable().futureCall(request); // Do something. QueuedResource response = future.get(); }
-
deleteQueuedResourceCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteQueuedResourceRequest,com.google.longrunning.Operation> deleteQueuedResourceCallable()
Deletes a QueuedResource TPU instance.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 (TpuClient tpuClient = TpuClient.create()) { DeleteQueuedResourceRequest request = DeleteQueuedResourceRequest.newBuilder() .setName( QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString()) .setRequestId("requestId693933066") .setForce(true) .build(); ApiFuture<Operation> future = tpuClient.deleteQueuedResourceCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
resetQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> resetQueuedResourceAsync(QueuedResourceName name)
Resets a QueuedResource TPU instanceSample 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 (TpuClient tpuClient = TpuClient.create()) { QueuedResourceName name = QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]"); QueuedResource response = tpuClient.resetQueuedResourceAsync(name).get(); }
- Parameters:
name
- Required. The name of the queued resource.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
resetQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> resetQueuedResourceAsync(String name)
Resets a QueuedResource TPU instanceSample 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 (TpuClient tpuClient = TpuClient.create()) { String name = QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString(); QueuedResource response = tpuClient.resetQueuedResourceAsync(name).get(); }
- Parameters:
name
- Required. The name of the queued resource.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
resetQueuedResourceAsync
public final com.google.api.gax.longrunning.OperationFuture<QueuedResource,OperationMetadata> resetQueuedResourceAsync(ResetQueuedResourceRequest request)
Resets a QueuedResource TPU instanceSample 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 (TpuClient tpuClient = TpuClient.create()) { ResetQueuedResourceRequest request = ResetQueuedResourceRequest.newBuilder() .setName( QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString()) .build(); QueuedResource response = tpuClient.resetQueuedResourceAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
resetQueuedResourceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<ResetQueuedResourceRequest,QueuedResource,OperationMetadata> resetQueuedResourceOperationCallable()
Resets a QueuedResource TPU instanceSample 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 (TpuClient tpuClient = TpuClient.create()) { ResetQueuedResourceRequest request = ResetQueuedResourceRequest.newBuilder() .setName( QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString()) .build(); OperationFuture<QueuedResource, OperationMetadata> future = tpuClient.resetQueuedResourceOperationCallable().futureCall(request); // Do something. QueuedResource response = future.get(); }
-
resetQueuedResourceCallable
public final com.google.api.gax.rpc.UnaryCallable<ResetQueuedResourceRequest,com.google.longrunning.Operation> resetQueuedResourceCallable()
Resets a QueuedResource TPU instanceSample 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 (TpuClient tpuClient = TpuClient.create()) { ResetQueuedResourceRequest request = ResetQueuedResourceRequest.newBuilder() .setName( QueuedResourceName.of("[PROJECT]", "[LOCATION]", "[QUEUED_RESOURCE]").toString()) .build(); ApiFuture<Operation> future = tpuClient.resetQueuedResourceCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
generateServiceIdentity
public final GenerateServiceIdentityResponse generateServiceIdentity(GenerateServiceIdentityRequest request)
Generates the Cloud TPU service identity for the 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 (TpuClient tpuClient = TpuClient.create()) { GenerateServiceIdentityRequest request = GenerateServiceIdentityRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .build(); GenerateServiceIdentityResponse response = tpuClient.generateServiceIdentity(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
generateServiceIdentityCallable
public final com.google.api.gax.rpc.UnaryCallable<GenerateServiceIdentityRequest,GenerateServiceIdentityResponse> generateServiceIdentityCallable()
Generates the Cloud TPU service identity for the 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 (TpuClient tpuClient = TpuClient.create()) { GenerateServiceIdentityRequest request = GenerateServiceIdentityRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .build(); ApiFuture<GenerateServiceIdentityResponse> future = tpuClient.generateServiceIdentityCallable().futureCall(request); // Do something. GenerateServiceIdentityResponse response = future.get(); }
-
listAcceleratorTypes
public final TpuClient.ListAcceleratorTypesPagedResponse listAcceleratorTypes(LocationName parent)
Lists accelerator types supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (AcceleratorType element : tpuClient.listAcceleratorTypes(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listAcceleratorTypes
public final TpuClient.ListAcceleratorTypesPagedResponse listAcceleratorTypes(String parent)
Lists accelerator types supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (AcceleratorType element : tpuClient.listAcceleratorTypes(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listAcceleratorTypes
public final TpuClient.ListAcceleratorTypesPagedResponse listAcceleratorTypes(ListAcceleratorTypesRequest request)
Lists accelerator types supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { ListAcceleratorTypesRequest request = ListAcceleratorTypesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); for (AcceleratorType element : tpuClient.listAcceleratorTypes(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listAcceleratorTypesPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListAcceleratorTypesRequest,TpuClient.ListAcceleratorTypesPagedResponse> listAcceleratorTypesPagedCallable()
Lists accelerator types supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { ListAcceleratorTypesRequest request = ListAcceleratorTypesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); ApiFuture<AcceleratorType> future = tpuClient.listAcceleratorTypesPagedCallable().futureCall(request); // Do something. for (AcceleratorType element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listAcceleratorTypesCallable
public final com.google.api.gax.rpc.UnaryCallable<ListAcceleratorTypesRequest,ListAcceleratorTypesResponse> listAcceleratorTypesCallable()
Lists accelerator types supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { ListAcceleratorTypesRequest request = ListAcceleratorTypesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); while (true) { ListAcceleratorTypesResponse response = tpuClient.listAcceleratorTypesCallable().call(request); for (AcceleratorType element : response.getAcceleratorTypesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getAcceleratorType
public final AcceleratorType getAcceleratorType(AcceleratorTypeName name)
Gets AcceleratorType.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 (TpuClient tpuClient = TpuClient.create()) { AcceleratorTypeName name = AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]"); AcceleratorType response = tpuClient.getAcceleratorType(name); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getAcceleratorType
public final AcceleratorType getAcceleratorType(String name)
Gets AcceleratorType.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 (TpuClient tpuClient = TpuClient.create()) { String name = AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]").toString(); AcceleratorType response = tpuClient.getAcceleratorType(name); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getAcceleratorType
public final AcceleratorType getAcceleratorType(GetAcceleratorTypeRequest request)
Gets AcceleratorType.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 (TpuClient tpuClient = TpuClient.create()) { GetAcceleratorTypeRequest request = GetAcceleratorTypeRequest.newBuilder() .setName( AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]") .toString()) .build(); AcceleratorType response = tpuClient.getAcceleratorType(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getAcceleratorTypeCallable
public final com.google.api.gax.rpc.UnaryCallable<GetAcceleratorTypeRequest,AcceleratorType> getAcceleratorTypeCallable()
Gets AcceleratorType.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 (TpuClient tpuClient = TpuClient.create()) { GetAcceleratorTypeRequest request = GetAcceleratorTypeRequest.newBuilder() .setName( AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]") .toString()) .build(); ApiFuture<AcceleratorType> future = tpuClient.getAcceleratorTypeCallable().futureCall(request); // Do something. AcceleratorType response = future.get(); }
-
listRuntimeVersions
public final TpuClient.ListRuntimeVersionsPagedResponse listRuntimeVersions(LocationName parent)
Lists runtime versions supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (RuntimeVersion element : tpuClient.listRuntimeVersions(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listRuntimeVersions
public final TpuClient.ListRuntimeVersionsPagedResponse listRuntimeVersions(String parent)
Lists runtime versions supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (RuntimeVersion element : tpuClient.listRuntimeVersions(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listRuntimeVersions
public final TpuClient.ListRuntimeVersionsPagedResponse listRuntimeVersions(ListRuntimeVersionsRequest request)
Lists runtime versions supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { ListRuntimeVersionsRequest request = ListRuntimeVersionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); for (RuntimeVersion element : tpuClient.listRuntimeVersions(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listRuntimeVersionsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListRuntimeVersionsRequest,TpuClient.ListRuntimeVersionsPagedResponse> listRuntimeVersionsPagedCallable()
Lists runtime versions supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { ListRuntimeVersionsRequest request = ListRuntimeVersionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); ApiFuture<RuntimeVersion> future = tpuClient.listRuntimeVersionsPagedCallable().futureCall(request); // Do something. for (RuntimeVersion element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listRuntimeVersionsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListRuntimeVersionsRequest,ListRuntimeVersionsResponse> listRuntimeVersionsCallable()
Lists runtime versions supported by this API.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 (TpuClient tpuClient = TpuClient.create()) { ListRuntimeVersionsRequest request = ListRuntimeVersionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); while (true) { ListRuntimeVersionsResponse response = tpuClient.listRuntimeVersionsCallable().call(request); for (RuntimeVersion element : response.getRuntimeVersionsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getRuntimeVersion
public final RuntimeVersion getRuntimeVersion(RuntimeVersionName name)
Gets a runtime version.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 (TpuClient tpuClient = TpuClient.create()) { RuntimeVersionName name = RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]"); RuntimeVersion response = tpuClient.getRuntimeVersion(name); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRuntimeVersion
public final RuntimeVersion getRuntimeVersion(String name)
Gets a runtime version.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 (TpuClient tpuClient = TpuClient.create()) { String name = RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]").toString(); RuntimeVersion response = tpuClient.getRuntimeVersion(name); }
- Parameters:
name
- Required. The resource name.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRuntimeVersion
public final RuntimeVersion getRuntimeVersion(GetRuntimeVersionRequest request)
Gets a runtime version.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 (TpuClient tpuClient = TpuClient.create()) { GetRuntimeVersionRequest request = GetRuntimeVersionRequest.newBuilder() .setName( RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]").toString()) .build(); RuntimeVersion response = tpuClient.getRuntimeVersion(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRuntimeVersionCallable
public final com.google.api.gax.rpc.UnaryCallable<GetRuntimeVersionRequest,RuntimeVersion> getRuntimeVersionCallable()
Gets a runtime version.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 (TpuClient tpuClient = TpuClient.create()) { GetRuntimeVersionRequest request = GetRuntimeVersionRequest.newBuilder() .setName( RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]").toString()) .build(); ApiFuture<RuntimeVersion> future = tpuClient.getRuntimeVersionCallable().futureCall(request); // Do something. RuntimeVersion response = future.get(); }
-
getGuestAttributes
public final GetGuestAttributesResponse getGuestAttributes(GetGuestAttributesRequest request)
Retrieves the guest attributes for the node.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 (TpuClient tpuClient = TpuClient.create()) { GetGuestAttributesRequest request = GetGuestAttributesRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .setQueryPath("queryPath-1807004403") .addAllWorkerIds(new ArrayList<String>()) .build(); GetGuestAttributesResponse response = tpuClient.getGuestAttributes(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getGuestAttributesCallable
public final com.google.api.gax.rpc.UnaryCallable<GetGuestAttributesRequest,GetGuestAttributesResponse> getGuestAttributesCallable()
Retrieves the guest attributes for the node.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 (TpuClient tpuClient = TpuClient.create()) { GetGuestAttributesRequest request = GetGuestAttributesRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .setQueryPath("queryPath-1807004403") .addAllWorkerIds(new ArrayList<String>()) .build(); ApiFuture<GetGuestAttributesResponse> future = tpuClient.getGuestAttributesCallable().futureCall(request); // Do something. GetGuestAttributesResponse response = future.get(); }
-
simulateMaintenanceEventAsync
public final com.google.api.gax.longrunning.OperationFuture<Node,OperationMetadata> simulateMaintenanceEventAsync(SimulateMaintenanceEventRequest request)
Simulates a maintenance event.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 (TpuClient tpuClient = TpuClient.create()) { SimulateMaintenanceEventRequest request = SimulateMaintenanceEventRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .addAllWorkerIds(new ArrayList<String>()) .build(); Node response = tpuClient.simulateMaintenanceEventAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
simulateMaintenanceEventOperationCallable
public final com.google.api.gax.rpc.OperationCallable<SimulateMaintenanceEventRequest,Node,OperationMetadata> simulateMaintenanceEventOperationCallable()
Simulates a maintenance event.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 (TpuClient tpuClient = TpuClient.create()) { SimulateMaintenanceEventRequest request = SimulateMaintenanceEventRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .addAllWorkerIds(new ArrayList<String>()) .build(); OperationFuture<Node, OperationMetadata> future = tpuClient.simulateMaintenanceEventOperationCallable().futureCall(request); // Do something. Node response = future.get(); }
-
simulateMaintenanceEventCallable
public final com.google.api.gax.rpc.UnaryCallable<SimulateMaintenanceEventRequest,com.google.longrunning.Operation> simulateMaintenanceEventCallable()
Simulates a maintenance event.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 (TpuClient tpuClient = TpuClient.create()) { SimulateMaintenanceEventRequest request = SimulateMaintenanceEventRequest.newBuilder() .setName(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) .addAllWorkerIds(new ArrayList<String>()) .build(); ApiFuture<Operation> future = tpuClient.simulateMaintenanceEventCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
listLocations
public final TpuClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.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 (TpuClient tpuClient = TpuClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : tpuClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listLocationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,TpuClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Lists information about the supported locations for this service.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 (TpuClient tpuClient = TpuClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = tpuClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listLocationsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Lists information about the supported locations for this service.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 (TpuClient tpuClient = TpuClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = tpuClient.listLocationsCallable().call(request); for (Location element : response.getLocationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getLocation
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.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 (TpuClient tpuClient = TpuClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = tpuClient.getLocation(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getLocationCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Gets information about a location.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 (TpuClient tpuClient = TpuClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = tpuClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-