public IRequest Marshall(CreateImageRequest createImageRequest)
        {
            IRequest request = new DefaultRequest(createImageRequest, "AmazonEC2");

            request.Parameters.Add("Action", "CreateImage");
            request.Parameters.Add("Version", "2013-10-15");
            if (createImageRequest != null && createImageRequest.IsSetInstanceId())
            {
                request.Parameters.Add("InstanceId", StringUtils.FromString(createImageRequest.InstanceId));
            }
            if (createImageRequest != null && createImageRequest.IsSetName())
            {
                request.Parameters.Add("Name", StringUtils.FromString(createImageRequest.Name));
            }
            if (createImageRequest != null && createImageRequest.IsSetDescription())
            {
                request.Parameters.Add("Description", StringUtils.FromString(createImageRequest.Description));
            }
            if (createImageRequest != null && createImageRequest.IsSetNoReboot())
            {
                request.Parameters.Add("NoReboot", StringUtils.FromBool(createImageRequest.NoReboot));
            }

            if (createImageRequest != null)
            {
                List <BlockDeviceMapping> blockDeviceMappingsList = createImageRequest.BlockDeviceMappings;
                int blockDeviceMappingsListIndex = 1;
                foreach (BlockDeviceMapping blockDeviceMappingsListValue in blockDeviceMappingsList)
                {
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetVirtualName())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".VirtualName", StringUtils.FromString(blockDeviceMappingsListValue.VirtualName));
                    }
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetDeviceName())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".DeviceName", StringUtils.FromString(blockDeviceMappingsListValue.DeviceName));
                    }
                    if (blockDeviceMappingsListValue != null)
                    {
                        EbsBlockDevice ebs = blockDeviceMappingsListValue.Ebs;
                        if (ebs != null && ebs.IsSetSnapshotId())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.SnapshotId", StringUtils.FromString(ebs.SnapshotId));
                        }
                        if (ebs != null && ebs.IsSetVolumeSize())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.VolumeSize", StringUtils.FromInt(ebs.VolumeSize));
                        }
                        if (ebs != null && ebs.IsSetDeleteOnTermination())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.DeleteOnTermination", StringUtils.FromBool(ebs.DeleteOnTermination));
                        }
                        if (ebs != null && ebs.IsSetVolumeType())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.VolumeType", StringUtils.FromString(ebs.VolumeType));
                        }
                        if (ebs != null && ebs.IsSetIops())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.Iops", StringUtils.FromInt(ebs.Iops));
                        }
                    }
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetNoDevice())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".NoDevice", StringUtils.FromString(blockDeviceMappingsListValue.NoDevice));
                    }

                    blockDeviceMappingsListIndex++;
                }
            }

            return(request);
        }
