// 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: true,
messageFormat: monitoring.models.UpdateAlarmDetails.MessageFormat.Raw,
destinations: ["EXAMPLE--Value" ],
repeatNotificationDuration: "EXAMPLE-repeatNotificationDuration-Value",
suppression: {
description: "EXAMPLE-description-Value",
timeSuppressFrom: new Date("Sat Apr 21 14:24:53 UTC 2018"),
timeSuppressUntil: new Date("Tue Jun 07 21:37:59 UTC 2044"),
}
,
isEnabled: false,
freeformTags: {
EXAMPLE_KEY_BLW0z :"EXAMPLE_VALUE_vO0MCD9Y83EgIZBu0EU0"
},
definedTags: {
EXAMPLE_KEY_xzyQW :{
EXAMPLE_KEY_anrNB :"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",
notificationTitle: "EXAMPLE-notificationTitle-Value",
evaluationSlackDuration: "EXAMPLE-evaluationSlackDuration-Value",
alarmSummary: "EXAMPLE-alarmSummary-Value",
}
const updateAlarmRequest: monitoring.requests.UpdateAlarmRequest = {
alarmId: "ocid1.test.oc1..<unique_ID>EXAMPLE-alarmId-Value",
updateAlarmDetails: updateAlarmDetails,
ifMatch: "EXAMPLE-ifMatch-Value",
opcRequestId: "SBZIUGQXAWE6OBHF4THZ<unique_ID>",
};
// Send request to the Client.
const updateAlarmResponse = await client.updateAlarm(updateAlarmRequest);
}
catch (error) {
console.log("updateAlarm Failed with error " + error);
}
})();