Example #1
0
 internal GetAggregateDiscoveredResourceCountsPaginator(IAmazonConfigService client, GetAggregateDiscoveredResourceCountsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Example #2
0
 /// <summary>
 /// Paginator for GetAggregateDiscoveredResourceCounts operation
 ///</summary>
 public IGetAggregateDiscoveredResourceCountsPaginator GetAggregateDiscoveredResourceCounts(GetAggregateDiscoveredResourceCountsRequest request)
 {
     return(new GetAggregateDiscoveredResourceCountsPaginator(this.client, request));
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ConfigService.Model.GetAggregateDiscoveredResourceCountsRequest();

            if (cmdletContext.ConfigurationAggregatorName != null)
            {
                request.ConfigurationAggregatorName = cmdletContext.ConfigurationAggregatorName;
            }

            // populate Filters
            var requestFiltersIsNull = true;

            request.Filters = new Amazon.ConfigService.Model.ResourceCountFilters();
            System.String requestFilters_filters_AccountId = null;
            if (cmdletContext.Filters_AccountId != null)
            {
                requestFilters_filters_AccountId = cmdletContext.Filters_AccountId;
            }
            if (requestFilters_filters_AccountId != null)
            {
                request.Filters.AccountId = requestFilters_filters_AccountId;
                requestFiltersIsNull      = false;
            }
            System.String requestFilters_filters_Region = null;
            if (cmdletContext.Filters_Region != null)
            {
                requestFilters_filters_Region = cmdletContext.Filters_Region;
            }
            if (requestFilters_filters_Region != null)
            {
                request.Filters.Region = requestFilters_filters_Region;
                requestFiltersIsNull   = false;
            }
            Amazon.ConfigService.ResourceType requestFilters_filters_ResourceType = null;
            if (cmdletContext.Filters_ResourceType != null)
            {
                requestFilters_filters_ResourceType = cmdletContext.Filters_ResourceType;
            }
            if (requestFilters_filters_ResourceType != null)
            {
                request.Filters.ResourceType = requestFilters_filters_ResourceType;
                requestFiltersIsNull         = false;
            }
            // determine if request.Filters should be set to null
            if (requestFiltersIsNull)
            {
                request.Filters = null;
            }
            if (cmdletContext.GroupByKey != null)
            {
                request.GroupByKey = cmdletContext.GroupByKey;
            }
            if (cmdletContext.Limit != null)
            {
                request.Limit = cmdletContext.Limit.Value;
            }
            if (cmdletContext.NextToken != null)
            {
                request.NextToken = cmdletContext.NextToken;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
 private Amazon.ConfigService.Model.GetAggregateDiscoveredResourceCountsResponse CallAWSServiceOperation(IAmazonConfigService client, Amazon.ConfigService.Model.GetAggregateDiscoveredResourceCountsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Config", "GetAggregateDiscoveredResourceCounts");
     try
     {
         #if DESKTOP
         return(client.GetAggregateDiscoveredResourceCounts(request));
         #elif CORECLR
         return(client.GetAggregateDiscoveredResourceCountsAsync(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.ConfigService.Model.GetAggregateDiscoveredResourceCountsRequest();

            if (cmdletContext.ConfigurationAggregatorName != null)
            {
                request.ConfigurationAggregatorName = cmdletContext.ConfigurationAggregatorName;
            }

            // populate Filters
            var requestFiltersIsNull = true;

            request.Filters = new Amazon.ConfigService.Model.ResourceCountFilters();
            System.String requestFilters_filters_AccountId = null;
            if (cmdletContext.Filters_AccountId != null)
            {
                requestFilters_filters_AccountId = cmdletContext.Filters_AccountId;
            }
            if (requestFilters_filters_AccountId != null)
            {
                request.Filters.AccountId = requestFilters_filters_AccountId;
                requestFiltersIsNull      = false;
            }
            System.String requestFilters_filters_Region = null;
            if (cmdletContext.Filters_Region != null)
            {
                requestFilters_filters_Region = cmdletContext.Filters_Region;
            }
            if (requestFilters_filters_Region != null)
            {
                request.Filters.Region = requestFilters_filters_Region;
                requestFiltersIsNull   = false;
            }
            Amazon.ConfigService.ResourceType requestFilters_filters_ResourceType = null;
            if (cmdletContext.Filters_ResourceType != null)
            {
                requestFilters_filters_ResourceType = cmdletContext.Filters_ResourceType;
            }
            if (requestFilters_filters_ResourceType != null)
            {
                request.Filters.ResourceType = requestFilters_filters_ResourceType;
                requestFiltersIsNull         = false;
            }
            // determine if request.Filters should be set to null
            if (requestFiltersIsNull)
            {
                request.Filters = null;
            }
            if (cmdletContext.GroupByKey != null)
            {
                request.GroupByKey = cmdletContext.GroupByKey;
            }
            if (cmdletContext.Limit != null)
            {
                request.Limit = cmdletContext.Limit.Value;
            }

            // Initialize loop variant and commence piping
            var _nextToken             = cmdletContext.NextToken;
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            do
            {
                request.NextToken = _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.NextToken;
                }
                catch (Exception e)
                {
                    output = new CmdletOutput {
                        ErrorResponse = e
                    };
                }

                ProcessOutput(output);
            } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken));

            if (useParameterSelect)
            {
                WriteObject(cmdletContext.Select(null, this));
            }


            return(null);
        }