1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. rds
  5. getAccounts
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.rds.getAccounts

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

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

NOTE: Available in v1.120.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const example = alicloud.rds.getAccounts({
    dbInstanceId: "example_value",
    nameRegex: "the_resource_name",
});
export const firstRdsAccountId = example.then(example => example.accounts?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

example = alicloud.rds.get_accounts(db_instance_id="example_value",
    name_regex="the_resource_name")
pulumi.export("firstRdsAccountId", example.accounts[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rds"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := rds.GetAccounts(ctx, &rds.GetAccountsArgs{
			DbInstanceId: "example_value",
			NameRegex:    pulumi.StringRef("the_resource_name"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstRdsAccountId", example.Accounts[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var example = AliCloud.Rds.GetAccounts.Invoke(new()
    {
        DbInstanceId = "example_value",
        NameRegex = "the_resource_name",
    });

    return new Dictionary<string, object?>
    {
        ["firstRdsAccountId"] = example.Apply(getAccountsResult => getAccountsResult.Accounts[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.rds.RdsFunctions;
import com.pulumi.alicloud.rds.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 example = RdsFunctions.getAccounts(GetAccountsArgs.builder()
            .dbInstanceId("example_value")
            .nameRegex("the_resource_name")
            .build());

        ctx.export("firstRdsAccountId", example.applyValue(getAccountsResult -> getAccountsResult.accounts()[0].id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: alicloud:rds:getAccounts
      arguments:
        dbInstanceId: example_value
        nameRegex: the_resource_name
outputs:
  firstRdsAccountId: ${example.accounts[0].id}
Copy

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>
Copy
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]
Copy
func GetAccounts(ctx *Context, args *GetAccountsArgs, opts ...InvokeOption) (*GetAccountsResult, error)
func GetAccountsOutput(ctx *Context, args *GetAccountsOutputArgs, opts ...InvokeOption) GetAccountsResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetAccountsResult> getAccounts(GetAccountsArgs args, InvokeOptions options)
public static Output<GetAccountsResult> getAccounts(GetAccountsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:rds/getAccounts:getAccounts
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

DbInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The db instance id.
Ids Changes to this property will trigger replacement. List<string>
A list of Account IDs.
NameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. string
The status of the resource. Valid values: Available, Unavailable.
DbInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The db instance id.
Ids Changes to this property will trigger replacement. []string
A list of Account IDs.
NameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. string
The status of the resource. Valid values: Available, Unavailable.
dbInstanceId
This property is required.
Changes to this property will trigger replacement.
String
The db instance id.
ids Changes to this property will trigger replacement. List<String>
A list of Account IDs.
nameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. String
The status of the resource. Valid values: Available, Unavailable.
dbInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The db instance id.
ids Changes to this property will trigger replacement. string[]
A list of Account IDs.
nameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. string
The status of the resource. Valid values: Available, Unavailable.
db_instance_id
This property is required.
Changes to this property will trigger replacement.
str
The db instance id.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Account IDs.
name_regex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. str
The status of the resource. Valid values: Available, Unavailable.
dbInstanceId
This property is required.
Changes to this property will trigger replacement.
String
The db instance id.
ids Changes to this property will trigger replacement. List<String>
A list of Account IDs.
nameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. String
The status of the resource. Valid values: Available, Unavailable.

getAccounts Result

The following output properties are available:

Accounts List<Pulumi.AliCloud.Rds.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 This property is required. string
Database description.
AccountName This property is required. string
Name of database account.
AccountType This property is required. string
Privilege type of account.
DatabasePrivileges This property is required. List<Pulumi.AliCloud.Rds.Inputs.GetAccountsAccountDatabasePrivilege>
A list of database permissions the account has.
Id This property is required. string
The ID of the Account.
PrivExceeded This property is required. string
Whether the maximum number of databases managed by the account is exceeded.
Status This property is required. string
The status of the resource.
AccountDescription This property is required. string
Database description.
AccountName This property is required. string
Name of database account.
AccountType This property is required. string
Privilege type of account.
DatabasePrivileges This property is required. []GetAccountsAccountDatabasePrivilege
A list of database permissions the account has.
Id This property is required. string
The ID of the Account.
PrivExceeded This property is required. string
Whether the maximum number of databases managed by the account is exceeded.
Status This property is required. string
The status of the resource.
accountDescription This property is required. String
Database description.
accountName This property is required. String
Name of database account.
accountType This property is required. String
Privilege type of account.
databasePrivileges This property is required. List<GetAccountsAccountDatabasePrivilege>
A list of database permissions the account has.
id This property is required. String
The ID of the Account.
privExceeded This property is required. String
Whether the maximum number of databases managed by the account is exceeded.
status This property is required. String
The status of the resource.
accountDescription This property is required. string
Database description.
accountName This property is required. string
Name of database account.
accountType This property is required. string
Privilege type of account.
databasePrivileges This property is required. GetAccountsAccountDatabasePrivilege[]
A list of database permissions the account has.
id This property is required. string
The ID of the Account.
privExceeded This property is required. string
Whether the maximum number of databases managed by the account is exceeded.
status This property is required. string
The status of the resource.
account_description This property is required. str
Database description.
account_name This property is required. str
Name of database account.
account_type This property is required. str
Privilege type of account.
database_privileges This property is required. Sequence[GetAccountsAccountDatabasePrivilege]
A list of database permissions the account has.
id This property is required. str
The ID of the Account.
priv_exceeded This property is required. str
Whether the maximum number of databases managed by the account is exceeded.
status This property is required. str
The status of the resource.
accountDescription This property is required. String
Database description.
accountName This property is required. String
Name of database account.
accountType This property is required. String
Privilege type of account.
databasePrivileges This property is required. List<Property Map>
A list of database permissions the account has.
id This property is required. String
The ID of the Account.
privExceeded This property is required. String
Whether the maximum number of databases managed by the account is exceeded.
status This property is required. String
The status of the resource.

GetAccountsAccountDatabasePrivilege

AccountPrivilege This property is required. string
The type of permission for the account.
AccountPrivilegeDetail This property is required. string
The specific permissions corresponding to the type of account permissions.
DbName This property is required. string
Database name.
AccountPrivilege This property is required. string
The type of permission for the account.
AccountPrivilegeDetail This property is required. string
The specific permissions corresponding to the type of account permissions.
DbName This property is required. string
Database name.
accountPrivilege This property is required. String
The type of permission for the account.
accountPrivilegeDetail This property is required. String
The specific permissions corresponding to the type of account permissions.
dbName This property is required. String
Database name.
accountPrivilege This property is required. string
The type of permission for the account.
accountPrivilegeDetail This property is required. string
The specific permissions corresponding to the type of account permissions.
dbName This property is required. string
Database name.
account_privilege This property is required. str
The type of permission for the account.
account_privilege_detail This property is required. str
The specific permissions corresponding to the type of account permissions.
db_name This property is required. str
Database name.
accountPrivilege This property is required. String
The type of permission for the account.
accountPrivilegeDetail This property is required. String
The specific permissions corresponding to the type of account permissions.
dbName This property is required. String
Database name.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi