-
Notifications
You must be signed in to change notification settings - Fork 16
/
config.go
139 lines (127 loc) · 6.81 KB
/
config.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
package zpa
import (
"log"
gozscaler "github.com/zscaler/zscaler-sdk-go/zpa"
"github.com/zscaler/zscaler-sdk-go/zpa/services/appconnectorcontroller"
"github.com/zscaler/zscaler-sdk-go/zpa/services/appconnectorgroup"
"github.com/zscaler/zscaler-sdk-go/zpa/services/applicationsegment"
"github.com/zscaler/zscaler-sdk-go/zpa/services/applicationsegmentinspection"
"github.com/zscaler/zscaler-sdk-go/zpa/services/applicationsegmentpra"
"github.com/zscaler/zscaler-sdk-go/zpa/services/appservercontroller"
"github.com/zscaler/zscaler-sdk-go/zpa/services/bacertificate"
"github.com/zscaler/zscaler-sdk-go/zpa/services/browseraccess"
"github.com/zscaler/zscaler-sdk-go/zpa/services/clienttypes"
"github.com/zscaler/zscaler-sdk-go/zpa/services/cloudconnectorgroup"
"github.com/zscaler/zscaler-sdk-go/zpa/services/customerversionprofile"
"github.com/zscaler/zscaler-sdk-go/zpa/services/enrollmentcert"
"github.com/zscaler/zscaler-sdk-go/zpa/services/idpcontroller"
"github.com/zscaler/zscaler-sdk-go/zpa/services/inspectioncontrol/inspection_custom_controls"
"github.com/zscaler/zscaler-sdk-go/zpa/services/inspectioncontrol/inspection_predefined_controls"
"github.com/zscaler/zscaler-sdk-go/zpa/services/inspectioncontrol/inspection_profile"
"github.com/zscaler/zscaler-sdk-go/zpa/services/isolationprofile"
"github.com/zscaler/zscaler-sdk-go/zpa/services/lssconfigcontroller"
"github.com/zscaler/zscaler-sdk-go/zpa/services/machinegroup"
"github.com/zscaler/zscaler-sdk-go/zpa/services/platforms"
"github.com/zscaler/zscaler-sdk-go/zpa/services/policysetcontroller"
"github.com/zscaler/zscaler-sdk-go/zpa/services/postureprofile"
"github.com/zscaler/zscaler-sdk-go/zpa/services/provisioningkey"
"github.com/zscaler/zscaler-sdk-go/zpa/services/samlattribute"
"github.com/zscaler/zscaler-sdk-go/zpa/services/scimattributeheader"
"github.com/zscaler/zscaler-sdk-go/zpa/services/scimgroup"
"github.com/zscaler/zscaler-sdk-go/zpa/services/segmentgroup"
"github.com/zscaler/zscaler-sdk-go/zpa/services/servergroup"
"github.com/zscaler/zscaler-sdk-go/zpa/services/serviceedgecontroller"
"github.com/zscaler/zscaler-sdk-go/zpa/services/serviceedgegroup"
"github.com/zscaler/zscaler-sdk-go/zpa/services/trustednetwork"
)
func init() {
// remove timestamp from Zscaler provider logger, use the timestamp from the default terraform logger
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
}
type Client struct {
appconnectorgroup appconnectorgroup.Service
appconnectorcontroller appconnectorcontroller.Service
applicationsegment applicationsegment.Service
applicationsegmentpra applicationsegmentpra.Service
applicationsegmentinspection applicationsegmentinspection.Service
appservercontroller appservercontroller.Service
bacertificate bacertificate.Service
cloudconnectorgroup cloudconnectorgroup.Service
customerversionprofile customerversionprofile.Service
enrollmentcert enrollmentcert.Service
idpcontroller idpcontroller.Service
lssconfigcontroller lssconfigcontroller.Service
machinegroup machinegroup.Service
postureprofile postureprofile.Service
isolationprofile isolationprofile.Service
policysetcontroller policysetcontroller.Service
provisioningkey provisioningkey.Service
samlattribute samlattribute.Service
scimgroup scimgroup.Service
scimattributeheader scimattributeheader.Service
segmentgroup segmentgroup.Service
servergroup servergroup.Service
serviceedgegroup serviceedgegroup.Service
serviceedgecontroller serviceedgecontroller.Service
trustednetwork trustednetwork.Service
platforms platforms.Service
clienttypes clienttypes.Service
browseraccess browseraccess.Service
inspection_custom_controls inspection_custom_controls.Service
inspection_predefined_controls inspection_predefined_controls.Service
inspection_profile inspection_profile.Service
}
type Config struct {
// ZPA Client ID for API Client
ClientID string
// ZPA Client Secret for API Client
ClientSecret string
// ZPA Customer ID for API Client
CustomerID string
// ZPA Base URL for API Client
BaseURL string
// UserAgent for API Client
UserAgent string
}
func (c *Config) Client() (*Client, error) {
config, err := gozscaler.NewConfig(c.ClientID, c.ClientSecret, c.CustomerID, c.BaseURL, c.UserAgent)
if err != nil {
return nil, err
}
zpaClient := gozscaler.NewClient(config)
client := &Client{
appconnectorgroup: *appconnectorgroup.New(zpaClient),
appconnectorcontroller: *appconnectorcontroller.New(zpaClient),
applicationsegment: *applicationsegment.New(zpaClient),
applicationsegmentpra: *applicationsegmentpra.New(zpaClient),
applicationsegmentinspection: *applicationsegmentinspection.New(zpaClient),
appservercontroller: *appservercontroller.New(zpaClient),
bacertificate: *bacertificate.New(zpaClient),
cloudconnectorgroup: *cloudconnectorgroup.New(zpaClient),
customerversionprofile: *customerversionprofile.New(zpaClient),
enrollmentcert: *enrollmentcert.New(zpaClient),
idpcontroller: *idpcontroller.New(zpaClient),
lssconfigcontroller: *lssconfigcontroller.New(zpaClient),
machinegroup: *machinegroup.New(zpaClient),
postureprofile: *postureprofile.New(zpaClient),
isolationprofile: *isolationprofile.New(zpaClient),
policysetcontroller: *policysetcontroller.New(zpaClient),
provisioningkey: *provisioningkey.New(zpaClient),
samlattribute: *samlattribute.New(zpaClient),
scimgroup: *scimgroup.New(zpaClient),
scimattributeheader: *scimattributeheader.New(zpaClient),
segmentgroup: *segmentgroup.New(zpaClient),
servergroup: *servergroup.New(zpaClient),
serviceedgegroup: *serviceedgegroup.New(zpaClient),
serviceedgecontroller: *serviceedgecontroller.New(zpaClient),
trustednetwork: *trustednetwork.New(zpaClient),
platforms: *platforms.New(zpaClient),
clienttypes: *clienttypes.New(zpaClient),
browseraccess: *browseraccess.New(zpaClient),
inspection_custom_controls: *inspection_custom_controls.New(zpaClient),
inspection_predefined_controls: *inspection_predefined_controls.New(zpaClient),
inspection_profile: *inspection_profile.New(zpaClient),
}
log.Println("[INFO] initialized ZPA client")
return client, nil
}