Ejemplo n.º 1
0
        internal static IServiceCollection AddCustomHealthChecks(
            this IServiceCollection services,
            IAzureBlobStorageSettings storageSettings)
        {
            services.AddHealthChecks()
            .AddAzureBlobStorage(
                storageSettings.ConnectionString,
                storageSettings.ContainerName,
                null,
                "Azure Blob Storage",
                HealthStatus.Unhealthy,
                new[] { HealthCheckTags.Ready },
                storageSettings.HealthCheck?.Timeout)
            .AddCheck("self", () => HealthCheckResult.Healthy(), new[] { HealthCheckTags.Live });

            return(services);
        }
Ejemplo n.º 2
0
        internal static BlobContainerClient Create(IAzureBlobStorageSettings settings)
        {
            var retrySettings = settings.Retry;

            var options = retrySettings == null
                ? new BlobClientOptions()
                : new BlobClientOptions
            {
                Retry =
                {
                    Mode       = retrySettings.Mode,
                    MaxRetries = retrySettings.MaxRetries,
                    Delay      = retrySettings.Delay,
                    MaxDelay   = retrySettings.MaxDelay
                },
            };

            return(new BlobServiceClient(settings.ConnectionString, options)
                   .GetBlobContainerClient(settings.ContainerName));
        }
 public AzureBlobDocumentRepository(BlobContainerClient client, IAzureBlobStorageSettings blobStorageSettings)
 {
     this.client = client;
     this.blobStorageSettings = blobStorageSettings;
 }