// 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 apmsynthetics from "oci-apmsynthetics";
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 apmsynthetics.ApmSyntheticClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const createMonitorDetails = {
displayName: "EXAMPLE-displayName-Value",
monitorType: apmsynthetics.models.MonitorTypes.Ftp,
vantagePoints: ["EXAMPLE--Value" ],
scriptId: "ocid1.test.oc1..<unique_ID>EXAMPLE-scriptId-Value",
status: apmsynthetics.models.MonitorStatus.Enabled,
repeatIntervalInSeconds: 549,
isRunOnce: false,
timeoutInSeconds: 28,
target: "EXAMPLE-target-Value",
scriptParameters: [{
paramName: "EXAMPLE-paramName-Value",
paramValue: "EXAMPLE-paramValue-Value",
}
],
configuration: {
configType: "DNS_TRACE_CONFIG", recordType: apmsynthetics.models.DnsRecordType.Soa,
protocol: apmsynthetics.models.DnsTransportProtocol.Udp,
verifyResponseContent: "EXAMPLE-verifyResponseContent-Value",
isFailureRetried: true,
dnsConfiguration: {
isOverrideDns: true,
overrideDnsIp: "EXAMPLE-overrideDnsIp-Value",
}
}
,
availabilityConfiguration: {
maxAllowedFailuresPerInterval: 396,
minAllowedRunsPerInterval: 361,
}
,
maintenanceWindowSchedule: {
timeStarted: new Date("Sat Sep 22 15:07:31 UTC 2035"),
timeEnded: new Date("Thu May 18 11:46:28 UTC 2034"),
}
,
freeformTags: {
EXAMPLE_KEY_m3UEB :"EXAMPLE_VALUE_7vPTzUwFbD2RyqsLTm44"
},
definedTags: {
EXAMPLE_KEY_woi5q :{
EXAMPLE_KEY_8tsUL :"EXAMPLE--Value"
}
},
isRunNow: true,
schedulingPolicy: apmsynthetics.models.SchedulingPolicy.RoundRobin,
batchIntervalInSeconds: 507,
isIPv6: false,
}
const createMonitorRequest: apmsynthetics.requests.CreateMonitorRequest = {
apmDomainId: "ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value",
createMonitorDetails: createMonitorDetails,
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
opcRequestId: "IV4EV2JMA7B5W8PFIRLD<unique_ID>",
};
// Send request to the Client.
const createMonitorResponse = await client.createMonitor(createMonitorRequest);
}
catch (error) {
console.log("createMonitor Failed with error " + error);
}
})();