private Amazon.EC2.Model.CreateFpgaImageResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateFpgaImageRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateFpgaImage");
     try
     {
         #if DESKTOP
         return(client.CreateFpgaImage(request));
         #elif CORECLR
         return(client.CreateFpgaImageAsync(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;
     }
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.CreateFpgaImageRequest();

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

            // populate InputStorageLocation
            var requestInputStorageLocationIsNull = true;

            request.InputStorageLocation = new Amazon.EC2.Model.StorageLocation();
            System.String requestInputStorageLocation_inputStorageLocation_Bucket = null;
            if (cmdletContext.InputStorageLocation_Bucket != null)
            {
                requestInputStorageLocation_inputStorageLocation_Bucket = cmdletContext.InputStorageLocation_Bucket;
            }
            if (requestInputStorageLocation_inputStorageLocation_Bucket != null)
            {
                request.InputStorageLocation.Bucket = requestInputStorageLocation_inputStorageLocation_Bucket;
                requestInputStorageLocationIsNull   = false;
            }
            System.String requestInputStorageLocation_inputStorageLocation_Key = null;
            if (cmdletContext.InputStorageLocation_Key != null)
            {
                requestInputStorageLocation_inputStorageLocation_Key = cmdletContext.InputStorageLocation_Key;
            }
            if (requestInputStorageLocation_inputStorageLocation_Key != null)
            {
                request.InputStorageLocation.Key  = requestInputStorageLocation_inputStorageLocation_Key;
                requestInputStorageLocationIsNull = false;
            }
            // determine if request.InputStorageLocation should be set to null
            if (requestInputStorageLocationIsNull)
            {
                request.InputStorageLocation = null;
            }

            // populate LogsStorageLocation
            var requestLogsStorageLocationIsNull = true;

            request.LogsStorageLocation = new Amazon.EC2.Model.StorageLocation();
            System.String requestLogsStorageLocation_logsStorageLocation_Bucket = null;
            if (cmdletContext.LogsStorageLocation_Bucket != null)
            {
                requestLogsStorageLocation_logsStorageLocation_Bucket = cmdletContext.LogsStorageLocation_Bucket;
            }
            if (requestLogsStorageLocation_logsStorageLocation_Bucket != null)
            {
                request.LogsStorageLocation.Bucket = requestLogsStorageLocation_logsStorageLocation_Bucket;
                requestLogsStorageLocationIsNull   = false;
            }
            System.String requestLogsStorageLocation_logsStorageLocation_Key = null;
            if (cmdletContext.LogsStorageLocation_Key != null)
            {
                requestLogsStorageLocation_logsStorageLocation_Key = cmdletContext.LogsStorageLocation_Key;
            }
            if (requestLogsStorageLocation_logsStorageLocation_Key != null)
            {
                request.LogsStorageLocation.Key  = requestLogsStorageLocation_logsStorageLocation_Key;
                requestLogsStorageLocationIsNull = false;
            }
            // determine if request.LogsStorageLocation should be set to null
            if (requestLogsStorageLocationIsNull)
            {
                request.LogsStorageLocation = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.TagSpecification != null)
            {
                request.TagSpecifications = cmdletContext.TagSpecification;
            }

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