| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 3 | | // license information. |
| | 4 | |
|
| | 5 | | using System.Net.Http; |
| | 6 | | using System.Threading; |
| | 7 | | using System.Threading.Tasks; |
| | 8 | | using Microsoft.Rest; |
| | 9 | |
|
| | 10 | | namespace Microsoft.Azure.EventGrid.Models |
| | 11 | | { |
| | 12 | | public class TopicCredentials : ServiceClientCredentials |
| | 13 | | { |
| | 14 | | readonly string topicKey; |
| | 15 | |
|
| 0 | 16 | | public TopicCredentials(string topicKey) |
| | 17 | | { |
| 0 | 18 | | this.topicKey = topicKey; |
| 0 | 19 | | } |
| | 20 | |
|
| | 21 | | public override void InitializeServiceClient<T>(ServiceClient<T> client) |
| | 22 | | { |
| 0 | 23 | | } |
| | 24 | |
|
| | 25 | | public override async Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationTok |
| | 26 | | { |
| 0 | 27 | | request.Headers.Add("aeg-sas-key", this.topicKey); |
| 0 | 28 | | await base.ProcessHttpRequestAsync(request, cancellationToken).ConfigureAwait(false); |
| 0 | 29 | | } |
| | 30 | | } |
| | 31 | | } |