private Amazon.GameLift.Model.UpdateScriptResponse CallAWSServiceOperation(IAmazonGameLift client, Amazon.GameLift.Model.UpdateScriptRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon GameLift Service", "UpdateScript");
     try
     {
         #if DESKTOP
         return(client.UpdateScript(request));
         #elif CORECLR
         return(client.UpdateScriptAsync(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)
        {
            System.IO.MemoryStream _ZipFileStream = null;

            try
            {
                var cmdletContext = context as CmdletContext;
                // create request
                var request = new Amazon.GameLift.Model.UpdateScriptRequest();

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

                // populate StorageLocation
                var requestStorageLocationIsNull = true;
                request.StorageLocation = new Amazon.GameLift.Model.S3Location();
                System.String requestStorageLocation_storageLocation_Bucket = null;
                if (cmdletContext.StorageLocation_Bucket != null)
                {
                    requestStorageLocation_storageLocation_Bucket = cmdletContext.StorageLocation_Bucket;
                }
                if (requestStorageLocation_storageLocation_Bucket != null)
                {
                    request.StorageLocation.Bucket = requestStorageLocation_storageLocation_Bucket;
                    requestStorageLocationIsNull   = false;
                }
                System.String requestStorageLocation_storageLocation_Key = null;
                if (cmdletContext.StorageLocation_Key != null)
                {
                    requestStorageLocation_storageLocation_Key = cmdletContext.StorageLocation_Key;
                }
                if (requestStorageLocation_storageLocation_Key != null)
                {
                    request.StorageLocation.Key  = requestStorageLocation_storageLocation_Key;
                    requestStorageLocationIsNull = false;
                }
                System.String requestStorageLocation_storageLocation_ObjectVersion = null;
                if (cmdletContext.StorageLocation_ObjectVersion != null)
                {
                    requestStorageLocation_storageLocation_ObjectVersion = cmdletContext.StorageLocation_ObjectVersion;
                }
                if (requestStorageLocation_storageLocation_ObjectVersion != null)
                {
                    request.StorageLocation.ObjectVersion = requestStorageLocation_storageLocation_ObjectVersion;
                    requestStorageLocationIsNull          = false;
                }
                System.String requestStorageLocation_storageLocation_RoleArn = null;
                if (cmdletContext.StorageLocation_RoleArn != null)
                {
                    requestStorageLocation_storageLocation_RoleArn = cmdletContext.StorageLocation_RoleArn;
                }
                if (requestStorageLocation_storageLocation_RoleArn != null)
                {
                    request.StorageLocation.RoleArn = requestStorageLocation_storageLocation_RoleArn;
                    requestStorageLocationIsNull    = false;
                }
                // determine if request.StorageLocation should be set to null
                if (requestStorageLocationIsNull)
                {
                    request.StorageLocation = null;
                }
                if (cmdletContext.Version != null)
                {
                    request.Version = cmdletContext.Version;
                }
                if (cmdletContext.ZipFile != null)
                {
                    _ZipFileStream  = new System.IO.MemoryStream(cmdletContext.ZipFile);
                    request.ZipFile = _ZipFileStream;
                }

                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);
            }
            finally
            {
                if (_ZipFileStream != null)
                {
                    _ZipFileStream.Dispose();
                }
            }
        }