Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.rds.getAccounts
Explore with Pulumi AI
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);
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)
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
	})
}
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),
    };
});
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()));
    }
}
variables:
  example:
    fn::invoke:
      Function: alicloud:rds:getAccounts
      Arguments:
        dbInstanceId: example_value
        nameRegex: the_resource_name
outputs:
  firstRdsAccountId: ${example.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:rds/getAccounts:getAccounts
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Db
Instance stringId  - The db instance id.
 - Ids List<string>
 - A list of Account IDs.
 - 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 resource. Valid values: 
Available,Unavailable. 
- Db
Instance stringId  - The db instance id.
 - Ids []string
 - A list of Account IDs.
 - 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 resource. Valid values: 
Available,Unavailable. 
- db
Instance StringId  - The db instance id.
 - ids List<String>
 - A list of Account IDs.
 - 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 resource. Valid values: 
Available,Unavailable. 
- db
Instance stringId  - The db instance id.
 - ids string[]
 - A list of Account IDs.
 - 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 resource. Valid values: 
Available,Unavailable. 
- db_
instance_ strid  - The db instance id.
 - ids Sequence[str]
 - A list of Account IDs.
 - 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. Valid values: 
Available,Unavailable. 
- db
Instance StringId  - The db instance id.
 - ids List<String>
 - A list of Account IDs.
 - 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 resource. Valid values: 
Available,Unavailable. 
getAccounts Result
The following output properties are available:
- Accounts
List<Pulumi.
Ali Cloud. Rds. 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 - Database description.
 - Account
Name string - Name of database account.
 - Account
Type string - Privilege type of account.
 - Database
Privileges List<Pulumi.Ali Cloud. Rds. Inputs. Get Accounts Account Database Privilege>  - A list of database permissions the account has.
 - Id string
 - The ID of the Account.
 - Priv
Exceeded string - Whether the maximum number of databases managed by the account is exceeded.
 - Status string
 - The status of the resource.
 
- Account
Description string - Database description.
 - Account
Name string - Name of database account.
 - Account
Type string - Privilege type of account.
 - Database
Privileges []GetAccounts Account Database Privilege  - A list of database permissions the account has.
 - Id string
 - The ID of the Account.
 - Priv
Exceeded string - Whether the maximum number of databases managed by the account is exceeded.
 - Status string
 - The status of the resource.
 
- account
Description String - Database description.
 - account
Name String - Name of database account.
 - account
Type String - Privilege type of account.
 - database
Privileges List<GetAccounts Account Database Privilege>  - A list of database permissions the account has.
 - id String
 - The ID of the Account.
 - priv
Exceeded String - Whether the maximum number of databases managed by the account is exceeded.
 - status String
 - The status of the resource.
 
- account
Description string - Database description.
 - account
Name string - Name of database account.
 - account
Type string - Privilege type of account.
 - database
Privileges GetAccounts Account Database Privilege[]  - A list of database permissions the account has.
 - id string
 - The ID of the Account.
 - priv
Exceeded string - Whether the maximum number of databases managed by the account is exceeded.
 - status string
 - The status of the resource.
 
- account_
description str - Database description.
 - account_
name str - Name of database account.
 - account_
type str - Privilege type of account.
 - database_
privileges Sequence[GetAccounts Account Database Privilege]  - A list of database permissions the account has.
 - id str
 - The ID of the Account.
 - priv_
exceeded str - Whether the maximum number of databases managed by the account is exceeded.
 - status str
 - The status of the resource.
 
- account
Description String - Database description.
 - account
Name String - Name of database account.
 - account
Type String - Privilege type of account.
 - database
Privileges List<Property Map> - A list of database permissions the account has.
 - id String
 - The ID of the Account.
 - priv
Exceeded String - Whether the maximum number of databases managed by the account is exceeded.
 - status String
 - The status of the resource.
 
GetAccountsAccountDatabasePrivilege    
- Account
Privilege string - The type of permission for the account.
 - Account
Privilege stringDetail  - The specific permissions corresponding to the type of account permissions.
 - Db
Name string - Database name.
 
- Account
Privilege string - The type of permission for the account.
 - Account
Privilege stringDetail  - The specific permissions corresponding to the type of account permissions.
 - Db
Name string - Database name.
 
- account
Privilege String - The type of permission for the account.
 - account
Privilege StringDetail  - The specific permissions corresponding to the type of account permissions.
 - db
Name String - Database name.
 
- account
Privilege string - The type of permission for the account.
 - account
Privilege stringDetail  - The specific permissions corresponding to the type of account permissions.
 - db
Name string - Database name.
 
- account_
privilege str - The type of permission for the account.
 - account_
privilege_ strdetail  - The specific permissions corresponding to the type of account permissions.
 - db_
name str - Database name.
 
- account
Privilege String - The type of permission for the account.
 - account
Privilege StringDetail  - The specific permissions corresponding to the type of account permissions.
 - db
Name String - Database name.
 
Package Details
- Repository
 - Alibaba Cloud pulumi/pulumi-alicloud
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
alicloudTerraform Provider.