github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/kms/getAlias.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package kms 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Use this data source to get the ARN of a KMS key alias. 15 // By using this data source, you can reference key alias 16 // without having to hard code the ARN as input. 17 // 18 // ## Example Usage 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := kms.LookupAlias(ctx, &kms.LookupAliasArgs{ 34 // Name: "alias/aws/s3", 35 // }, nil) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 func LookupAlias(ctx *pulumi.Context, args *LookupAliasArgs, opts ...pulumi.InvokeOption) (*LookupAliasResult, error) { 46 opts = internal.PkgInvokeDefaultOpts(opts) 47 var rv LookupAliasResult 48 err := ctx.Invoke("aws:kms/getAlias:getAlias", args, &rv, opts...) 49 if err != nil { 50 return nil, err 51 } 52 return &rv, nil 53 } 54 55 // A collection of arguments for invoking getAlias. 56 type LookupAliasArgs struct { 57 // Display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/) 58 Name string `pulumi:"name"` 59 } 60 61 // A collection of values returned by getAlias. 62 type LookupAliasResult struct { 63 // Amazon Resource Name(ARN) of the key alias. 64 Arn string `pulumi:"arn"` 65 // The provider-assigned unique ID for this managed resource. 66 Id string `pulumi:"id"` 67 // Name of the alias 68 Name string `pulumi:"name"` 69 // ARN pointed to by the alias. 70 TargetKeyArn string `pulumi:"targetKeyArn"` 71 // Key identifier pointed to by the alias. 72 TargetKeyId string `pulumi:"targetKeyId"` 73 } 74 75 func LookupAliasOutput(ctx *pulumi.Context, args LookupAliasOutputArgs, opts ...pulumi.InvokeOption) LookupAliasResultOutput { 76 return pulumi.ToOutputWithContext(context.Background(), args). 77 ApplyT(func(v interface{}) (LookupAliasResult, error) { 78 args := v.(LookupAliasArgs) 79 r, err := LookupAlias(ctx, &args, opts...) 80 var s LookupAliasResult 81 if r != nil { 82 s = *r 83 } 84 return s, err 85 }).(LookupAliasResultOutput) 86 } 87 88 // A collection of arguments for invoking getAlias. 89 type LookupAliasOutputArgs struct { 90 // Display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/) 91 Name pulumi.StringInput `pulumi:"name"` 92 } 93 94 func (LookupAliasOutputArgs) ElementType() reflect.Type { 95 return reflect.TypeOf((*LookupAliasArgs)(nil)).Elem() 96 } 97 98 // A collection of values returned by getAlias. 99 type LookupAliasResultOutput struct{ *pulumi.OutputState } 100 101 func (LookupAliasResultOutput) ElementType() reflect.Type { 102 return reflect.TypeOf((*LookupAliasResult)(nil)).Elem() 103 } 104 105 func (o LookupAliasResultOutput) ToLookupAliasResultOutput() LookupAliasResultOutput { 106 return o 107 } 108 109 func (o LookupAliasResultOutput) ToLookupAliasResultOutputWithContext(ctx context.Context) LookupAliasResultOutput { 110 return o 111 } 112 113 // Amazon Resource Name(ARN) of the key alias. 114 func (o LookupAliasResultOutput) Arn() pulumi.StringOutput { 115 return o.ApplyT(func(v LookupAliasResult) string { return v.Arn }).(pulumi.StringOutput) 116 } 117 118 // The provider-assigned unique ID for this managed resource. 119 func (o LookupAliasResultOutput) Id() pulumi.StringOutput { 120 return o.ApplyT(func(v LookupAliasResult) string { return v.Id }).(pulumi.StringOutput) 121 } 122 123 // Name of the alias 124 func (o LookupAliasResultOutput) Name() pulumi.StringOutput { 125 return o.ApplyT(func(v LookupAliasResult) string { return v.Name }).(pulumi.StringOutput) 126 } 127 128 // ARN pointed to by the alias. 129 func (o LookupAliasResultOutput) TargetKeyArn() pulumi.StringOutput { 130 return o.ApplyT(func(v LookupAliasResult) string { return v.TargetKeyArn }).(pulumi.StringOutput) 131 } 132 133 // Key identifier pointed to by the alias. 134 func (o LookupAliasResultOutput) TargetKeyId() pulumi.StringOutput { 135 return o.ApplyT(func(v LookupAliasResult) string { return v.TargetKeyId }).(pulumi.StringOutput) 136 } 137 138 func init() { 139 pulumi.RegisterOutputType(LookupAliasResultOutput{}) 140 }