-
Notifications
You must be signed in to change notification settings - Fork 597
/
Copy pathAzureWebPubSubHubResource.cs
44 lines (37 loc) · 2.03 KB
/
AzureWebPubSubHubResource.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Azure.Provisioning.WebPubSub;
namespace Aspire.Hosting.ApplicationModel;
/// <summary>
/// Represents an Azure Web PubSub Hub setting resource.
/// </summary>
/// <param name="name">The name of the resource.</param>
/// <param name="webpubsub">The <see cref="AzureWebPubSubResource"/> that the resource belongs to.</param>
public class AzureWebPubSubHubResource(string name, AzureWebPubSubResource webpubsub) : Resource(name),
IResourceWithParent<AzureWebPubSubResource>, IResourceWithConnectionString
{
/// <summary>
/// Represents an Azure Web PubSub Hub setting resource.
/// </summary>
/// <param name="name">The name of the resource.</param>
/// <param name="hubName">The name of the Azure Web PubSub Hub.</param>
/// <param name="webpubsub">The <see cref="AzureWebPubSubResource"/> that the resource belongs to.</param>
public AzureWebPubSubHubResource(string name, string hubName, AzureWebPubSubResource webpubsub) : this(name, webpubsub)
{
HubName = hubName ?? throw new ArgumentNullException(nameof(hubName));
}
private readonly AzureWebPubSubResource _webpubsub = webpubsub ?? throw new ArgumentNullException(nameof(webpubsub));
/// <summary>
/// Gets the parent AzureWebPubSubResource of this AzureWebPubSubHubSettingResource.
/// </summary>
public AzureWebPubSubResource Parent => _webpubsub;
/// <summary>
/// Gets the name associated with the Azure Web PubSub Hub.
/// </summary>
public string HubName { get; set; } = name;
/// <summary>
/// Gets the connection string template for the manifest for Azure Web PubSub.
/// </summary>
public ReferenceExpression ConnectionStringExpression => ReferenceExpression.Create($"Endpoint={Parent.Endpoint};Hub={HubName}");
internal List<(ReferenceExpression url, string userEvents, string[]? systemEvents, UpstreamAuthSettings? auth)> EventHandlers { get; } = new();
}