Watch Aspire live streamsDocsTry Aspire

PostgresServerResource

Handle
📦 Aspire.Hosting.PostgreSQL v13.6.4
interface PostgresServerResource
extends IComputeResource,
IExpressionValue,
IManifestExpressionProvider,
IResource,
IResourceWithArgs,
IResourceWithConnectionString,
IResourceWithEndpoints,
IResourceWithEnvironment,
IResourceWithProbes,
IResourceWithWaitSupport,
IValueProvider,
IValueWithReferences {
readonly connectionStringExpression: ReferenceExpression;
readonly databases: Dict<string,string>;
readonly host: EndpointReferenceExpression;
readonly jdbcConnectionString: ReferenceExpression;
passwordParameter: ParameterResource;
readonly port: EndpointReferenceExpression;
readonly primaryEndpoint: EndpointReference;
readonly uriExpression: ReferenceExpression;
userNameParameter: ParameterResource;
readonly userNameReference: ReferenceExpression;
addDatabase(
name: string,
databaseName?: string): PostgresDatabaseResource;
withDataBindMount(
source: string,
isReadOnly?: boolean): PostgresServerResource;
withDataVolume(
name?: string,
isReadOnly?: boolean): PostgresServerResource;
withHostPort(port: number): PostgresServerResource;
withInitFiles(source: string): PostgresServerResource;
withPassword(password: ParameterResource): PostgresServerResource;
withPgAdmin(configureContainer?: (obj: PgAdminContainerResource) => Promise<void>, containerName?: string): PostgresServerResource;
withPgWeb(configureContainer?: (obj: PgWebContainerResource) => Promise<void>, containerName?: string): PostgresServerResource;
withRepl(): PostgresServerResource;
withUserName(userName: ParameterResource): PostgresServerResource;
}

Properties

propertyconnectionStringExpressionReferenceExpressionget
Gets the connection string expression for the PostgreSQL server.
propertydatabasesDict<string,string>get
A dictionary where the key is the resource name and the value is the database name.
propertyhostEndpointReferenceExpressionget
Gets the host endpoint reference for this service.
propertyjdbcConnectionStringReferenceExpressionget
Gets the JDBC connection string for the PostgreSQL server.
propertypasswordParameterParameterResourceget · set
Gets or sets the parameter that contains the PostgreSQL server password.
propertyportEndpointReferenceExpressionget
Gets the endpoint reference expression that identifies the port for this endpoint.
propertyprimaryEndpointEndpointReferenceget
Gets the primary endpoint for the PostgreSQL server.
propertyuriExpressionReferenceExpressionget
Gets the connection URI expression for the PostgreSQL server.
propertyuserNameParameterParameterResourceget · set
Gets or sets the parameter that contains the PostgreSQL server user name.
propertyuserNameReferenceReferenceExpressionget
Gets a reference to the user name for the PostgreSQL server.

Methods

methodaddDatabasebuilder
Adds a PostgreSQL database to the application model.
addDatabase(
name: string,
databaseName?: string): PostgresDatabaseResource
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
databaseNamestringoptionalThe name of the database. If not provided, this defaults to the same value as `name`.
PostgresDatabaseResource
methodwithDataBindMountbuilder
Adds a bind mount for the data folder to a PostgreSQL container resource.
withDataBindMount(
source: string,
isReadOnly?: boolean): PostgresServerResource
sourcestringThe source directory on the host to mount into the container.
isReadOnlybooleanoptional= FalseA flag that indicates if this is a read-only mount.
PostgresServerResource
methodwithDataVolumebuilder
Adds a named volume for the data folder to a PostgreSQL container resource.
withDataVolume(
name?: string,
isReadOnly?: boolean): PostgresServerResource
namestringoptionalThe name of the volume. Defaults to an auto-generated name based on the application and resource names.
isReadOnlybooleanoptional= FalseA flag that indicates if this is a read-only volume.
PostgresServerResource
methodwithHostPortbuilder
Configures the host port that the PostgreSQL resource is exposed on instead of using randomly assigned port.
withHostPort(port: number): PostgresServerResource
portnumberThe port to bind on the host. If `null` is used random port will be assigned.
PostgresServerResource
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
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
methodwithPgAdminbuilder
Adds a pgAdmin 4 administration and development platform for PostgreSQL to the application model.
withPgAdmin(configureContainer?: (obj: PgAdminContainerResource) => Promise<void>, containerName?: string): PostgresServerResource
configureContainer(obj: PgAdminContainerResource) => Promise<void>optionalCallback to configure PgAdmin container resource.
containerNamestringoptionalThe name of the container (Optional).
PostgresServerResource
methodwithPgWebbuilder
Adds an administration and development platform for PostgreSQL to the application model using pgweb.
withPgWeb(configureContainer?: (obj: PgWebContainerResource) => Promise<void>, containerName?: string): PostgresServerResource
configureContainer(obj: PgWebContainerResource) => Promise<void>optionalConfiguration callback for pgweb container resource.
containerNamestringoptionalThe name of the container (Optional).
PostgresServerResource
methodwithReplbuilder
Adds a REPL command that opens an authenticated PostgreSQL shell in the dashboard terminal dock.
withRepl(): PostgresServerResource
PostgresServerResource
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