# 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
stack_monitoring_client =
  OCI::StackMonitoring::StackMonitoringClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
create_maintenance_window_response =
  stack_monitoring_client.create_maintenance_window(
    OCI::StackMonitoring::Models::CreateMaintenanceWindowDetails.new(
      name: 'EXAMPLE-name-Value',
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      resources: [
        OCI::StackMonitoring::Models::CreateMaintenanceWindowResourceDetails
          .new(
          resource_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-resourceId-Value',
          are_members_included: true
        )
      ],
      schedule:
        OCI::StackMonitoring::Models::OneTimeMaintenanceWindowSchedule.new(
          schedule_type: 'ONE_TIME',
          time_maintenance_window_start:
            DateTime.parse('2031-02-08T14:49:52.184Z'),
          time_maintenance_window_end:
            DateTime.parse('2033-09-06T20:13:26.882Z')
        ),
      description: 'EXAMPLE-description-Value',
      freeform_tags: {
        'EXAMPLE_KEY_OOkEr' => 'EXAMPLE_VALUE_WCcZ0azyZ0gdQ5FKXVDP'
      },
      defined_tags: {
        'EXAMPLE_KEY_SDpcW' => { 'EXAMPLE_KEY_e2aPB' => 'EXAMPLE--Value' }
      }
    )
  )

# Get the data from response
puts "#{create_maintenance_window_response.data}"