Viewing docs for UpCloud v0.12.0
published on Saturday, Mar 21, 2026 by UpCloudLtd
published on Saturday, Mar 21, 2026 by UpCloudLtd
Viewing docs for UpCloud v0.12.0
published on Saturday, Mar 21, 2026 by UpCloudLtd
published on Saturday, Mar 21, 2026 by UpCloudLtd
Current sessions of a PostgreSQL managed database
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as upcloud from "@upcloud/pulumi-upcloud";
// Use data source to gather a list of the active sessions for a Managed PostgreSQL Database
// Create a Managed PostgreSQL resource
const exampleManagedDatabasePostgresql = new upcloud.ManagedDatabasePostgresql("example", {
name: "mysql-example1",
title: "mysql-example1",
plan: "1x1xCPU-2GB-25GB",
zone: "fi-hel1",
});
// Read the active sessions of the newly created service
const example = upcloud.getManagedDatabasePostgresqlSessionsOutput({
service: exampleManagedDatabasePostgresql.id,
});
import pulumi
import pulumi_upcloud as upcloud
# Use data source to gather a list of the active sessions for a Managed PostgreSQL Database
# Create a Managed PostgreSQL resource
example_managed_database_postgresql = upcloud.ManagedDatabasePostgresql("example",
name="mysql-example1",
title="mysql-example1",
plan="1x1xCPU-2GB-25GB",
zone="fi-hel1")
# Read the active sessions of the newly created service
example = upcloud.get_managed_database_postgresql_sessions_output(service=example_managed_database_postgresql.id)
package main
import (
"github.com/UpCloudLtd/pulumi-upcloud/sdk/go/upcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Use data source to gather a list of the active sessions for a Managed PostgreSQL Database
// Create a Managed PostgreSQL resource
exampleManagedDatabasePostgresql, err := upcloud.NewManagedDatabasePostgresql(ctx, "example", &upcloud.ManagedDatabasePostgresqlArgs{
Name: pulumi.String("mysql-example1"),
Title: pulumi.String("mysql-example1"),
Plan: pulumi.String("1x1xCPU-2GB-25GB"),
Zone: pulumi.String("fi-hel1"),
})
if err != nil {
return err
}
// Read the active sessions of the newly created service
_ = upcloud.GetManagedDatabasePostgresqlSessionsOutput(ctx, upcloud.GetManagedDatabasePostgresqlSessionsOutputArgs{
Service: exampleManagedDatabasePostgresql.ID(),
}, nil)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using UpCloud = UpCloud.Pulumi.UpCloud;
return await Deployment.RunAsync(() =>
{
// Use data source to gather a list of the active sessions for a Managed PostgreSQL Database
// Create a Managed PostgreSQL resource
var exampleManagedDatabasePostgresql = new UpCloud.ManagedDatabasePostgresql("example", new()
{
Name = "mysql-example1",
Title = "mysql-example1",
Plan = "1x1xCPU-2GB-25GB",
Zone = "fi-hel1",
});
// Read the active sessions of the newly created service
var example = UpCloud.GetManagedDatabasePostgresqlSessions.Invoke(new()
{
Service = exampleManagedDatabasePostgresql.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.upcloud.ManagedDatabasePostgresql;
import com.pulumi.upcloud.ManagedDatabasePostgresqlArgs;
import com.pulumi.upcloud.UpcloudFunctions;
import com.pulumi.upcloud.inputs.GetManagedDatabasePostgresqlSessionsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Use data source to gather a list of the active sessions for a Managed PostgreSQL Database
// Create a Managed PostgreSQL resource
var exampleManagedDatabasePostgresql = new ManagedDatabasePostgresql("exampleManagedDatabasePostgresql", ManagedDatabasePostgresqlArgs.builder()
.name("mysql-example1")
.title("mysql-example1")
.plan("1x1xCPU-2GB-25GB")
.zone("fi-hel1")
.build());
// Read the active sessions of the newly created service
final var example = UpcloudFunctions.getManagedDatabasePostgresqlSessions(GetManagedDatabasePostgresqlSessionsArgs.builder()
.service(exampleManagedDatabasePostgresql.id())
.build());
}
}
resources:
# Use data source to gather a list of the active sessions for a Managed PostgreSQL Database
# Create a Managed PostgreSQL resource
exampleManagedDatabasePostgresql:
type: upcloud:ManagedDatabasePostgresql
name: example
properties:
name: mysql-example1
title: mysql-example1
plan: 1x1xCPU-2GB-25GB
zone: fi-hel1
variables:
# Read the active sessions of the newly created service
example:
fn::invoke:
function: upcloud:getManagedDatabasePostgresqlSessions
arguments:
service: ${exampleManagedDatabasePostgresql.id}
Using getManagedDatabasePostgresqlSessions
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getManagedDatabasePostgresqlSessions(args: GetManagedDatabasePostgresqlSessionsArgs, opts?: InvokeOptions): Promise<GetManagedDatabasePostgresqlSessionsResult>
function getManagedDatabasePostgresqlSessionsOutput(args: GetManagedDatabasePostgresqlSessionsOutputArgs, opts?: InvokeOptions): Output<GetManagedDatabasePostgresqlSessionsResult>def get_managed_database_postgresql_sessions(limit: Optional[int] = None,
offset: Optional[int] = None,
order: Optional[str] = None,
service: Optional[str] = None,
sessions: Optional[Sequence[GetManagedDatabasePostgresqlSessionsSession]] = None,
opts: Optional[InvokeOptions] = None) -> GetManagedDatabasePostgresqlSessionsResult
def get_managed_database_postgresql_sessions_output(limit: Optional[pulumi.Input[int]] = None,
offset: Optional[pulumi.Input[int]] = None,
order: Optional[pulumi.Input[str]] = None,
service: Optional[pulumi.Input[str]] = None,
sessions: Optional[pulumi.Input[Sequence[pulumi.Input[GetManagedDatabasePostgresqlSessionsSessionArgs]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetManagedDatabasePostgresqlSessionsResult]func GetManagedDatabasePostgresqlSessions(ctx *Context, args *GetManagedDatabasePostgresqlSessionsArgs, opts ...InvokeOption) (*GetManagedDatabasePostgresqlSessionsResult, error)
func GetManagedDatabasePostgresqlSessionsOutput(ctx *Context, args *GetManagedDatabasePostgresqlSessionsOutputArgs, opts ...InvokeOption) GetManagedDatabasePostgresqlSessionsResultOutput> Note: This function is named GetManagedDatabasePostgresqlSessions in the Go SDK.
public static class GetManagedDatabasePostgresqlSessions
{
public static Task<GetManagedDatabasePostgresqlSessionsResult> InvokeAsync(GetManagedDatabasePostgresqlSessionsArgs args, InvokeOptions? opts = null)
public static Output<GetManagedDatabasePostgresqlSessionsResult> Invoke(GetManagedDatabasePostgresqlSessionsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetManagedDatabasePostgresqlSessionsResult> getManagedDatabasePostgresqlSessions(GetManagedDatabasePostgresqlSessionsArgs args, InvokeOptions options)
public static Output<GetManagedDatabasePostgresqlSessionsResult> getManagedDatabasePostgresqlSessions(GetManagedDatabasePostgresqlSessionsArgs args, InvokeOptions options)
fn::invoke:
function: upcloud:index/getManagedDatabasePostgresqlSessions:getManagedDatabasePostgresqlSessions
arguments:
# arguments dictionaryThe following arguments are supported:
getManagedDatabasePostgresqlSessions Result
The following output properties are available:
Supporting Types
GetManagedDatabasePostgresqlSessionsSession
- Application
Name string - Name of the application that is connected to this service.
- Backend
Start string - Time when this process was started, i.e., when the client connected to the server.
- Backend
Type string - Type of current service.
- Backend
Xid int - Top-level transaction identifier of this service, if any.
- Backend
Xmin int - The current service's xmin horizon.
- Client
Addr string - IP address of the client connected to this service. If this field is null, it indicates either that the client is connected via a Unix socket on the server machine or that this is an internal process such as autovacuum.
- Client
Hostname string - Host name of the connected client, as reported by a reverse DNS lookup of
client_addr. - Client
Port int - TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
- Datid int
- OID of the database this service is connected to.
- Datname string
- Name of the database this service is connected to.
- Id string
- Process ID of this service.
- Query string
- Text of this service's most recent query. If state is active this field shows the currently executing query. In all other states, it shows the last query that was executed.
- Query
Duration string - The active query current duration.
- Query
Start string - Time when the currently active query was started, or if state is not active, when the last query was started.
- State string
- Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
- State
Change string - Time when the state was last changed.
- Usename string
- Name of the user logged into this service.
- Usesysid int
- OID of the user logged into this service.
- Wait
Event string - Wait event name if service is currently waiting.
- Wait
Event stringType - The type of event for which the service is waiting, if any; otherwise NULL.
- Xact
Start string - Time when this process' current transaction was started, or null if no transaction is active.
- Application
Name string - Name of the application that is connected to this service.
- Backend
Start string - Time when this process was started, i.e., when the client connected to the server.
- Backend
Type string - Type of current service.
- Backend
Xid int - Top-level transaction identifier of this service, if any.
- Backend
Xmin int - The current service's xmin horizon.
- Client
Addr string - IP address of the client connected to this service. If this field is null, it indicates either that the client is connected via a Unix socket on the server machine or that this is an internal process such as autovacuum.
- Client
Hostname string - Host name of the connected client, as reported by a reverse DNS lookup of
client_addr. - Client
Port int - TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
- Datid int
- OID of the database this service is connected to.
- Datname string
- Name of the database this service is connected to.
- Id string
- Process ID of this service.
- Query string
- Text of this service's most recent query. If state is active this field shows the currently executing query. In all other states, it shows the last query that was executed.
- Query
Duration string - The active query current duration.
- Query
Start string - Time when the currently active query was started, or if state is not active, when the last query was started.
- State string
- Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
- State
Change string - Time when the state was last changed.
- Usename string
- Name of the user logged into this service.
- Usesysid int
- OID of the user logged into this service.
- Wait
Event string - Wait event name if service is currently waiting.
- Wait
Event stringType - The type of event for which the service is waiting, if any; otherwise NULL.
- Xact
Start string - Time when this process' current transaction was started, or null if no transaction is active.
- application
Name String - Name of the application that is connected to this service.
- backend
Start String - Time when this process was started, i.e., when the client connected to the server.
- backend
Type String - Type of current service.
- backend
Xid Integer - Top-level transaction identifier of this service, if any.
- backend
Xmin Integer - The current service's xmin horizon.
- client
Addr String - IP address of the client connected to this service. If this field is null, it indicates either that the client is connected via a Unix socket on the server machine or that this is an internal process such as autovacuum.
- client
Hostname String - Host name of the connected client, as reported by a reverse DNS lookup of
client_addr. - client
Port Integer - TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
- datid Integer
- OID of the database this service is connected to.
- datname String
- Name of the database this service is connected to.
- id String
- Process ID of this service.
- query String
- Text of this service's most recent query. If state is active this field shows the currently executing query. In all other states, it shows the last query that was executed.
- query
Duration String - The active query current duration.
- query
Start String - Time when the currently active query was started, or if state is not active, when the last query was started.
- state String
- Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
- state
Change String - Time when the state was last changed.
- usename String
- Name of the user logged into this service.
- usesysid Integer
- OID of the user logged into this service.
- wait
Event String - Wait event name if service is currently waiting.
- wait
Event StringType - The type of event for which the service is waiting, if any; otherwise NULL.
- xact
Start String - Time when this process' current transaction was started, or null if no transaction is active.
- application
Name string - Name of the application that is connected to this service.
- backend
Start string - Time when this process was started, i.e., when the client connected to the server.
- backend
Type string - Type of current service.
- backend
Xid number - Top-level transaction identifier of this service, if any.
- backend
Xmin number - The current service's xmin horizon.
- client
Addr string - IP address of the client connected to this service. If this field is null, it indicates either that the client is connected via a Unix socket on the server machine or that this is an internal process such as autovacuum.
- client
Hostname string - Host name of the connected client, as reported by a reverse DNS lookup of
client_addr. - client
Port number - TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
- datid number
- OID of the database this service is connected to.
- datname string
- Name of the database this service is connected to.
- id string
- Process ID of this service.
- query string
- Text of this service's most recent query. If state is active this field shows the currently executing query. In all other states, it shows the last query that was executed.
- query
Duration string - The active query current duration.
- query
Start string - Time when the currently active query was started, or if state is not active, when the last query was started.
- state string
- Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
- state
Change string - Time when the state was last changed.
- usename string
- Name of the user logged into this service.
- usesysid number
- OID of the user logged into this service.
- wait
Event string - Wait event name if service is currently waiting.
- wait
Event stringType - The type of event for which the service is waiting, if any; otherwise NULL.
- xact
Start string - Time when this process' current transaction was started, or null if no transaction is active.
- application_
name str - Name of the application that is connected to this service.
- backend_
start str - Time when this process was started, i.e., when the client connected to the server.
- backend_
type str - Type of current service.
- backend_
xid int - Top-level transaction identifier of this service, if any.
- backend_
xmin int - The current service's xmin horizon.
- client_
addr str - IP address of the client connected to this service. If this field is null, it indicates either that the client is connected via a Unix socket on the server machine or that this is an internal process such as autovacuum.
- client_
hostname str - Host name of the connected client, as reported by a reverse DNS lookup of
client_addr. - client_
port int - TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
- datid int
- OID of the database this service is connected to.
- datname str
- Name of the database this service is connected to.
- id str
- Process ID of this service.
- query str
- Text of this service's most recent query. If state is active this field shows the currently executing query. In all other states, it shows the last query that was executed.
- query_
duration str - The active query current duration.
- query_
start str - Time when the currently active query was started, or if state is not active, when the last query was started.
- state str
- Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
- state_
change str - Time when the state was last changed.
- usename str
- Name of the user logged into this service.
- usesysid int
- OID of the user logged into this service.
- wait_
event str - Wait event name if service is currently waiting.
- wait_
event_ strtype - The type of event for which the service is waiting, if any; otherwise NULL.
- xact_
start str - Time when this process' current transaction was started, or null if no transaction is active.
- application
Name String - Name of the application that is connected to this service.
- backend
Start String - Time when this process was started, i.e., when the client connected to the server.
- backend
Type String - Type of current service.
- backend
Xid Number - Top-level transaction identifier of this service, if any.
- backend
Xmin Number - The current service's xmin horizon.
- client
Addr String - IP address of the client connected to this service. If this field is null, it indicates either that the client is connected via a Unix socket on the server machine or that this is an internal process such as autovacuum.
- client
Hostname String - Host name of the connected client, as reported by a reverse DNS lookup of
client_addr. - client
Port Number - TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
- datid Number
- OID of the database this service is connected to.
- datname String
- Name of the database this service is connected to.
- id String
- Process ID of this service.
- query String
- Text of this service's most recent query. If state is active this field shows the currently executing query. In all other states, it shows the last query that was executed.
- query
Duration String - The active query current duration.
- query
Start String - Time when the currently active query was started, or if state is not active, when the last query was started.
- state String
- Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
- state
Change String - Time when the state was last changed.
- usename String
- Name of the user logged into this service.
- usesysid Number
- OID of the user logged into this service.
- wait
Event String - Wait event name if service is currently waiting.
- wait
Event StringType - The type of event for which the service is waiting, if any; otherwise NULL.
- xact
Start String - Time when this process' current transaction was started, or null if no transaction is active.
Package Details
- Repository
- upcloud UpCloudLtd/pulumi-upcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
upcloudTerraform Provider.
Viewing docs for UpCloud v0.12.0
published on Saturday, Mar 21, 2026 by UpCloudLtd
published on Saturday, Mar 21, 2026 by UpCloudLtd
