Example #1
0
 private Amazon.ConfigService.Model.PutConfigurationAggregatorResponse CallAWSServiceOperation(IAmazonConfigService client, Amazon.ConfigService.Model.PutConfigurationAggregatorRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Config", "PutConfigurationAggregator");
     try
     {
         #if DESKTOP
         return(client.PutConfigurationAggregator(request));
         #elif CORECLR
         return(client.PutConfigurationAggregatorAsync(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;
     }
 }
Example #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ConfigService.Model.PutConfigurationAggregatorRequest();

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

            // populate OrganizationAggregationSource
            var requestOrganizationAggregationSourceIsNull = true;

            request.OrganizationAggregationSource = new Amazon.ConfigService.Model.OrganizationAggregationSource();
            System.Boolean?requestOrganizationAggregationSource_organizationAggregationSource_AllAwsRegion = null;
            if (cmdletContext.OrganizationAggregationSource_AllAwsRegion != null)
            {
                requestOrganizationAggregationSource_organizationAggregationSource_AllAwsRegion = cmdletContext.OrganizationAggregationSource_AllAwsRegion.Value;
            }
            if (requestOrganizationAggregationSource_organizationAggregationSource_AllAwsRegion != null)
            {
                request.OrganizationAggregationSource.AllAwsRegions = requestOrganizationAggregationSource_organizationAggregationSource_AllAwsRegion.Value;
                requestOrganizationAggregationSourceIsNull          = false;
            }
            List <System.String> requestOrganizationAggregationSource_organizationAggregationSource_AwsRegion = null;

            if (cmdletContext.OrganizationAggregationSource_AwsRegion != null)
            {
                requestOrganizationAggregationSource_organizationAggregationSource_AwsRegion = cmdletContext.OrganizationAggregationSource_AwsRegion;
            }
            if (requestOrganizationAggregationSource_organizationAggregationSource_AwsRegion != null)
            {
                request.OrganizationAggregationSource.AwsRegions = requestOrganizationAggregationSource_organizationAggregationSource_AwsRegion;
                requestOrganizationAggregationSourceIsNull       = false;
            }
            System.String requestOrganizationAggregationSource_organizationAggregationSource_RoleArn = null;
            if (cmdletContext.OrganizationAggregationSource_RoleArn != null)
            {
                requestOrganizationAggregationSource_organizationAggregationSource_RoleArn = cmdletContext.OrganizationAggregationSource_RoleArn;
            }
            if (requestOrganizationAggregationSource_organizationAggregationSource_RoleArn != null)
            {
                request.OrganizationAggregationSource.RoleArn = requestOrganizationAggregationSource_organizationAggregationSource_RoleArn;
                requestOrganizationAggregationSourceIsNull    = false;
            }
            // determine if request.OrganizationAggregationSource should be set to null
            if (requestOrganizationAggregationSourceIsNull)
            {
                request.OrganizationAggregationSource = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }