1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. mongodb
  5. getAccounts
Alibaba Cloud v3.57.0 published on Saturday, Jun 15, 2024 by Pulumi

alicloud.mongodb.getAccounts

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.0 published on Saturday, Jun 15, 2024 by Pulumi

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

    NOTE: Available in v1.148.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const example = alicloud.mongodb.getAccounts({
        instanceId: "example_value",
        accountName: "root",
    });
    export const mongodbAccountId1 = example.then(example => example.accounts?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    example = alicloud.mongodb.get_accounts(instance_id="example_value",
        account_name="root")
    pulumi.export("mongodbAccountId1", example.accounts[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/mongodb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := mongodb.GetAccounts(ctx, &mongodb.GetAccountsArgs{
    			InstanceId:  "example_value",
    			AccountName: pulumi.StringRef("root"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("mongodbAccountId1", 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.MongoDB.GetAccounts.Invoke(new()
        {
            InstanceId = "example_value",
            AccountName = "root",
        });
    
        return new Dictionary<string, object?>
        {
            ["mongodbAccountId1"] = 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.mongodb.MongodbFunctions;
    import com.pulumi.alicloud.mongodb.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 = MongodbFunctions.getAccounts(GetAccountsArgs.builder()
                .instanceId("example_value")
                .accountName("root")
                .build());
    
            ctx.export("mongodbAccountId1", example.applyValue(getAccountsResult -> getAccountsResult.accounts()[0].id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: alicloud:mongodb:getAccounts
          Arguments:
            instanceId: example_value
            accountName: root
    outputs:
      mongodbAccountId1: ${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(account_name: Optional[str] = None,
                     instance_id: Optional[str] = None,
                     output_file: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetAccountsResult
    def get_accounts_output(account_name: Optional[pulumi.Input[str]] = None,
                     instance_id: Optional[pulumi.Input[str]] = None,
                     output_file: 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:mongodb/getAccounts:getAccounts
      arguments:
        # arguments dictionary

    The following arguments are supported:

    InstanceId string
    The ID of the instance.
    AccountName string
    The name of the account. Valid values: root.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    InstanceId string
    The ID of the instance.
    AccountName string
    The name of the account. Valid values: root.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    instanceId String
    The ID of the instance.
    accountName String
    The name of the account. Valid values: root.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    instanceId string
    The ID of the instance.
    accountName string
    The name of the account. Valid values: root.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    instance_id str
    The ID of the instance.
    account_name str
    The name of the account. Valid values: root.
    output_file str
    File name where to save data source results (after running pulumi preview).
    instanceId String
    The ID of the instance.
    accountName String
    The name of the account. Valid values: root.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getAccounts Result

    The following output properties are available:

    Accounts List<Pulumi.AliCloud.MongoDB.Outputs.GetAccountsAccount>
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceId string
    AccountName string
    OutputFile string
    Accounts []GetAccountsAccount
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceId string
    AccountName string
    OutputFile string
    accounts List<GetAccountsAccount>
    id String
    The provider-assigned unique ID for this managed resource.
    instanceId String
    accountName String
    outputFile String
    accounts GetAccountsAccount[]
    id string
    The provider-assigned unique ID for this managed resource.
    instanceId string
    accountName string
    outputFile string
    accounts Sequence[GetAccountsAccount]
    id str
    The provider-assigned unique ID for this managed resource.
    instance_id str
    account_name str
    output_file str
    accounts List<Property Map>
    id String
    The provider-assigned unique ID for this managed resource.
    instanceId String
    accountName String
    outputFile String

    Supporting Types

    GetAccountsAccount

    AccountDescription string
    The description of the account.
    AccountName string
    The name of the account.
    CharacterType string
    The role of the account. Valid values: db, cs, mongos, logic, normal.
    Id string
    The ID of the Account. The value formats as <instance_id>:<account_name>.
    InstanceId string
    The id of the instance to which the account belongs.
    Status string
    The status of the account. Valid values: Unavailable, Available.
    AccountDescription string
    The description of the account.
    AccountName string
    The name of the account.
    CharacterType string
    The role of the account. Valid values: db, cs, mongos, logic, normal.
    Id string
    The ID of the Account. The value formats as <instance_id>:<account_name>.
    InstanceId string
    The id of the instance to which the account belongs.
    Status string
    The status of the account. Valid values: Unavailable, Available.
    accountDescription String
    The description of the account.
    accountName String
    The name of the account.
    characterType String
    The role of the account. Valid values: db, cs, mongos, logic, normal.
    id String
    The ID of the Account. The value formats as <instance_id>:<account_name>.
    instanceId String
    The id of the instance to which the account belongs.
    status String
    The status of the account. Valid values: Unavailable, Available.
    accountDescription string
    The description of the account.
    accountName string
    The name of the account.
    characterType string
    The role of the account. Valid values: db, cs, mongos, logic, normal.
    id string
    The ID of the Account. The value formats as <instance_id>:<account_name>.
    instanceId string
    The id of the instance to which the account belongs.
    status string
    The status of the account. Valid values: Unavailable, Available.
    account_description str
    The description of the account.
    account_name str
    The name of the account.
    character_type str
    The role of the account. Valid values: db, cs, mongos, logic, normal.
    id str
    The ID of the Account. The value formats as <instance_id>:<account_name>.
    instance_id str
    The id of the instance to which the account belongs.
    status str
    The status of the account. Valid values: Unavailable, Available.
    accountDescription String
    The description of the account.
    accountName String
    The name of the account.
    characterType String
    The role of the account. Valid values: db, cs, mongos, logic, normal.
    id String
    The ID of the Account. The value formats as <instance_id>:<account_name>.
    instanceId String
    The id of the instance to which the account belongs.
    status String
    The status of the account. Valid values: Unavailable, Available.

    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.57.0 published on Saturday, Jun 15, 2024 by Pulumi