Skip to content

Commit 3bc2b3a

Browse files
Last round of triple slash, I believe. (dotnet#661)
* Last round of triple slash, I believe. * Revert Aspire.sln change * Update src/Aspire.Hosting.Azure.Provisioning/UserSecretsPathHelper.cs * Update src/Aspire.Hosting.Azure.Provisioning/UserSecretsPathHelper.cs --------- Co-authored-by: David Fowler <[email protected]>
1 parent 314af0f commit 3bc2b3a

File tree

39 files changed

+236
-68
lines changed

39 files changed

+236
-68
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
;
55
; Here are some resources for what's supported for .NET/C#
66
; https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers
7-
; https://learn.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
7+
; https://learn.microsoft.com/visualstudio/ide/editorconfig-code-style-settings-reference
88
;
99
; Be **careful** editing this because some of the rules don't support adding a severity level
1010
; For instance if you change to `dotnet_sort_system_directives_first = true:warning` (adding `:warning`)

eng/common/templates/job/job.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
- name: EnableRichCodeNavigation
7777
value: 'true'
7878
# Retry signature validation up to three times, waiting 2 seconds between attempts.
79-
# See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures
79+
# See https://learn.microsoft.com/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures
8080
- name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY
8181
value: 3,2000
8282
- ${{ each variable in parameters.variables }}:

samples/eShopLite/BasketService/Protos/basket.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ message DeleteCustomerBasketRequest {
4747
message DeleteCustomerBasketResponse {
4848
}
4949

50-
// See: https://learn.microsoft.com/en-us/dotnet/architecture/grpc-for-wcf-developers/protobuf-data-types#decimals
50+
// See: https://learn.microsoft.com/dotnet/architecture/grpc-for-wcf-developers/protobuf-data-types#decimals
5151
// Example: 12345.6789 -> { units = 12345, nanos = 678900000 }
5252
message DecimalValue {
5353

src/Aspire.Dashboard/Components/Controls/LogViewer.razor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public async ValueTask DisposeAsync()
7777
}
7878
catch (JSDisconnectedException)
7979
{
80-
// Per https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-7.0#javascript-interop-calls-without-a-circuit
80+
// Per https://learn.microsoft.com/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-7.0#javascript-interop-calls-without-a-circuit
8181
// this is one of the calls that will fail if the circuit is disconnected, and we just need to catch the exception so it doesn't pollute the logs
8282
}
8383
}

src/Aspire.Dashboard/Components/Dialogs/SettingsDialog.razor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public async ValueTask DisposeAsync()
8383
}
8484
catch (JSDisconnectedException)
8585
{
86-
// Per https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-7.0#javascript-interop-calls-without-a-circuit
86+
// Per https://learn.microsoft.com/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-7.0#javascript-interop-calls-without-a-circuit
8787
// this is one of the calls that will fail if the circuit is disconnected, and we just need to catch the exception so it doesn't pollute the logs
8888
}
8989
}

src/Aspire.Hosting.Azure.Provisioning/AzureProvisionerExtensions.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
namespace Aspire.Hosting;
1818

