/// <summary> /// Initiates the asynchronous execution of the CreateLaunchConfiguration operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLaunchConfiguration 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<CreateLaunchConfigurationResponse> CreateLaunchConfigurationAsync(CreateLaunchConfigurationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateLaunchConfigurationRequestMarshaller(); var unmarshaller = CreateLaunchConfigurationResponseUnmarshaller.Instance; return InvokeAsync<CreateLaunchConfigurationRequest,CreateLaunchConfigurationResponse>(request, marshaller, unmarshaller, cancellationToken); }
IAsyncResult invokeCreateLaunchConfiguration(CreateLaunchConfigurationRequest createLaunchConfigurationRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateLaunchConfigurationRequestMarshaller().Marshall(createLaunchConfigurationRequest); var unmarshaller = CreateLaunchConfigurationResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
internal CreateLaunchConfigurationResponse CreateLaunchConfiguration(CreateLaunchConfigurationRequest request) { var marshaller = new CreateLaunchConfigurationRequestMarshaller(); var unmarshaller = CreateLaunchConfigurationResponseUnmarshaller.Instance; return Invoke<CreateLaunchConfigurationRequest,CreateLaunchConfigurationResponse>(request, marshaller, unmarshaller); }
/// <summary> /// <para> Creates a new launch configuration. The launch configuration name must be unique within the scope of the client's AWS account. The /// maximum limit of launch configurations, which by default is 100, must not yet have been met; otherwise, the call will fail. When created, /// the new launch configuration is available for immediate use. </para> <para>You can create a launch configuration with Amazon EC2 security /// groups or with Amazon VPC security groups. However, you can't use Amazon EC2 security groups together with Amazon VPC security groups, or /// vice versa.</para> <para><b>NOTE:</b> At this time, Auto Scaling launch configurations don't support compressed (e.g. zipped) user data /// files. </para> /// </summary> /// /// <param name="createLaunchConfigurationRequest">Container for the necessary parameters to execute the CreateLaunchConfiguration service /// method on AmazonAutoScaling.</param> /// /// <exception cref="LimitExceededException"/> /// <exception cref="AlreadyExistsException"/> public CreateLaunchConfigurationResponse CreateLaunchConfiguration(CreateLaunchConfigurationRequest createLaunchConfigurationRequest) { IAsyncResult asyncResult = invokeCreateLaunchConfiguration(createLaunchConfigurationRequest, null, null, true); return EndCreateLaunchConfiguration(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the CreateLaunchConfiguration operation. /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.CreateLaunchConfiguration"/> /// </summary> /// /// <param name="createLaunchConfigurationRequest">Container for the necessary parameters to execute the CreateLaunchConfiguration operation on /// AmazonAutoScaling.</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> public IAsyncResult BeginCreateLaunchConfiguration(CreateLaunchConfigurationRequest createLaunchConfigurationRequest, AsyncCallback callback, object state) { return invokeCreateLaunchConfiguration(createLaunchConfigurationRequest, callback, state, false); }
/// <summary> /// <para> Creates a new launch configuration. The launch configuration name must be unique within the scope of the client's AWS account. The /// maximum limit of launch configurations, which by default is 100, must not yet have been met; otherwise, the call will fail. When created, /// the new launch configuration is available for immediate use. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLaunchConfiguration service /// method on AmazonAutoScaling.</param> /// /// <exception cref="T:Amazon.AutoScaling.Model.LimitExceededException" /> /// <exception cref="T:Amazon.AutoScaling.Model.AlreadyExistsException" /> public CreateLaunchConfigurationResponse CreateLaunchConfiguration(CreateLaunchConfigurationRequest request) { var task = CreateLaunchConfigurationAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the CreateLaunchConfiguration operation. /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.CreateLaunchConfiguration"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLaunchConfiguration 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<CreateLaunchConfigurationResponse> CreateLaunchConfigurationAsync(CreateLaunchConfigurationRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateLaunchConfigurationRequestMarshaller(); var unmarshaller = CreateLaunchConfigurationResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateLaunchConfigurationRequest, CreateLaunchConfigurationResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
private Amazon.AutoScaling.Model.CreateLaunchConfigurationResponse CallAWSServiceOperation(IAmazonAutoScaling client, Amazon.AutoScaling.Model.CreateLaunchConfigurationRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Auto Scaling", "CreateLaunchConfiguration"); try { #if DESKTOP return(client.CreateLaunchConfiguration(request)); #elif CORECLR return(client.CreateLaunchConfigurationAsync(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 CreateLaunchConfiguration operation. /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLaunchConfiguration operation on AmazonAutoScalingClient.</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 EndCreateLaunchConfiguration /// operation.</returns> public IAsyncResult BeginCreateLaunchConfiguration(CreateLaunchConfigurationRequest request, AsyncCallback callback, object state) { var marshaller = new CreateLaunchConfigurationRequestMarshaller(); var unmarshaller = CreateLaunchConfigurationResponseUnmarshaller.Instance; return BeginInvoke<CreateLaunchConfigurationRequest>(request, marshaller, unmarshaller, callback, state); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.AutoScaling.Model.CreateLaunchConfigurationRequest(); if (cmdletContext.AssociatePublicIpAddress != null) { request.AssociatePublicIpAddress = cmdletContext.AssociatePublicIpAddress.Value; } if (cmdletContext.BlockDeviceMapping != null) { request.BlockDeviceMappings = cmdletContext.BlockDeviceMapping; } if (cmdletContext.ClassicLinkVPCId != null) { request.ClassicLinkVPCId = cmdletContext.ClassicLinkVPCId; } if (cmdletContext.ClassicLinkVPCSecurityGroup != null) { request.ClassicLinkVPCSecurityGroups = cmdletContext.ClassicLinkVPCSecurityGroup; } if (cmdletContext.EbsOptimized != null) { request.EbsOptimized = cmdletContext.EbsOptimized.Value; } if (cmdletContext.IamInstanceProfile != null) { request.IamInstanceProfile = cmdletContext.IamInstanceProfile; } if (cmdletContext.ImageId != null) { request.ImageId = cmdletContext.ImageId; } if (cmdletContext.InstanceId != null) { request.InstanceId = cmdletContext.InstanceId; } // populate InstanceMonitoring var requestInstanceMonitoringIsNull = true; request.InstanceMonitoring = new Amazon.AutoScaling.Model.InstanceMonitoring(); System.Boolean?requestInstanceMonitoring_instanceMonitoring_Enabled = null; if (cmdletContext.InstanceMonitoring_Enabled != null) { requestInstanceMonitoring_instanceMonitoring_Enabled = cmdletContext.InstanceMonitoring_Enabled.Value; } if (requestInstanceMonitoring_instanceMonitoring_Enabled != null) { request.InstanceMonitoring.Enabled = requestInstanceMonitoring_instanceMonitoring_Enabled.Value; requestInstanceMonitoringIsNull = false; } // determine if request.InstanceMonitoring should be set to null if (requestInstanceMonitoringIsNull) { request.InstanceMonitoring = null; } if (cmdletContext.InstanceType != null) { request.InstanceType = cmdletContext.InstanceType; } if (cmdletContext.KernelId != null) { request.KernelId = cmdletContext.KernelId; } if (cmdletContext.KeyName != null) { request.KeyName = cmdletContext.KeyName; } if (cmdletContext.LaunchConfigurationName != null) { request.LaunchConfigurationName = cmdletContext.LaunchConfigurationName; } // populate MetadataOptions var requestMetadataOptionsIsNull = true; request.MetadataOptions = new Amazon.AutoScaling.Model.InstanceMetadataOptions(); Amazon.AutoScaling.InstanceMetadataEndpointState requestMetadataOptions_metadataOptions_HttpEndpoint = null; if (cmdletContext.MetadataOptions_HttpEndpoint != null) { requestMetadataOptions_metadataOptions_HttpEndpoint = cmdletContext.MetadataOptions_HttpEndpoint; } if (requestMetadataOptions_metadataOptions_HttpEndpoint != null) { request.MetadataOptions.HttpEndpoint = requestMetadataOptions_metadataOptions_HttpEndpoint; requestMetadataOptionsIsNull = false; } System.Int32?requestMetadataOptions_metadataOptions_HttpPutResponseHopLimit = null; if (cmdletContext.MetadataOptions_HttpPutResponseHopLimit != null) { requestMetadataOptions_metadataOptions_HttpPutResponseHopLimit = cmdletContext.MetadataOptions_HttpPutResponseHopLimit.Value; } if (requestMetadataOptions_metadataOptions_HttpPutResponseHopLimit != null) { request.MetadataOptions.HttpPutResponseHopLimit = requestMetadataOptions_metadataOptions_HttpPutResponseHopLimit.Value; requestMetadataOptionsIsNull = false; } Amazon.AutoScaling.InstanceMetadataHttpTokensState requestMetadataOptions_metadataOptions_HttpToken = null; if (cmdletContext.MetadataOptions_HttpToken != null) { requestMetadataOptions_metadataOptions_HttpToken = cmdletContext.MetadataOptions_HttpToken; } if (requestMetadataOptions_metadataOptions_HttpToken != null) { request.MetadataOptions.HttpTokens = requestMetadataOptions_metadataOptions_HttpToken; requestMetadataOptionsIsNull = false; } // determine if request.MetadataOptions should be set to null if (requestMetadataOptionsIsNull) { request.MetadataOptions = null; } if (cmdletContext.PlacementTenancy != null) { request.PlacementTenancy = cmdletContext.PlacementTenancy; } if (cmdletContext.RamdiskId != null) { request.RamdiskId = cmdletContext.RamdiskId; } if (cmdletContext.SecurityGroup != null) { request.SecurityGroups = cmdletContext.SecurityGroup; } if (cmdletContext.SpotPrice != null) { request.SpotPrice = cmdletContext.SpotPrice; } if (cmdletContext.UserData != null) { request.UserData = cmdletContext.UserData; } 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); }
/// <summary> /// <para> Creates a new launch configuration. The launch configuration name must be unique within the scope of the client's AWS account. The /// maximum limit of launch configurations, which by default is 100, must not yet have been met; otherwise, the call will fail. When created, /// the new launch configuration is available for immediate use. </para> <para>You can create a launch configuration with Amazon EC2 security /// groups or with Amazon VPC security groups. However, you can't use Amazon EC2 security groups together with Amazon VPC security groups, or /// vice versa.</para> <para><b>NOTE:</b> At this time, Auto Scaling launch configurations don't support compressed (e.g. zipped) user data /// files. </para> /// </summary> /// /// <param name="createLaunchConfigurationRequest">Container for the necessary parameters to execute the CreateLaunchConfiguration service /// method on AmazonAutoScaling.</param> /// /// <exception cref="LimitExceededException"/> /// <exception cref="AlreadyExistsException"/> public CreateLaunchConfigurationResponse CreateLaunchConfiguration(CreateLaunchConfigurationRequest createLaunchConfigurationRequest) { IRequest<CreateLaunchConfigurationRequest> request = new CreateLaunchConfigurationRequestMarshaller().Marshall(createLaunchConfigurationRequest); CreateLaunchConfigurationResponse response = Invoke<CreateLaunchConfigurationRequest, CreateLaunchConfigurationResponse> (request, this.signer, CreateLaunchConfigurationResponseUnmarshaller.GetInstance()); return response; }
internal CreateLaunchConfigurationResponse CreateLaunchConfiguration(CreateLaunchConfigurationRequest request) { var task = CreateLaunchConfigurationAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
protected override void ProcessRecord() { AmazonAutoScaling client = base.GetClient(); Amazon.AutoScaling.Model.CreateLaunchConfigurationRequest request = new Amazon.AutoScaling.Model.CreateLaunchConfigurationRequest(); request.LaunchConfigurationName = this._LaunchConfigurationName; request.ImageId = this._ImageId; request.KeyName = this._KeyName; if (string.IsNullOrEmpty(this._SecurityGroups)) { request.SecurityGroups.Add(this._SecurityGroups); } request.UserData = this._UserData; request.InstanceType = this._InstanceType; request.KernelId = this._KernelId; request.RamdiskId = this._RamdiskId; Amazon.AutoScaling.Model.CreateLaunchConfigurationResponse response = client.CreateLaunchConfiguration(request); }
/// <summary> /// Initiates the asynchronous execution of the CreateLaunchConfiguration operation. /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.CreateLaunchConfiguration"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLaunchConfiguration 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 async Task<CreateLaunchConfigurationResponse> CreateLaunchConfigurationAsync(CreateLaunchConfigurationRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateLaunchConfigurationRequestMarshaller(); var unmarshaller = CreateLaunchConfigurationResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateLaunchConfigurationRequest, CreateLaunchConfigurationResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }