# 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
budget_client = oci.budget.CostAdClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
create_cost_anomaly_monitor_response = budget_client.create_cost_anomaly_monitor(
    create_cost_anomaly_monitor_details=oci.budget.models.CreateCostAnomalyMonitorDetails(
        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        name="EXAMPLE-name-Value",
        target_resource_filter=oci.budget.models.TargetResourceFilter(
            operator="AND",
            dimensions=[
                oci.budget.models.Dimension(
                    key="EXAMPLE-key-Value",
                    value="EXAMPLE-value-Value")],
            tags=[
                oci.budget.models.Tag(
                    namespace="EXAMPLE-namespace-Value",
                    key="EXAMPLE-key-Value",
                    value="EXAMPLE-value-Value")]),
        description="EXAMPLE-description-Value",
        cost_alert_subscription_map=oci.budget.models.CostAlertSubscriptionMap(
            operator="AND",
            threshold_absolute_value=336,
            threshold_relative_percent=728,
            cost_alert_subscription_id="ocid1.test.oc1..<unique_ID>EXAMPLE-costAlertSubscriptionId-Value"),
        defined_tags={
            'EXAMPLE_KEY_KKMoj': {
                'EXAMPLE_KEY_TvQi2': 'EXAMPLE--Value'}},
        freeform_tags={
            'EXAMPLE_KEY_aPhRm': 'EXAMPLE_VALUE_aNaXx8UvqOXcE0jYEe17'}),
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_request_id="3DAQF2NJEHGWDGRL0ZO8<unique_ID>")

# Get the data from response
print(create_cost_anomaly_monitor_response.data)