# 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'
require 'date'
# 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
core_client = OCI::Core::ComputeClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
update_instance_response =
core_client.update_instance(
'ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value',
OCI::Core::Models::UpdateInstanceDetails.new(
capacity_reservation_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value',
defined_tags: {
'EXAMPLE_KEY_dS179' => { 'EXAMPLE_KEY_w3Xop' => 'EXAMPLE--Value' }
},
display_name: 'EXAMPLE-displayName-Value',
freeform_tags: {
'EXAMPLE_KEY_0XBNz' => 'EXAMPLE_VALUE_f2AMbZV1bVFoHsVyeWk2'
},
agent_config:
OCI::Core::Models::UpdateInstanceAgentConfigDetails.new(
is_monitoring_disabled: false,
is_management_disabled: false,
are_all_plugins_disabled: true,
plugins_config: [
OCI::Core::Models::InstanceAgentPluginConfigDetails.new(
name: 'EXAMPLE-name-Value', desired_state: 'ENABLED'
)
]
),
metadata: { 'EXAMPLE_KEY_qIRKB' => 'EXAMPLE_VALUE_TX6bVzOd2Lix84TEOsKC' },
extended_metadata: { 'EXAMPLE_KEY_sMlqk' => 'EXAMPLE--Value' },
shape: 'EXAMPLE-shape-Value',
shape_config:
OCI::Core::Models::UpdateInstanceShapeConfigDetails.new(
ocpus: 1560.1063,
vcpus: 448,
memory_in_gbs: 6556.356,
baseline_ocpu_utilization: 'BASELINE_1_1',
nvmes: 4
),
source_details:
OCI::Core::Models::UpdateInstanceSourceViaImageDetails.new(
source_type: 'image',
image_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value',
is_preserve_boot_volume_enabled: false,
boot_volume_size_in_gbs: 62,
kms_key_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value'
),
update_operation_constraint: 'AVOID_DOWNTIME',
instance_options:
OCI::Core::Models::InstanceOptions.new(
are_legacy_imds_endpoints_disabled: false
),
fault_domain: 'EXAMPLE-faultDomain-Value',
launch_options:
OCI::Core::Models::UpdateLaunchOptions.new(
boot_volume_type: 'ISCSI',
network_type: 'PARAVIRTUALIZED',
is_pv_encryption_in_transit_enabled: false
),
availability_config:
OCI::Core::Models::UpdateInstanceAvailabilityConfigDetails.new(
is_live_migration_preferred: false, recovery_action: 'STOP_INSTANCE'
),
time_maintenance_reboot_due: DateTime.parse('2037-07-28T12:25:35.262Z'),
dedicated_vm_host_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-dedicatedVmHostId-Value',
platform_config:
OCI::Core::Models::AmdVmUpdateInstancePlatformConfig.new(
type: 'AMD_VM', is_symmetric_multi_threading_enabled: false
)
)
)
# Get the data from response
puts "#{update_instance_response.data}"