1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. gpdb
  5. getAccounts
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.gpdb.getAccounts

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

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

    NOTE: Available in v1.142.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.gpdb.getAccounts({
        dbInstanceId: "example_value",
        ids: [
            "my-Account-1",
            "my-Account-2",
        ],
    });
    export const gpdbAccountId1 = ids.then(ids => ids.accounts?.[0]?.id);
    const nameRegex = alicloud.gpdb.getAccounts({
        dbInstanceId: "example_value",
        nameRegex: "^my-Account",
    });
    export const gpdbAccountId2 = nameRegex.then(nameRegex => nameRegex.accounts?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.gpdb.get_accounts(db_instance_id="example_value",
        ids=[
            "my-Account-1",
            "my-Account-2",
        ])
    pulumi.export("gpdbAccountId1", ids.accounts[0].id)
    name_regex = alicloud.gpdb.get_accounts(db_instance_id="example_value",
        name_regex="^my-Account")
    pulumi.export("gpdbAccountId2", name_regex.accounts[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/gpdb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := gpdb.GetAccounts(ctx, &gpdb.GetAccountsArgs{
    			DbInstanceId: "example_value",
    			Ids: []string{
    				"my-Account-1",
    				"my-Account-2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("gpdbAccountId1", ids.Accounts[0].Id)
    		nameRegex, err := gpdb.GetAccounts(ctx, &gpdb.GetAccountsArgs{
    			DbInstanceId: "example_value",
    			NameRegex:    pulumi.StringRef("^my-Account"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("gpdbAccountId2", nameRegex.Accounts[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.Gpdb.GetAccounts.Invoke(new()
        {
            DbInstanceId = "example_value",
            Ids = new[]
            {
                "my-Account-1",
                "my-Account-2",
            },
        });
    
        var nameRegex = AliCloud.Gpdb.GetAccounts.Invoke(new()
        {
            DbInstanceId = "example_value",
            NameRegex = "^my-Account",
        });
    
        return new Dictionary<string, object?>
        {
            ["gpdbAccountId1"] = ids.Apply(getAccountsResult => getAccountsResult.Accounts[0]?.Id),
            ["gpdbAccountId2"] = nameRegex.Apply(getAccountsResult => getAccountsResult.Accounts[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.gpdb.GpdbFunctions;
    import com.pulumi.alicloud.gpdb.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 ids = GpdbFunctions.getAccounts(GetAccountsArgs.builder()
                .dbInstanceId("example_value")
                .ids(            
                    "my-Account-1",
                    "my-Account-2")
                .build());
    
            ctx.export("gpdbAccountId1", ids.applyValue(getAccountsResult -> getAccountsResult.accounts()[0].id()));
            final var nameRegex = GpdbFunctions.getAccounts(GetAccountsArgs.builder()
                .dbInstanceId("example_value")
                .nameRegex("^my-Account")
                .build());
    
            ctx.export("gpdbAccountId2", nameRegex.applyValue(getAccountsResult -> getAccountsResult.accounts()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:gpdb:getAccounts
          Arguments:
            dbInstanceId: example_value
            ids:
              - my-Account-1
              - my-Account-2
      nameRegex:
        fn::invoke:
          Function: alicloud:gpdb:getAccounts
          Arguments:
            dbInstanceId: example_value
            nameRegex: ^my-Account
    outputs:
      gpdbAccountId1: ${ids.accounts[0].id}
      gpdbAccountId2: ${nameRegex.accounts[0].id}
    

    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_instance_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_instance_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:gpdb/getAccounts:getAccounts
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DbInstanceId string
    The ID of the instance.
    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 account. Valid values: Active, Creating and Deleting.
    DbInstanceId string
    The ID of the instance.
    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 account. Valid values: Active, Creating and Deleting.
    dbInstanceId String
    The ID of the instance.
    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 account. Valid values: Active, Creating and Deleting.
    dbInstanceId string
    The ID of the instance.
    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 account. Valid values: Active, Creating and Deleting.
    db_instance_id str
    The ID of the instance.
    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 account. Valid values: Active, Creating and Deleting.
    dbInstanceId String
    The ID of the instance.
    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 account. Valid values: Active, Creating and Deleting.

    getAccounts Result

    The following output properties are available:

    Accounts List<Pulumi.AliCloud.Gpdb.Outputs.GetAccountsAccount>
    DbInstanceId 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
    DbInstanceId 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>
    dbInstanceId 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[]
    dbInstanceId 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_instance_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>
    dbInstanceId 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
    The description of the account.
    AccountName string
    The name of the account.
    DbInstanceId string
    The ID of the instance.
    Id string
    The ID of the Account. Its value is same as Queue Name.
    Status string
    The status of the account. Valid values: Active, Creating and Deleting.
    AccountDescription string
    The description of the account.
    AccountName string
    The name of the account.
    DbInstanceId string
    The ID of the instance.
    Id string
    The ID of the Account. Its value is same as Queue Name.
    Status string
    The status of the account. Valid values: Active, Creating and Deleting.
    accountDescription String
    The description of the account.
    accountName String
    The name of the account.
    dbInstanceId String
    The ID of the instance.
    id String
    The ID of the Account. Its value is same as Queue Name.
    status String
    The status of the account. Valid values: Active, Creating and Deleting.
    accountDescription string
    The description of the account.
    accountName string
    The name of the account.
    dbInstanceId string
    The ID of the instance.
    id string
    The ID of the Account. Its value is same as Queue Name.
    status string
    The status of the account. Valid values: Active, Creating and Deleting.
    account_description str
    The description of the account.
    account_name str
    The name of the account.
    db_instance_id str
    The ID of the instance.
    id str
    The ID of the Account. Its value is same as Queue Name.
    status str
    The status of the account. Valid values: Active, Creating and Deleting.
    accountDescription String
    The description of the account.
    accountName String
    The name of the account.
    dbInstanceId String
    The ID of the instance.
    id String
    The ID of the Account. Its value is same as Queue Name.
    status String
    The status of the account. Valid values: Active, Creating and Deleting.

    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.57.1 published on Wednesday, Jun 26, 2024 by Pulumi