mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Returns list of usage in region
|
|
*
|
|
* @summary Returns list of usage in region
|
|
* x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/ListUsages.json
|
|
*/
|
|
|
|
import { VMwareCloudSimple } from "@azure/arm-vmwarecloudsimple";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import "dotenv/config";
|
|
|
|
async function listUsages(): Promise<void> {
|
|
const subscriptionId = process.env["VMWARECLOUDSIMPLE_SUBSCRIPTION_ID"] || "{subscription-id}";
|
|
const regionId = "westus2";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new VMwareCloudSimple(credential, subscriptionId);
|
|
const resArray = new Array();
|
|
for await (const item of client.usages.list(regionId)) {
|
|
resArray.push(item);
|
|
}
|
|
console.log(resArray);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await listUsages();
|
|
}
|
|
|
|
main().catch(console.error);
|