MinioBuilderExtensions Methods
Class Methods 6 members
Provides extension methods for adding MinIO resources to an
Hosting.IDistributedApplicationBuilder. AddMinioContainer(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, int?) Section titled AddMinioContainer(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, int?) extension IResourceBuilder<MinioContainerResource> Adds a MinIO container to the application model. The default image is "minio/minio" and the tag is "latest".
public static class MinioBuilderExtensions{ public static IResourceBuilder<MinioContainerResource> AddMinioContainer( this IDistributedApplicationBuilder builder, string name, IResourceBuilder<ParameterResource>? rootUser = null, IResourceBuilder<ParameterResource>? rootPassword = null, int? port = null) { // ... }}Parameters
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder. name string The name of the resource. This name will be used as the connection string name when referenced in a dependency. rootUser IResourceBuilder<ParameterResource> optional The parameter used to provide the root user name for the MinIO resource. If null a default value will be used. rootPassword IResourceBuilder<ParameterResource> optional The parameter used to provide the administrator password for the MinIO resource. If null a random password will be generated. port int? optional The host port for MinIO. Returns
IResourceBuilder<MinioContainerResource> A reference to the ApplicationModel.IResourceBuilder`1. WithDataBindMount(IResourceBuilder<MinioContainerResource>, string) Section titled WithDataBindMount(IResourceBuilder<MinioContainerResource>, string) extension IResourceBuilder<MinioContainerResource> Adds a bind mount for the data folder to a MinIO container resource.
public static class MinioBuilderExtensions{ public static IResourceBuilder<MinioContainerResource> WithDataBindMount( this IResourceBuilder<MinioContainerResource> builder, string source) { // ... }}Parameters
builder IResourceBuilder<MinioContainerResource> The resource builder. source string The source directory on the host to mount into the container. Returns
IResourceBuilder<MinioContainerResource> The ApplicationModel.IResourceBuilder`1. Remarks
Add an MinIO container to the application model and reference it in a .NET project. Additionally, in this example a bind mount is added to the container to allow data to be persisted across container restarts.
var builder = DistributedApplication.CreateBuilder(args);
var minio = builder.AddMinio("minio").WithDataBindMount("./data/minio/data");var api = builder.AddProject<Projects.Api>("api") .WithReference(minio);
builder.Build().Run();WithDataVolume(IResourceBuilder<MinioContainerResource>, string?) Section titled WithDataVolume(IResourceBuilder<MinioContainerResource>, string?) extension IResourceBuilder<MinioContainerResource> Adds a named volume for the data folder to a MinIO container resource.
public static class MinioBuilderExtensions{ public static IResourceBuilder<MinioContainerResource> WithDataVolume( this IResourceBuilder<MinioContainerResource> builder, string? name = null) { // ... }}Parameters
builder IResourceBuilder<MinioContainerResource> The resource builder. name string? optional The name of the volume. Defaults to an auto-generated name based on the application and resource names. Returns
IResourceBuilder<MinioContainerResource> The ApplicationModel.IResourceBuilder`1. Remarks
Add an MinIO container to the application model and reference it in a .NET project. Additionally, in this example a data volume is added to the container to allow data to be persisted across container restarts.
var builder = DistributedApplication.CreateBuilder(args);
var minio = builder.AddMinio("minio").WithDataVolume();var api = builder.AddProject<Projects.Api>("api") .WithReference(minio);
builder.Build().Run();WithHostPort(IResourceBuilder<MinioContainerResource>, int?) Section titled WithHostPort(IResourceBuilder<MinioContainerResource>, int?) extension IResourceBuilder<MinioContainerResource> Configures the host port that the MinIO resource is exposed on instead of using randomly assigned port.
public static class MinioBuilderExtensions{ public static IResourceBuilder<MinioContainerResource> WithHostPort( this IResourceBuilder<MinioContainerResource> builder, int? port) { // ... }}Parameters
builder IResourceBuilder<MinioContainerResource> The resource builder for MinIO. port int? The port to bind on the host. If null is used, a random port will be assigned. Returns
IResourceBuilder<MinioContainerResource> The resource builder for MinIO. WithPassword(IResourceBuilder<MinioContainerResource>, IResourceBuilder<ParameterResource>) Section titled WithPassword(IResourceBuilder<MinioContainerResource>, IResourceBuilder<ParameterResource>) extension IResourceBuilder<MinioContainerResource> Configures the password that the MinIO resource is used.
public static class MinioBuilderExtensions{ public static IResourceBuilder<MinioContainerResource> WithPassword( this IResourceBuilder<MinioContainerResource> builder, IResourceBuilder<ParameterResource> password) { // ... }}Parameters
builder IResourceBuilder<MinioContainerResource> The resource builder. password IResourceBuilder<ParameterResource> The parameter used to provide the password for the MinIO resource. If null, no password will be configured. Returns
IResourceBuilder<MinioContainerResource> The ApplicationModel.IResourceBuilder`1. WithUserName(IResourceBuilder<MinioContainerResource>, IResourceBuilder<ParameterResource>) Section titled WithUserName(IResourceBuilder<MinioContainerResource>, IResourceBuilder<ParameterResource>) extension IResourceBuilder<MinioContainerResource> Configures the user name that the MinIO resource uses.
public static class MinioBuilderExtensions{ public static IResourceBuilder<MinioContainerResource> WithUserName( this IResourceBuilder<MinioContainerResource> builder, IResourceBuilder<ParameterResource> userName) { // ... }}Parameters
builder IResourceBuilder<MinioContainerResource> The resource builder. userName IResourceBuilder<ParameterResource> The parameter used to provide the user name for the MinIO resource. Returns
IResourceBuilder<MinioContainerResource> The ApplicationModel.IResourceBuilder`1.