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

upcloud.getManagedDatabaseMysqlSessions

Explore with Pulumi AI

Current sessions of a MySQL 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 MySQL Database
// Create a Managed MySQL resource
const exampleManagedDatabaseMysql = new upcloud.ManagedDatabaseMysql("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.getManagedDatabaseMysqlSessionsOutput({
    service: exampleManagedDatabaseMysql.id,
});
Copy
import pulumi
import pulumi_upcloud as upcloud

# Use data source to gather a list of the active sessions for a Managed MySQL Database
# Create a Managed MySQL resource
example_managed_database_mysql = upcloud.ManagedDatabaseMysql("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_mysql_sessions_output(service=example_managed_database_mysql.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 MySQL Database
		// Create a Managed MySQL resource
		exampleManagedDatabaseMysql, err := upcloud.NewManagedDatabaseMysql(ctx, "example", &upcloud.ManagedDatabaseMysqlArgs{
			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.GetManagedDatabaseMysqlSessionsOutput(ctx, upcloud.GetManagedDatabaseMysqlSessionsOutputArgs{
			Service: exampleManagedDatabaseMysql.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 MySQL Database
    // Create a Managed MySQL resource
    var exampleManagedDatabaseMysql = new UpCloud.ManagedDatabaseMysql("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.GetManagedDatabaseMysqlSessions.Invoke(new()
    {
        Service = exampleManagedDatabaseMysql.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.upcloud.ManagedDatabaseMysql;
import com.pulumi.upcloud.ManagedDatabaseMysqlArgs;
import com.pulumi.upcloud.UpcloudFunctions;
import com.pulumi.upcloud.inputs.GetManagedDatabaseMysqlSessionsArgs;
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 MySQL Database
        // Create a Managed MySQL resource
        var exampleManagedDatabaseMysql = new ManagedDatabaseMysql("exampleManagedDatabaseMysql", ManagedDatabaseMysqlArgs.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.getManagedDatabaseMysqlSessions(GetManagedDatabaseMysqlSessionsArgs.builder()
            .service(exampleManagedDatabaseMysql.id())
            .build());

    }
}
Copy
resources:
  # Use data source to gather a list of the active sessions for a Managed MySQL Database

  # Create a Managed MySQL resource
  exampleManagedDatabaseMysql:
    type: upcloud:ManagedDatabaseMysql
    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:getManagedDatabaseMysqlSessions
      arguments:
        service: ${exampleManagedDatabaseMysql.id}
Copy

Using getManagedDatabaseMysqlSessions

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 getManagedDatabaseMysqlSessions(args: GetManagedDatabaseMysqlSessionsArgs, opts?: InvokeOptions): Promise<GetManagedDatabaseMysqlSessionsResult>
function getManagedDatabaseMysqlSessionsOutput(args: GetManagedDatabaseMysqlSessionsOutputArgs, opts?: InvokeOptions): Output<GetManagedDatabaseMysqlSessionsResult>
Copy
def get_managed_database_mysql_sessions(limit: Optional[int] = None,
                                        offset: Optional[int] = None,
                                        order: Optional[str] = None,
                                        service: Optional[str] = None,
                                        sessions: Optional[Sequence[GetManagedDatabaseMysqlSessionsSession]] = None,
                                        opts: Optional[InvokeOptions] = None) -> GetManagedDatabaseMysqlSessionsResult
def get_managed_database_mysql_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[GetManagedDatabaseMysqlSessionsSessionArgs]]]] = None,
                                        opts: Optional[InvokeOptions] = None) -> Output[GetManagedDatabaseMysqlSessionsResult]
Copy
func GetManagedDatabaseMysqlSessions(ctx *Context, args *GetManagedDatabaseMysqlSessionsArgs, opts ...InvokeOption) (*GetManagedDatabaseMysqlSessionsResult, error)
func GetManagedDatabaseMysqlSessionsOutput(ctx *Context, args *GetManagedDatabaseMysqlSessionsOutputArgs, opts ...InvokeOption) GetManagedDatabaseMysqlSessionsResultOutput
Copy

> Note: This function is named GetManagedDatabaseMysqlSessions in the Go SDK.

public static class GetManagedDatabaseMysqlSessions 
{
    public static Task<GetManagedDatabaseMysqlSessionsResult> InvokeAsync(GetManagedDatabaseMysqlSessionsArgs args, InvokeOptions? opts = null)
    public static Output<GetManagedDatabaseMysqlSessionsResult> Invoke(GetManagedDatabaseMysqlSessionsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetManagedDatabaseMysqlSessionsResult> getManagedDatabaseMysqlSessions(GetManagedDatabaseMysqlSessionsArgs args, InvokeOptions options)
public static Output<GetManagedDatabaseMysqlSessionsResult> getManagedDatabaseMysqlSessions(GetManagedDatabaseMysqlSessionsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: upcloud:index/getManagedDatabaseMysqlSessions:getManagedDatabaseMysqlSessions
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Service This property is required. string
Limit int
Offset int
Order string
Sessions []GetManagedDatabaseMysqlSessionsSession
service This property is required. String
limit Integer
offset Integer
order String
sessions List<GetManagedDatabaseMysqlSessionsSession>
service This property is required. string
limit number
offset number
order string
sessions GetManagedDatabaseMysqlSessionsSession[]
service This property is required. String
limit Number
offset Number
order String
sessions List<Property Map>

getManagedDatabaseMysqlSessions 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.GetManagedDatabaseMysqlSessionsSession>
Limit int
Offset int
Order string
Id string
The provider-assigned unique ID for this managed resource.
Service string
Sessions []GetManagedDatabaseMysqlSessionsSession
Limit int
Offset int
Order string
id String
The provider-assigned unique ID for this managed resource.
service String
sessions List<GetManagedDatabaseMysqlSessionsSession>
limit Integer
offset Integer
order String
id string
The provider-assigned unique ID for this managed resource.
service string
sessions GetManagedDatabaseMysqlSessionsSession[]
limit number
offset number
order string
id str
The provider-assigned unique ID for this managed resource.
service str
sessions Sequence[GetManagedDatabaseMysqlSessionsSession]
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

GetManagedDatabaseMysqlSessionsSession

ApplicationName This property is required. string
Name of the application that is connected to this service.
ClientAddr This property is required. string
IP address of the client connected to this service.
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 an empty string.
QueryDuration This property is required. string
The active query current duration.
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.
Usename This property is required. string
Name of the user logged into this service.
ApplicationName This property is required. string
Name of the application that is connected to this service.
ClientAddr This property is required. string
IP address of the client connected to this service.
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 an empty string.
QueryDuration This property is required. string
The active query current duration.
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.
Usename This property is required. string
Name of the user logged into this service.
applicationName This property is required. String
Name of the application that is connected to this service.
clientAddr This property is required. String
IP address of the client connected to this service.
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 an empty string.
queryDuration This property is required. String
The active query current duration.
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.
usename This property is required. String
Name of the user logged into this service.
applicationName This property is required. string
Name of the application that is connected to this service.
clientAddr This property is required. string
IP address of the client connected to this service.
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 an empty string.
queryDuration This property is required. string
The active query current duration.
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.
usename This property is required. string
Name of the user logged into this service.
application_name This property is required. str
Name of the application that is connected to this service.
client_addr This property is required. str
IP address of the client connected to this service.
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 an empty string.
query_duration This property is required. str
The active query current duration.
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.
usename This property is required. str
Name of the user logged into this service.
applicationName This property is required. String
Name of the application that is connected to this service.
clientAddr This property is required. String
IP address of the client connected to this service.
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 an empty string.
queryDuration This property is required. String
The active query current duration.
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.
usename This property is required. String
Name of the user logged into this service.

Package Details

Repository
upcloud UpCloudLtd/pulumi-upcloud
License
Apache-2.0
Notes
This Pulumi package is based on the upcloud Terraform Provider.