Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.gpdb.getAccounts
Explore with Pulumi AI
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 dictionaryThe following arguments are supported:
- Db
Instance stringId  - The ID of the instance.
 - 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 - File name where to save data source results (after running 
pulumi preview). - Status string
 - The status of the account. Valid values: 
Active,CreatingandDeleting. 
- Db
Instance stringId  - The ID of the instance.
 - 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 - File name where to save data source results (after running 
pulumi preview). - Status string
 - The status of the account. Valid values: 
Active,CreatingandDeleting. 
- db
Instance StringId  - The ID of the instance.
 - 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 - File name where to save data source results (after running 
pulumi preview). - status String
 - The status of the account. Valid values: 
Active,CreatingandDeleting. 
- db
Instance stringId  - The ID of the instance.
 - 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 - File name where to save data source results (after running 
pulumi preview). - status string
 - The status of the account. Valid values: 
Active,CreatingandDeleting. 
- db_
instance_ strid  - 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,CreatingandDeleting. 
- db
Instance StringId  - The ID of the instance.
 - 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 - File name where to save data source results (after running 
pulumi preview). - status String
 - The status of the account. Valid values: 
Active,CreatingandDeleting. 
getAccounts Result
The following output properties are available:
- Accounts
List<Pulumi.
Ali Cloud. Gpdb. Outputs. Get Accounts Account>  - Db
Instance 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
Instance 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
Instance 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
Instance 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_
instance_ 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
Instance 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 - The description of the account.
 - Account
Name string - The name of the account.
 - Db
Instance stringId  - 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,CreatingandDeleting. 
- Account
Description string - The description of the account.
 - Account
Name string - The name of the account.
 - Db
Instance stringId  - 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,CreatingandDeleting. 
- account
Description String - The description of the account.
 - account
Name String - The name of the account.
 - db
Instance StringId  - 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,CreatingandDeleting. 
- account
Description string - The description of the account.
 - account
Name string - The name of the account.
 - db
Instance stringId  - 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,CreatingandDeleting. 
- account_
description str - The description of the account.
 - account_
name str - The name of the account.
 - db_
instance_ strid  - 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,CreatingandDeleting. 
- account
Description String - The description of the account.
 - account
Name String - The name of the account.
 - db
Instance StringId  - 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,CreatingandDeleting. 
Package Details
- Repository
 - Alibaba Cloud pulumi/pulumi-alicloud
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
alicloudTerraform Provider.