Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.26.0 published on Friday, Jul 29, 2022 by Pulumi

getDatabases

The alicloud.polardb.getDatabases data source provides a collection of PolarDB cluster database available in Alibaba Cloud account. Filters support regular expression for the database name, searches by clusterId.

NOTE: Available in v1.70.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var polardbClustersDs = Output.Create(AliCloud.PolarDB.GetClusters.InvokeAsync(new AliCloud.PolarDB.GetClustersArgs
        {
            DescriptionRegex = "pc-\\w+",
            Status = "Running",
        }));
        var @default = polardbClustersDs.Apply(polardbClustersDs => Output.Create(AliCloud.PolarDB.GetDatabases.InvokeAsync(new AliCloud.PolarDB.GetDatabasesArgs
        {
            DbClusterId = polardbClustersDs.Clusters?[0]?.Id,
        })));
        this.Database = @default.Apply(@default => @default.Databases?[0]?.DbName);
    }

    [Output("database")]
    public Output<string> Database { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/polardb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		polardbClustersDs, err := polardb.GetClusters(ctx, &polardb.GetClustersArgs{
			DescriptionRegex: pulumi.StringRef("pc-\\w+"),
			Status:           pulumi.StringRef("Running"),
		}, nil)
		if err != nil {
			return err
		}
		_default, err := polardb.GetDatabases(ctx, &polardb.GetDatabasesArgs{
			DbClusterId: polardbClustersDs.Clusters[0].Id,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("database", _default.Databases[0].DbName)
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

polardb_clusters_ds = alicloud.polardb.get_clusters(description_regex="pc-\\w+",
    status="Running")
default = alicloud.polardb.get_databases(db_cluster_id=polardb_clusters_ds.clusters[0].id)
pulumi.export("database", default.databases[0].db_name)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const polardbClustersDs = alicloud.polardb.getClusters({
    descriptionRegex: "pc-\\w+",
    status: "Running",
});
const default = polardbClustersDs.then(polardbClustersDs => alicloud.polardb.getDatabases({
    dbClusterId: polardbClustersDs.clusters?[0]?.id,
}));
export const database = _default.then(_default => _default.databases?[0]?.dbName);

Coming soon!

Using getDatabases

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 getDatabases(args: GetDatabasesArgs, opts?: InvokeOptions): Promise<GetDatabasesResult>
function getDatabasesOutput(args: GetDatabasesOutputArgs, opts?: InvokeOptions): Output<GetDatabasesResult>
def get_databases(db_cluster_id: Optional[str] = None,
                  name_regex: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetDatabasesResult
def get_databases_output(db_cluster_id: Optional[pulumi.Input[str]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetDatabasesResult]
func GetDatabases(ctx *Context, args *GetDatabasesArgs, opts ...InvokeOption) (*GetDatabasesResult, error)
func GetDatabasesOutput(ctx *Context, args *GetDatabasesOutputArgs, opts ...InvokeOption) GetDatabasesResultOutput

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

public static class GetDatabases 
{
    public static Task<GetDatabasesResult> InvokeAsync(GetDatabasesArgs args, InvokeOptions? opts = null)
    public static Output<GetDatabasesResult> Invoke(GetDatabasesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDatabasesResult> getDatabases(GetDatabasesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: alicloud:polardb/getDatabases:getDatabases
  Arguments:
    # Arguments dictionary

The following arguments are supported:

DbClusterId string

The polarDB cluster ID.

NameRegex string

A regex string to filter results by database name.

DbClusterId string

The polarDB cluster ID.

NameRegex string

A regex string to filter results by database name.

dbClusterId String

The polarDB cluster ID.

nameRegex String

A regex string to filter results by database name.

dbClusterId string

The polarDB cluster ID.

nameRegex string

A regex string to filter results by database name.

db_cluster_id str

The polarDB cluster ID.

name_regex str

A regex string to filter results by database name.

dbClusterId String

The polarDB cluster ID.

nameRegex String

A regex string to filter results by database name.

getDatabases Result

The following output properties are available:

Databases List<Pulumi.AliCloud.PolarDB.Outputs.GetDatabasesDatabase>

A list of PolarDB cluster databases. Each element contains the following attributes:

DbClusterId string
Id string

The provider-assigned unique ID for this managed resource.

Names List<string>

database name of the cluster.

NameRegex string
Databases []GetDatabasesDatabase

A list of PolarDB cluster databases. Each element contains the following attributes:

DbClusterId string
Id string

The provider-assigned unique ID for this managed resource.

Names []string

database name of the cluster.

NameRegex string
databases List<GetDatabasesDatabase>

A list of PolarDB cluster databases. Each element contains the following attributes:

dbClusterId String
id String

The provider-assigned unique ID for this managed resource.

names List<String>

database name of the cluster.

nameRegex String
databases GetDatabasesDatabase[]

A list of PolarDB cluster databases. Each element contains the following attributes:

dbClusterId string
id string

The provider-assigned unique ID for this managed resource.

names string[]

database name of the cluster.

nameRegex string
databases Sequence[GetDatabasesDatabase]

A list of PolarDB cluster databases. Each element contains the following attributes:

db_cluster_id str
id str

The provider-assigned unique ID for this managed resource.

names Sequence[str]

database name of the cluster.

name_regex str
databases List<Property Map>

A list of PolarDB cluster databases. Each element contains the following attributes:

dbClusterId String
id String

The provider-assigned unique ID for this managed resource.

names List<String>

database name of the cluster.

nameRegex String

Supporting Types

GetDatabasesDatabase

Accounts List<Pulumi.AliCloud.PolarDB.Inputs.GetDatabasesDatabaseAccount>

A list of accounts of database. Each element contains the following attributes.

CharacterSetName string

The character set name of database.

DbDescription string

Database description.

DbName string

Database name.

DbStatus string

The status of database.

Engine string

The engine of database.

Accounts []GetDatabasesDatabaseAccount

A list of accounts of database. Each element contains the following attributes.

CharacterSetName string

The character set name of database.

DbDescription string

Database description.

DbName string

Database name.

DbStatus string

The status of database.

Engine string

The engine of database.

accounts List<GetDatabasesDatabaseAccount>

A list of accounts of database. Each element contains the following attributes.

characterSetName String

The character set name of database.

dbDescription String

Database description.

dbName String

Database name.

dbStatus String

The status of database.

engine String

The engine of database.

accounts GetDatabasesDatabaseAccount[]

A list of accounts of database. Each element contains the following attributes.

characterSetName string

The character set name of database.

dbDescription string

Database description.

dbName string

Database name.

dbStatus string

The status of database.

engine string

The engine of database.

accounts Sequence[GetDatabasesDatabaseAccount]

A list of accounts of database. Each element contains the following attributes.

character_set_name str

The character set name of database.

db_description str

Database description.

db_name str

Database name.

db_status str

The status of database.

engine str

The engine of database.

accounts List<Property Map>

A list of accounts of database. Each element contains the following attributes.

characterSetName String

The character set name of database.

dbDescription String

Database description.

dbName String

Database name.

dbStatus String

The status of database.

engine String

The engine of database.

GetDatabasesDatabaseAccount

AccountName string

Account name.

AccountStatus string

Account status.

PrivilegeStatus string

The privilege status of account.

AccountName string

Account name.

AccountStatus string

Account status.

PrivilegeStatus string

The privilege status of account.

accountName String

Account name.

accountStatus String

Account status.

privilegeStatus String

The privilege status of account.

accountName string

Account name.

accountStatus string

Account status.

privilegeStatus string

The privilege status of account.

account_name str

Account name.

account_status str

Account status.

privilege_status str

The privilege status of account.

accountName String

Account name.

accountStatus String

Account status.

privilegeStatus String

The privilege status of account.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.