# RustFsResource.WithDataVolume

- Module: [CommunityToolkit.Aspire.Hosting.RustFs](/reference/api/go/communitytoolkit.aspire.hosting.rustfs.md)
- Defined on: [RustFsResource](/reference/api/go/communitytoolkit.aspire.hosting.rustfs/rustfsresource.md)
- Version: `13.6.1`
- Kind: `method`

Adds a named volume for the data folder to a RustFs container resource.

## Remarks

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();
```

## Definition

```go
type RustFsResource interface {
    // ... omitted for brevity
    WithDataVolume(options ...*WithDataVolumeOptions) RustFsResource
}
```

## Signature

```go
WithDataVolume(options ...*WithDataVolumeOptions) RustFsResource
```

## Parameters

- `options` (`...*WithDataVolumeOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithDataVolumeOptions` argument.

- `Name` (`*string`) -- The name of the volume. Defaults to an auto-generated name based on the application and resource names.

## Returns

[`RustFsResource`](/reference/api/go/communitytoolkit.aspire.hosting.rustfs/rustfsresource.md) -- The `IResourceBuilder`.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [RustFsResource](/reference/api/go/communitytoolkit.aspire.hosting.rustfs/rustfsresource.md) -- `handle`
