github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/getUserSshKey.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 iam 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 information about a SSH public key associated with the specified IAM user. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // _, err := iam.GetUserSshKey(ctx, &iam.GetUserSshKeyArgs{ 32 // Encoding: "SSH", 33 // SshPublicKeyId: "APKARUZ32GUTKIGARLXE", 34 // Username: "test-user", 35 // }, nil) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 func GetUserSshKey(ctx *pulumi.Context, args *GetUserSshKeyArgs, opts ...pulumi.InvokeOption) (*GetUserSshKeyResult, error) { 46 opts = internal.PkgInvokeDefaultOpts(opts) 47 var rv GetUserSshKeyResult 48 err := ctx.Invoke("aws:iam/getUserSshKey:getUserSshKey", 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 getUserSshKey. 56 type GetUserSshKeyArgs struct { 57 // Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use `SSH`. To retrieve the public key in PEM format, use `PEM`. 58 Encoding string `pulumi:"encoding"` 59 // Unique identifier for the SSH public key. 60 SshPublicKeyId string `pulumi:"sshPublicKeyId"` 61 // Name of the IAM user associated with the SSH public key. 62 Username string `pulumi:"username"` 63 } 64 65 // A collection of values returned by getUserSshKey. 66 type GetUserSshKeyResult struct { 67 Encoding string `pulumi:"encoding"` 68 // MD5 message digest of the SSH public key. 69 Fingerprint string `pulumi:"fingerprint"` 70 // The provider-assigned unique ID for this managed resource. 71 Id string `pulumi:"id"` 72 // SSH public key. 73 PublicKey string `pulumi:"publicKey"` 74 SshPublicKeyId string `pulumi:"sshPublicKeyId"` 75 // Status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used. 76 Status string `pulumi:"status"` 77 Username string `pulumi:"username"` 78 } 79 80 func GetUserSshKeyOutput(ctx *pulumi.Context, args GetUserSshKeyOutputArgs, opts ...pulumi.InvokeOption) GetUserSshKeyResultOutput { 81 return pulumi.ToOutputWithContext(context.Background(), args). 82 ApplyT(func(v interface{}) (GetUserSshKeyResult, error) { 83 args := v.(GetUserSshKeyArgs) 84 r, err := GetUserSshKey(ctx, &args, opts...) 85 var s GetUserSshKeyResult 86 if r != nil { 87 s = *r 88 } 89 return s, err 90 }).(GetUserSshKeyResultOutput) 91 } 92 93 // A collection of arguments for invoking getUserSshKey. 94 type GetUserSshKeyOutputArgs struct { 95 // Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use `SSH`. To retrieve the public key in PEM format, use `PEM`. 96 Encoding pulumi.StringInput `pulumi:"encoding"` 97 // Unique identifier for the SSH public key. 98 SshPublicKeyId pulumi.StringInput `pulumi:"sshPublicKeyId"` 99 // Name of the IAM user associated with the SSH public key. 100 Username pulumi.StringInput `pulumi:"username"` 101 } 102 103 func (GetUserSshKeyOutputArgs) ElementType() reflect.Type { 104 return reflect.TypeOf((*GetUserSshKeyArgs)(nil)).Elem() 105 } 106 107 // A collection of values returned by getUserSshKey. 108 type GetUserSshKeyResultOutput struct{ *pulumi.OutputState } 109 110 func (GetUserSshKeyResultOutput) ElementType() reflect.Type { 111 return reflect.TypeOf((*GetUserSshKeyResult)(nil)).Elem() 112 } 113 114 func (o GetUserSshKeyResultOutput) ToGetUserSshKeyResultOutput() GetUserSshKeyResultOutput { 115 return o 116 } 117 118 func (o GetUserSshKeyResultOutput) ToGetUserSshKeyResultOutputWithContext(ctx context.Context) GetUserSshKeyResultOutput { 119 return o 120 } 121 122 func (o GetUserSshKeyResultOutput) Encoding() pulumi.StringOutput { 123 return o.ApplyT(func(v GetUserSshKeyResult) string { return v.Encoding }).(pulumi.StringOutput) 124 } 125 126 // MD5 message digest of the SSH public key. 127 func (o GetUserSshKeyResultOutput) Fingerprint() pulumi.StringOutput { 128 return o.ApplyT(func(v GetUserSshKeyResult) string { return v.Fingerprint }).(pulumi.StringOutput) 129 } 130 131 // The provider-assigned unique ID for this managed resource. 132 func (o GetUserSshKeyResultOutput) Id() pulumi.StringOutput { 133 return o.ApplyT(func(v GetUserSshKeyResult) string { return v.Id }).(pulumi.StringOutput) 134 } 135 136 // SSH public key. 137 func (o GetUserSshKeyResultOutput) PublicKey() pulumi.StringOutput { 138 return o.ApplyT(func(v GetUserSshKeyResult) string { return v.PublicKey }).(pulumi.StringOutput) 139 } 140 141 func (o GetUserSshKeyResultOutput) SshPublicKeyId() pulumi.StringOutput { 142 return o.ApplyT(func(v GetUserSshKeyResult) string { return v.SshPublicKeyId }).(pulumi.StringOutput) 143 } 144 145 // Status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used. 146 func (o GetUserSshKeyResultOutput) Status() pulumi.StringOutput { 147 return o.ApplyT(func(v GetUserSshKeyResult) string { return v.Status }).(pulumi.StringOutput) 148 } 149 150 func (o GetUserSshKeyResultOutput) Username() pulumi.StringOutput { 151 return o.ApplyT(func(v GetUserSshKeyResult) string { return v.Username }).(pulumi.StringOutput) 152 } 153 154 func init() { 155 pulumi.RegisterOutputType(GetUserSshKeyResultOutput{}) 156 }