# 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).

import 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.config.from_file()


# Initialize service client with default config file
core_client = oci.core.ComputeClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
launch_instance_response = core_client.launch_instance(
    launch_instance_details=oci.core.models.LaunchInstanceDetails(
        availability_domain="EXAMPLE-availabilityDomain-Value",
        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        shape="EXAMPLE-shape-Value",
        capacity_reservation_id="ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value",
        create_vnic_details=oci.core.models.CreateVnicDetails(
            assign_public_ip=True,
            assign_private_dns_record=True,
            defined_tags={
                'EXAMPLE_KEY_SgMNk': {
                    'EXAMPLE_KEY_rNtIy': 'EXAMPLE--Value'}},
            display_name="EXAMPLE-displayName-Value",
            freeform_tags={
                'EXAMPLE_KEY_w837l': 'EXAMPLE_VALUE_aROI1WWesv2bnNBLo0Lc'},
            hostname_label="EXAMPLE-hostnameLabel-Value",
            nsg_ids=["EXAMPLE--Value"],
            private_ip="EXAMPLE-privateIp-Value",
            skip_source_dest_check=False,
            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_qNp2d': {
                'EXAMPLE_KEY_8qgDL': 'EXAMPLE--Value'}},
        display_name="EXAMPLE-displayName-Value",
        extended_metadata={
            'EXAMPLE_KEY_VC2Lo': 'EXAMPLE--Value'},
        fault_domain="EXAMPLE-faultDomain-Value",
        freeform_tags={
            'EXAMPLE_KEY_sHHst': 'EXAMPLE_VALUE_xqvkCTDHnaPUIU0fcex7'},
        hostname_label="EXAMPLE-hostnameLabel-Value",
        image_id="ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
        ipxe_script="EXAMPLE-ipxeScript-Value",
        launch_options=oci.core.models.LaunchOptions(
            boot_volume_type="ISCSI",
            firmware="UEFI_64",
            network_type="VFIO",
            remote_data_volume_type="VFIO",
            is_pv_encryption_in_transit_enabled=False,
            is_consistent_volume_naming_enabled=True),
        instance_options=oci.core.models.InstanceOptions(
            are_legacy_imds_endpoints_disabled=True),
        availability_config=oci.core.models.LaunchInstanceAvailabilityConfigDetails(
            is_live_migration_preferred=False,
            recovery_action="RESTORE_INSTANCE"),
        preemptible_instance_config=oci.core.models.PreemptibleInstanceConfigDetails(
            preemption_action=oci.core.models.TerminatePreemptionAction(
                type="TERMINATE",
                preserve_boot_volume=True)),
        metadata={
            'EXAMPLE_KEY_0b5Ei': 'EXAMPLE_VALUE_9RgeWxaQPgPX6uIe7Suv'},
        agent_config=oci.core.models.LaunchInstanceAgentConfigDetails(
            is_monitoring_disabled=False,
            is_management_disabled=True,
            are_all_plugins_disabled=False,
            plugins_config=[
                oci.core.models.InstanceAgentPluginConfigDetails(
                    name="EXAMPLE-name-Value",
                    desired_state="DISABLED")]),
        shape_config=oci.core.models.LaunchInstanceShapeConfigDetails(
            ocpus=6198.1313,
            memory_in_gbs=4307.694,
            baseline_ocpu_utilization="BASELINE_1_1"),
        source_details=oci.core.models.InstanceSourceViaBootVolumeDetails(
            source_type="bootVolume",
            boot_volume_id="ocid1.test.oc1..<unique_ID>EXAMPLE-bootVolumeId-Value"),
        subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
        is_pv_encryption_in_transit_enabled=True,
        platform_config=oci.core.models.AmdRomeBmLaunchInstancePlatformConfig(
            type="AMD_ROME_BM",
            is_secure_boot_enabled=False,
            is_trusted_platform_module_enabled=True,
            is_measured_boot_enabled=True)),
    opc_retry_token="EXAMPLE-opcRetryToken-Value")

# Get the data from response
print(launch_instance_response.data)