1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. rds
  5. getAccounts
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.rds.getAccounts

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 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);
    
    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 dictionary

    The following arguments are supported:

    DbInstanceId string
    The db instance id.
    Ids List<string>
    A list of Account IDs.
    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 resource. Valid values: Available, Unavailable.
    DbInstanceId string
    The db instance id.
    Ids []string
    A list of Account IDs.
    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 resource. Valid values: Available, Unavailable.
    dbInstanceId String
    The db instance id.
    ids List<String>
    A list of Account IDs.
    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 resource. Valid values: Available, Unavailable.
    dbInstanceId string
    The db instance id.
    ids string[]
    A list of Account IDs.
    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 resource. Valid values: Available, Unavailable.
    db_instance_id str
    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.
    dbInstanceId String
    The db instance id.
    ids List<String>
    A list of Account IDs.
    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 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 string
    Database description.
    AccountName string
    Name of database account.
    AccountType string
    Privilege type of account.
    DatabasePrivileges List<Pulumi.AliCloud.Rds.Inputs.GetAccountsAccountDatabasePrivilege>
    A list of database permissions the account has.
    Id string
    The ID of the Account.
    PrivExceeded string
    Whether the maximum number of databases managed by the account is exceeded.
    Status string
    The status of the resource.
    AccountDescription string
    Database description.
    AccountName string
    Name of database account.
    AccountType string
    Privilege type of account.
    DatabasePrivileges []GetAccountsAccountDatabasePrivilege
    A list of database permissions the account has.
    Id string
    The ID of the Account.
    PrivExceeded string
    Whether the maximum number of databases managed by the account is exceeded.
    Status string
    The status of the resource.
    accountDescription String
    Database description.
    accountName String
    Name of database account.
    accountType String
    Privilege type of account.
    databasePrivileges List<GetAccountsAccountDatabasePrivilege>
    A list of database permissions the account has.
    id String
    The ID of the Account.
    privExceeded String
    Whether the maximum number of databases managed by the account is exceeded.
    status String
    The status of the resource.
    accountDescription string
    Database description.
    accountName string
    Name of database account.
    accountType string
    Privilege type of account.
    databasePrivileges GetAccountsAccountDatabasePrivilege[]
    A list of database permissions the account has.
    id string
    The ID of the Account.
    privExceeded 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[GetAccountsAccountDatabasePrivilege]
    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.
    accountDescription String
    Database description.
    accountName String
    Name of database account.
    accountType String
    Privilege type of account.
    databasePrivileges List<Property Map>
    A list of database permissions the account has.
    id String
    The ID of the Account.
    privExceeded String
    Whether the maximum number of databases managed by the account is exceeded.
    status String
    The status of the resource.

    GetAccountsAccountDatabasePrivilege

    AccountPrivilege string
    The type of permission for the account.
    AccountPrivilegeDetail string
    The specific permissions corresponding to the type of account permissions.
    DbName string
    Database name.
    AccountPrivilege string
    The type of permission for the account.
    AccountPrivilegeDetail string
    The specific permissions corresponding to the type of account permissions.
    DbName string
    Database name.
    accountPrivilege String
    The type of permission for the account.
    accountPrivilegeDetail String
    The specific permissions corresponding to the type of account permissions.
    dbName String
    Database name.
    accountPrivilege string
    The type of permission for the account.
    accountPrivilegeDetail string
    The specific permissions corresponding to the type of account permissions.
    dbName string
    Database name.
    account_privilege str
    The type of permission for the account.
    account_privilege_detail str
    The specific permissions corresponding to the type of account permissions.
    db_name str
    Database name.
    accountPrivilege String
    The type of permission for the account.
    accountPrivilegeDetail String
    The specific permissions corresponding to the type of account permissions.
    dbName 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.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi