Exemple #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            Utils.Common.WriteVerboseEndpointMessage(this, Client.Config, "GetJobOutput");

            using (var transferManager = new ArchiveTransferManager(client))
            {
                var runner          = new ProgressRunner(this);
                var downloadOptions = new DownloadOptions
                {
                    AccountId = cmdletContext.AccountId
                };

                var tracker = new DownloadProgressTracker(runner, handler => downloadOptions.StreamTransferProgress += handler, cmdletContext.FilePath);

                var output = runner.SafeRun(() =>
                {
#if DESKTOP
                    transferManager.DownloadJob(cmdletContext.VaultName, cmdletContext.JobId, cmdletContext.FilePath, downloadOptions);
#else
                    transferManager.DownloadJobAsync(cmdletContext.VaultName, cmdletContext.JobId, cmdletContext.FilePath, downloadOptions).Wait();
#endif
                }, tracker);

                return(output);
            }
        }