# 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
apm_traces_client = oci.apm_traces.ScheduledQueryClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
update_scheduled_query_response = apm_traces_client.update_scheduled_query(
    apm_domain_id="ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value",
    scheduled_query_id="ocid1.test.oc1..<unique_ID>EXAMPLE-scheduledQueryId-Value",
    update_scheduled_query_details=oci.apm_traces.models.UpdateScheduledQueryDetails(
        scheduled_query_name="EXAMPLE-scheduledQueryName-Value",
        scheduled_query_processing_type="EXPORT",
        scheduled_query_processing_sub_type="CUSTOM_METRIC",
        scheduled_query_text="EXAMPLE-scheduledQueryText-Value",
        scheduled_query_schedule="EXAMPLE-scheduledQuerySchedule-Value",
        scheduled_query_description="EXAMPLE-scheduledQueryDescription-Value",
        scheduled_query_maximum_runtime_in_seconds=186,
        scheduled_query_retention_period_in_ms=734,
        scheduled_query_processing_configuration=oci.apm_traces.models.ScheduledQueryProcessingConfig(
            streaming=oci.apm_traces.models.Streaming(
                stream_id="ocid1.test.oc1..<unique_ID>EXAMPLE-streamId-Value"),
            object_storage=oci.apm_traces.models.ObjectStorage(
                bucket_name="EXAMPLE-bucketName-Value",
                name_space="EXAMPLE-nameSpace-Value",
                object_name_prefix="EXAMPLE-objectNamePrefix-Value"),
            custom_metric=oci.apm_traces.models.CustomMetric(
                name="EXAMPLE-name-Value",
                namespace="EXAMPLE-namespace-Value",
                description="EXAMPLE-description-Value",
                resource_group="EXAMPLE-resourceGroup-Value",
                is_anomaly_detection_enabled=True,
                compartment="EXAMPLE-compartment-Value",
                unit="EXAMPLE-unit-Value",
                is_metric_published=False)),
        scheduled_query_retention_criteria="UPDATE",
        freeform_tags={
            'EXAMPLE_KEY_p22W3': 'EXAMPLE_VALUE_5qUUdsvHpqlBBkrQvYLC'},
        defined_tags={
            'EXAMPLE_KEY_c5XkY': {
                'EXAMPLE_KEY_bAxr4': 'EXAMPLE--Value'}}),
    if_match="EXAMPLE-ifMatch-Value",
    opc_request_id="FNUTPQEXLUGKPETAWR7T<unique_ID>",
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_dry_run="EXAMPLE-opcDryRun-Value")

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

Was this article helpful?