github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/secretsmanager/getSecret.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 secretsmanager 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 // Retrieve metadata information about a Secrets Manager secret. To retrieve a secret value, see the `secretsmanager.SecretVersion` data source. 15 // 16 // ## Example Usage 17 // 18 // ### ARN 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager" 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 := secretsmanager.LookupSecret(ctx, &secretsmanager.LookupSecretArgs{ 34 // Arn: pulumi.StringRef("arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456"), 35 // }, nil) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 // 46 // ### Name 47 // 48 // <!--Start PulumiCodeChooser --> 49 // ```go 50 // package main 51 // 52 // import ( 53 // 54 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager" 55 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 56 // 57 // ) 58 // 59 // func main() { 60 // pulumi.Run(func(ctx *pulumi.Context) error { 61 // _, err := secretsmanager.LookupSecret(ctx, &secretsmanager.LookupSecretArgs{ 62 // Name: pulumi.StringRef("example"), 63 // }, nil) 64 // if err != nil { 65 // return err 66 // } 67 // return nil 68 // }) 69 // } 70 // 71 // ``` 72 // <!--End PulumiCodeChooser --> 73 func LookupSecret(ctx *pulumi.Context, args *LookupSecretArgs, opts ...pulumi.InvokeOption) (*LookupSecretResult, error) { 74 opts = internal.PkgInvokeDefaultOpts(opts) 75 var rv LookupSecretResult 76 err := ctx.Invoke("aws:secretsmanager/getSecret:getSecret", args, &rv, opts...) 77 if err != nil { 78 return nil, err 79 } 80 return &rv, nil 81 } 82 83 // A collection of arguments for invoking getSecret. 84 type LookupSecretArgs struct { 85 // ARN of the secret to retrieve. 86 Arn *string `pulumi:"arn"` 87 // Name of the secret to retrieve. 88 Name *string `pulumi:"name"` 89 // Tags of the secret. 90 Tags map[string]string `pulumi:"tags"` 91 } 92 93 // A collection of values returned by getSecret. 94 type LookupSecretResult struct { 95 // ARN of the secret. 96 Arn string `pulumi:"arn"` 97 // Created date of the secret in UTC. 98 CreatedDate string `pulumi:"createdDate"` 99 // Description of the secret. 100 Description string `pulumi:"description"` 101 // The provider-assigned unique ID for this managed resource. 102 Id string `pulumi:"id"` 103 // Key Management Service (KMS) Customer Master Key (CMK) associated with the secret. 104 KmsKeyId string `pulumi:"kmsKeyId"` 105 // Last updated date of the secret in UTC. 106 LastChangedDate string `pulumi:"lastChangedDate"` 107 Name string `pulumi:"name"` 108 // Resource-based policy document that's attached to the secret. 109 Policy string `pulumi:"policy"` 110 // Tags of the secret. 111 Tags map[string]string `pulumi:"tags"` 112 } 113 114 func LookupSecretOutput(ctx *pulumi.Context, args LookupSecretOutputArgs, opts ...pulumi.InvokeOption) LookupSecretResultOutput { 115 return pulumi.ToOutputWithContext(context.Background(), args). 116 ApplyT(func(v interface{}) (LookupSecretResult, error) { 117 args := v.(LookupSecretArgs) 118 r, err := LookupSecret(ctx, &args, opts...) 119 var s LookupSecretResult 120 if r != nil { 121 s = *r 122 } 123 return s, err 124 }).(LookupSecretResultOutput) 125 } 126 127 // A collection of arguments for invoking getSecret. 128 type LookupSecretOutputArgs struct { 129 // ARN of the secret to retrieve. 130 Arn pulumi.StringPtrInput `pulumi:"arn"` 131 // Name of the secret to retrieve. 132 Name pulumi.StringPtrInput `pulumi:"name"` 133 // Tags of the secret. 134 Tags pulumi.StringMapInput `pulumi:"tags"` 135 } 136 137 func (LookupSecretOutputArgs) ElementType() reflect.Type { 138 return reflect.TypeOf((*LookupSecretArgs)(nil)).Elem() 139 } 140 141 // A collection of values returned by getSecret. 142 type LookupSecretResultOutput struct{ *pulumi.OutputState } 143 144 func (LookupSecretResultOutput) ElementType() reflect.Type { 145 return reflect.TypeOf((*LookupSecretResult)(nil)).Elem() 146 } 147 148 func (o LookupSecretResultOutput) ToLookupSecretResultOutput() LookupSecretResultOutput { 149 return o 150 } 151 152 func (o LookupSecretResultOutput) ToLookupSecretResultOutputWithContext(ctx context.Context) LookupSecretResultOutput { 153 return o 154 } 155 156 // ARN of the secret. 157 func (o LookupSecretResultOutput) Arn() pulumi.StringOutput { 158 return o.ApplyT(func(v LookupSecretResult) string { return v.Arn }).(pulumi.StringOutput) 159 } 160 161 // Created date of the secret in UTC. 162 func (o LookupSecretResultOutput) CreatedDate() pulumi.StringOutput { 163 return o.ApplyT(func(v LookupSecretResult) string { return v.CreatedDate }).(pulumi.StringOutput) 164 } 165 166 // Description of the secret. 167 func (o LookupSecretResultOutput) Description() pulumi.StringOutput { 168 return o.ApplyT(func(v LookupSecretResult) string { return v.Description }).(pulumi.StringOutput) 169 } 170 171 // The provider-assigned unique ID for this managed resource. 172 func (o LookupSecretResultOutput) Id() pulumi.StringOutput { 173 return o.ApplyT(func(v LookupSecretResult) string { return v.Id }).(pulumi.StringOutput) 174 } 175 176 // Key Management Service (KMS) Customer Master Key (CMK) associated with the secret. 177 func (o LookupSecretResultOutput) KmsKeyId() pulumi.StringOutput { 178 return o.ApplyT(func(v LookupSecretResult) string { return v.KmsKeyId }).(pulumi.StringOutput) 179 } 180 181 // Last updated date of the secret in UTC. 182 func (o LookupSecretResultOutput) LastChangedDate() pulumi.StringOutput { 183 return o.ApplyT(func(v LookupSecretResult) string { return v.LastChangedDate }).(pulumi.StringOutput) 184 } 185 186 func (o LookupSecretResultOutput) Name() pulumi.StringOutput { 187 return o.ApplyT(func(v LookupSecretResult) string { return v.Name }).(pulumi.StringOutput) 188 } 189 190 // Resource-based policy document that's attached to the secret. 191 func (o LookupSecretResultOutput) Policy() pulumi.StringOutput { 192 return o.ApplyT(func(v LookupSecretResult) string { return v.Policy }).(pulumi.StringOutput) 193 } 194 195 // Tags of the secret. 196 func (o LookupSecretResultOutput) Tags() pulumi.StringMapOutput { 197 return o.ApplyT(func(v LookupSecretResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 198 } 199 200 func init() { 201 pulumi.RegisterOutputType(LookupSecretResultOutput{}) 202 }