// 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 updateMonitorDetails = {
displayName: "EXAMPLE-displayName-Value",
vantagePoints: ["EXAMPLE--Value" ],
scriptId: "ocid1.test.oc1..<unique_ID>EXAMPLE-scriptId-Value",
status: apmsynthetics.models.MonitorStatus.Invalid,
repeatIntervalInSeconds: 184,
isRunOnce: false,
timeoutInSeconds: 706,
target: "EXAMPLE-target-Value",
scriptParameters: [{
paramName: "EXAMPLE-paramName-Value",
paramValue: "EXAMPLE-paramValue-Value",
}
],
configuration: {
configType: "REST_CONFIG", isRedirectionEnabled: true,
isCertificateValidationEnabled: true,
requestMethod: apmsynthetics.models.RequestMethods.Post,
reqAuthenticationScheme: apmsynthetics.models.RequestAuthenticationSchemes.Basic,
reqAuthenticationDetails: {
oauthScheme: apmsynthetics.models.OAuthSchemes.None,
authUserName: "EXAMPLE-authUserName-Value",
authUserPassword: "EXAMPLE-authUserPassword-Value",
authToken: "EXAMPLE-authToken-Value",
authUrl: "EXAMPLE-authUrl-Value",
authHeaders: [{
headerName: "EXAMPLE-headerName-Value",
headerValue: "EXAMPLE-headerValue-Value",
}
],
authRequestMethod: apmsynthetics.models.RequestMethods.Post,
authRequestPostBody: "EXAMPLE-authRequestPostBody-Value",
}
,
clientCertificateDetails: {
clientCertificate: {
fileName: "EXAMPLE-fileName-Value",
content: "EXAMPLE-content-Value",
}
,
privateKey: {
fileName: "EXAMPLE-fileName-Value",
content: "EXAMPLE-content-Value",
}
,
}
,
requestHeaders: [{
headerName: "EXAMPLE-headerName-Value",
headerValue: "EXAMPLE-headerValue-Value",
}
],
requestQueryParams: [{
paramName: "EXAMPLE-paramName-Value",
paramValue: "EXAMPLE-paramValue-Value",
}
],
requestPostBody: "EXAMPLE-requestPostBody-Value",
verifyResponseContent: "EXAMPLE-verifyResponseContent-Value",
verifyResponseCodes: ["EXAMPLE--Value" ],
networkConfiguration: {
numberOfHops: 176,
probePerHop: 5,
transmissionRate: 65,
protocol: apmsynthetics.models.Protocol.Tcp,
probeMode: apmsynthetics.models.ProbeMode.Sack,
}
,
isFailureRetried: true,
dnsConfiguration: {
isOverrideDns: true,
overrideDnsIp: "EXAMPLE-overrideDnsIp-Value",
}
}
,
availabilityConfiguration: {
maxAllowedFailuresPerInterval: 128,
minAllowedRunsPerInterval: 207,
}
,
maintenanceWindowSchedule: {
timeStarted: new Date("Thu Nov 19 19:24:05 UTC 2026"),
timeEnded: new Date("Mon Apr 30 10:56:26 UTC 2035"),
}
,
freeformTags: {
EXAMPLE_KEY_6o60V :"EXAMPLE_VALUE_v2PPuWQjNcxwNm34GFN3"
},
definedTags: {
EXAMPLE_KEY_9rVd8 :{
EXAMPLE_KEY_YQxUc :"EXAMPLE--Value"
}
},
isRunNow: false,
schedulingPolicy: apmsynthetics.models.SchedulingPolicy.BatchedRoundRobin,
batchIntervalInSeconds: 545,
isIPv6: true,
}
const updateMonitorRequest: apmsynthetics.requests.UpdateMonitorRequest = {
apmDomainId: "ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value",
monitorId: "ocid1.test.oc1..<unique_ID>EXAMPLE-monitorId-Value",
updateMonitorDetails: updateMonitorDetails,
ifMatch: "EXAMPLE-ifMatch-Value",
opcRequestId: "N9VXP0TSQ9SK3AZ7XI7O<unique_ID>",
};
// Send request to the Client.
const updateMonitorResponse = await client.updateMonitor(updateMonitorRequest);
}
catch (error) {
console.log("updateMonitor Failed with error " + error);
}
})();