// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).
import * as monitoring from "oci-monitoring";
import common = require("oci-common");
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();
(async () => {
try {
// Create a service client
const client = new monitoring.MonitoringClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const updateAlarmDetails = {
displayName: "EXAMPLE-displayName-Value",
compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
metricCompartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-metricCompartmentId-Value",
metricCompartmentIdInSubtree: true,
namespace: "EXAMPLE-namespace-Value",
resourceGroup: "EXAMPLE-resourceGroup-Value",
query: "EXAMPLE-query-Value",
resolution: "EXAMPLE-resolution-Value",
pendingDuration: "EXAMPLE-pendingDuration-Value",
severity: monitoring.models.Alarm.Severity.Error,
body: "EXAMPLE-body-Value",
isNotificationsPerMetricDimensionEnabled: false,
messageFormat: monitoring.models.UpdateAlarmDetails.MessageFormat.OnsOptimized,
destinations: ["EXAMPLE--Value"],
repeatNotificationDuration: "EXAMPLE-repeatNotificationDuration-Value",
suppression: {
description: "EXAMPLE-description-Value",
timeSuppressFrom: new Date("Mon Dec 12 23:44:10 UTC 2022"),
timeSuppressUntil: new Date("Mon Nov 14 15:35:23 UTC 2022")
},
isEnabled: false,
freeformTags: {
EXAMPLE_KEY_4XH4P: "EXAMPLE_VALUE_ZfsQRB1xHaMFNwDnKXpi"
},
definedTags: {
EXAMPLE_KEY_Iw8QY: {
EXAMPLE_KEY_RyxGY: "EXAMPLE--Value"
}
},
overrides: [
{
pendingDuration: "EXAMPLE-pendingDuration-Value",
severity: monitoring.models.Alarm.Severity.Error,
body: "EXAMPLE-body-Value",
ruleName: "EXAMPLE-ruleName-Value",
query: "EXAMPLE-query-Value"
}
],
ruleName: "EXAMPLE-ruleName-Value",
notificationVersion: "EXAMPLE-notificationVersion-Value"
};
const updateAlarmRequest: monitoring.requests.UpdateAlarmRequest = {
alarmId: "ocid1.test.oc1..<unique_ID>EXAMPLE-alarmId-Value",
updateAlarmDetails: updateAlarmDetails,
ifMatch: "EXAMPLE-ifMatch-Value",
opcRequestId: "9Z0RVSYOB9JUZIN0D93X<unique_ID>"
};
// Send request to the Client.
const updateAlarmResponse = await client.updateAlarm(updateAlarmRequest);
} catch (error) {
console.log("updateAlarm Failed with error " + error);
}
})();