コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        public BlockRepository()
        {
            var connectionString = AppSettings.AzureStorageConnectionString;

            _blockTable  = new AzureTableStorage <BlockEntity>(connectionString, TableName, null);
            _blobStorage = new AzureBlobStorage(connectionString);
            _importedMap = new Dictionary <string, bool>();
        }
コード例 #4
0
        protected AzureBlobFolder(IAzureBlob parent, string containerName, Uri folderUri) : base(parent, containerName, folderUri)
        {
            if (folderUri == null)
            {
                throw new ArgumentNullException(nameof(folderUri));
            }

            _folder = null;
        }
コード例 #5
0
        public AzureBlobFolder(IAzureBlob parent, string name, CloudBlobDirectory folder) : base(parent, name, folder.Uri)
        {
            if (folder == null)
            {
                throw new ArgumentNullException(nameof(folder));
            }

            _folder = folder;
        }
コード例 #6
0
 static void SetContentEncoding(IAzureBlob blob, LogsContentEncoding logsContentEncoding)
 {
     switch (logsContentEncoding)
     {
     case LogsContentEncoding.Gzip:
         blob.BlobProperties.ContentEncoding = "gzip";
         break;
     }
 }
コード例 #7
0
ファイル: Events.cshtml.cs プロジェクト: vrao1020/netcorehoa
 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;
 }
コード例 #8
0
        AzureBlobAccount(IAzureBlob parent, string accountName, CloudBlobClient client)
            : base(parent, accountName, client.BaseUri)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            _client = client;
        }
コード例 #9
0
ファイル: JobManager.cs プロジェクト: BOONRewardsInc/rewards
        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");
        }
コード例 #10
0
        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;
            }
        }
コード例 #11
0
        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;
        }
コード例 #12
0
 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();
 }
コード例 #13
0
 public AssetsOwnersRepository(IAzureTableStorage <AssetsOwnersEntity> tableStorage, IAzureBlob azureBlob)
 {
     _tableStorage = tableStorage;
     _azureBlob    = azureBlob;
 }
コード例 #14
0
 public AzureBlobContainer(IAzureBlob parent, string name, CloudBlobContainer container) : base(parent, name, container.Uri)
 {
     _container = container;
 }
コード例 #15
0
 public Task UploadBlob(IAzureBlob blob, byte[] bytes) => blob.UploadFromByteArrayAsync(bytes);
コード例 #16
0
 public AzureBlobFileGeneric(IAzureBlob parent, string name, Uri uri) : base(parent, name, uri)
 {
 }
コード例 #17
0
 public ProvisionRewardNetworkVisaMids(IAzureBlob azureBlob)
 {
     this.azureBlob = azureBlob;
 }
コード例 #18
0
 public HomeController(IAzureBlob azureBlob)
 {
     this.azureBlob = azureBlob;
 }
コード例 #19
0
 public AzureBlobFileBlock(IAzureBlob parent, string name, CloudBlockBlob blob) : base(parent, name, blob.Uri)
 {
     _blob = blob;
 }
コード例 #20
0
 public AzureSASTokenUrl(IAzureBlob getAzureFile)
 {
     _getAzureFile = getAzureFile;
 }
コード例 #21
0
 public AzureBlobAccount(IAzureBlob parent, string accountName, string connectionString)
     : this(parent, accountName, GetClient(connectionString))
 {
 }
コード例 #22
0
 public ProvisionAmexMids(IAzureBlob azureBlob)
 {
     this.azureBlob = azureBlob;
 }
コード例 #23
0
 public ProjectFileRepository(IAzureBlob blobStorage)
 {
     _blobStorage = blobStorage;
 }
コード例 #24
0
ファイル: FileValidate.cs プロジェクト: vrao1020/netcorehoa
 public FileValidate(IAzureBlob azureBlob)
 {
     _azureBlob = azureBlob;
 }
コード例 #25
0
 public MeetingMinuteListAllViewComponent(IAzureBlob azureBlob)
 {
     _azureBlob = azureBlob;
 }
コード例 #26
0
 public BlockRepository(IAzureTableStorage <BlockNinjaEntity> tableStorage, IAzureBlob azureBlob)
 {
     _tableStorage = tableStorage;
     _azureBlob    = azureBlob;
 }
コード例 #27
0
 public BlobController(IAzureBlob blob)
 {
     this.blob = blob;
 }
コード例 #28
0
 public ProvisionMerchantsFromMasterCard(IAzureBlob azureBlob)
 {
     this.azureBlob = azureBlob;
 }
コード例 #29
0
 public ProvisionMasterCardMids(IAzureBlob azureBlob, AzureScheduler azureScheduler = null, SchedulerQueueInfo schedulerQueueInfo = null)
 {
     this.azureBlob          = azureBlob;
     this.azureScheduler     = azureScheduler;
     this.schedulerQueueInfo = schedulerQueueInfo;
 }