# NatsServerResource

- Kind: `class`
- Package: [Aspire.Hosting.Nats](/reference/api/csharp/aspire.hosting.nats.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs)
- Inherits: `ContainerResource`
- Implements: `IExpressionValue`, `IManifestExpressionProvider`, `IResource`, `IResourceWithConnectionString`, `IValueProvider`, `IValueWithReferences`

A resource that represents a NATS server container.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public class NatsServerResource
    : Aspire.Hosting.ApplicationModel.ContainerResource,
      Aspire.Hosting.ApplicationModel.IExpressionValue,
      Aspire.Hosting.ApplicationModel.IManifestExpressionProvider,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithConnectionString,
      Aspire.Hosting.ApplicationModel.IValueProvider,
      Aspire.Hosting.ApplicationModel.IValueWithReferences
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Nats/NatsServerResource`

## Constructors

- [NatsServerResource(string)](/reference/api/csharp/aspire.hosting.nats/natsserverresource/constructors.md#constructor-string) -- A resource that represents a NATS server container.
- [NatsServerResource(string, ParameterResource?, ParameterResource?)](/reference/api/csharp/aspire.hosting.nats/natsserverresource/constructors.md#constructor-string-parameterresource-parameterresource) -- Initializes a new instance of the [NatsServerResource](/reference/api/csharp/aspire.hosting.nats/natsserverresource.md) class.

## Properties

- [ConnectionStringExpression](/reference/api/csharp/aspire.hosting.nats/natsserverresource/properties.md#connectionstringexpression) : `ReferenceExpression` `get` -- Gets the connection string expression for the NATS server.
- [Host](/reference/api/csharp/aspire.hosting.nats/natsserverresource/properties.md#host) : `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- [PasswordParameter](/reference/api/csharp/aspire.hosting.nats/natsserverresource/properties.md#passwordparameter) : `ParameterResource?` `get; set` -- Gets or sets the password for the NATS server.
- [Port](/reference/api/csharp/aspire.hosting.nats/natsserverresource/properties.md#port) : `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- [PrimaryEndpoint](/reference/api/csharp/aspire.hosting.nats/natsserverresource/properties.md#primaryendpoint) : `EndpointReference` `get` -- Gets the primary endpoint for the NATS server.
- [UriExpression](/reference/api/csharp/aspire.hosting.nats/natsserverresource/properties.md#uriexpression) : `ReferenceExpression` `get` -- Gets the connection URI expression for the NATS server.
- [UserNameParameter](/reference/api/csharp/aspire.hosting.nats/natsserverresource/properties.md#usernameparameter) : `ParameterResource?` `get; set` -- Gets or sets the user name for the NATS server.
- [UserNameReference](/reference/api/csharp/aspire.hosting.nats/natsserverresource/properties.md#usernamereference) : `ReferenceExpression` `get` -- Gets a reference to the user name for the NATS server.
