Constants used for properties of type ResourceType.
Inheritance: ConstantClass
        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);
        }
Exemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ConfigService.Model.GetAggregateResourceConfigRequest();

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

            // populate ResourceIdentifier
            var requestResourceIdentifierIsNull = true;

            request.ResourceIdentifier = new Amazon.ConfigService.Model.AggregateResourceIdentifier();
            System.String requestResourceIdentifier_resourceIdentifier_ResourceId = null;
            if (cmdletContext.ResourceIdentifier_ResourceId != null)
            {
                requestResourceIdentifier_resourceIdentifier_ResourceId = cmdletContext.ResourceIdentifier_ResourceId;
            }
            if (requestResourceIdentifier_resourceIdentifier_ResourceId != null)
            {
                request.ResourceIdentifier.ResourceId = requestResourceIdentifier_resourceIdentifier_ResourceId;
                requestResourceIdentifierIsNull       = false;
            }
            System.String requestResourceIdentifier_resourceIdentifier_ResourceName = null;
            if (cmdletContext.ResourceIdentifier_ResourceName != null)
            {
                requestResourceIdentifier_resourceIdentifier_ResourceName = cmdletContext.ResourceIdentifier_ResourceName;
            }
            if (requestResourceIdentifier_resourceIdentifier_ResourceName != null)
            {
                request.ResourceIdentifier.ResourceName = requestResourceIdentifier_resourceIdentifier_ResourceName;
                requestResourceIdentifierIsNull         = false;
            }
            Amazon.ConfigService.ResourceType requestResourceIdentifier_resourceIdentifier_ResourceType = null;
            if (cmdletContext.ResourceIdentifier_ResourceType != null)
            {
                requestResourceIdentifier_resourceIdentifier_ResourceType = cmdletContext.ResourceIdentifier_ResourceType;
            }
            if (requestResourceIdentifier_resourceIdentifier_ResourceType != null)
            {
                request.ResourceIdentifier.ResourceType = requestResourceIdentifier_resourceIdentifier_ResourceType;
                requestResourceIdentifierIsNull         = false;
            }
            System.String requestResourceIdentifier_resourceIdentifier_SourceAccountId = null;
            if (cmdletContext.ResourceIdentifier_SourceAccountId != null)
            {
                requestResourceIdentifier_resourceIdentifier_SourceAccountId = cmdletContext.ResourceIdentifier_SourceAccountId;
            }
            if (requestResourceIdentifier_resourceIdentifier_SourceAccountId != null)
            {
                request.ResourceIdentifier.SourceAccountId = requestResourceIdentifier_resourceIdentifier_SourceAccountId;
                requestResourceIdentifierIsNull            = false;
            }
            System.String requestResourceIdentifier_resourceIdentifier_SourceRegion = null;
            if (cmdletContext.ResourceIdentifier_SourceRegion != null)
            {
                requestResourceIdentifier_resourceIdentifier_SourceRegion = cmdletContext.ResourceIdentifier_SourceRegion;
            }
            if (requestResourceIdentifier_resourceIdentifier_SourceRegion != null)
            {
                request.ResourceIdentifier.SourceRegion = requestResourceIdentifier_resourceIdentifier_SourceRegion;
                requestResourceIdentifierIsNull         = false;
            }
            // determine if request.ResourceIdentifier should be set to null
            if (requestResourceIdentifierIsNull)
            {
                request.ResourceIdentifier = 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.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);
        }