Constants used for properties of type ComplianceType.
Inheritance: ConstantClass
        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.DescribeAggregateComplianceByConfigRulesRequest();

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

            // populate Filters
            var requestFiltersIsNull = true;

            request.Filters = new Amazon.ConfigService.Model.ConfigRuleComplianceFilters();
            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_AwsRegion = null;
            if (cmdletContext.Filters_AwsRegion != null)
            {
                requestFilters_filters_AwsRegion = cmdletContext.Filters_AwsRegion;
            }
            if (requestFilters_filters_AwsRegion != null)
            {
                request.Filters.AwsRegion = requestFilters_filters_AwsRegion;
                requestFiltersIsNull      = false;
            }
            Amazon.ConfigService.ComplianceType requestFilters_filters_ComplianceType = null;
            if (cmdletContext.Filters_ComplianceType != null)
            {
                requestFilters_filters_ComplianceType = cmdletContext.Filters_ComplianceType;
            }
            if (requestFilters_filters_ComplianceType != null)
            {
                request.Filters.ComplianceType = requestFilters_filters_ComplianceType;
                requestFiltersIsNull           = false;
            }
            System.String requestFilters_filters_ConfigRuleName = null;
            if (cmdletContext.Filters_ConfigRuleName != null)
            {
                requestFilters_filters_ConfigRuleName = cmdletContext.Filters_ConfigRuleName;
            }
            if (requestFilters_filters_ConfigRuleName != null)
            {
                request.Filters.ConfigRuleName = requestFilters_filters_ConfigRuleName;
                requestFiltersIsNull           = false;
            }
            // determine if request.Filters should be set to null
            if (requestFiltersIsNull)
            {
                request.Filters = 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.Limit.HasValue)
            {
                // The service has a maximum page size of 1000. If the user has
                // asked for more items than page max, and there is no page size
                // configured, we rely on the service ignoring the set maximum
                // and giving us 1000 items back. If a page size is set, that will
                // be used to configure the pagination.
                // We'll make further calls to satisfy the user's request.
                _emitLimit = cmdletContext.Limit;
            }
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));

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

            do
            {
                request.NextToken = _nextToken;
                if (_emitLimit.HasValue)
                {
                    int correctPageSize = Math.Min(1000, _emitLimit.Value);
                    request.Limit = AutoIterationHelpers.ConvertEmitLimitToInt32(correctPageSize);
                }

                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.AggregateComplianceByConfigRules.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 >= 0));


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


            return(null);
        }
Example #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ConfigService.Model.PutExternalEvaluationRequest();

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

            // populate ExternalEvaluation
            var requestExternalEvaluationIsNull = true;

            request.ExternalEvaluation = new Amazon.ConfigService.Model.ExternalEvaluation();
            System.String requestExternalEvaluation_externalEvaluation_Annotation = null;
            if (cmdletContext.ExternalEvaluation_Annotation != null)
            {
                requestExternalEvaluation_externalEvaluation_Annotation = cmdletContext.ExternalEvaluation_Annotation;
            }
            if (requestExternalEvaluation_externalEvaluation_Annotation != null)
            {
                request.ExternalEvaluation.Annotation = requestExternalEvaluation_externalEvaluation_Annotation;
                requestExternalEvaluationIsNull       = false;
            }
            System.String requestExternalEvaluation_externalEvaluation_ComplianceResourceId = null;
            if (cmdletContext.ExternalEvaluation_ComplianceResourceId != null)
            {
                requestExternalEvaluation_externalEvaluation_ComplianceResourceId = cmdletContext.ExternalEvaluation_ComplianceResourceId;
            }
            if (requestExternalEvaluation_externalEvaluation_ComplianceResourceId != null)
            {
                request.ExternalEvaluation.ComplianceResourceId = requestExternalEvaluation_externalEvaluation_ComplianceResourceId;
                requestExternalEvaluationIsNull = false;
            }
            System.String requestExternalEvaluation_externalEvaluation_ComplianceResourceType = null;
            if (cmdletContext.ExternalEvaluation_ComplianceResourceType != null)
            {
                requestExternalEvaluation_externalEvaluation_ComplianceResourceType = cmdletContext.ExternalEvaluation_ComplianceResourceType;
            }
            if (requestExternalEvaluation_externalEvaluation_ComplianceResourceType != null)
            {
                request.ExternalEvaluation.ComplianceResourceType = requestExternalEvaluation_externalEvaluation_ComplianceResourceType;
                requestExternalEvaluationIsNull = false;
            }
            Amazon.ConfigService.ComplianceType requestExternalEvaluation_externalEvaluation_ComplianceType = null;
            if (cmdletContext.ExternalEvaluation_ComplianceType != null)
            {
                requestExternalEvaluation_externalEvaluation_ComplianceType = cmdletContext.ExternalEvaluation_ComplianceType;
            }
            if (requestExternalEvaluation_externalEvaluation_ComplianceType != null)
            {
                request.ExternalEvaluation.ComplianceType = requestExternalEvaluation_externalEvaluation_ComplianceType;
                requestExternalEvaluationIsNull           = false;
            }
            System.DateTime?requestExternalEvaluation_externalEvaluation_OrderingTimestamp = null;
            if (cmdletContext.ExternalEvaluation_OrderingTimestamp != null)
            {
                requestExternalEvaluation_externalEvaluation_OrderingTimestamp = cmdletContext.ExternalEvaluation_OrderingTimestamp.Value;
            }
            if (requestExternalEvaluation_externalEvaluation_OrderingTimestamp != null)
            {
                request.ExternalEvaluation.OrderingTimestamp = requestExternalEvaluation_externalEvaluation_OrderingTimestamp.Value;
                requestExternalEvaluationIsNull = false;
            }
            // determine if request.ExternalEvaluation should be set to null
            if (requestExternalEvaluationIsNull)
            {
                request.ExternalEvaluation = null;
            }

            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);
        }
        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.DescribeAggregateComplianceByConfigRulesRequest();

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

            // populate Filters
            var requestFiltersIsNull = true;

            request.Filters = new Amazon.ConfigService.Model.ConfigRuleComplianceFilters();
            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_AwsRegion = null;
            if (cmdletContext.Filters_AwsRegion != null)
            {
                requestFilters_filters_AwsRegion = cmdletContext.Filters_AwsRegion;
            }
            if (requestFilters_filters_AwsRegion != null)
            {
                request.Filters.AwsRegion = requestFilters_filters_AwsRegion;
                requestFiltersIsNull      = false;
            }
            Amazon.ConfigService.ComplianceType requestFilters_filters_ComplianceType = null;
            if (cmdletContext.Filters_ComplianceType != null)
            {
                requestFilters_filters_ComplianceType = cmdletContext.Filters_ComplianceType;
            }
            if (requestFilters_filters_ComplianceType != null)
            {
                request.Filters.ComplianceType = requestFilters_filters_ComplianceType;
                requestFiltersIsNull           = false;
            }
            System.String requestFilters_filters_ConfigRuleName = null;
            if (cmdletContext.Filters_ConfigRuleName != null)
            {
                requestFilters_filters_ConfigRuleName = cmdletContext.Filters_ConfigRuleName;
            }
            if (requestFilters_filters_ConfigRuleName != null)
            {
                request.Filters.ConfigRuleName = requestFilters_filters_ConfigRuleName;
                requestFiltersIsNull           = false;
            }
            // determine if request.Filters should be set to null
            if (requestFiltersIsNull)
            {
                request.Filters = null;
            }
            if (cmdletContext.Limit != null)
            {
                request.Limit = AutoIterationHelpers.ConvertEmitLimitToServiceTypeInt32(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);
        }