getAccounts

The alicloud.polardb.getAccounts data source provides a collection of PolarDB cluster database account available in Alibaba Cloud account. Filters support regular expression for the account 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.GetAccounts.InvokeAsync(new AliCloud.PolarDB.GetAccountsArgs
        {
            DbClusterId = polardbClustersDs.Clusters?[0]?.Id,
        })));
        this.Account = @default.Apply(@default => @default.Accounts?[0]?.AccountName);
    }

    [Output("account")]
    public Output<string> Account { 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.GetAccounts(ctx, &polardb.GetAccountsArgs{
			DbClusterId: polardbClustersDs.Clusters[0].Id,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("account", _default.Accounts[0].AccountName)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.polardb.PolardbFunctions;
import com.pulumi.alicloud.adb.inputs.GetClustersArgs;
import com.pulumi.alicloud.clickhouse.inputs.GetAccountsArgs;
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) {
        final var polardbClustersDs = PolardbFunctions.getClusters(GetClustersArgs.builder()
            .descriptionRegex("pc-\\w+")
            .status("Running")
            .build());

        final var default = PolardbFunctions.getAccounts(GetAccountsArgs.builder()
            .dbClusterId(polardbClustersDs.applyValue(getClustersResult -> getClustersResult.clusters()[0].id()))
            .build());

        ctx.export("account", default_.accounts()[0].accountName());
    }
}
import pulumi
import pulumi_alicloud as alicloud

polardb_clusters_ds = alicloud.polardb.get_clusters(description_regex="pc-\\w+",
    status="Running")
default = alicloud.polardb.get_accounts(db_cluster_id=polardb_clusters_ds.clusters[0].id)
pulumi.export("account", default.accounts[0].account_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.getAccounts({
    dbClusterId: polardbClustersDs.clusters?[0]?.id,
}));
export const account = _default.then(_default => _default.accounts?[0]?.accountName);
variables:
  polardbClustersDs:
    Fn::Invoke:
      Function: alicloud:polardb:getClusters
      Arguments:
        descriptionRegex: pc-\w+
        status: Running
  default:
    Fn::Invoke:
      Function: alicloud:polardb:getAccounts
      Arguments:
        dbClusterId: ${polardbClustersDs.clusters[0].id}
outputs:
  account: ${default.accounts[0].accountName}

Using getAccounts

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 getAccounts(args: GetAccountsArgs, opts?: InvokeOptions): Promise<GetAccountsResult>
function getAccountsOutput(args: GetAccountsOutputArgs, opts?: InvokeOptions): Output<GetAccountsResult>
def get_accounts(db_cluster_id: Optional[str] = None,
                 name_regex: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetAccountsResult
def get_accounts_output(db_cluster_id: Optional[pulumi.Input[str]] = None,
                 name_regex: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetAccountsResult]
func GetAccounts(ctx *Context, args *GetAccountsArgs, opts ...InvokeOption) (*GetAccountsResult, error)
func GetAccountsOutput(ctx *Context, args *GetAccountsOutputArgs, opts ...InvokeOption) GetAccountsResultOutput

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

public static class GetAccounts 
{
    public static Task<GetAccountsResult> InvokeAsync(GetAccountsArgs args, InvokeOptions? opts = null)
    public static Output<GetAccountsResult> Invoke(GetAccountsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAccountsResult> getAccounts(GetAccountsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:polardb/getAccounts:getAccounts
  arguments:
    # arguments dictionary

The following arguments are supported:

DbClusterId string

The polarDB cluster ID.

NameRegex string

A regex string to filter results by account name.

DbClusterId string

The polarDB cluster ID.

NameRegex string

A regex string to filter results by account name.

dbClusterId String

The polarDB cluster ID.

nameRegex String

A regex string to filter results by account name.

dbClusterId string

The polarDB cluster ID.

nameRegex string

A regex string to filter results by account name.

db_cluster_id str

The polarDB cluster ID.

name_regex str

A regex string to filter results by account name.

dbClusterId String

The polarDB cluster ID.

nameRegex String

A regex string to filter results by account name.

getAccounts Result

The following output properties are available:

Accounts List<Pulumi.AliCloud.PolarDB.Outputs.GetAccountsAccount>

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

DbClusterId string
Id string

The provider-assigned unique ID for this managed resource.

Names List<string>

Account name of the cluster.

NameRegex string
Accounts []GetAccountsAccount

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

DbClusterId string
Id string

The provider-assigned unique ID for this managed resource.

Names []string

Account name of the cluster.

NameRegex string
accounts List<GetAccountsAccount>

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

dbClusterId String
id String

The provider-assigned unique ID for this managed resource.

names List<String>

Account name of the cluster.

nameRegex String
accounts GetAccountsAccount[]

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

dbClusterId string
id string

The provider-assigned unique ID for this managed resource.

names string[]

Account name of the cluster.

nameRegex string
accounts Sequence[GetAccountsAccount]

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

db_cluster_id str
id str

The provider-assigned unique ID for this managed resource.

names Sequence[str]

Account name of the cluster.

name_regex str
accounts List<Property Map>

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

dbClusterId String
id String

The provider-assigned unique ID for this managed resource.

names List<String>

Account name of the cluster.

nameRegex String

Supporting Types

GetAccountsAccount

AccountDescription string

Account description.

AccountLockState string

Account lock state, Valid values are Lock, UnLock.

AccountName string

Account name.

AccountStatus string

Cluster address type.Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses.

AccountType string

Account type, Valid values are Normal, Super.

DatabasePrivileges List<Pulumi.AliCloud.PolarDB.Inputs.GetAccountsAccountDatabasePrivilege>

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

AccountDescription string

Account description.

AccountLockState string

Account lock state, Valid values are Lock, UnLock.

AccountName string

Account name.

AccountStatus string

Cluster address type.Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses.

AccountType string

Account type, Valid values are Normal, Super.

DatabasePrivileges []GetAccountsAccountDatabasePrivilege

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

accountDescription String

Account description.

accountLockState String

Account lock state, Valid values are Lock, UnLock.

accountName String

Account name.

accountStatus String

Cluster address type.Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses.

accountType String

Account type, Valid values are Normal, Super.

databasePrivileges List<GetAccountsAccountDatabasePrivilege>

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

accountDescription string

Account description.

accountLockState string

Account lock state, Valid values are Lock, UnLock.

accountName string

Account name.

accountStatus string

Cluster address type.Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses.

accountType string

Account type, Valid values are Normal, Super.

databasePrivileges GetAccountsAccountDatabasePrivilege[]

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

account_description str

Account description.

account_lock_state str

Account lock state, Valid values are Lock, UnLock.

account_name str

Account name.

account_status str

Cluster address type.Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses.

account_type str

Account type, Valid values are Normal, Super.

database_privileges Sequence[GetAccountsAccountDatabasePrivilege]

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

accountDescription String

Account description.

accountLockState String

Account lock state, Valid values are Lock, UnLock.

accountName String

Account name.

accountStatus String

Cluster address type.Cluster: the default address of the Cluster.Primary: Primary address.Custom: Custom cluster addresses.

accountType String

Account type, Valid values are Normal, Super.

databasePrivileges List<Property Map>

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

GetAccountsAccountDatabasePrivilege

AccountPrivilege string

Account privilege of database

DbName string

The account owned database name

AccountPrivilege string

Account privilege of database

DbName string

The account owned database name

accountPrivilege String

Account privilege of database

dbName String

The account owned database name

accountPrivilege string

Account privilege of database

dbName string

The account owned database name

account_privilege str

Account privilege of database

db_name str

The account owned database name

accountPrivilege String

Account privilege of database

dbName String

The account owned database name

Package Details

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

This Pulumi package is based on the alicloud Terraform Provider.