| | 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.Queues; |
| | 8 | |
|
| | 9 | | namespace Microsoft.Extensions.Azure |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Extension methods to add <see cref="QueueClientOptions"/> client to clients builder |
| | 13 | | /// </summary> |
| | 14 | | public static class QueueClientBuilderExtensions |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// Registers a <see cref="QueueServiceClient"/> instance with the provided <paramref name="connectionString"/> |
| | 18 | | /// </summary> |
| | 19 | | public static IAzureClientBuilder<QueueServiceClient, QueueClientOptions> AddQueueServiceClient<TBuilder>(this T |
| | 20 | | where TBuilder : IAzureClientFactoryBuilder |
| | 21 | | { |
| 0 | 22 | | return builder.RegisterClientFactory<QueueServiceClient, QueueClientOptions>(options => new QueueServiceClie |
| | 23 | | } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Registers a <see cref="QueueServiceClient"/> instance with the provided <paramref name="serviceUri"/> |
| | 27 | | /// </summary> |
| | 28 | | public static IAzureClientBuilder<QueueServiceClient, QueueClientOptions> AddQueueServiceClient<TBuilder>(this T |
| | 29 | | where TBuilder : IAzureClientFactoryBuilderWithCredential |
| | 30 | | { |
| 0 | 31 | | return builder.RegisterClientFactory<QueueServiceClient, QueueClientOptions>( |
| 0 | 32 | | (options, token) => token != null ? new QueueServiceClient(serviceUri, token, options) : new QueueServic |
| 0 | 33 | | requiresCredential: false); |
| | 34 | | } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// Registers a <see cref="QueueServiceClient"/> instance with the provided <paramref name="serviceUri"/> and <p |
| | 38 | | /// </summary> |
| | 39 | | public static IAzureClientBuilder<QueueServiceClient, QueueClientOptions> AddQueueServiceClient<TBuilder>(this T |
| | 40 | | where TBuilder : IAzureClientFactoryBuilder |
| | 41 | | { |
| 0 | 42 | | return builder.RegisterClientFactory<QueueServiceClient, QueueClientOptions>(options => new QueueServiceClie |
| | 43 | | } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Registers a <see cref="QueueServiceClient"/> instance with connection options loaded from the provided <para |
| | 47 | | /// </summary> |
| | 48 | | public static IAzureClientBuilder<QueueServiceClient, QueueClientOptions> AddQueueServiceClient<TBuilder, TConfi |
| | 49 | | where TBuilder : IAzureClientFactoryBuilderWithConfiguration<TConfiguration> |
| | 50 | | { |
| 0 | 51 | | return builder.RegisterClientFactory<QueueServiceClient, QueueClientOptions>(configuration); |
| | 52 | | } |
| | 53 | | } |
| | 54 | | } |