# NatsServerResource

- Module: [Aspire.Hosting.Nats](/reference/api/go/aspire.hosting.nats.md)
- Version: `17.0.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

A resource that represents a NATS server container.

## Definition

```go
type NatsServerResource interface {
    ExpressionValue
    IComputeResource
    Resource
    ResourceWithArgs
    ResourceWithConnectionString
    ResourceWithEndpoints
    ResourceWithEnvironment
    ResourceWithWaitSupport
}
```

## Embeds

- `ExpressionValue`
- `IComputeResource`
- `Resource`
- `ResourceWithArgs`
- `ResourceWithConnectionString`
- `ResourceWithEndpoints`
- `ResourceWithEnvironment`
- `ResourceWithWaitSupport`

## Properties

- `ConnectionStringExpression`: `*ReferenceExpression` `get` -- Gets the connection string expression for the NATS server.
- `Host`: `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- `PasswordParameter`: `ParameterResource` `get/set` -- Gets or sets the password for the NATS server.
- `Port`: `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- `PrimaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the NATS server.
- `ResourceTypeDisplayName`: `string` `get` -- Gets the ResourceTypeDisplayName property
- `UriExpression`: `*ReferenceExpression` `get` -- Gets the connection URI expression for the NATS server.
- `UserNameParameter`: `ParameterResource` `get/set` -- Gets or sets the user name for the NATS server.
- `UserNameReference`: `*ReferenceExpression` `get` -- Gets a reference to the user name for the NATS server.

## Methods

- [WithDataBindMount](/reference/api/go/aspire.hosting.nats/natsserverresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a NATS container resource.
  ```go
  WithDataBindMount(source string, options ...*WithDataBindMountOptions) NatsServerResource
  ```
- [WithDataVolume](/reference/api/go/aspire.hosting.nats/natsserverresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a NATS container resource.
  ```go
  WithDataVolume(options ...*WithDataVolumeOptions) NatsServerResource
  ```
- [WithJetStream](/reference/api/go/aspire.hosting.nats/natsserverresource/withjetstream.md) -- `method` -- Adds JetStream support to the NATS server resource.
  ```go
  WithJetStream() NatsServerResource
  ```
