/// <summary> /// Initiates the asynchronous execution of the RunScheduledInstances operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RunScheduledInstances operation on AmazonEC2Client.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRunScheduledInstances /// operation.</returns> public IAsyncResult BeginRunScheduledInstances(RunScheduledInstancesRequest request, AsyncCallback callback, object state) { var marshaller = new RunScheduledInstancesRequestMarshaller(); var unmarshaller = RunScheduledInstancesResponseUnmarshaller.Instance; return BeginInvoke<RunScheduledInstancesRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Launches the specified Scheduled Instances. /// /// /// <para> /// Before you can launch a Scheduled Instance, you must purchase it and obtain an identifier /// using <a>PurchaseScheduledInstances</a>. /// </para> /// /// <para> /// You must launch a Scheduled Instance during its scheduled time period. You can't stop /// or reboot a Scheduled Instance, but you can terminate it as needed. If you terminate /// a Scheduled Instance before the current scheduled time period ends, you can launch /// it again after a few minutes. For more information, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-scheduled-instances.html">Scheduled /// Instances</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the RunScheduledInstances service method.</param> /// /// <returns>The response from the RunScheduledInstances service method, as returned by EC2.</returns> public RunScheduledInstancesResponse RunScheduledInstances(RunScheduledInstancesRequest request) { var marshaller = new RunScheduledInstancesRequestMarshaller(); var unmarshaller = RunScheduledInstancesResponseUnmarshaller.Instance; return Invoke<RunScheduledInstancesRequest,RunScheduledInstancesResponse>(request, marshaller, unmarshaller); }
private Amazon.EC2.Model.RunScheduledInstancesResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.RunScheduledInstancesRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "RunScheduledInstances"); try { #if DESKTOP return(client.RunScheduledInstances(request)); #elif CORECLR return(client.RunScheduledInstancesAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Initiates the asynchronous execution of the RunScheduledInstances operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RunScheduledInstances operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<RunScheduledInstancesResponse> RunScheduledInstancesAsync(RunScheduledInstancesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RunScheduledInstancesRequestMarshaller(); var unmarshaller = RunScheduledInstancesResponseUnmarshaller.Instance; return InvokeAsync<RunScheduledInstancesRequest,RunScheduledInstancesResponse>(request, marshaller, unmarshaller, cancellationToken); }
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); }