// 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{VolumeId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-volumeId-Value"),
AttachDetails: core.InstanceConfigurationIscsiAttachVolumeDetails{DisplayName: common.String("EXAMPLE-displayName-Value"),
IsReadOnly: common.Bool(false),
IsShareable: common.Bool(false),
UseChap: common.Bool(false),
Device: common.String("EXAMPLE-device-Value")},
CreateDetails: &core.InstanceConfigurationCreateVolumeDetails{SourceDetails: core.InstanceConfigurationVolumeSourceFromVolumeBackupDetails{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")},
AutotunePolicies: []core.InstanceConfigurationAutotunePolicy{core.InstanceConfigurationDetachedVolumeAutotunePolicy{}},
VpusPerGB: common.Int64(667),
AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
BackupPolicyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-backupPolicyId-Value"),
BlockVolumeReplicas: []core.InstanceConfigurationBlockVolumeReplicaDetails{core.InstanceConfigurationBlockVolumeReplicaDetails{AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value")}},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_5v70a": map[string]interface{}{"EXAMPLE_KEY_7Bajf": "EXAMPLE--Value"}},
FreeformTags: map[string]string{"EXAMPLE_KEY_cXwUk": "EXAMPLE_VALUE_5XmZ165FJny655HgZhXD"},
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
IsReservationsEnabled: common.Bool(true),
SizeInGBs: common.Int64(0),
XrcKmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-xrcKmsKeyId-Value"),
ClusterPlacementGroupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value"),
DisplayName: common.String("EXAMPLE-displayName-Value"),
IsAutoTuneEnabled: common.Bool(false)}}},
LaunchDetails: &core.InstanceConfigurationLaunchInstanceDetails{CreateVnicDetails: &core.InstanceConfigurationCreateVnicDetails{AssignPrivateDnsRecord: common.Bool(false),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_wa0Nn": map[string]interface{}{"EXAMPLE_KEY_8x7z1": "EXAMPLE--Value"}},
FreeformTags: map[string]string{"EXAMPLE_KEY_xPsZp": "EXAMPLE_VALUE_DPoOxArtltMUr7c0SliF"},
HostnameLabel: common.String("EXAMPLE-hostnameLabel-Value"),
PrivateIp: common.String("EXAMPLE-privateIp-Value"),
SkipSourceDestCheck: common.Bool(false),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
AssignPublicIp: common.Bool(false),
DisplayName: common.String("EXAMPLE-displayName-Value"),
Ipv6AddressIpv6SubnetCidrPairDetails: []core.InstanceConfigurationIpv6AddressIpv6SubnetCidrPairDetails{core.InstanceConfigurationIpv6AddressIpv6SubnetCidrPairDetails{Ipv6SubnetCidr: common.String("EXAMPLE-ipv6SubnetCidr-Value"),
Ipv6Address: common.String("EXAMPLE-ipv6Address-Value")}},
NsgIds: []string{"EXAMPLE--Value"},
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_eCxnC": map[string]interface{}{"EXAMPLE_KEY_GIbbm": "EXAMPLE--Value"}},
SubnetCidr: common.String("EXAMPLE-subnetCidr-Value"),
AssignIpv6Ip: common.Bool(true)},
FreeformTags: map[string]string{"EXAMPLE_KEY_yuQJe": "EXAMPLE_VALUE_12GEhCHcuaFVEsuRW6KW"},
IsAIEnterpriseEnabled: common.Bool(false),
AgentConfig: &core.InstanceConfigurationLaunchInstanceAgentConfigDetails{AreAllPluginsDisabled: common.Bool(true),
IsManagementDisabled: common.Bool(true),
IsMonitoringDisabled: common.Bool(false),
PluginsConfig: []core.InstanceAgentPluginConfigDetails{core.InstanceAgentPluginConfigDetails{DesiredState: core.InstanceAgentPluginConfigDetailsDesiredStateEnabled,
Name: common.String("EXAMPLE-name-Value")}}},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DedicatedVmHostId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-dedicatedVmHostId-Value"),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_Aj2MY": map[string]interface{}{"EXAMPLE_KEY_Ee2qs": "EXAMPLE--Value"}},
ExtendedMetadata: map[string]interface{}{"EXAMPLE_KEY_JKmTy": "EXAMPLE--Value"},
FaultDomain: common.String("EXAMPLE-faultDomain-Value"),
AvailabilityConfig: &core.InstanceConfigurationAvailabilityConfig{IsLiveMigrationPreferred: common.Bool(false),
RecoveryAction: core.InstanceConfigurationAvailabilityConfigRecoveryActionStopInstance},
ComputeClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-computeClusterId-Value"),
Metadata: map[string]string{"EXAMPLE_KEY_vdGO8": "EXAMPLE_VALUE_BhKx9F8GgzlJlb2lCzEJ"},
PlacementConstraintDetails: core.InstanceConfigurationHostGroupPlacementConstraintDetails{ComputeHostGroupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-computeHostGroupId-Value")},
AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
ClusterPlacementGroupId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value"),
LaunchOptions: &core.InstanceConfigurationLaunchOptions{BootVolumeType: core.InstanceConfigurationLaunchOptionsBootVolumeTypeParavirtualized,
Firmware: core.InstanceConfigurationLaunchOptionsFirmwareBios,
IsConsistentVolumeNamingEnabled: common.Bool(true),
IsPvEncryptionInTransitEnabled: common.Bool(false),
NetworkType: core.InstanceConfigurationLaunchOptionsNetworkTypeParavirtualized,
RemoteDataVolumeType: core.InstanceConfigurationLaunchOptionsRemoteDataVolumeTypeScsi},
PreemptibleInstanceConfig: &core.PreemptibleInstanceConfigDetails{PreemptionAction: core.TerminatePreemptionAction{PreserveBootVolume: common.Bool(false)}},
PreferredMaintenanceAction: core.InstanceConfigurationLaunchInstanceDetailsPreferredMaintenanceActionReboot,
SourceDetails: core.InstanceConfigurationInstanceSourceViaBootVolumeDetails{BootVolumeId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-bootVolumeId-Value")},
IpxeScript: common.String("EXAMPLE-ipxeScript-Value"),
ShapeConfig: &core.InstanceConfigurationLaunchInstanceShapeConfigDetails{Vcpus: common.Int(538),
BaselineOcpuUtilization: core.InstanceConfigurationLaunchInstanceShapeConfigDetailsBaselineOcpuUtilization8,
MemoryInGBs: common.Float32(4814.49),
Nvmes: common.Int(5),
Ocpus: common.Float32(2230.4863),
ResourceManagement: core.InstanceConfigurationLaunchInstanceShapeConfigDetailsResourceManagementDynamic},
DisplayName: common.String("EXAMPLE-displayName-Value"),
InstanceOptions: &core.InstanceConfigurationInstanceOptions{AreLegacyImdsEndpointsDisabled: common.Bool(true)},
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_xGok6": map[string]interface{}{"EXAMPLE_KEY_p3RNe": "EXAMPLE--Value"}},
Shape: common.String("EXAMPLE-shape-Value"),
IsPvEncryptionInTransitEnabled: common.Bool(true),
LaunchMode: core.InstanceConfigurationLaunchInstanceDetailsLaunchModeNative,
LicensingConfigs: []core.LaunchInstanceLicensingConfig{core.LaunchInstanceWindowsLicensingConfig{LicenseType: core.LaunchInstanceLicensingConfigLicenseTypeOciProvided}},
PlatformConfig: core.InstanceConfigurationIntelIcelakeBmLaunchInstancePlatformConfig{IsTrustedPlatformModuleEnabled: common.Bool(false),
NumaNodesPerSocket: core.InstanceConfigurationIntelIcelakeBmLaunchInstancePlatformConfigNumaNodesPerSocketNps1,
PercentageOfCoresEnabled: common.Int(61),
IsInputOutputMemoryManagementUnitEnabled: common.Bool(true),
IsSecureBootEnabled: common.Bool(false),
ConfigMap: map[string]string{"EXAMPLE_KEY_hmIgF": "EXAMPLE_VALUE_hHafLsLYTIPjN6gXWqnv"},
IsMeasuredBootEnabled: common.Bool(false),
IsMemoryEncryptionEnabled: common.Bool(true),
IsSymmetricMultiThreadingEnabled: common.Bool(true)},
CapacityReservationId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value")},
SecondaryVnics: []core.InstanceConfigurationAttachVnicDetails{core.InstanceConfigurationAttachVnicDetails{CreateVnicDetails: &core.InstanceConfigurationCreateVnicDetails{AssignIpv6Ip: common.Bool(false),
AssignPrivateDnsRecord: common.Bool(false),
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_ZXH8I": map[string]interface{}{"EXAMPLE_KEY_G6BPa": "EXAMPLE--Value"}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
PrivateIp: common.String("EXAMPLE-privateIp-Value"),
SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_fwkY9": map[string]interface{}{"EXAMPLE_KEY_8wMQY": "EXAMPLE--Value"}},
SubnetCidr: common.String("EXAMPLE-subnetCidr-Value"),
AssignPublicIp: common.Bool(true),
FreeformTags: map[string]string{"EXAMPLE_KEY_g3eiK": "EXAMPLE_VALUE_h7uPMzkRiVG97ZteiELh"},
HostnameLabel: common.String("EXAMPLE-hostnameLabel-Value"),
Ipv6AddressIpv6SubnetCidrPairDetails: []core.InstanceConfigurationIpv6AddressIpv6SubnetCidrPairDetails{core.InstanceConfigurationIpv6AddressIpv6SubnetCidrPairDetails{Ipv6Address: common.String("EXAMPLE-ipv6Address-Value"),
Ipv6SubnetCidr: common.String("EXAMPLE-ipv6SubnetCidr-Value")}},
NsgIds: []string{"EXAMPLE--Value"},
SkipSourceDestCheck: common.Bool(false),
SubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value")},
DisplayName: common.String("EXAMPLE-displayName-Value"),
NicIndex: common.Int(13)}}}}},
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)
}