mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
49 lines
1.9 KiB
TypeScript
49 lines
1.9 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Return an async operation
|
|
*
|
|
* @summary Return an async operation
|
|
* x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetFailedOperationResult.json
|
|
*/
|
|
|
|
import { VMwareCloudSimple } from "@azure/arm-vmwarecloudsimple";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import "dotenv/config";
|
|
|
|
async function getFailedOperationResult(): Promise<void> {
|
|
const subscriptionId = process.env["VMWARECLOUDSIMPLE_SUBSCRIPTION_ID"] || "{subscription-id}";
|
|
const regionId = "westus2";
|
|
const referer = "https://management.azure.com/";
|
|
const operationId = "d030bb3f-7d53-11e9-8e09-9a86872085ff";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new VMwareCloudSimple(credential, subscriptionId);
|
|
const result = await client.operations.get(regionId, referer, operationId);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to Return an async operation
|
|
*
|
|
* @summary Return an async operation
|
|
* x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/GetOperationResult.json
|
|
*/
|
|
async function getOperationResult(): Promise<void> {
|
|
const subscriptionId = process.env["VMWARECLOUDSIMPLE_SUBSCRIPTION_ID"] || "{subscription-id}";
|
|
const regionId = "westus2";
|
|
const referer = "https://management.azure.com/";
|
|
const operationId = "f8e1c8f1-7d52-11e9-8e07-9a86872085ff";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new VMwareCloudSimple(credential, subscriptionId);
|
|
const result = await client.operations.get(regionId, referer, operationId);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await getFailedOperationResult();
|
|
await getOperationResult();
|
|
}
|
|
|
|
main().catch(console.error);
|