From 5142eca2d85edad47fc9ef5b31d2d78e7ff0f4e6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:42:12 +0000 Subject: [PATCH] chore(bazel): Update WORKSPACE files for rules_gapic, gax_java, generator_java versions (#230) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 472750037 Source-Link: https://github.com/googleapis/googleapis/commit/88f2ea3f53b9712f2e04f28f06210f6f77fa7e24 Source-Link: https://github.com/googleapis/googleapis-gen/commit/230a5588306aae18fe8f2a57f14d4039ad72c901 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjMwYTU1ODgzMDZhYWUxOGZlOGYyYTU3ZjE0ZDQwMzlhZDcyYzkwMSJ9 --- .../com/google/cloud/tpu/v1/TpuClient.java | 343 +++++++++++----- .../com/google/cloud/tpu/v1/TpuSettings.java | 12 +- .../com/google/cloud/tpu/v1/package-info.java | 7 +- .../cloud/tpu/v1/stub/TpuStubSettings.java | 12 +- .../google/cloud/tpu/v2alpha1/TpuClient.java | 378 +++++++++++++----- .../cloud/tpu/v2alpha1/TpuSettings.java | 12 +- .../cloud/tpu/v2alpha1/package-info.java | 7 +- .../tpu/v2alpha1/stub/TpuStubSettings.java | 12 +- .../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 +++ 113 files changed, 5584 insertions(+), 234 deletions(-) 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/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuClient.java b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuClient.java index 84fe5b42af7e..6f541fed9c6f 100644 --- a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuClient.java +++ b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuClient.java @@ -46,8 +46,11 @@ * calls that map to API methods. Sample code to get started: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); @@ -83,8 +86,11 @@ *To customize credentials: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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)) @@ -95,8 +101,11 @@ *To customize the endpoint: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); * }@@ -169,8 +178,11 @@ public final OperationsClient getOperationsClient() { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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()) { @@ -195,8 +207,11 @@ public final ListNodesPagedResponse listNodes(LocationName parent) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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()) { @@ -220,8 +235,11 @@ public final ListNodesPagedResponse listNodes(String parent) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -249,8 +267,11 @@ public final ListNodesPagedResponse listNodes(ListNodesRequest request) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -277,8 +298,11 @@ public final UnaryCallablelistNodesPa * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -312,8 +336,11 @@ public final UnaryCallablelistNodesCallabl * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); @@ -336,8 +363,11 @@ public final Node getNode(NodeName name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); @@ -359,8 +389,11 @@ public final Node getNode(String name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -384,8 +417,11 @@ public final Node getNode(GetNodeRequest request) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -408,8 +444,11 @@ public final UnaryCallablegetNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -441,8 +480,11 @@ public final OperationFuturecreateNodeAsync( * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -470,8 +512,11 @@ public final OperationFuturecreateNodeAsync( * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -497,8 +542,11 @@ public final OperationFuturecreateNodeAsync(CreateNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -525,8 +573,11 @@ public final OperationFuturecreateNodeAsync(CreateNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -551,8 +602,11 @@ public final UnaryCallablecreateNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -575,8 +629,11 @@ public final OperationFuturedeleteNodeAsync(NodeName n * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -598,8 +655,11 @@ public final OperationFuturedeleteNodeAsync(String nam * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -623,8 +683,11 @@ public final OperationFuturedeleteNodeAsync(DeleteNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -649,8 +712,11 @@ public final OperationFuturedeleteNodeAsync(DeleteNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -673,8 +739,11 @@ public final UnaryCallabledeleteNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -700,8 +769,11 @@ public final OperationFuturereimageNodeAsync( * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -727,8 +799,11 @@ public final OperationFuturereimageNodeAsync( * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -752,8 +827,11 @@ public final UnaryCallablereimageNodeCallable() * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -774,8 +852,11 @@ public final OperationFuturestopNodeAsync(StopNodeRequ * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); * OperationFuturefuture = @@ -797,8 +878,11 @@ public final OperationFuture stopNodeAsync(StopNodeRequ * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); * ApiFuturefuture = tpuClient.stopNodeCallable().futureCall(request); @@ -818,8 +902,11 @@ public final UnaryCallable stopNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -840,8 +927,11 @@ public final OperationFuturestartNodeAsync(StartNodeRe * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); * OperationFuturefuture = @@ -863,8 +953,11 @@ public final OperationFuture startNodeAsync(StartNodeRe * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); * ApiFuturefuture = tpuClient.startNodeCallable().futureCall(request); @@ -884,8 +977,11 @@ public final UnaryCallable startNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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]"); @@ -914,8 +1010,11 @@ public final ListTensorFlowVersionsPagedResponse listTensorFlowVersions( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -941,8 +1040,11 @@ public final ListTensorFlowVersionsPagedResponse listTensorFlowVersions(String p *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -975,8 +1077,11 @@ public final ListTensorFlowVersionsPagedResponse listTensorFlowVersions( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1009,8 +1114,11 @@ public final ListTensorFlowVersionsPagedResponse listTensorFlowVersions( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1050,8 +1158,11 @@ public final ListTensorFlowVersionsPagedResponse listTensorFlowVersions( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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]"); @@ -1077,8 +1188,11 @@ public final TensorFlowVersion getTensorFlowVersion(TensorFlowVersionName name) *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -1102,8 +1216,11 @@ public final TensorFlowVersion getTensorFlowVersion(String name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1129,8 +1246,11 @@ public final TensorFlowVersion getTensorFlowVersion(GetTensorFlowVersionRequest *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1157,8 +1277,11 @@ public final TensorFlowVersion getTensorFlowVersion(GetTensorFlowVersionRequest *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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]"); @@ -1186,8 +1309,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes(AcceleratorT *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -1213,8 +1339,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes(String paren *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1247,8 +1376,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1281,8 +1413,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1322,8 +1457,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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]"); @@ -1349,8 +1487,11 @@ public final AcceleratorType getAcceleratorType(AcceleratorTypeName name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -1374,8 +1515,11 @@ public final AcceleratorType getAcceleratorType(String name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1401,8 +1545,11 @@ public final AcceleratorType getAcceleratorType(GetAcceleratorTypeRequest reques *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() diff --git a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuSettings.java b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuSettings.java index 05f363e38587..6ad65f50eef2 100644 --- a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuSettings.java +++ b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuSettings.java @@ -56,16 +56,16 @@ *For example, to set the total timeout of getNode to 30 seconds: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() + * tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)) * .build()); * TpuSettings tpuSettings = tpuSettingsBuilder.build(); diff --git a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/package-info.java b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/package-info.java index 20f5e3214c0c..98f17162ac91 100644 --- a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/package-info.java +++ b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/package-info.java @@ -26,8 +26,11 @@ *Sample for TpuClient: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); diff --git a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/stub/TpuStubSettings.java b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/stub/TpuStubSettings.java index 6044b2e4b1c3..a527232ad04e 100644 --- a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/stub/TpuStubSettings.java +++ b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/stub/TpuStubSettings.java @@ -92,16 +92,16 @@ *For example, to set the total timeout of getNode to 30 seconds: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() + * tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)) * .build()); * TpuStubSettings tpuSettings = tpuSettingsBuilder.build(); diff --git a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuClient.java b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuClient.java index ab1fe0afafeb..7a1fbd831549 100644 --- a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuClient.java +++ b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuClient.java @@ -48,8 +48,11 @@ * calls that map to API methods. Sample code to get started: * *{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); @@ -85,8 +88,11 @@ *To customize credentials: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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)) @@ -97,8 +103,11 @@ *To customize the endpoint: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); * }@@ -172,8 +181,11 @@ public final OperationsClient getOperationsClient() { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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()) { @@ -198,8 +210,11 @@ public final ListNodesPagedResponse listNodes(NodeName parent) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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()) { @@ -223,8 +238,11 @@ public final ListNodesPagedResponse listNodes(String parent) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -252,8 +270,11 @@ public final ListNodesPagedResponse listNodes(ListNodesRequest request) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -280,8 +301,11 @@ public final UnaryCallablelistNodesPa * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -315,8 +339,11 @@ public final UnaryCallablelistNodesCallabl * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); @@ -339,8 +366,11 @@ public final Node getNode(NodeName name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); @@ -362,8 +392,11 @@ public final Node getNode(String name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -387,8 +420,11 @@ public final Node getNode(GetNodeRequest request) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -411,8 +447,11 @@ public final UnaryCallablegetNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -444,8 +483,11 @@ public final OperationFuturecreateNodeAsync( * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -473,8 +515,11 @@ public final OperationFuturecreateNodeAsync( * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -500,8 +545,11 @@ public final OperationFuturecreateNodeAsync(CreateNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -528,8 +576,11 @@ public final OperationFuturecreateNodeAsync(CreateNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -554,8 +605,11 @@ public final UnaryCallablecreateNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -578,8 +632,11 @@ public final OperationFuturedeleteNodeAsync(NodeName n * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -601,8 +658,11 @@ public final OperationFuturedeleteNodeAsync(String nam * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -626,8 +686,11 @@ public final OperationFuturedeleteNodeAsync(DeleteNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -652,8 +715,11 @@ public final OperationFuturedeleteNodeAsync(DeleteNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -676,8 +742,11 @@ public final UnaryCallabledeleteNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -698,8 +767,11 @@ public final OperationFuturestopNodeAsync(StopNodeRequ * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); * OperationFuturefuture = @@ -721,8 +793,11 @@ public final OperationFuture stopNodeAsync(StopNodeRequ * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); * ApiFuturefuture = tpuClient.stopNodeCallable().futureCall(request); @@ -742,8 +817,11 @@ public final UnaryCallable stopNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -764,8 +842,11 @@ public final OperationFuturestartNodeAsync(StartNodeRe * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); * OperationFuturefuture = @@ -787,8 +868,11 @@ public final OperationFuture startNodeAsync(StartNodeRe * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); * ApiFuturefuture = tpuClient.startNodeCallable().futureCall(request); @@ -808,8 +892,11 @@ public final UnaryCallable startNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -836,8 +923,11 @@ public final OperationFutureupdateNodeAsync( * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -862,8 +952,11 @@ public final OperationFutureupdateNodeAsync(UpdateNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -889,8 +982,11 @@ public final OperationFutureupdateNodeAsync(UpdateNode * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -914,8 +1010,11 @@ public final UnaryCallableupdateNodeCallable() { * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -940,8 +1039,11 @@ public final GenerateServiceIdentityResponse generateServiceIdentity( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -966,8 +1068,11 @@ public final GenerateServiceIdentityResponse generateServiceIdentity( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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]"); @@ -995,8 +1100,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes(AcceleratorT *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -1022,8 +1130,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes(String paren *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1056,8 +1167,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1090,8 +1204,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1131,8 +1248,11 @@ public final ListAcceleratorTypesPagedResponse listAcceleratorTypes( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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]"); @@ -1158,8 +1278,11 @@ public final AcceleratorType getAcceleratorType(AcceleratorTypeName name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -1183,8 +1306,11 @@ public final AcceleratorType getAcceleratorType(String name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1210,8 +1336,11 @@ public final AcceleratorType getAcceleratorType(GetAcceleratorTypeRequest reques *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1238,8 +1367,11 @@ public final AcceleratorType getAcceleratorType(GetAcceleratorTypeRequest reques *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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]"); @@ -1267,8 +1399,11 @@ public final ListRuntimeVersionsPagedResponse listRuntimeVersions(RuntimeVersion *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -1294,8 +1429,11 @@ public final ListRuntimeVersionsPagedResponse listRuntimeVersions(String parent) *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1327,8 +1465,11 @@ public final ListRuntimeVersionsPagedResponse listRuntimeVersions( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1360,8 +1501,11 @@ public final ListRuntimeVersionsPagedResponse listRuntimeVersions( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1400,8 +1544,11 @@ public final ListRuntimeVersionsPagedResponse listRuntimeVersions( *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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]"); @@ -1427,8 +1574,11 @@ public final RuntimeVersion getRuntimeVersion(RuntimeVersionName name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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(); @@ -1451,8 +1601,11 @@ public final RuntimeVersion getRuntimeVersion(String name) { *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1477,8 +1630,11 @@ public final RuntimeVersion getRuntimeVersion(GetRuntimeVersionRequest request) *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1502,8 +1658,11 @@ public final UnaryCallablegetRuntimeV * Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() @@ -1529,8 +1688,11 @@ public final GetGuestAttributesResponse getGuestAttributes(GetGuestAttributesReq *Sample code: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() diff --git a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuSettings.java b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuSettings.java index 3eff122feb28..84b03976c4e3 100644 --- a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuSettings.java +++ b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuSettings.java @@ -56,16 +56,16 @@ *For example, to set the total timeout of getNode to 30 seconds: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() + * tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)) * .build()); * TpuSettings tpuSettings = tpuSettingsBuilder.build(); diff --git a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/package-info.java b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/package-info.java index b2d24018c018..556bc1c77ba5 100644 --- a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/package-info.java +++ b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/package-info.java @@ -28,8 +28,11 @@ *Sample for TpuClient: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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); diff --git a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/stub/TpuStubSettings.java b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/stub/TpuStubSettings.java index d26706640767..726f0fec79ac 100644 --- a/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/stub/TpuStubSettings.java +++ b/java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/stub/TpuStubSettings.java @@ -96,16 +96,16 @@ *For example, to set the total timeout of getNode to 30 seconds: * *
{@code - * // This snippet has been automatically generated for illustrative purposes only. - * // It may require modifications to work in your environment. + * // 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() + * tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)) * .build()); * TpuStubSettings tpuSettings = tpuSettingsBuilder.build(); 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(); + ApiFuturefuture = 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]