private Amazon.WorkDocs.Model.DescribeGroupsResponse CallAWSServiceOperation(IAmazonWorkDocs client, Amazon.WorkDocs.Model.DescribeGroupsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon WorkDocs", "DescribeGroups"); try { #if DESKTOP return(client.DescribeGroups(request)); #elif CORECLR return(client.DescribeGroupsAsync(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.WorkDocs.Model.DescribeGroupsRequest(); if (cmdletContext.AuthenticationToken != null) { request.AuthenticationToken = cmdletContext.AuthenticationToken; } if (cmdletContext.OrganizationId != null) { request.OrganizationId = cmdletContext.OrganizationId; } if (cmdletContext.SearchQuery != null) { request.SearchQuery = cmdletContext.SearchQuery; } // 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 (cmdletContext.Limit.HasValue) { _emitLimit = cmdletContext.Limit; } var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.Marker = _nextToken; if (_emitLimit.HasValue) { request.Limit = AutoIterationHelpers.ConvertEmitLimitToInt32(_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.Groups.Count; _nextToken = response.Marker; _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); }