Skip to content

Commit 2593475

Browse files
Refactor Azure Storage API (#10241)
* Add AddBlobContainer on AzureStorageResource * Add AddQueue * Rename AzureQueueResource to AzureQueueStorageQueueResource * Rename AddAzureQueueServiceClient to AddAzureQueueServiceClient * More refactorings * Rename obsolete methods * Fix tests * Fix tests * Fix markdown * Add API diff * Add nameless storage resources * Update API diff * Update tables * Update tests/Aspire.Hosting.Azure.Tests/AzureStorageExtensionsTests.cs Co-authored-by: Copilot <[email protected]> * Some feedback work * Revert functions playground changes * Fix test * Fix storage playground app * Use Regex to remove connection string property * Revert API diff changes * Add bicep test * Updated manifest --------- Co-authored-by: Copilot <[email protected]>
1 parent 4a2125f commit 2593475

File tree

69 files changed

+1376
-254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1376
-254
lines changed

playground/AspireEventHub/EventHubs.AppHost/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// required for the event processor client which will use the connectionName to get the connectionString.
44
var blob = builder.AddAzureStorage("ehstorage")
55
.RunAsEmulator()
6-
.AddBlobs("checkpoints");
6+
.AddBlobService("checkpoints");
77

88
var eventHub = builder.AddAzureEventHubs("eventhubns")
99
.RunAsEmulator()

playground/AspireEventHub/EventHubsConsumer/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
else
1919
{
2020
// required for checkpointing our position in the event stream
21-
builder.AddAzureBlobClient("checkpoints");
21+
builder.AddAzureBlobServiceClient("checkpoints");
2222

2323
builder.AddAzureEventProcessorClient("eventhubOne");
2424

playground/AzureAppService/AzureAppService.ApiService/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
builder.AddServiceDefaults();
1111

1212
builder.AddCosmosDbContext<TestCosmosContext>("account", "db");
13-
builder.AddAzureBlobClient("blobs");
13+
builder.AddAzureBlobServiceClient("blobs");
1414

1515
var app = builder.Build();
1616

playground/AzureAppService/AzureAppService.AppHost/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
storage.AllowBlobPublicAccess = false;
2626
})
2727
.RunAsEmulator(c => c.WithLifetime(ContainerLifetime.Persistent));
28-
var blobs = storage.AddBlobs("blobs");
28+
var blobs = storage.AddBlobService("blobs");
2929

3030
// Testing projects
3131
builder.AddProject<Projects.AzureAppService_ApiService>("api")

playground/AzureContainerApps/AzureContainerApps.ApiService/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
builder.AddServiceDefaults();
1212

1313
builder.AddCosmosDbContext<TestCosmosContext>("account", "db");
14-
builder.AddAzureBlobClient("blobs");
14+
builder.AddAzureBlobServiceClient("blobs");
1515
builder.AddRedisClient("cache");
1616

1717
var app = builder.Build();

playground/AzureContainerApps/AzureContainerApps.AppHost/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
// Testing a connection string
3232
var storage = builder.AddAzureStorage("storage")
3333
.RunAsEmulator(c => c.WithLifetime(ContainerLifetime.Persistent));
34-
var blobs = storage.AddBlobs("blobs");
34+
var blobs = storage.AddBlobService("blobs");
3535

3636
// Testing docker files
3737

playground/AzureFunctionsEndToEnd/AzureFunctionsEndToEnd.ApiService/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
// Add service defaults & Aspire client integrations.
1616
builder.AddServiceDefaults();
17-
builder.AddAzureQueueClient("queue");
18-
builder.AddAzureBlobClient("blob");
17+
builder.AddAzureQueueServiceClient("queue");
18+
builder.AddAzureBlobServiceClient("blob");
1919
builder.AddAzureEventHubProducerClient("myhub");
2020
#if !SKIP_UNSTABLE_EMULATORS
2121
builder.AddAzureServiceBusClient("messaging");

playground/AzureFunctionsEndToEnd/AzureFunctionsEndToEnd.AppHost/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
builder.AddAzureContainerAppEnvironment("env");
44

55
var storage = builder.AddAzureStorage("storage").RunAsEmulator();
6-
var queue = storage.AddQueues("queue");
7-
var blob = storage.AddBlobs("blob");
8-
var myBlobContainer = blob.AddBlobContainer("myblobcontainer");
6+
var queue = storage.AddQueueService("queue");
7+
var blob = storage.AddBlobService("blob");
8+
var myBlobContainer = storage.AddBlobContainer("myblobcontainer");
99

1010
var eventHub = builder.AddAzureEventHubs("eventhubs")
1111
.RunAsEmulator()
@@ -24,11 +24,11 @@
2424
var funcApp = builder.AddAzureFunctionsProject<Projects.AzureFunctionsEndToEnd_Functions>("funcapp")
2525
.WithExternalHttpEndpoints()
2626
.WithReference(eventHub).WaitFor(eventHub)
27-
.WithReference(myBlobContainer).WaitFor(myBlobContainer)
2827
#if !SKIP_UNSTABLE_EMULATORS
2928
.WithReference(serviceBus).WaitFor(serviceBus)
3029
.WithReference(cosmosDb).WaitFor(cosmosDb)
3130
#endif
31+
.WithReference(myBlobContainer).WaitFor(myBlobContainer)
3232
.WithReference(blob)
3333
.WithReference(queue);
3434

playground/AzureFunctionsEndToEnd/AzureFunctionsEndToEnd.Functions/MyAzureBlobTrigger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace AzureFunctionsEndToEnd.Functions;
66

7-
public class MyAzureBlobTrigger(ILogger<MyAzureBlobTrigger> logger, BlobContainerClient containerClient)
7+
public class MyAzureBlobTrigger(BlobContainerClient containerClient, ILogger<MyAzureBlobTrigger> logger)
88
{
99
[Function(nameof(MyAzureBlobTrigger))]
1010
[BlobOutput("test-files/{name}.txt", Connection = "blob")]

playground/AzureFunctionsEndToEnd/AzureFunctionsEndToEnd.Functions/MyAzureQueueTrigger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class MyAzureQueueTrigger(ILogger<MyAzureQueueTrigger> logger)
88
{
99
[Function(nameof(MyAzureQueueTrigger))]
1010
public void Run([QueueTrigger("queue", Connection = "queue")] QueueMessage message)
11-
{
11+
{
1212
logger.LogInformation("C# Queue trigger function processed: {Text}", message.MessageText);
1313
}
1414
}

0 commit comments

Comments
 (0)