1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. bastionhost
  5. getHostShareKeys
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.bastionhost.getHostShareKeys

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

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

    NOTE: Available in v1.165.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.bastionhost.getHostShareKeys({
        instanceId: "example_value",
        ids: [
            "example_value-1",
            "example_value-2",
        ],
    });
    export const bastionhostHostShareKeyId1 = ids.then(ids => ids.keys?.[0]?.id);
    const nameRegex = alicloud.bastionhost.getHostShareKeys({
        instanceId: "example_value",
        nameRegex: "^my-HostShareKey",
    });
    export const bastionhostHostShareKeyId2 = nameRegex.then(nameRegex => nameRegex.keys?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.bastionhost.get_host_share_keys(instance_id="example_value",
        ids=[
            "example_value-1",
            "example_value-2",
        ])
    pulumi.export("bastionhostHostShareKeyId1", ids.keys[0].id)
    name_regex = alicloud.bastionhost.get_host_share_keys(instance_id="example_value",
        name_regex="^my-HostShareKey")
    pulumi.export("bastionhostHostShareKeyId2", name_regex.keys[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.GetHostShareKeys(ctx, &bastionhost.GetHostShareKeysArgs{
    			InstanceId: "example_value",
    			Ids: []string{
    				"example_value-1",
    				"example_value-2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("bastionhostHostShareKeyId1", ids.Keys[0].Id)
    		nameRegex, err := bastionhost.GetHostShareKeys(ctx, &bastionhost.GetHostShareKeysArgs{
    			InstanceId: "example_value",
    			NameRegex:  pulumi.StringRef("^my-HostShareKey"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("bastionhostHostShareKeyId2", nameRegex.Keys[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.GetHostShareKeys.Invoke(new()
        {
            InstanceId = "example_value",
            Ids = new[]
            {
                "example_value-1",
                "example_value-2",
            },
        });
    
        var nameRegex = AliCloud.BastionHost.GetHostShareKeys.Invoke(new()
        {
            InstanceId = "example_value",
            NameRegex = "^my-HostShareKey",
        });
    
        return new Dictionary<string, object?>
        {
            ["bastionhostHostShareKeyId1"] = ids.Apply(getHostShareKeysResult => getHostShareKeysResult.Keys[0]?.Id),
            ["bastionhostHostShareKeyId2"] = nameRegex.Apply(getHostShareKeysResult => getHostShareKeysResult.Keys[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.GetHostShareKeysArgs;
    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.getHostShareKeys(GetHostShareKeysArgs.builder()
                .instanceId("example_value")
                .ids(            
                    "example_value-1",
                    "example_value-2")
                .build());
    
            ctx.export("bastionhostHostShareKeyId1", ids.applyValue(getHostShareKeysResult -> getHostShareKeysResult.keys()[0].id()));
            final var nameRegex = BastionhostFunctions.getHostShareKeys(GetHostShareKeysArgs.builder()
                .instanceId("example_value")
                .nameRegex("^my-HostShareKey")
                .build());
    
            ctx.export("bastionhostHostShareKeyId2", nameRegex.applyValue(getHostShareKeysResult -> getHostShareKeysResult.keys()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:bastionhost:getHostShareKeys
          Arguments:
            instanceId: example_value
            ids:
              - example_value-1
              - example_value-2
      nameRegex:
        fn::invoke:
          Function: alicloud:bastionhost:getHostShareKeys
          Arguments:
            instanceId: example_value
            nameRegex: ^my-HostShareKey
    outputs:
      bastionhostHostShareKeyId1: ${ids.keys[0].id}
      bastionhostHostShareKeyId2: ${nameRegex.keys[0].id}
    

    Using getHostShareKeys

    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 getHostShareKeys(args: GetHostShareKeysArgs, opts?: InvokeOptions): Promise<GetHostShareKeysResult>
    function getHostShareKeysOutput(args: GetHostShareKeysOutputArgs, opts?: InvokeOptions): Output<GetHostShareKeysResult>
    def get_host_share_keys(enable_details: Optional[bool] = None,
                            ids: Optional[Sequence[str]] = None,
                            instance_id: Optional[str] = None,
                            name_regex: Optional[str] = None,
                            output_file: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetHostShareKeysResult
    def get_host_share_keys_output(enable_details: Optional[pulumi.Input[bool]] = 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,
                            opts: Optional[InvokeOptions] = None) -> Output[GetHostShareKeysResult]
    func GetHostShareKeys(ctx *Context, args *GetHostShareKeysArgs, opts ...InvokeOption) (*GetHostShareKeysResult, error)
    func GetHostShareKeysOutput(ctx *Context, args *GetHostShareKeysOutputArgs, opts ...InvokeOption) GetHostShareKeysResultOutput

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

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

    The following arguments are supported:

    InstanceId string
    The ID of the Bastion instance.
    EnableDetails bool
    Default to false. Set it to true can output more details about resource attributes.
    Ids List<string>
    A list of Host Share Key IDs.
    NameRegex string
    A regex string to filter results by Host Share Key name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    InstanceId string
    The ID of the Bastion instance.
    EnableDetails bool
    Default to false. Set it to true can output more details about resource attributes.
    Ids []string
    A list of Host Share Key IDs.
    NameRegex string
    A regex string to filter results by Host Share Key name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    instanceId String
    The ID of the Bastion instance.
    enableDetails Boolean
    Default to false. Set it to true can output more details about resource attributes.
    ids List<String>
    A list of Host Share Key IDs.
    nameRegex String
    A regex string to filter results by Host Share Key name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    instanceId string
    The ID of the Bastion instance.
    enableDetails boolean
    Default to false. Set it to true can output more details about resource attributes.
    ids string[]
    A list of Host Share Key IDs.
    nameRegex string
    A regex string to filter results by Host Share Key name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    instance_id str
    The ID of the Bastion instance.
    enable_details bool
    Default to false. Set it to true can output more details about resource attributes.
    ids Sequence[str]
    A list of Host Share Key IDs.
    name_regex str
    A regex string to filter results by Host Share Key name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    instanceId String
    The ID of the Bastion instance.
    enableDetails Boolean
    Default to false. Set it to true can output more details about resource attributes.
    ids List<String>
    A list of Host Share Key IDs.
    nameRegex String
    A regex string to filter results by Host Share Key name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getHostShareKeys Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    InstanceId string
    Keys List<Pulumi.AliCloud.BastionHost.Outputs.GetHostShareKeysKey>
    Names List<string>
    EnableDetails bool
    NameRegex string
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    InstanceId string
    Keys []GetHostShareKeysKey
    Names []string
    EnableDetails bool
    NameRegex string
    OutputFile string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    instanceId String
    keys List<GetHostShareKeysKey>
    names List<String>
    enableDetails Boolean
    nameRegex String
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    instanceId string
    keys GetHostShareKeysKey[]
    names string[]
    enableDetails boolean
    nameRegex string
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    instance_id str
    keys Sequence[GetHostShareKeysKey]
    names Sequence[str]
    enable_details bool
    name_regex str
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    instanceId String
    keys List<Property Map>
    names List<String>
    enableDetails Boolean
    nameRegex String
    outputFile String

    Supporting Types

    GetHostShareKeysKey

    HostShareKeyId string
    The first ID of the resource.
    HostShareKeyName string
    The name of the host shared key.
    Id string
    The ID of the Host Share Key.
    InstanceId string
    The ID of the Bastion instance.
    PrivateKeyFingerPrint string
    The fingerprint of the private key.
    HostShareKeyId string
    The first ID of the resource.
    HostShareKeyName string
    The name of the host shared key.
    Id string
    The ID of the Host Share Key.
    InstanceId string
    The ID of the Bastion instance.
    PrivateKeyFingerPrint string
    The fingerprint of the private key.
    hostShareKeyId String
    The first ID of the resource.
    hostShareKeyName String
    The name of the host shared key.
    id String
    The ID of the Host Share Key.
    instanceId String
    The ID of the Bastion instance.
    privateKeyFingerPrint String
    The fingerprint of the private key.
    hostShareKeyId string
    The first ID of the resource.
    hostShareKeyName string
    The name of the host shared key.
    id string
    The ID of the Host Share Key.
    instanceId string
    The ID of the Bastion instance.
    privateKeyFingerPrint string
    The fingerprint of the private key.
    host_share_key_id str
    The first ID of the resource.
    host_share_key_name str
    The name of the host shared key.
    id str
    The ID of the Host Share Key.
    instance_id str
    The ID of the Bastion instance.
    private_key_finger_print str
    The fingerprint of the private key.
    hostShareKeyId String
    The first ID of the resource.
    hostShareKeyName String
    The name of the host shared key.
    id String
    The ID of the Host Share Key.
    instanceId String
    The ID of the Bastion instance.
    privateKeyFingerPrint String
    The fingerprint of the private key.

    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.51.0 published on Saturday, Mar 23, 2024 by Pulumi