public async Task Upload(string uri, string id, byte[] payload, LogsContentEncoding logsContentEncoding, LogsContentType logsContentType) { Preconditions.CheckNonWhiteSpace(uri, nameof(uri)); Preconditions.CheckNonWhiteSpace(id, nameof(id)); Preconditions.CheckNotNull(payload, nameof(payload)); try { var containerUri = new Uri(uri); string blobName = this.GetBlobName(id, logsContentEncoding, logsContentType); var container = new CloudBlobContainer(containerUri); Events.Uploading(blobName, container.Name); await ExecuteWithRetry( () => { IAzureBlob blob = this.azureBlobUploader.GetBlob(containerUri, blobName); SetContentEncoding(blob, logsContentEncoding); SetContentType(blob, logsContentType); return(blob.UploadFromByteArrayAsync(payload)); }, r => Events.UploadErrorRetrying(blobName, container.Name, r)); Events.UploadSuccess(blobName, container.Name); } catch (Exception e) { Events.UploadError(e, id); throw; } }
public async Task UploadSupportBundle(string uri, Stream source) { Preconditions.CheckNonWhiteSpace(uri, nameof(uri)); Preconditions.CheckNotNull(source, nameof(source)); try { var containerUri = new Uri(uri); string blobName = this.GetBlobName("support-bundle", "zip"); var container = new CloudBlobContainer(containerUri); Events.Uploading(blobName, container.Name); await ExecuteWithRetry( () => { IAzureBlob blob = this.azureBlobUploader.GetBlob(containerUri, blobName, Option.Some("application/zip"), Option.Some("zip")); return(blob.UploadFromStreamAsync(source)); }, r => Events.UploadErrorRetrying(blobName, container.Name, r)); Events.UploadSuccess(blobName, container.Name); } catch (Exception e) { Events.UploadError(e, "support-bundle"); throw; } }
public BlockRepository() { var connectionString = AppSettings.AzureStorageConnectionString; _blockTable = new AzureTableStorage <BlockEntity>(connectionString, TableName, null); _blobStorage = new AzureBlobStorage(connectionString); _importedMap = new Dictionary <string, bool>(); }
protected AzureBlobFolder(IAzureBlob parent, string containerName, Uri folderUri) : base(parent, containerName, folderUri) { if (folderUri == null) { throw new ArgumentNullException(nameof(folderUri)); } _folder = null; }
public AzureBlobFolder(IAzureBlob parent, string name, CloudBlobDirectory folder) : base(parent, name, folder.Uri) { if (folder == null) { throw new ArgumentNullException(nameof(folder)); } _folder = folder; }
static void SetContentEncoding(IAzureBlob blob, LogsContentEncoding logsContentEncoding) { switch (logsContentEncoding) { case LogsContentEncoding.Gzip: blob.BlobProperties.ContentEncoding = "gzip"; break; } }
public EventsModel(ApiClient apiClient, IMapper mapper, IAzureBlob azureBlob, IFileValidate fileValidate, IAzureSASTokenUrl azureSASTokenUrl, ILogger <EventsModel> logger) { _apiClient = apiClient; _mapper = mapper; _azureBlob = azureBlob; _fileValidate = fileValidate; _azureSASTokenUrl = azureSASTokenUrl; _logger = logger; }
AzureBlobAccount(IAzureBlob parent, string accountName, CloudBlobClient client) : base(parent, accountName, client.BaseUri) { if (client == null) { throw new ArgumentNullException(nameof(client)); } _client = client; }
private static void InitializeAzureBlob() { Log.Info("Initializing AzureBlob"); Log.Info("Reading blob storage connection string from config"); string connectionString = CloudConfigurationManager.GetSetting("EarnStorageConnectionString"); IRetryPolicy retryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(6), 4); _azureBlob = new AzureBlob(connectionString, retryPolicy); Log.Info("Initialized AzureBlob"); }
static void SetContentType(IAzureBlob blob, LogsContentType logsContentType) { switch (logsContentType) { case LogsContentType.Json: blob.BlobProperties.ContentType = "application/json"; break; case LogsContentType.Text: blob.BlobProperties.ContentType = "text/plain"; break; } }
public AzureBlobRef(IAzureBlob parent, string name, Uri uri) { if (parent == null) { throw new ArgumentNullException(nameof(parent)); } EnsureValidName(name); Path = $"{parent.Path}/{name}"; Name = name; Uri = uri; }
public BoardMeetingsModel(ApiClient apiClient, IMapper mapper, IAzureSASTokenUrl azureSASTokenUrl, IAzureBlob azureBlob, IFileValidate fileValidate, ILogger <BoardMeetingsModel> logger) { _apiClient = apiClient; _mapper = mapper; _azureSASTokenUrl = azureSASTokenUrl; _azureBlob = azureBlob; _fileValidate = fileValidate; _logger = logger; //need to initialize an empty object because by default the property is null //within the view, when you try and access the objects underlying properties, razor will throw an error //because the property has not been initialized MeetingToCreateEdit = new BoardMeetingManipulationDto(); FileUploaded = new RequiredFileDto(); }
public AssetsOwnersRepository(IAzureTableStorage <AssetsOwnersEntity> tableStorage, IAzureBlob azureBlob) { _tableStorage = tableStorage; _azureBlob = azureBlob; }
public AzureBlobContainer(IAzureBlob parent, string name, CloudBlobContainer container) : base(parent, name, container.Uri) { _container = container; }
public Task UploadBlob(IAzureBlob blob, byte[] bytes) => blob.UploadFromByteArrayAsync(bytes);
public AzureBlobFileGeneric(IAzureBlob parent, string name, Uri uri) : base(parent, name, uri) { }
public ProvisionRewardNetworkVisaMids(IAzureBlob azureBlob) { this.azureBlob = azureBlob; }
public HomeController(IAzureBlob azureBlob) { this.azureBlob = azureBlob; }
public AzureBlobFileBlock(IAzureBlob parent, string name, CloudBlockBlob blob) : base(parent, name, blob.Uri) { _blob = blob; }
public AzureSASTokenUrl(IAzureBlob getAzureFile) { _getAzureFile = getAzureFile; }
public AzureBlobAccount(IAzureBlob parent, string accountName, string connectionString) : this(parent, accountName, GetClient(connectionString)) { }
public ProvisionAmexMids(IAzureBlob azureBlob) { this.azureBlob = azureBlob; }
public ProjectFileRepository(IAzureBlob blobStorage) { _blobStorage = blobStorage; }
public FileValidate(IAzureBlob azureBlob) { _azureBlob = azureBlob; }
public MeetingMinuteListAllViewComponent(IAzureBlob azureBlob) { _azureBlob = azureBlob; }
public BlockRepository(IAzureTableStorage <BlockNinjaEntity> tableStorage, IAzureBlob azureBlob) { _tableStorage = tableStorage; _azureBlob = azureBlob; }
public BlobController(IAzureBlob blob) { this.blob = blob; }
public ProvisionMerchantsFromMasterCard(IAzureBlob azureBlob) { this.azureBlob = azureBlob; }
public ProvisionMasterCardMids(IAzureBlob azureBlob, AzureScheduler azureScheduler = null, SchedulerQueueInfo schedulerQueueInfo = null) { this.azureBlob = azureBlob; this.azureScheduler = azureScheduler; this.schedulerQueueInfo = schedulerQueueInfo; }