1. Packages
  2. UpCloud
  3. API Docs
  4. getManagedDatabasePostgresqlSessions
UpCloud v0.1.0 published on Friday, Mar 14, 2025 by UpCloudLtd

upcloud.getManagedDatabasePostgresqlSessions

Explore with Pulumi AI

Current sessions of a PostgreSQL managed database

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as upcloud from "@pulumi/upcloud";
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,
});
Copy
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)
Copy
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
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using UpCloud = Pulumi.UpCloud;
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,
    });

});
Copy
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());

    }
}
Copy
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}
Copy

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>
Copy
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]
Copy
func GetManagedDatabasePostgresqlSessions(ctx *Context, args *GetManagedDatabasePostgresqlSessionsArgs, opts ...InvokeOption) (*GetManagedDatabasePostgresqlSessionsResult, error)
func GetManagedDatabasePostgresqlSessionsOutput(ctx *Context, args *GetManagedDatabasePostgresqlSessionsOutputArgs, opts ...InvokeOption) GetManagedDatabasePostgresqlSessionsResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetManagedDatabasePostgresqlSessionsResult> getManagedDatabasePostgresqlSessions(GetManagedDatabasePostgresqlSessionsArgs args, InvokeOptions options)
public static Output<GetManagedDatabasePostgresqlSessionsResult> getManagedDatabasePostgresqlSessions(GetManagedDatabasePostgresqlSessionsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: upcloud:index/getManagedDatabasePostgresqlSessions:getManagedDatabasePostgresqlSessions
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

service This property is required. String
limit Integer
offset Integer
order String
sessions List<GetManagedDatabasePostgresqlSessionsSession>
service This property is required. string
limit number
offset number
order string
sessions GetManagedDatabasePostgresqlSessionsSession[]
service This property is required. String
limit Number
offset Number
order String
sessions List<Property Map>

getManagedDatabasePostgresqlSessions Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Service string
Sessions List<UpCloud.Pulumi.UpCloud.Outputs.GetManagedDatabasePostgresqlSessionsSession>
Limit int
Offset int
Order string
Id string
The provider-assigned unique ID for this managed resource.
Service string
Sessions []GetManagedDatabasePostgresqlSessionsSession
Limit int
Offset int
Order string
id String
The provider-assigned unique ID for this managed resource.
service String
sessions List<GetManagedDatabasePostgresqlSessionsSession>
limit Integer
offset Integer
order String
id string
The provider-assigned unique ID for this managed resource.
service string
sessions GetManagedDatabasePostgresqlSessionsSession[]
limit number
offset number
order string
id str
The provider-assigned unique ID for this managed resource.
service str
sessions Sequence[GetManagedDatabasePostgresqlSessionsSession]
limit int
offset int
order str
id String
The provider-assigned unique ID for this managed resource.
service String
sessions List<Property Map>
limit Number
offset Number
order String

Supporting Types

GetManagedDatabasePostgresqlSessionsSession

ApplicationName This property is required. string
Name of the application that is connected to this service.
BackendStart This property is required. string
Time when this process was started, i.e., when the client connected to the server.
BackendType This property is required. string
Type of current service.
BackendXid This property is required. int
Top-level transaction identifier of this service, if any.
BackendXmin This property is required. int
The current service's xmin horizon.
ClientAddr This property is required. 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.
ClientHostname This property is required. string
Host name of the connected client, as reported by a reverse DNS lookup of client_addr.
ClientPort This property is required. int
TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
Datid This property is required. int
OID of the database this service is connected to.
Datname This property is required. string
Name of the database this service is connected to.
Id This property is required. string
Process ID of this service.
Query This property is required. 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.
QueryDuration This property is required. string
The active query current duration.
QueryStart This property is required. string
Time when the currently active query was started, or if state is not active, when the last query was started.
State This property is required. string
Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
StateChange This property is required. string
Time when the state was last changed.
Usename This property is required. string
Name of the user logged into this service.
Usesysid This property is required. int
OID of the user logged into this service.
WaitEvent This property is required. string
Wait event name if service is currently waiting.
WaitEventType This property is required. string
The type of event for which the service is waiting, if any; otherwise NULL.
XactStart This property is required. string
Time when this process' current transaction was started, or null if no transaction is active.
ApplicationName This property is required. string
Name of the application that is connected to this service.
BackendStart This property is required. string
Time when this process was started, i.e., when the client connected to the server.
BackendType This property is required. string
Type of current service.
BackendXid This property is required. int
Top-level transaction identifier of this service, if any.
BackendXmin This property is required. int
The current service's xmin horizon.
ClientAddr This property is required. 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.
ClientHostname This property is required. string
Host name of the connected client, as reported by a reverse DNS lookup of client_addr.
ClientPort This property is required. int
TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
Datid This property is required. int
OID of the database this service is connected to.
Datname This property is required. string
Name of the database this service is connected to.
Id This property is required. string
Process ID of this service.
Query This property is required. 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.
QueryDuration This property is required. string
The active query current duration.
QueryStart This property is required. string
Time when the currently active query was started, or if state is not active, when the last query was started.
State This property is required. string
Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
StateChange This property is required. string
Time when the state was last changed.
Usename This property is required. string
Name of the user logged into this service.
Usesysid This property is required. int
OID of the user logged into this service.
WaitEvent This property is required. string
Wait event name if service is currently waiting.
WaitEventType This property is required. string
The type of event for which the service is waiting, if any; otherwise NULL.
XactStart This property is required. string
Time when this process' current transaction was started, or null if no transaction is active.
applicationName This property is required. String
Name of the application that is connected to this service.
backendStart This property is required. String
Time when this process was started, i.e., when the client connected to the server.
backendType This property is required. String
Type of current service.
backendXid This property is required. Integer
Top-level transaction identifier of this service, if any.
backendXmin This property is required. Integer
The current service's xmin horizon.
clientAddr This property is required. 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.
clientHostname This property is required. String
Host name of the connected client, as reported by a reverse DNS lookup of client_addr.
clientPort This property is required. Integer
TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
datid This property is required. Integer
OID of the database this service is connected to.
datname This property is required. String
Name of the database this service is connected to.
id This property is required. String
Process ID of this service.
query This property is required. 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.
queryDuration This property is required. String
The active query current duration.
queryStart This property is required. String
Time when the currently active query was started, or if state is not active, when the last query was started.
state This property is required. String
Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
stateChange This property is required. String
Time when the state was last changed.
usename This property is required. String
Name of the user logged into this service.
usesysid This property is required. Integer
OID of the user logged into this service.
waitEvent This property is required. String
Wait event name if service is currently waiting.
waitEventType This property is required. String
The type of event for which the service is waiting, if any; otherwise NULL.
xactStart This property is required. String
Time when this process' current transaction was started, or null if no transaction is active.
applicationName This property is required. string
Name of the application that is connected to this service.
backendStart This property is required. string
Time when this process was started, i.e., when the client connected to the server.
backendType This property is required. string
Type of current service.
backendXid This property is required. number
Top-level transaction identifier of this service, if any.
backendXmin This property is required. number
The current service's xmin horizon.
clientAddr This property is required. 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.
clientHostname This property is required. string
Host name of the connected client, as reported by a reverse DNS lookup of client_addr.
clientPort This property is required. number
TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
datid This property is required. number
OID of the database this service is connected to.
datname This property is required. string
Name of the database this service is connected to.
id This property is required. string
Process ID of this service.
query This property is required. 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.
queryDuration This property is required. string
The active query current duration.
queryStart This property is required. string
Time when the currently active query was started, or if state is not active, when the last query was started.
state This property is required. string
Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
stateChange This property is required. string
Time when the state was last changed.
usename This property is required. string
Name of the user logged into this service.
usesysid This property is required. number
OID of the user logged into this service.
waitEvent This property is required. string
Wait event name if service is currently waiting.
waitEventType This property is required. string
The type of event for which the service is waiting, if any; otherwise NULL.
xactStart This property is required. string
Time when this process' current transaction was started, or null if no transaction is active.
application_name This property is required. str
Name of the application that is connected to this service.
backend_start This property is required. str
Time when this process was started, i.e., when the client connected to the server.
backend_type This property is required. str
Type of current service.
backend_xid This property is required. int
Top-level transaction identifier of this service, if any.
backend_xmin This property is required. int
The current service's xmin horizon.
client_addr This property is required. 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 This property is required. str
Host name of the connected client, as reported by a reverse DNS lookup of client_addr.
client_port This property is required. int
TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
datid This property is required. int
OID of the database this service is connected to.
datname This property is required. str
Name of the database this service is connected to.
id This property is required. str
Process ID of this service.
query This property is required. 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 This property is required. str
The active query current duration.
query_start This property is required. str
Time when the currently active query was started, or if state is not active, when the last query was started.
state This property is required. 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 This property is required. str
Time when the state was last changed.
usename This property is required. str
Name of the user logged into this service.
usesysid This property is required. int
OID of the user logged into this service.
wait_event This property is required. str
Wait event name if service is currently waiting.
wait_event_type This property is required. str
The type of event for which the service is waiting, if any; otherwise NULL.
xact_start This property is required. str
Time when this process' current transaction was started, or null if no transaction is active.
applicationName This property is required. String
Name of the application that is connected to this service.
backendStart This property is required. String
Time when this process was started, i.e., when the client connected to the server.
backendType This property is required. String
Type of current service.
backendXid This property is required. Number
Top-level transaction identifier of this service, if any.
backendXmin This property is required. Number
The current service's xmin horizon.
clientAddr This property is required. 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.
clientHostname This property is required. String
Host name of the connected client, as reported by a reverse DNS lookup of client_addr.
clientPort This property is required. Number
TCP port number that the client is using for communication with this service, or -1 if a Unix socket is used.
datid This property is required. Number
OID of the database this service is connected to.
datname This property is required. String
Name of the database this service is connected to.
id This property is required. String
Process ID of this service.
query This property is required. 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.
queryDuration This property is required. String
The active query current duration.
queryStart This property is required. String
Time when the currently active query was started, or if state is not active, when the last query was started.
state This property is required. String
Current overall state of this service: active: The service is executing a query, idle: The service is waiting for a new client command.
stateChange This property is required. String
Time when the state was last changed.
usename This property is required. String
Name of the user logged into this service.
usesysid This property is required. Number
OID of the user logged into this service.
waitEvent This property is required. String
Wait event name if service is currently waiting.
waitEventType This property is required. String
The type of event for which the service is waiting, if any; otherwise NULL.
xactStart This property is required. 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 upcloud Terraform Provider.