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

74 строки
2.4 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 {
MetricsRequest,
NewRelicObservability,
} from "@azure/arm-newrelicobservability";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get metric rules
*
* @summary Get metric rules
* x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/stable/2024-01-01/examples/Monitors_GetMetricRules_MaximumSet_Gen.json
*/
async function monitorsGetMetricRulesMaximumSetGen() {
const subscriptionId =
process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic";
const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz";
const request: MetricsRequest = { userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" };
const credential = new DefaultAzureCredential();
const client = new NewRelicObservability(credential, subscriptionId);
const result = await client.monitors.getMetricRules(
resourceGroupName,
monitorName,
request,
);
console.log(result);
}
/**
* This sample demonstrates how to Get metric rules
*
* @summary Get metric rules
* x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/stable/2024-01-01/examples/Monitors_GetMetricRules_MinimumSet_Gen.json
*/
async function monitorsGetMetricRulesMinimumSetGen() {
const subscriptionId =
process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic";
const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz";
const request: MetricsRequest = { userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" };
const credential = new DefaultAzureCredential();
const client = new NewRelicObservability(credential, subscriptionId);
const result = await client.monitors.getMetricRules(
resourceGroupName,
monitorName,
request,
);
console.log(result);
}
async function main() {
monitorsGetMetricRulesMaximumSetGen();
monitorsGetMetricRulesMinimumSetGen();
}
main().catch(console.error);