private Amazon.Athena.Model.StartQueryExecutionResponse CallAWSServiceOperation(IAmazonAthena client, Amazon.Athena.Model.StartQueryExecutionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Athena", "StartQueryExecution");
     try
     {
         #if DESKTOP
         return(client.StartQueryExecution(request));
         #elif CORECLR
         return(client.StartQueryExecutionAsync(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.Athena.Model.StartQueryExecutionRequest();

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

            // populate QueryExecutionContext
            var requestQueryExecutionContextIsNull = true;

            request.QueryExecutionContext = new Amazon.Athena.Model.QueryExecutionContext();
            System.String requestQueryExecutionContext_queryExecutionContext_Catalog = null;
            if (cmdletContext.QueryExecutionContext_Catalog != null)
            {
                requestQueryExecutionContext_queryExecutionContext_Catalog = cmdletContext.QueryExecutionContext_Catalog;
            }
            if (requestQueryExecutionContext_queryExecutionContext_Catalog != null)
            {
                request.QueryExecutionContext.Catalog = requestQueryExecutionContext_queryExecutionContext_Catalog;
                requestQueryExecutionContextIsNull    = false;
            }
            System.String requestQueryExecutionContext_queryExecutionContext_Database = null;
            if (cmdletContext.QueryExecutionContext_Database != null)
            {
                requestQueryExecutionContext_queryExecutionContext_Database = cmdletContext.QueryExecutionContext_Database;
            }
            if (requestQueryExecutionContext_queryExecutionContext_Database != null)
            {
                request.QueryExecutionContext.Database = requestQueryExecutionContext_queryExecutionContext_Database;
                requestQueryExecutionContextIsNull     = false;
            }
            // determine if request.QueryExecutionContext should be set to null
            if (requestQueryExecutionContextIsNull)
            {
                request.QueryExecutionContext = null;
            }
            if (cmdletContext.QueryString != null)
            {
                request.QueryString = cmdletContext.QueryString;
            }

            // populate ResultConfiguration
            var requestResultConfigurationIsNull = true;

            request.ResultConfiguration = new Amazon.Athena.Model.ResultConfiguration();
            System.String requestResultConfiguration_resultConfiguration_OutputLocation = null;
            if (cmdletContext.ResultConfiguration_OutputLocation != null)
            {
                requestResultConfiguration_resultConfiguration_OutputLocation = cmdletContext.ResultConfiguration_OutputLocation;
            }
            if (requestResultConfiguration_resultConfiguration_OutputLocation != null)
            {
                request.ResultConfiguration.OutputLocation = requestResultConfiguration_resultConfiguration_OutputLocation;
                requestResultConfigurationIsNull           = false;
            }
            Amazon.Athena.Model.EncryptionConfiguration requestResultConfiguration_resultConfiguration_EncryptionConfiguration = null;

            // populate EncryptionConfiguration
            var requestResultConfiguration_resultConfiguration_EncryptionConfigurationIsNull = true;

            requestResultConfiguration_resultConfiguration_EncryptionConfiguration = new Amazon.Athena.Model.EncryptionConfiguration();
            Amazon.Athena.EncryptionOption requestResultConfiguration_resultConfiguration_EncryptionConfiguration_encryptionConfiguration_EncryptionOption = null;
            if (cmdletContext.EncryptionConfiguration_EncryptionOption != null)
            {
                requestResultConfiguration_resultConfiguration_EncryptionConfiguration_encryptionConfiguration_EncryptionOption = cmdletContext.EncryptionConfiguration_EncryptionOption;
            }
            if (requestResultConfiguration_resultConfiguration_EncryptionConfiguration_encryptionConfiguration_EncryptionOption != null)
            {
                requestResultConfiguration_resultConfiguration_EncryptionConfiguration.EncryptionOption = requestResultConfiguration_resultConfiguration_EncryptionConfiguration_encryptionConfiguration_EncryptionOption;
                requestResultConfiguration_resultConfiguration_EncryptionConfigurationIsNull            = false;
            }
            System.String requestResultConfiguration_resultConfiguration_EncryptionConfiguration_encryptionConfiguration_KmsKey = null;
            if (cmdletContext.EncryptionConfiguration_KmsKey != null)
            {
                requestResultConfiguration_resultConfiguration_EncryptionConfiguration_encryptionConfiguration_KmsKey = cmdletContext.EncryptionConfiguration_KmsKey;
            }
            if (requestResultConfiguration_resultConfiguration_EncryptionConfiguration_encryptionConfiguration_KmsKey != null)
            {
                requestResultConfiguration_resultConfiguration_EncryptionConfiguration.KmsKey = requestResultConfiguration_resultConfiguration_EncryptionConfiguration_encryptionConfiguration_KmsKey;
                requestResultConfiguration_resultConfiguration_EncryptionConfigurationIsNull  = false;
            }
            // determine if requestResultConfiguration_resultConfiguration_EncryptionConfiguration should be set to null
            if (requestResultConfiguration_resultConfiguration_EncryptionConfigurationIsNull)
            {
                requestResultConfiguration_resultConfiguration_EncryptionConfiguration = null;
            }
            if (requestResultConfiguration_resultConfiguration_EncryptionConfiguration != null)
            {
                request.ResultConfiguration.EncryptionConfiguration = requestResultConfiguration_resultConfiguration_EncryptionConfiguration;
                requestResultConfigurationIsNull = false;
            }
            // determine if request.ResultConfiguration should be set to null
            if (requestResultConfigurationIsNull)
            {
                request.ResultConfiguration = null;
            }
            if (cmdletContext.WorkGroup != null)
            {
                request.WorkGroup = cmdletContext.WorkGroup;
            }

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