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

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/core"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleLaunchInstanceConfiguration() {
	// Create a default authentication provider that uses the DEFAULT
	// profile in the configuration file.
	// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
	client, err := core.NewComputeManagementClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := core.LaunchInstanceConfigurationRequest{InstanceConfiguration: core.ComputeInstanceOptions{Options: []core.ComputeInstanceDetails{core.ComputeInstanceDetails{BlockVolumes: []core.InstanceConfigurationBlockVolumeDetails{core.InstanceConfigurationBlockVolumeDetails{AttachDetails: core.InstanceConfigurationParavirtualizedAttachVolumeDetails{Device: common.String("EXAMPLE-device-Value"),
		DisplayName:                    common.String("EXAMPLE-displayName-Value"),
		IsPvEncryptionInTransitEnabled: common.Bool(false),
		IsReadOnly:                     common.Bool(false),
		IsShareable:                    common.Bool(false)},
		CreateDetails: &core.InstanceConfigurationCreateVolumeDetails{AutotunePolicies: []core.InstanceConfigurationAutotunePolicy{core.InstanceConfigurationPerformanceBasedAutotunePolicy{MaxVpusPerGB: common.Int64(868)}},
			AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
			DisplayName:        common.String("EXAMPLE-displayName-Value"),
			SourceDetails:      core.InstanceConfigurationVolumeSourceFromVolumeBackupDetails{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")},
			VpusPerGB:          common.Int64(470),
			BlockVolumeReplicas: []core.InstanceConfigurationBlockVolumeReplicaDetails{core.InstanceConfigurationBlockVolumeReplicaDetails{DisplayName: common.String("EXAMPLE-displayName-Value"),
				AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value")}},
			DefinedTags:             map[string]map[string]interface{}{"EXAMPLE_KEY_U0jxT": map[string]interface{}{"EXAMPLE_KEY_Yum49": "EXAMPLE--Value"}},
			IsAutoTuneEnabled:       common.Bool(false),
			KmsKeyId:                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
			BackupPolicyId:          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-backupPolicyId-Value"),
			FreeformTags:            map[string]string{"EXAMPLE_KEY_Z1S7m": "EXAMPLE_VALUE_6KA0fwKOh7cNikonHsem"},
			IsReservationsEnabled:   common.Bool(false),
			XrcKmsKeyId:             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-xrcKmsKeyId-Value"),
			ClusterPlacementGroupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value"),
			CompartmentId:           common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			SizeInGBs:               common.Int64(746)},
		VolumeId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-volumeId-Value")}},
		LaunchDetails: &core.InstanceConfigurationLaunchInstanceDetails{IpxeScript: common.String("EXAMPLE-ipxeScript-Value"),
			LaunchMode:                     core.InstanceConfigurationLaunchInstanceDetailsLaunchModeEmulated,
			PlacementConstraintDetails:     core.InstanceConfigurationHostGroupPlacementConstraintDetails{ComputeHostGroupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-computeHostGroupId-Value")},
			DedicatedVmHostId:              common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-dedicatedVmHostId-Value"),
			IsPvEncryptionInTransitEnabled: common.Bool(false),
			PreferredMaintenanceAction:     core.InstanceConfigurationLaunchInstanceDetailsPreferredMaintenanceActionLiveMigrate,
			ClusterPlacementGroupId:        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value"),
			ExtendedMetadata:               map[string]interface{}{"EXAMPLE_KEY_tQZvN": "EXAMPLE--Value"},
			PlatformConfig: core.InstanceConfigurationAmdMilanBmGpuLaunchInstancePlatformConfig{IsTrustedPlatformModuleEnabled: common.Bool(false),
				NumaNodesPerSocket:                       core.InstanceConfigurationAmdMilanBmGpuLaunchInstancePlatformConfigNumaNodesPerSocketNps2,
				ConfigMap:                                map[string]string{"EXAMPLE_KEY_rxu6m": "EXAMPLE_VALUE_DjrfqKr6kzJ2r3Q5eKB4"},
				IsAccessControlServiceEnabled:            common.Bool(false),
				IsMemoryEncryptionEnabled:                common.Bool(true),
				IsSecureBootEnabled:                      common.Bool(true),
				AreVirtualInstructionsEnabled:            common.Bool(true),
				IsInputOutputMemoryManagementUnitEnabled: common.Bool(true),
				IsMeasuredBootEnabled:                    common.Bool(false),
				IsSymmetricMultiThreadingEnabled:         common.Bool(false)},
			PreemptibleInstanceConfig: &core.PreemptibleInstanceConfigDetails{PreemptionAction: core.TerminatePreemptionAction{PreserveBootVolume: common.Bool(true)}},
			SourceDetails:             core.InstanceConfigurationInstanceSourceViaBootVolumeDetails{BootVolumeId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-bootVolumeId-Value")},
			ComputeClusterId:          common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-computeClusterId-Value"),
			AvailabilityConfig: &core.InstanceConfigurationAvailabilityConfig{IsLiveMigrationPreferred: common.Bool(false),
				RecoveryAction: core.InstanceConfigurationAvailabilityConfigRecoveryActionStopInstance},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			FreeformTags:  map[string]string{"EXAMPLE_KEY_gymy5": "EXAMPLE_VALUE_ctaA2KzKWXPS52VDjxvs"},
			LaunchOptions: &core.InstanceConfigurationLaunchOptions{BootVolumeType: core.InstanceConfigurationLaunchOptionsBootVolumeTypeIde,
				Firmware:                        core.InstanceConfigurationLaunchOptionsFirmwareBios,
				IsConsistentVolumeNamingEnabled: common.Bool(true),
				IsPvEncryptionInTransitEnabled:  common.Bool(false),
				NetworkType:                     core.InstanceConfigurationLaunchOptionsNetworkTypeVfio,
				RemoteDataVolumeType:            core.InstanceConfigurationLaunchOptionsRemoteDataVolumeTypeParavirtualized},
			LicensingConfigs: []core.LaunchInstanceLicensingConfig{core.LaunchInstanceWindowsLicensingConfig{LicenseType: core.LaunchInstanceLicensingConfigLicenseTypeBringYourOwnLicense}},
			AgentConfig: &core.InstanceConfigurationLaunchInstanceAgentConfigDetails{AreAllPluginsDisabled: common.Bool(false),
				IsManagementDisabled: common.Bool(false),
				IsMonitoringDisabled: common.Bool(false),
				PluginsConfig: []core.InstanceAgentPluginConfigDetails{core.InstanceAgentPluginConfigDetails{DesiredState: core.InstanceAgentPluginConfigDetailsDesiredStateDisabled,
					Name: common.String("EXAMPLE-name-Value")}}},
			Metadata:           map[string]string{"EXAMPLE_KEY_1r9mp": "EXAMPLE_VALUE_LKVg6ytQxIQV3wzGOlbD"},
			FaultDomain:        common.String("EXAMPLE-faultDomain-Value"),
			InstanceOptions:    &core.InstanceConfigurationInstanceOptions{AreLegacyImdsEndpointsDisabled: common.Bool(true)},
			SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_NLjXL": map[string]interface{}{"EXAMPLE_KEY_J5Aov": "EXAMPLE--Value"}},
			Shape:              common.String("EXAMPLE-shape-Value"),
			AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
			CreateVnicDetails: &core.InstanceConfigurationCreateVnicDetails{PrivateIp: common.String("EXAMPLE-privateIp-Value"),
				SkipSourceDestCheck: common.Bool(false),
				AssignIpv6Ip:        common.Bool(true),
				AssignPublicIp:      common.Bool(true),
				FreeformTags:        map[string]string{"EXAMPLE_KEY_2wgBf": "EXAMPLE_VALUE_aESTnXhmEjeCake58Hze"},
				Ipv6AddressIpv6SubnetCidrPairDetails: []core.InstanceConfigurationIpv6AddressIpv6SubnetCidrPairDetails{core.InstanceConfigurationIpv6AddressIpv6SubnetCidrPairDetails{Ipv6Address: common.String("EXAMPLE-ipv6Address-Value"),
					Ipv6SubnetCidr: common.String("EXAMPLE-ipv6SubnetCidr-Value")}},
				NsgIds:                 []string{"EXAMPLE--Value"},
				SubnetId:               common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
				AssignPrivateDnsRecord: common.Bool(false),
				DefinedTags:            map[string]map[string]interface{}{"EXAMPLE_KEY_BoTqH": map[string]interface{}{"EXAMPLE_KEY_1VcYY": "EXAMPLE--Value"}},
				DisplayName:            common.String("EXAMPLE-displayName-Value"),
				HostnameLabel:          common.String("EXAMPLE-hostnameLabel-Value"),
				SecurityAttributes:     map[string]map[string]interface{}{"EXAMPLE_KEY_5VrWw": map[string]interface{}{"EXAMPLE_KEY_KOBqF": "EXAMPLE--Value"}}},
			DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_vadct": map[string]interface{}{"EXAMPLE_KEY_suHRC": "EXAMPLE--Value"}},
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ShapeConfig: &core.InstanceConfigurationLaunchInstanceShapeConfigDetails{Vcpus: common.Int(769),
				BaselineOcpuUtilization: core.InstanceConfigurationLaunchInstanceShapeConfigDetailsBaselineOcpuUtilization1,
				MemoryInGBs:             common.Float32(3294.703),
				Nvmes:                   common.Int(2),
				Ocpus:                   common.Float32(4684.7544)},
			CapacityReservationId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value")},
		SecondaryVnics: []core.InstanceConfigurationAttachVnicDetails{core.InstanceConfigurationAttachVnicDetails{CreateVnicDetails: &core.InstanceConfigurationCreateVnicDetails{DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_BCeI4": map[string]interface{}{"EXAMPLE_KEY_UxbCO": "EXAMPLE--Value"}},
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			Ipv6AddressIpv6SubnetCidrPairDetails: []core.InstanceConfigurationIpv6AddressIpv6SubnetCidrPairDetails{core.InstanceConfigurationIpv6AddressIpv6SubnetCidrPairDetails{Ipv6Address: common.String("EXAMPLE-ipv6Address-Value"),
				Ipv6SubnetCidr: common.String("EXAMPLE-ipv6SubnetCidr-Value")}},
			NsgIds:                 []string{"EXAMPLE--Value"},
			PrivateIp:              common.String("EXAMPLE-privateIp-Value"),
			SkipSourceDestCheck:    common.Bool(true),
			AssignIpv6Ip:           common.Bool(true),
			AssignPrivateDnsRecord: common.Bool(true),
			HostnameLabel:          common.String("EXAMPLE-hostnameLabel-Value"),
			SecurityAttributes:     map[string]map[string]interface{}{"EXAMPLE_KEY_wPj0p": map[string]interface{}{"EXAMPLE_KEY_cYDtY": "EXAMPLE--Value"}},
			SubnetId:               common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
			AssignPublicIp:         common.Bool(true),
			FreeformTags:           map[string]string{"EXAMPLE_KEY_7FUM6": "EXAMPLE_VALUE_rjN8ZOM4pYPQIs40eAOq"}},
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			NicIndex:    common.Int(10)}}}}},
		InstanceConfigurationId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-instanceConfigurationId-Value"),
		OpcRetryToken:           common.String("EXAMPLE-opcRetryToken-Value")}

	// Send the request using the service client
	resp, err := client.LaunchInstanceConfiguration(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}