47 строки
1.6 KiB
TypeScript
47 строки
1.6 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 { NewRelicObservability } from "@azure/arm-newrelicobservability";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import * as dotenv from "dotenv";
|
|
|
|
dotenv.config();
|
|
|
|
/**
|
|
* This sample demonstrates how to List all Azure resources associated to the same NewRelic organization and account as the target resource.
|
|
*
|
|
* @summary List all Azure resources associated to the same NewRelic organization and account as the target resource.
|
|
* x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/stable/2024-01-01/examples/LinkedResources_List.json
|
|
*/
|
|
async function monitorsListLinkedResources() {
|
|
const subscriptionId =
|
|
process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] ||
|
|
"00000000-0000-0000-0000-000000000000";
|
|
const resourceGroupName =
|
|
process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "myResourceGroup";
|
|
const monitorName = "myMonitor";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new NewRelicObservability(credential, subscriptionId);
|
|
const resArray = new Array();
|
|
for await (let item of client.monitors.listLinkedResources(
|
|
resourceGroupName,
|
|
monitorName,
|
|
)) {
|
|
resArray.push(item);
|
|
}
|
|
console.log(resArray);
|
|
}
|
|
|
|
async function main() {
|
|
monitorsListLinkedResources();
|
|
}
|
|
|
|
main().catch(console.error);
|