-
Notifications
You must be signed in to change notification settings - Fork 4
/
structures.go
751 lines (683 loc) · 20.9 KB
/
structures.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
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
package centrify
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
logger "github.com/marcozj/golang-sdk/logging"
vault "github.com/marcozj/golang-sdk/platform"
)
// ResourceIDStringInterface - Generic interface for resource ID
type ResourceIDStringInterface interface {
Id() string
}
// ResourceIDString - Obtain resource ID string
func ResourceIDString(d ResourceIDStringInterface) string {
id := d.Id()
if id == "" {
id = "<new resource>"
}
return fmt.Sprintf("(ID = %s)", id)
}
// flattenTypeListToSlice converts simple schema.TypeList to slices
func flattenTypeListToSlice(i interface{}) []string {
var lstr []string
for _, v := range i.([]interface{}) {
lstr = append(lstr, v.(string))
}
return lstr
}
// convert string slice to interface slice
func flattenStringSlice(list []string) []interface{} {
vs := make([]interface{}, 0, len(list))
for _, v := range list {
vs = append(vs, v)
}
return vs
}
// flattenSchemaSetToString converts ["value1", "value2"] to "value1,value2"
func flattenSchemaSetToString(input *schema.Set) string {
var str string
for i, v := range input.List() {
str = str + v.(string)
// Append "," if it is not the last element
if i < input.Len()-1 {
str = str + ","
}
}
return str
}
// flattenSliceToString converts ["value1", "value2"] to "value1,value2"
func flattenSliceToString(input []string) string {
var str string
for i, v := range input {
str = str + v
// Append "," if it is not the last element
if i < len(input)-1 {
str = str + ","
}
}
return str
}
// flattenSchemaSetToStringSlice used for converting terraform schema set to a string slice
func flattenSchemaSetToStringSlice(s interface{}) []string {
vL := []string{}
for _, v := range s.(*schema.Set).List() {
vL = append(vL, v.(string))
}
return vL
}
// flattenSchemaListToStringSlice used for converting terraform attribute of TypeString embedded in TypeList to a string slice.
// it expected interface{} type as []interface{}, usually get the value from `d.Get` of terraform resource data.
func flattenSchemaListToStringSlice(iface interface{}) []string {
s := []string{}
for _, i := range iface.([]interface{}) {
s = append(s, i.(string))
}
return s
}
// flattenStringSliceToSet converts slice of string to schema Set
func flattenStringSliceToSet(input []string) *schema.Set {
var out = make([]interface{}, len(input))
for i, v := range input {
out[i] = v
}
return schema.NewSet(schema.HashString, out)
}
func expandListToMap(input []interface{}) map[string]interface{} {
options := make(map[string]interface{})
for _, option := range input {
for optKey, optValue := range option.(map[string]interface{}) {
options[optKey] = optValue
}
}
return options
}
func expendSchemaSetToMap(input *schema.Set) map[string]interface{} {
options := make(map[string]interface{})
if input.Len() > 0 {
options = expandListToMap(input.List())
}
return options
}
// Assemble the hash for the system proxy_account
// TypeSet attribute.
func customProxyAccountHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["username"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["managed"]; ok {
buf.WriteString(fmt.Sprintf("%v-", v.(bool)))
}
return hashcode.String(buf.String())
}
func customRoleMemberHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["id"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["name"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["type"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return hashcode.String(buf.String())
}
func customPermissionsHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["principal_id"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["rights"]; ok {
buf.WriteString(fmt.Sprintf("%v-", v.(*schema.Set).GoString()))
}
return hashcode.String(buf.String())
}
func customLoginRuleHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["filter"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["condition"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["value"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return hashcode.String(buf.String())
}
func customCommandParamHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["name"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["type"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["target_object_id"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["value"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return hashcode.String(buf.String())
}
func customAccessKeyHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["access_key_id"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return hashcode.String(buf.String())
}
func customGroupMappingHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["attribute_value"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["group_name"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return hashcode.String(buf.String())
}
func customZoneRoleHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["name"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return hashcode.String(buf.String())
}
func customSamlAttributeHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["name"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["value"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return hashcode.String(buf.String())
}
func customOauthScopeHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
if v, ok := m["name"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["description"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["allowed_rest_apis"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(*schema.Set).GoString()))
}
return hashcode.String(buf.String())
}
// StringSliceToInterface converts []string to []interface{}
func StringSliceToInterface(s []string) []interface{} {
i := make([]interface{}, len(s))
for j, v := range s {
i[j] = v
}
return i
}
func expandRoleMembers(v interface{}) []vault.RoleMember {
members := []vault.RoleMember{}
for _, p := range v.(*schema.Set).List() {
member := vault.RoleMember{}
member.MemberID = p.(map[string]interface{})["id"].(string)
member.MemberName = p.(map[string]interface{})["name"].(string)
member.MemberType = p.(map[string]interface{})["type"].(string)
members = append(members, member)
}
logger.Debugf("Role members: %+v", members)
return members
}
func expandPermissions(v interface{}, valid map[string]string, validate bool) ([]vault.Permission, error) {
m := v.(*schema.Set).List()
var permissions []vault.Permission
if m != nil {
for _, v := range m {
// Validate given list of permissions against a valid map
existing := v.(map[string]interface{})["rights"].(*schema.Set)
var converted []string
for _, r := range existing.List() {
if valid[r.(string)] != "" {
converted = append(converted, valid[r.(string)])
} else {
if validate {
return nil, fmt.Errorf("For %s, %v can only contain %v", v.(map[string]interface{})["principal_name"].(string), existing.List(), valid)
}
}
}
// Convert map to Permission object
permission := vault.Permission{
PrincipalID: v.(map[string]interface{})["principal_id"].(string),
PrincipalName: v.(map[string]interface{})["principal_name"].(string),
PrincipalType: v.(map[string]interface{})["principal_type"].(string),
Rights: flattenSliceToString(converted),
}
permissions = append(permissions, permission)
}
}
return permissions, nil
}
func expandChallengeRules(v []interface{}) *vault.ChallengeRules {
challengerules := &vault.ChallengeRules{}
// Deal with root level
challengerules.Enabled = true
challengerules.Type = "RowSet"
challengerules.UniqueKey = "Condition"
for _, lrv := range v {
// Deal with "_Value" level
challengerule := vault.ChallengeRule{}
challengerule.AuthProfileID = lrv.(map[string]interface{})["authentication_profile_id"].(string)
rules := lrv.(map[string]interface{})["rule"]
for _, rv := range rules.(*schema.Set).List() {
// Deal with "Conditions" level
rule := vault.ChallengeCondition{}
rule.Filter = rv.(map[string]interface{})["filter"].(string)
rule.Condition = rv.(map[string]interface{})["condition"].(string)
rule.Value = rv.(map[string]interface{})["value"].(string)
challengerule.ChallengeCondition = append(challengerule.ChallengeCondition, rule)
}
challengerules.Rules = append(challengerules.Rules, challengerule)
}
return challengerules
}
func expandCommandParams(v interface{}) []vault.DesktopAppParam {
parms := []vault.DesktopAppParam{}
for _, p := range v.(*schema.Set).List() {
parm := vault.DesktopAppParam{}
parm.ParamName = p.(map[string]interface{})["name"].(string)
parm.ParamType = p.(map[string]interface{})["type"].(string)
parm.TargetObjectID = p.(map[string]interface{})["target_object_id"].(string)
parms = append(parms, parm)
}
logger.Debugf("Command params: %+v", parms)
return parms
}
func getPermissionSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Description: "Object permissions",
Set: customPermissionsHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"principal_id": {
Type: schema.TypeString,
Required: true,
Description: "Uuid of the principal",
},
"principal_name": {
Type: schema.TypeString,
Required: true,
Description: "User name or role name",
},
"principal_type": {
Type: schema.TypeString,
Required: true,
Description: "Principal type: User, Role or Group",
ValidateFunc: validation.StringInSlice([]string{
"User",
"Role",
"Group",
}, false),
},
"rights": {
Type: schema.TypeSet,
Required: true,
Set: schema.HashString,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Description: "Permissions: Grant,View,Edit,Delete",
},
},
},
}
}
func getChallengeRulesSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Optional: true,
Description: "Authentication rules",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"authentication_profile_id": {
Type: schema.TypeString,
Optional: true,
Description: "Authentication Profile (if all conditions met)",
},
"rule": {
Type: schema.TypeSet,
Optional: true,
Set: customLoginRuleHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"filter": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"IpAddress",
"IdentityCookie",
"DayOfWeek",
"Date",
"DateRange",
"Time",
"DeviceOs",
"Browser",
"CountryCode",
"Zso",
}, false),
},
"condition": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"OpInCorpIpRange", // IpAddress
"OpNotInCorpIpRange", // IpAddress
"OpExists", // IdentityCookie
"OpNotExists", // IdentityCookie
"OpIsDayOfWeek", // DayOfWeek
"OpLessThan", // Date
"OpGreaterThan", // Date
"OpBetween", // DateRange, Time
"OpEqual", // DeviceOs, Browser, CountryCode
"OpNotEqual", // DeviceOs, Browser, CountryCode
"OpIs", // Zso
"OpIsNot", // Zso
"OpHeader", // Header
"OpArgument", // Argument
}, false),
},
"value": {
Type: schema.TypeString,
Optional: true,
/*
DayOfWeek: "L,0,1,2,3,4,5,6" or "U,1,2"
Date: "L,08/27/2020" or "U,08/29/2020"
DateRange: "L,08/26/2020,08/29/2020" or "U,08/26/2020,08/29/2020"
Time: "L,00:16,15:56" or "U,00:16,15:56"
DeviceOs: iOS, Android, WindowsMobile, Mac, Windows, Linux
Browser: Other, Chrome, Firefox, IE, Safari, MicrosoftEdge
*/
},
},
},
},
},
},
}
}
func getAccessKeySchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Description: "AWS Access Key",
Set: customAccessKeyHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "AWS access key id",
},
"access_key_id": {
Type: schema.TypeString,
Required: true,
Description: "AWS access key id",
},
"secret_access_key": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
Description: "AWS secret access key",
},
},
},
}
}
func expandAccessKeys(v interface{}) []vault.AccessKey {
accesskeys := []vault.AccessKey{}
for _, p := range v.(*schema.Set).List() {
accesskey := vault.AccessKey{}
accesskey.AccessKeyID = p.(map[string]interface{})["access_key_id"].(string)
accesskey.SecretAccessKey = p.(map[string]interface{})["secret_access_key"].(string)
accesskeys = append(accesskeys, accesskey)
}
return accesskeys
}
func getZoneRoleSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Description: "Zone Role",
Set: customZoneRoleHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: "Zone role name. In the format of <zone role name>/<zone name>",
},
"zone_description": {
Type: schema.TypeString,
Optional: true,
Description: "Description of the zone",
},
"zone_dn": {
Type: schema.TypeString,
Optional: true,
Description: "Distinguished Name (DN) of the zone",
},
"description": {
Type: schema.TypeString,
Optional: true,
Description: "Description of the zone role",
},
"zone_canonical_name": {
Type: schema.TypeString,
Optional: true,
Description: "Cannoical name of the zone",
},
"parent_zone_dn": {
Type: schema.TypeString,
Optional: true,
Description: "DN of the parent zone",
},
"unix": {
Type: schema.TypeBool,
Optional: true,
Description: "The zone role is for Unix",
},
"windows": {
Type: schema.TypeBool,
Optional: true,
Description: "The zone role is for Windows",
},
},
},
}
}
func getWorkflowApproversSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Optional: true,
Description: "Workflow approvers",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"guid": {
Type: schema.TypeString,
Optional: true,
Description: "ID of the principal",
},
"name": {
Type: schema.TypeString,
Optional: true,
Description: "User or role name of the approver",
},
"type": {
Type: schema.TypeString,
Optional: true,
Description: "Type of principal",
ValidateFunc: validation.StringInSlice([]string{"User", "Role", "Manager"}, false),
},
"no_manager_action": {
Type: schema.TypeString,
Optional: true,
Description: "Type of principal",
ValidateFunc: validation.StringInSlice([]string{"approve", "deny", "useBackup"}, false),
},
"backup_approver": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"guid": {
Type: schema.TypeString,
Optional: true,
Description: "ID of the principal",
},
"name": {
Type: schema.TypeString,
Optional: true,
Description: "User or role name of the approver",
},
"type": {
Type: schema.TypeString,
Optional: true,
Description: "Type of principal",
ValidateFunc: validation.StringInSlice([]string{"User", "Role"}, false),
},
},
},
},
"options_selector": {
Type: schema.TypeBool,
Optional: true,
},
},
},
}
}
func expandZoneRoles(v interface{}) []vault.ZoneRole {
m := v.(*schema.Set).List()
var zoneroles []vault.ZoneRole
for _, lrv := range m {
zonerole := vault.ZoneRole{}
zonerole.Name = lrv.(map[string]interface{})["name"].(string)
zonerole.ZoneDescription = lrv.(map[string]interface{})["zone_description"].(string)
zonerole.ZoneDn = lrv.(map[string]interface{})["zone_dn"].(string)
zonerole.Description = lrv.(map[string]interface{})["description"].(string)
zonerole.ZoneCanonicalName = lrv.(map[string]interface{})["zone_canonical_name"].(string)
zonerole.ParentZoneDn = lrv.(map[string]interface{})["parent_zone_dn"].(string)
zonerole.Unix = lrv.(map[string]interface{})["unix"].(bool)
zonerole.Windows = lrv.(map[string]interface{})["windows"].(bool)
zoneroles = append(zoneroles, zonerole)
}
return zoneroles
}
func expandWorkflowApprovers(v []interface{}) []vault.WorkflowApprover {
var approvers []vault.WorkflowApprover
for _, lrv := range v {
approver := vault.WorkflowApprover{}
approver.Guid = lrv.(map[string]interface{})["guid"].(string)
approver.Name = lrv.(map[string]interface{})["name"].(string)
approver.Type = lrv.(map[string]interface{})["type"].(string)
approver.NoManagerAction = lrv.(map[string]interface{})["no_manager_action"].(string)
something := lrv.(map[string]interface{})["backup_approver"].([]interface{})
if len(something) > 0 && something[0] != nil {
d := something[0].(map[string]interface{})
approver.BackupApprover = &vault.BackupApprover{
Guid: d["guid"].(string),
Name: d["name"].(string),
Type: d["type"].(string),
}
}
approver.OptionsSelector = lrv.(map[string]interface{})["options_selector"].(bool)
approvers = append(approvers, approver)
}
return approvers
}
func getWorkflowDefaultOptionsSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"grant_minute": {
Type: schema.TypeInt,
Optional: true,
},
},
},
}
}
func expandWorkflowDefaultOptions(v interface{}) *vault.WorkflowDefaultOptions {
options := v.([]interface{})
if len(options) > 0 && options[0] != nil {
d := options[0].(map[string]interface{})
data := &vault.WorkflowDefaultOptions{
GrantMin: d["grant_minute"].(int),
}
return data
}
return nil
}
func convertWorkflowSchema(v string) (interface{}, error) {
str := strings.Replace(v, "\\", "", -1)
var wfapprovers vault.ProxyWorkflowApprover
err := json.Unmarshal([]byte(str), &wfapprovers)
if err != nil {
logger.ErrorTracef(err.Error())
return nil, fmt.Errorf("failed to unmarshal ProxyWorkflowApprover: %v", err)
}
approvers, err := vault.GenerateSchemaMap(wfapprovers)
if err != nil {
return nil, err
}
return processBackupApproverSchema(approvers["proxy_approver"]), nil
}
// processBackupApproverSchema converts "backup_approver" from map to list of map so that it conforms to schema
func processBackupApproverSchema(v interface{}) []interface{} {
approvers := v.([]interface{})
for i, v := range approvers {
backupapprover := v.(map[string]interface{})["backup_approver"]
if backupapprover != nil {
// backup_approver is schema.TypeList but BackupApprover struct is not, so convert it
v.(map[string]interface{})["backup_approver"] = []interface{}{backupapprover}
approvers[i] = v
}
}
return approvers
}
func convertZoneRoleSchema(v string) (interface{}, error) {
str := strings.Replace(v, "\\", "", -1)
var zoneroles vault.ProxyZoneRole
err := json.Unmarshal([]byte(str), &zoneroles)
if err != nil {
logger.ErrorTracef(err.Error())
return nil, fmt.Errorf("failed to unmarshal ProxyZoneRole: %v", err)
}
zroles, err := vault.GenerateSchemaMap(zoneroles)
if err != nil {
return nil, err
}
return processBackupApproverSchema(zroles["proxy_zonerole"]), nil
}