19+
/// <summary>
20+
/// Provides extension methods for adding support for generating Azure resources dynamically during application startup.
21+
/// </summary>
1922
public static class AzureProvisionerExtensions
2023
{
2124
/// <summary>
@@ -27,11 +30,11 @@ public static IDistributedApplicationBuilder AddAzureProvisioning(this IDistribu
2730
builder.Services.AddLifecycleHook<AzureProvisioner>();
2831

2932
// Attempt to read azure configuration from configuration
30-
builder.Services.AddOptions<AzureProvisinerOptions>()
33+
builder.Services.AddOptions<AzureProvisionerOptions>()
3134
.BindConfiguration("Azure");
3235

3336
// We're adding 2 because there's no easy way to enumerate all keys and all service types
34-
builder.AddAzureProvisioner<AzureKeyVaultResource, KeyVaultProvisoner>();
37+
builder.AddAzureProvisioner<AzureKeyVaultResource, KeyVaultProvisioner>();
3538
builder.AddResourceEnumerator(resourceGroup => resourceGroup.GetKeyVaults(), resource => resource.Data.Tags);
3639

3740
builder.AddAzureProvisioner<AzureStorageResource, StorageProvisioner>();
@@ -43,7 +46,7 @@ public static IDistributedApplicationBuilder AddAzureProvisioning(this IDistribu
4346
builder.AddAzureProvisioner<AzureRedisResource, AzureRedisProvisioner>();
4447
builder.AddResourceEnumerator(resourceGroup => resourceGroup.GetAllRedis(), resource => resource.Data.Tags);
4548

46-
builder.AddAzureProvisioner<AzureAppConfigurationResource, AppConfigurationProvisoner>();
49+
builder.AddAzureProvisioner<AzureAppConfigurationResource, AppConfigurationProvisioner>();
4750
builder.AddResourceEnumerator(resourceGroup => resourceGroup.GetAppConfigurationStores(), resource => resource.Data.Tags);
4851
return builder;
4952
}

src/Aspire.Hosting.Azure.Provisioning/AzureProvisinerOptions.cs renamed to src/Aspire.Hosting.Azure.Provisioning/AzureProvisionerOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Aspire.Hosting.Azure.Provisioning;
55

6-
internal sealed class AzureProvisinerOptions
6+
internal sealed class AzureProvisionerOptions
77
{
88
public string? SubscriptionId { get; set; }
99

src/Aspire.Hosting.Azure.Provisioning/JsonExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
3+
34
using System.Text.Json.Nodes;
45

56
namespace Aspire.Hosting.Azure;

src/Aspire.Hosting.Azure.Provisioning/Provisioners/AppConfigurationProvisoner.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace Aspire.Hosting.Azure.Provisioning;
1717

18-
internal sealed class AppConfigurationProvisoner(ILogger<AppConfigurationProvisoner> logger) : AzureResourceProvisioner<AzureAppConfigurationResource>
18+
internal sealed class AppConfigurationProvisioner(ILogger<AppConfigurationProvisioner> logger) : AzureResourceProvisioner<AzureAppConfigurationResource>
1919
{
2020
public override bool ConfigureResource(IConfiguration configuration, AzureAppConfigurationResource resource)
2121
{
@@ -72,7 +72,7 @@ public override async Task GetOrCreateResourceAsync(
7272
connectionStrings[resource.Name] = resource.Endpoint;
7373

7474
// App Configuration Data Owner
75-
// https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#app-configuration-data-owner
75+
// https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#app-configuration-data-owner
7676
var roleDefinitionId = CreateRoleDefinitionId(subscription, "5ae67dd6-50cb-40e7-96ff-dc2bfa4b606b");
7777

7878
await DoRoleAssignmentAsync(armClient, appConfigurationResource.Id, principalId, roleDefinitionId, cancellationToken).ConfigureAwait(false);

src/Aspire.Hosting.Azure.Provisioning/Provisioners/AzureProvisioner.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Aspire.Hosting.Azure;
2424

2525
// Provisions azure resources for development purposes
2626
internal sealed class AzureProvisioner(
27-
IOptions<AzureProvisinerOptions> options,
27+
IOptions<AzureProvisionerOptions> options,
2828
IOptions<PublishingOptions> publishingOptions,
2929
IConfiguration configuration,
3030
IHostEnvironment environment,
@@ -34,7 +34,7 @@ internal sealed class AzureProvisioner(
3434
{
3535
internal const string AspireResourceNameTag = "aspire-resource-name";
3636

37-
private readonly AzureProvisinerOptions _options = options.Value;
37+
private readonly AzureProvisionerOptions _options = options.Value;
3838

3939
public async Task BeforeStartAsync(DistributedApplicationModel appModel, CancellationToken cancellationToken = default)
4040
{
@@ -186,21 +186,21 @@ await PopulateExistingAspireResources(
186186
{
187187
usedResources.Add(resource.Name);
188188

189-
var provisoner = serviceProvider.GetKeyedService<IAzureResourceProvisioner>(resource.GetType());
189+
var provisioner = serviceProvider.GetKeyedService<IAzureResourceProvisioner>(resource.GetType());
190190

191-
if (provisoner is null)
191+
if (provisioner is null)
192192
{
193193
logger.LogWarning("No provisioner found for {resourceType} skipping.", resource.GetType().Name);
194194
continue;
195195
}
196196

197-
if (!provisoner.ShouldProvision(configuration, resource))
197+
if (!provisioner.ShouldProvision(configuration, resource))
198198
{
199199
logger.LogInformation("Skipping {resourceName} because it is not configured to be provisioned.", resource.Name);
200200
continue;
201201
}
202202

203-
if (provisoner.ConfigureResource(configuration, resource))
203+
if (provisioner.ConfigureResource(configuration, resource))
204204
{
205205
logger.LogInformation("Using connection information stored in user secrets for {resourceName}.", resource.Name);
206206

@@ -217,7 +217,7 @@ await PopulateExistingAspireResources(
217217
resourceMap ??= await resourceMapLazy.Value.ConfigureAwait(false);
218218
principalId ??= await principalIdLazy.Value.ConfigureAwait(false);
219219

220-
var task = provisoner.GetOrCreateResourceAsync(armClient,
220+
var task = provisioner.GetOrCreateResourceAsync(armClient,
221221
subscription,
222222
resourceGroup,
223223
resourceMap,

src/Aspire.Hosting.Azure.Provisioning/Provisioners/KeyVaultProvisoner.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace Aspire.Hosting.Azure.Provisioning;
1616

17-
internal sealed class KeyVaultProvisoner(ILogger<KeyVaultProvisoner> logger) : AzureResourceProvisioner<AzureKeyVaultResource>
17+
internal sealed class KeyVaultProvisioner(ILogger<KeyVaultProvisioner> logger) : AzureResourceProvisioner<AzureKeyVaultResource>
1818
{
1919
public override bool ConfigureResource(IConfiguration configuration, AzureKeyVaultResource resource)
2020
{
@@ -76,7 +76,7 @@ public override async Task GetOrCreateResourceAsync(
7676
connectionStrings[keyVault.Name] = keyVault.VaultUri.ToString();
7777

7878
// Key Vault Administrator
79-
// https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#key-vault-administrator
79+
// https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#key-vault-administrator
8080
var roleDefinitionId = CreateRoleDefinitionId(subscription, "00482a5a-887f-4fb3-b363-3b7fe8e74483");
8181

8282
await DoRoleAssignmentAsync(armClient, keyVaultResource.Id, principalId, roleDefinitionId, cancellationToken).ConfigureAwait(false);

src/Aspire.Hosting.Azure.Provisioning/Provisioners/ServiceBusProvisioner.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public override async Task GetOrCreateResourceAsync(
150150
}
151151

152152
// Azure Service Bus Data Owner
153-
// https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#azure-service-bus-data-owner
153+
// https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#azure-service-bus-data-owner
154154
var roleDefinitionId = CreateRoleDefinitionId(subscription, "090c5cfd-751d-490a-894a-3ce6f1109419");
155155

156156
await DoRoleAssignmentAsync(armClient, serviceBusNamespace.Id, principalId, roleDefinitionId, cancellationToken).ConfigureAwait(false);

src/Aspire.Hosting.Azure.Provisioning/Provisioners/StorageProvisioner.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ public override async Task GetOrCreateResourceAsync(
9191
resourceEntry["QueueUri"] = resource.QueueUri.ToString();
9292

9393
// Storage Queue Data Contributor
94-
// https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#storage-queue-data-contributor
94+
// https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#storage-queue-data-contributor
9595
var storageQueueDataContributorId = CreateRoleDefinitionId(subscription, "974c5e8b-45b9-4653-ba55-5f855dd0fb88");
9696

9797
// Storage Table Data Contributor
98-
// https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#storage-table-data-contributor
98+
// https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#storage-table-data-contributor
9999
var storageDataContributorId = CreateRoleDefinitionId(subscription, "0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3");
100100

101101
// Storage Blob Data Contributor
102-
// https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#storage-blob-data-contributor
102+
// https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#storage-blob-data-contributor
103103
var storageBlobDataContributorId = CreateRoleDefinitionId(subscription, "81a9662b-bebf-436f-a333-f67b29880f12");
104104

105105
var t0 = DoRoleAssignmentAsync(armClient, storageAccount.Id, principalId, storageQueueDataContributorId, cancellationToken);

src/Aspire.Hosting.Azure.Provisioning/UserSecretsPathHelper.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ namespace Aspire.Hosting.Azure;
55

66
// Copied from https://github.com/dotnet/runtime/blob/213833ea99b79a4b494b2935e1ccb10b93cd4cbc/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/PathHelper.cs
77

8-
public class UserSecretsPathHelper
8+
/// <summary>
9+
/// Provides helper methods for working with user secrets in a location outside of source control.
10+
/// </summary>
11+
internal sealed class UserSecretsPathHelper
912
{
1013
internal const string SecretsFileName = "secrets.json";
1114

src/Aspire.Hosting.Azure/AzureAppConfigurationResource.cs

+11
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@
33

44
namespace Aspire.Hosting.ApplicationModel;
55

6+
/// <summary>
7+
/// Represents an Azure App Configuration resource.
8+
/// </summary>
9+
/// <param name="name">The name of the resource.</param>
610
public class AzureAppConfigurationResource(string name) : Resource(name), IAzureResource, IResourceWithConnectionString
711
{
12+
/// <summary>
13+
/// Gets or sets the endpoint for the Azure App Configuration resource.
14+
/// </summary>
815
public string? Endpoint { get; set; }
916

17+
/// <summary>
18+
/// Gets the connection string for the Azure App Configuration resource.
19+
/// </summary>
20+
/// <returns>The connection string for the Azure App Configuration resource.</returns>
1021
public string? GetConnectionString() => Endpoint;
1122
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Aspire.Hosting.ApplicationModel;
5+
6+
/// <summary>
7+
/// Represents a resource that is stored in Azure Blob Storage.
8+
/// </summary>
9+
/// <param name="name">The name of the resource.</param>
10+
/// <param name="storage">The <see cref="AzureStorageResource"/> that the resource is stored in.</param>
11+
public class AzureBlobStorageResource(string name, AzureStorageResource storage) : Resource(name),
12+
IAzureResource,
13+
IResourceWithConnectionString,
14+
IResourceWithParent<AzureStorageResource>
15+
{
16+
/// <summary>
17+
/// Gets the parent AzureStorageResource of this AzureBlobStorageResource.
18+
/// </summary>
19+
public AzureStorageResource Parent => storage;
20+
21+
/// <summary>
22+
/// Gets the connection string for the Azure Blob Storage resource.
23+
/// </summary>
24+
/// <returns>The connection string for the Azure Blob Storage resource.</returns>
25+
public string? GetConnectionString() => Parent.GetBlobConnectionString();
26+
}

src/Aspire.Hosting.Azure/AzureKeyVaultResource.cs

+11
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@
33

44
namespace Aspire.Hosting.ApplicationModel;
55

6+
/// <summary>
7+
/// Represents an Azure Key Vault resource that can be deployed to an Azure resource group.
8+
/// </summary>
9+
/// <param name="name">The name of the resource.</param>
610
public class AzureKeyVaultResource(string name) : Resource(name), IAzureResource, IResourceWithConnectionString
711
{
12+
/// <summary>
13+
/// Gets or sets the URI of the Azure Key Vault.
14+
/// </summary>
815
public Uri? VaultUri { get; set; }
916

17+
/// <summary>
18+
/// Gets the connection string for the Azure Key Vault resource.
19+
/// </summary>
20+
/// <returns>The connection string for the Azure Key Vault resource.</returns>
1021
public string? GetConnectionString() => VaultUri?.ToString();
1122
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Aspire.Hosting.ApplicationModel;
5+
6+
/// <summary>
7+
/// Represents an Azure Queue Storage resource.
8+
/// </summary>
9+
/// <param name="name">The name of the resource.</param>
10+
/// <param name="storage">The <see cref="AzureStorageResource"/> that the resource is stored in.</param>
11+
public class AzureQueueStorageResource(string name, AzureStorageResource storage) : Resource(name),
12+
IAzureResource,
13+
IResourceWithConnectionString,
14+
IResourceWithParent<AzureStorageResource>
15+
{
16+
/// <summary>
17+
/// Gets the parent AzureStorageResource of this AzureQueueStorageResource.
18+
/// </summary>
19+
public AzureStorageResource Parent => storage;
20+
21+
/// <summary>
22+
/// Gets the connection string for the Azure Queue Storage resource.
23+
/// </summary>
24+
/// <returns>The connection string for the Azure Queue Storage resource.</returns>
25+
public string? GetConnectionString() => Parent.GetQueueConnectionString();
26+
}

src/Aspire.Hosting.Azure/AzureRedisResource.cs

+11
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@
33

44
namespace Aspire.Hosting.ApplicationModel;
55

6+
/// <summary>
7+
/// Represents an Azure Redis resource.
8+
/// </summary>
9+
/// <param name="name">The name of the resource.</param>
610
public class AzureRedisResource(string name) : Resource(name), IAzureResource, IResourceWithConnectionString
711
{
12+
/// <summary>
13+
/// Gets or sets the connection string for the Azure Redis resource.
14+
/// </summary>
815
public string? ConnectionString { get; set; }
916

17+
/// <summary>
18+
/// Gets the connection string for the Azure Redis resource.
19+
/// </summary>
20+
/// <returns>The connection string for the Azure Redis resource.</returns>
1021
public string? GetConnectionString() => ConnectionString;
1122
}

src/Aspire.Hosting.Azure/AzureResourceExtensions.cs

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
namespace Aspire.Hosting;
99

10+
/// <summary>
11+
/// Provides extension methods for adding Azure resources to the application model.
12+
/// </summary>
1013
public static class AzureResourceExtensions
1114
{
1215
/// <summary>

src/Aspire.Hosting.Azure/AzureServiceBusResource.cs

+19-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,31 @@
33

44
namespace Aspire.Hosting.ApplicationModel;
55

6+
/// <summary>
7+
/// Represents an Azure Service Bus resource.
8+
/// </summary>
9+
/// <param name="name">The name of the resource.</param>
610
public class AzureServiceBusResource(string name) : Resource(name), IAzureResource, IResourceWithConnectionString
711
{
8-
// This is the full uri to the service bus namespace e.g namespace.servicebus.windows.net
12+
/// <summary>
13+
/// Gets or sets the Service Bus endpoint. This is the full uri to the service bus
14+
/// namespace, for example <c>"namespace.servicebus.windows.net"</c>.
15+
/// </summary>
916
public string? ServiceBusEndpoint { get; set; }
1017

18+
/// <summary>
19+
/// Gets or sets the names of the queues associated with the Azure Service Bus resource.
20+
/// </summary>
1121
public string[] QueueNames { get; set; } = [];
22+
23+
/// <summary>
24+
/// Gets or sets the names of the topics associated with the Azure Service Bus resource.
25+
/// </summary>
1226
public string[] TopicNames { get; set; } = [];
1327

28+
/// <summary>
29+
/// Gets the connection string for the Azure Service Bus endpoint.
30+
/// </summary>
31+
/// <returns>The connection string for the Azure Service Bus endpoint.</returns>
1432
public string? GetConnectionString() => ServiceBusEndpoint;
1533
}

0 commit comments

Comments
 (0)