generated from pulumi/pulumi-tf-provider-boilerplate
/
kmsSecretCiphertext.go
310 lines (260 loc) · 12 KB
/
kmsSecretCiphertext.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package yandex
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Encrypts given plaintext with the specified Yandex KMS key and provides access to the ciphertext.
//
// > **Note:** Using this resource 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.
//
// For more information, see [the official documentation](https://cloud.yandex.com/docs/kms/concepts/).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-yandex/sdk/go/yandex"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := yandex.NewKmsSymmetricKey(ctx, "example", &yandex.KmsSymmetricKeyArgs{
// Description: pulumi.String("description for key"),
// })
// if err != nil {
// return err
// }
// _, err = yandex.NewKmsSecretCiphertext(ctx, "password", &yandex.KmsSecretCiphertextArgs{
// AadContext: pulumi.String("additional authenticated data"),
// KeyId: example.ID(),
// Plaintext: pulumi.String("strong password"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type KmsSecretCiphertext struct {
pulumi.CustomResourceState
// Additional authenticated data (AAD context), optional. If specified, this data will be required for decryption with the `SymmetricDecryptRequest`
AadContext pulumi.StringPtrOutput `pulumi:"aadContext"`
// Resulting ciphertext, encoded with "standard" base64 alphabet as defined in RFC 4648 section 4
Ciphertext pulumi.StringOutput `pulumi:"ciphertext"`
// ID of the symmetric KMS key to use for encryption.
KeyId pulumi.StringOutput `pulumi:"keyId"`
// Plaintext to be encrypted.
Plaintext pulumi.StringOutput `pulumi:"plaintext"`
}
// NewKmsSecretCiphertext registers a new resource with the given unique name, arguments, and options.
func NewKmsSecretCiphertext(ctx *pulumi.Context,
name string, args *KmsSecretCiphertextArgs, opts ...pulumi.ResourceOption) (*KmsSecretCiphertext, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.KeyId == nil {
return nil, errors.New("invalid value for required argument 'KeyId'")
}
if args.Plaintext == nil {
return nil, errors.New("invalid value for required argument 'Plaintext'")
}
if args.Plaintext != nil {
args.Plaintext = pulumi.ToSecret(args.Plaintext).(pulumi.StringOutput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"plaintext",
})
opts = append(opts, secrets)
opts = pkgResourceDefaultOpts(opts)
var resource KmsSecretCiphertext
err := ctx.RegisterResource("yandex:index/kmsSecretCiphertext:KmsSecretCiphertext", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetKmsSecretCiphertext gets an existing KmsSecretCiphertext resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetKmsSecretCiphertext(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *KmsSecretCiphertextState, opts ...pulumi.ResourceOption) (*KmsSecretCiphertext, error) {
var resource KmsSecretCiphertext
err := ctx.ReadResource("yandex:index/kmsSecretCiphertext:KmsSecretCiphertext", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering KmsSecretCiphertext resources.
type kmsSecretCiphertextState struct {
// Additional authenticated data (AAD context), optional. If specified, this data will be required for decryption with the `SymmetricDecryptRequest`
AadContext *string `pulumi:"aadContext"`
// Resulting ciphertext, encoded with "standard" base64 alphabet as defined in RFC 4648 section 4
Ciphertext *string `pulumi:"ciphertext"`
// ID of the symmetric KMS key to use for encryption.
KeyId *string `pulumi:"keyId"`
// Plaintext to be encrypted.
Plaintext *string `pulumi:"plaintext"`
}
type KmsSecretCiphertextState struct {
// Additional authenticated data (AAD context), optional. If specified, this data will be required for decryption with the `SymmetricDecryptRequest`
AadContext pulumi.StringPtrInput
// Resulting ciphertext, encoded with "standard" base64 alphabet as defined in RFC 4648 section 4
Ciphertext pulumi.StringPtrInput
// ID of the symmetric KMS key to use for encryption.
KeyId pulumi.StringPtrInput
// Plaintext to be encrypted.
Plaintext pulumi.StringPtrInput
}
func (KmsSecretCiphertextState) ElementType() reflect.Type {
return reflect.TypeOf((*kmsSecretCiphertextState)(nil)).Elem()
}
type kmsSecretCiphertextArgs struct {
// Additional authenticated data (AAD context), optional. If specified, this data will be required for decryption with the `SymmetricDecryptRequest`
AadContext *string `pulumi:"aadContext"`
// ID of the symmetric KMS key to use for encryption.
KeyId string `pulumi:"keyId"`
// Plaintext to be encrypted.
Plaintext string `pulumi:"plaintext"`
}
// The set of arguments for constructing a KmsSecretCiphertext resource.
type KmsSecretCiphertextArgs struct {
// Additional authenticated data (AAD context), optional. If specified, this data will be required for decryption with the `SymmetricDecryptRequest`
AadContext pulumi.StringPtrInput
// ID of the symmetric KMS key to use for encryption.
KeyId pulumi.StringInput
// Plaintext to be encrypted.
Plaintext pulumi.StringInput
}
func (KmsSecretCiphertextArgs) ElementType() reflect.Type {
return reflect.TypeOf((*kmsSecretCiphertextArgs)(nil)).Elem()
}
type KmsSecretCiphertextInput interface {
pulumi.Input
ToKmsSecretCiphertextOutput() KmsSecretCiphertextOutput
ToKmsSecretCiphertextOutputWithContext(ctx context.Context) KmsSecretCiphertextOutput
}
func (*KmsSecretCiphertext) ElementType() reflect.Type {
return reflect.TypeOf((**KmsSecretCiphertext)(nil)).Elem()
}
func (i *KmsSecretCiphertext) ToKmsSecretCiphertextOutput() KmsSecretCiphertextOutput {
return i.ToKmsSecretCiphertextOutputWithContext(context.Background())
}
func (i *KmsSecretCiphertext) ToKmsSecretCiphertextOutputWithContext(ctx context.Context) KmsSecretCiphertextOutput {
return pulumi.ToOutputWithContext(ctx, i).(KmsSecretCiphertextOutput)
}
// KmsSecretCiphertextArrayInput is an input type that accepts KmsSecretCiphertextArray and KmsSecretCiphertextArrayOutput values.
// You can construct a concrete instance of `KmsSecretCiphertextArrayInput` via:
//
// KmsSecretCiphertextArray{ KmsSecretCiphertextArgs{...} }
type KmsSecretCiphertextArrayInput interface {
pulumi.Input
ToKmsSecretCiphertextArrayOutput() KmsSecretCiphertextArrayOutput
ToKmsSecretCiphertextArrayOutputWithContext(context.Context) KmsSecretCiphertextArrayOutput
}
type KmsSecretCiphertextArray []KmsSecretCiphertextInput
func (KmsSecretCiphertextArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*KmsSecretCiphertext)(nil)).Elem()
}
func (i KmsSecretCiphertextArray) ToKmsSecretCiphertextArrayOutput() KmsSecretCiphertextArrayOutput {
return i.ToKmsSecretCiphertextArrayOutputWithContext(context.Background())
}
func (i KmsSecretCiphertextArray) ToKmsSecretCiphertextArrayOutputWithContext(ctx context.Context) KmsSecretCiphertextArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(KmsSecretCiphertextArrayOutput)
}
// KmsSecretCiphertextMapInput is an input type that accepts KmsSecretCiphertextMap and KmsSecretCiphertextMapOutput values.
// You can construct a concrete instance of `KmsSecretCiphertextMapInput` via:
//
// KmsSecretCiphertextMap{ "key": KmsSecretCiphertextArgs{...} }
type KmsSecretCiphertextMapInput interface {
pulumi.Input
ToKmsSecretCiphertextMapOutput() KmsSecretCiphertextMapOutput
ToKmsSecretCiphertextMapOutputWithContext(context.Context) KmsSecretCiphertextMapOutput
}
type KmsSecretCiphertextMap map[string]KmsSecretCiphertextInput
func (KmsSecretCiphertextMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*KmsSecretCiphertext)(nil)).Elem()
}
func (i KmsSecretCiphertextMap) ToKmsSecretCiphertextMapOutput() KmsSecretCiphertextMapOutput {
return i.ToKmsSecretCiphertextMapOutputWithContext(context.Background())
}
func (i KmsSecretCiphertextMap) ToKmsSecretCiphertextMapOutputWithContext(ctx context.Context) KmsSecretCiphertextMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(KmsSecretCiphertextMapOutput)
}
type KmsSecretCiphertextOutput struct{ *pulumi.OutputState }
func (KmsSecretCiphertextOutput) ElementType() reflect.Type {
return reflect.TypeOf((**KmsSecretCiphertext)(nil)).Elem()
}
func (o KmsSecretCiphertextOutput) ToKmsSecretCiphertextOutput() KmsSecretCiphertextOutput {
return o
}
func (o KmsSecretCiphertextOutput) ToKmsSecretCiphertextOutputWithContext(ctx context.Context) KmsSecretCiphertextOutput {
return o
}
// Additional authenticated data (AAD context), optional. If specified, this data will be required for decryption with the `SymmetricDecryptRequest`
func (o KmsSecretCiphertextOutput) AadContext() pulumi.StringPtrOutput {
return o.ApplyT(func(v *KmsSecretCiphertext) pulumi.StringPtrOutput { return v.AadContext }).(pulumi.StringPtrOutput)
}
// Resulting ciphertext, encoded with "standard" base64 alphabet as defined in RFC 4648 section 4
func (o KmsSecretCiphertextOutput) Ciphertext() pulumi.StringOutput {
return o.ApplyT(func(v *KmsSecretCiphertext) pulumi.StringOutput { return v.Ciphertext }).(pulumi.StringOutput)
}
// ID of the symmetric KMS key to use for encryption.
func (o KmsSecretCiphertextOutput) KeyId() pulumi.StringOutput {
return o.ApplyT(func(v *KmsSecretCiphertext) pulumi.StringOutput { return v.KeyId }).(pulumi.StringOutput)
}
// Plaintext to be encrypted.
func (o KmsSecretCiphertextOutput) Plaintext() pulumi.StringOutput {
return o.ApplyT(func(v *KmsSecretCiphertext) pulumi.StringOutput { return v.Plaintext }).(pulumi.StringOutput)
}
type KmsSecretCiphertextArrayOutput struct{ *pulumi.OutputState }
func (KmsSecretCiphertextArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*KmsSecretCiphertext)(nil)).Elem()
}
func (o KmsSecretCiphertextArrayOutput) ToKmsSecretCiphertextArrayOutput() KmsSecretCiphertextArrayOutput {
return o
}
func (o KmsSecretCiphertextArrayOutput) ToKmsSecretCiphertextArrayOutputWithContext(ctx context.Context) KmsSecretCiphertextArrayOutput {
return o
}
func (o KmsSecretCiphertextArrayOutput) Index(i pulumi.IntInput) KmsSecretCiphertextOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *KmsSecretCiphertext {
return vs[0].([]*KmsSecretCiphertext)[vs[1].(int)]
}).(KmsSecretCiphertextOutput)
}
type KmsSecretCiphertextMapOutput struct{ *pulumi.OutputState }
func (KmsSecretCiphertextMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*KmsSecretCiphertext)(nil)).Elem()
}
func (o KmsSecretCiphertextMapOutput) ToKmsSecretCiphertextMapOutput() KmsSecretCiphertextMapOutput {
return o
}
func (o KmsSecretCiphertextMapOutput) ToKmsSecretCiphertextMapOutputWithContext(ctx context.Context) KmsSecretCiphertextMapOutput {
return o
}
func (o KmsSecretCiphertextMapOutput) MapIndex(k pulumi.StringInput) KmsSecretCiphertextOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *KmsSecretCiphertext {
return vs[0].(map[string]*KmsSecretCiphertext)[vs[1].(string)]
}).(KmsSecretCiphertextOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*KmsSecretCiphertextInput)(nil)).Elem(), &KmsSecretCiphertext{})
pulumi.RegisterInputType(reflect.TypeOf((*KmsSecretCiphertextArrayInput)(nil)).Elem(), KmsSecretCiphertextArray{})
pulumi.RegisterInputType(reflect.TypeOf((*KmsSecretCiphertextMapInput)(nil)).Elem(), KmsSecretCiphertextMap{})
pulumi.RegisterOutputType(KmsSecretCiphertextOutput{})
pulumi.RegisterOutputType(KmsSecretCiphertextArrayOutput{})
pulumi.RegisterOutputType(KmsSecretCiphertextMapOutput{})
}