public static VhdDownloadContext Download(DownloaderParameters downloadParameters, ComputeClientBaseCmdlet cmdlet) { Program.SyncOutput = new PSSyncOutputEvents(cmdlet); downloadParameters.ProgressDownloadComplete = Program.SyncOutput.ProgressDownloadComplete; downloadParameters.ProgressDownloadStatus = Program.SyncOutput.ProgressDownloadStatus; var downloader = new Downloader(downloadParameters); downloader.Download(); return new VhdDownloadContext { LocalFilePath = new FileInfo(downloadParameters.LocalFilePath), Source = downloadParameters.BlobUri.Uri }; }
private VhdDownloadContext DownloadFromBlobUri( ComputeClientBaseCmdlet cmdlet, Uri sourceUri, FileInfo localFileInfo, string storagekey, string resourceGroupName, int numThreads, bool overwrite) { BlobUri blobUri; if (!BlobUri.TryParseUri(sourceUri, out blobUri)) { throw new ArgumentOutOfRangeException("Source", sourceUri.ToString()); } if (storagekey == null) { var storageClient = AzureSession.Instance.ClientFactory.CreateArmClient <StorageManagementClient>( DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager); var storageService = storageClient.StorageAccounts.GetProperties(resourceGroupName, blobUri.StorageAccountName); if (storageService != null) { var storageKeys = storageClient.StorageAccounts.ListKeys(resourceGroupName, storageService.Name); storagekey = storageKeys.GetKey1(); } } var downloaderParameters = new DownloaderParameters { BlobUri = blobUri, LocalFilePath = localFileInfo.FullName, ConnectionLimit = numThreads, StorageAccountKey = storagekey, ValidateFreeDiskSpace = true, OverWrite = overwrite }; return(VhdDownloaderModel.Download(downloaderParameters, cmdlet)); }
public static VhdDownloadContext Download(DownloaderParameters downloadParameters, ComputeClientBaseCmdlet cmdlet) { Program.SyncOutput = new PSSyncOutputEvents(cmdlet); downloadParameters.ProgressDownloadComplete = Program.SyncOutput.ProgressDownloadComplete; downloadParameters.ProgressDownloadStatus = Program.SyncOutput.ProgressDownloadStatus; var downloader = new Downloader(downloadParameters); downloader.Download(); return(new VhdDownloadContext { LocalFilePath = new FileInfo(downloadParameters.LocalFilePath), Source = downloadParameters.BlobUri.Uri }); }
private VhdDownloadContext DownloadFromBlobUri( ComputeClientBaseCmdlet cmdlet, Uri sourceUri, FileInfo localFileInfo, string storagekey, string resourceGroupName, int numThreads, bool overwrite) { BlobUri blobUri; if (!BlobUri.TryParseUri(sourceUri, out blobUri)) { throw new ArgumentOutOfRangeException("Source", sourceUri.ToString()); } if (storagekey == null) { var storageClient = AzureSession.ClientFactory.CreateClient<StorageManagementClient>( DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager); var storageService = storageClient.StorageAccounts.GetProperties(resourceGroupName, blobUri.StorageAccountName); if (storageService != null) { var storageKeys = storageClient.StorageAccounts.ListKeys(resourceGroupName, storageService.StorageAccount.Name); storagekey = storageKeys.StorageAccountKeys.Key1; } } var downloaderParameters = new DownloaderParameters { BlobUri = blobUri, LocalFilePath = localFileInfo.FullName, ConnectionLimit = numThreads, StorageAccountKey = storagekey, ValidateFreeDiskSpace = true, OverWrite = overwrite }; return VhdDownloaderModel.Download(downloaderParameters, cmdlet); }