Alibaba Cloud

v3.15.0 published on Thursday, Jan 13, 2022 by Pulumi

getAccounts

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

NOTE: Available in v1.142.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ids = Output.Create(AliCloud.Gpdb.GetAccounts.InvokeAsync(new AliCloud.Gpdb.GetAccountsArgs
        {
            DbInstanceId = "example_value",
            Ids = 
            {
                "my-Account-1",
                "my-Account-2",
            },
        }));
        this.GpdbAccountId1 = ids.Apply(ids => ids.Accounts?[0]?.Id);
        var nameRegex = Output.Create(AliCloud.Gpdb.GetAccounts.InvokeAsync(new AliCloud.Gpdb.GetAccountsArgs
        {
            DbInstanceId = "example_value",
            NameRegex = "^my-Account",
        }));
        this.GpdbAccountId2 = nameRegex.Apply(nameRegex => nameRegex.Accounts?[0]?.Id);
    }

    [Output("gpdbAccountId1")]
    public Output<string> GpdbAccountId1 { get; set; }
    [Output("gpdbAccountId2")]
    public Output<string> GpdbAccountId2 { get; set; }
}
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)
		opt0 := "^my-Account"
		nameRegex, err := gpdb.GetAccounts(ctx, &gpdb.GetAccountsArgs{
			DbInstanceId: "example_value",
			NameRegex:    &opt0,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("gpdbAccountId2", nameRegex.Accounts[0].Id)
		return nil
	})
}
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)
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);

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)
}

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
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
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
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
status str
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 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

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.
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.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.