// 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 * as apmtraces from "oci-apmtraces";
import common = require("oci-common");

// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
    try {
     // Create a service client
     const client = new apmtraces.ScheduledQueryClient({ authenticationDetailsProvider: provider });

     // Create a request and dependent object(s).
	const  updateScheduledQueryDetails = {
		scheduledQueryName: "EXAMPLE-scheduledQueryName-Value",
		scheduledQueryProcessingType: apmtraces.models.ScheduledQueryProcessingType.Query,
		scheduledQueryProcessingSubType: apmtraces.models.ScheduledQueryProcessingSubType.None,
		scheduledQueryText: "EXAMPLE-scheduledQueryText-Value",
		scheduledQuerySchedule: "EXAMPLE-scheduledQuerySchedule-Value",
		scheduledQueryDescription: "EXAMPLE-scheduledQueryDescription-Value",
		scheduledQueryMaximumRuntimeInSeconds: 826,
		scheduledQueryRetentionPeriodInMs: 346,
		scheduledQueryProcessingConfiguration: {
			streaming: {
				streamId: "ocid1.test.oc1..<unique_ID>EXAMPLE-streamId-Value",

				}
,
			objectStorage: {
				bucketName: "EXAMPLE-bucketName-Value",
				nameSpace: "EXAMPLE-nameSpace-Value",
				objectNamePrefix: "EXAMPLE-objectNamePrefix-Value",

				}
,
			customMetric: {
				namespace: "EXAMPLE-namespace-Value",
				name: "EXAMPLE-name-Value",
				description: "EXAMPLE-description-Value",
				resourceGroup: "EXAMPLE-resourceGroup-Value",
				isAnomalyDetectionEnabled: false,
				compartment: "EXAMPLE-compartment-Value",
				unit: "EXAMPLE-unit-Value",
				isMetricPublished: false,

				}
,

			}
,
		scheduledQueryRetentionCriteria: apmtraces.models.ScheduledQueryRetentionCriteria.KeepDataUntilRetentionPeriod,
		freeformTags: {
			EXAMPLE_KEY_aqEP2 :"EXAMPLE_VALUE_TALlsbfTIzuwEEGGcZ3N"
			},
		definedTags: {
			EXAMPLE_KEY_88G8G :{
				EXAMPLE_KEY_DpNoM :"EXAMPLE--Value"
				}
			},

		}

	const updateScheduledQueryRequest: apmtraces.requests.UpdateScheduledQueryRequest = { 
	apmDomainId: "ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value",
	scheduledQueryId: "ocid1.test.oc1..<unique_ID>EXAMPLE-scheduledQueryId-Value",
	updateScheduledQueryDetails: updateScheduledQueryDetails,
	ifMatch: "EXAMPLE-ifMatch-Value",
	opcRequestId: "UYXWOZLKWYG06ESQL7Q8<unique_ID>",
	opcRetryToken: "EXAMPLE-opcRetryToken-Value",
	opcDryRun: "EXAMPLE-opcDryRun-Value",

		}; 


     // Send request to the Client.
     const updateScheduledQueryResponse = await client.updateScheduledQuery(updateScheduledQueryRequest);
     }
     catch (error) {
         console.log("updateScheduledQuery Failed with error  " + error);
     }
})();