예제 #2
0
        public IRequest Marshall(RequestSpotInstancesRequest requestSpotInstancesRequest)
        {
            IRequest request = new DefaultRequest(requestSpotInstancesRequest, "AmazonEC2");

            request.Parameters.Add("Action", "RequestSpotInstances");
            request.Parameters.Add("Version", "2014-02-01");
            if (requestSpotInstancesRequest != null && requestSpotInstancesRequest.IsSetSpotPrice())
            {
                request.Parameters.Add("SpotPrice", StringUtils.FromString(requestSpotInstancesRequest.SpotPrice));
            }
            if (requestSpotInstancesRequest != null && requestSpotInstancesRequest.IsSetInstanceCount())
            {
                request.Parameters.Add("InstanceCount", StringUtils.FromInt(requestSpotInstancesRequest.InstanceCount));
            }
            if (requestSpotInstancesRequest != null && requestSpotInstancesRequest.IsSetType())
            {
                request.Parameters.Add("Type", StringUtils.FromString(requestSpotInstancesRequest.Type));
            }
            if (requestSpotInstancesRequest != null && requestSpotInstancesRequest.IsSetValidFrom())
            {
                request.Parameters.Add("ValidFrom", StringUtils.FromDateTime(requestSpotInstancesRequest.ValidFrom));
            }
            if (requestSpotInstancesRequest != null && requestSpotInstancesRequest.IsSetValidUntil())
            {
                request.Parameters.Add("ValidUntil", StringUtils.FromDateTime(requestSpotInstancesRequest.ValidUntil));
            }
            if (requestSpotInstancesRequest != null && requestSpotInstancesRequest.IsSetLaunchGroup())
            {
                request.Parameters.Add("LaunchGroup", StringUtils.FromString(requestSpotInstancesRequest.LaunchGroup));
            }
            if (requestSpotInstancesRequest != null && requestSpotInstancesRequest.IsSetAvailabilityZoneGroup())
            {
                request.Parameters.Add("AvailabilityZoneGroup", StringUtils.FromString(requestSpotInstancesRequest.AvailabilityZoneGroup));
            }
            if (requestSpotInstancesRequest != null)
            {
                LaunchSpecification launchSpecification = requestSpotInstancesRequest.LaunchSpecification;
                if (launchSpecification != null && launchSpecification.IsSetImageId())
                {
                    request.Parameters.Add("LaunchSpecification.ImageId", StringUtils.FromString(launchSpecification.ImageId));
                }
                if (launchSpecification != null && launchSpecification.IsSetKeyName())
                {
                    request.Parameters.Add("LaunchSpecification.KeyName", StringUtils.FromString(launchSpecification.KeyName));
                }

                if (launchSpecification != null)
                {
                    List <GroupIdentifier> allSecurityGroupsList = launchSpecification.AllSecurityGroups;
                    int allSecurityGroupsListIndex = 1;
                    foreach (GroupIdentifier allSecurityGroupsListValue in allSecurityGroupsList)
                    {
                        if (allSecurityGroupsListValue != null && allSecurityGroupsListValue.IsSetGroupName())
                        {
                            request.Parameters.Add("LaunchSpecification.GroupSet." + allSecurityGroupsListIndex + ".GroupName", StringUtils.FromString(allSecurityGroupsListValue.GroupName));
                        }
                        if (allSecurityGroupsListValue != null && allSecurityGroupsListValue.IsSetGroupId())
                        {
                            request.Parameters.Add("LaunchSpecification.GroupSet." + allSecurityGroupsListIndex + ".GroupId", StringUtils.FromString(allSecurityGroupsListValue.GroupId));
                        }

                        allSecurityGroupsListIndex++;
                    }
                }
                if (launchSpecification != null)
                {
                    List <string> securityGroupsList = launchSpecification.SecurityGroups;

                    int securityGroupsListIndex = 1;
                    foreach (string securityGroupsListValue in securityGroupsList)
                    {
                        request.Parameters.Add("LaunchSpecification.SecurityGroup." + securityGroupsListIndex, StringUtils.FromString(securityGroupsListValue));
                        securityGroupsListIndex++;
                    }
                }
                if (launchSpecification != null && launchSpecification.IsSetUserData())
                {
                    request.Parameters.Add("LaunchSpecification.UserData", StringUtils.FromString(launchSpecification.UserData));
                }
                if (launchSpecification != null && launchSpecification.IsSetAddressingType())
                {
                    request.Parameters.Add("LaunchSpecification.AddressingType", StringUtils.FromString(launchSpecification.AddressingType));
                }
                if (launchSpecification != null && launchSpecification.IsSetInstanceType())
                {
                    request.Parameters.Add("LaunchSpecification.InstanceType", StringUtils.FromString(launchSpecification.InstanceType));
                }
                if (launchSpecification != null)
                {
                    SpotPlacement placement = launchSpecification.Placement;
                    if (placement != null && placement.IsSetAvailabilityZone())
                    {
                        request.Parameters.Add("LaunchSpecification.Placement.AvailabilityZone", StringUtils.FromString(placement.AvailabilityZone));
                    }
                    if (placement != null && placement.IsSetGroupName())
                    {
                        request.Parameters.Add("LaunchSpecification.Placement.GroupName", StringUtils.FromString(placement.GroupName));
                    }
                }
                if (launchSpecification != null && launchSpecification.IsSetKernelId())
                {
                    request.Parameters.Add("LaunchSpecification.KernelId", StringUtils.FromString(launchSpecification.KernelId));
                }
                if (launchSpecification != null && launchSpecification.IsSetRamdiskId())
                {
                    request.Parameters.Add("LaunchSpecification.RamdiskId", StringUtils.FromString(launchSpecification.RamdiskId));
                }

                if (launchSpecification != null)
                {
                    List <BlockDeviceMapping> blockDeviceMappingsList = launchSpecification.BlockDeviceMappings;
                    int blockDeviceMappingsListIndex = 1;
                    foreach (BlockDeviceMapping blockDeviceMappingsListValue in blockDeviceMappingsList)
                    {
                        if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetVirtualName())
                        {
                            request.Parameters.Add("LaunchSpecification.BlockDeviceMapping." + blockDeviceMappingsListIndex + ".VirtualName", StringUtils.FromString(blockDeviceMappingsListValue.VirtualName));
                        }
                        if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetDeviceName())
                        {
                            request.Parameters.Add("LaunchSpecification.BlockDeviceMapping." + blockDeviceMappingsListIndex + ".DeviceName", StringUtils.FromString(blockDeviceMappingsListValue.DeviceName));
                        }
                        if (blockDeviceMappingsListValue != null)
                        {
                            EbsBlockDevice ebs = blockDeviceMappingsListValue.Ebs;
                            if (ebs != null && ebs.IsSetSnapshotId())
                            {
                                request.Parameters.Add("LaunchSpecification.BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.SnapshotId", StringUtils.FromString(ebs.SnapshotId));
                            }
                            if (ebs != null && ebs.IsSetVolumeSize())
                            {
                                request.Parameters.Add("LaunchSpecification.BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.VolumeSize", StringUtils.FromInt(ebs.VolumeSize));
                            }
                            if (ebs != null && ebs.IsSetDeleteOnTermination())
                            {
                                request.Parameters.Add("LaunchSpecification.BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.DeleteOnTermination", StringUtils.FromBool(ebs.DeleteOnTermination));
                            }
                            if (ebs != null && ebs.IsSetVolumeType())
                            {
                                request.Parameters.Add("LaunchSpecification.BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.VolumeType", StringUtils.FromString(ebs.VolumeType));
                            }
                            if (ebs != null && ebs.IsSetIops())
                            {
                                request.Parameters.Add("LaunchSpecification.BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.Iops", StringUtils.FromInt(ebs.Iops));
                            }
                        }
                        if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetNoDevice())
                        {
                            request.Parameters.Add("LaunchSpecification.BlockDeviceMapping." + blockDeviceMappingsListIndex + ".NoDevice", StringUtils.FromString(blockDeviceMappingsListValue.NoDevice));
                        }

                        blockDeviceMappingsListIndex++;
                    }
                }
                if (launchSpecification != null && launchSpecification.IsSetMonitoringEnabled())
                {
                    request.Parameters.Add("LaunchSpecification.Monitoring.Enabled", StringUtils.FromBool(launchSpecification.MonitoringEnabled));
                }
                if (launchSpecification != null && launchSpecification.IsSetSubnetId())
                {
                    request.Parameters.Add("LaunchSpecification.SubnetId", StringUtils.FromString(launchSpecification.SubnetId));
                }

                if (launchSpecification != null)
                {
                    List <InstanceNetworkInterfaceSpecification> networkInterfacesList = launchSpecification.NetworkInterfaces;
                    int networkInterfacesListIndex = 1;
                    foreach (InstanceNetworkInterfaceSpecification networkInterfacesListValue in networkInterfacesList)
                    {
                        if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetNetworkInterfaceId())
                        {
                            request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".NetworkInterfaceId", StringUtils.FromString(networkInterfacesListValue.NetworkInterfaceId));
                        }
                        if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetDeviceIndex())
                        {
                            request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".DeviceIndex", StringUtils.FromInt(networkInterfacesListValue.DeviceIndex));
                        }
                        if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetSubnetId())
                        {
                            request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".SubnetId", StringUtils.FromString(networkInterfacesListValue.SubnetId));
                        }
                        if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetDescription())
                        {
                            request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".Description", StringUtils.FromString(networkInterfacesListValue.Description));
                        }
                        if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetPrivateIpAddress())
                        {
                            request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".PrivateIpAddress", StringUtils.FromString(networkInterfacesListValue.PrivateIpAddress));
                        }
                        if (networkInterfacesListValue != null)
                        {
                            List <string> groupsList = networkInterfacesListValue.Groups;

                            int groupsListIndex = 1;
                            foreach (string groupsListValue in groupsList)
                            {
                                request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".SecurityGroupId." + groupsListIndex, StringUtils.FromString(groupsListValue));
                                groupsListIndex++;
                            }
                        }
                        if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetDeleteOnTermination())
                        {
                            request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".DeleteOnTermination", StringUtils.FromBool(networkInterfacesListValue.DeleteOnTermination));
                        }

                        if (networkInterfacesListValue != null)
                        {
                            List <PrivateIpAddressSpecification> privateIpAddressesList = networkInterfacesListValue.PrivateIpAddresses;
                            int privateIpAddressesListIndex = 1;
                            foreach (PrivateIpAddressSpecification privateIpAddressesListValue in privateIpAddressesList)
                            {
                                if (privateIpAddressesListValue != null && privateIpAddressesListValue.IsSetPrivateIpAddress())
                                {
                                    request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".PrivateIpAddresses." + privateIpAddressesListIndex + ".PrivateIpAddress", StringUtils.FromString(privateIpAddressesListValue.PrivateIpAddress));
                                }
                                if (privateIpAddressesListValue != null && privateIpAddressesListValue.IsSetPrimary())
                                {
                                    request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".PrivateIpAddresses." + privateIpAddressesListIndex + ".Primary", StringUtils.FromBool(privateIpAddressesListValue.Primary));
                                }

                                privateIpAddressesListIndex++;
                            }
                        }
                        if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetSecondaryPrivateIpAddressCount())
                        {
                            request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".SecondaryPrivateIpAddressCount", StringUtils.FromInt(networkInterfacesListValue.SecondaryPrivateIpAddressCount));
                        }
                        if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetAssociatePublicIpAddress())
                        {
                            request.Parameters.Add("LaunchSpecification.NetworkInterface." + networkInterfacesListIndex + ".AssociatePublicIpAddress", StringUtils.FromBool(networkInterfacesListValue.AssociatePublicIpAddress));
                        }

                        networkInterfacesListIndex++;
                    }
                }
                if (launchSpecification != null)
                {
                    IamInstanceProfileSpecification iamInstanceProfile = launchSpecification.IamInstanceProfile;
                    if (iamInstanceProfile != null && iamInstanceProfile.IsSetArn())
                    {
                        request.Parameters.Add("LaunchSpecification.IamInstanceProfile.Arn", StringUtils.FromString(iamInstanceProfile.Arn));
                    }
                    if (iamInstanceProfile != null && iamInstanceProfile.IsSetName())
                    {
                        request.Parameters.Add("LaunchSpecification.IamInstanceProfile.Name", StringUtils.FromString(iamInstanceProfile.Name));
                    }
                }
                if (launchSpecification != null && launchSpecification.IsSetEbsOptimized())
                {
                    request.Parameters.Add("LaunchSpecification.EbsOptimized", StringUtils.FromBool(launchSpecification.EbsOptimized));
                }
            }

            return(request);
        }
