private Amazon.AppStream.Model.CreateApplicationResponse CallAWSServiceOperation(IAmazonAppStream client, Amazon.AppStream.Model.CreateApplicationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon AppStream", "CreateApplication");
     try
     {
         #if DESKTOP
         return(client.CreateApplication(request));
         #elif CORECLR
         return(client.CreateApplicationAsync(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.AppStream.Model.CreateApplicationRequest();

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

            // populate IconS3Location
            var requestIconS3LocationIsNull = true;

            request.IconS3Location = new Amazon.AppStream.Model.S3Location();
            System.String requestIconS3Location_iconS3Location_S3Bucket = null;
            if (cmdletContext.IconS3Location_S3Bucket != null)
            {
                requestIconS3Location_iconS3Location_S3Bucket = cmdletContext.IconS3Location_S3Bucket;
            }
            if (requestIconS3Location_iconS3Location_S3Bucket != null)
            {
                request.IconS3Location.S3Bucket = requestIconS3Location_iconS3Location_S3Bucket;
                requestIconS3LocationIsNull     = false;
            }
            System.String requestIconS3Location_iconS3Location_S3Key = null;
            if (cmdletContext.IconS3Location_S3Key != null)
            {
                requestIconS3Location_iconS3Location_S3Key = cmdletContext.IconS3Location_S3Key;
            }
            if (requestIconS3Location_iconS3Location_S3Key != null)
            {
                request.IconS3Location.S3Key = requestIconS3Location_iconS3Location_S3Key;
                requestIconS3LocationIsNull  = false;
            }
            // determine if request.IconS3Location should be set to null
            if (requestIconS3LocationIsNull)
            {
                request.IconS3Location = null;
            }
            if (cmdletContext.InstanceFamily != null)
            {
                request.InstanceFamilies = cmdletContext.InstanceFamily;
            }
            if (cmdletContext.LaunchParameter != null)
            {
                request.LaunchParameters = cmdletContext.LaunchParameter;
            }
            if (cmdletContext.LaunchPath != null)
            {
                request.LaunchPath = cmdletContext.LaunchPath;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.Platform != null)
            {
                request.Platforms = cmdletContext.Platform;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.WorkingDirectory != null)
            {
                request.WorkingDirectory = cmdletContext.WorkingDirectory;
            }

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