# 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).
require '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::ConfigFileLoader.load_config
# Initialize service client with default config file
apm_traces_client = OCI::ApmTraces::ScheduledQueryClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
create_scheduled_query_response =
apm_traces_client.create_scheduled_query(
'ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value',
OCI::ApmTraces::Models::CreateScheduledQueryDetails.new(
scheduled_query_name: 'EXAMPLE-scheduledQueryName-Value',
scheduled_query_processing_type: 'QUERY',
scheduled_query_text: 'EXAMPLE-scheduledQueryText-Value',
scheduled_query_schedule: 'EXAMPLE-scheduledQuerySchedule-Value',
scheduled_query_description: 'EXAMPLE-scheduledQueryDescription-Value',
scheduled_query_maximum_runtime_in_seconds: 817,
scheduled_query_retention_period_in_ms: 730,
scheduled_query_processing_sub_type: 'CUSTOM_METRIC',
scheduled_query_processing_configuration:
OCI::ApmTraces::Models::ScheduledQueryProcessingConfig.new(
streaming:
OCI::ApmTraces::Models::Streaming.new(
stream_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-streamId-Value'
),
object_storage:
OCI::ApmTraces::Models::ObjectStorage.new(
bucket_name: 'EXAMPLE-bucketName-Value',
name_space: 'EXAMPLE-nameSpace-Value',
object_name_prefix: 'EXAMPLE-objectNamePrefix-Value'
),
custom_metric:
OCI::ApmTraces::Models::CustomMetric.new(
name: 'EXAMPLE-name-Value',
namespace: 'EXAMPLE-namespace-Value',
description: 'EXAMPLE-description-Value',
resource_group: 'EXAMPLE-resourceGroup-Value',
is_anomaly_detection_enabled: false,
compartment: 'EXAMPLE-compartment-Value',
unit: 'EXAMPLE-unit-Value',
is_metric_published: false
)
),
scheduled_query_retention_criteria: 'UPDATE',
freeform_tags: {
'EXAMPLE_KEY_vVbLz' => 'EXAMPLE_VALUE_jHPo3ERKOe3XRKHqWlZU'
},
defined_tags: {
'EXAMPLE_KEY_CO799' => { 'EXAMPLE_KEY_f3L9h' => 'EXAMPLE--Value' }
}
)
)
# Get the data from response
puts "#{create_scheduled_query_response.data}"