# 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).
from datetime import datetime
import oci
# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()
# Initialize service client with default config file
resource_scheduler_client = oci.resource_scheduler.ScheduleClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_schedule_response = resource_scheduler_client.create_schedule(
create_schedule_details=oci.resource_scheduler.models.CreateScheduleDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
action="START_RESOURCE",
recurrence_details="EXAMPLE-recurrenceDetails-Value",
recurrence_type="ICAL",
display_name="EXAMPLE-displayName-Value",
description="EXAMPLE-description-Value",
resource_filters=[
oci.resource_scheduler.models.ResourceTypeResourceFilter(
attribute="RESOURCE_TYPE",
value=["EXAMPLE--Value"])],
resources=[
oci.resource_scheduler.models.Resource(
id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
metadata={
'EXAMPLE_KEY_W9o1N': 'EXAMPLE_VALUE_kozNrvoVzH98NrbzBkE5'})],
time_starts=datetime.strptime(
"2003-02-11T19:40:22.563Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
time_ends=datetime.strptime(
"2005-05-05T20:03:04.811Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
freeform_tags={
'EXAMPLE_KEY_VFoZb': 'EXAMPLE_VALUE_owoY0IfhTfz6pUisKVEt'},
defined_tags={
'EXAMPLE_KEY_Dtbun': {
'EXAMPLE_KEY_dHERl': 'EXAMPLE--Value'}}),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="YRUTM3SFSYUZLSP99ZWM<unique_ID>")
# Get the data from response
print(create_schedule_response.data)