Container for the parameters to the ListFindings operation. Lists findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs.
Inheritance: AmazonInspectorRequest
        /// <summary>
        /// Initiates the asynchronous execution of the ListFindings operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ListFindings 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<ListFindingsResponse> ListFindingsAsync(ListFindingsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ListFindingsRequestMarshaller();
            var unmarshaller = ListFindingsResponseUnmarshaller.Instance;

            return InvokeAsync<ListFindingsRequest,ListFindingsResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
 internal ListFindingsPaginator(IAmazonInspector client, ListFindingsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
        /// <summary>
        /// Lists findings that are generated by the assessment runs that are specified by the
        /// ARNs of the assessment runs.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListFindings service method.</param>
        /// 
        /// <returns>The response from the ListFindings service method, as returned by Inspector.</returns>
        /// <exception cref="Amazon.Inspector.Model.AccessDeniedException">
        /// You do not have required permissions to access the requested resource.
        /// </exception>
        /// <exception cref="Amazon.Inspector.Model.InternalException">
        /// Internal server error.
        /// </exception>
        /// <exception cref="Amazon.Inspector.Model.InvalidInputException">
        /// The request was rejected because an invalid or out-of-range value was supplied for
        /// an input parameter.
        /// </exception>
        /// <exception cref="Amazon.Inspector.Model.NoSuchEntityException">
        /// The request was rejected because it referenced an entity that does not exist. The
        /// error code describes the entity.
        /// </exception>
        public ListFindingsResponse ListFindings(ListFindingsRequest request)
        {
            var marshaller = new ListFindingsRequestMarshaller();
            var unmarshaller = ListFindingsResponseUnmarshaller.Instance;

            return Invoke<ListFindingsRequest,ListFindingsResponse>(request, marshaller, unmarshaller);
        }
Exemple #4
0
 /// <summary>
 /// Paginator for ListFindings operation
 ///</summary>
 public IListFindingsPaginator ListFindings(ListFindingsRequest request)
 {
     return(new ListFindingsPaginator(this.client, request));
 }
 private Amazon.Inspector.Model.ListFindingsResponse CallAWSServiceOperation(IAmazonInspector client, Amazon.Inspector.Model.ListFindingsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Inspector", "ListFindings");
     try
     {
         #if DESKTOP
         return(client.ListFindings(request));
         #elif CORECLR
         return(client.ListFindingsAsync(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("^") || this.PassThru.IsPresent;

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

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

            // populate Filter
            var requestFilterIsNull = true;

            request.Filter = new Amazon.Inspector.Model.FindingFilter();
            List <System.String> requestFilter_filter_AgentId = null;

            if (cmdletContext.Filter_AgentId != null)
            {
                requestFilter_filter_AgentId = cmdletContext.Filter_AgentId;
            }
            if (requestFilter_filter_AgentId != null)
            {
                request.Filter.AgentIds = requestFilter_filter_AgentId;
                requestFilterIsNull     = false;
            }
            List <Amazon.Inspector.Model.Attribute> requestFilter_filter_Attribute = null;

            if (cmdletContext.Filter_Attribute != null)
            {
                requestFilter_filter_Attribute = cmdletContext.Filter_Attribute;
            }
            if (requestFilter_filter_Attribute != null)
            {
                request.Filter.Attributes = requestFilter_filter_Attribute;
                requestFilterIsNull       = false;
            }
            List <System.String> requestFilter_filter_AutoScalingGroup = null;

            if (cmdletContext.Filter_AutoScalingGroup != null)
            {
                requestFilter_filter_AutoScalingGroup = cmdletContext.Filter_AutoScalingGroup;
            }
            if (requestFilter_filter_AutoScalingGroup != null)
            {
                request.Filter.AutoScalingGroups = requestFilter_filter_AutoScalingGroup;
                requestFilterIsNull = false;
            }
            List <System.String> requestFilter_filter_RuleName = null;

            if (cmdletContext.Filter_RuleName != null)
            {
                requestFilter_filter_RuleName = cmdletContext.Filter_RuleName;
            }
            if (requestFilter_filter_RuleName != null)
            {
                request.Filter.RuleNames = requestFilter_filter_RuleName;
                requestFilterIsNull      = false;
            }
            List <System.String> requestFilter_filter_RulesPackageArn = null;

            if (cmdletContext.Filter_RulesPackageArn != null)
            {
                requestFilter_filter_RulesPackageArn = cmdletContext.Filter_RulesPackageArn;
            }
            if (requestFilter_filter_RulesPackageArn != null)
            {
                request.Filter.RulesPackageArns = requestFilter_filter_RulesPackageArn;
                requestFilterIsNull             = false;
            }
            List <System.String> requestFilter_filter_Severity = null;

            if (cmdletContext.Filter_Severity != null)
            {
                requestFilter_filter_Severity = cmdletContext.Filter_Severity;
            }
            if (requestFilter_filter_Severity != null)
            {
                request.Filter.Severities = requestFilter_filter_Severity;
                requestFilterIsNull       = false;
            }
            List <Amazon.Inspector.Model.Attribute> requestFilter_filter_UserAttribute = null;

            if (cmdletContext.Filter_UserAttribute != null)
            {
                requestFilter_filter_UserAttribute = cmdletContext.Filter_UserAttribute;
            }
            if (requestFilter_filter_UserAttribute != null)
            {
                request.Filter.UserAttributes = requestFilter_filter_UserAttribute;
                requestFilterIsNull           = false;
            }
            Amazon.Inspector.Model.TimestampRange requestFilter_filter_CreationTimeRange = null;

            // populate CreationTimeRange
            var requestFilter_filter_CreationTimeRangeIsNull = true;

            requestFilter_filter_CreationTimeRange = new Amazon.Inspector.Model.TimestampRange();
            System.DateTime?requestFilter_filter_CreationTimeRange_creationTimeRange_BeginDate = null;
            if (cmdletContext.CreationTimeRange_BeginDate != null)
            {
                requestFilter_filter_CreationTimeRange_creationTimeRange_BeginDate = cmdletContext.CreationTimeRange_BeginDate.Value;
            }
            if (requestFilter_filter_CreationTimeRange_creationTimeRange_BeginDate != null)
            {
                requestFilter_filter_CreationTimeRange.BeginDate = requestFilter_filter_CreationTimeRange_creationTimeRange_BeginDate.Value;
                requestFilter_filter_CreationTimeRangeIsNull     = false;
            }
            System.DateTime?requestFilter_filter_CreationTimeRange_creationTimeRange_EndDate = null;
            if (cmdletContext.CreationTimeRange_EndDate != null)
            {
                requestFilter_filter_CreationTimeRange_creationTimeRange_EndDate = cmdletContext.CreationTimeRange_EndDate.Value;
            }
            if (requestFilter_filter_CreationTimeRange_creationTimeRange_EndDate != null)
            {
                requestFilter_filter_CreationTimeRange.EndDate = requestFilter_filter_CreationTimeRange_creationTimeRange_EndDate.Value;
                requestFilter_filter_CreationTimeRangeIsNull   = false;
            }
            // determine if requestFilter_filter_CreationTimeRange should be set to null
            if (requestFilter_filter_CreationTimeRangeIsNull)
            {
                requestFilter_filter_CreationTimeRange = null;
            }
            if (requestFilter_filter_CreationTimeRange != null)
            {
                request.Filter.CreationTimeRange = requestFilter_filter_CreationTimeRange;
                requestFilterIsNull = false;
            }
            // determine if request.Filter should be set to null
            if (requestFilterIsNull)
            {
                request.Filter = null;
            }

            // Initialize loop variants and commence piping
            System.String _nextToken      = null;
            int?          _emitLimit      = null;
            int           _retrievedSoFar = 0;

            if (AutoIterationHelpers.HasValue(cmdletContext.NextToken))
            {
                _nextToken = cmdletContext.NextToken;
            }
            if (cmdletContext.MaxResult.HasValue)
            {
                _emitLimit = cmdletContext.MaxResult;
            }
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));

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

            do
            {
                request.NextToken = _nextToken;
                if (_emitLimit.HasValue)
                {
                    request.MaxResults = 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.FindingArns.Count;

                    _nextToken       = response.NextToken;
                    _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 ListFindings operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ListFindings operation on AmazonInspectorClient.</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 EndListFindings
        ///         operation.</returns>
        public IAsyncResult BeginListFindings(ListFindingsRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new ListFindingsRequestMarshaller();
            var unmarshaller = ListFindingsResponseUnmarshaller.Instance;

            return BeginInvoke<ListFindingsRequest>(request, marshaller, unmarshaller,
                callback, state);
        }