# 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
create_alarm_suppression_response = monitoring_client.create_alarm_suppression(
create_alarm_suppression_details=oci.monitoring.models.CreateAlarmSuppressionDetails(
alarm_suppression_target=oci.monitoring.models.AlarmSuppressionCompartmentTarget(
target_type="COMPARTMENT",
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
compartment_id_in_subtree=False),
display_name="EXAMPLE-displayName-Value",
time_suppress_from=datetime.strptime(
"2030-12-20T09:56:17.616Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
time_suppress_until=datetime.strptime(
"2001-05-10T05:39:57.207Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
level="DIMENSION",
description="EXAMPLE-description-Value",
dimensions={
'EXAMPLE_KEY_eKQJj': 'EXAMPLE_VALUE_KP3mchtDERhXOJJvYfat'},
freeform_tags={
'EXAMPLE_KEY_eF6rY': 'EXAMPLE_VALUE_Dv223RVVdoKAybOffrko'},
defined_tags={
'EXAMPLE_KEY_vtINv': {
'EXAMPLE_KEY_BsQYV': 'EXAMPLE--Value'}},
suppression_conditions=[
oci.monitoring.models.Recurrence(
condition_type="RECURRENCE",
suppression_recurrence="EXAMPLE-suppressionRecurrence-Value",
suppression_duration="EXAMPLE-suppressionDuration-Value")]),
opc_request_id="UQNSDGPAZ6TIOEATBHUC<unique_ID>",
opc_retry_token="EXAMPLE-opcRetryToken-Value")
# Get the data from response
print(create_alarm_suppression_response.data)