1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ens
  5. getKeyPairs
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.ens.getKeyPairs

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    This data source provides the Ens Key Pairs of the current Alibaba Cloud user.

    NOTE: Available in v1.133.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const nameRegex = alicloud.ens.getKeyPairs({
        version: "example_value",
        nameRegex: "^my-KeyPair",
    });
    export const ensKeyPairId1 = nameRegex.then(nameRegex => nameRegex.pairs?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    name_regex = alicloud.ens.get_key_pairs(version="example_value",
        name_regex="^my-KeyPair")
    pulumi.export("ensKeyPairId1", name_regex.pairs[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		nameRegex, err := ens.GetKeyPairs(ctx, &ens.GetKeyPairsArgs{
    			Version:   "example_value",
    			NameRegex: pulumi.StringRef("^my-KeyPair"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("ensKeyPairId1", nameRegex.Pairs[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var nameRegex = AliCloud.Ens.GetKeyPairs.Invoke(new()
        {
            Version = "example_value",
            NameRegex = "^my-KeyPair",
        });
    
        return new Dictionary<string, object?>
        {
            ["ensKeyPairId1"] = nameRegex.Apply(getKeyPairsResult => getKeyPairsResult.Pairs[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ens.EnsFunctions;
    import com.pulumi.alicloud.ens.inputs.GetKeyPairsArgs;
    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 nameRegex = EnsFunctions.getKeyPairs(GetKeyPairsArgs.builder()
                .version("example_value")
                .nameRegex("^my-KeyPair")
                .build());
    
            ctx.export("ensKeyPairId1", nameRegex.applyValue(getKeyPairsResult -> getKeyPairsResult.pairs()[0].id()));
        }
    }
    
    variables:
      nameRegex:
        fn::invoke:
          Function: alicloud:ens:getKeyPairs
          Arguments:
            version: example_value
            nameRegex: ^my-KeyPair
    outputs:
      ensKeyPairId1: ${nameRegex.pairs[0].id}
    

    Using getKeyPairs

    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 getKeyPairs(args: GetKeyPairsArgs, opts?: InvokeOptions): Promise<GetKeyPairsResult>
    function getKeyPairsOutput(args: GetKeyPairsOutputArgs, opts?: InvokeOptions): Output<GetKeyPairsResult>
    def get_key_pairs(key_pair_name: Optional[str] = None,
                      name_regex: Optional[str] = None,
                      output_file: Optional[str] = None,
                      version: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetKeyPairsResult
    def get_key_pairs_output(key_pair_name: Optional[pulumi.Input[str]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      output_file: Optional[pulumi.Input[str]] = None,
                      version: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetKeyPairsResult]
    func GetKeyPairs(ctx *Context, args *GetKeyPairsArgs, opts ...InvokeOption) (*GetKeyPairsResult, error)
    func GetKeyPairsOutput(ctx *Context, args *GetKeyPairsOutputArgs, opts ...InvokeOption) GetKeyPairsResultOutput

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

    public static class GetKeyPairs 
    {
        public static Task<GetKeyPairsResult> InvokeAsync(GetKeyPairsArgs args, InvokeOptions? opts = null)
        public static Output<GetKeyPairsResult> Invoke(GetKeyPairsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKeyPairsResult> getKeyPairs(GetKeyPairsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:ens/getKeyPairs:getKeyPairs
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Version string
    The version number.
    KeyPairName string
    The name of the key pair.
    NameRegex string
    A regex string to filter results by Key Pair name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Version string
    The version number.
    KeyPairName string
    The name of the key pair.
    NameRegex string
    A regex string to filter results by Key Pair name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    version String
    The version number.
    keyPairName String
    The name of the key pair.
    nameRegex String
    A regex string to filter results by Key Pair name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    version string
    The version number.
    keyPairName string
    The name of the key pair.
    nameRegex string
    A regex string to filter results by Key Pair name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    version str
    The version number.
    key_pair_name str
    The name of the key pair.
    name_regex str
    A regex string to filter results by Key Pair name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    version String
    The version number.
    keyPairName String
    The name of the key pair.
    nameRegex String
    A regex string to filter results by Key Pair name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getKeyPairs Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    Pairs List<Pulumi.AliCloud.Ens.Outputs.GetKeyPairsPair>
    Version string
    KeyPairName string
    NameRegex string
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    Pairs []GetKeyPairsPair
    Version string
    KeyPairName string
    NameRegex string
    OutputFile string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    pairs List<GetKeyPairsPair>
    version String
    keyPairName String
    nameRegex String
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    pairs GetKeyPairsPair[]
    version string
    keyPairName string
    nameRegex string
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    pairs Sequence[GetKeyPairsPair]
    version str
    key_pair_name str
    name_regex str
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    pairs List<Property Map>
    version String
    keyPairName String
    nameRegex String
    outputFile String

    Supporting Types

    GetKeyPairsPair

    CreateTime string
    The creation time of the key pair. The date format is in accordance with ISO8601 notation and uses UTC time. The format is yyyy-MM-ddTHH:mm:ssZ.
    Id string
    The ID of the Key Pair.
    KeyPairFingerPrint string
    Fingerprint of the key pair.
    KeyPairName string
    The name of the key pair.
    Version string
    The version number.
    CreateTime string
    The creation time of the key pair. The date format is in accordance with ISO8601 notation and uses UTC time. The format is yyyy-MM-ddTHH:mm:ssZ.
    Id string
    The ID of the Key Pair.
    KeyPairFingerPrint string
    Fingerprint of the key pair.
    KeyPairName string
    The name of the key pair.
    Version string
    The version number.
    createTime String
    The creation time of the key pair. The date format is in accordance with ISO8601 notation and uses UTC time. The format is yyyy-MM-ddTHH:mm:ssZ.
    id String
    The ID of the Key Pair.
    keyPairFingerPrint String
    Fingerprint of the key pair.
    keyPairName String
    The name of the key pair.
    version String
    The version number.
    createTime string
    The creation time of the key pair. The date format is in accordance with ISO8601 notation and uses UTC time. The format is yyyy-MM-ddTHH:mm:ssZ.
    id string
    The ID of the Key Pair.
    keyPairFingerPrint string
    Fingerprint of the key pair.
    keyPairName string
    The name of the key pair.
    version string
    The version number.
    create_time str
    The creation time of the key pair. The date format is in accordance with ISO8601 notation and uses UTC time. The format is yyyy-MM-ddTHH:mm:ssZ.
    id str
    The ID of the Key Pair.
    key_pair_finger_print str
    Fingerprint of the key pair.
    key_pair_name str
    The name of the key pair.
    version str
    The version number.
    createTime String
    The creation time of the key pair. The date format is in accordance with ISO8601 notation and uses UTC time. The format is yyyy-MM-ddTHH:mm:ssZ.
    id String
    The ID of the Key Pair.
    keyPairFingerPrint String
    Fingerprint of the key pair.
    keyPairName String
    The name of the key pair.
    version String
    The version number.

    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.53.0 published on Wednesday, Apr 17, 2024 by Pulumi