public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; var useParameterSelect = this.Select.StartsWith("^"); // create request and set iteration invariants var request = new Amazon.CloudFront.Model.ListDistributionsRequest(); if (cmdletContext.MaxItem != null) { request.MaxItems = AutoIterationHelpers.ConvertEmitLimitToServiceTypeString(cmdletContext.MaxItem.Value); } // Initialize loop variant and commence piping var _nextToken = cmdletContext.Marker; var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.Marker = _nextToken; CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; _nextToken = response.DistributionList.NextMarker; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }
protected override void ProcessRecord() { AmazonCloudFront client = base.GetClient(); Amazon.CloudFront.Model.ListDistributionsRequest request = new Amazon.CloudFront.Model.ListDistributionsRequest(); request.Marker = this._Marker; request.MaxItems = this._MaxItems; request.Id = this._Id; request.ETag = this._ETag; Amazon.CloudFront.Model.ListDistributionsResponse response = client.ListDistributions(request); }
/// <summary> /// Initiates the asynchronous execution of the ListDistributions operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListDistributions 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<ListDistributionsResponse> ListDistributionsAsync(ListDistributionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListDistributionsRequestMarshaller(); var unmarshaller = ListDistributionsResponseUnmarshaller.Instance; return InvokeAsync<ListDistributionsRequest,ListDistributionsResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Paginator for ListDistributions operation ///</summary> public IListDistributionsPaginator ListDistributions(ListDistributionsRequest request) { return(new ListDistributionsPaginator(this.client, request)); }
/// <summary> /// List distributions. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListDistributions service method.</param> /// /// <returns>The response from the ListDistributions service method, as returned by CloudFront.</returns> /// <exception cref="InvalidArgumentException"> /// The argument is invalid. /// </exception> public ListDistributionsResponse ListDistributions(ListDistributionsRequest request) { var task = ListDistributionsAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the ListDistributions operation. /// <seealso cref="Amazon.CloudFront.AmazonCloudFront.ListDistributions"/> /// </summary> /// /// <param name="listDistributionsRequest">Container for the necessary parameters to execute the ListDistributions operation on /// AmazonCloudFront.</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 EndListDistributions /// operation.</returns> public IAsyncResult BeginListDistributions(ListDistributionsRequest listDistributionsRequest, AsyncCallback callback, object state) { return invokeListDistributions(listDistributionsRequest, callback, state, false); }
IAsyncResult invokeListDistributions(ListDistributionsRequest listDistributionsRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new ListDistributionsRequestMarshaller().Marshall(listDistributionsRequest); var unmarshaller = ListDistributionsResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para> List distributions. </para> /// </summary> /// /// <param name="listDistributionsRequest">Container for the necessary parameters to execute the ListDistributions service method on /// AmazonCloudFront.</param> /// /// <returns>The response from the ListDistributions service method, as returned by AmazonCloudFront.</returns> /// /// <exception cref="InvalidArgumentException"/> public ListDistributionsResponse ListDistributions(ListDistributionsRequest listDistributionsRequest) { IAsyncResult asyncResult = invokeListDistributions(listDistributionsRequest, null, null, true); return EndListDistributions(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the ListDistributions operation. /// <seealso cref="Amazon.CloudFront.IAmazonCloudFront.ListDistributions"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListDistributions 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<ListDistributionsResponse> ListDistributionsAsync(ListDistributionsRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListDistributionsRequestMarshaller(); var unmarshaller = ListDistributionsResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, ListDistributionsRequest, ListDistributionsResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> List distributions. </para> /// </summary> /// /// <param name="listDistributionsRequest">Container for the necessary parameters to execute the ListDistributions service method on /// AmazonCloudFront.</param> /// /// <returns>The response from the ListDistributions service method, as returned by AmazonCloudFront.</returns> /// /// <exception cref="T:Amazon.CloudFront.Model.InvalidArgumentException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<ListDistributionsResponse> ListDistributionsAsync(ListDistributionsRequest listDistributionsRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListDistributionsRequestMarshaller(); var unmarshaller = ListDistributionsResponseUnmarshaller.GetInstance(); return Invoke<IRequest, ListDistributionsRequest, ListDistributionsResponse>(listDistributionsRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal ListDistributionsResponse ListDistributions(ListDistributionsRequest request) { var task = ListDistributionsAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.CloudFront.Model.ListDistributionsResponse CallAWSServiceOperation(IAmazonCloudFront client, Amazon.CloudFront.Model.ListDistributionsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudFront", "ListDistributions"); try { #if DESKTOP return(client.ListDistributions(request)); #elif CORECLR return(client.ListDistributionsAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; var useParameterSelect = this.Select.StartsWith("^"); // create request and set iteration invariants var request = new Amazon.CloudFront.Model.ListDistributionsRequest(); // Initialize loop variants and commence piping System.String _nextToken = null; int? _emitLimit = null; int _retrievedSoFar = 0; if (AutoIterationHelpers.HasValue(cmdletContext.Marker)) { _nextToken = cmdletContext.Marker; } if (AutoIterationHelpers.HasValue(cmdletContext.MaxItem)) { _emitLimit = cmdletContext.MaxItem; } var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.Marker = _nextToken; if (_emitLimit.HasValue) { request.MaxItems = AutoIterationHelpers.ConvertEmitLimitToString(_emitLimit.Value); } CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; int _receivedThisCall = response.DistributionList.Items.Count; _nextToken = response.DistributionList.NextMarker; _retrievedSoFar += _receivedThisCall; if (_emitLimit.HasValue) { _emitLimit -= _receivedThisCall; } } catch (Exception e) { if (_retrievedSoFar == 0 || !_emitLimit.HasValue) { output = new CmdletOutput { ErrorResponse = e }; } else { break; } } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken) && (!_emitLimit.HasValue || _emitLimit.Value >= 1)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }
IAsyncResult invokeListDistributions(ListDistributionsRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new ListDistributionsRequestMarshaller(); var unmarshaller = ListDistributionsResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
/// <summary> /// List distributions. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListDistributions service method.</param> /// /// <returns>The response from the ListDistributions service method, as returned by CloudFront.</returns> /// <exception cref="Amazon.CloudFront.Model.InvalidArgumentException"> /// The argument is invalid. /// </exception> public ListDistributionsResponse ListDistributions(ListDistributionsRequest request) { var marshaller = new ListDistributionsRequestMarshaller(); var unmarshaller = ListDistributionsResponseUnmarshaller.Instance; return Invoke<ListDistributionsRequest,ListDistributionsResponse>(request, marshaller, unmarshaller); }
internal ListDistributionsPaginator(IAmazonCloudFront client, ListDistributionsRequest request) { this._client = client; this._request = request; }
/// <summary> /// Initiates the asynchronous execution of the ListDistributions operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListDistributions operation on AmazonCloudFrontClient.</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 EndListDistributions /// operation.</returns> public IAsyncResult BeginListDistributions(ListDistributionsRequest request, AsyncCallback callback, object state) { var marshaller = new ListDistributionsRequestMarshaller(); var unmarshaller = ListDistributionsResponseUnmarshaller.Instance; return BeginInvoke<ListDistributionsRequest>(request, marshaller, unmarshaller, callback, state); }
public List<string> GetCloudFrontDistributionDomains() { ListDistributionsRequest request = new ListDistributionsRequest(); ListDistributionsResponse response = _client.ListDistributions(request); return response.Distribution.Select(dist => dist.DomainName).ToList(); }