// 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: 142,
isRunOnce: true,
timeoutInSeconds: 562,
target: "EXAMPLE-target-Value",
scriptParameters: [{
paramName: "EXAMPLE-paramName-Value",
paramValue: "EXAMPLE-paramValue-Value",
}
],
configuration: {
configType: "BROWSER_CONFIG", isCertificateValidationEnabled: true,
isDefaultSnapshotEnabled: false,
verifyTexts: [{
text: "EXAMPLE-text-Value",
}
],
verifyResponseCodes: ["EXAMPLE--Value" ],
networkConfiguration: {
numberOfHops: 92,
probePerHop: 2,
transmissionRate: 73,
protocol: apmsynthetics.models.Protocol.Icmp,
probeMode: apmsynthetics.models.ProbeMode.Sack,
}
,
isFailureRetried: true,
dnsConfiguration: {
isOverrideDns: false,
overrideDnsIp: "EXAMPLE-overrideDnsIp-Value",
}
}
,
availabilityConfiguration: {
maxAllowedFailuresPerInterval: 643,
minAllowedRunsPerInterval: 445,
}
,
maintenanceWindowSchedule: {
timeStarted: new Date("Fri Jun 18 14:18:26 UTC 2004"),
timeEnded: new Date("Wed Mar 04 14:04:32 UTC 2026"),
}
,
freeformTags: {
EXAMPLE_KEY_3ooeB :"EXAMPLE_VALUE_ZqPnJ61MUPv6xNYHStJk"
},
definedTags: {
EXAMPLE_KEY_YKbjC :{
EXAMPLE_KEY_Hgu01 :"EXAMPLE--Value"
}
},
isRunNow: false,
schedulingPolicy: apmsynthetics.models.SchedulingPolicy.All,
batchIntervalInSeconds: 246,
isIPv6: true,
}
const createMonitorRequest: apmsynthetics.requests.CreateMonitorRequest = {
apmDomainId: "ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value",
createMonitorDetails: createMonitorDetails,
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
opcRequestId: "MAQONPMQM8P6FYDII4EN<unique_ID>",
};
// Send request to the Client.
const createMonitorResponse = await client.createMonitor(createMonitorRequest);
}
catch (error) {
console.log("createMonitor Failed with error " + error);
}
})();