Esempio n. 1
0
 private Amazon.ConfigService.Model.GetAggregateResourceConfigResponse CallAWSServiceOperation(IAmazonConfigService client, Amazon.ConfigService.Model.GetAggregateResourceConfigRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Config", "GetAggregateResourceConfig");
     try
     {
         #if DESKTOP
         return(client.GetAggregateResourceConfig(request));
         #elif CORECLR
         return(client.GetAggregateResourceConfigAsync(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;
     }
 }
Esempio 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);
        }