# 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
fleet_software_update_client =
  OCI::FleetSoftwareUpdate::FleetSoftwareUpdateClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
create_fsu_cycle_response =
  fleet_software_update_client.create_fsu_cycle(
    OCI::FleetSoftwareUpdate::Models::CreateUpgradeFsuCycle.new(
      type: 'UPGRADE',
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      fsu_collection_id:
        'ocid1.test.oc1..<unique_ID>EXAMPLE-fsuCollectionId-Value',
      goal_version_details:
        OCI::FleetSoftwareUpdate::Models::ExadbStackFsuGoalVersionDetails.new(
          type: 'EXADB_STACK',
          components: [
            OCI::FleetSoftwareUpdate::Models::GiGoalSoftwareComponentDetails
              .new(
              component_type: 'GI',
              goal_version_details:
                OCI::FleetSoftwareUpdate::Models::CustomGiGoalVersionDetails
                  .new(
                  goal_type: 'GI_CUSTOM_IMAGE',
                  goal_software_image_id:
                    'ocid1.test.oc1..<unique_ID>EXAMPLE-goalSoftwareImageId-Value'
                ),
              home_policy: 'USE_EXISTING',
              new_home_prefix: 'EXAMPLE-newHomePrefix-Value'
            )
          ],
          home_policy: 'USE_EXISTING',
          new_home_prefix: 'EXAMPLE-newHomePrefix-Value'
        ),
      display_name: 'EXAMPLE-displayName-Value',
      batching_strategy:
        OCI::FleetSoftwareUpdate::Models::CreateNonRollingBatchingStrategyDetails
          .new(type: 'NON_ROLLING'),
      stage_action_schedule:
        OCI::FleetSoftwareUpdate::Models::CreateStartTimeScheduleDetails.new(
          type: 'START_TIME',
          time_to_start: DateTime.parse('2012-08-10T17:25:32.908Z')
        ),
      apply_action_schedule:
        OCI::FleetSoftwareUpdate::Models::CreateStartTimeScheduleDetails.new(
          type: 'START_TIME',
          time_to_start: DateTime.parse('2042-11-04T19:59:33.933Z')
        ),
      diagnostics_collection:
        OCI::FleetSoftwareUpdate::Models::DiagnosticsCollectionDetails.new(
          log_collection_mode: 'NO_CHANGE'
        ),
      freeform_tags: {
        'EXAMPLE_KEY_HMNK8' => 'EXAMPLE_VALUE_7KkbifOwB0Z1rfw2ovxr'
      },
      defined_tags: {
        'EXAMPLE_KEY_SpNpK' => { 'EXAMPLE_KEY_P8Owt' => 'EXAMPLE--Value' }
      },
      upgrade_details:
        OCI::FleetSoftwareUpdate::Models::UpgradeGiCollectionDetails.new(
          collection_type: 'GI',
          is_ignore_prerequisites: false,
          is_ignore_post_upgrade_errors: false
        )
    )
  )

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