protected override void ProcessRecord() { base.ProcessRecord(); CreateListenerRequest request; try { request = new CreateListenerRequest { NetworkLoadBalancerId = NetworkLoadBalancerId, CreateListenerDetails = CreateListenerDetails, OpcRequestId = OpcRequestId, OpcRetryToken = OpcRetryToken, IfMatch = IfMatch }; response = client.CreateListener(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
internal virtual CreateListenerResponse CreateListener(CreateListenerRequest request) { var marshaller = CreateListenerRequestMarshaller.Instance; 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.</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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/globalaccelerator-2018-08-08/CreateListener">REST API Reference for CreateListener Operation</seealso> public virtual Task <CreateListenerResponse> CreateListenerAsync(CreateListenerRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = CreateListenerRequestMarshaller.Instance; var unmarshaller = CreateListenerResponseUnmarshaller.Instance; return(InvokeAsync <CreateListenerRequest, CreateListenerResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// 创建监听器 /// </summary> public CreateListenerResponse CreateListener(CreateListenerRequest createListenerRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/elb/listeners", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", createListenerRequest); HttpResponseMessage response = DoHttpRequestSync("POST", request); return(JsonUtils.DeSerialize <CreateListenerResponse>(response)); }
/// <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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/globalaccelerator-2018-08-08/CreateListener">REST API Reference for CreateListener Operation</seealso> public virtual Task <CreateListenerResponse> CreateListenerAsync(CreateListenerRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = CreateListenerRequestMarshaller.Instance; options.ResponseUnmarshaller = CreateListenerResponseUnmarshaller.Instance; return(InvokeAsync <CreateListenerResponse>(request, options, cancellationToken)); }
internal virtual CreateListenerResponse CreateListener(CreateListenerRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = CreateListenerRequestMarshaller.Instance; options.ResponseUnmarshaller = CreateListenerResponseUnmarshaller.Instance; return(Invoke <CreateListenerResponse>(request, options)); }
/// <summary> /// 创建监听器 /// </summary> public async Task <CreateListenerResponse> CreateListenerAsync(CreateListenerRequest createListenerRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v2/{project_id}/elb/listeners", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", createListenerRequest); HttpResponseMessage response = await DoHttpRequestAsync("POST", request); return(JsonUtils.DeSerialize <CreateListenerResponse>(response)); }
/// <summary> /// 在一个负载均衡实例下创建监听器。 /// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。 /// </summary> /// <param name="req">参考<see cref="CreateListenerRequest"/></param> /// <returns>参考<see cref="CreateListenerResponse"/>实例</returns> public async Task <CreateListenerResponse> CreateListener(CreateListenerRequest req) { JsonResponseModel <CreateListenerResponse> rsp = null; try { var strResp = await this.InternalRequest(req, "CreateListener"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <CreateListenerResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }
private static async Task CreateListener(LoadBalancerClient lbClient, string loadBalancerId, RuleSet ruleSet, string backendSetName) { logger.Info($"Creating new listener: {ListenerName} with ruleset: {RuleSetName}"); var ruleSetNames = new List <string>() { ruleSet.Name }; var createListenerDetails = new CreateListenerDetails { Name = ListenerName, DefaultBackendSetName = backendSetName, Port = ListenerPort, Protocol = ListenerProtocol, RuleSetNames = ruleSetNames }; var createListenerRequest = new CreateListenerRequest { CreateListenerDetails = createListenerDetails, LoadBalancerId = loadBalancerId }; var response = await lbClient.CreateListener(createListenerRequest); var waiterConfiguration = new WaiterConfiguration { MaxAttempts = 20, GetNextDelayInSeconds = DelayStrategy.GetExponentialDelayInSeconds }; var getWorkRequestRequest = new GetWorkRequestRequest { WorkRequestId = response.OpcWorkRequestId }; lbClient.Waiters.ForWorkRequest(getWorkRequestRequest, waiterConfiguration, WorkRequest.LifecycleStateEnum.Succeeded).Execute(); logger.Info($"listener {ListenerName} is created"); }
public async Task <SA_Listener> CreatListener( string loadBalancerArn, string targetGroupArn, string strProtocol, int port, string certificateArn = "") { var actions = new List <Amazon.ElasticLoadBalancingV2.Model.Action>(); var action = new Amazon.ElasticLoadBalancingV2.Model.Action(); action.Type = ActionTypeEnum.Forward; action.TargetGroupArn = targetGroupArn; actions.Add(action); var protocol = new ProtocolEnum(strProtocol); var request = new CreateListenerRequest { DefaultActions = actions, Protocol = protocol, Port = port, LoadBalancerArn = loadBalancerArn, }; if (!string.IsNullOrEmpty(certificateArn)) { var certificate = new Certificate(); certificate.CertificateArn = certificateArn; //certificate.IsDefault = true; request.Certificates = new List <Certificate>() { certificate }; } var response = await client.CreateListenerAsync(request); var listener = response.Listeners[0]; return(ConvertListener(response.Listeners[0])); }
/// <summary> /// 创建一个监听器 /// </summary> /// <param name="request">请求参数信息</param> /// <returns>请求结果信息</returns> public async Task <CreateListenerResponse> CreateListener(CreateListenerRequest request) { return(await new CreateListenerExecutor().Client(this).Execute <CreateListenerResponse, CreateListenerResult, CreateListenerRequest>(request).ConfigureAwait(false)); }
/// <summary> /// 创建一个监听器 /// </summary> /// <param name="request">请求参数信息</param> /// <returns>请求结果信息</returns> public CreateListenerResponse CreateListener(CreateListenerRequest request) { return(new CreateListenerExecutor().Client(this).Execute <CreateListenerResponse, CreateListenerResult, CreateListenerRequest>(request)); }