Skip to content

Commit 356d260

Browse files
authored
Rename IKeyVaultResource and IKeyVaultSecretReference (#8532)
Using the Azure prefix, as we do this everywhere else. Contributes to #7811
1 parent 1007a6c commit 356d260

File tree

13 files changed

+25
-25
lines changed

13 files changed

+25
-25
lines changed

src/Aspire.Hosting.Azure.AppContainers/AzureContainerAppsInfrastructure.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ BicepValue<string> GetHostValue(string? prefix = null, string? suffix = null)
714714
return (AllocateParameter(secretOutputReference, secretType: SecretType.KeyVault), SecretType.KeyVault);
715715
}
716716

717-
if (value is IKeyVaultSecretReference vaultSecretReference)
717+
if (value is IAzureKeyVaultSecretReference vaultSecretReference)
718718
{
719719
if (parent is null)
720720
{
@@ -797,7 +797,7 @@ private BicepValue<string> AllocateKeyVaultSecretUriReference(BicepSecretOutputR
797797
return secret.Properties.SecretUri;
798798
}
799799

800-
private BicepValue<string> AllocateKeyVaultSecretUriReference(IKeyVaultSecretReference secretOutputReference)
800+
private BicepValue<string> AllocateKeyVaultSecretUriReference(IAzureKeyVaultSecretReference secretOutputReference)
801801
{
802802
if (!KeyVaultRefs.TryGetValue(secretOutputReference.Resource.Name, out var kv))
803803
{

src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public static IResourceBuilder<AzureCosmosDBResource> WithAccessKeyAuthenticatio
365365
/// <param name="builder">The Azure Cosmos DB resource builder.</param>
366366
/// <param name="keyVaultBuilder">The Azure Key Vault resource builder where the connection string used to connect to this AzureCosmosDBResource will be stored.</param>
367367
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/> builder.</returns>
368-
public static IResourceBuilder<AzureCosmosDBResource> WithAccessKeyAuthentication(this IResourceBuilder<AzureCosmosDBResource> builder, IResourceBuilder<IKeyVaultResource> keyVaultBuilder)
368+
public static IResourceBuilder<AzureCosmosDBResource> WithAccessKeyAuthentication(this IResourceBuilder<AzureCosmosDBResource> builder, IResourceBuilder<IAzureKeyVaultResource> keyVaultBuilder)
369369
{
370370
ArgumentNullException.ThrowIfNull(builder);
371371

src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class AzureCosmosDBResource(string name, Action<AzureResourceInfrastructu
4141
///
4242
/// This is set when access key authentication is used. The connection string is stored in a secret in the Azure Key Vault.
4343
/// </summary>
44-
internal IKeyVaultSecretReference? ConnectionStringSecretOutput { get; set; }
44+
internal IAzureKeyVaultSecretReference? ConnectionStringSecretOutput { get; set; }
4545

4646
private BicepOutputReference NameOutputReference => new("name", this);
4747

src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResource.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Aspire.Hosting.Azure;
1313
/// <param name="name">The name of the resource.</param>
1414
/// <param name="configureInfrastructure">Callback to configure the Azure resources.</param>
1515
public class AzureKeyVaultResource(string name, Action<AzureResourceInfrastructure> configureInfrastructure)
16-
: AzureProvisioningResource(name, configureInfrastructure), IResourceWithConnectionString, IKeyVaultResource
16+
: AzureProvisioningResource(name, configureInfrastructure), IResourceWithConnectionString, IAzureKeyVaultResource
1717
{
1818
/// <summary>
1919
/// Gets the "vaultUri" output reference for the Azure Key Vault resource.
@@ -31,12 +31,12 @@ public class AzureKeyVaultResource(string name, Action<AzureResourceInfrastructu
3131
public ReferenceExpression ConnectionStringExpression =>
3232
ReferenceExpression.Create($"{VaultUri}");
3333

34-
BicepOutputReference IKeyVaultResource.VaultUriOutputReference => VaultUri;
34+
BicepOutputReference IAzureKeyVaultResource.VaultUriOutputReference => VaultUri;
3535

3636
// In run mode, this is set to the secret client used to access the Azure Key Vault.
37-
internal Func<IKeyVaultSecretReference, CancellationToken, Task<string?>>? SecretResolver { get; set; }
37+
internal Func<IAzureKeyVaultSecretReference, CancellationToken, Task<string?>>? SecretResolver { get; set; }
3838

39-
Func<IKeyVaultSecretReference, CancellationToken, Task<string?>>? IKeyVaultResource.SecretResolver
39+
Func<IAzureKeyVaultSecretReference, CancellationToken, Task<string?>>? IAzureKeyVaultResource.SecretResolver
4040
{
4141
get => SecretResolver;
4242
set => SecretResolver = value;
@@ -48,7 +48,7 @@ public class AzureKeyVaultResource(string name, Action<AzureResourceInfrastructu
4848
/// <param name="secretName"></param>
4949
/// <returns></returns>
5050
/// <exception cref="ArgumentException"></exception>
51-
public IKeyVaultSecretReference GetSecretReference(string secretName)
51+
public IAzureKeyVaultSecretReference GetSecretReference(string secretName)
5252
{
5353
ArgumentException.ThrowIfNullOrEmpty(secretName, nameof(secretName));
5454

src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultSecretReference.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Aspire.Hosting.Azure;
1010
/// </summary>
1111
/// <param name="secretName">The name of the secret.</param>
1212
/// <param name="azureKeyVaultResource">The Azure Key Vault resource.</param>
13-
internal sealed class AzureKeyVaultSecretReference(string secretName, AzureKeyVaultResource azureKeyVaultResource) : IKeyVaultSecretReference, IValueProvider, IManifestExpressionProvider
13+
internal sealed class AzureKeyVaultSecretReference(string secretName, AzureKeyVaultResource azureKeyVaultResource) : IAzureKeyVaultSecretReference, IValueProvider, IManifestExpressionProvider
1414
{
1515
/// <summary>
1616
/// Gets the name of the secret.
@@ -20,7 +20,7 @@ internal sealed class AzureKeyVaultSecretReference(string secretName, AzureKeyVa
2020
/// <summary>
2121
/// Gets the Azure Key Vault resource.
2222
/// </summary>
23-
public IKeyVaultResource Resource => azureKeyVaultResource;
23+
public IAzureKeyVaultResource Resource => azureKeyVaultResource;
2424

2525
string IManifestExpressionProvider.ValueExpression => $"{{{azureKeyVaultResource.Name}.secrets.{SecretName}}}";
2626

src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public static IResourceBuilder<PostgresServerResource> AsAzurePostgresFlexibleSe
118118
/// This requires changes to the application code to use an azure credential to authenticate with the resource. See
119119
/// https://learn.microsoft.com/azure/postgresql/flexible-server/how-to-connect-with-managed-identity#connect-using-managed-identity-in-c for more information.
120120
///
121-
/// You can use the <see cref="WithPasswordAuthentication(IResourceBuilder{AzurePostgresFlexibleServerResource}, IResourceBuilder{IKeyVaultResource}, IResourceBuilder{ParameterResource}?, IResourceBuilder{ParameterResource}?)"/> method to configure the resource to use password authentication.
121+
/// You can use the <see cref="WithPasswordAuthentication(IResourceBuilder{AzurePostgresFlexibleServerResource}, IResourceBuilder{IAzureKeyVaultResource}, IResourceBuilder{ParameterResource}?, IResourceBuilder{ParameterResource}?)"/> method to configure the resource to use password authentication.
122122
/// </remarks>
123123
/// <example>
124124
/// The following example creates an Azure PostgreSQL Flexible Server resource and referencing that resource in a .NET project.
@@ -317,7 +317,7 @@ public static IResourceBuilder<AzurePostgresFlexibleServerResource> WithPassword
317317
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/> builder.</returns>
318318
public static IResourceBuilder<AzurePostgresFlexibleServerResource> WithPasswordAuthentication(
319319
this IResourceBuilder<AzurePostgresFlexibleServerResource> builder,
320-
IResourceBuilder<IKeyVaultResource> keyVaultBuilder,
320+
IResourceBuilder<IAzureKeyVaultResource> keyVaultBuilder,
321321
IResourceBuilder<ParameterResource>? userName = null,
322322
IResourceBuilder<ParameterResource>? password = null)
323323
{

src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class AzurePostgresFlexibleServerResource(string name, Action<AzureResour
3333
///
3434
/// This is set when password authentication is used. The connection string is stored in a secret in the Azure Key Vault.
3535
/// </summary>
36-
internal IKeyVaultSecretReference? ConnectionStringSecretOutput { get; set; }
36+
internal IAzureKeyVaultSecretReference? ConnectionStringSecretOutput { get; set; }
3737

3838
private BicepOutputReference NameOutputReference => new("name", this);
3939

src/Aspire.Hosting.Azure.Redis/AzureRedisCacheResource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class AzureRedisCacheResource(string name, Action<AzureResourceInfrastruc
2929
///
3030
/// This is set when access key authentication is used. The connection string is stored in a secret in the Azure Key Vault.
3131
/// </summary>
32-
internal IKeyVaultSecretReference? ConnectionStringSecretOutput { get; set; }
32+
internal IAzureKeyVaultSecretReference? ConnectionStringSecretOutput { get; set; }
3333

3434
private BicepOutputReference NameOutputReference => new("name", this);
3535

src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static IResourceBuilder<RedisResource> AsAzureRedis(this IResourceBuilder
9696
/// This requires changes to the application code to use an azure credential to authenticate with the resource. See
9797
/// https://github.com/Azure/Microsoft.Azure.StackExchangeRedis for more information.
9898
///
99-
/// You can use the <see cref="WithAccessKeyAuthentication(IResourceBuilder{AzureRedisCacheResource}, IResourceBuilder{IKeyVaultResource})"/> method to configure the resource to use access key authentication.
99+
/// You can use the <see cref="WithAccessKeyAuthentication(IResourceBuilder{AzureRedisCacheResource}, IResourceBuilder{IAzureKeyVaultResource})"/> method to configure the resource to use access key authentication.
100100
/// </remarks>
101101
/// <example>
102102
/// The following example creates an Azure Cache for Redis resource and referencing that resource in a .NET project.
@@ -218,7 +218,7 @@ public static IResourceBuilder<AzureRedisCacheResource> WithAccessKeyAuthenticat
218218
/// <param name="builder">The Azure Cache for Redis resource builder.</param>
219219
/// <param name="keyVaultBuilder">The Azure Key Vault resource builder where the connection string used to connect to this AzureRedisCacheResource will be stored.</param>
220220
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/> builder.</returns>
221-
public static IResourceBuilder<AzureRedisCacheResource> WithAccessKeyAuthentication(this IResourceBuilder<AzureRedisCacheResource> builder, IResourceBuilder<IKeyVaultResource> keyVaultBuilder)
221+
public static IResourceBuilder<AzureRedisCacheResource> WithAccessKeyAuthentication(this IResourceBuilder<AzureRedisCacheResource> builder, IResourceBuilder<IAzureKeyVaultResource> keyVaultBuilder)
222222
{
223223
ArgumentNullException.ThrowIfNull(builder);
224224
ArgumentNullException.ThrowIfNull(keyVaultBuilder);

src/Aspire.Hosting.Azure/AzureResourcePreparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ private static void ProcessAzureReferences(HashSet<IAzureResource> azureReferenc
362362
return;
363363
}
364364

365-
if (value is IKeyVaultSecretReference keyVaultSecretReference)
365+
if (value is IAzureKeyVaultSecretReference keyVaultSecretReference)
366366
{
367367
azureReferences.Add(keyVaultSecretReference.Resource);
368368
return;

0 commit comments

Comments
 (0)