# 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).
require 'date'
require '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::ConfigFileLoader.load_config
# Initialize service client with default config file
os_management_hub_client =
OCI::OsManagementHub::ScheduledJobClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
create_scheduled_job_response =
os_management_hub_client.create_scheduled_job(
OCI::OsManagementHub::Models::CreateScheduledJobDetails.new(
compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
schedule_type: 'RECURRING',
time_next_execution: DateTime.parse('2046-03-13T22:24:15.804Z'),
operations: [
OCI::OsManagementHub::Models::ScheduledJobOperation.new(
operation_type: 'INSTALL_WINDOWS_UPDATES',
package_names: %w[EXAMPLE--Value],
windows_update_names: %w[EXAMPLE--Value],
manage_module_streams_details:
OCI::OsManagementHub::Models::ManageModuleStreamsInScheduledJobDetails
.new(
enable: [
OCI::OsManagementHub::Models::ModuleStreamDetails.new(
module_name: 'EXAMPLE-moduleName-Value',
stream_name: 'EXAMPLE-streamName-Value',
software_source_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value'
)
],
disable: [
OCI::OsManagementHub::Models::ModuleStreamDetails.new(
module_name: 'EXAMPLE-moduleName-Value',
stream_name: 'EXAMPLE-streamName-Value',
software_source_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value'
)
],
install: [
OCI::OsManagementHub::Models::ModuleStreamProfileDetails.new(
module_name: 'EXAMPLE-moduleName-Value',
stream_name: 'EXAMPLE-streamName-Value',
profile_name: 'EXAMPLE-profileName-Value',
software_source_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value'
)
],
remove: [
OCI::OsManagementHub::Models::ModuleStreamProfileDetails.new(
module_name: 'EXAMPLE-moduleName-Value',
stream_name: 'EXAMPLE-streamName-Value',
profile_name: 'EXAMPLE-profileName-Value',
software_source_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value'
)
]
),
switch_module_streams_details:
OCI::OsManagementHub::Models::ModuleStreamDetails.new(
module_name: 'EXAMPLE-moduleName-Value',
stream_name: 'EXAMPLE-streamName-Value',
software_source_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value'
),
software_source_ids: %w[EXAMPLE--Value],
reboot_timeout_in_mins: 15,
install_snap_details:
OCI::OsManagementHub::Models::InstallSnapDetails.new(
name: 'EXAMPLE-name-Value',
channel: 'EXAMPLE-channel-Value',
is_signed: false,
mode: 'DEV_MODE',
revision: 'EXAMPLE-revision-Value'
),
remove_snap_details:
OCI::OsManagementHub::Models::RemoveSnapDetails.new(
name: 'EXAMPLE-name-Value', revision: 'EXAMPLE-revision-Value'
),
switch_snap_channel_details:
OCI::OsManagementHub::Models::SwitchSnapChannelDetails.new(
name: 'EXAMPLE-name-Value', channel: 'EXAMPLE-channel-Value'
)
)
],
display_name: 'EXAMPLE-displayName-Value',
description: 'EXAMPLE-description-Value',
locations: %w[ON_PREMISE OCI_COMPUTE AZURE EC2 GCP],
recurring_rule: 'EXAMPLE-recurringRule-Value',
managed_instance_ids: %w[EXAMPLE--Value],
managed_instance_group_ids: %w[EXAMPLE--Value],
managed_compartment_ids: %w[EXAMPLE--Value],
lifecycle_stage_ids: %w[EXAMPLE--Value],
dynamic_set_ids: %w[EXAMPLE--Value],
is_subcompartment_included: true,
freeform_tags: {
'EXAMPLE_KEY_CM6lR' => 'EXAMPLE_VALUE_sskzLRRBVsWP3Zk1YhJt'
},
defined_tags: {
'EXAMPLE_KEY_Vg5HS' => { 'EXAMPLE_KEY_F3wqP' => 'EXAMPLE--Value' }
},
retry_intervals: [658],
is_managed_by_autonomous_linux: false,
work_request_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-workRequestId-Value'
)
)
# Get the data from response
puts "#{create_scheduled_job_response.data}"