Describes the placement for a Scheduled Instance.
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.RunScheduledInstancesRequest();

            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.InstanceCount != null)
            {
                request.InstanceCount = cmdletContext.InstanceCount.Value;
            }

            // populate LaunchSpecification
            var requestLaunchSpecificationIsNull = true;

            request.LaunchSpecification = new Amazon.EC2.Model.ScheduledInstancesLaunchSpecification();
            List <Amazon.EC2.Model.ScheduledInstancesBlockDeviceMapping> requestLaunchSpecification_launchSpecification_BlockDeviceMapping = null;

            if (cmdletContext.LaunchSpecification_BlockDeviceMapping != null)
            {
                requestLaunchSpecification_launchSpecification_BlockDeviceMapping = cmdletContext.LaunchSpecification_BlockDeviceMapping;
            }
            if (requestLaunchSpecification_launchSpecification_BlockDeviceMapping != null)
            {
                request.LaunchSpecification.BlockDeviceMappings = requestLaunchSpecification_launchSpecification_BlockDeviceMapping;
                requestLaunchSpecificationIsNull = false;
            }
            System.Boolean?requestLaunchSpecification_launchSpecification_EbsOptimized = null;
            if (cmdletContext.LaunchSpecification_EbsOptimized != null)
            {
                requestLaunchSpecification_launchSpecification_EbsOptimized = cmdletContext.LaunchSpecification_EbsOptimized.Value;
            }
            if (requestLaunchSpecification_launchSpecification_EbsOptimized != null)
            {
                request.LaunchSpecification.EbsOptimized = requestLaunchSpecification_launchSpecification_EbsOptimized.Value;
                requestLaunchSpecificationIsNull         = false;
            }
            System.String requestLaunchSpecification_launchSpecification_ImageId = null;
            if (cmdletContext.LaunchSpecification_ImageId != null)
            {
                requestLaunchSpecification_launchSpecification_ImageId = cmdletContext.LaunchSpecification_ImageId;
            }
            if (requestLaunchSpecification_launchSpecification_ImageId != null)
            {
                request.LaunchSpecification.ImageId = requestLaunchSpecification_launchSpecification_ImageId;
                requestLaunchSpecificationIsNull    = false;
            }
            System.String requestLaunchSpecification_launchSpecification_InstanceType = null;
            if (cmdletContext.LaunchSpecification_InstanceType != null)
            {
                requestLaunchSpecification_launchSpecification_InstanceType = cmdletContext.LaunchSpecification_InstanceType;
            }
            if (requestLaunchSpecification_launchSpecification_InstanceType != null)
            {
                request.LaunchSpecification.InstanceType = requestLaunchSpecification_launchSpecification_InstanceType;
                requestLaunchSpecificationIsNull         = false;
            }
            System.String requestLaunchSpecification_launchSpecification_KernelId = null;
            if (cmdletContext.LaunchSpecification_KernelId != null)
            {
                requestLaunchSpecification_launchSpecification_KernelId = cmdletContext.LaunchSpecification_KernelId;
            }
            if (requestLaunchSpecification_launchSpecification_KernelId != null)
            {
                request.LaunchSpecification.KernelId = requestLaunchSpecification_launchSpecification_KernelId;
                requestLaunchSpecificationIsNull     = false;
            }
            System.String requestLaunchSpecification_launchSpecification_KeyName = null;
            if (cmdletContext.LaunchSpecification_KeyName != null)
            {
                requestLaunchSpecification_launchSpecification_KeyName = cmdletContext.LaunchSpecification_KeyName;
            }
            if (requestLaunchSpecification_launchSpecification_KeyName != null)
            {
                request.LaunchSpecification.KeyName = requestLaunchSpecification_launchSpecification_KeyName;
                requestLaunchSpecificationIsNull    = false;
            }
            List <Amazon.EC2.Model.ScheduledInstancesNetworkInterface> requestLaunchSpecification_launchSpecification_NetworkInterface = null;

            if (cmdletContext.LaunchSpecification_NetworkInterface != null)
            {
                requestLaunchSpecification_launchSpecification_NetworkInterface = cmdletContext.LaunchSpecification_NetworkInterface;
            }
            if (requestLaunchSpecification_launchSpecification_NetworkInterface != null)
            {
                request.LaunchSpecification.NetworkInterfaces = requestLaunchSpecification_launchSpecification_NetworkInterface;
                requestLaunchSpecificationIsNull = false;
            }
            System.String requestLaunchSpecification_launchSpecification_RamdiskId = null;
            if (cmdletContext.LaunchSpecification_RamdiskId != null)
            {
                requestLaunchSpecification_launchSpecification_RamdiskId = cmdletContext.LaunchSpecification_RamdiskId;
            }
            if (requestLaunchSpecification_launchSpecification_RamdiskId != null)
            {
                request.LaunchSpecification.RamdiskId = requestLaunchSpecification_launchSpecification_RamdiskId;
                requestLaunchSpecificationIsNull      = false;
            }
            List <System.String> requestLaunchSpecification_launchSpecification_SecurityGroupId = null;

            if (cmdletContext.LaunchSpecification_SecurityGroupId != null)
            {
                requestLaunchSpecification_launchSpecification_SecurityGroupId = cmdletContext.LaunchSpecification_SecurityGroupId;
            }
            if (requestLaunchSpecification_launchSpecification_SecurityGroupId != null)
            {
                request.LaunchSpecification.SecurityGroupIds = requestLaunchSpecification_launchSpecification_SecurityGroupId;
                requestLaunchSpecificationIsNull             = false;
            }
            System.String requestLaunchSpecification_launchSpecification_SubnetId = null;
            if (cmdletContext.LaunchSpecification_SubnetId != null)
            {
                requestLaunchSpecification_launchSpecification_SubnetId = cmdletContext.LaunchSpecification_SubnetId;
            }
            if (requestLaunchSpecification_launchSpecification_SubnetId != null)
            {
                request.LaunchSpecification.SubnetId = requestLaunchSpecification_launchSpecification_SubnetId;
                requestLaunchSpecificationIsNull     = false;
            }
            System.String requestLaunchSpecification_launchSpecification_UserData = null;
            if (cmdletContext.LaunchSpecification_UserData != null)
            {
                requestLaunchSpecification_launchSpecification_UserData = cmdletContext.LaunchSpecification_UserData;
            }
            if (requestLaunchSpecification_launchSpecification_UserData != null)
            {
                request.LaunchSpecification.UserData = requestLaunchSpecification_launchSpecification_UserData;
                requestLaunchSpecificationIsNull     = false;
            }
            Amazon.EC2.Model.ScheduledInstancesMonitoring requestLaunchSpecification_launchSpecification_Monitoring = null;

            // populate Monitoring
            var requestLaunchSpecification_launchSpecification_MonitoringIsNull = true;

            requestLaunchSpecification_launchSpecification_Monitoring = new Amazon.EC2.Model.ScheduledInstancesMonitoring();
            System.Boolean?requestLaunchSpecification_launchSpecification_Monitoring_monitoring_Enabled = null;
            if (cmdletContext.Monitoring_Enabled != null)
            {
                requestLaunchSpecification_launchSpecification_Monitoring_monitoring_Enabled = cmdletContext.Monitoring_Enabled.Value;
            }
            if (requestLaunchSpecification_launchSpecification_Monitoring_monitoring_Enabled != null)
            {
                requestLaunchSpecification_launchSpecification_Monitoring.Enabled = requestLaunchSpecification_launchSpecification_Monitoring_monitoring_Enabled.Value;
                requestLaunchSpecification_launchSpecification_MonitoringIsNull   = false;
            }
            // determine if requestLaunchSpecification_launchSpecification_Monitoring should be set to null
            if (requestLaunchSpecification_launchSpecification_MonitoringIsNull)
            {
                requestLaunchSpecification_launchSpecification_Monitoring = null;
            }
            if (requestLaunchSpecification_launchSpecification_Monitoring != null)
            {
                request.LaunchSpecification.Monitoring = requestLaunchSpecification_launchSpecification_Monitoring;
                requestLaunchSpecificationIsNull       = false;
            }
            Amazon.EC2.Model.ScheduledInstancesIamInstanceProfile requestLaunchSpecification_launchSpecification_IamInstanceProfile = null;

            // populate IamInstanceProfile
            var requestLaunchSpecification_launchSpecification_IamInstanceProfileIsNull = true;

            requestLaunchSpecification_launchSpecification_IamInstanceProfile = new Amazon.EC2.Model.ScheduledInstancesIamInstanceProfile();
            System.String requestLaunchSpecification_launchSpecification_IamInstanceProfile_iamInstanceProfile_Arn = null;
            if (cmdletContext.IamInstanceProfile_Arn != null)
            {
                requestLaunchSpecification_launchSpecification_IamInstanceProfile_iamInstanceProfile_Arn = cmdletContext.IamInstanceProfile_Arn;
            }
            if (requestLaunchSpecification_launchSpecification_IamInstanceProfile_iamInstanceProfile_Arn != null)
            {
                requestLaunchSpecification_launchSpecification_IamInstanceProfile.Arn   = requestLaunchSpecification_launchSpecification_IamInstanceProfile_iamInstanceProfile_Arn;
                requestLaunchSpecification_launchSpecification_IamInstanceProfileIsNull = false;
            }
            System.String requestLaunchSpecification_launchSpecification_IamInstanceProfile_iamInstanceProfile_Name = null;
            if (cmdletContext.IamInstanceProfile_Name != null)
            {
                requestLaunchSpecification_launchSpecification_IamInstanceProfile_iamInstanceProfile_Name = cmdletContext.IamInstanceProfile_Name;
            }
            if (requestLaunchSpecification_launchSpecification_IamInstanceProfile_iamInstanceProfile_Name != null)
            {
                requestLaunchSpecification_launchSpecification_IamInstanceProfile.Name  = requestLaunchSpecification_launchSpecification_IamInstanceProfile_iamInstanceProfile_Name;
                requestLaunchSpecification_launchSpecification_IamInstanceProfileIsNull = false;
            }
            // determine if requestLaunchSpecification_launchSpecification_IamInstanceProfile should be set to null
            if (requestLaunchSpecification_launchSpecification_IamInstanceProfileIsNull)
            {
                requestLaunchSpecification_launchSpecification_IamInstanceProfile = null;
            }
            if (requestLaunchSpecification_launchSpecification_IamInstanceProfile != null)
            {
                request.LaunchSpecification.IamInstanceProfile = requestLaunchSpecification_launchSpecification_IamInstanceProfile;
                requestLaunchSpecificationIsNull = false;
            }
            Amazon.EC2.Model.ScheduledInstancesPlacement requestLaunchSpecification_launchSpecification_Placement = null;

            // populate Placement
            var requestLaunchSpecification_launchSpecification_PlacementIsNull = true;

            requestLaunchSpecification_launchSpecification_Placement = new Amazon.EC2.Model.ScheduledInstancesPlacement();
            System.String requestLaunchSpecification_launchSpecification_Placement_placement_AvailabilityZone = null;
            if (cmdletContext.Placement_AvailabilityZone != null)
            {
                requestLaunchSpecification_launchSpecification_Placement_placement_AvailabilityZone = cmdletContext.Placement_AvailabilityZone;
            }
            if (requestLaunchSpecification_launchSpecification_Placement_placement_AvailabilityZone != null)
            {
                requestLaunchSpecification_launchSpecification_Placement.AvailabilityZone = requestLaunchSpecification_launchSpecification_Placement_placement_AvailabilityZone;
                requestLaunchSpecification_launchSpecification_PlacementIsNull            = false;
            }
            System.String requestLaunchSpecification_launchSpecification_Placement_placement_GroupName = null;
            if (cmdletContext.Placement_GroupName != null)
            {
                requestLaunchSpecification_launchSpecification_Placement_placement_GroupName = cmdletContext.Placement_GroupName;
            }
            if (requestLaunchSpecification_launchSpecification_Placement_placement_GroupName != null)
            {
                requestLaunchSpecification_launchSpecification_Placement.GroupName = requestLaunchSpecification_launchSpecification_Placement_placement_GroupName;
                requestLaunchSpecification_launchSpecification_PlacementIsNull     = false;
            }
            // determine if requestLaunchSpecification_launchSpecification_Placement should be set to null
            if (requestLaunchSpecification_launchSpecification_PlacementIsNull)
            {
                requestLaunchSpecification_launchSpecification_Placement = null;
            }
            if (requestLaunchSpecification_launchSpecification_Placement != null)
            {
                request.LaunchSpecification.Placement = requestLaunchSpecification_launchSpecification_Placement;
                requestLaunchSpecificationIsNull      = false;
            }
            // determine if request.LaunchSpecification should be set to null
            if (requestLaunchSpecificationIsNull)
            {
                request.LaunchSpecification = null;
            }
            if (cmdletContext.ScheduledInstanceId != null)
            {
                request.ScheduledInstanceId = cmdletContext.ScheduledInstanceId;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }