Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

PostgresServerResource

Handle
📦 Aspire.Hosting.PostgreSQL v17.0.0

A resource that represents a PostgreSQL container.

type PostgresServerResource interface {
ExpressionValue
IComputeResource
Resource
ResourceWithArgs
ResourceWithConnectionString
ResourceWithEndpoints
ResourceWithEnvironment
ResourceWithWaitSupport
}

Properties

propertyConnectionStringExpression*ReferenceExpressionget
Gets the connection string expression for the PostgreSQL server.
ConnectionStringExpression() *ReferenceExpression
propertyDatabasesmap[string]stringget
A dictionary where the key is the resource name and the value is the database name.
Databases() (map[string]string, error)
propertyHostEndpointReferenceExpressionget
Gets the host endpoint reference for this service.
Host() EndpointReferenceExpression
propertyJdbcConnectionString*ReferenceExpressionget
Gets the JDBC connection string for the PostgreSQL server.
JdbcConnectionString() *ReferenceExpression
propertyPasswordParameterParameterResourceget · set
Gets or sets the parameter that contains the PostgreSQL server password.
PasswordParameter() ParameterResource
SetPasswordParameter(value ParameterResource) PostgresServerResource
propertyPortEndpointReferenceExpressionget
Gets the endpoint reference expression that identifies the port for this endpoint.
Port() EndpointReferenceExpression
propertyPrimaryEndpointEndpointReferenceget
Gets the primary endpoint for the PostgreSQL server.
PrimaryEndpoint() EndpointReference
propertyResourceTypeDisplayNamestringget
Gets the ResourceTypeDisplayName property
ResourceTypeDisplayName() (string, error)
propertyUriExpression*ReferenceExpressionget
Gets the connection URI expression for the PostgreSQL server.
UriExpression() *ReferenceExpression
propertyUserNameParameterParameterResourceget · set
Gets or sets the parameter that contains the PostgreSQL server user name.
UserNameParameter() ParameterResource
SetUserNameParameter(value ParameterResource) PostgresServerResource
propertyUserNameReference*ReferenceExpressionget
Gets a reference to the user name for the PostgreSQL server.
UserNameReference() *ReferenceExpression

Methods

methodAddDatabasebuilder
Adds a PostgreSQL database to the application model.
AddDatabase(
name string,
options ...*AddDatabaseOptions,
) PostgresDatabaseResource
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
options...*AddDatabaseOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*AddDatabaseOptions argument.

DatabaseName*stringThe name of the database. If not provided, this defaults to the same value as name.
PostgresDatabaseResource

The resource builder.

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

methodWithDataBindMountbuilder
Adds a bind mount for the data folder to a PostgreSQL container resource.
WithDataBindMount(
source string,
options ...*WithDataBindMountOptions,
) PostgresServerResource
sourcestringThe source directory on the host to mount into the container.
options...*WithDataBindMountOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithDataBindMountOptions argument.

IsReadOnly*boolA flag that indicates if this is a read-only mount.
PostgresServerResource

The resource builder.

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

methodWithDataVolumebuilder
Adds a named volume for the data folder to a PostgreSQL container resource.
WithDataVolume(options ...*WithDataVolumeOptions) PostgresServerResource
options...*WithDataVolumeOptionsOptional settings, described under Options.

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

Name*stringThe name of the volume. Defaults to an auto-generated name based on the application and resource names.
IsReadOnly*boolA flag that indicates if this is a read-only volume.
PostgresServerResource

The resource builder.

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

methodWithHostPortbuilder
Configures the host port that the PostgreSQL resource is exposed on instead of using randomly assigned port.
WithHostPort(port *float64) PostgresServerResource
port*float64The port to bind on the host. If null is used random port will be assigned.
PostgresServerResource

The resource builder.

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

methodWithInitFilesbuilder
Copies init files to a PostgreSQL container resource.
WithInitFiles(source string) PostgresServerResource
sourcestringThe source directory or files on the host to copy into the container.
PostgresServerResource

The resource builder.

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

methodWithPasswordbuilder
Configures the password that the PostgreSQL resource is used.
WithPassword(password ParameterResource) PostgresServerResource
passwordParameterResourceThe parameter used to provide the password for the PostgreSQL resource.
PostgresServerResource

The resource builder.

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

methodWithPgAdminbuilder
Adds a pgAdmin 4 administration and development platform for PostgreSQL to the application model.
WithPgAdmin(options ...*WithPgAdminOptions) PostgresServerResource
options...*WithPgAdminOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithPgAdminOptions argument.

ConfigureContainerfunc(obj PgAdminContainerResource)callbackCallback to configure PgAdmin container resource.
ContainerName*stringThe name of the container (Optional).
PostgresServerResource

The resource builder.

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

methodWithPgWebbuilder
Adds an administration and development platform for PostgreSQL to the application model using pgweb.
WithPgWeb(options ...*WithPgWebOptions) PostgresServerResource
options...*WithPgWebOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithPgWebOptions argument.

ConfigureContainerfunc(obj PgWebContainerResource)callbackConfiguration callback for pgweb container resource.
ContainerName*stringThe name of the container (Optional).
PostgresServerResource

The resource builder.

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

methodWithReplbuilder
Adds a REPL command that opens an authenticated PostgreSQL shell in the dashboard terminal dock.
WithRepl() PostgresServerResource
PostgresServerResource

The resource builder for chaining.

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

methodWithUserNamebuilder
Configures the user name that the PostgreSQL resource is used.
WithUserName(userName ParameterResource) PostgresServerResource
userNameParameterResourceThe parameter used to provide the user name for the PostgreSQL resource.
PostgresServerResource

The resource builder.

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