# 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
cloud_migrations_client =
  OCI::CloudMigrations::MigrationClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
update_target_asset_response =
  cloud_migrations_client.update_target_asset(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-targetAssetId-Value',
    OCI::CloudMigrations::Models::UpdateVmTargetAssetDetails.new(
      type: 'INSTANCE',
      is_excluded_from_execution: false,
      preferred_shape_type: 'VM_INTEL_Optimized',
      block_volumes_performance: 843,
      ms_license: 'EXAMPLE-msLicense-Value',
      user_spec:
        OCI::CloudMigrations::Models::LaunchInstanceDetails.new(
          availability_domain: 'EXAMPLE-availabilityDomain-Value',
          capacity_reservation_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value',
          compartment_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
          create_vnic_details:
            OCI::CloudMigrations::Models::CreateVnicDetails.new(
              assign_public_ip: true,
              assign_private_dns_record: false,
              defined_tags: {
                'EXAMPLE_KEY_erlBr' => {
                  'EXAMPLE_KEY_OqC6r' => 'EXAMPLE--Value'
                }
              },
              display_name: 'EXAMPLE-displayName-Value',
              freeform_tags: {
                'EXAMPLE_KEY_YaCS3' => 'EXAMPLE_VALUE_CelFXo5buO29iSI6TpTC'
              },
              hostname_label: 'EXAMPLE-hostnameLabel-Value',
              nsg_ids: %w[EXAMPLE--Value],
              private_ip: 'EXAMPLE-privateIp-Value',
              skip_source_dest_check: true,
              subnet_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value',
              vlan_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value'
            ),
          dedicated_vm_host_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-dedicatedVmHostId-Value',
          defined_tags: {
            'EXAMPLE_KEY_2U0o3' => { 'EXAMPLE_KEY_NGmOq' => 'EXAMPLE--Value' }
          },
          display_name: 'EXAMPLE-displayName-Value',
          fault_domain: 'EXAMPLE-faultDomain-Value',
          freeform_tags: {
            'EXAMPLE_KEY_Kjj5N' => 'EXAMPLE_VALUE_1aSgZap3ou1bA68R3Wi1'
          },
          hostname_label: 'EXAMPLE-hostnameLabel-Value',
          ipxe_script: 'EXAMPLE-ipxeScript-Value',
          instance_options:
            OCI::CloudMigrations::Models::InstanceOptions.new(
              are_legacy_imds_endpoints_disabled: false
            ),
          preemptible_instance_config:
            OCI::CloudMigrations::Models::PreemptibleInstanceConfigDetails.new(
              preemption_action:
                OCI::CloudMigrations::Models::TerminatePreemptionAction.new(
                  type: 'TERMINATE', preserve_boot_volume: true
                )
            ),
          agent_config:
            OCI::CloudMigrations::Models::LaunchInstanceAgentConfigDetails.new(
              is_monitoring_disabled: false,
              is_management_disabled: false,
              are_all_plugins_disabled: true,
              plugins_config: [
                OCI::CloudMigrations::Models::InstanceAgentPluginConfigDetails
                  .new(name: 'EXAMPLE-name-Value', desired_state: 'ENABLED')
              ]
            ),
          shape: 'EXAMPLE-shape-Value',
          shape_config:
            OCI::CloudMigrations::Models::LaunchInstanceShapeConfigDetails.new(
              ocpus: 8058.3086,
              memory_in_gbs: 7649.6904,
              baseline_ocpu_utilization: 'BASELINE_1_8'
            ),
          source_details:
            OCI::CloudMigrations::Models::InstanceSourceViaBootVolumeDetails
              .new(
              source_type: 'bootVolume',
              boot_volume_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-bootVolumeId-Value'
            ),
          is_pv_encryption_in_transit_enabled: true
        )
    )
  )

# Get the data from response
puts "#{update_target_asset_response.headers}"