-
Notifications
You must be signed in to change notification settings - Fork 761
Refactor Azure Storage API #10241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Refactor Azure Storage API #10241
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4b11a68
Add AddBlobContainer on AzureStorageResource
sebastienros 6ba4914
Add AddQueue
sebastienros bfb259e
Rename AzureQueueResource to AzureQueueStorageQueueResource
sebastienros 3592abb
Rename AddAzureQueueServiceClient to AddAzureQueueServiceClient
sebastienros a7294e7
More refactorings
sebastienros 70d6813
Rename obsolete methods
sebastienros 0e092a2
Fix tests
sebastienros cc1d744
Fix tests
sebastienros fd62642
Fix markdown
sebastienros c2d87c3
Add API diff
sebastienros e02db02
Add nameless storage resources
sebastienros 4428e56
Update API diff
sebastienros ee562f5
Update tables
sebastienros b146f5b
Update tests/Aspire.Hosting.Azure.Tests/AzureStorageExtensionsTests.cs
sebastienros bccded3
Some feedback work
sebastienros 04477e9
Revert functions playground changes
sebastienros 8b80c0c
Fix test
sebastienros 2ccc3c6
Fix storage playground app
sebastienros fd450c4
Use Regex to remove connection string property
sebastienros a0813f1
Merge remote-tracking branch 'origin/main' into sebros/storateapi
sebastienros 7cafd9c
Revert API diff changes
sebastienros 5b2a73f
Add bicep test
sebastienros c3d751e
Updated manifest
sebastienros File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/Aspire.Hosting.Azure.Storage/AzureQueueStorageQueueResource.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Runtime.CompilerServices; | ||
| using Aspire.Hosting.ApplicationModel; | ||
| using Azure.Provisioning; | ||
|
|
||
| namespace Aspire.Hosting.Azure; | ||
|
|
||
| /// <summary> | ||
| /// A resource that represents an Azure Storage Queue. | ||
| /// </summary> | ||
| /// <param name="name">The name of the resource.</param> | ||
| /// <param name="queueName">The name of the queue.</param> | ||
| /// <param name="parent">The <see cref="AzureQueueStorageResource"/> that the resource is stored in.</param> | ||
| public class AzureQueueStorageQueueResource(string name, string queueName, AzureQueueStorageResource parent) : Resource(name), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this (and blob container) implement |
||
| IResourceWithConnectionString, | ||
| IResourceWithParent<AzureQueueStorageResource> | ||
| { | ||
| /// <summary> | ||
| /// Gets the blob container name. | ||
| /// </summary> | ||
| public string QueueName { get; } = ThrowIfNullOrEmpty(queueName); | ||
|
|
||
| /// <summary> | ||
| /// Gets the connection string template for the manifest for the Azure Storage Queue resource. | ||
| /// </summary> | ||
| public ReferenceExpression ConnectionStringExpression => Parent.GetConnectionString(QueueName); | ||
|
|
||
| /// <summary> | ||
| /// Gets the parent <see cref="AzureQueueStorageResource"/> of this <see cref="AzureQueueStorageQueueResource"/>. | ||
| /// </summary> | ||
| public AzureQueueStorageResource Parent => parent ?? throw new ArgumentNullException(nameof(parent)); | ||
|
|
||
| /// <summary> | ||
| /// Converts the current instance to a provisioning entity. | ||
| /// </summary> | ||
| /// <returns>A <see cref="global::Azure.Provisioning.Storage.BlobContainer"/> instance.</returns> | ||
| internal global::Azure.Provisioning.Storage.StorageQueue ToProvisioningEntity() | ||
| { | ||
| global::Azure.Provisioning.Storage.StorageQueue queue = new(Infrastructure.NormalizeBicepIdentifier(Name)) | ||
| { | ||
| Name = QueueName | ||
| }; | ||
|
|
||
| return queue; | ||
| } | ||
|
|
||
| private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) | ||
| { | ||
| ArgumentException.ThrowIfNullOrEmpty(argument, paramName); | ||
| return argument; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.