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.Route53.Model.ListTrafficPoliciesRequest(); if (cmdletContext.MaxItem != null) { request.MaxItems = AutoIterationHelpers.ConvertEmitLimitToServiceTypeString(cmdletContext.MaxItem.Value); } // Initialize loop variant and commence piping var _nextToken = cmdletContext.TrafficPolicyIdMarker; var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.TrafficPolicyIdMarker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.TrafficPolicyIdMarker = _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.TrafficPolicyIdMarker; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }
private Amazon.Route53.Model.ListTrafficPoliciesResponse CallAWSServiceOperation(IAmazonRoute53 client, Amazon.Route53.Model.ListTrafficPoliciesRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Route 53", "ListTrafficPolicies"); try { #if DESKTOP return(client.ListTrafficPolicies(request)); #elif CORECLR return(client.ListTrafficPoliciesAsync(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.Route53.Model.ListTrafficPoliciesRequest(); // Initialize loop variants and commence piping System.String _nextToken = null; int? _emitLimit = null; int _retrievedSoFar = 0; if (AutoIterationHelpers.HasValue(cmdletContext.TrafficPolicyIdMarker)) { _nextToken = cmdletContext.TrafficPolicyIdMarker; } if (cmdletContext.MaxItem.HasValue) { // The service has a maximum page size of 100. If the user has // asked for more items than page max, and there is no page size // configured, we rely on the service ignoring the set maximum // and giving us 100 items back. If a page size is set, that will // be used to configure the pagination. // We'll make further calls to satisfy the user's request. _emitLimit = cmdletContext.MaxItem; } var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.TrafficPolicyIdMarker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.TrafficPolicyIdMarker = _nextToken; if (_emitLimit.HasValue) { int correctPageSize = Math.Min(100, _emitLimit.Value); request.MaxItems = AutoIterationHelpers.ConvertEmitLimitToString(correctPageSize); } else if (!ParameterWasBound(nameof(this.MaxItem))) { request.MaxItems = AutoIterationHelpers.ConvertEmitLimitToString(100); } 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.TrafficPolicySummaries.Count; _nextToken = response.TrafficPolicyIdMarker; _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); }
/// <summary> /// Initiates the asynchronous execution of the ListTrafficPolicies operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListTrafficPolicies operation on AmazonRoute53Client.</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 EndListTrafficPolicies /// operation.</returns> public IAsyncResult BeginListTrafficPolicies(ListTrafficPoliciesRequest request, AsyncCallback callback, object state) { var marshaller = new ListTrafficPoliciesRequestMarshaller(); var unmarshaller = ListTrafficPoliciesResponseUnmarshaller.Instance; return BeginInvoke<ListTrafficPoliciesRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Gets information about the latest version for every traffic policy that is associated /// with the current AWS account. Send a <code>GET</code> request to the <code>/<i>Amazon /// Route 53 API version</i>/trafficpolicy</code> resource. /// /// /// <para> /// Amazon Route 53 returns a maximum of 100 items in each response. If you have a lot /// of traffic policies, you can use the <code>maxitems</code> parameter to list them /// in groups of up to 100. /// </para> /// /// <para> /// The response includes three values that help you navigate from one group of <code>maxitems</code> /// traffic policies to the next: /// </para> /// <ul> <li> /// <para> /// <b>IsTruncated</b> /// </para> /// /// <para> /// If the value of <code>IsTruncated</code> in the response is <code>true</code>, there /// are more traffic policies associated with the current AWS account. /// </para> /// /// <para> /// If <code>IsTruncated</code> is <code>false</code>, this response includes the last /// traffic policy that is associated with the current account. /// </para> /// </li> <li> /// <para> /// <b>TrafficPolicyIdMarker</b> /// </para> /// /// <para> /// If <code>IsTruncated</code> is <code>true</code>, <code>TrafficPolicyIdMarker</code> /// is the ID of the first traffic policy in the next group of <code>MaxItems</code> traffic /// policies. If you want to list more traffic policies, make another call to <code>ListTrafficPolicies</code>, /// and specify the value of the <code>TrafficPolicyIdMarker</code> element from the response /// in the <code>TrafficPolicyIdMarker</code> request parameter. /// </para> /// /// <para> /// If <code>IsTruncated</code> is <code>false</code>, the <code>TrafficPolicyIdMarker</code> /// element is omitted from the response. /// </para> /// </li> <li> /// <para> /// <b>MaxItems</b> /// </para> /// /// <para> /// The value that you specified for the <code>MaxItems</code> parameter in the request /// that produced the current response. /// </para> /// </li> </ul> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListTrafficPolicies service method.</param> /// /// <returns>The response from the ListTrafficPolicies service method, as returned by Route53.</returns> /// <exception cref="Amazon.Route53.Model.InvalidInputException"> /// The input is not valid. /// </exception> public ListTrafficPoliciesResponse ListTrafficPolicies(ListTrafficPoliciesRequest request) { var marshaller = new ListTrafficPoliciesRequestMarshaller(); var unmarshaller = ListTrafficPoliciesResponseUnmarshaller.Instance; return Invoke<ListTrafficPoliciesRequest,ListTrafficPoliciesResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the ListTrafficPolicies operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListTrafficPolicies 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<ListTrafficPoliciesResponse> ListTrafficPoliciesAsync(ListTrafficPoliciesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListTrafficPoliciesRequestMarshaller(); var unmarshaller = ListTrafficPoliciesResponseUnmarshaller.Instance; return InvokeAsync<ListTrafficPoliciesRequest,ListTrafficPoliciesResponse>(request, marshaller, unmarshaller, cancellationToken); }