44 строки
1.3 KiB
TypeScript
44 строки
1.3 KiB
TypeScript
/*
|
|
* Copyright (c) Microsoft Corporation.
|
|
* Licensed under the MIT License.
|
|
*
|
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
*/
|
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
import { OperationalInsightsManagementClient } from "@azure/arm-operationalinsights";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import * as dotenv from "dotenv";
|
|
|
|
dotenv.config();
|
|
|
|
/**
|
|
* This sample demonstrates how to Gets the Log Analytics clusters in a subscription.
|
|
*
|
|
* @summary Gets the Log Analytics clusters in a subscription.
|
|
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2021-06-01/examples/ClustersSubscriptionList.json
|
|
*/
|
|
async function clustersSubscriptionList() {
|
|
const subscriptionId =
|
|
process.env["OPERATIONALINSIGHTS_SUBSCRIPTION_ID"] ||
|
|
"00000000-0000-0000-0000-00000000000";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new OperationalInsightsManagementClient(
|
|
credential,
|
|
subscriptionId
|
|
);
|
|
const resArray = new Array();
|
|
for await (let item of client.clusters.list()) {
|
|
resArray.push(item);
|
|
}
|
|
console.log(resArray);
|
|
}
|
|
|
|
async function main() {
|
|
clustersSubscriptionList();
|
|
}
|
|
|
|
main().catch(console.error);
|