-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfa.go
694 lines (607 loc) · 19.1 KB
/
fa.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
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
package radir
/*
fa.go contains all FirstAuthority methods and types.
*/
/*
FirstAuthority describes an initial or previous registration authority.
Instances of this type should not be initialized by the user directly.
Instead, see:
- *[Registrant.FirstAuthority] (Dedicated Registrants Policy)
- *[Registration.X660] to access [X660.CombinedFirstAuthority] (Combined Registrants Policy)
*/
type FirstAuthority struct {
// Primary draft-based attribute types for authorities. These
// represent the default types/fields that will be used for an
// authority of this form.
R_L string `ldap:"firstAuthorityLocality"`
R_O string `ldap:"firstAuthorityOrg"`
R_C string `ldap:"firstAuthorityCountryCode"`
R_CO string `ldap:"firstAuthorityCountryName"`
R_ST string `ldap:"firstAuthorityState"`
R_CN string `ldap:"firstAuthorityCommonName"`
R_Tel string `ldap:"firstAuthorityTelephone"`
R_Fax string `ldap:"firstAuthorityFax"`
R_Title string `ldap:"firstAuthorityTitle"`
R_Email string `ldap:"firstAuthorityEmail"`
R_POBox string `ldap:"firstAuthorityPOBox"`
R_PCode string `ldap:"firstAuthorityPostalCode"`
R_PAddr string `ldap:"firstAuthorityPostalAddress"`
R_Street string `ldap:"firstAuthorityStreet"`
R_Mobile string `ldap:"firstAuthorityMobile"`
R_StartTime string `ldap:"firstAuthorityStartTimestamp"`
R_EndTime string `ldap:"firstAuthorityEndTimestamp"`
R_URI []string `ldap:"firstAuthorityURI"`
// Alternative RFC-based attribute types for authorities. See Section
// 3.2.1.1.1 of the RADIT I-D for strategy details and caveats.
//
// By utilizing this strategy, the users in question are expected to
// manage any custom object class chain elements, such as the 'person',
// 'organizationalRole', etc. This package will not assist in this task
// but will not stand in your way, either.
//
// Note that is is possible for these standard types to replace all of
// the above *EXCEPT* for start and end time, as there is no standard
// user-managed timestamp type of this nature.
//
// Also note that the 'firstAuthorityContext' AUXILIARY class will
// still be used for entries of this kind, regardless of attribute
// content strategy.
R_L_alt string `ldap:"l"` // RFC 4519 § 2.16
R_O_alt string `ldap:"o"` // RFC 4519 § 2.19
R_C_alt string `ldap:"c"` // RFC 4519 § 2.2
R_CO_alt string `ldap:"co"` // RFC 4524 § 2.4
R_ST_alt string `ldap:"st"` // RFC 4519 § 2.33
R_CN_alt string `ldap:"cn"` // RFC 4519 § 2.3
R_Tel_alt string `ldap:"telephoneNumber"` // RFC 4519 § 2.35
R_Fax_alt string `ldap:"facsimileTelephoneNumber"` // RFC 4519 § 2.10
R_Title_alt string `ldap:"title"` // RFC 4519 § 2.38
R_Email_alt string `ldap:"mail"` // RFC 4524 § 2.16
R_POBox_alt string `ldap:"postOfficeBox"` // RFC 4519 § 2.25
R_PCode_alt string `ldap:"postalCode"` // RFC 4519 § 2.24
R_PAddr_alt string `ldap:"postalAddress"` // RFC 4519 § 2.23
R_Street_alt string `ldap:"street"` // RFC 4519 § 2.34
R_Mobile_alt string `ldap:"mobile"` // RFC 4524 § 2.18
R_URI_alt []string `ldap:"labeledURI"` // RFC 2079 § 2
r_alt_types bool
}
/*
marshal returns an error following an attempt to execute the input meth
signature upon the receiver instance. Generally, this method need not
be called directly by the end-user for instances of this type.
*/
func (r *FirstAuthority) marshal(meth func(any) error) error {
if r.IsZero() {
r = new(FirstAuthority)
} else if meth == nil {
return NilMethodErr
}
return meth(r)
}
/*
unmarshal returns an instance of map[string][]string bearing the contents
of the receiver.
*/
func (r *FirstAuthority) unmarshal() map[string][]string {
m := make(map[string][]string)
return unmarshalStruct(r, m)
}
func (r *FirstAuthority) ldif() (l string) {
if !r.IsZero() {
l = toLDIF(r)
}
return
}
/*
IsZero returns a Boolean value indicative of a nil receiver state.
*/
func (r *FirstAuthority) IsZero() bool {
return r == nil
}
func (r *FirstAuthority) isEmpty() bool {
return structEmpty(r)
}
/*
CN returns the common name value assigned to the receiver instance.
*/
func (r *FirstAuthority) CN() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_CN
} else {
val = r.R_CN_alt
}
}
return
}
/*
SetCN assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetCN(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityCommonName`,
0, r.r_alt_types), r.SetCN, r, args...)
}
/*
CNGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) CNGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityCommonName`, 0, r.r_alt_types))
}
/*
L returns the locality name value assigned to the receiver instance.
*/
func (r *FirstAuthority) L() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_L
} else {
val = r.R_L_alt
}
}
return
}
/*
SetL assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetL(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityLocality`,
0, r.r_alt_types), r.SetL, r, args...)
}
/*
LGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) LGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityLocality`, 0, r.r_alt_types))
}
/*
O returns the organization name value assigned to the receiver instance.
*/
func (r *FirstAuthority) O() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_O
} else {
val = r.R_O_alt
}
}
return
}
/*
SetO assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetO(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityOrg`,
0, r.r_alt_types), r.SetO, r, args...)
}
/*
OGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) OGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityOrg`, 0, r.r_alt_types))
}
/*
C returns the 2-letter country code value assigned to the receiver instance.
*/
func (r *FirstAuthority) C() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_C
} else {
val = r.R_C_alt
}
}
return
}
/*
SetC assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetC(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityCountryCode`,
0, r.r_alt_types), r.SetC, r, args...)
}
/*
CGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) CGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityCountryCode`, 0, r.r_alt_types))
}
/*
CO returns the so-called "friendly country name" value assigned to the receiver instance.
*/
func (r *FirstAuthority) CO() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_CO
} else {
val = r.R_CO_alt
}
}
return
}
/*
SetCO assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetCO(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityCountryName`,
0, r.r_alt_types), r.SetCO, r, args...)
}
/*
COGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) COGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityCountryName`, 0, r.r_alt_types))
}
/*
ST returns the state or province name value assigned to the receiver instance.
*/
func (r *FirstAuthority) ST() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_ST
} else {
val = r.R_ST_alt
}
}
return
}
/*
SetST assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetST(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityState`,
0, r.r_alt_types), r.SetST, r, args...)
}
/*
STGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) STGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityState`, 0, r.r_alt_types))
}
/*
Tel returns the telephone number value assigned to the receiver instance.
*/
func (r *FirstAuthority) Tel() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_Tel
} else {
val = r.R_Tel_alt
}
}
return
}
/*
SetTel assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetTel(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityTelephone`,
0, r.r_alt_types), r.SetTel, r, args...)
}
/*
TelGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) TelGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityTelephone`, 0, r.r_alt_types))
}
/*
Fax returns the facsimile telephone number value assigned to the receiver instance.
*/
func (r *FirstAuthority) Fax() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_Fax
} else {
val = r.R_Fax_alt
}
}
return
}
/*
SetFax assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetFax(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityFax`,
0, r.r_alt_types), r.SetFax, r, args...)
}
/*
FaxGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) FaxGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityFax`, 0, r.r_alt_types))
}
/*
Title returns the title value assigned to the receiver instance.
*/
func (r *FirstAuthority) Title() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_Title
} else {
val = r.R_Title_alt
}
}
return
}
/*
SetTitle assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetTitle(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityTitle`,
0, r.r_alt_types), r.SetTitle, r, args...)
}
/*
TitleGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) TitleGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityTitle`, 0, r.r_alt_types))
}
/*
Email returns the email address value assigned to the receiver instance.
*/
func (r *FirstAuthority) Email() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_Email
} else {
val = r.R_Email_alt
}
}
return
}
/*
SetEmail assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetEmail(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityEmail`,
0, r.r_alt_types), r.SetEmail, r, args...)
}
/*
EmailGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) EmailGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityEmail`, 0, r.r_alt_types))
}
/*
POBox returns the postal office box value assigned to the receiver instance.
*/
func (r *FirstAuthority) POBox() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_POBox
} else {
val = r.R_POBox_alt
}
}
return
}
/*
SetPOBox assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetPOBox(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityPOBox`,
0, r.r_alt_types), r.SetPOBox, r, args...)
}
/*
POBoxGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) POBoxGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityPOBox`, 0, r.r_alt_types))
}
/*
PostalAddress returns the postal address value assigned to the receiver instance.
*/
func (r *FirstAuthority) PostalAddress() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_PAddr
} else {
val = r.R_PAddr_alt
}
}
return
}
/*
SetPostalAddress assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetPostalAddress(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityPostalAddress`,
0, r.r_alt_types), r.SetPostalAddress, r, args...)
}
/*
PostalAddressGetFunc processes the underlying field value(s) through the
provided [GetOrSetFunc] instance, returning an interface value alongside
an error.
*/
func (r *FirstAuthority) PostalAddressGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityPostalAddress`, 0, r.r_alt_types))
}
/*
PostalCode returns the postal code value assigned to the receiver instance.
*/
func (r *FirstAuthority) PostalCode() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_PCode
} else {
val = r.R_PCode_alt
}
}
return
}
/*
SetPostalCode assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetPostalCode(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityPostalCode`,
0, r.r_alt_types), r.SetPostalCode, r, args...)
}
/*
PostalCodeGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) PostalCodeGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityPostalCode`, 0, r.r_alt_types))
}
/*
Mobile returns the mobile telephone number value assigned to the receiver instance.
*/
func (r *FirstAuthority) Mobile() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_Mobile
} else {
val = r.R_Mobile_alt
}
}
return
}
/*
SetMobile assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetMobile(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityMobile`,
0, r.r_alt_types), r.SetMobile, r, args...)
}
/*
MobileGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) MobileGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityMobile`, 0, r.r_alt_types))
}
/*
Street returns the street value assigned to the receiver instance.
*/
func (r *FirstAuthority) Street() (val string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_Street
} else {
val = r.R_Street_alt
}
}
return
}
/*
SetStreet assigns the provided string value to the receiver instance.
*/
func (r *FirstAuthority) SetStreet(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityStreet`,
0, r.r_alt_types), r.SetStreet, r, args...)
}
/*
StreetGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) StreetGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityStreet`, 0, r.r_alt_types))
}
/*
URI returns slices of string URIs assigned to the receiver instance.
*/
func (r *FirstAuthority) URI() (val []string) {
if !r.IsZero() {
if !r.r_alt_types {
val = r.R_URI
} else {
val = r.R_URI_alt
}
}
return
}
/*
SetURI appends one or more string slice values to the receiver instance.
Note that if a slice is passed as X, the destination value will be clobbered.
*/
func (r *FirstAuthority) SetURI(args ...any) error {
return writeFieldByTag(resolveAltType(`firstAuthorityURI`,
0, r.r_alt_types), r.SetURI, r, args...)
}
/*
URIGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) URIGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc,
resolveAltType(`firstAuthorityURI`, 0, r.r_alt_types))
}
/*
StartTime returns the string-based generalized time value that reflects
the time at which the receiver was (or will be) officiated.
*/
func (r *FirstAuthority) StartTime() (when string) {
if !r.IsZero() {
when = r.R_StartTime
}
return
}
/*
SetStartTime assigns the string input value to the receiver instance.
*/
func (r *FirstAuthority) SetStartTime(args ...any) error {
return writeFieldByTag(`firstAuthorityStartTimestamp`, r.SetStartTime, r, args...)
}
/*
StartTimeGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) StartTimeGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc, `firstAuthorityStartTimestamp`)
}
/*
EndTime returns the string-based generalized time value that reflects the
time at which the receiver was (or will be) terminated.
*/
func (r *FirstAuthority) EndTime() (when string) {
if !r.IsZero() {
when = r.R_EndTime
}
return
}
/*
SetEndTime appends one or more string slice value to the receiver instance.
*/
func (r *FirstAuthority) SetEndTime(args ...any) error {
return writeFieldByTag(`firstAuthorityEndTimestamp`, r.SetEndTime, r, args...)
}
/*
EndTimeGetFunc processes the underlying field value(s) through the provided
[GetOrSetFunc] instance, returning an interface value alongside an error.
*/
func (r *FirstAuthority) EndTimeGetFunc(getfunc GetOrSetFunc) (any, error) {
return getFieldValueByNameTagAndGoSF(r, getfunc, `firstAuthorityEndTimestamp`)
}
/*
Auxiliary returns the static string value "[firstAuthorityContext]" as a
convenient means of determining the AUXILIARY class associated with an
instance of this type.
[firstAuthorityContext]: https://datatracker.ietf.org/doc/html/draft-coretta-oiddir-schema#section-2.5.13
*/
func (r *FirstAuthority) Auxiliary() string {
return `firstAuthorityContext`
}