예제 #3
0
        public IRequest Marshall(RunInstancesRequest runInstancesRequest)
        {
            IRequest request = new DefaultRequest(runInstancesRequest, "AmazonEC2");

            request.Parameters.Add("Action", "RunInstances");
            request.Parameters.Add("Version", "2014-05-01");
            if (runInstancesRequest != null && runInstancesRequest.IsSetImageId())
            {
                request.Parameters.Add("ImageId", StringUtils.FromString(runInstancesRequest.ImageId));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetMinCount())
            {
                request.Parameters.Add("MinCount", StringUtils.FromInt(runInstancesRequest.MinCount));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetMaxCount())
            {
                request.Parameters.Add("MaxCount", StringUtils.FromInt(runInstancesRequest.MaxCount));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetKeyName())
            {
                request.Parameters.Add("KeyName", StringUtils.FromString(runInstancesRequest.KeyName));
            }
            if (runInstancesRequest != null)
            {
                List <string> securityGroupsList = runInstancesRequest.SecurityGroups;

                int securityGroupsListIndex = 1;
                foreach (string securityGroupsListValue in securityGroupsList)
                {
                    request.Parameters.Add("SecurityGroup." + securityGroupsListIndex, StringUtils.FromString(securityGroupsListValue));
                    securityGroupsListIndex++;
                }
            }
            if (runInstancesRequest != null)
            {
                List <string> securityGroupIdsList = runInstancesRequest.SecurityGroupIds;

                int securityGroupIdsListIndex = 1;
                foreach (string securityGroupIdsListValue in securityGroupIdsList)
                {
                    request.Parameters.Add("SecurityGroupId." + securityGroupIdsListIndex, StringUtils.FromString(securityGroupIdsListValue));
                    securityGroupIdsListIndex++;
                }
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetUserData())
            {
                request.Parameters.Add("UserData", StringUtils.FromString(runInstancesRequest.UserData));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetInstanceType())
            {
                request.Parameters.Add("InstanceType", StringUtils.FromString(runInstancesRequest.InstanceType));
            }
            if (runInstancesRequest != null)
            {
                Placement placement = runInstancesRequest.Placement;
                if (placement != null && placement.IsSetAvailabilityZone())
                {
                    request.Parameters.Add("Placement.AvailabilityZone", StringUtils.FromString(placement.AvailabilityZone));
                }
                if (placement != null && placement.IsSetGroupName())
                {
                    request.Parameters.Add("Placement.GroupName", StringUtils.FromString(placement.GroupName));
                }
                if (placement != null && placement.IsSetTenancy())
                {
                    request.Parameters.Add("Placement.Tenancy", StringUtils.FromString(placement.Tenancy));
                }
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetKernelId())
            {
                request.Parameters.Add("KernelId", StringUtils.FromString(runInstancesRequest.KernelId));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetRamdiskId())
            {
                request.Parameters.Add("RamdiskId", StringUtils.FromString(runInstancesRequest.RamdiskId));
            }

            if (runInstancesRequest != null)
            {
                List <BlockDeviceMapping> blockDeviceMappingsList = runInstancesRequest.BlockDeviceMappings;
                int blockDeviceMappingsListIndex = 1;
                foreach (BlockDeviceMapping blockDeviceMappingsListValue in blockDeviceMappingsList)
                {
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetVirtualName())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".VirtualName", StringUtils.FromString(blockDeviceMappingsListValue.VirtualName));
                    }
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetDeviceName())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".DeviceName", StringUtils.FromString(blockDeviceMappingsListValue.DeviceName));
                    }
                    if (blockDeviceMappingsListValue != null)
                    {
                        EbsBlockDevice ebs = blockDeviceMappingsListValue.Ebs;
                        if (ebs != null && ebs.IsSetSnapshotId())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.SnapshotId", StringUtils.FromString(ebs.SnapshotId));
                        }
                        if (ebs != null && ebs.IsSetVolumeSize())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.VolumeSize", StringUtils.FromInt(ebs.VolumeSize));
                        }
                        if (ebs != null && ebs.IsSetDeleteOnTermination())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.DeleteOnTermination", StringUtils.FromBool(ebs.DeleteOnTermination));
                        }
                        if (ebs != null && ebs.IsSetVolumeType())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.VolumeType", StringUtils.FromString(ebs.VolumeType));
                        }
                        if (ebs != null && ebs.IsSetIops())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.Iops", StringUtils.FromInt(ebs.Iops));
                        }
                        if (ebs != null && ebs.IsSetEncrypted())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.Encrypted", StringUtils.FromBool(ebs.Encrypted));
                        }
                    }
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetNoDevice())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".NoDevice", StringUtils.FromString(blockDeviceMappingsListValue.NoDevice));
                    }

                    blockDeviceMappingsListIndex++;
                }
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetMonitoring())
            {
                request.Parameters.Add("Monitoring.Enabled", StringUtils.FromBool(runInstancesRequest.Monitoring));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetSubnetId())
            {
                request.Parameters.Add("SubnetId", StringUtils.FromString(runInstancesRequest.SubnetId));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetDisableApiTermination())
            {
                request.Parameters.Add("DisableApiTermination", StringUtils.FromBool(runInstancesRequest.DisableApiTermination));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetInstanceInitiatedShutdownBehavior())
            {
                request.Parameters.Add("InstanceInitiatedShutdownBehavior", StringUtils.FromString(runInstancesRequest.InstanceInitiatedShutdownBehavior));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetPrivateIpAddress())
            {
                request.Parameters.Add("PrivateIpAddress", StringUtils.FromString(runInstancesRequest.PrivateIpAddress));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetClientToken())
            {
                request.Parameters.Add("ClientToken", StringUtils.FromString(runInstancesRequest.ClientToken));
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetAdditionalInfo())
            {
                request.Parameters.Add("AdditionalInfo", StringUtils.FromString(runInstancesRequest.AdditionalInfo));
            }

            if (runInstancesRequest != null)
            {
                List <InstanceNetworkInterfaceSpecification> networkInterfacesList = runInstancesRequest.NetworkInterfaces;
                int networkInterfacesListIndex = 1;
                foreach (InstanceNetworkInterfaceSpecification networkInterfacesListValue in networkInterfacesList)
                {
                    if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetNetworkInterfaceId())
                    {
                        request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".NetworkInterfaceId", StringUtils.FromString(networkInterfacesListValue.NetworkInterfaceId));
                    }
                    if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetDeviceIndex())
                    {
                        request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".DeviceIndex", StringUtils.FromInt(networkInterfacesListValue.DeviceIndex));
                    }
                    if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetSubnetId())
                    {
                        request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".SubnetId", StringUtils.FromString(networkInterfacesListValue.SubnetId));
                    }
                    if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetDescription())
                    {
                        request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".Description", StringUtils.FromString(networkInterfacesListValue.Description));
                    }
                    if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetPrivateIpAddress())
                    {
                        request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".PrivateIpAddress", StringUtils.FromString(networkInterfacesListValue.PrivateIpAddress));
                    }
                    if (networkInterfacesListValue != null)
                    {
                        List <string> groupsList = networkInterfacesListValue.Groups;

                        int groupsListIndex = 1;
                        foreach (string groupsListValue in groupsList)
                        {
                            request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".SecurityGroupId." + groupsListIndex, StringUtils.FromString(groupsListValue));
                            groupsListIndex++;
                        }
                    }
                    if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetDeleteOnTermination())
                    {
                        request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".DeleteOnTermination", StringUtils.FromBool(networkInterfacesListValue.DeleteOnTermination));
                    }

                    if (networkInterfacesListValue != null)
                    {
                        List <PrivateIpAddressSpecification> privateIpAddressesList = networkInterfacesListValue.PrivateIpAddresses;
                        int privateIpAddressesListIndex = 1;
                        foreach (PrivateIpAddressSpecification privateIpAddressesListValue in privateIpAddressesList)
                        {
                            if (privateIpAddressesListValue != null && privateIpAddressesListValue.IsSetPrivateIpAddress())
                            {
                                request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".PrivateIpAddresses." + privateIpAddressesListIndex + ".PrivateIpAddress", StringUtils.FromString(privateIpAddressesListValue.PrivateIpAddress));
                            }
                            if (privateIpAddressesListValue != null && privateIpAddressesListValue.IsSetPrimary())
                            {
                                request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".PrivateIpAddresses." + privateIpAddressesListIndex + ".Primary", StringUtils.FromBool(privateIpAddressesListValue.Primary));
                            }

                            privateIpAddressesListIndex++;
                        }
                    }
                    if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetSecondaryPrivateIpAddressCount())
                    {
                        request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".SecondaryPrivateIpAddressCount", StringUtils.FromInt(networkInterfacesListValue.SecondaryPrivateIpAddressCount));
                    }
                    if (networkInterfacesListValue != null && networkInterfacesListValue.IsSetAssociatePublicIpAddress())
                    {
                        request.Parameters.Add("NetworkInterface." + networkInterfacesListIndex + ".AssociatePublicIpAddress", StringUtils.FromBool(networkInterfacesListValue.AssociatePublicIpAddress));
                    }

                    networkInterfacesListIndex++;
                }
            }
            if (runInstancesRequest != null)
            {
                IamInstanceProfileSpecification iamInstanceProfile = runInstancesRequest.IamInstanceProfile;
                if (iamInstanceProfile != null && iamInstanceProfile.IsSetArn())
                {
                    request.Parameters.Add("IamInstanceProfile.Arn", StringUtils.FromString(iamInstanceProfile.Arn));
                }
                if (iamInstanceProfile != null && iamInstanceProfile.IsSetName())
                {
                    request.Parameters.Add("IamInstanceProfile.Name", StringUtils.FromString(iamInstanceProfile.Name));
                }
            }
            if (runInstancesRequest != null && runInstancesRequest.IsSetEbsOptimized())
            {
                request.Parameters.Add("EbsOptimized", StringUtils.FromBool(runInstancesRequest.EbsOptimized));
            }

            return(request);
        }
        public IRequest Marshall(RegisterImageRequest registerImageRequest)
        {
            IRequest request = new DefaultRequest(registerImageRequest, "AmazonEC2");

            request.Parameters.Add("Action", "RegisterImage");
            request.Parameters.Add("Version", "2014-06-15");
            if (registerImageRequest != null && registerImageRequest.IsSetImageLocation())
            {
                request.Parameters.Add("ImageLocation", StringUtils.FromString(registerImageRequest.ImageLocation));
            }
            if (registerImageRequest != null && registerImageRequest.IsSetName())
            {
                request.Parameters.Add("Name", StringUtils.FromString(registerImageRequest.Name));
            }
            if (registerImageRequest != null && registerImageRequest.IsSetDescription())
            {
                request.Parameters.Add("Description", StringUtils.FromString(registerImageRequest.Description));
            }
            if (registerImageRequest != null && registerImageRequest.IsSetArchitecture())
            {
                request.Parameters.Add("Architecture", StringUtils.FromString(registerImageRequest.Architecture));
            }
            if (registerImageRequest != null && registerImageRequest.IsSetKernelId())
            {
                request.Parameters.Add("KernelId", StringUtils.FromString(registerImageRequest.KernelId));
            }
            if (registerImageRequest != null && registerImageRequest.IsSetRamdiskId())
            {
                request.Parameters.Add("RamdiskId", StringUtils.FromString(registerImageRequest.RamdiskId));
            }
            if (registerImageRequest != null && registerImageRequest.IsSetRootDeviceName())
            {
                request.Parameters.Add("RootDeviceName", StringUtils.FromString(registerImageRequest.RootDeviceName));
            }

            if (registerImageRequest != null)
            {
                List <BlockDeviceMapping> blockDeviceMappingsList = registerImageRequest.BlockDeviceMappings;
                int blockDeviceMappingsListIndex = 1;
                foreach (BlockDeviceMapping blockDeviceMappingsListValue in blockDeviceMappingsList)
                {
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetVirtualName())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".VirtualName", StringUtils.FromString(blockDeviceMappingsListValue.VirtualName));
                    }
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetDeviceName())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".DeviceName", StringUtils.FromString(blockDeviceMappingsListValue.DeviceName));
                    }
                    if (blockDeviceMappingsListValue != null)
                    {
                        EbsBlockDevice ebs = blockDeviceMappingsListValue.Ebs;
                        if (ebs != null && ebs.IsSetSnapshotId())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.SnapshotId", StringUtils.FromString(ebs.SnapshotId));
                        }
                        if (ebs != null && ebs.IsSetVolumeSize())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.VolumeSize", StringUtils.FromInt(ebs.VolumeSize));
                        }
                        if (ebs != null && ebs.IsSetDeleteOnTermination())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.DeleteOnTermination", StringUtils.FromBool(ebs.DeleteOnTermination));
                        }
                        if (ebs != null && ebs.IsSetVolumeType())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.VolumeType", StringUtils.FromString(ebs.VolumeType));
                        }
                        if (ebs != null && ebs.IsSetIops())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.Iops", StringUtils.FromInt(ebs.Iops));
                        }
                        if (ebs != null && ebs.IsSetEncrypted())
                        {
                            request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".Ebs.Encrypted", StringUtils.FromBool(ebs.Encrypted));
                        }
                    }
                    if (blockDeviceMappingsListValue != null && blockDeviceMappingsListValue.IsSetNoDevice())
                    {
                        request.Parameters.Add("BlockDeviceMapping." + blockDeviceMappingsListIndex + ".NoDevice", StringUtils.FromString(blockDeviceMappingsListValue.NoDevice));
                    }

                    blockDeviceMappingsListIndex++;
                }
            }
            if (registerImageRequest != null && registerImageRequest.IsSetVirtualizationType())
            {
                request.Parameters.Add("VirtualizationType", StringUtils.FromString(registerImageRequest.VirtualizationType));
            }
            if (registerImageRequest != null && registerImageRequest.IsSetSriovNetSupport())
            {
                request.Parameters.Add("SriovNetSupport", StringUtils.FromString(registerImageRequest.SriovNetSupport));
            }

            return(request);
        }