/**
         * Convert CreateLaunchConfigurationRequest to name value pairs
         */
        private static IDictionary <string, string> ConvertCreateLaunchConfiguration(CreateLaunchConfigurationRequest request)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["Action"] = "CreateLaunchConfiguration";
            if (request.IsSetLaunchConfigurationName())
            {
                parameters["LaunchConfigurationName"] = request.LaunchConfigurationName;
            }
            if (request.IsSetImageId())
            {
                parameters["ImageId"] = request.ImageId;
            }
            if (request.IsSetKeyName())
            {
                parameters["KeyName"] = request.KeyName;
            }
            List <string> createLaunchConfigurationRequestSecurityGroupsList      = request.SecurityGroups;
            int           createLaunchConfigurationRequestSecurityGroupsListIndex = 1;

            foreach (string createLaunchConfigurationRequestSecurityGroups in createLaunchConfigurationRequestSecurityGroupsList)
            {
                parameters[String.Concat("SecurityGroups", ".member.", createLaunchConfigurationRequestSecurityGroupsListIndex)] = createLaunchConfigurationRequestSecurityGroups;
                createLaunchConfigurationRequestSecurityGroupsListIndex++;
            }
            if (request.IsSetUserData())
            {
                parameters["UserData"] = request.UserData;
            }
            if (request.IsSetInstanceType())
            {
                parameters["InstanceType"] = request.InstanceType;
            }
            if (request.IsSetKernelId())
            {
                parameters["KernelId"] = request.KernelId;
            }
            if (request.IsSetRamdiskId())
            {
                parameters["RamdiskId"] = request.RamdiskId;
            }
            List <BlockDeviceMapping> createLaunchConfigurationRequestBlockDeviceMappingsList = request.BlockDeviceMappings;
            int createLaunchConfigurationRequestBlockDeviceMappingsListIndex = 1;

            foreach (BlockDeviceMapping createLaunchConfigurationRequestBlockDeviceMappings in createLaunchConfigurationRequestBlockDeviceMappingsList)
            {
                if (createLaunchConfigurationRequestBlockDeviceMappings.IsSetVirtualName())
                {
                    parameters[String.Concat("BlockDeviceMappings", ".member.", createLaunchConfigurationRequestBlockDeviceMappingsListIndex, ".", "VirtualName")] = createLaunchConfigurationRequestBlockDeviceMappings.VirtualName;
                }
                if (createLaunchConfigurationRequestBlockDeviceMappings.IsSetDeviceName())
                {
                    parameters[String.Concat("BlockDeviceMappings", ".member.", createLaunchConfigurationRequestBlockDeviceMappingsListIndex, ".", "DeviceName")] = createLaunchConfigurationRequestBlockDeviceMappings.DeviceName;
                }

                createLaunchConfigurationRequestBlockDeviceMappingsListIndex++;
            }

            return(parameters);
        }
Beispiel #2
0
        private static IDictionary <string, string> ConvertCreateLaunchConfiguration(CreateLaunchConfigurationRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "CreateLaunchConfiguration";
            if (request.IsSetLaunchConfigurationName())
            {
                dictionary["LaunchConfigurationName"] = request.LaunchConfigurationName;
            }
            if (request.IsSetImageId())
            {
                dictionary["ImageId"] = request.ImageId;
            }
            if (request.IsSetKeyName())
            {
                dictionary["KeyName"] = request.KeyName;
            }
            List <string> securityGroups = request.SecurityGroups;
            int           num            = 1;

            foreach (string str in securityGroups)
            {
                dictionary["SecurityGroups" + ".member." + num] = str;
                num++;
            }
            if (request.IsSetUserData())
            {
                dictionary["UserData"] = request.UserData;
            }
            if (request.IsSetInstanceType())
            {
                dictionary["InstanceType"] = request.InstanceType;
            }
            if (request.IsSetKernelId())
            {
                dictionary["KernelId"] = request.KernelId;
            }
            if (request.IsSetRamdiskId())
            {
                dictionary["RamdiskId"] = request.RamdiskId;
            }
            List <BlockDeviceMapping> blockDeviceMappings = request.BlockDeviceMappings;
            int num2 = 1;

            foreach (BlockDeviceMapping mapping in blockDeviceMappings)
            {
                if (mapping.IsSetVirtualName())
                {
                    dictionary[string.Concat(new object[] { "BlockDeviceMappings", ".member.", num2, ".", "VirtualName" })] = mapping.VirtualName;
                }
                if (mapping.IsSetDeviceName())
                {
                    dictionary[string.Concat(new object[] { "BlockDeviceMappings", ".member.", num2, ".", "DeviceName" })] = mapping.DeviceName;
                }
                num2++;
            }
            return(dictionary);
        }