This repository has been archived by the owner on Sep 24, 2020. It is now read-only.
forked from CiscoDevNet/terraform-provider-aci
-
Notifications
You must be signed in to change notification settings - Fork 6
/
data_source_aci_configexportp.go
85 lines (65 loc) · 1.65 KB
/
data_source_aci_configexportp.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
package aci
import (
"fmt"
"github.com/ciscoecosystem/aci-go-client/client"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
func dataSourceAciConfigurationExportPolicy() *schema.Resource {
return &schema.Resource{
Read: dataSourceAciConfigurationExportPolicyRead,
SchemaVersion: 1,
Schema: AppendBaseAttrSchema(map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Required: true,
},
"admin_st": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"format": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"include_secure_fields": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"max_snapshot_count": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"name_alias": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"snapshot": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"target_dn": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
}),
}
}
func dataSourceAciConfigurationExportPolicyRead(d *schema.ResourceData, m interface{}) error {
aciClient := m.(*client.Client)
name := d.Get("name").(string)
rn := fmt.Sprintf("fabric/configexp-%s", name)
dn := fmt.Sprintf("uni/%s", rn)
configExportP, err := getRemoteConfigurationExportPolicy(aciClient, dn)
if err != nil {
return err
}
setConfigurationExportPolicyAttributes(configExportP, d)
return nil
}