|
| 1 | +// Copyright 2022 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | +// |
| 15 | +// ** This file is automatically generated by gapic-generator-typescript. ** |
| 16 | +// ** https://github.com/googleapis/gapic-generator-typescript ** |
| 17 | +// ** All changes to this file may be overwritten. ** |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +'use strict'; |
| 22 | + |
| 23 | +function main(datacenterConnector) { |
| 24 | + // [START vmmigration_v1_generated_VmMigration_UpgradeAppliance_async] |
| 25 | + /** |
| 26 | + * TODO(developer): Uncomment these variables before running the sample. |
| 27 | + */ |
| 28 | + /** |
| 29 | + * Required. The DatacenterConnector name. |
| 30 | + */ |
| 31 | + // const datacenterConnector = 'abc123' |
| 32 | + /** |
| 33 | + * A request ID to identify requests. Specify a unique request ID |
| 34 | + * so that if you must retry your request, the server will know to ignore |
| 35 | + * the request if it has already been completed. The server will guarantee |
| 36 | + * that for at least 60 minutes after the first request. |
| 37 | + * For example, consider a situation where you make an initial request and t |
| 38 | + * he request times out. If you make the request again with the same request |
| 39 | + * ID, the server can check if original operation with the same request ID |
| 40 | + * was received, and if so, will ignore the second request. This prevents |
| 41 | + * clients from accidentally creating duplicate commitments. |
| 42 | + * The request ID must be a valid UUID with the exception that zero UUID is |
| 43 | + * not supported (00000000-0000-0000-0000-000000000000). |
| 44 | + */ |
| 45 | + // const requestId = 'abc123' |
| 46 | + |
| 47 | + // Imports the Vmmigration library |
| 48 | + const {VmMigrationClient} = require('@google-cloud/vmmigration').v1; |
| 49 | + |
| 50 | + // Instantiates a client |
| 51 | + const vmmigrationClient = new VmMigrationClient(); |
| 52 | + |
| 53 | + async function callUpgradeAppliance() { |
| 54 | + // Construct request |
| 55 | + const request = { |
| 56 | + datacenterConnector, |
| 57 | + }; |
| 58 | + |
| 59 | + // Run request |
| 60 | + const [operation] = await vmmigrationClient.upgradeAppliance(request); |
| 61 | + const [response] = await operation.promise(); |
| 62 | + console.log(response); |
| 63 | + } |
| 64 | + |
| 65 | + callUpgradeAppliance(); |
| 66 | + // [END vmmigration_v1_generated_VmMigration_UpgradeAppliance_async] |
| 67 | +} |
| 68 | + |
| 69 | +process.on('unhandledRejection', err => { |
| 70 | + console.error(err.message); |
| 71 | + process.exitCode = 1; |
| 72 | +}); |
| 73 | +main(...process.argv.slice(2)); |
0 commit comments