private Amazon.DevOpsGuru.Model.SearchInsightsResponse CallAWSServiceOperation(IAmazonDevOpsGuru client, Amazon.DevOpsGuru.Model.SearchInsightsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon DevOps Guru", "SearchInsights");
     try
     {
         #if DESKTOP
         return(client.SearchInsights(request));
         #elif CORECLR
         return(client.SearchInsightsAsync(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;
     }
 }
 internal SearchInsightsPaginator(IAmazonDevOpsGuru client, SearchInsightsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;

            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent;
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute

            // create request and set iteration invariants
            var request = new Amazon.DevOpsGuru.Model.SearchInsightsRequest();


            // populate Filters
            var requestFiltersIsNull = true;
            request.Filters = new Amazon.DevOpsGuru.Model.SearchInsightsFilters();
            Amazon.DevOpsGuru.Model.ResourceCollection requestFilters_filters_ResourceCollection = null;
            if (cmdletContext.Filters_ResourceCollection != null)
            {
                requestFilters_filters_ResourceCollection = cmdletContext.Filters_ResourceCollection;
            }
            if (requestFilters_filters_ResourceCollection != null)
            {
                request.Filters.ResourceCollection = requestFilters_filters_ResourceCollection;
                requestFiltersIsNull = false;
            }
            List <System.String> requestFilters_filters_Severity = null;
            if (cmdletContext.Filters_Severity != null)
            {
                requestFilters_filters_Severity = cmdletContext.Filters_Severity;
            }
            if (requestFilters_filters_Severity != null)
            {
                request.Filters.Severities = requestFilters_filters_Severity;
                requestFiltersIsNull       = false;
            }
            List <System.String> requestFilters_filters_Status = null;
            if (cmdletContext.Filters_Status != null)
            {
                requestFilters_filters_Status = cmdletContext.Filters_Status;
            }
            if (requestFilters_filters_Status != null)
            {
                request.Filters.Statuses = requestFilters_filters_Status;
                requestFiltersIsNull     = false;
            }
            Amazon.DevOpsGuru.Model.ServiceCollection requestFilters_filters_ServiceCollection = null;

            // populate ServiceCollection
            var requestFilters_filters_ServiceCollectionIsNull = true;
            requestFilters_filters_ServiceCollection = new Amazon.DevOpsGuru.Model.ServiceCollection();
            List <System.String> requestFilters_filters_ServiceCollection_serviceCollection_ServiceName = null;
            if (cmdletContext.ServiceCollection_ServiceName != null)
            {
                requestFilters_filters_ServiceCollection_serviceCollection_ServiceName = cmdletContext.ServiceCollection_ServiceName;
            }
            if (requestFilters_filters_ServiceCollection_serviceCollection_ServiceName != null)
            {
                requestFilters_filters_ServiceCollection.ServiceNames = requestFilters_filters_ServiceCollection_serviceCollection_ServiceName;
                requestFilters_filters_ServiceCollectionIsNull        = false;
            }
            // determine if requestFilters_filters_ServiceCollection should be set to null
            if (requestFilters_filters_ServiceCollectionIsNull)
            {
                requestFilters_filters_ServiceCollection = null;
            }
            if (requestFilters_filters_ServiceCollection != null)
            {
                request.Filters.ServiceCollection = requestFilters_filters_ServiceCollection;
                requestFiltersIsNull = false;
            }
            // determine if request.Filters should be set to null
            if (requestFiltersIsNull)
            {
                request.Filters = null;
            }
            if (cmdletContext.MaxResult != null)
            {
                request.MaxResults = cmdletContext.MaxResult.Value;
            }
            if (cmdletContext.StartTimeRange != null)
            {
                request.StartTimeRange = cmdletContext.StartTimeRange;
            }
            if (cmdletContext.Type != null)
            {
                request.Type = cmdletContext.Type;
            }

            // 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);
        }
Example #4
0
 /// <summary>
 /// Paginator for SearchInsights operation
 ///</summary>
 public ISearchInsightsPaginator SearchInsights(SearchInsightsRequest request)
 {
     return(new SearchInsightsPaginator(this.client, request));
 }