/
getKMSSecret.go
119 lines (100 loc) · 4.81 KB
/
getKMSSecret.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package kms
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// This data source allows you to use data encrypted with Google Cloud KMS
// within your resource definitions.
//
// For more information see
// [the official documentation](https://cloud.google.com/kms/docs/encrypt-decrypt).
//
// > **NOTE:** Using this data provider will allow you to conceal secret data within your
// resource definitions, but it does not take care of protecting that data in the
// logging output, plan output, or state output. Please take care to secure your secret
// data outside of resource definitions.
func GetKMSSecret(ctx *pulumi.Context, args *GetKMSSecretArgs, opts ...pulumi.InvokeOption) (*GetKMSSecretResult, error) {
var rv GetKMSSecretResult
err := ctx.Invoke("gcp:kms/getKMSSecret:getKMSSecret", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getKMSSecret.
type GetKMSSecretArgs struct {
// The [additional authenticated data](https://cloud.google.com/kms/docs/additional-authenticated-data) used for integrity checks during encryption and decryption.
AdditionalAuthenticatedData *string `pulumi:"additionalAuthenticatedData"`
// The ciphertext to be decrypted, encoded in base64
Ciphertext string `pulumi:"ciphertext"`
// The id of the CryptoKey that will be used to
// decrypt the provided ciphertext. This is represented by the format
// `{projectId}/{location}/{keyRingName}/{cryptoKeyName}`.
CryptoKey string `pulumi:"cryptoKey"`
}
// A collection of values returned by getKMSSecret.
type GetKMSSecretResult struct {
AdditionalAuthenticatedData *string `pulumi:"additionalAuthenticatedData"`
Ciphertext string `pulumi:"ciphertext"`
CryptoKey string `pulumi:"cryptoKey"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// Contains the result of decrypting the provided ciphertext.
Plaintext string `pulumi:"plaintext"`
}
func GetKMSSecretOutput(ctx *pulumi.Context, args GetKMSSecretOutputArgs, opts ...pulumi.InvokeOption) GetKMSSecretResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetKMSSecretResult, error) {
args := v.(GetKMSSecretArgs)
r, err := GetKMSSecret(ctx, &args, opts...)
return *r, err
}).(GetKMSSecretResultOutput)
}
// A collection of arguments for invoking getKMSSecret.
type GetKMSSecretOutputArgs struct {
// The [additional authenticated data](https://cloud.google.com/kms/docs/additional-authenticated-data) used for integrity checks during encryption and decryption.
AdditionalAuthenticatedData pulumi.StringPtrInput `pulumi:"additionalAuthenticatedData"`
// The ciphertext to be decrypted, encoded in base64
Ciphertext pulumi.StringInput `pulumi:"ciphertext"`
// The id of the CryptoKey that will be used to
// decrypt the provided ciphertext. This is represented by the format
// `{projectId}/{location}/{keyRingName}/{cryptoKeyName}`.
CryptoKey pulumi.StringInput `pulumi:"cryptoKey"`
}
func (GetKMSSecretOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetKMSSecretArgs)(nil)).Elem()
}
// A collection of values returned by getKMSSecret.
type GetKMSSecretResultOutput struct{ *pulumi.OutputState }
func (GetKMSSecretResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetKMSSecretResult)(nil)).Elem()
}
func (o GetKMSSecretResultOutput) ToGetKMSSecretResultOutput() GetKMSSecretResultOutput {
return o
}
func (o GetKMSSecretResultOutput) ToGetKMSSecretResultOutputWithContext(ctx context.Context) GetKMSSecretResultOutput {
return o
}
func (o GetKMSSecretResultOutput) AdditionalAuthenticatedData() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetKMSSecretResult) *string { return v.AdditionalAuthenticatedData }).(pulumi.StringPtrOutput)
}
func (o GetKMSSecretResultOutput) Ciphertext() pulumi.StringOutput {
return o.ApplyT(func(v GetKMSSecretResult) string { return v.Ciphertext }).(pulumi.StringOutput)
}
func (o GetKMSSecretResultOutput) CryptoKey() pulumi.StringOutput {
return o.ApplyT(func(v GetKMSSecretResult) string { return v.CryptoKey }).(pulumi.StringOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetKMSSecretResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetKMSSecretResult) string { return v.Id }).(pulumi.StringOutput)
}
// Contains the result of decrypting the provided ciphertext.
func (o GetKMSSecretResultOutput) Plaintext() pulumi.StringOutput {
return o.ApplyT(func(v GetKMSSecretResult) string { return v.Plaintext }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(GetKMSSecretResultOutput{})
}