From ac0133dec14b7dbbeb6c13020a41696ec76a800a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 00:06:24 +0000 Subject: [PATCH] fix: better support for fallback mode (#91) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 468790263 Source-Link: https://github.com/googleapis/googleapis/commit/873ab456273d105245df0fb82a6c17a814553b80 Source-Link: https://github.com/googleapis/googleapis-gen/commit/cb6f37aeff2a3472e40a7bbace8c67d75e24bee5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I2ZjM3YWVmZjJhMzQ3MmU0MGE3YmJhY2U4YzY3ZDc1ZTI0YmVlNSJ9 --- .../snippet_metadata.google.cloud.tpu.v1.json | 22 +-- .../samples/generated/v1/tpu.create_node.js | 3 + .../samples/generated/v1/tpu.delete_node.js | 3 + .../generated/v1/tpu.get_accelerator_type.js | 3 + .../samples/generated/v1/tpu.get_node.js | 3 + .../v1/tpu.get_tensor_flow_version.js | 3 + .../v1/tpu.list_accelerator_types.js | 3 + .../samples/generated/v1/tpu.list_nodes.js | 3 + .../v1/tpu.list_tensor_flow_versions.js | 3 + .../samples/generated/v1/tpu.reimage_node.js | 3 + .../samples/generated/v1/tpu.start_node.js | 3 + .../samples/generated/v1/tpu.stop_node.js | 3 + ...et_metadata.google.cloud.tpu.v2alpha1.json | 26 +-- .../generated/v2alpha1/tpu.create_node.js | 3 + .../generated/v2alpha1/tpu.delete_node.js | 3 + .../v2alpha1/tpu.generate_service_identity.js | 3 + .../v2alpha1/tpu.get_accelerator_type.js | 3 + .../v2alpha1/tpu.get_guest_attributes.js | 3 + .../generated/v2alpha1/tpu.get_node.js | 3 + .../v2alpha1/tpu.get_runtime_version.js | 3 + .../v2alpha1/tpu.list_accelerator_types.js | 3 + .../generated/v2alpha1/tpu.list_nodes.js | 3 + .../v2alpha1/tpu.list_runtime_versions.js | 3 + .../generated/v2alpha1/tpu.start_node.js | 3 + .../generated/v2alpha1/tpu.stop_node.js | 3 + .../generated/v2alpha1/tpu.update_node.js | 3 + .../google-cloud-tpu/src/v1/tpu_client.ts | 26 +-- .../src/v2alpha1/tpu_client.ts | 26 +-- .../google-cloud-tpu/test/gapic_tpu_v1.ts | 156 +++++++++--------- .../test/gapic_tpu_v2alpha1.ts | 156 +++++++++--------- 30 files changed, 280 insertions(+), 204 deletions(-) diff --git a/packages/google-cloud-tpu/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json b/packages/google-cloud-tpu/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json index f63fff15e2a..3934a315725 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json +++ b/packages/google-cloud-tpu/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 63, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -110,7 +110,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 63, "type": "FULL" } ], @@ -158,7 +158,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 54, + "end": 57, "type": "FULL" } ], @@ -242,7 +242,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -282,7 +282,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -322,7 +322,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 71, "type": "FULL" } ], @@ -378,7 +378,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -418,7 +418,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 71, "type": "FULL" } ], @@ -474,7 +474,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.create_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.create_node.js index ae0d66d2bac..35fcf2bec3a 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.create_node.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.create_node.js @@ -23,6 +23,9 @@ function main(parent, node) { // [START tpu_v1_generated_Tpu_CreateNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.delete_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.delete_node.js index 5f3eca55139..ad364cdbb8a 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.delete_node.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.delete_node.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v1_generated_Tpu_DeleteNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_accelerator_type.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_accelerator_type.js index 44a1a7c96df..b2e8afbdd48 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_accelerator_type.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_accelerator_type.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v1_generated_Tpu_GetAcceleratorType_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_node.js index b1646d49b56..70b0c8ff589 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_node.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_node.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v1_generated_Tpu_GetNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_tensor_flow_version.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_tensor_flow_version.js index af488dd0833..479389099cd 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.get_tensor_flow_version.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.get_tensor_flow_version.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v1_generated_Tpu_GetTensorFlowVersion_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_accelerator_types.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_accelerator_types.js index a316f32453b..9458a1aef12 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_accelerator_types.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_accelerator_types.js @@ -23,6 +23,9 @@ function main(parent) { // [START tpu_v1_generated_Tpu_ListAcceleratorTypes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_nodes.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_nodes.js index 47e8534f3dc..c7165073b90 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_nodes.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_nodes.js @@ -23,6 +23,9 @@ function main(parent) { // [START tpu_v1_generated_Tpu_ListNodes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_tensor_flow_versions.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_tensor_flow_versions.js index 3fce642c2ec..6884855a885 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.list_tensor_flow_versions.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.list_tensor_flow_versions.js @@ -23,6 +23,9 @@ function main(parent) { // [START tpu_v1_generated_Tpu_ListTensorFlowVersions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js index 009b9076245..5963a05144d 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js @@ -23,6 +23,9 @@ function main() { // [START tpu_v1_generated_Tpu_ReimageNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js index 53eed0e14ac..61d31d20b5a 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js @@ -23,6 +23,9 @@ function main() { // [START tpu_v1_generated_Tpu_StartNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js b/packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js index 4c15ef2e4b9..e3b7891529f 100644 --- a/packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js +++ b/packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js @@ -23,6 +23,9 @@ function main() { // [START tpu_v1_generated_Tpu_StopNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json b/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json index 645ead9239a..d5a62c029e8 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 63, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -110,7 +110,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 63, "type": "FULL" } ], @@ -158,7 +158,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -238,7 +238,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -278,7 +278,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -322,7 +322,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -362,7 +362,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 71, "type": "FULL" } ], @@ -418,7 +418,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -458,7 +458,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 71, "type": "FULL" } ], @@ -514,7 +514,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -554,7 +554,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js index 6f00c6d0545..e99cae62be7 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js @@ -23,6 +23,9 @@ function main(parent, node) { // [START tpu_v2alpha1_generated_Tpu_CreateNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js index ca7c24c07eb..c61789134fb 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v2alpha1_generated_Tpu_DeleteNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js index 6ffe8b866d9..6120c836015 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js @@ -23,6 +23,9 @@ function main(parent) { // [START tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js index d87f1707e51..c09ba898d76 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js index 41f16742291..e6b83bcafac 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js index b5ea83c0723..ad9a1a2c833 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v2alpha1_generated_Tpu_GetNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js index ede2a750407..8b9a3ee8556 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js @@ -23,6 +23,9 @@ function main(name) { // [START tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js index a835cc1ad84..bbaeacf2d0d 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js @@ -23,6 +23,9 @@ function main(parent) { // [START tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js index ab6542a102d..4a43bdcc192 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js @@ -23,6 +23,9 @@ function main(parent) { // [START tpu_v2alpha1_generated_Tpu_ListNodes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js index 743c2fb0007..ba51c03858c 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js @@ -23,6 +23,9 @@ function main(parent) { // [START tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js index 0d2cc975a80..047f5124c7b 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js @@ -23,6 +23,9 @@ function main() { // [START tpu_v2alpha1_generated_Tpu_StartNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js index cb9551938ce..21ceb97b54b 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js @@ -23,6 +23,9 @@ function main() { // [START tpu_v2alpha1_generated_Tpu_StopNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js index a39e5f32e79..80769d98505 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js @@ -23,6 +23,9 @@ function main(updateMask, node) { // [START tpu_v2alpha1_generated_Tpu_UpdateNode_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-tpu/src/v1/tpu_client.ts b/packages/google-cloud-tpu/src/v1/tpu_client.ts index 6d4fbcb8245..77467364f8c 100644 --- a/packages/google-cloud-tpu/src/v1/tpu_client.ts +++ b/packages/google-cloud-tpu/src/v1/tpu_client.ts @@ -30,7 +30,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -389,7 +388,8 @@ export class TpuClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -845,7 +845,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.createNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v1.Node, @@ -982,7 +982,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v1.Node, @@ -1121,7 +1121,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.reimageNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v1.Node, @@ -1258,7 +1258,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.stopNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v1.Node, @@ -1395,7 +1395,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.startNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v1.Node, @@ -1531,7 +1531,7 @@ export class TpuClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listNodes.createStream( - this.innerApiCalls.listNodes as gax.GaxCall, + this.innerApiCalls.listNodes as GaxCall, request, callSettings ); @@ -1579,7 +1579,7 @@ export class TpuClient { this.initialize(); return this.descriptors.page.listNodes.asyncIterate( this.innerApiCalls['listNodes'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -1732,7 +1732,7 @@ export class TpuClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listTensorFlowVersions.createStream( - this.innerApiCalls.listTensorFlowVersions as gax.GaxCall, + this.innerApiCalls.listTensorFlowVersions as GaxCall, request, callSettings ); @@ -1784,7 +1784,7 @@ export class TpuClient { this.initialize(); return this.descriptors.page.listTensorFlowVersions.asyncIterate( this.innerApiCalls['listTensorFlowVersions'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -1933,7 +1933,7 @@ export class TpuClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAcceleratorTypes.createStream( - this.innerApiCalls.listAcceleratorTypes as gax.GaxCall, + this.innerApiCalls.listAcceleratorTypes as GaxCall, request, callSettings ); @@ -1985,7 +1985,7 @@ export class TpuClient { this.initialize(); return this.descriptors.page.listAcceleratorTypes.asyncIterate( this.innerApiCalls['listAcceleratorTypes'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts b/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts index b8012321a72..675a640f3a5 100644 --- a/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts +++ b/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts @@ -30,7 +30,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -414,7 +413,8 @@ export class TpuClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1073,7 +1073,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.createNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v2alpha1.Node, @@ -1210,7 +1210,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v2alpha1.Node, @@ -1347,7 +1347,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.stopNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v2alpha1.Node, @@ -1484,7 +1484,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.startNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v2alpha1.Node, @@ -1624,7 +1624,7 @@ export class TpuClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.updateNode, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.tpu.v2alpha1.Node, @@ -1762,7 +1762,7 @@ export class TpuClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listNodes.createStream( - this.innerApiCalls.listNodes as gax.GaxCall, + this.innerApiCalls.listNodes as GaxCall, request, callSettings ); @@ -1810,7 +1810,7 @@ export class TpuClient { this.initialize(); return this.descriptors.page.listNodes.asyncIterate( this.innerApiCalls['listNodes'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -1959,7 +1959,7 @@ export class TpuClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAcceleratorTypes.createStream( - this.innerApiCalls.listAcceleratorTypes as gax.GaxCall, + this.innerApiCalls.listAcceleratorTypes as GaxCall, request, callSettings ); @@ -2011,7 +2011,7 @@ export class TpuClient { this.initialize(); return this.descriptors.page.listAcceleratorTypes.asyncIterate( this.innerApiCalls['listAcceleratorTypes'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -2160,7 +2160,7 @@ export class TpuClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listRuntimeVersions.createStream( - this.innerApiCalls.listRuntimeVersions as gax.GaxCall, + this.innerApiCalls.listRuntimeVersions as GaxCall, request, callSettings ); @@ -2212,7 +2212,7 @@ export class TpuClient { this.initialize(); return this.descriptors.page.listRuntimeVersions.asyncIterate( this.innerApiCalls['listRuntimeVersions'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-tpu/test/gapic_tpu_v1.ts b/packages/google-cloud-tpu/test/gapic_tpu_v1.ts index f67ea1d9192..50ca0d5dbd9 100644 --- a/packages/google-cloud-tpu/test/gapic_tpu_v1.ts +++ b/packages/google-cloud-tpu/test/gapic_tpu_v1.ts @@ -145,99 +145,101 @@ function stubAsyncIterationCall( } describe('v1.TpuClient', () => { - it('has servicePath', () => { - const servicePath = tpuModule.v1.TpuClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = tpuModule.v1.TpuClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = tpuModule.v1.TpuClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = tpuModule.v1.TpuClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new tpuModule.v1.TpuClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = tpuModule.v1.TpuClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new tpuModule.v1.TpuClient({ - fallback: true, + it('has port', () => { + const port = tpuModule.v1.TpuClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new tpuModule.v1.TpuClient(); + assert(client); }); - assert.strictEqual(client.tpuStub, undefined); - await client.initialize(); - assert(client.tpuStub); - }); - it('has close method for the initialized client', done => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new tpuModule.v1.TpuClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.tpuStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + await client.initialize(); + assert(client.tpuStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.tpuStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.tpuStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('getNode', () => { diff --git a/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts b/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts index d6dab153efe..148eb480443 100644 --- a/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts +++ b/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts @@ -145,99 +145,101 @@ function stubAsyncIterationCall( } describe('v2alpha1.TpuClient', () => { - it('has servicePath', () => { - const servicePath = tpuModule.v2alpha1.TpuClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = tpuModule.v2alpha1.TpuClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = tpuModule.v2alpha1.TpuClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = tpuModule.v2alpha1.TpuClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new tpuModule.v2alpha1.TpuClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = tpuModule.v2alpha1.TpuClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new tpuModule.v2alpha1.TpuClient({ - fallback: true, + it('has port', () => { + const port = tpuModule.v2alpha1.TpuClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new tpuModule.v2alpha1.TpuClient(); + assert(client); }); - assert.strictEqual(client.tpuStub, undefined); - await client.initialize(); - assert(client.tpuStub); - }); - it('has close method for the initialized client', done => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new tpuModule.v2alpha1.TpuClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.tpuStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + await client.initialize(); + assert(client.tpuStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.tpuStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.tpuStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('getNode', () => {