// 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 resourcescheduler from "oci-resourcescheduler";
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 resourcescheduler.ScheduleClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const updateScheduleDetails = {
displayName: "EXAMPLE-displayName-Value",
description: "EXAMPLE-description-Value",
action: resourcescheduler.models.UpdateScheduleDetails.Action.StartResource,
recurrenceDetails: "EXAMPLE-recurrenceDetails-Value",
recurrenceType: resourcescheduler.models.UpdateScheduleDetails.RecurrenceType.Cron,
resourceFilters: [{
attribute: "LIFECYCLE_STATE", value: ["EXAMPLE--Value" ]
}
],
resources: [{
id: "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
metadata: {
EXAMPLE_KEY_hNYRO :"EXAMPLE_VALUE_LbEMQxRdPHjxgMmnwrpV"
},
parameters: [{
parameterType: "QUERY", value: {
EXAMPLE_KEY_jj1zb :"EXAMPLE_VALUE_8dVcuT4NqSjt1jEl5ARV"
}
}
],
}
],
timeStarts: new Date("Mon Jun 25 09:31:19 UTC 2007"),
timeEnds: new Date("Wed Dec 30 09:11:06 UTC 2043"),
freeformTags: {
EXAMPLE_KEY_jt0gG :"EXAMPLE_VALUE_6XFQ3YbYUPg6Fno2j9hH"
},
definedTags: {
EXAMPLE_KEY_GhLQw :{
EXAMPLE_KEY_E0MPl :"EXAMPLE--Value"
}
},
}
const updateScheduleRequest: resourcescheduler.requests.UpdateScheduleRequest = {
scheduleId: "ocid1.test.oc1..<unique_ID>EXAMPLE-scheduleId-Value",
updateScheduleDetails: updateScheduleDetails,
ifMatch: "EXAMPLE-ifMatch-Value",
opcRequestId: "HLQPGTZP390ZNJMZIH0V<unique_ID>",
};
// Send request to the Client.
const updateScheduleResponse = await client.updateSchedule(updateScheduleRequest);
}
catch (error) {
console.log("updateSchedule Failed with error " + error);
}
})();