# 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 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
costad_client = oci.costad.CostAdClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_cost_anomaly_monitor_response = costad_client.create_cost_anomaly_monitor(
create_cost_anomaly_monitor_details=oci.costad.models.CreateCostAnomalyMonitorDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
name="EXAMPLE-name-Value",
target_resource_filter=oci.costad.models.TargetResourceFilter(
operator="AND",
dimensions=[
oci.costad.models.Dimension(
key="EXAMPLE-key-Value",
value="EXAMPLE-value-Value")],
tags=[
oci.costad.models.Tag(
namespace="EXAMPLE-namespace-Value",
key="EXAMPLE-key-Value",
value="EXAMPLE-value-Value")]),
description="EXAMPLE-description-Value",
cost_alert_subscription_map=oci.costad.models.CostAlertSubscriptionMap(
operator="AND",
threshold_absolute_value=745,
threshold_relative_percent=949,
cost_alert_subscription_id="ocid1.test.oc1..<unique_ID>EXAMPLE-costAlertSubscriptionId-Value"),
defined_tags={
'EXAMPLE_KEY_qYfAW': {
'EXAMPLE_KEY_fYed0': 'EXAMPLE--Value'}},
freeform_tags={
'EXAMPLE_KEY_powWy': 'EXAMPLE_VALUE_8FOLVdxUEeKVVWCO3mE3'}),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="UL2MBGYQAID3LM3GX7QS<unique_ID>")
# Get the data from response
print(create_cost_anomaly_monitor_response.data)