public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ElasticLoadBalancingV2.Model.CreateListenerRequest(); if (cmdletContext.AlpnPolicy != null) { request.AlpnPolicy = cmdletContext.AlpnPolicy; } if (cmdletContext.Certificate != null) { request.Certificates = cmdletContext.Certificate; } if (cmdletContext.DefaultAction != null) { request.DefaultActions = cmdletContext.DefaultAction; } if (cmdletContext.LoadBalancerArn != null) { request.LoadBalancerArn = cmdletContext.LoadBalancerArn; } if (cmdletContext.Port != null) { request.Port = cmdletContext.Port.Value; } if (cmdletContext.Protocol != null) { request.Protocol = cmdletContext.Protocol; } if (cmdletContext.SslPolicy != null) { request.SslPolicy = cmdletContext.SslPolicy; } 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); }
private Amazon.ElasticLoadBalancingV2.Model.CreateListenerResponse CallAWSServiceOperation(IAmazonElasticLoadBalancingV2 client, Amazon.ElasticLoadBalancingV2.Model.CreateListenerRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Elastic Load Balancing V2", "CreateListener"); try { #if DESKTOP return(client.CreateListener(request)); #elif CORECLR return(client.CreateListenerAsync(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 CreateListener operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateListener 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<CreateListenerResponse> CreateListenerAsync(CreateListenerRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateListenerRequestMarshaller(); var unmarshaller = CreateListenerResponseUnmarshaller.Instance; return InvokeAsync<CreateListenerRequest,CreateListenerResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Creates a listener for the specified Application Load Balancer. /// /// /// <para> /// You can create up to 10 listeners per load balancer. /// </para> /// /// <para> /// To update a listener, use <a>ModifyListener</a>. When you are finished with a listener, /// you can delete it using <a>DeleteListener</a>. If you are finished with both the listener /// and the load balancer, you can delete them both using <a>DeleteLoadBalancer</a>. /// </para> /// /// <para> /// For more information, see <a href="http://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html">Listeners /// for Your Application Load Balancers</a> in the <i>Application Load Balancers Guide</i>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateListener service method.</param> /// /// <returns>The response from the CreateListener service method, as returned by ElasticLoadBalancingV2.</returns> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.CertificateNotFoundException"> /// The specified certificate does not exist. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.DuplicateListenerException"> /// A listener with the specified port already exists. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.IncompatibleProtocolsException"> /// The specified configuration is not valid with this protocol. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.InvalidConfigurationRequestException"> /// The requested configuration is not valid. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.LoadBalancerNotFoundException"> /// The specified load balancer does not exist. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.SSLPolicyNotFoundException"> /// The specified SSL policy does not exist. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.TargetGroupAssociationLimitException"> /// You've reached the limit on the number of load balancers per target group. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.TargetGroupNotFoundException"> /// The specified target group does not exist. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.TooManyCertificatesException"> /// You've reached the limit on the number of certificates per listener. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.TooManyListenersException"> /// You've reached the limit on the number of listeners per load balancer. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.TooManyRegistrationsForTargetIdException"> /// You've reached the limit on the number of times a target can be registered with a /// load balancer. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.UnsupportedProtocolException"> /// The specified protocol is not supported. /// </exception> public CreateListenerResponse CreateListener(CreateListenerRequest request) { var marshaller = new CreateListenerRequestMarshaller(); var unmarshaller = CreateListenerResponseUnmarshaller.Instance; return Invoke<CreateListenerRequest,CreateListenerResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateListener operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateListener operation on AmazonElasticLoadBalancingV2Client.</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 EndCreateListener /// operation.</returns> public IAsyncResult BeginCreateListener(CreateListenerRequest request, AsyncCallback callback, object state) { var marshaller = new CreateListenerRequestMarshaller(); var unmarshaller = CreateListenerResponseUnmarshaller.Instance; return BeginInvoke<CreateListenerRequest>(request, marshaller, unmarshaller, callback, state); }