From 739b86ea3a2cd36e1395eade5544030bcb028859 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 20 Sep 2022 09:58:20 -0400 Subject: [PATCH] feat: [tpu] Add Secure Boot support to TPU v2alpha1 API (#8411) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add Secure Boot support to TPU v2alpha1 API PiperOrigin-RevId: 474644226 Source-Link: https://github.com/googleapis/googleapis/commit/f90b329a7eb583a21a20796892b993e91e8ccf34 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ad8763bde676f92a3eb70753ae1cfed0e81387e Copy-Tag: eyJwIjoiamF2YS10cHUvLk93bEJvdC55YW1sIiwiaCI6IjRhZDg3NjNiZGU2NzZmOTJhM2ViNzA3NTNhZTFjZmVkMGU4MTM4N2UifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- java-tpu/README.md | 4 +- .../cloud/tpu/v2alpha1/TpuClientTest.java | 9 + .../cloud/tpu/v2alpha1/CloudTpuProto.java | 327 ++++++----- .../com/google/cloud/tpu/v2alpha1/Node.java | 286 +++++++++ .../cloud/tpu/v2alpha1/NodeOrBuilder.java | 36 ++ .../tpu/v2alpha1/ShieldedInstanceConfig.java | 548 ++++++++++++++++++ .../ShieldedInstanceConfigOrBuilder.java | 38 ++ .../google/cloud/tpu/v2alpha1/cloud_tpu.proto | 11 +- java-tpu/renovate.json | 74 +++ .../tpustubsettings/getnode/SyncGetNode.java | 45 ++ .../SyncCreateSetCredentialsProvider.java | 44 ++ .../create/SyncCreateSetEndpoint.java | 40 ++ .../tpuclient/createnode/AsyncCreateNode.java | 52 ++ .../createnode/AsyncCreateNodeLRO.java | 53 ++ .../tpuclient/createnode/SyncCreateNode.java | 48 ++ .../SyncCreateNodeLocationnameNodeString.java | 44 ++ .../SyncCreateNodeStringNodeString.java | 44 ++ .../tpuclient/deletenode/AsyncDeleteNode.java | 49 ++ .../deletenode/AsyncDeleteNodeLRO.java | 51 ++ .../tpuclient/deletenode/SyncDeleteNode.java | 46 ++ .../deletenode/SyncDeleteNodeNodename.java | 42 ++ .../deletenode/SyncDeleteNodeString.java | 42 ++ .../AsyncGetAcceleratorType.java | 52 ++ .../SyncGetAcceleratorType.java | 48 ++ ...GetAcceleratorTypeAcceleratortypename.java | 43 ++ .../SyncGetAcceleratorTypeString.java | 43 ++ .../v1/tpuclient/getnode/AsyncGetNode.java | 49 ++ .../tpu/v1/tpuclient/getnode/SyncGetNode.java | 46 ++ .../getnode/SyncGetNodeNodename.java | 42 ++ .../tpuclient/getnode/SyncGetNodeString.java | 42 ++ .../AsyncGetTensorFlowVersion.java | 52 ++ .../SyncGetTensorFlowVersion.java | 48 ++ .../SyncGetTensorFlowVersionString.java | 43 ++ ...ensorFlowVersionTensorflowversionname.java | 43 ++ .../AsyncListAcceleratorTypes.java | 58 ++ .../AsyncListAcceleratorTypesPaged.java | 66 +++ .../SyncListAcceleratorTypes.java | 54 ++ ...stAcceleratorTypesAcceleratortypename.java | 45 ++ .../SyncListAcceleratorTypesString.java | 45 ++ .../tpuclient/listnodes/AsyncListNodes.java | 53 ++ .../listnodes/AsyncListNodesPaged.java | 61 ++ .../v1/tpuclient/listnodes/SyncListNodes.java | 50 ++ .../listnodes/SyncListNodesLocationname.java | 44 ++ .../listnodes/SyncListNodesString.java | 44 ++ .../AsyncListTensorFlowVersions.java | 58 ++ .../AsyncListTensorFlowVersionsPaged.java | 66 +++ .../SyncListTensorFlowVersions.java | 54 ++ .../SyncListTensorFlowVersionsString.java | 45 ++ ...nsorFlowVersionsTensorflowversionname.java | 45 ++ .../reimagenode/AsyncReimageNode.java | 49 ++ .../reimagenode/AsyncReimageNodeLRO.java | 51 ++ .../reimagenode/SyncReimageNode.java | 46 ++ .../tpuclient/startnode/AsyncStartNode.java | 45 ++ .../startnode/AsyncStartNodeLRO.java | 47 ++ .../v1/tpuclient/startnode/SyncStartNode.java | 42 ++ .../v1/tpuclient/stopnode/AsyncStopNode.java | 45 ++ .../tpuclient/stopnode/AsyncStopNodeLRO.java | 47 ++ .../v1/tpuclient/stopnode/SyncStopNode.java | 42 ++ .../v1/tpusettings/getnode/SyncGetNode.java | 45 ++ .../tpustubsettings/getnode/SyncGetNode.java | 45 ++ .../SyncCreateSetCredentialsProvider.java | 44 ++ .../create/SyncCreateSetEndpoint.java | 40 ++ .../tpuclient/createnode/AsyncCreateNode.java | 52 ++ .../createnode/AsyncCreateNodeLRO.java | 53 ++ .../tpuclient/createnode/SyncCreateNode.java | 48 ++ .../SyncCreateNodeLocationnameNodeString.java | 44 ++ .../SyncCreateNodeStringNodeString.java | 44 ++ .../tpuclient/deletenode/AsyncDeleteNode.java | 49 ++ .../deletenode/AsyncDeleteNodeLRO.java | 51 ++ .../tpuclient/deletenode/SyncDeleteNode.java | 46 ++ .../deletenode/SyncDeleteNodeNodename.java | 42 ++ .../deletenode/SyncDeleteNodeString.java | 42 ++ .../AsyncGenerateServiceIdentity.java | 50 ++ .../SyncGenerateServiceIdentity.java | 46 ++ .../AsyncGetAcceleratorType.java | 52 ++ .../SyncGetAcceleratorType.java | 48 ++ ...GetAcceleratorTypeAcceleratortypename.java | 43 ++ .../SyncGetAcceleratorTypeString.java | 43 ++ .../AsyncGetGuestAttributes.java | 53 ++ .../SyncGetGuestAttributes.java | 49 ++ .../tpuclient/getnode/AsyncGetNode.java | 49 ++ .../tpuclient/getnode/SyncGetNode.java | 46 ++ .../getnode/SyncGetNodeNodename.java | 42 ++ .../tpuclient/getnode/SyncGetNodeString.java | 42 ++ .../AsyncGetRuntimeVersion.java | 50 ++ .../SyncGetRuntimeVersion.java | 47 ++ ...ncGetRuntimeVersionRuntimeversionname.java | 43 ++ .../SyncGetRuntimeVersionString.java | 43 ++ .../AsyncListAcceleratorTypes.java | 58 ++ .../AsyncListAcceleratorTypesPaged.java | 66 +++ .../SyncListAcceleratorTypes.java | 54 ++ ...stAcceleratorTypesAcceleratortypename.java | 45 ++ .../SyncListAcceleratorTypesString.java | 45 ++ .../tpuclient/listnodes/AsyncListNodes.java | 53 ++ .../listnodes/AsyncListNodesPaged.java | 61 ++ .../tpuclient/listnodes/SyncListNodes.java | 50 ++ .../listnodes/SyncListNodesNodename.java | 44 ++ .../listnodes/SyncListNodesString.java | 44 ++ .../AsyncListRuntimeVersions.java | 57 ++ .../AsyncListRuntimeVersionsPaged.java | 65 +++ .../SyncListRuntimeVersions.java | 53 ++ ...ListRuntimeVersionsRuntimeversionname.java | 45 ++ .../SyncListRuntimeVersionsString.java | 45 ++ .../tpuclient/startnode/AsyncStartNode.java | 45 ++ .../startnode/AsyncStartNodeLRO.java | 47 ++ .../tpuclient/startnode/SyncStartNode.java | 42 ++ .../tpuclient/stopnode/AsyncStopNode.java | 45 ++ .../tpuclient/stopnode/AsyncStopNodeLRO.java | 47 ++ .../tpuclient/stopnode/SyncStopNode.java | 42 ++ .../tpuclient/updatenode/AsyncUpdateNode.java | 51 ++ .../updatenode/AsyncUpdateNodeLRO.java | 52 ++ .../tpuclient/updatenode/SyncUpdateNode.java | 47 ++ .../SyncUpdateNodeNodeFieldmask.java | 43 ++ .../tpusettings/getnode/SyncGetNode.java | 45 ++ 114 files changed, 6210 insertions(+), 158 deletions(-) create mode 100644 java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/ShieldedInstanceConfig.java create mode 100644 java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/ShieldedInstanceConfigOrBuilder.java create mode 100644 java-tpu/renovate.json create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/stub/tpustubsettings/getnode/SyncGetNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/create/SyncCreateSetEndpoint.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/AsyncCreateNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/AsyncCreateNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNodeLocationnameNodeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNodeStringNodeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/AsyncDeleteNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/AsyncDeleteNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNodeNodename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNodeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/AsyncGetAcceleratorType.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorType.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeAcceleratortypename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/AsyncGetNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNodeNodename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNodeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/AsyncGetTensorFlowVersion.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersion.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersionString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersionTensorflowversionname.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypesPaged.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesAcceleratortypename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/AsyncListNodes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/AsyncListNodesPaged.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodesLocationname.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodesString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/AsyncListTensorFlowVersions.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/AsyncListTensorFlowVersionsPaged.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersions.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersionsString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersionsTensorflowversionname.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/AsyncReimageNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/AsyncReimageNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/SyncReimageNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/AsyncStartNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/AsyncStartNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/SyncStartNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/AsyncStopNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/AsyncStopNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/SyncStopNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpusettings/getnode/SyncGetNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/stub/tpustubsettings/getnode/SyncGetNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/create/SyncCreateSetEndpoint.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/AsyncCreateNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/AsyncCreateNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNodeLocationnameNodeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNodeStringNodeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/AsyncDeleteNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/AsyncDeleteNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNodeNodename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNodeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/generateserviceidentity/AsyncGenerateServiceIdentity.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/generateserviceidentity/SyncGenerateServiceIdentity.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/AsyncGetAcceleratorType.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorType.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeAcceleratortypename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getguestattributes/AsyncGetGuestAttributes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getguestattributes/SyncGetGuestAttributes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/AsyncGetNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNodeNodename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNodeString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/AsyncGetRuntimeVersion.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersion.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersionRuntimeversionname.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersionString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypesPaged.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesAcceleratortypename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/AsyncListNodes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/AsyncListNodesPaged.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodes.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodesNodename.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodesString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/AsyncListRuntimeVersions.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/AsyncListRuntimeVersionsPaged.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersions.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersionsRuntimeversionname.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersionsString.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/AsyncStartNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/AsyncStartNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/SyncStartNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/AsyncStopNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/AsyncStopNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/SyncStopNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/AsyncUpdateNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/AsyncUpdateNodeLRO.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/SyncUpdateNode.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/SyncUpdateNodeNodeFieldmask.java create mode 100644 java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpusettings/getnode/SyncGetNode.java diff --git a/java-tpu/README.md b/java-tpu/README.md index d96d1f82f122..796dc4f6b120 100644 --- a/java-tpu/README.md +++ b/java-tpu/README.md @@ -27,13 +27,13 @@ If you are using Maven, add this to your pom.xml file: If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-tpu:2.3.4' +implementation 'com.google.cloud:google-cloud-tpu:2.3.5' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-tpu" % "2.3.4" +libraryDependencies += "com.google.cloud" % "google-cloud-tpu" % "2.3.5" ``` ## Authentication diff --git a/java-tpu/google-cloud-tpu/src/test/java/com/google/cloud/tpu/v2alpha1/TpuClientTest.java b/java-tpu/google-cloud-tpu/src/test/java/com/google/cloud/tpu/v2alpha1/TpuClientTest.java index 7813a46f6e25..79115b13271b 100644 --- a/java-tpu/google-cloud-tpu/src/test/java/com/google/cloud/tpu/v2alpha1/TpuClientTest.java +++ b/java-tpu/google-cloud-tpu/src/test/java/com/google/cloud/tpu/v2alpha1/TpuClientTest.java @@ -197,6 +197,7 @@ public void getNodeTest() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); mockTpu.addResponse(expectedResponse); @@ -251,6 +252,7 @@ public void getNodeTest2() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); mockTpu.addResponse(expectedResponse); @@ -305,6 +307,7 @@ public void createNodeTest() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -373,6 +376,7 @@ public void createNodeTest2() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -441,6 +445,7 @@ public void deleteNodeTest() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -503,6 +508,7 @@ public void deleteNodeTest2() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -565,6 +571,7 @@ public void stopNodeTest() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -627,6 +634,7 @@ public void startNodeTest() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -689,6 +697,7 @@ public void updateNodeTest() throws Exception { .setId(3355) .addAllDataDisks(new ArrayList()) .addAllSymptoms(new ArrayList()) + .setShieldedInstanceConfig(ShieldedInstanceConfig.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() diff --git a/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/CloudTpuProto.java b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/CloudTpuProto.java index 5a61eb6e60f8..ec199bd8634f 100644 --- a/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/CloudTpuProto.java +++ b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/CloudTpuProto.java @@ -167,6 +167,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_tpu_v2alpha1_GetGuestAttributesResponse_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_tpu_v2alpha1_GetGuestAttributesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_tpu_v2alpha1_ShieldedInstanceConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_tpu_v2alpha1_ShieldedInstanceConfig_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -202,7 +206,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "g\022\030\n\013external_ip\030\001 \001(\tB\003\340A\003\"Q\n\rNetworkCo" + "nfig\022\017\n\007network\030\001 \001(\t\022\022\n\nsubnetwork\030\002 \001(" + "\t\022\033\n\023enable_external_ips\030\003 \001(\010\".\n\016Servic" - + "eAccount\022\r\n\005email\030\001 \001(\t\022\r\n\005scope\030\002 \003(\t\"\233" + + "eAccount\022\r\n\005email\030\001 \001(\t\022\r\n\005scope\030\002 \003(\t\"\360" + "\014\n\004Node\022\024\n\004name\030\001 \001(\tB\006\340A\003\340A\005\022\023\n\013descrip" + "tion\030\003 \001(\t\022\035\n\020accelerator_type\030\005 \001(\tB\003\340A" + "\002\0229\n\005state\030\t \001(\0162%.google.cloud.tpu.v2al" @@ -227,160 +231,164 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "_version\030& \001(\0162*.google.cloud.tpu.v2alph" + "a1.Node.ApiVersionB\003\340A\003\0229\n\010symptoms\030\' \003(" + "\0132\".google.cloud.tpu.v2alpha1.SymptomB\003\340" - + "A\003\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" - + "\002 \001(\t:\0028\001\032/\n\rMetadataEntry\022\013\n\003key\030\001 \001(\t\022" - + "\r\n\005value\030\002 \001(\t:\0028\001\"\341\001\n\005State\022\025\n\021STATE_UN" - + "SPECIFIED\020\000\022\014\n\010CREATING\020\001\022\t\n\005READY\020\002\022\016\n\n" - + "RESTARTING\020\003\022\r\n\tREIMAGING\020\004\022\014\n\010DELETING\020" - + "\005\022\r\n\tREPAIRING\020\006\022\013\n\007STOPPED\020\010\022\014\n\010STOPPIN" - + "G\020\t\022\014\n\010STARTING\020\n\022\r\n\tPREEMPTED\020\013\022\016\n\nTERM" - + "INATED\020\014\022\n\n\006HIDING\020\r\022\n\n\006HIDDEN\020\016\022\014\n\010UNHI" - + "DING\020\017\"o\n\006Health\022\026\n\022HEALTH_UNSPECIFIED\020\000" - + "\022\013\n\007HEALTHY\020\001\022\013\n\007TIMEOUT\020\003\022\030\n\024UNHEALTHY_" - + "TENSORFLOW\020\004\022\031\n\025UNHEALTHY_MAINTENANCE\020\005\"" - + "O\n\nApiVersion\022\033\n\027API_VERSION_UNSPECIFIED" - + "\020\000\022\r\n\tV1_ALPHA1\020\001\022\006\n\002V1\020\002\022\r\n\tV2_ALPHA1\020\003" - + ":R\352AO\n\027tpu.googleapis.com/Node\0224projects" - + "/{project}/locations/{location}/nodes/{n" - + "ode}\"j\n\020ListNodesRequest\022/\n\006parent\030\001 \001(\t" - + "B\037\340A\002\372A\031\n\027tpu.googleapis.com/Node\022\021\n\tpag" - + "e_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\"q\n\021List" - + "NodesResponse\022.\n\005nodes\030\001 \003(\0132\037.google.cl" - + "oud.tpu.v2alpha1.Node\022\027\n\017next_page_token" - + "\030\002 \001(\t\022\023\n\013unreachable\030\003 \003(\t\"?\n\016GetNodeRe" - + "quest\022-\n\004name\030\001 \001(\tB\037\340A\002\372A\031\n\027tpu.googlea" - + "pis.com/Node\"\223\001\n\021CreateNodeRequest\0229\n\006pa" - + "rent\030\001 \001(\tB)\340A\002\372A#\n!locations.googleapis" - + ".com/Location\022\017\n\007node_id\030\002 \001(\t\0222\n\004node\030\003" - + " \001(\0132\037.google.cloud.tpu.v2alpha1.NodeB\003\340" - + "A\002\"B\n\021DeleteNodeRequest\022-\n\004name\030\001 \001(\tB\037\340" - + "A\002\372A\031\n\027tpu.googleapis.com/Node\"\037\n\017StopNo" - + "deRequest\022\014\n\004name\030\001 \001(\t\" \n\020StartNodeRequ" - + "est\022\014\n\004name\030\001 \001(\t\"}\n\021UpdateNodeRequest\0224" - + "\n\013update_mask\030\001 \001(\0132\032.google.protobuf.Fi" - + "eldMaskB\003\340A\002\0222\n\004node\030\002 \001(\0132\037.google.clou" - + "d.tpu.v2alpha1.NodeB\003\340A\002\" \n\017ServiceIdent" - + "ity\022\r\n\005email\030\001 \001(\t\"[\n\036GenerateServiceIde" - + "ntityRequest\0229\n\006parent\030\001 \001(\tB)\340A\002\372A#\n!lo" - + "cations.googleapis.com/Location\"_\n\037Gener" - + "ateServiceIdentityResponse\022<\n\010identity\030\001" - + " \001(\0132*.google.cloud.tpu.v2alpha1.Service" - + "Identity\"\243\001\n\017AcceleratorType\022\014\n\004name\030\001 \001" - + "(\t\022\014\n\004type\030\002 \001(\t:t\352Aq\n\"tpu.googleapis.co" - + "m/AcceleratorType\022Kprojects/{project}/lo" - + "cations/{location}/acceleratorTypes/{acc" - + "elerator_type}\"U\n\031GetAcceleratorTypeRequ" - + "est\0228\n\004name\030\001 \001(\tB*\340A\002\372A$\n\"tpu.googleapi" - + "s.com/AcceleratorType\"\242\001\n\033ListAccelerato" - + "rTypesRequest\022:\n\006parent\030\001 \001(\tB*\340A\002\372A$\n\"t" - + "pu.googleapis.com/AcceleratorType\022\021\n\tpag" - + "e_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\022\016\n\006filt" - + "er\030\005 \001(\t\022\020\n\010order_by\030\006 \001(\t\"\223\001\n\034ListAccel" - + "eratorTypesResponse\022E\n\021accelerator_types" - + "\030\001 \003(\0132*.google.cloud.tpu.v2alpha1.Accel" - + "eratorType\022\027\n\017next_page_token\030\002 \001(\t\022\023\n\013u" - + "nreachable\030\003 \003(\t\"\326\001\n\021OperationMetadata\022/" - + "\n\013create_time\030\001 \001(\0132\032.google.protobuf.Ti" - + "mestamp\022,\n\010end_time\030\002 \001(\0132\032.google.proto" - + "buf.Timestamp\022\016\n\006target\030\003 \001(\t\022\014\n\004verb\030\004 " - + "\001(\t\022\025\n\rstatus_detail\030\005 \001(\t\022\030\n\020cancel_req" - + "uested\030\006 \001(\010\022\023\n\013api_version\030\007 \001(\t\"\242\001\n\016Ru" - + "ntimeVersion\022\014\n\004name\030\001 \001(\t\022\017\n\007version\030\002 " - + "\001(\t:q\352An\n!tpu.googleapis.com/RuntimeVers" - + "ion\022Iprojects/{project}/locations/{locat" - + "ion}/runtimeVersions/{runtime_version}\"S" - + "\n\030GetRuntimeVersionRequest\0227\n\004name\030\001 \001(\t" - + "B)\340A\002\372A#\n!tpu.googleapis.com/RuntimeVers" - + "ion\"\240\001\n\032ListRuntimeVersionsRequest\0229\n\006pa" - + "rent\030\001 \001(\tB)\340A\002\372A#\n!tpu.googleapis.com/R" - + "untimeVersion\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage" - + "_token\030\003 \001(\t\022\016\n\006filter\030\005 \001(\t\022\020\n\010order_by" - + "\030\006 \001(\t\"\220\001\n\033ListRuntimeVersionsResponse\022C" - + "\n\020runtime_versions\030\001 \003(\0132).google.cloud." - + "tpu.v2alpha1.RuntimeVersion\022\027\n\017next_page" - + "_token\030\002 \001(\t\022\023\n\013unreachable\030\003 \003(\t\"\313\002\n\007Sy" - + "mptom\022/\n\013create_time\030\001 \001(\0132\032.google.prot" - + "obuf.Timestamp\022D\n\014symptom_type\030\002 \001(\0162..g" - + "oogle.cloud.tpu.v2alpha1.Symptom.Symptom" - + "Type\022\017\n\007details\030\003 \001(\t\022\021\n\tworker_id\030\004 \001(\t" - + "\"\244\001\n\013SymptomType\022\034\n\030SYMPTOM_TYPE_UNSPECI" - + "FIED\020\000\022\016\n\nLOW_MEMORY\020\001\022\021\n\rOUT_OF_MEMORY\020" - + "\002\022\025\n\021EXECUTE_TIMED_OUT\020\003\022\023\n\017MESH_BUILD_F" - + "AIL\020\004\022\025\n\021HBM_OUT_OF_MEMORY\020\005\022\021\n\rPROJECT_" - + "ABUSE\020\006\"r\n\031GetGuestAttributesRequest\022-\n\004" - + "name\030\001 \001(\tB\037\340A\002\372A\031\n\027tpu.googleapis.com/N" - + "ode\022\022\n\nquery_path\030\002 \001(\t\022\022\n\nworker_ids\030\003 " - + "\003(\t\"b\n\032GetGuestAttributesResponse\022D\n\020gue" - + "st_attributes\030\001 \003(\0132*.google.cloud.tpu.v" - + "2alpha1.GuestAttributes2\263\024\n\003Tpu\022\250\001\n\tList" - + "Nodes\022+.google.cloud.tpu.v2alpha1.ListNo" - + "desRequest\032,.google.cloud.tpu.v2alpha1.L" - + "istNodesResponse\"@\202\323\344\223\0021\022//v2alpha1/{par" - + "ent=projects/*/locations/*}/nodes\332A\006pare" - + "nt\022\225\001\n\007GetNode\022).google.cloud.tpu.v2alph" - + "a1.GetNodeRequest\032\037.google.cloud.tpu.v2a" - + "lpha1.Node\">\202\323\344\223\0021\022//v2alpha1/{name=proj" - + "ects/*/locations/*/nodes/*}\332A\004name\022\312\001\n\nC" - + "reateNode\022,.google.cloud.tpu.v2alpha1.Cr" - + "eateNodeRequest\032\035.google.longrunning.Ope" - + "ration\"o\202\323\344\223\0027\"//v2alpha1/{parent=projec" - + "ts/*/locations/*}/nodes:\004node\332A\023parent,n" - + "ode,node_id\312A\031\n\004Node\022\021OperationMetadata\022" - + "\265\001\n\nDeleteNode\022,.google.cloud.tpu.v2alph" - + "a1.DeleteNodeRequest\032\035.google.longrunnin" - + "g.Operation\"Z\202\323\344\223\0021*//v2alpha1/{name=pro" - + "jects/*/locations/*/nodes/*}\332A\004name\312A\031\n\004" - + "Node\022\021OperationMetadata\022\262\001\n\010StopNode\022*.g" - + "oogle.cloud.tpu.v2alpha1.StopNodeRequest" - + "\032\035.google.longrunning.Operation\"[\202\323\344\223\0029\"" - + "4/v2alpha1/{name=projects/*/locations/*/" - + "nodes/*}:stop:\001*\312A\031\n\004Node\022\021OperationMeta" - + "data\022\265\001\n\tStartNode\022+.google.cloud.tpu.v2" - + "alpha1.StartNodeRequest\032\035.google.longrun" - + "ning.Operation\"\\\202\323\344\223\002:\"5/v2alpha1/{name=" - + "projects/*/locations/*/nodes/*}:start:\001*" - + "\312A\031\n\004Node\022\021OperationMetadata\022\314\001\n\nUpdateN" - + "ode\022,.google.cloud.tpu.v2alpha1.UpdateNo" - + "deRequest\032\035.google.longrunning.Operation" - + "\"q\202\323\344\223\002<24/v2alpha1/{node.name=projects/" - + "*/locations/*/nodes/*}:\004node\332A\020node,upda" - + "te_mask\312A\031\n\004Node\022\021OperationMetadata\022\336\001\n\027" - + "GenerateServiceIdentity\0229.google.cloud.t" - + "pu.v2alpha1.GenerateServiceIdentityReque" - + "st\032:.google.cloud.tpu.v2alpha1.GenerateS" - + "erviceIdentityResponse\"L\202\323\344\223\002F\"A/v2alpha" - + "1/{parent=projects/*/locations/*}:genera" - + "teServiceIdentity:\001*\022\324\001\n\024ListAccelerator" - + "Types\0226.google.cloud.tpu.v2alpha1.ListAc" - + "celeratorTypesRequest\0327.google.cloud.tpu" - + ".v2alpha1.ListAcceleratorTypesResponse\"K" - + "\202\323\344\223\002<\022:/v2alpha1/{parent=projects/*/loc" - + "ations/*}/acceleratorTypes\332A\006parent\022\301\001\n\022" - + "GetAcceleratorType\0224.google.cloud.tpu.v2" - + "alpha1.GetAcceleratorTypeRequest\032*.googl" - + "e.cloud.tpu.v2alpha1.AcceleratorType\"I\202\323" - + "\344\223\002<\022:/v2alpha1/{name=projects/*/locatio" - + "ns/*/acceleratorTypes/*}\332A\004name\022\320\001\n\023List" - + "RuntimeVersions\0225.google.cloud.tpu.v2alp" - + "ha1.ListRuntimeVersionsRequest\0326.google." - + "cloud.tpu.v2alpha1.ListRuntimeVersionsRe" - + "sponse\"J\202\323\344\223\002;\0229/v2alpha1/{parent=projec" - + "ts/*/locations/*}/runtimeVersions\332A\006pare" - + "nt\022\275\001\n\021GetRuntimeVersion\0223.google.cloud." - + "tpu.v2alpha1.GetRuntimeVersionRequest\032)." - + "google.cloud.tpu.v2alpha1.RuntimeVersion" - + "\"H\202\323\344\223\002;\0229/v2alpha1/{name=projects/*/loc" - + "ations/*/runtimeVersions/*}\332A\004name\022\320\001\n\022G" - + "etGuestAttributes\0224.google.cloud.tpu.v2a" - + "lpha1.GetGuestAttributesRequest\0325.google" - + ".cloud.tpu.v2alpha1.GetGuestAttributesRe" - + "sponse\"M\202\323\344\223\002G\"B/v2alpha1/{name=projects" - + "/*/locations/*/nodes/*}:getGuestAttribut" - + "es:\001*\032F\312A\022tpu.googleapis.com\322A.https://w" - + "ww.googleapis.com/auth/cloud-platformBn\n" - + "\035com.google.cloud.tpu.v2alpha1B\rCloudTpu" - + "ProtoP\001Z\202\323\344\223\0021\022//" + + "v2alpha1/{name=projects/*/locations/*/no" + + "des/*}\332A\004name\022\312\001\n\nCreateNode\022,.google.cl" + + "oud.tpu.v2alpha1.CreateNodeRequest\032\035.goo" + + "gle.longrunning.Operation\"o\202\323\344\223\0027\"//v2al" + + "pha1/{parent=projects/*/locations/*}/nod" + + "es:\004node\332A\023parent,node,node_id\312A\031\n\004Node\022" + + "\021OperationMetadata\022\265\001\n\nDeleteNode\022,.goog" + + "le.cloud.tpu.v2alpha1.DeleteNodeRequest\032" + + "\035.google.longrunning.Operation\"Z\202\323\344\223\0021*/" + + "/v2alpha1/{name=projects/*/locations/*/n" + + "odes/*}\332A\004name\312A\031\n\004Node\022\021OperationMetada" + + "ta\022\262\001\n\010StopNode\022*.google.cloud.tpu.v2alp" + + "ha1.StopNodeRequest\032\035.google.longrunning" + + ".Operation\"[\202\323\344\223\0029\"4/v2alpha1/{name=proj" + + "ects/*/locations/*/nodes/*}:stop:\001*\312A\031\n\004" + + "Node\022\021OperationMetadata\022\265\001\n\tStartNode\022+." + + "google.cloud.tpu.v2alpha1.StartNodeReque" + + "st\032\035.google.longrunning.Operation\"\\\202\323\344\223\002" + + ":\"5/v2alpha1/{name=projects/*/locations/" + + "*/nodes/*}:start:\001*\312A\031\n\004Node\022\021OperationM" + + "etadata\022\314\001\n\nUpdateNode\022,.google.cloud.tp" + + "u.v2alpha1.UpdateNodeRequest\032\035.google.lo" + + "ngrunning.Operation\"q\202\323\344\223\002<24/v2alpha1/{" + + "node.name=projects/*/locations/*/nodes/*" + + "}:\004node\332A\020node,update_mask\312A\031\n\004Node\022\021Ope" + + "rationMetadata\022\336\001\n\027GenerateServiceIdenti" + + "ty\0229.google.cloud.tpu.v2alpha1.GenerateS" + + "erviceIdentityRequest\032:.google.cloud.tpu" + + ".v2alpha1.GenerateServiceIdentityRespons" + + "e\"L\202\323\344\223\002F\"A/v2alpha1/{parent=projects/*/" + + "locations/*}:generateServiceIdentity:\001*\022" + + "\324\001\n\024ListAcceleratorTypes\0226.google.cloud." + + "tpu.v2alpha1.ListAcceleratorTypesRequest" + + "\0327.google.cloud.tpu.v2alpha1.ListAcceler" + + "atorTypesResponse\"K\202\323\344\223\002<\022:/v2alpha1/{pa" + + "rent=projects/*/locations/*}/accelerator" + + "Types\332A\006parent\022\301\001\n\022GetAcceleratorType\0224." + + "google.cloud.tpu.v2alpha1.GetAccelerator" + + "TypeRequest\032*.google.cloud.tpu.v2alpha1." + + "AcceleratorType\"I\202\323\344\223\002<\022:/v2alpha1/{name" + + "=projects/*/locations/*/acceleratorTypes" + + "/*}\332A\004name\022\320\001\n\023ListRuntimeVersions\0225.goo" + + "gle.cloud.tpu.v2alpha1.ListRuntimeVersio" + + "nsRequest\0326.google.cloud.tpu.v2alpha1.Li" + + "stRuntimeVersionsResponse\"J\202\323\344\223\002;\0229/v2al" + + "pha1/{parent=projects/*/locations/*}/run" + + "timeVersions\332A\006parent\022\275\001\n\021GetRuntimeVers" + + "ion\0223.google.cloud.tpu.v2alpha1.GetRunti" + + "meVersionRequest\032).google.cloud.tpu.v2al" + + "pha1.RuntimeVersion\"H\202\323\344\223\002;\0229/v2alpha1/{" + + "name=projects/*/locations/*/runtimeVersi" + + "ons/*}\332A\004name\022\320\001\n\022GetGuestAttributes\0224.g" + + "oogle.cloud.tpu.v2alpha1.GetGuestAttribu" + + "tesRequest\0325.google.cloud.tpu.v2alpha1.G" + + "etGuestAttributesResponse\"M\202\323\344\223\002G\"B/v2al" + + "pha1/{name=projects/*/locations/*/nodes/" + + "*}:getGuestAttributes:\001*\032F\312A\022tpu.googlea" + + "pis.com\322A.https://www.googleapis.com/aut" + + "h/cloud-platformBn\n\035com.google.cloud.tpu" + + ".v2alpha1B\rCloudTpuProtoP\001Z + * Shielded Instance options. + * + * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + * + * @return Whether the shieldedInstanceConfig field is set. + */ + @java.lang.Override + public boolean hasShieldedInstanceConfig() { + return shieldedInstanceConfig_ != null; + } + /** + * + * + *
+   * Shielded Instance options.
+   * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + * + * @return The shieldedInstanceConfig. + */ + @java.lang.Override + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig getShieldedInstanceConfig() { + return shieldedInstanceConfig_ == null + ? com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.getDefaultInstance() + : shieldedInstanceConfig_; + } + /** + * + * + *
+   * Shielded Instance options.
+   * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + @java.lang.Override + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfigOrBuilder + getShieldedInstanceConfigOrBuilder() { + return getShieldedInstanceConfig(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -2376,6 +2442,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < dataDisks_.size(); i++) { output.writeMessage(41, dataDisks_.get(i)); } + if (shieldedInstanceConfig_ != null) { + output.writeMessage(45, getShieldedInstanceConfig()); + } unknownFields.writeTo(output); } @@ -2466,6 +2535,10 @@ public int getSerializedSize() { for (int i = 0; i < dataDisks_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(41, dataDisks_.get(i)); } + if (shieldedInstanceConfig_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(45, getShieldedInstanceConfig()); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -2513,6 +2586,10 @@ public boolean equals(final java.lang.Object obj) { if (!getDataDisksList().equals(other.getDataDisksList())) return false; if (apiVersion_ != other.apiVersion_) return false; if (!getSymptomsList().equals(other.getSymptomsList())) return false; + if (hasShieldedInstanceConfig() != other.hasShieldedInstanceConfig()) return false; + if (hasShieldedInstanceConfig()) { + if (!getShieldedInstanceConfig().equals(other.getShieldedInstanceConfig())) return false; + } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -2584,6 +2661,10 @@ public int hashCode() { hash = (37 * hash) + SYMPTOMS_FIELD_NUMBER; hash = (53 * hash) + getSymptomsList().hashCode(); } + if (hasShieldedInstanceConfig()) { + hash = (37 * hash) + SHIELDED_INSTANCE_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getShieldedInstanceConfig().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -2822,6 +2903,12 @@ public Builder clear() { } else { symptomsBuilder_.clear(); } + if (shieldedInstanceConfigBuilder_ == null) { + shieldedInstanceConfig_ = null; + } else { + shieldedInstanceConfig_ = null; + shieldedInstanceConfigBuilder_ = null; + } return this; } @@ -2915,6 +3002,11 @@ public com.google.cloud.tpu.v2alpha1.Node buildPartial() { } else { result.symptoms_ = symptomsBuilder_.build(); } + if (shieldedInstanceConfigBuilder_ == null) { + result.shieldedInstanceConfig_ = shieldedInstanceConfig_; + } else { + result.shieldedInstanceConfig_ = shieldedInstanceConfigBuilder_.build(); + } onBuilt(); return result; } @@ -3105,6 +3197,9 @@ public Builder mergeFrom(com.google.cloud.tpu.v2alpha1.Node other) { } } } + if (other.hasShieldedInstanceConfig()) { + mergeShieldedInstanceConfig(other.getShieldedInstanceConfig()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -6603,6 +6698,197 @@ public java.util.List getSymptoms return symptomsBuilder_; } + private com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shieldedInstanceConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig, + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.Builder, + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfigOrBuilder> + shieldedInstanceConfigBuilder_; + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + * + * @return Whether the shieldedInstanceConfig field is set. + */ + public boolean hasShieldedInstanceConfig() { + return shieldedInstanceConfigBuilder_ != null || shieldedInstanceConfig_ != null; + } + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + * + * @return The shieldedInstanceConfig. + */ + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig getShieldedInstanceConfig() { + if (shieldedInstanceConfigBuilder_ == null) { + return shieldedInstanceConfig_ == null + ? com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.getDefaultInstance() + : shieldedInstanceConfig_; + } else { + return shieldedInstanceConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + public Builder setShieldedInstanceConfig( + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig value) { + if (shieldedInstanceConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + shieldedInstanceConfig_ = value; + onChanged(); + } else { + shieldedInstanceConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + public Builder setShieldedInstanceConfig( + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.Builder builderForValue) { + if (shieldedInstanceConfigBuilder_ == null) { + shieldedInstanceConfig_ = builderForValue.build(); + onChanged(); + } else { + shieldedInstanceConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + public Builder mergeShieldedInstanceConfig( + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig value) { + if (shieldedInstanceConfigBuilder_ == null) { + if (shieldedInstanceConfig_ != null) { + shieldedInstanceConfig_ = + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.newBuilder( + shieldedInstanceConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + shieldedInstanceConfig_ = value; + } + onChanged(); + } else { + shieldedInstanceConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + public Builder clearShieldedInstanceConfig() { + if (shieldedInstanceConfigBuilder_ == null) { + shieldedInstanceConfig_ = null; + onChanged(); + } else { + shieldedInstanceConfig_ = null; + shieldedInstanceConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.Builder + getShieldedInstanceConfigBuilder() { + + onChanged(); + return getShieldedInstanceConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfigOrBuilder + getShieldedInstanceConfigOrBuilder() { + if (shieldedInstanceConfigBuilder_ != null) { + return shieldedInstanceConfigBuilder_.getMessageOrBuilder(); + } else { + return shieldedInstanceConfig_ == null + ? com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.getDefaultInstance() + : shieldedInstanceConfig_; + } + } + /** + * + * + *
+     * Shielded Instance options.
+     * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig, + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.Builder, + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfigOrBuilder> + getShieldedInstanceConfigFieldBuilder() { + if (shieldedInstanceConfigBuilder_ == null) { + shieldedInstanceConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig, + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.Builder, + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfigOrBuilder>( + getShieldedInstanceConfig(), getParentForChildren(), isClean()); + shieldedInstanceConfig_ = null; + } + return shieldedInstanceConfigBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/NodeOrBuilder.java b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/NodeOrBuilder.java index 1a3a19dce9af..9bce8749021f 100644 --- a/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/NodeOrBuilder.java +++ b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/NodeOrBuilder.java @@ -798,4 +798,40 @@ java.lang.String getMetadataOrDefault( * */ com.google.cloud.tpu.v2alpha1.SymptomOrBuilder getSymptomsOrBuilder(int index); + + /** + * + * + *
+   * Shielded Instance options.
+   * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + * + * @return Whether the shieldedInstanceConfig field is set. + */ + boolean hasShieldedInstanceConfig(); + /** + * + * + *
+   * Shielded Instance options.
+   * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + * + * @return The shieldedInstanceConfig. + */ + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig getShieldedInstanceConfig(); + /** + * + * + *
+   * Shielded Instance options.
+   * 
+ * + * .google.cloud.tpu.v2alpha1.ShieldedInstanceConfig shielded_instance_config = 45; + */ + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfigOrBuilder + getShieldedInstanceConfigOrBuilder(); } diff --git a/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/ShieldedInstanceConfig.java b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/ShieldedInstanceConfig.java new file mode 100644 index 000000000000..2072549f0340 --- /dev/null +++ b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/ShieldedInstanceConfig.java @@ -0,0 +1,548 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/tpu/v2alpha1/cloud_tpu.proto + +package com.google.cloud.tpu.v2alpha1; + +/** + * + * + *
+ * A set of Shielded Instance options.
+ * 
+ * + * Protobuf type {@code google.cloud.tpu.v2alpha1.ShieldedInstanceConfig} + */ +public final class ShieldedInstanceConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) + ShieldedInstanceConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ShieldedInstanceConfig.newBuilder() to construct. + private ShieldedInstanceConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ShieldedInstanceConfig() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ShieldedInstanceConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ShieldedInstanceConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + enableSecureBoot_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.tpu.v2alpha1.CloudTpuProto + .internal_static_google_cloud_tpu_v2alpha1_ShieldedInstanceConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.tpu.v2alpha1.CloudTpuProto + .internal_static_google_cloud_tpu_v2alpha1_ShieldedInstanceConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.class, + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.Builder.class); + } + + public static final int ENABLE_SECURE_BOOT_FIELD_NUMBER = 1; + private boolean enableSecureBoot_; + /** + * + * + *
+   * Defines whether the instance has Secure Boot enabled.
+   * 
+ * + * bool enable_secure_boot = 1; + * + * @return The enableSecureBoot. + */ + @java.lang.Override + public boolean getEnableSecureBoot() { + return enableSecureBoot_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (enableSecureBoot_ != false) { + output.writeBool(1, enableSecureBoot_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (enableSecureBoot_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, enableSecureBoot_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig)) { + return super.equals(obj); + } + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig other = + (com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) obj; + + if (getEnableSecureBoot() != other.getEnableSecureBoot()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENABLE_SECURE_BOOT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableSecureBoot()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A set of Shielded Instance options.
+   * 
+ * + * Protobuf type {@code google.cloud.tpu.v2alpha1.ShieldedInstanceConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.tpu.v2alpha1.CloudTpuProto + .internal_static_google_cloud_tpu_v2alpha1_ShieldedInstanceConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.tpu.v2alpha1.CloudTpuProto + .internal_static_google_cloud_tpu_v2alpha1_ShieldedInstanceConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.class, + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.Builder.class); + } + + // Construct using com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + enableSecureBoot_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.tpu.v2alpha1.CloudTpuProto + .internal_static_google_cloud_tpu_v2alpha1_ShieldedInstanceConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig getDefaultInstanceForType() { + return com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig build() { + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig buildPartial() { + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig result = + new com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig(this); + result.enableSecureBoot_ = enableSecureBoot_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) { + return mergeFrom((com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig other) { + if (other == com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.getDefaultInstance()) + return this; + if (other.getEnableSecureBoot() != false) { + setEnableSecureBoot(other.getEnableSecureBoot()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean enableSecureBoot_; + /** + * + * + *
+     * Defines whether the instance has Secure Boot enabled.
+     * 
+ * + * bool enable_secure_boot = 1; + * + * @return The enableSecureBoot. + */ + @java.lang.Override + public boolean getEnableSecureBoot() { + return enableSecureBoot_; + } + /** + * + * + *
+     * Defines whether the instance has Secure Boot enabled.
+     * 
+ * + * bool enable_secure_boot = 1; + * + * @param value The enableSecureBoot to set. + * @return This builder for chaining. + */ + public Builder setEnableSecureBoot(boolean value) { + + enableSecureBoot_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Defines whether the instance has Secure Boot enabled.
+     * 
+ * + * bool enable_secure_boot = 1; + * + * @return This builder for chaining. + */ + public Builder clearEnableSecureBoot() { + + enableSecureBoot_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) + private static final com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig(); + } + + public static com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ShieldedInstanceConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ShieldedInstanceConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/ShieldedInstanceConfigOrBuilder.java b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/ShieldedInstanceConfigOrBuilder.java new file mode 100644 index 000000000000..6172d0e72cd5 --- /dev/null +++ b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/java/com/google/cloud/tpu/v2alpha1/ShieldedInstanceConfigOrBuilder.java @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/tpu/v2alpha1/cloud_tpu.proto + +package com.google.cloud.tpu.v2alpha1; + +public interface ShieldedInstanceConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.tpu.v2alpha1.ShieldedInstanceConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Defines whether the instance has Secure Boot enabled.
+   * 
+ * + * bool enable_secure_boot = 1; + * + * @return The enableSecureBoot. + */ + boolean getEnableSecureBoot(); +} diff --git a/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/proto/google/cloud/tpu/v2alpha1/cloud_tpu.proto b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/proto/google/cloud/tpu/v2alpha1/cloud_tpu.proto index d805128fc1cd..612e1c4f5ddb 100644 --- a/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/proto/google/cloud/tpu/v2alpha1/cloud_tpu.proto +++ b/java-tpu/proto-google-cloud-tpu-v2alpha1/src/main/proto/google/cloud/tpu/v2alpha1/cloud_tpu.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -448,6 +448,9 @@ message Node { // Output only. The Symptoms that have occurred to the TPU Node. repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Shielded Instance options. + ShieldedInstanceConfig shielded_instance_config = 45; } // Request for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes]. @@ -780,3 +783,9 @@ message GetGuestAttributesResponse { // The guest attributes for the TPU workers. repeated GuestAttributes guest_attributes = 1; } + +// A set of Shielded Instance options. +message ShieldedInstanceConfig { + // Defines whether the instance has Secure Boot enabled. + bool enable_secure_boot = 1; +} \ No newline at end of file diff --git a/java-tpu/renovate.json b/java-tpu/renovate.json new file mode 100644 index 000000000000..f7a7f1f53969 --- /dev/null +++ b/java-tpu/renovate.json @@ -0,0 +1,74 @@ +{ + "extends": [ + ":separateMajorReleases", + ":combinePatchMinorReleases", + ":ignoreUnstable", + ":prImmediately", + ":updateNotScheduled", + ":automergeDisabled", + ":ignoreModulesAndTests", + ":maintainLockFilesDisabled", + ":autodetectPinVersions" + ], + "packageRules": [ + { + "packagePatterns": [ + "^com.google.guava:" + ], + "versionScheme": "docker" + }, + { + "packagePatterns": [ + "*" + ], + "semanticCommitType": "deps", + "semanticCommitScope": null + }, + { + "packagePatterns": [ + "^org.apache.maven", + "^org.jacoco:", + "^org.codehaus.mojo:", + "^org.sonatype.plugins:", + "^com.coveo:", + "^com.google.cloud:google-cloud-shared-config" + ], + "semanticCommitType": "build", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-tpu", + "^com.google.cloud:libraries-bom", + "^com.google.cloud.samples:shared-configuration" + ], + "semanticCommitType": "chore", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^junit:junit", + "^com.google.truth:truth", + "^org.mockito:mockito-core", + "^org.objenesis:objenesis", + "^com.google.cloud:google-cloud-conformance-tests" + ], + "semanticCommitType": "test", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-" + ], + "ignoreUnstable": false + }, + { + "packagePatterns": [ + "^com.fasterxml.jackson.core" + ], + "groupName": "jackson dependencies" + } + ], + "semanticCommits": true, + "dependencyDashboard": true +} diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/stub/tpustubsettings/getnode/SyncGetNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/stub/tpustubsettings/getnode/SyncGetNode.java new file mode 100644 index 000000000000..b96ed478d45d --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/stub/tpustubsettings/getnode/SyncGetNode.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.stub.samples; + +// [START tpu_v1_generated_tpustubsettings_getnode_sync] +import com.google.cloud.tpu.v1.stub.TpuStubSettings; +import java.time.Duration; + +public class SyncGetNode { + + public static void main(String[] args) throws Exception { + syncGetNode(); + } + + public static void syncGetNode() throws Exception { + // 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 + TpuStubSettings.Builder tpuSettingsBuilder = TpuStubSettings.newBuilder(); + tpuSettingsBuilder + .getNodeSettings() + .setRetrySettings( + tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TpuStubSettings tpuSettings = tpuSettingsBuilder.build(); + } +} +// [END tpu_v1_generated_tpustubsettings_getnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/create/SyncCreateSetCredentialsProvider.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..32d5b4f7ff7f --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.cloud.tpu.v1.TpuSettings; +import com.google.cloud.tpu.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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); + } +} +// [END tpu_v1_generated_tpuclient_create_setcredentialsprovider_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/create/SyncCreateSetEndpoint.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..f19eab4b9342 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_create_setendpoint_sync] +import com.google.cloud.tpu.v1.TpuClient; +import com.google.cloud.tpu.v1.TpuSettings; +import com.google.cloud.tpu.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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); + } +} +// [END tpu_v1_generated_tpuclient_create_setendpoint_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/AsyncCreateNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/AsyncCreateNode.java new file mode 100644 index 000000000000..135808e3a898 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/AsyncCreateNode.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_createnode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.CreateNodeRequest; +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncCreateNode { + + public static void main(String[] args) throws Exception { + asyncCreateNode(); + } + + public static void asyncCreateNode() throws Exception { + // 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()) + .build(); + ApiFuture future = tpuClient.createNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_createnode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/AsyncCreateNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/AsyncCreateNodeLRO.java new file mode 100644 index 000000000000..c119a9a5d150 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/AsyncCreateNodeLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_createnode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v1.CreateNodeRequest; +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.OperationMetadata; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncCreateNodeLRO { + + public static void main(String[] args) throws Exception { + asyncCreateNodeLRO(); + } + + public static void asyncCreateNodeLRO() throws Exception { + // 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()) + .build(); + OperationFuture future = + tpuClient.createNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_createnode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNode.java new file mode 100644 index 000000000000..79e58c793318 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_createnode_sync] +import com.google.cloud.tpu.v1.CreateNodeRequest; +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncCreateNode { + + public static void main(String[] args) throws Exception { + syncCreateNode(); + } + + public static void syncCreateNode() throws Exception { + // 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()) + .build(); + Node response = tpuClient.createNodeAsync(request).get(); + } + } +} +// [END tpu_v1_generated_tpuclient_createnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNodeLocationnameNodeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNodeLocationnameNodeString.java new file mode 100644 index 000000000000..b9d37cbef281 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNodeLocationnameNodeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_createnode_locationnamenodestring_sync] +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncCreateNodeLocationnameNodeString { + + public static void main(String[] args) throws Exception { + syncCreateNodeLocationnameNodeString(); + } + + public static void syncCreateNodeLocationnameNodeString() throws Exception { + // 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(); + } + } +} +// [END tpu_v1_generated_tpuclient_createnode_locationnamenodestring_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNodeStringNodeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNodeStringNodeString.java new file mode 100644 index 000000000000..2be8b6f66174 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/createnode/SyncCreateNodeStringNodeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_createnode_stringnodestring_sync] +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncCreateNodeStringNodeString { + + public static void main(String[] args) throws Exception { + syncCreateNodeStringNodeString(); + } + + public static void syncCreateNodeStringNodeString() throws Exception { + // 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(); + } + } +} +// [END tpu_v1_generated_tpuclient_createnode_stringnodestring_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/AsyncDeleteNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/AsyncDeleteNode.java new file mode 100644 index 000000000000..e208941b885a --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/AsyncDeleteNode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_deletenode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.DeleteNodeRequest; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteNode { + + public static void main(String[] args) throws Exception { + asyncDeleteNode(); + } + + public static void asyncDeleteNode() throws Exception { + // 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()) + .build(); + ApiFuture future = tpuClient.deleteNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_deletenode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/AsyncDeleteNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/AsyncDeleteNodeLRO.java new file mode 100644 index 000000000000..4a27ea1f06c4 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/AsyncDeleteNodeLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_deletenode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v1.DeleteNodeRequest; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.OperationMetadata; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncDeleteNodeLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteNodeLRO(); + } + + public static void asyncDeleteNodeLRO() throws Exception { + // 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()) + .build(); + OperationFuture future = + tpuClient.deleteNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_deletenode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNode.java new file mode 100644 index 000000000000..e4a1668a5ade --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNode.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_deletenode_sync] +import com.google.cloud.tpu.v1.DeleteNodeRequest; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncDeleteNode { + + public static void main(String[] args) throws Exception { + syncDeleteNode(); + } + + public static void syncDeleteNode() throws Exception { + // 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()) + .build(); + Node response = tpuClient.deleteNodeAsync(request).get(); + } + } +} +// [END tpu_v1_generated_tpuclient_deletenode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNodeNodename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNodeNodename.java new file mode 100644 index 000000000000..3648088d21f6 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNodeNodename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_deletenode_nodename_sync] +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncDeleteNodeNodename { + + public static void main(String[] args) throws Exception { + syncDeleteNodeNodename(); + } + + public static void syncDeleteNodeNodename() throws Exception { + // 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.deleteNodeAsync(name).get(); + } + } +} +// [END tpu_v1_generated_tpuclient_deletenode_nodename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNodeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNodeString.java new file mode 100644 index 000000000000..9f6d56cec7bd --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/deletenode/SyncDeleteNodeString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_deletenode_string_sync] +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncDeleteNodeString { + + public static void main(String[] args) throws Exception { + syncDeleteNodeString(); + } + + public static void syncDeleteNodeString() throws Exception { + // 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.deleteNodeAsync(name).get(); + } + } +} +// [END tpu_v1_generated_tpuclient_deletenode_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/AsyncGetAcceleratorType.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/AsyncGetAcceleratorType.java new file mode 100644 index 000000000000..9bc876032e89 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/AsyncGetAcceleratorType.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_getacceleratortype_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.GetAcceleratorTypeRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncGetAcceleratorType { + + public static void main(String[] args) throws Exception { + asyncGetAcceleratorType(); + } + + public static void asyncGetAcceleratorType() throws Exception { + // 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 future = + tpuClient.getAcceleratorTypeCallable().futureCall(request); + // Do something. + AcceleratorType response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_getacceleratortype_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorType.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorType.java new file mode 100644 index 000000000000..315664040774 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorType.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_getacceleratortype_sync] +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.GetAcceleratorTypeRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetAcceleratorType { + + public static void main(String[] args) throws Exception { + syncGetAcceleratorType(); + } + + public static void syncGetAcceleratorType() throws Exception { + // 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); + } + } +} +// [END tpu_v1_generated_tpuclient_getacceleratortype_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeAcceleratortypename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeAcceleratortypename.java new file mode 100644 index 000000000000..cfa3cb6b4b73 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeAcceleratortypename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_getacceleratortype_acceleratortypename_sync] +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetAcceleratorTypeAcceleratortypename { + + public static void main(String[] args) throws Exception { + syncGetAcceleratorTypeAcceleratortypename(); + } + + public static void syncGetAcceleratorTypeAcceleratortypename() throws Exception { + // 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); + } + } +} +// [END tpu_v1_generated_tpuclient_getacceleratortype_acceleratortypename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeString.java new file mode 100644 index 000000000000..dadf40e27cb1 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_getacceleratortype_string_sync] +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetAcceleratorTypeString { + + public static void main(String[] args) throws Exception { + syncGetAcceleratorTypeString(); + } + + public static void syncGetAcceleratorTypeString() throws Exception { + // 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); + } + } +} +// [END tpu_v1_generated_tpuclient_getacceleratortype_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/AsyncGetNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/AsyncGetNode.java new file mode 100644 index 000000000000..5e0a593c75a6 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/AsyncGetNode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_getnode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.GetNodeRequest; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncGetNode { + + public static void main(String[] args) throws Exception { + asyncGetNode(); + } + + public static void asyncGetNode() throws Exception { + // 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 future = tpuClient.getNodeCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_getnode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNode.java new file mode 100644 index 000000000000..8a20b0a299e8 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNode.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_getnode_sync] +import com.google.cloud.tpu.v1.GetNodeRequest; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetNode { + + public static void main(String[] args) throws Exception { + syncGetNode(); + } + + public static void syncGetNode() throws Exception { + // 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); + } + } +} +// [END tpu_v1_generated_tpuclient_getnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNodeNodename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNodeNodename.java new file mode 100644 index 000000000000..669352936062 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNodeNodename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_getnode_nodename_sync] +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetNodeNodename { + + public static void main(String[] args) throws Exception { + syncGetNodeNodename(); + } + + public static void syncGetNodeNodename() throws Exception { + // 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); + } + } +} +// [END tpu_v1_generated_tpuclient_getnode_nodename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNodeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNodeString.java new file mode 100644 index 000000000000..1527e6e0936a --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/getnode/SyncGetNodeString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_getnode_string_sync] +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.NodeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetNodeString { + + public static void main(String[] args) throws Exception { + syncGetNodeString(); + } + + public static void syncGetNodeString() throws Exception { + // 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); + } + } +} +// [END tpu_v1_generated_tpuclient_getnode_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/AsyncGetTensorFlowVersion.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/AsyncGetTensorFlowVersion.java new file mode 100644 index 000000000000..bbf69d561c3d --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/AsyncGetTensorFlowVersion.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_gettensorflowversion_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.GetTensorFlowVersionRequest; +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncGetTensorFlowVersion { + + public static void main(String[] args) throws Exception { + asyncGetTensorFlowVersion(); + } + + public static void asyncGetTensorFlowVersion() throws Exception { + // 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()) { + GetTensorFlowVersionRequest request = + GetTensorFlowVersionRequest.newBuilder() + .setName( + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]") + .toString()) + .build(); + ApiFuture future = + tpuClient.getTensorFlowVersionCallable().futureCall(request); + // Do something. + TensorFlowVersion response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_gettensorflowversion_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersion.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersion.java new file mode 100644 index 000000000000..85247f48a1b4 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersion.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_gettensorflowversion_sync] +import com.google.cloud.tpu.v1.GetTensorFlowVersionRequest; +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetTensorFlowVersion { + + public static void main(String[] args) throws Exception { + syncGetTensorFlowVersion(); + } + + public static void syncGetTensorFlowVersion() throws Exception { + // 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()) { + GetTensorFlowVersionRequest request = + GetTensorFlowVersionRequest.newBuilder() + .setName( + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]") + .toString()) + .build(); + TensorFlowVersion response = tpuClient.getTensorFlowVersion(request); + } + } +} +// [END tpu_v1_generated_tpuclient_gettensorflowversion_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersionString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersionString.java new file mode 100644 index 000000000000..2c70fab7b3ab --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersionString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_gettensorflowversion_string_sync] +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetTensorFlowVersionString { + + public static void main(String[] args) throws Exception { + syncGetTensorFlowVersionString(); + } + + public static void syncGetTensorFlowVersionString() throws Exception { + // 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 = + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]").toString(); + TensorFlowVersion response = tpuClient.getTensorFlowVersion(name); + } + } +} +// [END tpu_v1_generated_tpuclient_gettensorflowversion_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersionTensorflowversionname.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersionTensorflowversionname.java new file mode 100644 index 000000000000..8e1d6cfb6eab --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/gettensorflowversion/SyncGetTensorFlowVersionTensorflowversionname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_gettensorflowversion_tensorflowversionname_sync] +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncGetTensorFlowVersionTensorflowversionname { + + public static void main(String[] args) throws Exception { + syncGetTensorFlowVersionTensorflowversionname(); + } + + public static void syncGetTensorFlowVersionTensorflowversionname() throws Exception { + // 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()) { + TensorFlowVersionName name = + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]"); + TensorFlowVersion response = tpuClient.getTensorFlowVersion(name); + } + } +} +// [END tpu_v1_generated_tpuclient_gettensorflowversion_tensorflowversionname_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypes.java new file mode 100644 index 000000000000..628271b920c7 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypes.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listacceleratortypes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.ListAcceleratorTypesRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncListAcceleratorTypes { + + public static void main(String[] args) throws Exception { + asyncListAcceleratorTypes(); + } + + public static void asyncListAcceleratorTypes() throws Exception { + // 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( + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + tpuClient.listAcceleratorTypesPagedCallable().futureCall(request); + // Do something. + for (AcceleratorType element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listacceleratortypes_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypesPaged.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypesPaged.java new file mode 100644 index 000000000000..7adfc638a723 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypesPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listacceleratortypes_paged_async] +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.ListAcceleratorTypesRequest; +import com.google.cloud.tpu.v1.ListAcceleratorTypesResponse; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.common.base.Strings; + +public class AsyncListAcceleratorTypesPaged { + + public static void main(String[] args) throws Exception { + asyncListAcceleratorTypesPaged(); + } + + public static void asyncListAcceleratorTypesPaged() throws Exception { + // 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( + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]") + .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; + } + } + } + } +} +// [END tpu_v1_generated_tpuclient_listacceleratortypes_paged_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypes.java new file mode 100644 index 000000000000..fc7a5b5d71b6 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypes.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listacceleratortypes_sync] +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.ListAcceleratorTypesRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListAcceleratorTypes { + + public static void main(String[] args) throws Exception { + syncListAcceleratorTypes(); + } + + public static void syncListAcceleratorTypes() throws Exception { + // 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( + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (AcceleratorType element : tpuClient.listAcceleratorTypes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listacceleratortypes_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesAcceleratortypename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesAcceleratortypename.java new file mode 100644 index 000000000000..401ac381de21 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesAcceleratortypename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listacceleratortypes_acceleratortypename_sync] +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListAcceleratorTypesAcceleratortypename { + + public static void main(String[] args) throws Exception { + syncListAcceleratorTypesAcceleratortypename(); + } + + public static void syncListAcceleratorTypesAcceleratortypename() throws Exception { + // 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 parent = + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]"); + for (AcceleratorType element : tpuClient.listAcceleratorTypes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listacceleratortypes_acceleratortypename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesString.java new file mode 100644 index 000000000000..2a343757516c --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listacceleratortypes_string_sync] +import com.google.cloud.tpu.v1.AcceleratorType; +import com.google.cloud.tpu.v1.AcceleratorTypeName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListAcceleratorTypesString { + + public static void main(String[] args) throws Exception { + syncListAcceleratorTypesString(); + } + + public static void syncListAcceleratorTypesString() throws Exception { + // 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 = + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]").toString(); + for (AcceleratorType element : tpuClient.listAcceleratorTypes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listacceleratortypes_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/AsyncListNodes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/AsyncListNodes.java new file mode 100644 index 000000000000..66e789d57314 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/AsyncListNodes.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listnodes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.ListNodesRequest; +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncListNodes { + + public static void main(String[] args) throws Exception { + asyncListNodes(); + } + + public static void asyncListNodes() throws Exception { + // 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 future = tpuClient.listNodesPagedCallable().futureCall(request); + // Do something. + for (Node element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listnodes_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/AsyncListNodesPaged.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/AsyncListNodesPaged.java new file mode 100644 index 000000000000..a979a45575ca --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/AsyncListNodesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listnodes_paged_async] +import com.google.cloud.tpu.v1.ListNodesRequest; +import com.google.cloud.tpu.v1.ListNodesResponse; +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.common.base.Strings; + +public class AsyncListNodesPaged { + + public static void main(String[] args) throws Exception { + asyncListNodesPaged(); + } + + public static void asyncListNodesPaged() throws Exception { + // 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; + } + } + } + } +} +// [END tpu_v1_generated_tpuclient_listnodes_paged_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodes.java new file mode 100644 index 000000000000..cfd2ef7be750 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodes.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listnodes_sync] +import com.google.cloud.tpu.v1.ListNodesRequest; +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListNodes { + + public static void main(String[] args) throws Exception { + syncListNodes(); + } + + public static void syncListNodes() throws Exception { + // 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); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listnodes_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodesLocationname.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodesLocationname.java new file mode 100644 index 000000000000..6cc8ed87b40c --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodesLocationname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listnodes_locationname_sync] +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListNodesLocationname { + + public static void main(String[] args) throws Exception { + syncListNodesLocationname(); + } + + public static void syncListNodesLocationname() throws Exception { + // 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); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listnodes_locationname_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodesString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodesString.java new file mode 100644 index 000000000000..60493c99f2f0 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listnodes/SyncListNodesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listnodes_string_sync] +import com.google.cloud.tpu.v1.LocationName; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListNodesString { + + public static void main(String[] args) throws Exception { + syncListNodesString(); + } + + public static void syncListNodesString() throws Exception { + // 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); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listnodes_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/AsyncListTensorFlowVersions.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/AsyncListTensorFlowVersions.java new file mode 100644 index 000000000000..fced33adb6b4 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/AsyncListTensorFlowVersions.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listtensorflowversions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.ListTensorFlowVersionsRequest; +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncListTensorFlowVersions { + + public static void main(String[] args) throws Exception { + asyncListTensorFlowVersions(); + } + + public static void asyncListTensorFlowVersions() throws Exception { + // 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()) { + ListTensorFlowVersionsRequest request = + ListTensorFlowVersionsRequest.newBuilder() + .setParent( + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + tpuClient.listTensorFlowVersionsPagedCallable().futureCall(request); + // Do something. + for (TensorFlowVersion element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listtensorflowversions_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/AsyncListTensorFlowVersionsPaged.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/AsyncListTensorFlowVersionsPaged.java new file mode 100644 index 000000000000..a052350dedfd --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/AsyncListTensorFlowVersionsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listtensorflowversions_paged_async] +import com.google.cloud.tpu.v1.ListTensorFlowVersionsRequest; +import com.google.cloud.tpu.v1.ListTensorFlowVersionsResponse; +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.common.base.Strings; + +public class AsyncListTensorFlowVersionsPaged { + + public static void main(String[] args) throws Exception { + asyncListTensorFlowVersionsPaged(); + } + + public static void asyncListTensorFlowVersionsPaged() throws Exception { + // 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()) { + ListTensorFlowVersionsRequest request = + ListTensorFlowVersionsRequest.newBuilder() + .setParent( + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListTensorFlowVersionsResponse response = + tpuClient.listTensorFlowVersionsCallable().call(request); + for (TensorFlowVersion element : response.getTensorflowVersionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END tpu_v1_generated_tpuclient_listtensorflowversions_paged_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersions.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersions.java new file mode 100644 index 000000000000..86fc5c6cd069 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersions.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listtensorflowversions_sync] +import com.google.cloud.tpu.v1.ListTensorFlowVersionsRequest; +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListTensorFlowVersions { + + public static void main(String[] args) throws Exception { + syncListTensorFlowVersions(); + } + + public static void syncListTensorFlowVersions() throws Exception { + // 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()) { + ListTensorFlowVersionsRequest request = + ListTensorFlowVersionsRequest.newBuilder() + .setParent( + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (TensorFlowVersion element : tpuClient.listTensorFlowVersions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listtensorflowversions_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersionsString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersionsString.java new file mode 100644 index 000000000000..74551315ed19 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersionsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listtensorflowversions_string_sync] +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListTensorFlowVersionsString { + + public static void main(String[] args) throws Exception { + syncListTensorFlowVersionsString(); + } + + public static void syncListTensorFlowVersionsString() throws Exception { + // 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 = + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]").toString(); + for (TensorFlowVersion element : tpuClient.listTensorFlowVersions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listtensorflowversions_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersionsTensorflowversionname.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersionsTensorflowversionname.java new file mode 100644 index 000000000000..d5318914ccb2 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/listtensorflowversions/SyncListTensorFlowVersionsTensorflowversionname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_listtensorflowversions_tensorflowversionname_sync] +import com.google.cloud.tpu.v1.TensorFlowVersion; +import com.google.cloud.tpu.v1.TensorFlowVersionName; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncListTensorFlowVersionsTensorflowversionname { + + public static void main(String[] args) throws Exception { + syncListTensorFlowVersionsTensorflowversionname(); + } + + public static void syncListTensorFlowVersionsTensorflowversionname() throws Exception { + // 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()) { + TensorFlowVersionName parent = + TensorFlowVersionName.of("[PROJECT]", "[LOCATION]", "[TENSOR_FLOW_VERSION]"); + for (TensorFlowVersion element : tpuClient.listTensorFlowVersions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v1_generated_tpuclient_listtensorflowversions_tensorflowversionname_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/AsyncReimageNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/AsyncReimageNode.java new file mode 100644 index 000000000000..f36cbe5f1c35 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/AsyncReimageNode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_reimagenode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.ReimageNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncReimageNode { + + public static void main(String[] args) throws Exception { + asyncReimageNode(); + } + + public static void asyncReimageNode() throws Exception { + // 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()) { + ReimageNodeRequest request = + ReimageNodeRequest.newBuilder() + .setName("name3373707") + .setTensorflowVersion("tensorflowVersion-470125103") + .build(); + ApiFuture future = tpuClient.reimageNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_reimagenode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/AsyncReimageNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/AsyncReimageNodeLRO.java new file mode 100644 index 000000000000..55c81051b2f0 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/AsyncReimageNodeLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_reimagenode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.OperationMetadata; +import com.google.cloud.tpu.v1.ReimageNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncReimageNodeLRO { + + public static void main(String[] args) throws Exception { + asyncReimageNodeLRO(); + } + + public static void asyncReimageNodeLRO() throws Exception { + // 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()) { + ReimageNodeRequest request = + ReimageNodeRequest.newBuilder() + .setName("name3373707") + .setTensorflowVersion("tensorflowVersion-470125103") + .build(); + OperationFuture future = + tpuClient.reimageNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_reimagenode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/SyncReimageNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/SyncReimageNode.java new file mode 100644 index 000000000000..8e3793b5bbf7 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/reimagenode/SyncReimageNode.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_reimagenode_sync] +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.ReimageNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncReimageNode { + + public static void main(String[] args) throws Exception { + syncReimageNode(); + } + + public static void syncReimageNode() throws Exception { + // 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()) { + ReimageNodeRequest request = + ReimageNodeRequest.newBuilder() + .setName("name3373707") + .setTensorflowVersion("tensorflowVersion-470125103") + .build(); + Node response = tpuClient.reimageNodeAsync(request).get(); + } + } +} +// [END tpu_v1_generated_tpuclient_reimagenode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/AsyncStartNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/AsyncStartNode.java new file mode 100644 index 000000000000..8ce3dcfeb103 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/AsyncStartNode.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_startnode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.StartNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncStartNode { + + public static void main(String[] args) throws Exception { + asyncStartNode(); + } + + public static void asyncStartNode() throws Exception { + // 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("name3373707").build(); + ApiFuture future = tpuClient.startNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_startnode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/AsyncStartNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/AsyncStartNodeLRO.java new file mode 100644 index 000000000000..fc2bb43e4728 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/AsyncStartNodeLRO.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_startnode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.OperationMetadata; +import com.google.cloud.tpu.v1.StartNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncStartNodeLRO { + + public static void main(String[] args) throws Exception { + asyncStartNodeLRO(); + } + + public static void asyncStartNodeLRO() throws Exception { + // 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("name3373707").build(); + OperationFuture future = + tpuClient.startNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_startnode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/SyncStartNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/SyncStartNode.java new file mode 100644 index 000000000000..32e716469c42 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/startnode/SyncStartNode.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_startnode_sync] +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.StartNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncStartNode { + + public static void main(String[] args) throws Exception { + syncStartNode(); + } + + public static void syncStartNode() throws Exception { + // 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("name3373707").build(); + Node response = tpuClient.startNodeAsync(request).get(); + } + } +} +// [END tpu_v1_generated_tpuclient_startnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/AsyncStopNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/AsyncStopNode.java new file mode 100644 index 000000000000..ce4bd5ffb949 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/AsyncStopNode.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_stopnode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v1.StopNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncStopNode { + + public static void main(String[] args) throws Exception { + asyncStopNode(); + } + + public static void asyncStopNode() throws Exception { + // 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("name3373707").build(); + ApiFuture future = tpuClient.stopNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_stopnode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/AsyncStopNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/AsyncStopNodeLRO.java new file mode 100644 index 000000000000..db1ab1cef974 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/AsyncStopNodeLRO.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_stopnode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.OperationMetadata; +import com.google.cloud.tpu.v1.StopNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class AsyncStopNodeLRO { + + public static void main(String[] args) throws Exception { + asyncStopNodeLRO(); + } + + public static void asyncStopNodeLRO() throws Exception { + // 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("name3373707").build(); + OperationFuture future = + tpuClient.stopNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v1_generated_tpuclient_stopnode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/SyncStopNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/SyncStopNode.java new file mode 100644 index 000000000000..ade9a76a8607 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpuclient/stopnode/SyncStopNode.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpuclient_stopnode_sync] +import com.google.cloud.tpu.v1.Node; +import com.google.cloud.tpu.v1.StopNodeRequest; +import com.google.cloud.tpu.v1.TpuClient; + +public class SyncStopNode { + + public static void main(String[] args) throws Exception { + syncStopNode(); + } + + public static void syncStopNode() throws Exception { + // 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("name3373707").build(); + Node response = tpuClient.stopNodeAsync(request).get(); + } + } +} +// [END tpu_v1_generated_tpuclient_stopnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpusettings/getnode/SyncGetNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpusettings/getnode/SyncGetNode.java new file mode 100644 index 000000000000..043c66b8352b --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v1/tpusettings/getnode/SyncGetNode.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v1.samples; + +// [START tpu_v1_generated_tpusettings_getnode_sync] +import com.google.cloud.tpu.v1.TpuSettings; +import java.time.Duration; + +public class SyncGetNode { + + public static void main(String[] args) throws Exception { + syncGetNode(); + } + + public static void syncGetNode() throws Exception { + // 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.Builder tpuSettingsBuilder = TpuSettings.newBuilder(); + tpuSettingsBuilder + .getNodeSettings() + .setRetrySettings( + tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TpuSettings tpuSettings = tpuSettingsBuilder.build(); + } +} +// [END tpu_v1_generated_tpusettings_getnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/stub/tpustubsettings/getnode/SyncGetNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/stub/tpustubsettings/getnode/SyncGetNode.java new file mode 100644 index 000000000000..284d1d908741 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/stub/tpustubsettings/getnode/SyncGetNode.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.stub.samples; + +// [START tpu_v2alpha1_generated_tpustubsettings_getnode_sync] +import com.google.cloud.tpu.v2alpha1.stub.TpuStubSettings; +import java.time.Duration; + +public class SyncGetNode { + + public static void main(String[] args) throws Exception { + syncGetNode(); + } + + public static void syncGetNode() throws Exception { + // 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 + TpuStubSettings.Builder tpuSettingsBuilder = TpuStubSettings.newBuilder(); + tpuSettingsBuilder + .getNodeSettings() + .setRetrySettings( + tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TpuStubSettings tpuSettings = tpuSettingsBuilder.build(); + } +} +// [END tpu_v2alpha1_generated_tpustubsettings_getnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/create/SyncCreateSetCredentialsProvider.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..0d5337d79923 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.cloud.tpu.v2alpha1.TpuSettings; +import com.google.cloud.tpu.v2alpha1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // 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); + } +} +// [END tpu_v2alpha1_generated_tpuclient_create_setcredentialsprovider_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/create/SyncCreateSetEndpoint.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..6dd505fdca01 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_create_setendpoint_sync] +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.cloud.tpu.v2alpha1.TpuSettings; +import com.google.cloud.tpu.v2alpha1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // 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); + } +} +// [END tpu_v2alpha1_generated_tpuclient_create_setendpoint_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/AsyncCreateNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/AsyncCreateNode.java new file mode 100644 index 000000000000..7aebf5a05016 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/AsyncCreateNode.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_createnode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.CreateNodeRequest; +import com.google.cloud.tpu.v2alpha1.LocationName; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncCreateNode { + + public static void main(String[] args) throws Exception { + asyncCreateNode(); + } + + public static void asyncCreateNode() throws Exception { + // 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()) + .build(); + ApiFuture future = tpuClient.createNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_createnode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/AsyncCreateNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/AsyncCreateNodeLRO.java new file mode 100644 index 000000000000..5d949942e44e --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/AsyncCreateNodeLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_createnode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v2alpha1.CreateNodeRequest; +import com.google.cloud.tpu.v2alpha1.LocationName; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.OperationMetadata; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncCreateNodeLRO { + + public static void main(String[] args) throws Exception { + asyncCreateNodeLRO(); + } + + public static void asyncCreateNodeLRO() throws Exception { + // 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()) + .build(); + OperationFuture future = + tpuClient.createNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_createnode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNode.java new file mode 100644 index 000000000000..9c67764c645e --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNode.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_createnode_sync] +import com.google.cloud.tpu.v2alpha1.CreateNodeRequest; +import com.google.cloud.tpu.v2alpha1.LocationName; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncCreateNode { + + public static void main(String[] args) throws Exception { + syncCreateNode(); + } + + public static void syncCreateNode() throws Exception { + // 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()) + .build(); + Node response = tpuClient.createNodeAsync(request).get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_createnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNodeLocationnameNodeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNodeLocationnameNodeString.java new file mode 100644 index 000000000000..1591e3ea6657 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNodeLocationnameNodeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_createnode_locationnamenodestring_sync] +import com.google.cloud.tpu.v2alpha1.LocationName; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncCreateNodeLocationnameNodeString { + + public static void main(String[] args) throws Exception { + syncCreateNodeLocationnameNodeString(); + } + + public static void syncCreateNodeLocationnameNodeString() throws Exception { + // 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(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_createnode_locationnamenodestring_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNodeStringNodeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNodeStringNodeString.java new file mode 100644 index 000000000000..070563aec17e --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/createnode/SyncCreateNodeStringNodeString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_createnode_stringnodestring_sync] +import com.google.cloud.tpu.v2alpha1.LocationName; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncCreateNodeStringNodeString { + + public static void main(String[] args) throws Exception { + syncCreateNodeStringNodeString(); + } + + public static void syncCreateNodeStringNodeString() throws Exception { + // 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(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_createnode_stringnodestring_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/AsyncDeleteNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/AsyncDeleteNode.java new file mode 100644 index 000000000000..b835a28aa180 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/AsyncDeleteNode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_deletenode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.DeleteNodeRequest; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteNode { + + public static void main(String[] args) throws Exception { + asyncDeleteNode(); + } + + public static void asyncDeleteNode() throws Exception { + // 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()) + .build(); + ApiFuture future = tpuClient.deleteNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_deletenode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/AsyncDeleteNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/AsyncDeleteNodeLRO.java new file mode 100644 index 000000000000..cab1b4b6e219 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/AsyncDeleteNodeLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_deletenode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v2alpha1.DeleteNodeRequest; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.OperationMetadata; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncDeleteNodeLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteNodeLRO(); + } + + public static void asyncDeleteNodeLRO() throws Exception { + // 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()) + .build(); + OperationFuture future = + tpuClient.deleteNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_deletenode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNode.java new file mode 100644 index 000000000000..5f510d5f433c --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNode.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_deletenode_sync] +import com.google.cloud.tpu.v2alpha1.DeleteNodeRequest; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncDeleteNode { + + public static void main(String[] args) throws Exception { + syncDeleteNode(); + } + + public static void syncDeleteNode() throws Exception { + // 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()) + .build(); + Node response = tpuClient.deleteNodeAsync(request).get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_deletenode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNodeNodename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNodeNodename.java new file mode 100644 index 000000000000..6ceb4b8c774e --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNodeNodename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_deletenode_nodename_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncDeleteNodeNodename { + + public static void main(String[] args) throws Exception { + syncDeleteNodeNodename(); + } + + public static void syncDeleteNodeNodename() throws Exception { + // 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.deleteNodeAsync(name).get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_deletenode_nodename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNodeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNodeString.java new file mode 100644 index 000000000000..b4d17cd5498e --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/deletenode/SyncDeleteNodeString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_deletenode_string_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncDeleteNodeString { + + public static void main(String[] args) throws Exception { + syncDeleteNodeString(); + } + + public static void syncDeleteNodeString() throws Exception { + // 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.deleteNodeAsync(name).get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_deletenode_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/generateserviceidentity/AsyncGenerateServiceIdentity.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/generateserviceidentity/AsyncGenerateServiceIdentity.java new file mode 100644 index 000000000000..8ceafe852fc6 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/generateserviceidentity/AsyncGenerateServiceIdentity.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_generateserviceidentity_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest; +import com.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse; +import com.google.cloud.tpu.v2alpha1.LocationName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncGenerateServiceIdentity { + + public static void main(String[] args) throws Exception { + asyncGenerateServiceIdentity(); + } + + public static void asyncGenerateServiceIdentity() throws Exception { + // 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 future = + tpuClient.generateServiceIdentityCallable().futureCall(request); + // Do something. + GenerateServiceIdentityResponse response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_generateserviceidentity_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/generateserviceidentity/SyncGenerateServiceIdentity.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/generateserviceidentity/SyncGenerateServiceIdentity.java new file mode 100644 index 000000000000..31e6bbcc50f3 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/generateserviceidentity/SyncGenerateServiceIdentity.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_generateserviceidentity_sync] +import com.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest; +import com.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse; +import com.google.cloud.tpu.v2alpha1.LocationName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGenerateServiceIdentity { + + public static void main(String[] args) throws Exception { + syncGenerateServiceIdentity(); + } + + public static void syncGenerateServiceIdentity() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_generateserviceidentity_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/AsyncGetAcceleratorType.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/AsyncGetAcceleratorType.java new file mode 100644 index 000000000000..28dd94e76fec --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/AsyncGetAcceleratorType.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getacceleratortype_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncGetAcceleratorType { + + public static void main(String[] args) throws Exception { + asyncGetAcceleratorType(); + } + + public static void asyncGetAcceleratorType() throws Exception { + // 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 future = + tpuClient.getAcceleratorTypeCallable().futureCall(request); + // Do something. + AcceleratorType response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getacceleratortype_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorType.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorType.java new file mode 100644 index 000000000000..1740eb187f2c --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorType.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getacceleratortype_sync] +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetAcceleratorType { + + public static void main(String[] args) throws Exception { + syncGetAcceleratorType(); + } + + public static void syncGetAcceleratorType() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getacceleratortype_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeAcceleratortypename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeAcceleratortypename.java new file mode 100644 index 000000000000..94ed84fa7894 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeAcceleratortypename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getacceleratortype_acceleratortypename_sync] +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetAcceleratorTypeAcceleratortypename { + + public static void main(String[] args) throws Exception { + syncGetAcceleratorTypeAcceleratortypename(); + } + + public static void syncGetAcceleratorTypeAcceleratortypename() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getacceleratortype_acceleratortypename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeString.java new file mode 100644 index 000000000000..4949842c6d33 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getacceleratortype/SyncGetAcceleratorTypeString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getacceleratortype_string_sync] +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetAcceleratorTypeString { + + public static void main(String[] args) throws Exception { + syncGetAcceleratorTypeString(); + } + + public static void syncGetAcceleratorTypeString() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getacceleratortype_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getguestattributes/AsyncGetGuestAttributes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getguestattributes/AsyncGetGuestAttributes.java new file mode 100644 index 000000000000..69c495518d84 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getguestattributes/AsyncGetGuestAttributes.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getguestattributes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest; +import com.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import java.util.ArrayList; + +public class AsyncGetGuestAttributes { + + public static void main(String[] args) throws Exception { + asyncGetGuestAttributes(); + } + + public static void asyncGetGuestAttributes() throws Exception { + // 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()) + .build(); + ApiFuture future = + tpuClient.getGuestAttributesCallable().futureCall(request); + // Do something. + GetGuestAttributesResponse response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getguestattributes_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getguestattributes/SyncGetGuestAttributes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getguestattributes/SyncGetGuestAttributes.java new file mode 100644 index 000000000000..23645d3abfab --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getguestattributes/SyncGetGuestAttributes.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getguestattributes_sync] +import com.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest; +import com.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import java.util.ArrayList; + +public class SyncGetGuestAttributes { + + public static void main(String[] args) throws Exception { + syncGetGuestAttributes(); + } + + public static void syncGetGuestAttributes() throws Exception { + // 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()) + .build(); + GetGuestAttributesResponse response = tpuClient.getGuestAttributes(request); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getguestattributes_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/AsyncGetNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/AsyncGetNode.java new file mode 100644 index 000000000000..693d916d8fc8 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/AsyncGetNode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getnode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.GetNodeRequest; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncGetNode { + + public static void main(String[] args) throws Exception { + asyncGetNode(); + } + + public static void asyncGetNode() throws Exception { + // 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 future = tpuClient.getNodeCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getnode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNode.java new file mode 100644 index 000000000000..6c58807c2106 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNode.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getnode_sync] +import com.google.cloud.tpu.v2alpha1.GetNodeRequest; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetNode { + + public static void main(String[] args) throws Exception { + syncGetNode(); + } + + public static void syncGetNode() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNodeNodename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNodeNodename.java new file mode 100644 index 000000000000..64aebf223ed8 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNodeNodename.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getnode_nodename_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetNodeNodename { + + public static void main(String[] args) throws Exception { + syncGetNodeNodename(); + } + + public static void syncGetNodeNodename() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getnode_nodename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNodeString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNodeString.java new file mode 100644 index 000000000000..7841a99ab661 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getnode/SyncGetNodeString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getnode_string_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetNodeString { + + public static void main(String[] args) throws Exception { + syncGetNodeString(); + } + + public static void syncGetNodeString() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getnode_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/AsyncGetRuntimeVersion.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/AsyncGetRuntimeVersion.java new file mode 100644 index 000000000000..d694da43caeb --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/AsyncGetRuntimeVersion.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getruntimeversion_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest; +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncGetRuntimeVersion { + + public static void main(String[] args) throws Exception { + asyncGetRuntimeVersion(); + } + + public static void asyncGetRuntimeVersion() throws Exception { + // 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 future = tpuClient.getRuntimeVersionCallable().futureCall(request); + // Do something. + RuntimeVersion response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getruntimeversion_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersion.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersion.java new file mode 100644 index 000000000000..bfbbf288ffc6 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersion.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getruntimeversion_sync] +import com.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest; +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetRuntimeVersion { + + public static void main(String[] args) throws Exception { + syncGetRuntimeVersion(); + } + + public static void syncGetRuntimeVersion() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getruntimeversion_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersionRuntimeversionname.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersionRuntimeversionname.java new file mode 100644 index 000000000000..181c01f77b7b --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersionRuntimeversionname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getruntimeversion_runtimeversionname_sync] +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetRuntimeVersionRuntimeversionname { + + public static void main(String[] args) throws Exception { + syncGetRuntimeVersionRuntimeversionname(); + } + + public static void syncGetRuntimeVersionRuntimeversionname() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getruntimeversion_runtimeversionname_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersionString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersionString.java new file mode 100644 index 000000000000..92c96e65fff9 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/getruntimeversion/SyncGetRuntimeVersionString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_getruntimeversion_string_sync] +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncGetRuntimeVersionString { + + public static void main(String[] args) throws Exception { + syncGetRuntimeVersionString(); + } + + public static void syncGetRuntimeVersionString() throws Exception { + // 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); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_getruntimeversion_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypes.java new file mode 100644 index 000000000000..8d1337fd6b43 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypes.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listacceleratortypes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncListAcceleratorTypes { + + public static void main(String[] args) throws Exception { + asyncListAcceleratorTypes(); + } + + public static void asyncListAcceleratorTypes() throws Exception { + // 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( + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + tpuClient.listAcceleratorTypesPagedCallable().futureCall(request); + // Do something. + for (AcceleratorType element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listacceleratortypes_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypesPaged.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypesPaged.java new file mode 100644 index 000000000000..5dbe6d57c530 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/AsyncListAcceleratorTypesPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listacceleratortypes_paged_async] +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest; +import com.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.common.base.Strings; + +public class AsyncListAcceleratorTypesPaged { + + public static void main(String[] args) throws Exception { + asyncListAcceleratorTypesPaged(); + } + + public static void asyncListAcceleratorTypesPaged() throws Exception { + // 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( + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]") + .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; + } + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listacceleratortypes_paged_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypes.java new file mode 100644 index 000000000000..d35e98f15ec6 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypes.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listacceleratortypes_sync] +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListAcceleratorTypes { + + public static void main(String[] args) throws Exception { + syncListAcceleratorTypes(); + } + + public static void syncListAcceleratorTypes() throws Exception { + // 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( + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (AcceleratorType element : tpuClient.listAcceleratorTypes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listacceleratortypes_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesAcceleratortypename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesAcceleratortypename.java new file mode 100644 index 000000000000..5d4012985d4d --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesAcceleratortypename.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listacceleratortypes_acceleratortypename_sync] +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListAcceleratorTypesAcceleratortypename { + + public static void main(String[] args) throws Exception { + syncListAcceleratorTypesAcceleratortypename(); + } + + public static void syncListAcceleratorTypesAcceleratortypename() throws Exception { + // 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 parent = + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]"); + for (AcceleratorType element : tpuClient.listAcceleratorTypes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listacceleratortypes_acceleratortypename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesString.java new file mode 100644 index 000000000000..6db1d55b293e --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listacceleratortypes/SyncListAcceleratorTypesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listacceleratortypes_string_sync] +import com.google.cloud.tpu.v2alpha1.AcceleratorType; +import com.google.cloud.tpu.v2alpha1.AcceleratorTypeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListAcceleratorTypesString { + + public static void main(String[] args) throws Exception { + syncListAcceleratorTypesString(); + } + + public static void syncListAcceleratorTypesString() throws Exception { + // 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 = + AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]").toString(); + for (AcceleratorType element : tpuClient.listAcceleratorTypes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listacceleratortypes_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/AsyncListNodes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/AsyncListNodes.java new file mode 100644 index 000000000000..dd2ebcb7937d --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/AsyncListNodes.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listnodes_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.ListNodesRequest; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncListNodes { + + public static void main(String[] args) throws Exception { + asyncListNodes(); + } + + public static void asyncListNodes() throws Exception { + // 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(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = tpuClient.listNodesPagedCallable().futureCall(request); + // Do something. + for (Node element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listnodes_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/AsyncListNodesPaged.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/AsyncListNodesPaged.java new file mode 100644 index 000000000000..87f07997e785 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/AsyncListNodesPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listnodes_paged_async] +import com.google.cloud.tpu.v2alpha1.ListNodesRequest; +import com.google.cloud.tpu.v2alpha1.ListNodesResponse; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.common.base.Strings; + +public class AsyncListNodesPaged { + + public static void main(String[] args) throws Exception { + asyncListNodesPaged(); + } + + public static void asyncListNodesPaged() throws Exception { + // 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(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").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; + } + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listnodes_paged_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodes.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodes.java new file mode 100644 index 000000000000..adf0bf8bb185 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodes.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listnodes_sync] +import com.google.cloud.tpu.v2alpha1.ListNodesRequest; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListNodes { + + public static void main(String[] args) throws Exception { + syncListNodes(); + } + + public static void syncListNodes() throws Exception { + // 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(NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Node element : tpuClient.listNodes(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listnodes_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodesNodename.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodesNodename.java new file mode 100644 index 000000000000..fdccc3a23888 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodesNodename.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listnodes_nodename_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListNodesNodename { + + public static void main(String[] args) throws Exception { + syncListNodesNodename(); + } + + public static void syncListNodesNodename() throws Exception { + // 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 parent = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]"); + for (Node element : tpuClient.listNodes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listnodes_nodename_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodesString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodesString.java new file mode 100644 index 000000000000..528798a43c21 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listnodes/SyncListNodesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listnodes_string_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.NodeName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListNodesString { + + public static void main(String[] args) throws Exception { + syncListNodesString(); + } + + public static void syncListNodesString() throws Exception { + // 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 = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]").toString(); + for (Node element : tpuClient.listNodes(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listnodes_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/AsyncListRuntimeVersions.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/AsyncListRuntimeVersions.java new file mode 100644 index 000000000000..274d7ea22a48 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/AsyncListRuntimeVersions.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listruntimeversions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncListRuntimeVersions { + + public static void main(String[] args) throws Exception { + asyncListRuntimeVersions(); + } + + public static void asyncListRuntimeVersions() throws Exception { + // 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( + RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + tpuClient.listRuntimeVersionsPagedCallable().futureCall(request); + // Do something. + for (RuntimeVersion element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listruntimeversions_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/AsyncListRuntimeVersionsPaged.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/AsyncListRuntimeVersionsPaged.java new file mode 100644 index 000000000000..c2b443aa1b36 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/AsyncListRuntimeVersionsPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listruntimeversions_paged_async] +import com.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; +import com.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.common.base.Strings; + +public class AsyncListRuntimeVersionsPaged { + + public static void main(String[] args) throws Exception { + asyncListRuntimeVersionsPaged(); + } + + public static void asyncListRuntimeVersionsPaged() throws Exception { + // 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( + RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]").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; + } + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listruntimeversions_paged_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersions.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersions.java new file mode 100644 index 000000000000..b411994e46e2 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listruntimeversions_sync] +import com.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListRuntimeVersions { + + public static void main(String[] args) throws Exception { + syncListRuntimeVersions(); + } + + public static void syncListRuntimeVersions() throws Exception { + // 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( + RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (RuntimeVersion element : tpuClient.listRuntimeVersions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listruntimeversions_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersionsRuntimeversionname.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersionsRuntimeversionname.java new file mode 100644 index 000000000000..a336a9ed42a2 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersionsRuntimeversionname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listruntimeversions_runtimeversionname_sync] +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListRuntimeVersionsRuntimeversionname { + + public static void main(String[] args) throws Exception { + syncListRuntimeVersionsRuntimeversionname(); + } + + public static void syncListRuntimeVersionsRuntimeversionname() throws Exception { + // 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 parent = + RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]"); + for (RuntimeVersion element : tpuClient.listRuntimeVersions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listruntimeversions_runtimeversionname_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersionsString.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersionsString.java new file mode 100644 index 000000000000..06ff8ba197dc --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/listruntimeversions/SyncListRuntimeVersionsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_listruntimeversions_string_sync] +import com.google.cloud.tpu.v2alpha1.RuntimeVersion; +import com.google.cloud.tpu.v2alpha1.RuntimeVersionName; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncListRuntimeVersionsString { + + public static void main(String[] args) throws Exception { + syncListRuntimeVersionsString(); + } + + public static void syncListRuntimeVersionsString() throws Exception { + // 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 = + RuntimeVersionName.of("[PROJECT]", "[LOCATION]", "[RUNTIME_VERSION]").toString(); + for (RuntimeVersion element : tpuClient.listRuntimeVersions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_listruntimeversions_string_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/AsyncStartNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/AsyncStartNode.java new file mode 100644 index 000000000000..00ed6e6cb73a --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/AsyncStartNode.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_startnode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.StartNodeRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncStartNode { + + public static void main(String[] args) throws Exception { + asyncStartNode(); + } + + public static void asyncStartNode() throws Exception { + // 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("name3373707").build(); + ApiFuture future = tpuClient.startNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_startnode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/AsyncStartNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/AsyncStartNodeLRO.java new file mode 100644 index 000000000000..d019038fb54e --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/AsyncStartNodeLRO.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_startnode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.OperationMetadata; +import com.google.cloud.tpu.v2alpha1.StartNodeRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncStartNodeLRO { + + public static void main(String[] args) throws Exception { + asyncStartNodeLRO(); + } + + public static void asyncStartNodeLRO() throws Exception { + // 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("name3373707").build(); + OperationFuture future = + tpuClient.startNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_startnode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/SyncStartNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/SyncStartNode.java new file mode 100644 index 000000000000..221c0eb2add2 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/startnode/SyncStartNode.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_startnode_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.StartNodeRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncStartNode { + + public static void main(String[] args) throws Exception { + syncStartNode(); + } + + public static void syncStartNode() throws Exception { + // 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("name3373707").build(); + Node response = tpuClient.startNodeAsync(request).get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_startnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/AsyncStopNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/AsyncStopNode.java new file mode 100644 index 000000000000..b87767742c2d --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/AsyncStopNode.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_stopnode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.StopNodeRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.longrunning.Operation; + +public class AsyncStopNode { + + public static void main(String[] args) throws Exception { + asyncStopNode(); + } + + public static void asyncStopNode() throws Exception { + // 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("name3373707").build(); + ApiFuture future = tpuClient.stopNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_stopnode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/AsyncStopNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/AsyncStopNodeLRO.java new file mode 100644 index 000000000000..d81e1656d1a0 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/AsyncStopNodeLRO.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_stopnode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.OperationMetadata; +import com.google.cloud.tpu.v2alpha1.StopNodeRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class AsyncStopNodeLRO { + + public static void main(String[] args) throws Exception { + asyncStopNodeLRO(); + } + + public static void asyncStopNodeLRO() throws Exception { + // 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("name3373707").build(); + OperationFuture future = + tpuClient.stopNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_stopnode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/SyncStopNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/SyncStopNode.java new file mode 100644 index 000000000000..46b321325163 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/stopnode/SyncStopNode.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_stopnode_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.StopNodeRequest; +import com.google.cloud.tpu.v2alpha1.TpuClient; + +public class SyncStopNode { + + public static void main(String[] args) throws Exception { + syncStopNode(); + } + + public static void syncStopNode() throws Exception { + // 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("name3373707").build(); + Node response = tpuClient.stopNodeAsync(request).get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_stopnode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/AsyncUpdateNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/AsyncUpdateNode.java new file mode 100644 index 000000000000..b743abe71ac2 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/AsyncUpdateNode.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_updatenode_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.cloud.tpu.v2alpha1.UpdateNodeRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateNode { + + public static void main(String[] args) throws Exception { + asyncUpdateNode(); + } + + public static void asyncUpdateNode() throws Exception { + // 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 future = tpuClient.updateNodeCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_updatenode_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/AsyncUpdateNodeLRO.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/AsyncUpdateNodeLRO.java new file mode 100644 index 000000000000..390c057518b9 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/AsyncUpdateNodeLRO.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_updatenode_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.OperationMetadata; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.cloud.tpu.v2alpha1.UpdateNodeRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateNodeLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateNodeLRO(); + } + + public static void asyncUpdateNodeLRO() throws Exception { + // 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 future = + tpuClient.updateNodeOperationCallable().futureCall(request); + // Do something. + Node response = future.get(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_updatenode_lro_async] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/SyncUpdateNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/SyncUpdateNode.java new file mode 100644 index 000000000000..079e952d27ec --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/SyncUpdateNode.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_updatenode_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.cloud.tpu.v2alpha1.UpdateNodeRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateNode { + + public static void main(String[] args) throws Exception { + syncUpdateNode(); + } + + public static void syncUpdateNode() throws Exception { + // 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(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_updatenode_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/SyncUpdateNodeNodeFieldmask.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/SyncUpdateNodeNodeFieldmask.java new file mode 100644 index 000000000000..f0720d17fe0d --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpuclient/updatenode/SyncUpdateNodeNodeFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpuclient_updatenode_nodefieldmask_sync] +import com.google.cloud.tpu.v2alpha1.Node; +import com.google.cloud.tpu.v2alpha1.TpuClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateNodeNodeFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateNodeNodeFieldmask(); + } + + public static void syncUpdateNodeNodeFieldmask() throws Exception { + // 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(); + } + } +} +// [END tpu_v2alpha1_generated_tpuclient_updatenode_nodefieldmask_sync] diff --git a/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpusettings/getnode/SyncGetNode.java b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpusettings/getnode/SyncGetNode.java new file mode 100644 index 000000000000..fa5d928fa292 --- /dev/null +++ b/java-tpu/samples/snippets/generated/com/google/cloud/tpu/v2alpha1/tpusettings/getnode/SyncGetNode.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.tpu.v2alpha1.samples; + +// [START tpu_v2alpha1_generated_tpusettings_getnode_sync] +import com.google.cloud.tpu.v2alpha1.TpuSettings; +import java.time.Duration; + +public class SyncGetNode { + + public static void main(String[] args) throws Exception { + syncGetNode(); + } + + public static void syncGetNode() throws Exception { + // 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.Builder tpuSettingsBuilder = TpuSettings.newBuilder(); + tpuSettingsBuilder + .getNodeSettings() + .setRetrySettings( + tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TpuSettings tpuSettings = tpuSettingsBuilder.build(); + } +} +// [END tpu_v2alpha1_generated_tpusettings_getnode_sync]