/
secretBackendCert.go
441 lines (380 loc) · 16.2 KB
/
secretBackendCert.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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
// *** 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 pkisecret
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type SecretBackendCert struct {
pulumi.CustomResourceState
// List of alternative names
AltNames pulumi.StringArrayOutput `pulumi:"altNames"`
// If set to `true`, certs will be renewed if the expiration is within `minSecondsRemaining`. Default `false`
AutoRenew pulumi.BoolPtrOutput `pulumi:"autoRenew"`
// The PKI secret backend the resource belongs to.
Backend pulumi.StringOutput `pulumi:"backend"`
// The CA chain
CaChain pulumi.StringOutput `pulumi:"caChain"`
// The certificate
Certificate pulumi.StringOutput `pulumi:"certificate"`
// CN of certificate to create
CommonName pulumi.StringOutput `pulumi:"commonName"`
// Flag to exclude CN from SANs
ExcludeCnFromSans pulumi.BoolPtrOutput `pulumi:"excludeCnFromSans"`
// The expiration date of the certificate in unix epoch format
Expiration pulumi.IntOutput `pulumi:"expiration"`
// The format of data
Format pulumi.StringPtrOutput `pulumi:"format"`
// List of alternative IPs
IpSans pulumi.StringArrayOutput `pulumi:"ipSans"`
// The issuing CA
IssuingCa pulumi.StringOutput `pulumi:"issuingCa"`
// Generate a new certificate when the expiration is within this number of seconds, default is 604800 (7 days)
MinSecondsRemaining pulumi.IntPtrOutput `pulumi:"minSecondsRemaining"`
// Name of the role to create the certificate against
Name pulumi.StringOutput `pulumi:"name"`
// List of other SANs
OtherSans pulumi.StringArrayOutput `pulumi:"otherSans"`
// The private key
PrivateKey pulumi.StringOutput `pulumi:"privateKey"`
// The private key format
PrivateKeyFormat pulumi.StringPtrOutput `pulumi:"privateKeyFormat"`
// The private key type
PrivateKeyType pulumi.StringOutput `pulumi:"privateKeyType"`
// The serial number
SerialNumber pulumi.StringOutput `pulumi:"serialNumber"`
// Time to live
Ttl pulumi.StringPtrOutput `pulumi:"ttl"`
// List of alternative URIs
UriSans pulumi.StringArrayOutput `pulumi:"uriSans"`
}
// NewSecretBackendCert registers a new resource with the given unique name, arguments, and options.
func NewSecretBackendCert(ctx *pulumi.Context,
name string, args *SecretBackendCertArgs, opts ...pulumi.ResourceOption) (*SecretBackendCert, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Backend == nil {
return nil, errors.New("invalid value for required argument 'Backend'")
}
if args.CommonName == nil {
return nil, errors.New("invalid value for required argument 'CommonName'")
}
var resource SecretBackendCert
err := ctx.RegisterResource("vault:pkiSecret/secretBackendCert:SecretBackendCert", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSecretBackendCert gets an existing SecretBackendCert 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 GetSecretBackendCert(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SecretBackendCertState, opts ...pulumi.ResourceOption) (*SecretBackendCert, error) {
var resource SecretBackendCert
err := ctx.ReadResource("vault:pkiSecret/secretBackendCert:SecretBackendCert", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SecretBackendCert resources.
type secretBackendCertState struct {
// List of alternative names
AltNames []string `pulumi:"altNames"`
// If set to `true`, certs will be renewed if the expiration is within `minSecondsRemaining`. Default `false`
AutoRenew *bool `pulumi:"autoRenew"`
// The PKI secret backend the resource belongs to.
Backend *string `pulumi:"backend"`
// The CA chain
CaChain *string `pulumi:"caChain"`
// The certificate
Certificate *string `pulumi:"certificate"`
// CN of certificate to create
CommonName *string `pulumi:"commonName"`
// Flag to exclude CN from SANs
ExcludeCnFromSans *bool `pulumi:"excludeCnFromSans"`
// The expiration date of the certificate in unix epoch format
Expiration *int `pulumi:"expiration"`
// The format of data
Format *string `pulumi:"format"`
// List of alternative IPs
IpSans []string `pulumi:"ipSans"`
// The issuing CA
IssuingCa *string `pulumi:"issuingCa"`
// Generate a new certificate when the expiration is within this number of seconds, default is 604800 (7 days)
MinSecondsRemaining *int `pulumi:"minSecondsRemaining"`
// Name of the role to create the certificate against
Name *string `pulumi:"name"`
// List of other SANs
OtherSans []string `pulumi:"otherSans"`
// The private key
PrivateKey *string `pulumi:"privateKey"`
// The private key format
PrivateKeyFormat *string `pulumi:"privateKeyFormat"`
// The private key type
PrivateKeyType *string `pulumi:"privateKeyType"`
// The serial number
SerialNumber *string `pulumi:"serialNumber"`
// Time to live
Ttl *string `pulumi:"ttl"`
// List of alternative URIs
UriSans []string `pulumi:"uriSans"`
}
type SecretBackendCertState struct {
// List of alternative names
AltNames pulumi.StringArrayInput
// If set to `true`, certs will be renewed if the expiration is within `minSecondsRemaining`. Default `false`
AutoRenew pulumi.BoolPtrInput
// The PKI secret backend the resource belongs to.
Backend pulumi.StringPtrInput
// The CA chain
CaChain pulumi.StringPtrInput
// The certificate
Certificate pulumi.StringPtrInput
// CN of certificate to create
CommonName pulumi.StringPtrInput
// Flag to exclude CN from SANs
ExcludeCnFromSans pulumi.BoolPtrInput
// The expiration date of the certificate in unix epoch format
Expiration pulumi.IntPtrInput
// The format of data
Format pulumi.StringPtrInput
// List of alternative IPs
IpSans pulumi.StringArrayInput
// The issuing CA
IssuingCa pulumi.StringPtrInput
// Generate a new certificate when the expiration is within this number of seconds, default is 604800 (7 days)
MinSecondsRemaining pulumi.IntPtrInput
// Name of the role to create the certificate against
Name pulumi.StringPtrInput
// List of other SANs
OtherSans pulumi.StringArrayInput
// The private key
PrivateKey pulumi.StringPtrInput
// The private key format
PrivateKeyFormat pulumi.StringPtrInput
// The private key type
PrivateKeyType pulumi.StringPtrInput
// The serial number
SerialNumber pulumi.StringPtrInput
// Time to live
Ttl pulumi.StringPtrInput
// List of alternative URIs
UriSans pulumi.StringArrayInput
}
func (SecretBackendCertState) ElementType() reflect.Type {
return reflect.TypeOf((*secretBackendCertState)(nil)).Elem()
}
type secretBackendCertArgs struct {
// List of alternative names
AltNames []string `pulumi:"altNames"`
// If set to `true`, certs will be renewed if the expiration is within `minSecondsRemaining`. Default `false`
AutoRenew *bool `pulumi:"autoRenew"`
// The PKI secret backend the resource belongs to.
Backend string `pulumi:"backend"`
// CN of certificate to create
CommonName string `pulumi:"commonName"`
// Flag to exclude CN from SANs
ExcludeCnFromSans *bool `pulumi:"excludeCnFromSans"`
// The format of data
Format *string `pulumi:"format"`
// List of alternative IPs
IpSans []string `pulumi:"ipSans"`
// Generate a new certificate when the expiration is within this number of seconds, default is 604800 (7 days)
MinSecondsRemaining *int `pulumi:"minSecondsRemaining"`
// Name of the role to create the certificate against
Name *string `pulumi:"name"`
// List of other SANs
OtherSans []string `pulumi:"otherSans"`
// The private key format
PrivateKeyFormat *string `pulumi:"privateKeyFormat"`
// Time to live
Ttl *string `pulumi:"ttl"`
// List of alternative URIs
UriSans []string `pulumi:"uriSans"`
}
// The set of arguments for constructing a SecretBackendCert resource.
type SecretBackendCertArgs struct {
// List of alternative names
AltNames pulumi.StringArrayInput
// If set to `true`, certs will be renewed if the expiration is within `minSecondsRemaining`. Default `false`
AutoRenew pulumi.BoolPtrInput
// The PKI secret backend the resource belongs to.
Backend pulumi.StringInput
// CN of certificate to create
CommonName pulumi.StringInput
// Flag to exclude CN from SANs
ExcludeCnFromSans pulumi.BoolPtrInput
// The format of data
Format pulumi.StringPtrInput
// List of alternative IPs
IpSans pulumi.StringArrayInput
// Generate a new certificate when the expiration is within this number of seconds, default is 604800 (7 days)
MinSecondsRemaining pulumi.IntPtrInput
// Name of the role to create the certificate against
Name pulumi.StringPtrInput
// List of other SANs
OtherSans pulumi.StringArrayInput
// The private key format
PrivateKeyFormat pulumi.StringPtrInput
// Time to live
Ttl pulumi.StringPtrInput
// List of alternative URIs
UriSans pulumi.StringArrayInput
}
func (SecretBackendCertArgs) ElementType() reflect.Type {
return reflect.TypeOf((*secretBackendCertArgs)(nil)).Elem()
}
type SecretBackendCertInput interface {
pulumi.Input
ToSecretBackendCertOutput() SecretBackendCertOutput
ToSecretBackendCertOutputWithContext(ctx context.Context) SecretBackendCertOutput
}
func (*SecretBackendCert) ElementType() reflect.Type {
return reflect.TypeOf((*SecretBackendCert)(nil))
}
func (i *SecretBackendCert) ToSecretBackendCertOutput() SecretBackendCertOutput {
return i.ToSecretBackendCertOutputWithContext(context.Background())
}
func (i *SecretBackendCert) ToSecretBackendCertOutputWithContext(ctx context.Context) SecretBackendCertOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecretBackendCertOutput)
}
func (i *SecretBackendCert) ToSecretBackendCertPtrOutput() SecretBackendCertPtrOutput {
return i.ToSecretBackendCertPtrOutputWithContext(context.Background())
}
func (i *SecretBackendCert) ToSecretBackendCertPtrOutputWithContext(ctx context.Context) SecretBackendCertPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecretBackendCertPtrOutput)
}
type SecretBackendCertPtrInput interface {
pulumi.Input
ToSecretBackendCertPtrOutput() SecretBackendCertPtrOutput
ToSecretBackendCertPtrOutputWithContext(ctx context.Context) SecretBackendCertPtrOutput
}
type secretBackendCertPtrType SecretBackendCertArgs
func (*secretBackendCertPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**SecretBackendCert)(nil))
}
func (i *secretBackendCertPtrType) ToSecretBackendCertPtrOutput() SecretBackendCertPtrOutput {
return i.ToSecretBackendCertPtrOutputWithContext(context.Background())
}
func (i *secretBackendCertPtrType) ToSecretBackendCertPtrOutputWithContext(ctx context.Context) SecretBackendCertPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecretBackendCertPtrOutput)
}
// SecretBackendCertArrayInput is an input type that accepts SecretBackendCertArray and SecretBackendCertArrayOutput values.
// You can construct a concrete instance of `SecretBackendCertArrayInput` via:
//
// SecretBackendCertArray{ SecretBackendCertArgs{...} }
type SecretBackendCertArrayInput interface {
pulumi.Input
ToSecretBackendCertArrayOutput() SecretBackendCertArrayOutput
ToSecretBackendCertArrayOutputWithContext(context.Context) SecretBackendCertArrayOutput
}
type SecretBackendCertArray []SecretBackendCertInput
func (SecretBackendCertArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SecretBackendCert)(nil)).Elem()
}
func (i SecretBackendCertArray) ToSecretBackendCertArrayOutput() SecretBackendCertArrayOutput {
return i.ToSecretBackendCertArrayOutputWithContext(context.Background())
}
func (i SecretBackendCertArray) ToSecretBackendCertArrayOutputWithContext(ctx context.Context) SecretBackendCertArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecretBackendCertArrayOutput)
}
// SecretBackendCertMapInput is an input type that accepts SecretBackendCertMap and SecretBackendCertMapOutput values.
// You can construct a concrete instance of `SecretBackendCertMapInput` via:
//
// SecretBackendCertMap{ "key": SecretBackendCertArgs{...} }
type SecretBackendCertMapInput interface {
pulumi.Input
ToSecretBackendCertMapOutput() SecretBackendCertMapOutput
ToSecretBackendCertMapOutputWithContext(context.Context) SecretBackendCertMapOutput
}
type SecretBackendCertMap map[string]SecretBackendCertInput
func (SecretBackendCertMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SecretBackendCert)(nil)).Elem()
}
func (i SecretBackendCertMap) ToSecretBackendCertMapOutput() SecretBackendCertMapOutput {
return i.ToSecretBackendCertMapOutputWithContext(context.Background())
}
func (i SecretBackendCertMap) ToSecretBackendCertMapOutputWithContext(ctx context.Context) SecretBackendCertMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecretBackendCertMapOutput)
}
type SecretBackendCertOutput struct{ *pulumi.OutputState }
func (SecretBackendCertOutput) ElementType() reflect.Type {
return reflect.TypeOf((*SecretBackendCert)(nil))
}
func (o SecretBackendCertOutput) ToSecretBackendCertOutput() SecretBackendCertOutput {
return o
}
func (o SecretBackendCertOutput) ToSecretBackendCertOutputWithContext(ctx context.Context) SecretBackendCertOutput {
return o
}
func (o SecretBackendCertOutput) ToSecretBackendCertPtrOutput() SecretBackendCertPtrOutput {
return o.ToSecretBackendCertPtrOutputWithContext(context.Background())
}
func (o SecretBackendCertOutput) ToSecretBackendCertPtrOutputWithContext(ctx context.Context) SecretBackendCertPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v SecretBackendCert) *SecretBackendCert {
return &v
}).(SecretBackendCertPtrOutput)
}
type SecretBackendCertPtrOutput struct{ *pulumi.OutputState }
func (SecretBackendCertPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SecretBackendCert)(nil))
}
func (o SecretBackendCertPtrOutput) ToSecretBackendCertPtrOutput() SecretBackendCertPtrOutput {
return o
}
func (o SecretBackendCertPtrOutput) ToSecretBackendCertPtrOutputWithContext(ctx context.Context) SecretBackendCertPtrOutput {
return o
}
func (o SecretBackendCertPtrOutput) Elem() SecretBackendCertOutput {
return o.ApplyT(func(v *SecretBackendCert) SecretBackendCert {
if v != nil {
return *v
}
var ret SecretBackendCert
return ret
}).(SecretBackendCertOutput)
}
type SecretBackendCertArrayOutput struct{ *pulumi.OutputState }
func (SecretBackendCertArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]SecretBackendCert)(nil))
}
func (o SecretBackendCertArrayOutput) ToSecretBackendCertArrayOutput() SecretBackendCertArrayOutput {
return o
}
func (o SecretBackendCertArrayOutput) ToSecretBackendCertArrayOutputWithContext(ctx context.Context) SecretBackendCertArrayOutput {
return o
}
func (o SecretBackendCertArrayOutput) Index(i pulumi.IntInput) SecretBackendCertOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) SecretBackendCert {
return vs[0].([]SecretBackendCert)[vs[1].(int)]
}).(SecretBackendCertOutput)
}
type SecretBackendCertMapOutput struct{ *pulumi.OutputState }
func (SecretBackendCertMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]SecretBackendCert)(nil))
}
func (o SecretBackendCertMapOutput) ToSecretBackendCertMapOutput() SecretBackendCertMapOutput {
return o
}
func (o SecretBackendCertMapOutput) ToSecretBackendCertMapOutputWithContext(ctx context.Context) SecretBackendCertMapOutput {
return o
}
func (o SecretBackendCertMapOutput) MapIndex(k pulumi.StringInput) SecretBackendCertOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) SecretBackendCert {
return vs[0].(map[string]SecretBackendCert)[vs[1].(string)]
}).(SecretBackendCertOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SecretBackendCertInput)(nil)).Elem(), &SecretBackendCert{})
pulumi.RegisterInputType(reflect.TypeOf((*SecretBackendCertPtrInput)(nil)).Elem(), &SecretBackendCert{})
pulumi.RegisterInputType(reflect.TypeOf((*SecretBackendCertArrayInput)(nil)).Elem(), SecretBackendCertArray{})
pulumi.RegisterInputType(reflect.TypeOf((*SecretBackendCertMapInput)(nil)).Elem(), SecretBackendCertMap{})
pulumi.RegisterOutputType(SecretBackendCertOutput{})
pulumi.RegisterOutputType(SecretBackendCertPtrOutput{})
pulumi.RegisterOutputType(SecretBackendCertArrayOutput{})
pulumi.RegisterOutputType(SecretBackendCertMapOutput{})
}