azure-sdk-for-js/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitoredSubscriptionsGetSa...

46 строки
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 the subscriptions currently being monitored by the NewRelic monitor resource.
*
* @summary List the subscriptions currently being monitored by the NewRelic monitor resource.
* x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/stable/2024-01-01/examples/MonitoredSubscriptions_Get.json
*/
async function monitorsGetMonitoredSubscriptions() {
const subscriptionId =
process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "myResourceGroup";
const monitorName = "myMonitor";
const configurationName = "default";
const credential = new DefaultAzureCredential();
const client = new NewRelicObservability(credential, subscriptionId);
const result = await client.monitoredSubscriptions.get(
resourceGroupName,
monitorName,
configurationName,
);
console.log(result);
}
async function main() {
monitorsGetMonitoredSubscriptions();
}
main().catch(console.error);