alicloud.clickhouse.getAccounts
This data source provides the Click House Accounts of the current Alibaba Cloud user.
NOTE: Available in v1.134.0+.
Example Usage
Basic Usage
using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "testaccountname";
var pwd = config.Get("pwd") ?? "Tf-testpwd";
var defaultDbCluster = new AliCloud.ClickHouse.DbCluster("defaultDbCluster", new()
{
DbClusterVersion = "20.3.10.75",
Category = "Basic",
DbClusterClass = "S8",
DbClusterNetworkType = "vpc",
DbClusterDescription = name,
DbNodeGroupCount = 1,
PaymentType = "PayAsYouGo",
DbNodeStorage = "500",
StorageType = "cloud_essd",
VswitchId = "your_vswitch_id",
});
var defaultAccount = new AliCloud.ClickHouse.Account("defaultAccount", new()
{
DbClusterId = defaultDbCluster.Id,
AccountDescription = "your_description",
AccountName = name,
AccountPassword = pwd,
});
var defaultAccounts = AliCloud.ClickHouse.GetAccounts.Invoke(new()
{
Ids = new[]
{
defaultAccount.Id,
},
DbClusterId = defaultDbCluster.Id,
});
return new Dictionary<string, object?>
{
["accountId"] = defaultAccounts.Apply(getAccountsResult => getAccountsResult.Ids[0]),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/clickhouse"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "testaccountname"
if param := cfg.Get("name"); param != "" {
name = param
}
pwd := "Tf-testpwd"
if param := cfg.Get("pwd"); param != "" {
pwd = param
}
defaultDbCluster, err := clickhouse.NewDbCluster(ctx, "defaultDbCluster", &clickhouse.DbClusterArgs{
DbClusterVersion: pulumi.String("20.3.10.75"),
Category: pulumi.String("Basic"),
DbClusterClass: pulumi.String("S8"),
DbClusterNetworkType: pulumi.String("vpc"),
DbClusterDescription: pulumi.String(name),
DbNodeGroupCount: pulumi.Int(1),
PaymentType: pulumi.String("PayAsYouGo"),
DbNodeStorage: pulumi.String("500"),
StorageType: pulumi.String("cloud_essd"),
VswitchId: pulumi.String("your_vswitch_id"),
})
if err != nil {
return err
}
defaultAccount, err := clickhouse.NewAccount(ctx, "defaultAccount", &clickhouse.AccountArgs{
DbClusterId: defaultDbCluster.ID(),
AccountDescription: pulumi.String("your_description"),
AccountName: pulumi.String(name),
AccountPassword: pulumi.String(pwd),
})
if err != nil {
return err
}
defaultAccounts := clickhouse.GetAccountsOutput(ctx, clickhouse.GetAccountsOutputArgs{
Ids: pulumi.StringArray{
defaultAccount.ID(),
},
DbClusterId: defaultDbCluster.ID(),
}, nil)
ctx.Export("accountId", defaultAccounts.ApplyT(func(defaultAccounts clickhouse.GetAccountsResult) (*string, error) {
return &defaultAccounts.Ids[0], nil
}).(pulumi.StringPtrOutput))
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.clickhouse.DbCluster;
import com.pulumi.alicloud.clickhouse.DbClusterArgs;
import com.pulumi.alicloud.clickhouse.Account;
import com.pulumi.alicloud.clickhouse.AccountArgs;
import com.pulumi.alicloud.clickhouse.ClickhouseFunctions;
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 config = ctx.config();
final var name = config.get("name").orElse("testaccountname");
final var pwd = config.get("pwd").orElse("Tf-testpwd");
var defaultDbCluster = new DbCluster("defaultDbCluster", DbClusterArgs.builder()
.dbClusterVersion("20.3.10.75")
.category("Basic")
.dbClusterClass("S8")
.dbClusterNetworkType("vpc")
.dbClusterDescription(name)
.dbNodeGroupCount("1")
.paymentType("PayAsYouGo")
.dbNodeStorage("500")
.storageType("cloud_essd")
.vswitchId("your_vswitch_id")
.build());
var defaultAccount = new Account("defaultAccount", AccountArgs.builder()
.dbClusterId(defaultDbCluster.id())
.accountDescription("your_description")
.accountName(name)
.accountPassword(pwd)
.build());
final var defaultAccounts = ClickhouseFunctions.getAccounts(GetAccountsArgs.builder()
.ids(defaultAccount.id())
.dbClusterId(defaultDbCluster.id())
.build());
ctx.export("accountId", defaultAccounts.applyValue(getAccountsResult -> getAccountsResult).applyValue(defaultAccounts -> defaultAccounts.applyValue(getAccountsResult -> getAccountsResult.ids()[0])));
}
}
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "testaccountname"
pwd = config.get("pwd")
if pwd is None:
pwd = "Tf-testpwd"
default_db_cluster = alicloud.clickhouse.DbCluster("defaultDbCluster",
db_cluster_version="20.3.10.75",
category="Basic",
db_cluster_class="S8",
db_cluster_network_type="vpc",
db_cluster_description=name,
db_node_group_count=1,
payment_type="PayAsYouGo",
db_node_storage="500",
storage_type="cloud_essd",
vswitch_id="your_vswitch_id")
default_account = alicloud.clickhouse.Account("defaultAccount",
db_cluster_id=default_db_cluster.id,
account_description="your_description",
account_name=name,
account_password=pwd)
default_accounts = alicloud.clickhouse.get_accounts_output(ids=[default_account.id],
db_cluster_id=default_db_cluster.id)
pulumi.export("accountId", default_accounts.ids[0])
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "testaccountname";
const pwd = config.get("pwd") || "Tf-testpwd";
const defaultDbCluster = new alicloud.clickhouse.DbCluster("defaultDbCluster", {
dbClusterVersion: "20.3.10.75",
category: "Basic",
dbClusterClass: "S8",
dbClusterNetworkType: "vpc",
dbClusterDescription: name,
dbNodeGroupCount: 1,
paymentType: "PayAsYouGo",
dbNodeStorage: "500",
storageType: "cloud_essd",
vswitchId: "your_vswitch_id",
});
const defaultAccount = new alicloud.clickhouse.Account("defaultAccount", {
dbClusterId: defaultDbCluster.id,
accountDescription: "your_description",
accountName: name,
accountPassword: pwd,
});
const defaultAccounts = alicloud.clickhouse.getAccountsOutput({
ids: [defaultAccount.id],
dbClusterId: defaultDbCluster.id,
});
export const accountId = defaultAccounts.apply(defaultAccounts => defaultAccounts.ids?.[0]);
configuration:
name:
type: string
default: testaccountname
pwd:
type: string
default: Tf-testpwd
resources:
defaultDbCluster:
type: alicloud:clickhouse:DbCluster
properties:
dbClusterVersion: 20.3.10.75
category: Basic
dbClusterClass: S8
dbClusterNetworkType: vpc
dbClusterDescription: ${name}
dbNodeGroupCount: '1'
paymentType: PayAsYouGo
dbNodeStorage: '500'
storageType: cloud_essd
vswitchId: your_vswitch_id
defaultAccount:
type: alicloud:clickhouse:Account
properties:
dbClusterId: ${defaultDbCluster.id}
accountDescription: your_description
accountName: ${name}
accountPassword: ${pwd}
variables:
defaultAccounts:
fn::invoke:
Function: alicloud:clickhouse:getAccounts
Arguments:
ids:
- ${defaultAccount.id}
dbClusterId: ${defaultDbCluster.id}
outputs:
accountId: ${defaultAccounts.ids[0]}
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,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
status: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAccountsResult
def get_accounts_output(db_cluster_id: Optional[pulumi.Input[str]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
status: 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:clickhouse/getAccounts:getAccounts
arguments:
# arguments dictionary
The following arguments are supported:
- Db
Cluster stringId The DBCluster id.
- Ids List<string>
A list of Account IDs. Its element value is same as Account Name.
- Name
Regex string A regex string to filter results by Account name.
- Output
File string - Status string
The status of the resource.
- Db
Cluster stringId The DBCluster id.
- Ids []string
A list of Account IDs. Its element value is same as Account Name.
- Name
Regex string A regex string to filter results by Account name.
- Output
File string - Status string
The status of the resource.
- db
Cluster StringId The DBCluster id.
- ids List<String>
A list of Account IDs. Its element value is same as Account Name.
- name
Regex String A regex string to filter results by Account name.
- output
File String - status String
The status of the resource.
- db
Cluster stringId The DBCluster id.
- ids string[]
A list of Account IDs. Its element value is same as Account Name.
- name
Regex string A regex string to filter results by Account name.
- output
File string - status string
The status of the resource.
- db_
cluster_ strid The DBCluster id.
- ids Sequence[str]
A list of Account IDs. Its element value is same as Account Name.
- name_
regex str A regex string to filter results by Account name.
- output_
file str - status str
The status of the resource.
- db
Cluster StringId The DBCluster id.
- ids List<String>
A list of Account IDs. Its element value is same as Account Name.
- name
Regex String A regex string to filter results by Account name.
- output
File String - status String
The status of the resource.
getAccounts Result
The following output properties are available:
- Accounts
List<Pulumi.
Ali Cloud. Click House. Outputs. Get Accounts Account> - Db
Cluster stringId - Id string
The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- Name
Regex string - Output
File string - Status string
- Accounts
[]Get
Accounts Account - Db
Cluster stringId - Id string
The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- Name
Regex string - Output
File string - Status string
- accounts
List<Get
Accounts Account> - db
Cluster StringId - id String
The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- name
Regex String - output
File String - status String
- accounts
Get
Accounts Account[] - db
Cluster stringId - id string
The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- name
Regex string - output
File string - status string
- accounts
Sequence[Get
Accounts Account] - db_
cluster_ strid - id str
The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- name_
regex str - output_
file str - status str
- accounts List<Property Map>
- db
Cluster StringId - id String
The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- name
Regex String - output
File String - status String
Supporting Types
GetAccountsAccount
- Account
Description string In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- Account
Name string Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- Account
Type string The Valid Account type:
Normal
,Super
.- Db
Cluster stringId The DBCluster id.
- Id string
The ID of the Account. Its value is same as Queue Name.
- Status string
The status of the resource.
- Account
Description string In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- Account
Name string Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- Account
Type string The Valid Account type:
Normal
,Super
.- Db
Cluster stringId The DBCluster id.
- Id string
The ID of the Account. Its value is same as Queue Name.
- Status string
The status of the resource.
- account
Description String In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- account
Name String Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- account
Type String The Valid Account type:
Normal
,Super
.- db
Cluster StringId The DBCluster id.
- id String
The ID of the Account. Its value is same as Queue Name.
- status String
The status of the resource.
- account
Description string In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- account
Name string Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- account
Type string The Valid Account type:
Normal
,Super
.- db
Cluster stringId The DBCluster id.
- id string
The ID of the Account. Its value is same as Queue Name.
- status string
The status of the resource.
- account_
description str In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- account_
name str Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- account_
type str The Valid Account type:
Normal
,Super
.- db_
cluster_ strid The DBCluster id.
- id str
The ID of the Account. Its value is same as Queue Name.
- status str
The status of the resource.
- account
Description String In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- account
Name String Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- account
Type String The Valid Account type:
Normal
,Super
.- db
Cluster StringId The DBCluster id.
- id String
The ID of the Account. Its value is same as Queue Name.
- status String
The status of the resource.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.