# 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).
from datetime import datetime
import oci
# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()
# Initialize service client with default config file
monitoring_client = oci.monitoring.MonitoringClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
update_alarm_response = monitoring_client.update_alarm(
alarm_id="ocid1.test.oc1..<unique_ID>EXAMPLE-alarmId-Value",
update_alarm_details=oci.monitoring.models.UpdateAlarmDetails(
display_name="EXAMPLE-displayName-Value",
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
metric_compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-metricCompartmentId-Value",
metric_compartment_id_in_subtree=True,
namespace="EXAMPLE-namespace-Value",
resource_group="EXAMPLE-resourceGroup-Value",
query="EXAMPLE-query-Value",
resolution="EXAMPLE-resolution-Value",
pending_duration="EXAMPLE-pendingDuration-Value",
severity="CRITICAL",
body="EXAMPLE-body-Value",
is_notifications_per_metric_dimension_enabled=False,
message_format="PRETTY_JSON",
destinations=["EXAMPLE--Value"],
repeat_notification_duration="EXAMPLE-repeatNotificationDuration-Value",
suppression=oci.monitoring.models.Suppression(
time_suppress_from=datetime.strptime(
"2009-08-21T05:19:06.854Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
time_suppress_until=datetime.strptime(
"2029-07-13T08:22:30.761Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
description="EXAMPLE-description-Value"),
is_enabled=False,
freeform_tags={
'EXAMPLE_KEY_onWxl': 'EXAMPLE_VALUE_Jux3zjWfEZHBH4rueOck'},
defined_tags={
'EXAMPLE_KEY_Qds88': {
'EXAMPLE_KEY_iwIwY': 'EXAMPLE--Value'}},
overrides=[
oci.monitoring.models.AlarmOverride(
pending_duration="EXAMPLE-pendingDuration-Value",
severity="WARNING",
body="EXAMPLE-body-Value",
rule_name="EXAMPLE-ruleName-Value",
query="EXAMPLE-query-Value")],
rule_name="EXAMPLE-ruleName-Value",
notification_version="EXAMPLE-notificationVersion-Value",
notification_title="EXAMPLE-notificationTitle-Value",
evaluation_slack_duration="EXAMPLE-evaluationSlackDuration-Value",
alarm_summary="EXAMPLE-alarmSummary-Value"),
if_match="EXAMPLE-ifMatch-Value",
opc_request_id="FX1LZUIYWRQRZ05PD9RP<unique_ID>")
# Get the data from response
print(update_alarm_response.data)