Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.ecs.getEcsKeyPairs
Explore with Pulumi AI
This data source provides the Ecs Key Pairs of the current Alibaba Cloud user.
NOTE: Available in v1.121.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.ecs.getEcsKeyPairs({
ids: ["key_pair_name"],
nameRegex: "key_pair_name",
});
export const firstEcsKeyPairId = example.then(example => example.pairs?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.ecs.get_ecs_key_pairs(ids=["key_pair_name"],
name_regex="key_pair_name")
pulumi.export("firstEcsKeyPairId", example.pairs[0].id)
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 {
example, err := ecs.GetEcsKeyPairs(ctx, &ecs.GetEcsKeyPairsArgs{
Ids: []string{
"key_pair_name",
},
NameRegex: pulumi.StringRef("key_pair_name"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstEcsKeyPairId", example.Pairs[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var example = AliCloud.Ecs.GetEcsKeyPairs.Invoke(new()
{
Ids = new[]
{
"key_pair_name",
},
NameRegex = "key_pair_name",
});
return new Dictionary<string, object?>
{
["firstEcsKeyPairId"] = example.Apply(getEcsKeyPairsResult => getEcsKeyPairsResult.Pairs[0]?.Id),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetEcsKeyPairsArgs;
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 = EcsFunctions.getEcsKeyPairs(GetEcsKeyPairsArgs.builder()
.ids("key_pair_name")
.nameRegex("key_pair_name")
.build());
ctx.export("firstEcsKeyPairId", example.applyValue(getEcsKeyPairsResult -> getEcsKeyPairsResult.pairs()[0].id()));
}
}
variables:
example:
fn::invoke:
Function: alicloud:ecs:getEcsKeyPairs
Arguments:
ids:
- key_pair_name
nameRegex: key_pair_name
outputs:
firstEcsKeyPairId: ${example.pairs[0].id}
Using getEcsKeyPairs
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 getEcsKeyPairs(args: GetEcsKeyPairsArgs, opts?: InvokeOptions): Promise<GetEcsKeyPairsResult>
function getEcsKeyPairsOutput(args: GetEcsKeyPairsOutputArgs, opts?: InvokeOptions): Output<GetEcsKeyPairsResult>
def get_ecs_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) -> GetEcsKeyPairsResult
def get_ecs_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[GetEcsKeyPairsResult]
func GetEcsKeyPairs(ctx *Context, args *GetEcsKeyPairsArgs, opts ...InvokeOption) (*GetEcsKeyPairsResult, error)
func GetEcsKeyPairsOutput(ctx *Context, args *GetEcsKeyPairsOutputArgs, opts ...InvokeOption) GetEcsKeyPairsResultOutput
> Note: This function is named GetEcsKeyPairs
in the Go SDK.
public static class GetEcsKeyPairs
{
public static Task<GetEcsKeyPairsResult> InvokeAsync(GetEcsKeyPairsArgs args, InvokeOptions? opts = null)
public static Output<GetEcsKeyPairsResult> Invoke(GetEcsKeyPairsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetEcsKeyPairsResult> getEcsKeyPairs(GetEcsKeyPairsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:ecs/getEcsKeyPairs:getEcsKeyPairs
arguments:
# arguments dictionary
The following arguments are supported:
- Finger
Print string - The finger print of the key pair.
- Ids List<string>
- A list of Key Pair IDs.
- Name
Regex string - A regex string to filter results by Key Pair name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Resource
Group stringId - The resource group Id.
- Dictionary<string, object>
- Finger
Print string - The finger print of the key pair.
- Ids []string
- A list of Key Pair IDs.
- Name
Regex string - A regex string to filter results by Key Pair name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Resource
Group stringId - The resource group Id.
- map[string]interface{}
- finger
Print String - The finger print of the key pair.
- ids List<String>
- A list of Key Pair IDs.
- name
Regex String - A regex string to filter results by Key Pair name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - resource
Group StringId - The resource group Id.
- Map<String,Object>
- finger
Print string - The finger print of the key pair.
- ids string[]
- A list of Key Pair IDs.
- name
Regex string - A regex string to filter results by Key Pair name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - resource
Group stringId - The resource group Id.
- {[key: string]: any}
- finger_
print str - The finger print of the key pair.
- ids Sequence[str]
- A list of Key Pair IDs.
- 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
). - resource_
group_ strid - The resource group Id.
- Mapping[str, Any]
- finger
Print String - The finger print of the key pair.
- ids List<String>
- A list of Key Pair IDs.
- name
Regex String - A regex string to filter results by Key Pair name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - resource
Group StringId - The resource group Id.
- Map<Any>
getEcsKeyPairs Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Key
Pairs List<Pulumi.Ali Cloud. Ecs. Outputs. Get Ecs Key Pairs Key Pair> - Names List<string>
- Pairs
List<Pulumi.
Ali Cloud. Ecs. Outputs. Get Ecs Key Pairs Pair> - Finger
Print string - Name
Regex string - Output
File string - Resource
Group stringId - Dictionary<string, object>
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Key
Pairs []GetEcs Key Pairs Key Pair - Names []string
- Pairs
[]Get
Ecs Key Pairs Pair - Finger
Print string - Name
Regex string - Output
File string - Resource
Group stringId - map[string]interface{}
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- key
Pairs List<GetEcs Key Pairs Key Pair> - names List<String>
- pairs
List<Get
Ecs Key Pairs Pair> - finger
Print String - name
Regex String - output
File String - resource
Group StringId - Map<String,Object>
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- key
Pairs GetEcs Key Pairs Key Pair[] - names string[]
- pairs
Get
Ecs Key Pairs Pair[] - finger
Print string - name
Regex string - output
File string - resource
Group stringId - {[key: string]: any}
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- key_
pairs Sequence[GetEcs Key Pairs Key Pair] - names Sequence[str]
- pairs
Sequence[Get
Ecs Key Pairs Pair] - finger_
print str - name_
regex str - output_
file str - resource_
group_ strid - Mapping[str, Any]
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- key
Pairs List<Property Map> - names List<String>
- pairs List<Property Map>
- finger
Print String - name
Regex String - output
File String - resource
Group StringId - Map<Any>
Supporting Types
GetEcsKeyPairsKeyPair
- Finger
Print string - The finger print of the key pair.
- Id string
- Instances
List<Pulumi.
Ali Cloud. Ecs. Inputs. Get Ecs Key Pairs Key Pair Instance> - Key
Name string - Key
Pair stringName - Resource
Group stringId - The resource group Id.
- Dictionary<string, object>
- Finger
Print string - The finger print of the key pair.
- Id string
- Instances
[]Get
Ecs Key Pairs Key Pair Instance - Key
Name string - Key
Pair stringName - Resource
Group stringId - The resource group Id.
- map[string]interface{}
- finger
Print String - The finger print of the key pair.
- id String
- instances
List<Get
Ecs Key Pairs Key Pair Instance> - key
Name String - key
Pair StringName - resource
Group StringId - The resource group Id.
- Map<String,Object>
- finger
Print string - The finger print of the key pair.
- id string
- instances
Get
Ecs Key Pairs Key Pair Instance[] - key
Name string - key
Pair stringName - resource
Group stringId - The resource group Id.
- {[key: string]: any}
- finger_
print str - The finger print of the key pair.
- id str
- instances
Sequence[Get
Ecs Key Pairs Key Pair Instance] - key_
name str - key_
pair_ strname - resource_
group_ strid - The resource group Id.
- Mapping[str, Any]
- finger
Print String - The finger print of the key pair.
- id String
- instances List<Property Map>
- key
Name String - key
Pair StringName - resource
Group StringId - The resource group Id.
- Map<Any>
GetEcsKeyPairsKeyPairInstance
- Availability
Zone string - Description string
- Image
Id string - Instance
Id string - Instance
Name string - Instance
Type string - Key
Name string - Private
Ip string - Public
Ip string - Region
Id string - Status string
- Vswitch
Id string
- Availability
Zone string - Description string
- Image
Id string - Instance
Id string - Instance
Name string - Instance
Type string - Key
Name string - Private
Ip string - Public
Ip string - Region
Id string - Status string
- Vswitch
Id string
- availability
Zone String - description String
- image
Id String - instance
Id String - instance
Name String - instance
Type String - key
Name String - private
Ip String - public
Ip String - region
Id String - status String
- vswitch
Id String
- availability
Zone string - description string
- image
Id string - instance
Id string - instance
Name string - instance
Type string - key
Name string - private
Ip string - public
Ip string - region
Id string - status string
- vswitch
Id string
- availability_
zone str - description str
- image_
id str - instance_
id str - instance_
name str - instance_
type str - key_
name str - private_
ip str - public_
ip str - region_
id str - status str
- vswitch_
id str
- availability
Zone String - description String
- image
Id String - instance
Id String - instance
Name String - instance
Type String - key
Name String - private
Ip String - public
Ip String - region
Id String - status String
- vswitch
Id String
GetEcsKeyPairsPair
- Finger
Print string - The finger print of the key pair.
- Id string
- The ID of the Key Pair.
- Instances
List<Pulumi.
Ali Cloud. Ecs. Inputs. Get Ecs Key Pairs Pair Instance> - Key
Name string - The Key Pair Name.
- Key
Pair stringName - Resource
Group stringId - The Resource Group Id.
- Dictionary<string, object>
- The tags.
- Finger
Print string - The finger print of the key pair.
- Id string
- The ID of the Key Pair.
- Instances
[]Get
Ecs Key Pairs Pair Instance - Key
Name string - The Key Pair Name.
- Key
Pair stringName - Resource
Group stringId - The Resource Group Id.
- map[string]interface{}
- The tags.
- finger
Print String - The finger print of the key pair.
- id String
- The ID of the Key Pair.
- instances
List<Get
Ecs Key Pairs Pair Instance> - key
Name String - The Key Pair Name.
- key
Pair StringName - resource
Group StringId - The Resource Group Id.
- Map<String,Object>
- The tags.
- finger
Print string - The finger print of the key pair.
- id string
- The ID of the Key Pair.
- instances
Get
Ecs Key Pairs Pair Instance[] - key
Name string - The Key Pair Name.
- key
Pair stringName - resource
Group stringId - The Resource Group Id.
- {[key: string]: any}
- The tags.
- finger_
print str - The finger print of the key pair.
- id str
- The ID of the Key Pair.
- instances
Sequence[Get
Ecs Key Pairs Pair Instance] - key_
name str - The Key Pair Name.
- key_
pair_ strname - resource_
group_ strid - The Resource Group Id.
- Mapping[str, Any]
- The tags.
- finger
Print String - The finger print of the key pair.
- id String
- The ID of the Key Pair.
- instances List<Property Map>
- key
Name String - The Key Pair Name.
- key
Pair StringName - resource
Group StringId - The Resource Group Id.
- Map<Any>
- The tags.
GetEcsKeyPairsPairInstance
- Availability
Zone string - Description string
- Image
Id string - Instance
Id string - Instance
Name string - Instance
Type string - Key
Name string - Private
Ip string - Public
Ip string - Region
Id string - Status string
- Vswitch
Id string
- Availability
Zone string - Description string
- Image
Id string - Instance
Id string - Instance
Name string - Instance
Type string - Key
Name string - Private
Ip string - Public
Ip string - Region
Id string - Status string
- Vswitch
Id string
- availability
Zone String - description String
- image
Id String - instance
Id String - instance
Name String - instance
Type String - key
Name String - private
Ip String - public
Ip String - region
Id String - status String
- vswitch
Id String
- availability
Zone string - description string
- image
Id string - instance
Id string - instance
Name string - instance
Type string - key
Name string - private
Ip string - public
Ip string - region
Id string - status string
- vswitch
Id string
- availability_
zone str - description str
- image_
id str - instance_
id str - instance_
name str - instance_
type str - key_
name str - private_
ip str - public_
ip str - region_
id str - status str
- vswitch_
id str
- availability
Zone String - description String
- image
Id String - instance
Id String - instance
Name String - instance
Type String - key
Name String - private
Ip String - public
Ip String - region
Id String - status String
- vswitch
Id String
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.