コード例 #1
0
 internal ListCoveragePaginator(IAmazonInspector2 client, ListCoverageRequest request)
 {
     this._client  = client;
     this._request = request;
 }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Inspector2.Model.ListCoverageRequest();


            // populate FilterCriteria
            var requestFilterCriteriaIsNull = true;

            request.FilterCriteria = new Amazon.Inspector2.Model.CoverageFilterCriteria();
            List <Amazon.Inspector2.Model.CoverageStringFilter> requestFilterCriteria_filterCriteria_AccountId = null;

            if (cmdletContext.FilterCriteria_AccountId != null)
            {
                requestFilterCriteria_filterCriteria_AccountId = cmdletContext.FilterCriteria_AccountId;
            }
            if (requestFilterCriteria_filterCriteria_AccountId != null)
            {
                request.FilterCriteria.AccountId = requestFilterCriteria_filterCriteria_AccountId;
                requestFilterCriteriaIsNull      = false;
            }
            List <Amazon.Inspector2.Model.CoverageMapFilter> requestFilterCriteria_filterCriteria_Ec2InstanceTag = null;

            if (cmdletContext.FilterCriteria_Ec2InstanceTag != null)
            {
                requestFilterCriteria_filterCriteria_Ec2InstanceTag = cmdletContext.FilterCriteria_Ec2InstanceTag;
            }
            if (requestFilterCriteria_filterCriteria_Ec2InstanceTag != null)
            {
                request.FilterCriteria.Ec2InstanceTags = requestFilterCriteria_filterCriteria_Ec2InstanceTag;
                requestFilterCriteriaIsNull            = false;
            }
            List <Amazon.Inspector2.Model.CoverageStringFilter> requestFilterCriteria_filterCriteria_EcrImageTag = null;

            if (cmdletContext.FilterCriteria_EcrImageTag != null)
            {
                requestFilterCriteria_filterCriteria_EcrImageTag = cmdletContext.FilterCriteria_EcrImageTag;
            }
            if (requestFilterCriteria_filterCriteria_EcrImageTag != null)
            {
                request.FilterCriteria.EcrImageTags = requestFilterCriteria_filterCriteria_EcrImageTag;
                requestFilterCriteriaIsNull         = false;
            }
            List <Amazon.Inspector2.Model.CoverageStringFilter> requestFilterCriteria_filterCriteria_EcrRepositoryName = null;

            if (cmdletContext.FilterCriteria_EcrRepositoryName != null)
            {
                requestFilterCriteria_filterCriteria_EcrRepositoryName = cmdletContext.FilterCriteria_EcrRepositoryName;
            }
            if (requestFilterCriteria_filterCriteria_EcrRepositoryName != null)
            {
                request.FilterCriteria.EcrRepositoryName = requestFilterCriteria_filterCriteria_EcrRepositoryName;
                requestFilterCriteriaIsNull = false;
            }
            List <Amazon.Inspector2.Model.CoverageStringFilter> requestFilterCriteria_filterCriteria_ResourceId = null;

            if (cmdletContext.FilterCriteria_ResourceId != null)
            {
                requestFilterCriteria_filterCriteria_ResourceId = cmdletContext.FilterCriteria_ResourceId;
            }
            if (requestFilterCriteria_filterCriteria_ResourceId != null)
            {
                request.FilterCriteria.ResourceId = requestFilterCriteria_filterCriteria_ResourceId;
                requestFilterCriteriaIsNull       = false;
            }
            List <Amazon.Inspector2.Model.CoverageStringFilter> requestFilterCriteria_filterCriteria_ResourceType = null;

            if (cmdletContext.FilterCriteria_ResourceType != null)
            {
                requestFilterCriteria_filterCriteria_ResourceType = cmdletContext.FilterCriteria_ResourceType;
            }
            if (requestFilterCriteria_filterCriteria_ResourceType != null)
            {
                request.FilterCriteria.ResourceType = requestFilterCriteria_filterCriteria_ResourceType;
                requestFilterCriteriaIsNull         = false;
            }
            List <Amazon.Inspector2.Model.CoverageStringFilter> requestFilterCriteria_filterCriteria_ScanStatusCode = null;

            if (cmdletContext.FilterCriteria_ScanStatusCode != null)
            {
                requestFilterCriteria_filterCriteria_ScanStatusCode = cmdletContext.FilterCriteria_ScanStatusCode;
            }
            if (requestFilterCriteria_filterCriteria_ScanStatusCode != null)
            {
                request.FilterCriteria.ScanStatusCode = requestFilterCriteria_filterCriteria_ScanStatusCode;
                requestFilterCriteriaIsNull           = false;
            }
            List <Amazon.Inspector2.Model.CoverageStringFilter> requestFilterCriteria_filterCriteria_ScanStatusReason = null;

            if (cmdletContext.FilterCriteria_ScanStatusReason != null)
            {
                requestFilterCriteria_filterCriteria_ScanStatusReason = cmdletContext.FilterCriteria_ScanStatusReason;
            }
            if (requestFilterCriteria_filterCriteria_ScanStatusReason != null)
            {
                request.FilterCriteria.ScanStatusReason = requestFilterCriteria_filterCriteria_ScanStatusReason;
                requestFilterCriteriaIsNull             = false;
            }
            List <Amazon.Inspector2.Model.CoverageStringFilter> requestFilterCriteria_filterCriteria_ScanType = null;

            if (cmdletContext.FilterCriteria_ScanType != null)
            {
                requestFilterCriteria_filterCriteria_ScanType = cmdletContext.FilterCriteria_ScanType;
            }
            if (requestFilterCriteria_filterCriteria_ScanType != null)
            {
                request.FilterCriteria.ScanType = requestFilterCriteria_filterCriteria_ScanType;
                requestFilterCriteriaIsNull     = false;
            }
            // determine if request.FilterCriteria should be set to null
            if (requestFilterCriteriaIsNull)
            {
                request.FilterCriteria = null;
            }
            if (cmdletContext.MaxResult != null)
            {
                request.MaxResults = cmdletContext.MaxResult.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);
        }
コード例 #3
0
 private Amazon.Inspector2.Model.ListCoverageResponse CallAWSServiceOperation(IAmazonInspector2 client, Amazon.Inspector2.Model.ListCoverageRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Inspector2", "ListCoverage");
     try
     {
         #if DESKTOP
         return(client.ListCoverage(request));
         #elif CORECLR
         return(client.ListCoverageAsync(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;
     }
 }
コード例 #4
0
 /// <summary>
 /// Paginator for ListCoverage operation
 ///</summary>
 public IListCoveragePaginator ListCoverage(ListCoverageRequest request)
 {
     return(new ListCoveragePaginator(this.client, request));
 }