1. Packages
  2. Alicloud Provider
  3. API Docs
  4. bastionhost
  5. getHostAccounts
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.bastionhost.getHostAccounts

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

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

    NOTE: Available in v1.135.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.bastionhost.getHostAccounts({
        hostId: "15",
        instanceId: "example_value",
        ids: [
            "1",
            "2",
        ],
    });
    export const bastionhostHostAccountId1 = ids.then(ids => ids.accounts?.[0]?.id);
    const nameRegex = alicloud.bastionhost.getHostAccounts({
        hostId: "15",
        instanceId: "example_value",
        nameRegex: "^my-HostAccount",
    });
    export const bastionhostHostAccountId2 = nameRegex.then(nameRegex => nameRegex.accounts?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.bastionhost.get_host_accounts(host_id="15",
        instance_id="example_value",
        ids=[
            "1",
            "2",
        ])
    pulumi.export("bastionhostHostAccountId1", ids.accounts[0].id)
    name_regex = alicloud.bastionhost.get_host_accounts(host_id="15",
        instance_id="example_value",
        name_regex="^my-HostAccount")
    pulumi.export("bastionhostHostAccountId2", name_regex.accounts[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/bastionhost"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := bastionhost.GetHostAccounts(ctx, &bastionhost.GetHostAccountsArgs{
    			HostId:     "15",
    			InstanceId: "example_value",
    			Ids: []string{
    				"1",
    				"2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("bastionhostHostAccountId1", ids.Accounts[0].Id)
    		nameRegex, err := bastionhost.GetHostAccounts(ctx, &bastionhost.GetHostAccountsArgs{
    			HostId:     "15",
    			InstanceId: "example_value",
    			NameRegex:  pulumi.StringRef("^my-HostAccount"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("bastionhostHostAccountId2", nameRegex.Accounts[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.BastionHost.GetHostAccounts.Invoke(new()
        {
            HostId = "15",
            InstanceId = "example_value",
            Ids = new[]
            {
                "1",
                "2",
            },
        });
    
        var nameRegex = AliCloud.BastionHost.GetHostAccounts.Invoke(new()
        {
            HostId = "15",
            InstanceId = "example_value",
            NameRegex = "^my-HostAccount",
        });
    
        return new Dictionary<string, object?>
        {
            ["bastionhostHostAccountId1"] = ids.Apply(getHostAccountsResult => getHostAccountsResult.Accounts[0]?.Id),
            ["bastionhostHostAccountId2"] = nameRegex.Apply(getHostAccountsResult => getHostAccountsResult.Accounts[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.bastionhost.BastionhostFunctions;
    import com.pulumi.alicloud.bastionhost.inputs.GetHostAccountsArgs;
    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 ids = BastionhostFunctions.getHostAccounts(GetHostAccountsArgs.builder()
                .hostId("15")
                .instanceId("example_value")
                .ids(            
                    "1",
                    "2")
                .build());
    
            ctx.export("bastionhostHostAccountId1", ids.applyValue(getHostAccountsResult -> getHostAccountsResult.accounts()[0].id()));
            final var nameRegex = BastionhostFunctions.getHostAccounts(GetHostAccountsArgs.builder()
                .hostId("15")
                .instanceId("example_value")
                .nameRegex("^my-HostAccount")
                .build());
    
            ctx.export("bastionhostHostAccountId2", nameRegex.applyValue(getHostAccountsResult -> getHostAccountsResult.accounts()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:bastionhost:getHostAccounts
          Arguments:
            hostId: '15'
            instanceId: example_value
            ids:
              - '1'
              - '2'
      nameRegex:
        fn::invoke:
          Function: alicloud:bastionhost:getHostAccounts
          Arguments:
            hostId: '15'
            instanceId: example_value
            nameRegex: ^my-HostAccount
    outputs:
      bastionhostHostAccountId1: ${ids.accounts[0].id}
      bastionhostHostAccountId2: ${nameRegex.accounts[0].id}
    

    Using getHostAccounts

    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 getHostAccounts(args: GetHostAccountsArgs, opts?: InvokeOptions): Promise<GetHostAccountsResult>
    function getHostAccountsOutput(args: GetHostAccountsOutputArgs, opts?: InvokeOptions): Output<GetHostAccountsResult>
    def get_host_accounts(host_account_name: Optional[str] = None,
                          host_id: Optional[str] = None,
                          ids: Optional[Sequence[str]] = None,
                          instance_id: Optional[str] = None,
                          name_regex: Optional[str] = None,
                          output_file: Optional[str] = None,
                          protocol_name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetHostAccountsResult
    def get_host_accounts_output(host_account_name: Optional[pulumi.Input[str]] = None,
                          host_id: Optional[pulumi.Input[str]] = None,
                          ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                          instance_id: Optional[pulumi.Input[str]] = None,
                          name_regex: Optional[pulumi.Input[str]] = None,
                          output_file: Optional[pulumi.Input[str]] = None,
                          protocol_name: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetHostAccountsResult]
    func GetHostAccounts(ctx *Context, args *GetHostAccountsArgs, opts ...InvokeOption) (*GetHostAccountsResult, error)
    func GetHostAccountsOutput(ctx *Context, args *GetHostAccountsOutputArgs, opts ...InvokeOption) GetHostAccountsResultOutput

    > Note: This function is named GetHostAccounts in the Go SDK.

    public static class GetHostAccounts 
    {
        public static Task<GetHostAccountsResult> InvokeAsync(GetHostAccountsArgs args, InvokeOptions? opts = null)
        public static Output<GetHostAccountsResult> Invoke(GetHostAccountsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetHostAccountsResult> getHostAccounts(GetHostAccountsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:bastionhost/getHostAccounts:getHostAccounts
      arguments:
        # arguments dictionary

    The following arguments are supported:

    HostId string
    Specifies the database where you want to create your hosting account's host ID.
    InstanceId string
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    HostAccountName string
    Specify the new hosting account's name, support the longest 128 characters.
    Ids List<string>
    A list of Host Account IDs.
    NameRegex string
    A regex string to filter results by Host Account name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ProtocolName string
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    HostId string
    Specifies the database where you want to create your hosting account's host ID.
    InstanceId string
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    HostAccountName string
    Specify the new hosting account's name, support the longest 128 characters.
    Ids []string
    A list of Host Account IDs.
    NameRegex string
    A regex string to filter results by Host Account name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ProtocolName string
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    hostId String
    Specifies the database where you want to create your hosting account's host ID.
    instanceId String
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    hostAccountName String
    Specify the new hosting account's name, support the longest 128 characters.
    ids List<String>
    A list of Host Account IDs.
    nameRegex String
    A regex string to filter results by Host Account name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    protocolName String
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    hostId string
    Specifies the database where you want to create your hosting account's host ID.
    instanceId string
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    hostAccountName string
    Specify the new hosting account's name, support the longest 128 characters.
    ids string[]
    A list of Host Account IDs.
    nameRegex string
    A regex string to filter results by Host Account name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    protocolName string
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    host_id str
    Specifies the database where you want to create your hosting account's host ID.
    instance_id str
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    host_account_name str
    Specify the new hosting account's name, support the longest 128 characters.
    ids Sequence[str]
    A list of Host Account IDs.
    name_regex str
    A regex string to filter results by Host Account name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    protocol_name str
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    hostId String
    Specifies the database where you want to create your hosting account's host ID.
    instanceId String
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    hostAccountName String
    Specify the new hosting account's name, support the longest 128 characters.
    ids List<String>
    A list of Host Account IDs.
    nameRegex String
    A regex string to filter results by Host Account name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    protocolName String
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.

    getHostAccounts Result

    The following output properties are available:

    Accounts List<Pulumi.AliCloud.BastionHost.Outputs.GetHostAccountsAccount>
    HostId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    InstanceId string
    Names List<string>
    HostAccountName string
    NameRegex string
    OutputFile string
    ProtocolName string
    Accounts []GetHostAccountsAccount
    HostId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    InstanceId string
    Names []string
    HostAccountName string
    NameRegex string
    OutputFile string
    ProtocolName string
    accounts List<GetHostAccountsAccount>
    hostId String
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    instanceId String
    names List<String>
    hostAccountName String
    nameRegex String
    outputFile String
    protocolName String
    accounts GetHostAccountsAccount[]
    hostId string
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    instanceId string
    names string[]
    hostAccountName string
    nameRegex string
    outputFile string
    protocolName string
    accounts Sequence[GetHostAccountsAccount]
    host_id str
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    instance_id str
    names Sequence[str]
    host_account_name str
    name_regex str
    output_file str
    protocol_name str
    accounts List<Property Map>
    hostId String
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    instanceId String
    names List<String>
    hostAccountName String
    nameRegex String
    outputFile String
    protocolName String

    Supporting Types

    GetHostAccountsAccount

    HasPassword bool
    Whether to set a new password.
    HostAccountId string
    Hosting account ID.
    HostAccountName string
    Specify the new hosting account's name, support the longest 128 characters.
    HostId string
    Specifies the database where you want to create your hosting account's host ID.
    Id string
    The ID of the Host Account.
    InstanceId string
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    PrivateKeyFingerprint string
    The situation where the private keys of the fingerprint information.
    ProtocolName string
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    HasPassword bool
    Whether to set a new password.
    HostAccountId string
    Hosting account ID.
    HostAccountName string
    Specify the new hosting account's name, support the longest 128 characters.
    HostId string
    Specifies the database where you want to create your hosting account's host ID.
    Id string
    The ID of the Host Account.
    InstanceId string
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    PrivateKeyFingerprint string
    The situation where the private keys of the fingerprint information.
    ProtocolName string
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    hasPassword Boolean
    Whether to set a new password.
    hostAccountId String
    Hosting account ID.
    hostAccountName String
    Specify the new hosting account's name, support the longest 128 characters.
    hostId String
    Specifies the database where you want to create your hosting account's host ID.
    id String
    The ID of the Host Account.
    instanceId String
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    privateKeyFingerprint String
    The situation where the private keys of the fingerprint information.
    protocolName String
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    hasPassword boolean
    Whether to set a new password.
    hostAccountId string
    Hosting account ID.
    hostAccountName string
    Specify the new hosting account's name, support the longest 128 characters.
    hostId string
    Specifies the database where you want to create your hosting account's host ID.
    id string
    The ID of the Host Account.
    instanceId string
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    privateKeyFingerprint string
    The situation where the private keys of the fingerprint information.
    protocolName string
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    has_password bool
    Whether to set a new password.
    host_account_id str
    Hosting account ID.
    host_account_name str
    Specify the new hosting account's name, support the longest 128 characters.
    host_id str
    Specifies the database where you want to create your hosting account's host ID.
    id str
    The ID of the Host Account.
    instance_id str
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    private_key_fingerprint str
    The situation where the private keys of the fingerprint information.
    protocol_name str
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
    hasPassword Boolean
    Whether to set a new password.
    hostAccountId String
    Hosting account ID.
    hostAccountName String
    Specify the new hosting account's name, support the longest 128 characters.
    hostId String
    Specifies the database where you want to create your hosting account's host ID.
    id String
    The ID of the Host Account.
    instanceId String
    Specifies the database where you want to create your hosting account's host bastion host ID of.
    privateKeyFingerprint String
    The situation where the private keys of the fingerprint information.
    protocolName String
    Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.

    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.62.1 published on Monday, Sep 16, 2024 by Pulumi