-
Notifications
You must be signed in to change notification settings - Fork 0
/
dlp_idm_profiles.go
108 lines (80 loc) · 4.17 KB
/
dlp_idm_profiles.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
package dlp_idm_profiles
import (
"fmt"
"strings"
"github.com/SecurityGeekIO/zscaler-sdk-go/zia/services/common"
)
const (
dlpIDMProfileEndpoint = "/idmprofile"
)
type DLPIDMProfile struct {
// The identifier (1-64) for the IDM template (i.e., IDM profile) that is unique within the organization.
ProfileID int `json:"profileId,omitempty"`
// The IDM template name, which is unique per Index Tool.
ProfileName string `json:"profileName,omitempty"`
// The IDM template's description.
ProfileDesc string `json:"profileDesc,omitempty"`
// The IDM template's type.
ProfileType string `json:"profileType,omitempty"`
// The fully qualified domain name (FQDN) of the IDM template's host machine.
Host string `json:"host,omitempty"`
// The port number of the IDM template's host machine.
Port int `json:"port,omitempty"`
// The IDM template's directory file path, where all files are present.
ProfileDirPath string `json:"profileDirPath,omitempty"`
// The schedule type for the IDM template's schedule (i.e., Monthly, Weekly, Daily, or None). This attribute is required by PUT and POST requests.
ScheduleType string `json:"scheduleType,omitempty"`
// The day the IDM template is scheduled for. This attribute is required by PUT and POST requests.
ScheduleDay int `json:"scheduleDay,omitempty"`
// The day of the month that the IDM template is scheduled for. This attribute is required by PUT and POST requests, and when scheduleType is set to MONTHLY.
ScheduleDayOfMonth []string `json:"scheduleDayOfMonth,omitempty"`
// The day of the week the IDM template is scheduled for. This attribute is required by PUT and POST requests, and when scheduleType is set to WEEKLY.
ScheduleDayOfWeek []string `json:"scheduleDayOfWeek,omitempty"`
// The time of the day (in minutes) that the IDM template is scheduled for. For example: at 3am= 180 mins. This attribute is required by PUT and POST requests.
ScheduleTime int `json:"scheduleTime,omitempty"`
// If set to true, the schedule for the IDM template is temporarily in a disabled state. This attribute is required by PUT requests in order to disable or enable a schedule.
ScheduleDisabled bool `json:"scheduleDisabled,omitempty"`
// The status of the file uploaded to the Index Tool for the IDM template.
UploadStatus string `json:"uploadStatus"`
// The username to be used on the IDM template's host machine.
UserName string `json:"userName,omitempty"`
// The version number for the IDM template.
Version int `json:"version,omitempty"`
// The unique identifer for the Index Tool that was used to create the IDM template. This attribute is required by POST requests, but ignored if provided in PUT requests.
IDMClient *common.IDNameExtensions `json:"idmClient,omitempty"`
// The total volume of all the documents associated to the IDM template.
VolumeOfDocuments int `json:"volumeOfDocuments,omitempty"`
// The number of documents associated to the IDM template.
NumDocuments int `json:"numDocuments,omitempty"`
// The date and time the IDM template was last modified.
LastModifiedTime int `json:"lastModifiedTime,omitempty"`
// The admin that modified the IDM template last.
ModifiedBy *common.IDNameExtensions `json:"modifiedBy,omitempty"`
}
func (service *Service) Get(idmProfileID int) (*DLPIDMProfile, error) {
var idmpProfile DLPIDMProfile
err := service.Client.Read(fmt.Sprintf("%s/%d", dlpIDMProfileEndpoint, idmProfileID), &idmpProfile)
if err != nil {
return nil, err
}
service.Client.Logger.Printf("[DEBUG]Returning dlp icap server from Get: %d", idmpProfile.ProfileID)
return &idmpProfile, nil
}
func (service *Service) GetByName(idmProfileName string) (*DLPIDMProfile, error) {
var idmpProfile []DLPIDMProfile
err := common.ReadAllPages(service.Client, dlpIDMProfileEndpoint, &idmpProfile)
if err != nil {
return nil, err
}
for _, icap := range idmpProfile {
if strings.EqualFold(icap.ProfileName, idmProfileName) {
return &icap, nil
}
}
return nil, fmt.Errorf("no dlp icap server found with name: %s", idmProfileName)
}
func (service *Service) GetAll() ([]DLPIDMProfile, error) {
var idmpProfile []DLPIDMProfile
err := common.ReadAllPages(service.Client, dlpIDMProfileEndpoint, &idmpProfile)
return idmpProfile, err
}