| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using Azure.Core.Extensions; |
| | 6 | | using Azure.Storage; |
| | 7 | | using Azure.Storage.Blobs; |
| | 8 | |
|
| | 9 | | namespace Microsoft.Extensions.Azure |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Extension methods to add <see cref="BlobServiceClient"/> client to clients builder |
| | 13 | | /// </summary> |
| | 14 | | public static class BlobClientBuilderExtensions |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// Registers a <see cref="BlobServiceClient"/> instance with the provided <paramref name="connectionString"/> |
| | 18 | | /// </summary> |
| | 19 | | public static IAzureClientBuilder<BlobServiceClient, BlobClientOptions> AddBlobServiceClient<TBuilder>(this TBui |
| | 20 | | where TBuilder : IAzureClientFactoryBuilder |
| | 21 | | { |
| 0 | 22 | | return builder.RegisterClientFactory<BlobServiceClient, BlobClientOptions>(options => new BlobServiceClient( |
| | 23 | | } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Registers a <see cref="BlobServiceClient"/> instance with the provided <paramref name="serviceUri"/> |
| | 27 | | /// </summary> |
| | 28 | | public static IAzureClientBuilder<BlobServiceClient, BlobClientOptions> AddBlobServiceClient<TBuilder>(this TBui |
| | 29 | | where TBuilder : IAzureClientFactoryBuilderWithCredential |
| | 30 | | { |
| 0 | 31 | | return builder.RegisterClientFactory<BlobServiceClient, BlobClientOptions>( |
| 0 | 32 | | (options, token) => token != null ? new BlobServiceClient(serviceUri, token, options) : new BlobServiceC |
| 0 | 33 | | requiresCredential: false); |
| | 34 | | } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// Registers a <see cref="BlobServiceClient"/> instance with the provided <paramref name="serviceUri"/> and <pa |
| | 38 | | /// </summary> |
| | 39 | | public static IAzureClientBuilder<BlobServiceClient, BlobClientOptions> AddBlobServiceClient<TBuilder>(this TBui |
| | 40 | | where TBuilder : IAzureClientFactoryBuilder |
| | 41 | | { |
| 0 | 42 | | return builder.RegisterClientFactory<BlobServiceClient, BlobClientOptions>(options => new BlobServiceClient( |
| | 43 | | } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Registers a <see cref="BlobServiceClient"/> instance with connection options loaded from the provided <param |
| | 47 | | /// </summary> |
| | 48 | | public static IAzureClientBuilder<BlobServiceClient, BlobClientOptions> AddBlobServiceClient<TBuilder, TConfigur |
| | 49 | | where TBuilder : IAzureClientFactoryBuilderWithConfiguration<TConfiguration> |
| | 50 | | { |
| 0 | 51 | | return builder.RegisterClientFactory<BlobServiceClient, BlobClientOptions>(configuration); |
| | 52 | | } |
| | 53 | | } |
| | 54 | | } |