Skip to content
DocsTry Aspire
DocsTry

RustFsBuilderExtensions Methods

ClassMethods6 members
Provides extension methods for adding RustFs resources to an Hosting.IDistributedApplicationBuilder.
AddBucket(IResourceBuilder<RustFsResource>, string)Section titled AddBucket(IResourceBuilder<RustFsResource>, string)extensionIResourceBuilder<RustFsBucketResource>
Adds a bucket to the RustFs resource. The bucket is created by issuing a signed PUT request to the RustFs S3 API after the server resource becomes ready.
public static class RustFsBuilderExtensions
{
public static IResourceBuilder<RustFsBucketResource> AddBucket(
this IResourceBuilder<RustFsResource> builder,
string bucketName)
{
// ...
}
}
builderIResourceBuilder<RustFsResource>The resource builder.
bucketNamestringThe name of the bucket to create.
IResourceBuilder<RustFsBucketResource>A reference to the ApplicationModel.IResourceBuilder`1 for the bucket resource.
AddBucket(IResourceBuilder<RustFsResource>, IReadOnlyList<string>)Section titled AddBucket(IResourceBuilder<RustFsResource>, IReadOnlyList<string>)extensionIResourceBuilder<RustFsResource>
Adds multiple buckets to the RustFs resource. Each bucket is registered as its own RustFsBucketResource child resource and created via the RustFs S3 API once the server resource becomes ready.
public static class RustFsBuilderExtensions
{
public static IResourceBuilder<RustFsResource> AddBucket(
this IResourceBuilder<RustFsResource> builder,
IReadOnlyList<string> bucketNames)
{
// ...
}
}
builderIResourceBuilder<RustFsResource>The resource builder.
bucketNamesIReadOnlyList<string>The names of the buckets to create.
IResourceBuilder<RustFsResource>The original ApplicationModel.IResourceBuilder`1 for further chaining.
AddRustFs(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, int?, int?)Section titled AddRustFs(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, int?, int?)extensionIResourceBuilder<RustFsResource>
Adds a RustFs container to the application model. The default image is "rustfs/rustfs".
public static class RustFsBuilderExtensions
{
public static IResourceBuilder<RustFsResource> AddRustFs(
this IDistributedApplicationBuilder builder,
string name,
IResourceBuilder<ParameterResource>? accessKey = null,
IResourceBuilder<ParameterResource>? secretKey = null,
int? port = null,
int? consolePort = null)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder.
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
accessKeyIResourceBuilder<ParameterResource>optionalThe parameter used to provide the access key for the RustFs resource. If null a random key will be generated.
secretKeyIResourceBuilder<ParameterResource>optionalThe parameter used to provide the secret key for the RustFs resource. If null a random key will be generated.
portint?optionalThe host port for the RustFs S3-compatible API endpoint.
consolePortint?optionalThe host port for the RustFs console endpoint.
IResourceBuilder<RustFsResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithDataBindMount(IResourceBuilder<RustFsResource>, string)Section titled WithDataBindMount(IResourceBuilder<RustFsResource>, string)extensionIResourceBuilder<RustFsResource>
Adds a bind mount for the data folder to a RustFs container resource.
public static class RustFsBuilderExtensions
{
public static IResourceBuilder<RustFsResource> WithDataBindMount(
this IResourceBuilder<RustFsResource> builder,
string source)
{
// ...
}
}
builderIResourceBuilder<RustFsResource>The resource builder.
sourcestringThe source directory on the host to mount into the container.
IResourceBuilder<RustFsResource>The ApplicationModel.IResourceBuilder`1.
Add a RustFs 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 rustfs = builder.AddRustFs("rustfs")
.WithDataBindMount("./data/rustfs/data");
var api = builder.AddProject<Projects.Api>("api")
.WithReference(rustfs);
builder.Build().Run();
WithDataVolume(IResourceBuilder<RustFsResource>, string?)Section titled WithDataVolume(IResourceBuilder<RustFsResource>, string?)extensionIResourceBuilder<RustFsResource>
Adds a named volume for the data folder to a RustFs container resource.
public static class RustFsBuilderExtensions
{
public static IResourceBuilder<RustFsResource> WithDataVolume(
this IResourceBuilder<RustFsResource> builder,
string? name = null)
{
// ...
}
}
builderIResourceBuilder<RustFsResource>The resource builder.
namestring?optionalThe name of the volume. Defaults to an auto-generated name based on the application and resource names.
IResourceBuilder<RustFsResource>The ApplicationModel.IResourceBuilder`1.
Add a RustFs 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 rustfs = builder.AddRustFs("rustfs")
.WithDataVolume();
var api = builder.AddProject<Projects.Api>("api")
.WithReference(rustfs);
builder.Build().Run();
WithSigningRegion(IResourceBuilder<RustFsResource>, string)Section titled WithSigningRegion(IResourceBuilder<RustFsResource>, string)extensionIResourceBuilder<RustFsResource>
Sets the AWS signing region used when creating buckets via the S3 API. Defaults to us-east-1 if not specified.
public static class RustFsBuilderExtensions
{
public static IResourceBuilder<RustFsResource> WithSigningRegion(
this IResourceBuilder<RustFsResource> builder,
string region)
{
// ...
}
}
builderIResourceBuilder<RustFsResource>The resource builder.
regionstringThe AWS signing region (e.g. us-east-1, ap-northeast-1).
IResourceBuilder<RustFsResource>The ApplicationModel.IResourceBuilder`1.