-
Notifications
You must be signed in to change notification settings - Fork 158
Add Minio hosting/client integration #691
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
aaronpowell
merged 18 commits into
CommunityToolkit:main
from
Harold-Morgan:minio_integration
Jun 6, 2025
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6ed2fa2
Minio integration raw draft
Harold-Morgan 7f9cead
Tests draft
Harold-Morgan f556a63
Refinement + project structure + tests
Harold-Morgan 8038e30
Documentation draft
Harold-Morgan a3cba12
Tests added to tests.yaml
Harold-Morgan 28f7542
Fix ubuntu build
Harold-Morgan 20e93db
README.md final draft
Harold-Morgan 53e1a5c
DataVolume api added
Harold-Morgan 7178b44
Password/user/port parameters api changed
Harold-Morgan d625e3b
Update src/CommunityToolkit.Aspire.Hosting.Minio/MinioContainerResour…
davidfowl 19f7e27
Randomize ports fxd + new healthcheck
Harold-Morgan c1b1a7c
Fix tests
Harold-Morgan 8ca5d91
Fix slnx support
Harold-Morgan 67b09bf
Naming inconsistency fxd
Harold-Morgan d860634
Update src/CommunityToolkit.Aspire.Minio.Client/README.md
Harold-Morgan 11557a9
Apiservice test timeout
Harold-Morgan 90a326e
ApiServiceCreateData test now checks file upload/download result
Harold-Morgan e7b0f70
MinioContainerResource.cs class structure revamped
Harold-Morgan 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
Password/user/port parameters api changed
- Loading branch information
commit 7178b44cd867020312c9c4c54cc286e30ab66098
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,27 +3,33 @@ | |
| /// <summary> | ||
| /// A resource that represents a MiniO storage | ||
| /// </summary> | ||
| /// <param name="name">The name of the resource</param> | ||
| /// <param name="rootUser"> A parameter that contains the MiniO server admin user name, or null to</param> | ||
| /// <param name="rootPassword"> A parameter that contains the Minio server admin password</param> | ||
| public sealed class MinioContainerResource( | ||
| string name, | ||
| ParameterResource rootUser, | ||
| ParameterResource rootPassword) : ContainerResource(name), | ||
| IResourceWithConnectionString | ||
| public sealed class MinioContainerResource : ContainerResource, IResourceWithConnectionString | ||
| { | ||
| internal const string PrimaryEndpointName = "http"; | ||
| internal const string ConsoleEndpointName = "console"; | ||
| internal const string DefaultUserName = "minioadmin"; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MinioContainerResource"/> class. | ||
| /// </summary> | ||
| /// <param name="name">The name of the resource.</param> | ||
| /// <param name="user">A parameter that contains the Minio server root user name.</param> | ||
| /// <param name="password">A parameter that contains the Minio server root password.</param> | ||
| public MinioContainerResource(string name, ParameterResource user, ParameterResource password) : base(name) | ||
| { | ||
| RootUser = user; | ||
| PasswordParameter = password; | ||
| } | ||
|
||
|
|
||
| /// <summary> | ||
| /// The MiniO root user. | ||
| /// </summary> | ||
| public ParameterResource RootUser { get; set; } = rootUser; | ||
| public ParameterResource RootUser { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The MiniO root password. | ||
| /// </summary> | ||
| public ParameterResource RootPassword { get; } = rootPassword; | ||
| public ParameterResource PasswordParameter { get; set; } | ||
|
|
||
| private EndpointReference? _primaryEndpoint; | ||
|
|
||
|
|
@@ -36,17 +42,40 @@ public sealed class MinioContainerResource( | |
| /// Gets the connection string expression for the Minio | ||
| /// </summary> | ||
| public ReferenceExpression ConnectionStringExpression => GetConnectionString(); | ||
|
|
||
|
|
||
| /// <summary> | ||
| /// Gets the connection string for the MiniO server. | ||
| /// </summary> | ||
| /// <param name="cancellationToken"> A <see cref="CancellationToken"/> to observe while waiting for the task to complete.</param> | ||
| /// <returns>A connection string for the PostgreSQL server in the form "Host=host;Port=port;Username=postgres;Password=password".</returns> | ||
| public ValueTask<string?> GetConnectionStringAsync(CancellationToken cancellationToken = default) | ||
| { | ||
| if (this.TryGetLastAnnotation<ConnectionStringRedirectAnnotation>(out var connectionStringAnnotation)) | ||
| { | ||
| return connectionStringAnnotation.Resource.GetConnectionStringAsync(cancellationToken); | ||
| } | ||
|
|
||
| return ConnectionStringExpression.GetValueAsync(cancellationToken); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the connection string for the MiniO server. | ||
| /// </summary> | ||
| private ReferenceExpression GetConnectionString() | ||
| { | ||
| var builder = new ReferenceExpressionBuilder(); | ||
|
|
||
| builder.Append( | ||
| $"Endpoint=http://{PrimaryEndpoint.Property(EndpointProperty.Host)}:{PrimaryEndpoint.Property(EndpointProperty.Port)}"); | ||
|
|
||
| builder.Append($";AccessKey={RootUser.Value}"); | ||
| builder.Append($";SecretKey={RootPassword.Value}"); | ||
| builder.Append($";SecretKey={PasswordParameter.Value}"); | ||
|
|
||
| return builder.Build(); | ||
| } | ||
|
|
||
| internal void SetPassword(ParameterResource password) | ||
| { | ||
| PasswordParameter = password; | ||
| } | ||
aaronpowell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
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
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.