private Amazon.Personalize.Model.CreateDatasetImportJobResponse CallAWSServiceOperation(IAmazonPersonalize client, Amazon.Personalize.Model.CreateDatasetImportJobRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Personalize", "CreateDatasetImportJob");
     try
     {
         #if DESKTOP
         return(client.CreateDatasetImportJob(request));
         #elif CORECLR
         return(client.CreateDatasetImportJobAsync(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.Personalize.Model.CreateDatasetImportJobRequest();

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

            // populate DataSource
            var requestDataSourceIsNull = true;

            request.DataSource = new Amazon.Personalize.Model.DataSource();
            System.String requestDataSource_dataSource_DataLocation = null;
            if (cmdletContext.DataSource_DataLocation != null)
            {
                requestDataSource_dataSource_DataLocation = cmdletContext.DataSource_DataLocation;
            }
            if (requestDataSource_dataSource_DataLocation != null)
            {
                request.DataSource.DataLocation = requestDataSource_dataSource_DataLocation;
                requestDataSourceIsNull         = false;
            }
            // determine if request.DataSource should be set to null
            if (requestDataSourceIsNull)
            {
                request.DataSource = null;
            }
            if (cmdletContext.JobName != null)
            {
                request.JobName = cmdletContext.JobName;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }

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