/
keyRingImportJob.go
391 lines (330 loc) · 16.5 KB
/
keyRingImportJob.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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
// *** 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/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A `KeyRingImportJob` can be used to create `CryptoKeys` and `CryptoKeyVersions` using pre-existing
// key material, generated outside of Cloud KMS. A `KeyRingImportJob` expires 3 days after it is created.
// Once expired, Cloud KMS will no longer be able to import or unwrap any key material that
// was wrapped with the `KeyRingImportJob`'s public key.
//
// > **Note:** KeyRingImportJobs cannot be deleted from Google Cloud Platform.
// Destroying a provider-managed KeyRingImportJob will remove it from state but
// *will not delete the resource from the project.*
//
// To get more information about KeyRingImportJob, see:
//
// * [API documentation](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.importJobs)
// * How-to Guides
// * [Importing a key](https://cloud.google.com/kms/docs/importing-a-key)
//
// ## Example Usage
//
// ## Import
//
// KeyRingImportJob can be imported using any of these accepted formats
//
// ```sh
// $ pulumi import gcp:kms/keyRingImportJob:KeyRingImportJob default {{name}}
// ```
type KeyRingImportJob struct {
pulumi.CustomResourceState
// Statement that was generated and signed by the key creator (for example, an HSM) at key creation time. Use this
// statement to verify attributes of the key as stored on the HSM, independently of Google. Only present if the chosen
// ImportMethod is one with a protection level of HSM.
Attestations KeyRingImportJobAttestationArrayOutput `pulumi:"attestations"`
// The time at which this resource is scheduled for expiration and can no longer be used. This is in RFC3339 text format.
ExpireTime pulumi.StringOutput `pulumi:"expireTime"`
// It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}
ImportJobId pulumi.StringOutput `pulumi:"importJobId"`
// The wrapping method to be used for incoming key material.
// Possible values are `RSA_OAEP_3072_SHA1_AES_256` and `RSA_OAEP_4096_SHA1_AES_256`.
ImportMethod pulumi.StringOutput `pulumi:"importMethod"`
// The KeyRing that this import job belongs to.
// Format: `'projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}'`.
KeyRing pulumi.StringOutput `pulumi:"keyRing"`
// The resource name for this ImportJob in the format projects/*/locations/*/keyRings/*/importJobs/*.
Name pulumi.StringOutput `pulumi:"name"`
// The protection level of the ImportJob. This must match the protectionLevel of the
// versionTemplate on the CryptoKey you attempt to import into.
// Possible values are `SOFTWARE`, `HSM`, and `EXTERNAL`.
ProtectionLevel pulumi.StringOutput `pulumi:"protectionLevel"`
// The public key with which to wrap key material prior to import. Only returned if state is 'ACTIVE'.
PublicKeys KeyRingImportJobPublicKeyArrayOutput `pulumi:"publicKeys"`
// The current state of the ImportJob, indicating if it can be used.
State pulumi.StringOutput `pulumi:"state"`
}
// NewKeyRingImportJob registers a new resource with the given unique name, arguments, and options.
func NewKeyRingImportJob(ctx *pulumi.Context,
name string, args *KeyRingImportJobArgs, opts ...pulumi.ResourceOption) (*KeyRingImportJob, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ImportJobId == nil {
return nil, errors.New("invalid value for required argument 'ImportJobId'")
}
if args.ImportMethod == nil {
return nil, errors.New("invalid value for required argument 'ImportMethod'")
}
if args.KeyRing == nil {
return nil, errors.New("invalid value for required argument 'KeyRing'")
}
if args.ProtectionLevel == nil {
return nil, errors.New("invalid value for required argument 'ProtectionLevel'")
}
var resource KeyRingImportJob
err := ctx.RegisterResource("gcp:kms/keyRingImportJob:KeyRingImportJob", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetKeyRingImportJob gets an existing KeyRingImportJob 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 GetKeyRingImportJob(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *KeyRingImportJobState, opts ...pulumi.ResourceOption) (*KeyRingImportJob, error) {
var resource KeyRingImportJob
err := ctx.ReadResource("gcp:kms/keyRingImportJob:KeyRingImportJob", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering KeyRingImportJob resources.
type keyRingImportJobState struct {
// Statement that was generated and signed by the key creator (for example, an HSM) at key creation time. Use this
// statement to verify attributes of the key as stored on the HSM, independently of Google. Only present if the chosen
// ImportMethod is one with a protection level of HSM.
Attestations []KeyRingImportJobAttestation `pulumi:"attestations"`
// The time at which this resource is scheduled for expiration and can no longer be used. This is in RFC3339 text format.
ExpireTime *string `pulumi:"expireTime"`
// It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}
ImportJobId *string `pulumi:"importJobId"`
// The wrapping method to be used for incoming key material.
// Possible values are `RSA_OAEP_3072_SHA1_AES_256` and `RSA_OAEP_4096_SHA1_AES_256`.
ImportMethod *string `pulumi:"importMethod"`
// The KeyRing that this import job belongs to.
// Format: `'projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}'`.
KeyRing *string `pulumi:"keyRing"`
// The resource name for this ImportJob in the format projects/*/locations/*/keyRings/*/importJobs/*.
Name *string `pulumi:"name"`
// The protection level of the ImportJob. This must match the protectionLevel of the
// versionTemplate on the CryptoKey you attempt to import into.
// Possible values are `SOFTWARE`, `HSM`, and `EXTERNAL`.
ProtectionLevel *string `pulumi:"protectionLevel"`
// The public key with which to wrap key material prior to import. Only returned if state is 'ACTIVE'.
PublicKeys []KeyRingImportJobPublicKey `pulumi:"publicKeys"`
// The current state of the ImportJob, indicating if it can be used.
State *string `pulumi:"state"`
}
type KeyRingImportJobState struct {
// Statement that was generated and signed by the key creator (for example, an HSM) at key creation time. Use this
// statement to verify attributes of the key as stored on the HSM, independently of Google. Only present if the chosen
// ImportMethod is one with a protection level of HSM.
Attestations KeyRingImportJobAttestationArrayInput
// The time at which this resource is scheduled for expiration and can no longer be used. This is in RFC3339 text format.
ExpireTime pulumi.StringPtrInput
// It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}
ImportJobId pulumi.StringPtrInput
// The wrapping method to be used for incoming key material.
// Possible values are `RSA_OAEP_3072_SHA1_AES_256` and `RSA_OAEP_4096_SHA1_AES_256`.
ImportMethod pulumi.StringPtrInput
// The KeyRing that this import job belongs to.
// Format: `'projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}'`.
KeyRing pulumi.StringPtrInput
// The resource name for this ImportJob in the format projects/*/locations/*/keyRings/*/importJobs/*.
Name pulumi.StringPtrInput
// The protection level of the ImportJob. This must match the protectionLevel of the
// versionTemplate on the CryptoKey you attempt to import into.
// Possible values are `SOFTWARE`, `HSM`, and `EXTERNAL`.
ProtectionLevel pulumi.StringPtrInput
// The public key with which to wrap key material prior to import. Only returned if state is 'ACTIVE'.
PublicKeys KeyRingImportJobPublicKeyArrayInput
// The current state of the ImportJob, indicating if it can be used.
State pulumi.StringPtrInput
}
func (KeyRingImportJobState) ElementType() reflect.Type {
return reflect.TypeOf((*keyRingImportJobState)(nil)).Elem()
}
type keyRingImportJobArgs struct {
// It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}
ImportJobId string `pulumi:"importJobId"`
// The wrapping method to be used for incoming key material.
// Possible values are `RSA_OAEP_3072_SHA1_AES_256` and `RSA_OAEP_4096_SHA1_AES_256`.
ImportMethod string `pulumi:"importMethod"`
// The KeyRing that this import job belongs to.
// Format: `'projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}'`.
KeyRing string `pulumi:"keyRing"`
// The protection level of the ImportJob. This must match the protectionLevel of the
// versionTemplate on the CryptoKey you attempt to import into.
// Possible values are `SOFTWARE`, `HSM`, and `EXTERNAL`.
ProtectionLevel string `pulumi:"protectionLevel"`
}
// The set of arguments for constructing a KeyRingImportJob resource.
type KeyRingImportJobArgs struct {
// It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}
ImportJobId pulumi.StringInput
// The wrapping method to be used for incoming key material.
// Possible values are `RSA_OAEP_3072_SHA1_AES_256` and `RSA_OAEP_4096_SHA1_AES_256`.
ImportMethod pulumi.StringInput
// The KeyRing that this import job belongs to.
// Format: `'projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}'`.
KeyRing pulumi.StringInput
// The protection level of the ImportJob. This must match the protectionLevel of the
// versionTemplate on the CryptoKey you attempt to import into.
// Possible values are `SOFTWARE`, `HSM`, and `EXTERNAL`.
ProtectionLevel pulumi.StringInput
}
func (KeyRingImportJobArgs) ElementType() reflect.Type {
return reflect.TypeOf((*keyRingImportJobArgs)(nil)).Elem()
}
type KeyRingImportJobInput interface {
pulumi.Input
ToKeyRingImportJobOutput() KeyRingImportJobOutput
ToKeyRingImportJobOutputWithContext(ctx context.Context) KeyRingImportJobOutput
}
func (*KeyRingImportJob) ElementType() reflect.Type {
return reflect.TypeOf((*KeyRingImportJob)(nil))
}
func (i *KeyRingImportJob) ToKeyRingImportJobOutput() KeyRingImportJobOutput {
return i.ToKeyRingImportJobOutputWithContext(context.Background())
}
func (i *KeyRingImportJob) ToKeyRingImportJobOutputWithContext(ctx context.Context) KeyRingImportJobOutput {
return pulumi.ToOutputWithContext(ctx, i).(KeyRingImportJobOutput)
}
func (i *KeyRingImportJob) ToKeyRingImportJobPtrOutput() KeyRingImportJobPtrOutput {
return i.ToKeyRingImportJobPtrOutputWithContext(context.Background())
}
func (i *KeyRingImportJob) ToKeyRingImportJobPtrOutputWithContext(ctx context.Context) KeyRingImportJobPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(KeyRingImportJobPtrOutput)
}
type KeyRingImportJobPtrInput interface {
pulumi.Input
ToKeyRingImportJobPtrOutput() KeyRingImportJobPtrOutput
ToKeyRingImportJobPtrOutputWithContext(ctx context.Context) KeyRingImportJobPtrOutput
}
type keyRingImportJobPtrType KeyRingImportJobArgs
func (*keyRingImportJobPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**KeyRingImportJob)(nil))
}
func (i *keyRingImportJobPtrType) ToKeyRingImportJobPtrOutput() KeyRingImportJobPtrOutput {
return i.ToKeyRingImportJobPtrOutputWithContext(context.Background())
}
func (i *keyRingImportJobPtrType) ToKeyRingImportJobPtrOutputWithContext(ctx context.Context) KeyRingImportJobPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(KeyRingImportJobPtrOutput)
}
// KeyRingImportJobArrayInput is an input type that accepts KeyRingImportJobArray and KeyRingImportJobArrayOutput values.
// You can construct a concrete instance of `KeyRingImportJobArrayInput` via:
//
// KeyRingImportJobArray{ KeyRingImportJobArgs{...} }
type KeyRingImportJobArrayInput interface {
pulumi.Input
ToKeyRingImportJobArrayOutput() KeyRingImportJobArrayOutput
ToKeyRingImportJobArrayOutputWithContext(context.Context) KeyRingImportJobArrayOutput
}
type KeyRingImportJobArray []KeyRingImportJobInput
func (KeyRingImportJobArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*KeyRingImportJob)(nil)).Elem()
}
func (i KeyRingImportJobArray) ToKeyRingImportJobArrayOutput() KeyRingImportJobArrayOutput {
return i.ToKeyRingImportJobArrayOutputWithContext(context.Background())
}
func (i KeyRingImportJobArray) ToKeyRingImportJobArrayOutputWithContext(ctx context.Context) KeyRingImportJobArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(KeyRingImportJobArrayOutput)
}
// KeyRingImportJobMapInput is an input type that accepts KeyRingImportJobMap and KeyRingImportJobMapOutput values.
// You can construct a concrete instance of `KeyRingImportJobMapInput` via:
//
// KeyRingImportJobMap{ "key": KeyRingImportJobArgs{...} }
type KeyRingImportJobMapInput interface {
pulumi.Input
ToKeyRingImportJobMapOutput() KeyRingImportJobMapOutput
ToKeyRingImportJobMapOutputWithContext(context.Context) KeyRingImportJobMapOutput
}
type KeyRingImportJobMap map[string]KeyRingImportJobInput
func (KeyRingImportJobMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*KeyRingImportJob)(nil)).Elem()
}
func (i KeyRingImportJobMap) ToKeyRingImportJobMapOutput() KeyRingImportJobMapOutput {
return i.ToKeyRingImportJobMapOutputWithContext(context.Background())
}
func (i KeyRingImportJobMap) ToKeyRingImportJobMapOutputWithContext(ctx context.Context) KeyRingImportJobMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(KeyRingImportJobMapOutput)
}
type KeyRingImportJobOutput struct{ *pulumi.OutputState }
func (KeyRingImportJobOutput) ElementType() reflect.Type {
return reflect.TypeOf((*KeyRingImportJob)(nil))
}
func (o KeyRingImportJobOutput) ToKeyRingImportJobOutput() KeyRingImportJobOutput {
return o
}
func (o KeyRingImportJobOutput) ToKeyRingImportJobOutputWithContext(ctx context.Context) KeyRingImportJobOutput {
return o
}
func (o KeyRingImportJobOutput) ToKeyRingImportJobPtrOutput() KeyRingImportJobPtrOutput {
return o.ToKeyRingImportJobPtrOutputWithContext(context.Background())
}
func (o KeyRingImportJobOutput) ToKeyRingImportJobPtrOutputWithContext(ctx context.Context) KeyRingImportJobPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v KeyRingImportJob) *KeyRingImportJob {
return &v
}).(KeyRingImportJobPtrOutput)
}
type KeyRingImportJobPtrOutput struct{ *pulumi.OutputState }
func (KeyRingImportJobPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**KeyRingImportJob)(nil))
}
func (o KeyRingImportJobPtrOutput) ToKeyRingImportJobPtrOutput() KeyRingImportJobPtrOutput {
return o
}
func (o KeyRingImportJobPtrOutput) ToKeyRingImportJobPtrOutputWithContext(ctx context.Context) KeyRingImportJobPtrOutput {
return o
}
func (o KeyRingImportJobPtrOutput) Elem() KeyRingImportJobOutput {
return o.ApplyT(func(v *KeyRingImportJob) KeyRingImportJob {
if v != nil {
return *v
}
var ret KeyRingImportJob
return ret
}).(KeyRingImportJobOutput)
}
type KeyRingImportJobArrayOutput struct{ *pulumi.OutputState }
func (KeyRingImportJobArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]KeyRingImportJob)(nil))
}
func (o KeyRingImportJobArrayOutput) ToKeyRingImportJobArrayOutput() KeyRingImportJobArrayOutput {
return o
}
func (o KeyRingImportJobArrayOutput) ToKeyRingImportJobArrayOutputWithContext(ctx context.Context) KeyRingImportJobArrayOutput {
return o
}
func (o KeyRingImportJobArrayOutput) Index(i pulumi.IntInput) KeyRingImportJobOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) KeyRingImportJob {
return vs[0].([]KeyRingImportJob)[vs[1].(int)]
}).(KeyRingImportJobOutput)
}
type KeyRingImportJobMapOutput struct{ *pulumi.OutputState }
func (KeyRingImportJobMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]KeyRingImportJob)(nil))
}
func (o KeyRingImportJobMapOutput) ToKeyRingImportJobMapOutput() KeyRingImportJobMapOutput {
return o
}
func (o KeyRingImportJobMapOutput) ToKeyRingImportJobMapOutputWithContext(ctx context.Context) KeyRingImportJobMapOutput {
return o
}
func (o KeyRingImportJobMapOutput) MapIndex(k pulumi.StringInput) KeyRingImportJobOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) KeyRingImportJob {
return vs[0].(map[string]KeyRingImportJob)[vs[1].(string)]
}).(KeyRingImportJobOutput)
}
func init() {
pulumi.RegisterOutputType(KeyRingImportJobOutput{})
pulumi.RegisterOutputType(KeyRingImportJobPtrOutput{})
pulumi.RegisterOutputType(KeyRingImportJobArrayOutput{})
pulumi.RegisterOutputType(KeyRingImportJobMapOutput{})
}