public static ImportInstanceLaunchSpecification PopulateLaunchSpecificationInstance(ImportLaunchConfiguration config)
{
var launchSpecification = new ImportInstanceLaunchSpecification
{
Architecture = config.Architecture,
InstanceType = config.InstanceType,
Monitoring = config.EnableMonitoring,
};
if (config.SecurityGroupNames != null)
launchSpecification.GroupNames.AddRange(config.SecurityGroupNames);
if (!string.IsNullOrEmpty(config.AvailabilityZone))
launchSpecification.Placement = new Placement { AvailabilityZone = config.AvailabilityZone };
if (!string.IsNullOrEmpty(config.SubnetId))
launchSpecification.SubnetId = config.SubnetId;
if (!string.IsNullOrEmpty(config.PrivateIpAddress))
launchSpecification.PrivateIpAddress = config.PrivateIpAddress;
if (config.InstanceInitiatedShutdownBehavior != null)
launchSpecification.InstanceInitiatedShutdownBehavior = config.InstanceInitiatedShutdownBehavior;
if (!string.IsNullOrEmpty(config.AdditionalInfo))
launchSpecification.AdditionalInfo = config.AdditionalInfo;
return launchSpecification;
}