# 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 '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::DynamicSetClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
update_dynamic_set_response =
  os_management_hub_client.update_dynamic_set(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-dynamicSetId-Value',
    OCI::OsManagementHub::Models::UpdateDynamicSetDetails.new(
      display_name: 'EXAMPLE-displayName-Value',
      description: 'EXAMPLE-description-Value',
      target_compartments: [
        OCI::OsManagementHub::Models::TargetCompartmentDetails.new(
          compartment_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
          does_include_children: true
        )
      ],
      match_type: 'ALL',
      matching_rule:
        OCI::OsManagementHub::Models::MatchingRule.new(
          tags: [
            OCI::OsManagementHub::Models::FreeFormTag.new(
              type: 'FREEFORM',
              key: 'EXAMPLE-key-Value',
              value: 'EXAMPLE-value-Value'
            )
          ],
          managed_instance_ids: %w[EXAMPLE--Value],
          managed_instance_group_ids: %w[EXAMPLE--Value],
          display_names: %w[EXAMPLE--Value],
          os_names: %w[ORACLE_LINUX],
          architectures: %w[AARCH64],
          os_families: %w[WINDOWS_SERVER_2025],
          statuses: %w[ERROR],
          locations: %w[EC2],
          is_reboot_required: false
        ),
      freeform_tags: {
        'EXAMPLE_KEY_8D5nh' => 'EXAMPLE_VALUE_uGwh7GCmd15q96VBtqCO'
      },
      defined_tags: {
        'EXAMPLE_KEY_FKL6I' => { 'EXAMPLE_KEY_0r3LT' => 'EXAMPLE--Value' }
      }
    )
  )

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