# 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::CreatePatchFsuCycle.new(
      type: 'PATCH',
      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::ImageIdFsuTargetDetails.new(
          type: 'IMAGE_ID',
          software_image_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-softwareImageId-Value',
          home_policy: 'CREATE_NEW',
          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('2041-04-25T01:25:10.862Z')
        ),
      apply_action_schedule:
        OCI::FleetSoftwareUpdate::Models::CreateStartTimeScheduleDetails.new(
          type: 'START_TIME',
          time_to_start: DateTime.parse('2042-07-10T15:23:03.768Z')
        ),
      diagnostics_collection:
        OCI::FleetSoftwareUpdate::Models::DiagnosticsCollectionDetails.new(
          log_collection_mode: 'ENABLE'
        ),
      freeform_tags: {
        'EXAMPLE_KEY_OT8Oq' => 'EXAMPLE_VALUE_hQnTPQjWk2F1pxi8SpKI'
      },
      defined_tags: {
        'EXAMPLE_KEY_s5dhI' => { 'EXAMPLE_KEY_Cxk6M' => 'EXAMPLE--Value' }
      },
      is_ignore_patches: true,
      is_ignore_missing_patches: %w[EXAMPLE--Value],
      max_drain_timeout_in_seconds: 36,
      is_keep_placement: true
    )
  )

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

Was this article helpful?