getKeyPairs

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        // Declare the data source
        var defaultKeyPair = new AliCloud.Ecs.KeyPair("defaultKeyPair", new AliCloud.Ecs.KeyPairArgs
        {
            KeyName = "keyPairDatasource",
        });
        var defaultKeyPairs = AliCloud.Ecs.GetKeyPairs.Invoke(new AliCloud.Ecs.GetKeyPairsInvokeArgs
        {
            NameRegex = defaultKeyPair.KeyName,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		defaultKeyPair, err := ecs.NewKeyPair(ctx, "defaultKeyPair", &ecs.KeyPairArgs{
			KeyName: pulumi.String("keyPairDatasource"),
		})
		if err != nil {
			return err
		}
		_ = ecs.GetKeyPairsOutput(ctx, ecs.GetKeyPairsOutputArgs{
			NameRegex: defaultKeyPair.KeyName,
		}, nil)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.KeyPair;
import com.pulumi.alicloud.ecs.KeyPairArgs;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecp.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) {
        var defaultKeyPair = new KeyPair("defaultKeyPair", KeyPairArgs.builder()        
            .keyName("keyPairDatasource")
            .build());

        final var defaultKeyPairs = EcsFunctions.getKeyPairs(GetKeyPairsArgs.builder()
            .nameRegex(defaultKeyPair.keyName())
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

# Declare the data source
default_key_pair = alicloud.ecs.KeyPair("defaultKeyPair", key_name="keyPairDatasource")
default_key_pairs = alicloud.ecs.get_key_pairs_output(name_regex=default_key_pair.key_name)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

// Declare the data source
const defaultKeyPair = new alicloud.ecs.KeyPair("default", {
    keyName: "keyPairDatasource",
});
const defaultKeyPairs = defaultKeyPair.keyName.apply(keyName => alicloud.ecs.getKeyPairs({
    nameRegex: keyName,
}));
resources:
  # Declare the data source
  defaultKeyPair:
    type: alicloud:ecs:KeyPair
    properties:
      keyName: keyPairDatasource
variables:
  defaultKeyPairs:
    Fn::Invoke:
      Function: alicloud:ecs:getKeyPairs
      Arguments:
        nameRegex: ${defaultKeyPair.keyName}

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(finger_print: Optional[str] = None,
                  ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  resource_group_id: Optional[str] = None,
                  tags: Optional[Mapping[str, Any]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetKeyPairsResult
def get_key_pairs_output(finger_print: Optional[pulumi.Input[str]] = None,
                  ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  output_file: Optional[pulumi.Input[str]] = None,
                  resource_group_id: Optional[pulumi.Input[str]] = None,
                  tags: Optional[pulumi.Input[Mapping[str, Any]]] = 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:ecs/getKeyPairs:getKeyPairs
  arguments:
    # arguments dictionary

The following arguments are supported:

FingerPrint string

A finger print used to retrieve specified key pair.

Ids List<string>

A list of key pair IDs.

NameRegex string

A regex string to apply to the resulting key pairs.

OutputFile string
ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

FingerPrint string

A finger print used to retrieve specified key pair.

Ids []string

A list of key pair IDs.

NameRegex string

A regex string to apply to the resulting key pairs.

OutputFile string
ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

fingerPrint String

A finger print used to retrieve specified key pair.

ids List<String>

A list of key pair IDs.

nameRegex String

A regex string to apply to the resulting key pairs.

outputFile String
resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map<String,Object>

A mapping of tags to assign to the resource.

fingerPrint string

A finger print used to retrieve specified key pair.

ids string[]

A list of key pair IDs.

nameRegex string

A regex string to apply to the resulting key pairs.

outputFile string
resourceGroupId string

The Id of resource group which the key pair belongs.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

finger_print str

A finger print used to retrieve specified key pair.

ids Sequence[str]

A list of key pair IDs.

name_regex str

A regex string to apply to the resulting key pairs.

output_file str
resource_group_id str

The Id of resource group which the key pair belongs.

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

fingerPrint String

A finger print used to retrieve specified key pair.

ids List<String>

A list of key pair IDs.

nameRegex String

A regex string to apply to the resulting key pairs.

outputFile String
resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map<Any>

A mapping of tags to assign to the resource.

getKeyPairs Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
KeyPairs List<Pulumi.AliCloud.Ecs.Outputs.GetKeyPairsKeyPair>

A list of key pairs. Each element contains the following attributes:

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

Names List<string>

A list of key pair names.

Pairs List<Pulumi.AliCloud.Ecs.Outputs.GetKeyPairsPair>
FingerPrint string

Finger print of the key pair.

NameRegex string
OutputFile string
ResourceGroupId string

The Id of resource group.

Tags Dictionary<string, object>

(Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.

Id string

The provider-assigned unique ID for this managed resource.

Ids []string
KeyPairs []GetKeyPairsKeyPair

A list of key pairs. Each element contains the following attributes:

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

Names []string

A list of key pair names.

Pairs []GetKeyPairsPair
FingerPrint string

Finger print of the key pair.

NameRegex string
OutputFile string
ResourceGroupId string

The Id of resource group.

Tags map[string]interface{}

(Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.

id String

The provider-assigned unique ID for this managed resource.

ids List<String>
keyPairs List<GetKeyPairsKeyPair>

A list of key pairs. Each element contains the following attributes:

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

names List<String>

A list of key pair names.

pairs List<GetKeyPairsPair>
fingerPrint String

Finger print of the key pair.

nameRegex String
outputFile String
resourceGroupId String

The Id of resource group.

tags Map<String,Object>

(Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.

id string

The provider-assigned unique ID for this managed resource.

ids string[]
keyPairs GetKeyPairsKeyPair[]

A list of key pairs. Each element contains the following attributes:

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

names string[]

A list of key pair names.

pairs GetKeyPairsPair[]
fingerPrint string

Finger print of the key pair.

nameRegex string
outputFile string
resourceGroupId string

The Id of resource group.

tags {[key: string]: any}

(Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.

id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
key_pairs Sequence[GetKeyPairsKeyPair]

A list of key pairs. Each element contains the following attributes:

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

names Sequence[str]

A list of key pair names.

pairs Sequence[GetKeyPairsPair]
finger_print str

Finger print of the key pair.

name_regex str
output_file str
resource_group_id str

The Id of resource group.

tags Mapping[str, Any]

(Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.

id String

The provider-assigned unique ID for this managed resource.

ids List<String>
keyPairs List<Property Map>

A list of key pairs. Each element contains the following attributes:

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

names List<String>

A list of key pair names.

pairs List<Property Map>
fingerPrint String

Finger print of the key pair.

nameRegex String
outputFile String
resourceGroupId String

The Id of resource group.

tags Map<Any>

(Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.

Supporting Types

GetKeyPairsKeyPair

FingerPrint string

A finger print used to retrieve specified key pair.

Id string

ID of the key pair.

Instances List<Pulumi.AliCloud.Ecs.Inputs.GetKeyPairsKeyPairInstance>

A list of ECS instances that has been bound this key pair.

KeyName string

Name of the key pair.

KeyPairName string
ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

FingerPrint string

A finger print used to retrieve specified key pair.

Id string

ID of the key pair.

Instances []GetKeyPairsKeyPairInstance

A list of ECS instances that has been bound this key pair.

KeyName string

Name of the key pair.

KeyPairName string
ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

fingerPrint String

A finger print used to retrieve specified key pair.

id String

ID of the key pair.

instances List<GetKeyPairsKeyPairInstance>

A list of ECS instances that has been bound this key pair.

keyName String

Name of the key pair.

keyPairName String
resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map<String,Object>

A mapping of tags to assign to the resource.

fingerPrint string

A finger print used to retrieve specified key pair.

id string

ID of the key pair.

instances GetKeyPairsKeyPairInstance[]

A list of ECS instances that has been bound this key pair.

keyName string

Name of the key pair.

keyPairName string
resourceGroupId string

The Id of resource group which the key pair belongs.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

finger_print str

A finger print used to retrieve specified key pair.

id str

ID of the key pair.

instances Sequence[GetKeyPairsKeyPairInstance]

A list of ECS instances that has been bound this key pair.

key_name str

Name of the key pair.

key_pair_name str
resource_group_id str

The Id of resource group which the key pair belongs.

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

fingerPrint String

A finger print used to retrieve specified key pair.

id String

ID of the key pair.

instances List<Property Map>

A list of ECS instances that has been bound this key pair.

keyName String

Name of the key pair.

keyPairName String
resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map<Any>

A mapping of tags to assign to the resource.

GetKeyPairsKeyPairInstance

AvailabilityZone string

The ID of the availability zone where the ECS instance is located.

Description string
ImageId string
InstanceId string

The ID of the ECS instance.

InstanceName string

The name of the ECS instance.

InstanceType string
KeyName string

Name of the key pair.

PrivateIp string

The private IP address of the ECS instance.

PublicIp string

The public IP address or EIP of the ECS instance.

RegionId string
Status string
VswitchId string

The ID of the VSwitch attached to the ECS instance.

AvailabilityZone string

The ID of the availability zone where the ECS instance is located.

Description string
ImageId string
InstanceId string

The ID of the ECS instance.

InstanceName string

The name of the ECS instance.

InstanceType string
KeyName string

Name of the key pair.

PrivateIp string

The private IP address of the ECS instance.

PublicIp string

The public IP address or EIP of the ECS instance.

RegionId string
Status string
VswitchId string

The ID of the VSwitch attached to the ECS instance.

availabilityZone String

The ID of the availability zone where the ECS instance is located.

description String
imageId String
instanceId String

The ID of the ECS instance.

instanceName String

The name of the ECS instance.

instanceType String
keyName String

Name of the key pair.

privateIp String

The private IP address of the ECS instance.

publicIp String

The public IP address or EIP of the ECS instance.

regionId String
status String
vswitchId String

The ID of the VSwitch attached to the ECS instance.

availabilityZone string

The ID of the availability zone where the ECS instance is located.

description string
imageId string
instanceId string

The ID of the ECS instance.

instanceName string

The name of the ECS instance.

instanceType string
keyName string

Name of the key pair.

privateIp string

The private IP address of the ECS instance.

publicIp string

The public IP address or EIP of the ECS instance.

regionId string
status string
vswitchId string

The ID of the VSwitch attached to the ECS instance.

availability_zone str

The ID of the availability zone where the ECS instance is located.

description str
image_id str
instance_id str

The ID of the ECS instance.

instance_name str

The name of the ECS instance.

instance_type str
key_name str

Name of the key pair.

private_ip str

The private IP address of the ECS instance.

public_ip str

The public IP address or EIP of the ECS instance.

region_id str
status str
vswitch_id str

The ID of the VSwitch attached to the ECS instance.

availabilityZone String

The ID of the availability zone where the ECS instance is located.

description String
imageId String
instanceId String

The ID of the ECS instance.

instanceName String

The name of the ECS instance.

instanceType String
keyName String

Name of the key pair.

privateIp String

The private IP address of the ECS instance.

publicIp String

The public IP address or EIP of the ECS instance.

regionId String
status String
vswitchId String

The ID of the VSwitch attached to the ECS instance.

GetKeyPairsPair

FingerPrint string

A finger print used to retrieve specified key pair.

Id string

ID of the key pair.

Instances List<Pulumi.AliCloud.Ecs.Inputs.GetKeyPairsPairInstance>

A list of ECS instances that has been bound this key pair.

KeyName string

Name of the key pair.

KeyPairName string
ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

FingerPrint string

A finger print used to retrieve specified key pair.

Id string

ID of the key pair.

Instances []GetKeyPairsPairInstance

A list of ECS instances that has been bound this key pair.

KeyName string

Name of the key pair.

KeyPairName string
ResourceGroupId string

The Id of resource group which the key pair belongs.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

fingerPrint String

A finger print used to retrieve specified key pair.

id String

ID of the key pair.

instances List<GetKeyPairsPairInstance>

A list of ECS instances that has been bound this key pair.

keyName String

Name of the key pair.

keyPairName String
resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map<String,Object>

A mapping of tags to assign to the resource.

fingerPrint string

A finger print used to retrieve specified key pair.

id string

ID of the key pair.

instances GetKeyPairsPairInstance[]

A list of ECS instances that has been bound this key pair.

keyName string

Name of the key pair.

keyPairName string
resourceGroupId string

The Id of resource group which the key pair belongs.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

finger_print str

A finger print used to retrieve specified key pair.

id str

ID of the key pair.

instances Sequence[GetKeyPairsPairInstance]

A list of ECS instances that has been bound this key pair.

key_name str

Name of the key pair.

key_pair_name str
resource_group_id str

The Id of resource group which the key pair belongs.

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

fingerPrint String

A finger print used to retrieve specified key pair.

id String

ID of the key pair.

instances List<Property Map>

A list of ECS instances that has been bound this key pair.

keyName String

Name of the key pair.

keyPairName String
resourceGroupId String

The Id of resource group which the key pair belongs.

tags Map<Any>

A mapping of tags to assign to the resource.

GetKeyPairsPairInstance

AvailabilityZone string

The ID of the availability zone where the ECS instance is located.

Description string
ImageId string
InstanceId string

The ID of the ECS instance.

InstanceName string

The name of the ECS instance.

InstanceType string
KeyName string

Name of the key pair.

PrivateIp string

The private IP address of the ECS instance.

PublicIp string

The public IP address or EIP of the ECS instance.

RegionId string
Status string
VswitchId string

The ID of the VSwitch attached to the ECS instance.

AvailabilityZone string

The ID of the availability zone where the ECS instance is located.

Description string
ImageId string
InstanceId string

The ID of the ECS instance.

InstanceName string

The name of the ECS instance.

InstanceType string
KeyName string

Name of the key pair.

PrivateIp string

The private IP address of the ECS instance.

PublicIp string

The public IP address or EIP of the ECS instance.

RegionId string
Status string
VswitchId string

The ID of the VSwitch attached to the ECS instance.

availabilityZone String

The ID of the availability zone where the ECS instance is located.

description String
imageId String
instanceId String

The ID of the ECS instance.

instanceName String

The name of the ECS instance.

instanceType String
keyName String

Name of the key pair.

privateIp String

The private IP address of the ECS instance.

publicIp String

The public IP address or EIP of the ECS instance.

regionId String
status String
vswitchId String

The ID of the VSwitch attached to the ECS instance.

availabilityZone string

The ID of the availability zone where the ECS instance is located.

description string
imageId string
instanceId string

The ID of the ECS instance.

instanceName string

The name of the ECS instance.

instanceType string
keyName string

Name of the key pair.

privateIp string

The private IP address of the ECS instance.

publicIp string

The public IP address or EIP of the ECS instance.

regionId string
status string
vswitchId string

The ID of the VSwitch attached to the ECS instance.

availability_zone str

The ID of the availability zone where the ECS instance is located.

description str
image_id str
instance_id str

The ID of the ECS instance.

instance_name str

The name of the ECS instance.

instance_type str
key_name str

Name of the key pair.

private_ip str

The private IP address of the ECS instance.

public_ip str

The public IP address or EIP of the ECS instance.

region_id str
status str
vswitch_id str

The ID of the VSwitch attached to the ECS instance.

availabilityZone String

The ID of the availability zone where the ECS instance is located.

description String
imageId String
instanceId String

The ID of the ECS instance.

instanceName String

The name of the ECS instance.

instanceType String
keyName String

Name of the key pair.

privateIp String

The private IP address of the ECS instance.

publicIp String

The public IP address or EIP of the ECS instance.

regionId String
status String
vswitchId String

The ID of the VSwitch attached to the ECS instance.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.