1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. clickhouse
  5. getAccounts
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.clickhouse.getAccounts

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    This data source provides the Click House Accounts of the current Alibaba Cloud user.

    NOTE: Available in v1.134.0+.

    Example Usage

    Basic Usage

    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]);
    
    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])
    
    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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    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 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])));
        }
    }
    
    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:

    DbClusterId string
    The DBCluster id.
    Ids List<string>
    A list of Account IDs. Its element value is same as Account Name.
    NameRegex string
    A regex string to filter results by Account name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The status of the resource.
    DbClusterId string
    The DBCluster id.
    Ids []string
    A list of Account IDs. Its element value is same as Account Name.
    NameRegex string
    A regex string to filter results by Account name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The status of the resource.
    dbClusterId String
    The DBCluster id.
    ids List<String>
    A list of Account IDs. Its element value is same as Account Name.
    nameRegex String
    A regex string to filter results by Account name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The status of the resource.
    dbClusterId string
    The DBCluster id.
    ids string[]
    A list of Account IDs. Its element value is same as Account Name.
    nameRegex string
    A regex string to filter results by Account name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    status string
    The status of the resource.
    db_cluster_id str
    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
    File name where to save data source results (after running pulumi preview).
    status str
    The status of the resource.
    dbClusterId String
    The DBCluster id.
    ids List<String>
    A list of Account IDs. Its element value is same as Account Name.
    nameRegex String
    A regex string to filter results by Account name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The status of the resource.

    getAccounts Result

    The following output properties are available:

    Accounts List<Pulumi.AliCloud.ClickHouse.Outputs.GetAccountsAccount>
    DbClusterId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    NameRegex string
    OutputFile string
    Status string
    Accounts []GetAccountsAccount
    DbClusterId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    NameRegex string
    OutputFile string
    Status string
    accounts List<GetAccountsAccount>
    dbClusterId String
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    nameRegex String
    outputFile String
    status String
    accounts GetAccountsAccount[]
    dbClusterId string
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    nameRegex string
    outputFile string
    status string
    accounts Sequence[GetAccountsAccount]
    db_cluster_id str
    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>
    dbClusterId String
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    nameRegex String
    outputFile String
    status String

    Supporting Types

    GetAccountsAccount

    AccountDescription 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.
    AccountName string
    Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
    AccountType string
    The Valid Account type: Normal, Super.
    DbClusterId string
    The DBCluster id.
    Id string
    The ID of the Account. Its value is same as Queue Name.
    Status string
    The status of the resource.
    AccountDescription 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.
    AccountName string
    Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
    AccountType string
    The Valid Account type: Normal, Super.
    DbClusterId string
    The DBCluster id.
    Id string
    The ID of the Account. Its value is same as Queue Name.
    Status string
    The status of the resource.
    accountDescription 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.
    accountName String
    Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
    accountType String
    The Valid Account type: Normal, Super.
    dbClusterId String
    The DBCluster id.
    id String
    The ID of the Account. Its value is same as Queue Name.
    status String
    The status of the resource.
    accountDescription 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.
    accountName string
    Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
    accountType string
    The Valid Account type: Normal, Super.
    dbClusterId string
    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_id str
    The DBCluster id.
    id str
    The ID of the Account. Its value is same as Queue Name.
    status str
    The status of the resource.
    accountDescription 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.
    accountName String
    Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
    accountType String
    The Valid Account type: Normal, Super.
    dbClusterId String
    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.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi