Skip to content

Commit

Permalink
Rename properties to match new type names.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerhardt authored and github-actions committed Oct 25, 2024
1 parent d235288 commit f71498c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ namespace Aspire.Hosting.Azure;
public sealed class AspireV8ResourceNamePropertyResolver : DynamicResourceNamePropertyResolver
{
/// <inheritdoc/>
public override BicepValue<string>? ResolveName(ProvisioningBuildOptions context, ProvisionableResource resource, ResourceNameRequirements requirements)
public override BicepValue<string>? ResolveName(ProvisioningBuildOptions options, ProvisionableResource resource, ResourceNameRequirements requirements)
{
var suffix = GetUniqueSuffix(context, resource);
var suffix = GetUniqueSuffix(options, resource);
return BicepFunction.ToLower(BicepFunction.Take(BicepFunction.Interpolate($"{resource.BicepIdentifier}{suffix}"), 24));
}
}
4 changes: 2 additions & 2 deletions src/Aspire.Hosting.Azure/AzureProvisioningOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Aspire.Hosting.Azure;
public sealed class AzureProvisioningOptions
{
/// <summary>
/// Gets the <see cref="Azure.Provisioning.ProvisioningContext"/> which contains common settings and
/// Gets the <see cref="global::Azure.Provisioning.ProvisioningBuildOptions"/> which contains common settings and
/// functionality for building Azure resources.
/// </summary>
public ProvisioningBuildOptions ProvisioningContext { get; } = new ProvisioningBuildOptions();
public ProvisioningBuildOptions ProvisioningBuildOptions { get; } = new ProvisioningBuildOptions();
}
6 changes: 3 additions & 3 deletions src/Aspire.Hosting.Azure/AzureProvisioningResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public class AzureProvisioningResource(string name, Action<AzureResourceInfrastr
public Action<AzureResourceInfrastructure> ConfigureInfrastructure { get; internal set; } = configureInfrastructure;

/// <summary>
/// Gets or sets the <see cref="Azure.Provisioning.ProvisioningContext"/> which contains common settings and
/// Gets or sets the <see cref="global::Azure.Provisioning.ProvisioningBuildOptions"/> which contains common settings and
/// functionality for building Azure resources.
/// </summary>
public ProvisioningBuildOptions? ProvisioningContext { get; set; }
public ProvisioningBuildOptions? ProvisioningBuildOptions { get; set; }

/// <inheritdoc/>
public override BicepTemplateFile GetBicepTemplateFile(string? directory = null, bool deleteTemporaryFileOnDispose = true)
Expand Down Expand Up @@ -56,7 +56,7 @@ public override BicepTemplateFile GetBicepTemplateFile(string? directory = null,
var generationPath = Directory.CreateTempSubdirectory("aspire").FullName;
var moduleSourcePath = Path.Combine(generationPath, "main.bicep");

var plan = infrastructure.Build(ProvisioningContext);
var plan = infrastructure.Build(ProvisioningBuildOptions);
var compilation = plan.Compile();
Debug.Assert(compilation.Count == 1);
var compiledBicep = compilation.First();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
return;
}

// set the ProvisioningContext on the resource, if necessary
// set the ProvisioningBuildOptions on the resource, if necessary
foreach (var r in azureResources)
{
if (r.AzureResource is AzureProvisioningResource provisioningResource)
{
provisioningResource.ProvisioningContext = provisioningOptions.Value.ProvisioningContext;
provisioningResource.ProvisioningBuildOptions = provisioningOptions.Value.ProvisioningBuildOptions;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/Aspire.Hosting.Azure/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ Aspire.Hosting.Azure.AspireV8ResourceNamePropertyResolver
Aspire.Hosting.Azure.AspireV8ResourceNamePropertyResolver.AspireV8ResourceNamePropertyResolver() -> void
Aspire.Hosting.Azure.AzureProvisioningOptions
Aspire.Hosting.Azure.AzureProvisioningOptions.AzureProvisioningOptions() -> void
Aspire.Hosting.Azure.AzureProvisioningOptions.ProvisioningContext.get -> Azure.Provisioning.ProvisioningBuildOptions!
Aspire.Hosting.Azure.AzureProvisioningOptions.ProvisioningBuildOptions.get -> Azure.Provisioning.ProvisioningBuildOptions!
Aspire.Hosting.Azure.AzureProvisioningResource.AzureProvisioningResource(string! name, System.Action<Aspire.Hosting.Azure.AzureResourceInfrastructure!>! configureInfrastructure) -> void
Aspire.Hosting.Azure.AzureProvisioningResource.ConfigureInfrastructure.get -> System.Action<Aspire.Hosting.Azure.AzureResourceInfrastructure!>!
Aspire.Hosting.Azure.AzureProvisioningResource
Aspire.Hosting.Azure.AzureProvisioningResource.ProvisioningContext.get -> Azure.Provisioning.ProvisioningBuildOptions?
Aspire.Hosting.Azure.AzureProvisioningResource.ProvisioningContext.set -> void
Aspire.Hosting.Azure.AzureProvisioningResource.ProvisioningBuildOptions.get -> Azure.Provisioning.ProvisioningBuildOptions?
Aspire.Hosting.Azure.AzureProvisioningResource.ProvisioningBuildOptions.set -> void
Aspire.Hosting.Azure.AzureResourceInfrastructure
Aspire.Hosting.Azure.AzureResourceInfrastructure.AspireResource.get -> Aspire.Hosting.Azure.AzureProvisioningResource!
Aspire.Hosting.Azure.IResourceWithAzureFunctionsConfig
Aspire.Hosting.Azure.IResourceWithAzureFunctionsConfig.ApplyAzureFunctionsConfiguration(System.Collections.Generic.IDictionary<string!, object!>! target, string! connectionName) -> void
Aspire.Hosting.AzureProvisioningResourceExtensions
override Aspire.Hosting.Azure.AspireV8ResourceNamePropertyResolver.ResolveName(Azure.Provisioning.ProvisioningBuildOptions! context, Azure.Provisioning.Primitives.ProvisionableResource! resource, Azure.Provisioning.Primitives.ResourceNameRequirements requirements) -> Azure.Provisioning.BicepValue<string!>?
override Aspire.Hosting.Azure.AspireV8ResourceNamePropertyResolver.ResolveName(Azure.Provisioning.ProvisioningBuildOptions! options, Azure.Provisioning.Primitives.ProvisionableResource! resource, Azure.Provisioning.Primitives.ResourceNameRequirements requirements) -> Azure.Provisioning.BicepValue<string!>?
override Aspire.Hosting.Azure.AzureProvisioningResource.GetBicepTemplateFile(string? directory = null, bool deleteTemporaryFileOnDispose = true) -> Aspire.Hosting.Azure.BicepTemplateFile
override Aspire.Hosting.Azure.AzureProvisioningResource.GetBicepTemplateString() -> string!
static Aspire.Hosting.AzureBicepResourceExtensions.WithParameter<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T!>! builder, string! name, Aspire.Hosting.ApplicationModel.EndpointReference! value) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<T!>!
Expand Down
4 changes: 2 additions & 2 deletions tests/Aspire.Hosting.Azure.Tests/AzureResourceOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Aspire.Hosting.Azure.Tests;
public class AzureResourceOptionsTests(ITestOutputHelper output)
{
/// <summary>
/// Ensures that an AzureProvisioningOptions can be configured to modify the ProvisioningContext
/// Ensures that an AzureProvisioningOptions can be configured to modify the ProvisioningBuildOptions
/// used when building the bicep for an Azure resource.
///
/// This uses the .NET Aspire v8.x naming policy, which always calls toLower, appends a unique string with no separator,
Expand All @@ -27,7 +27,7 @@ public async Task AzureResourceOptionsCanBeConfigured()
{
builder.Services.Configure<AzureProvisioningOptions>(options =>
{
options.ProvisioningContext.InfrastructureResolvers.Insert(0, new AspireV8ResourceNamePropertyResolver());
options.ProvisioningBuildOptions.InfrastructureResolvers.Insert(0, new AspireV8ResourceNamePropertyResolver());
});

var serviceBus = builder.AddAzureServiceBus("sb");
Expand Down

0 comments on commit f71498c

Please sign in to comment.