-
Notifications
You must be signed in to change notification settings - Fork 14
/
data_source_zpa_access_policy_platform.go
57 lines (49 loc) · 1.18 KB
/
data_source_zpa_access_policy_platform.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
package zpa
import (
"log"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func dataSourceAccessPolicyPlatforms() *schema.Resource {
return &schema.Resource{
Read: dataSourceAccessPolicyPlatformsRead,
Importer: &schema.ResourceImporter{},
Schema: map[string]*schema.Schema{
"linux": {
Type: schema.TypeString,
Computed: true,
},
"android": {
Type: schema.TypeString,
Computed: true,
},
"windows": {
Type: schema.TypeString,
Computed: true,
},
"ios": {
Type: schema.TypeString,
Computed: true,
},
"mac": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
func dataSourceAccessPolicyPlatformsRead(d *schema.ResourceData, m interface{}) error {
zClient := m.(*Client)
log.Printf("[INFO] Getting data for all platforms set\n")
resp, _, err := zClient.platforms.GetAllPlatforms()
if err != nil {
return err
}
log.Printf("[INFO] Getting data for all platforms:\n%+v\n", resp)
d.SetId("platforms")
_ = d.Set("linux", resp.Linux)
_ = d.Set("android", resp.Android)
_ = d.Set("windows", resp.Windows)
_ = d.Set("ios", resp.IOS)
_ = d.Set("mac", resp.MacOS)
return nil
}