private async Task <IStorageBlobResultSegment> ListBlobsSegmentedAsyncCore(Task <BlobResultSegment> sdkTask) { BlobResultSegment sdkSegment = await sdkTask; if (sdkSegment == null) { return(null); } IEnumerable <IListBlobItem> sdkResults = sdkSegment.Results; List <IStorageListBlobItem> results; if (sdkResults != null) { results = new List <IStorageListBlobItem>(); foreach (IListBlobItem sdkResult in sdkResults) { CloudBlobContainer sdkContainer = sdkResult.Container; Debug.Assert(sdkContainer != null); IStorageBlobContainer container = new StorageBlobContainer(this, sdkContainer); IStorageListBlobItem result = StorageBlobContainer.ToStorageListBlobItem(container, sdkResult); results.Add(result); } } else { results = null; } return(new StorageBlobResultSegment(sdkSegment.ContinuationToken, results)); }
public IStorageBlob Convert(ICloudBlob input) { if (input == null) { return(null); } CloudBlobClient sdkClient = input.ServiceClient; Debug.Assert(sdkClient != null); IStorageBlobClient client = new StorageBlobClient(sdkClient); CloudBlobContainer sdkContainer = input.Container; Debug.Assert(sdkContainer != null); IStorageBlobContainer container = new StorageBlobContainer(client, sdkContainer); CloudBlockBlob blockBlob = input as CloudBlockBlob; if (blockBlob != null) { return(new StorageBlockBlob(container, blockBlob)); } else { return(new StoragePageBlob(container, (CloudPageBlob)input)); } }
/* * If ContinueOnError argument is 'true', return the exception else nope. */ private void DeleteBlobFromAzureStorage(CodeActivityContext context) { try { AzureParamHelper azureStorageHelper = new AzureParamHelper(StorageConnectionString.Get(context), StorageBlobContainer.Get(context)); IsDeleted.Set(context, AzureHelper.DeleteBlobFromAzureStorage(BlobReference.Get(context))); } catch (Exception ex) { if (Convert.ToBoolean((int)ContinueOnError)) { } else { throw ex; } } }
/* * If ContinueOnError argument is 'true', return the exception else nope. */ private void CrateContainerInAzureStorage(CodeActivityContext context) { try { AzureParamHelper azureStorageHelper = new AzureParamHelper(StorageConnectionString.Get(context), StorageBlobContainer.Get(context)); IsContainerCreated.Set(context, AzureHelper.CrateContainerInAzureStorage()); } catch (Exception ex) { if (Convert.ToBoolean((int)ContinueOnError)) { } else { throw ex; } } }
/* * If ContinueOnError argument is 'true', return the exception else nope. * useFlatBlobListing is true to ensure loading all files in virtual blob sub-folders as a plain list */ private void GetBlobNamesFromAzureStorage(CodeActivityContext context) { try { AzureParamHelper azureStorageHelper = new AzureParamHelper(StorageConnectionString.Get(context), StorageBlobContainer.Get(context)); BlobNameList.Set(context, AzureHelper.GetBlobNamesFromAzureStorage(Convert.ToBoolean((int)IsIncludedSubfolder))); } catch (Exception ex) { if (Convert.ToBoolean((int)ContinueOnError)) { } else { throw ex; } } }
public SasContainer( CloudBlobContainer container, ILogger logger) : base(logger) { _container = new StorageBlobContainer(null, container); }
/* * If ContinueOnError argument is 'true', return the exception else nope. * Used storage space size will return in bytes */ private void GetUsedSpaceOfAzureStorage(CodeActivityContext context) { try { AzureParamHelper azureStorageHelper = new AzureParamHelper(StorageConnectionString.Get(context), StorageBlobContainer.Get(context)); UsedSpace.Set(context, AzureHelper.GetUsedSpaceOfAzureStorage(FileExtension.Get(context))); } catch (Exception ex) { if (Convert.ToBoolean((int)ContinueOnError)) { } else { throw ex; } } }
/* * If ContinueOnError argument is 'true', return the exception else nope. */ private void UploadToAzureStorage(CodeActivityContext context) { try { AzureParamHelper azureStorageHelper = new AzureParamHelper(StorageConnectionString.Get(context), StorageBlobContainer.Get(context)); BlobUri.Set(context, AzureHelper.UploadToAzureStorage(SourceFile.Get(context), BlobReference.Get(context), Convert.ToBoolean((int)DeleteSourceAfterUpload))); } catch (Exception ex) { if (Convert.ToBoolean((int)ContinueOnError)) { } else { throw ex; } } }
private async Task<IStorageBlobResultSegment> ListBlobsSegmentedAsyncCore(Task<BlobResultSegment> sdkTask) { BlobResultSegment sdkSegment = await sdkTask; if (sdkSegment == null) { return null; } IEnumerable<IListBlobItem> sdkResults = sdkSegment.Results; List<IStorageListBlobItem> results; if (sdkResults != null) { results = new List<IStorageListBlobItem>(); foreach (IListBlobItem sdkResult in sdkResults) { CloudBlobContainer sdkContainer = sdkResult.Container; Debug.Assert(sdkContainer != null); IStorageBlobContainer container = new StorageBlobContainer(this, sdkContainer); IStorageListBlobItem result = StorageBlobContainer.ToStorageListBlobItem(container, sdkResult); results.Add(result); } } else { results = null; } return new StorageBlobResultSegment(sdkSegment.ContinuationToken, results); }