private async Task <bool> LoadBalancerExists() { var request = new DescribeLoadBalancersRequest(); var response = await _client.DescribeLoadBalancersAsync(request); return(response.LoadBalancerDescriptions.Any(criteria => criteria.LoadBalancerName == _task.Name)); }
protected override async Task <IEnumerable <LoadBalancerDescription> > FetchResources() { var results = new List <LoadBalancerDescription>(); string marker = null; do { var response = await _client.DescribeLoadBalancersAsync(new DescribeLoadBalancersRequest { Marker = marker }); results.AddRange(response.LoadBalancerDescriptions); marker = response.NextMarker; }while (!string.IsNullOrEmpty(marker)); return(results); }
async IAsyncEnumerable <DescribeLoadBalancersResponse> IPaginator <DescribeLoadBalancersResponse> .PaginateAsync(CancellationToken cancellationToken = default) { if (Interlocked.Exchange(ref _isPaginatorInUse, 1) != 0) { throw new System.InvalidOperationException("Paginator has already been consumed and cannot be reused. Please create a new instance."); } var marker = _request.Marker; DescribeLoadBalancersResponse response; do { _request.Marker = marker; response = await _client.DescribeLoadBalancersAsync(_request, cancellationToken).ConfigureAwait(false); marker = response.NextMarker; cancellationToken.ThrowIfCancellationRequested(); yield return(response); }while (marker != null); }
private Amazon.ElasticLoadBalancing.Model.DescribeLoadBalancersResponse CallAWSServiceOperation(IAmazonElasticLoadBalancing client, Amazon.ElasticLoadBalancing.Model.DescribeLoadBalancersRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Elastic Load Balancing", "DescribeLoadBalancers"); try { #if DESKTOP return(client.DescribeLoadBalancers(request)); #elif CORECLR return(client.DescribeLoadBalancersAsync(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; } }