# 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
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(
is_ai_enterprise_enabled: true,
capacity_reservation_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value',
defined_tags: {
'EXAMPLE_KEY_N8uNB' => { 'EXAMPLE_KEY_UNrPR' => 'EXAMPLE--Value' }
},
security_attributes: {
'EXAMPLE_KEY_Y6Gfj' => { 'EXAMPLE_KEY_WTLjd' => 'EXAMPLE--Value' }
},
display_name: 'EXAMPLE-displayName-Value',
freeform_tags: {
'EXAMPLE_KEY_pJqRV' => 'EXAMPLE_VALUE_IF6qHeUVrVI59jnZ5J3E'
},
agent_config:
OCI::Core::Models::UpdateInstanceAgentConfigDetails.new(
is_monitoring_disabled: true,
is_management_disabled: true,
are_all_plugins_disabled: false,
plugins_config: [
OCI::Core::Models::InstanceAgentPluginConfigDetails.new(
name: 'EXAMPLE-name-Value', desired_state: 'ENABLED'
)
]
),
metadata: { 'EXAMPLE_KEY_Jz3GQ' => 'EXAMPLE_VALUE_r12kwmo50HPcRvcJHw5c' },
extended_metadata: { 'EXAMPLE_KEY_4SeV9' => 'EXAMPLE--Value' },
shape: 'EXAMPLE-shape-Value',
shape_config:
OCI::Core::Models::UpdateInstanceShapeConfigDetails.new(
ocpus: 7352.358,
vcpus: 947,
memory_in_gbs: 7257.0854,
baseline_ocpu_utilization: 'BASELINE_1_8',
nvmes: 6,
resource_management: 'STATIC',
local_volume_size_in_gbs: 12_408
),
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: true,
boot_volume_size_in_gbs: 919,
kms_key_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value'
),
update_operation_constraint: 'ALLOW_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: 'PARAVIRTUALIZED',
network_type: 'PARAVIRTUALIZED',
is_pv_encryption_in_transit_enabled: false
),
availability_config:
OCI::Core::Models::UpdateInstanceAvailabilityConfigDetails.new(
is_live_migration_preferred: false,
recovery_action: 'RESTORE_INSTANCE'
),
time_maintenance_reboot_due: DateTime.parse('2023-01-13T12:08:32.853Z'),
dedicated_vm_host_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-dedicatedVmHostId-Value',
platform_config:
OCI::Core::Models::IntelVmUpdateInstancePlatformConfig.new(
type: 'INTEL_VM', is_symmetric_multi_threading_enabled: false
),
licensing_configs: [
OCI::Core::Models::UpdateInstanceWindowsLicensingConfig.new(
type: 'WINDOWS', license_type: 'PARTNER_PROVIDED'
)
]
)
)
# Get the data from response
puts "#{update_instance_response.data}"