Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.mongodb.getAccounts
Explore with Pulumi AI
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 dictionaryThe following arguments are supported:
- Instance
Id string - The ID of the instance.
 - Account
Name string - The name of the account. Valid values: 
root. - Output
File string - File name where to save data source results (after running 
pulumi preview). 
- Instance
Id string - The ID of the instance.
 - Account
Name string - The name of the account. Valid values: 
root. - Output
File string - File name where to save data source results (after running 
pulumi preview). 
- instance
Id String - The ID of the instance.
 - account
Name String - The name of the account. Valid values: 
root. - output
File String - File name where to save data source results (after running 
pulumi preview). 
- instance
Id string - The ID of the instance.
 - account
Name string - The name of the account. Valid values: 
root. - output
File 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). 
- instance
Id String - The ID of the instance.
 - account
Name String - The name of the account. Valid values: 
root. - output
File String - File name where to save data source results (after running 
pulumi preview). 
getAccounts Result
The following output properties are available:
- Accounts
List<Pulumi.
Ali Cloud. Mongo DB. Outputs. Get Accounts Account>  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Instance
Id string - Account
Name string - Output
File string 
- Accounts
[]Get
Accounts Account  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Instance
Id string - Account
Name string - Output
File string 
- accounts
List<Get
Accounts Account>  - id String
 - The provider-assigned unique ID for this managed resource.
 - instance
Id String - account
Name String - output
File String 
- accounts
Get
Accounts Account[]  - id string
 - The provider-assigned unique ID for this managed resource.
 - instance
Id string - account
Name string - output
File string 
- accounts
Sequence[Get
Accounts Account]  - 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.
 - instance
Id String - account
Name String - output
File String 
Supporting Types
GetAccountsAccount  
- Account
Description string - The description of the account.
 - Account
Name string - The name of the account.
 - Character
Type 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>. - Instance
Id string - The id of the instance to which the account belongs.
 - Status string
 - The status of the account. Valid values: 
Unavailable,Available. 
- Account
Description string - The description of the account.
 - Account
Name string - The name of the account.
 - Character
Type 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>. - Instance
Id string - The id of the instance to which the account belongs.
 - Status string
 - The status of the account. Valid values: 
Unavailable,Available. 
- account
Description String - The description of the account.
 - account
Name String - The name of the account.
 - character
Type 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>. - instance
Id String - The id of the instance to which the account belongs.
 - status String
 - The status of the account. Valid values: 
Unavailable,Available. 
- account
Description string - The description of the account.
 - account
Name string - The name of the account.
 - character
Type 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>. - instance
Id 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. 
- account
Description String - The description of the account.
 - account
Name String - The name of the account.
 - character
Type 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>. - instance
Id 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 
alicloudTerraform Provider.