// 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.Dns,
vantagePoints: ["EXAMPLE--Value" ],
scriptId: "ocid1.test.oc1..<unique_ID>EXAMPLE-scriptId-Value",
status: apmsynthetics.models.MonitorStatus.Disabled,
repeatIntervalInSeconds: 680,
isRunOnce: false,
timeoutInSeconds: 405,
target: "EXAMPLE-target-Value",
scriptParameters: [{
paramName: "EXAMPLE-paramName-Value",
paramValue: "EXAMPLE-paramValue-Value",
}
],
configuration: {
configType: "NETWORK_CONFIG", networkConfiguration: {
numberOfHops: 31,
probePerHop: 5,
transmissionRate: 27,
protocol: apmsynthetics.models.Protocol.Tcp,
probeMode: apmsynthetics.models.ProbeMode.Syn,
}
,
isFailureRetried: false,
dnsConfiguration: {
isOverrideDns: false,
overrideDnsIp: "EXAMPLE-overrideDnsIp-Value",
}
}
,
availabilityConfiguration: {
maxAllowedFailuresPerInterval: 895,
minAllowedRunsPerInterval: 811,
}
,
maintenanceWindowSchedule: {
timeStarted: new Date("Fri Feb 05 19:24:14 UTC 2027"),
timeEnded: new Date("Wed Oct 29 14:01:06 UTC 2025"),
}
,
freeformTags: {
EXAMPLE_KEY_FewFd :"EXAMPLE_VALUE_ak0tEHPnqsUUu774RT7g"
},
definedTags: {
EXAMPLE_KEY_Fqc1Q :{
EXAMPLE_KEY_mW9ZD :"EXAMPLE--Value"
}
},
isRunNow: true,
schedulingPolicy: apmsynthetics.models.SchedulingPolicy.BatchedRoundRobin,
batchIntervalInSeconds: 645,
isIPv6: true,
}
const createMonitorRequest: apmsynthetics.requests.CreateMonitorRequest = {
apmDomainId: "ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value",
createMonitorDetails: createMonitorDetails,
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
opcRequestId: "DMBYBTUAYDHYQ8RDDUDR<unique_ID>",
};
// Send request to the Client.
const createMonitorResponse = await client.createMonitor(createMonitorRequest);
}
catch (error) {
console.log("createMonitor Failed with error " + error);
}
})();