forked from CiscoISE/ciscoise-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clear_threats_and_vulnerabilities.go
96 lines (70 loc) · 3.26 KB
/
clear_threats_and_vulnerabilities.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
package isegosdk
import (
"fmt"
"github.com/go-resty/resty/v2"
)
type ClearThreatsAndVulnerabilitiesService service
type ResponseClearThreatsAndVulnerabilitiesGetVersion struct {
VersionInfo *ResponseClearThreatsAndVulnerabilitiesGetVersionVersionInfo `json:"VersionInfo,omitempty"` //
}
type ResponseClearThreatsAndVulnerabilitiesGetVersionVersionInfo struct {
CurrentServerVersion string `json:"currentServerVersion,omitempty"` //
SupportedVersions string `json:"supportedVersions,omitempty"` //
Link *ResponseClearThreatsAndVulnerabilitiesGetVersionVersionInfoLink `json:"link,omitempty"` //
}
type ResponseClearThreatsAndVulnerabilitiesGetVersionVersionInfoLink struct {
Rel string `json:"rel,omitempty"` //
Href string `json:"href,omitempty"` //
Type string `json:"type,omitempty"` //
}
type RequestClearThreatsAndVulnerabilitiesClearThreatsAndVulnerabilities struct {
ERSIrfThreatContext *RequestClearThreatsAndVulnerabilitiesClearThreatsAndVulnerabilitiesERSIrfThreatContext `json:"ERSIrfThreatContext,omitempty"` //
}
type RequestClearThreatsAndVulnerabilitiesClearThreatsAndVulnerabilitiesERSIrfThreatContext struct {
MacAddresses string `json:"macAddresses,omitempty"` //
}
//GetVersion Get clear threats and vulneribilities version information
/* This API helps to retrieve the version information related to the clear threats and vulneribilities.
*/
func (s *ClearThreatsAndVulnerabilitiesService) GetVersion() (*ResponseClearThreatsAndVulnerabilitiesGetVersion, *resty.Response, error) {
setHost(s.client, "_ers")
path := "/ers/config/threat/versioninfo"
setCSRFToken(s.client)
response, err := s.client.R().
SetHeader("Content-Type", "application/json").
SetHeader("Accept", "application/json").
SetResult(&ResponseClearThreatsAndVulnerabilitiesGetVersion{}).
SetError(&Error).
Get(path)
if err != nil {
return nil, nil, err
}
if response.IsError() {
return nil, response, fmt.Errorf("error with operation GetVersion")
}
getCSFRToken(response.Header())
result := response.Result().(*ResponseClearThreatsAndVulnerabilitiesGetVersion)
return result, response, err
}
//ClearThreatsAndVulnerabilities Delete ThreatContext and Threat events that are associated with given MacAddress
/* This API allows the client to delete the ThreatContext and Threat events that are associated with the given MAC Address.
*/
func (s *ClearThreatsAndVulnerabilitiesService) ClearThreatsAndVulnerabilities(requestClearThreatsAndVulnerabilitiesClearThreatsAndVulnerabilities *RequestClearThreatsAndVulnerabilitiesClearThreatsAndVulnerabilities) (*resty.Response, error) {
setHost(s.client, "_ers")
path := "/ers/config/threat/clearThreatsAndVulneribilities"
setCSRFToken(s.client)
response, err := s.client.R().
SetHeader("Content-Type", "application/json").
SetHeader("Accept", "application/json").
SetBody(requestClearThreatsAndVulnerabilitiesClearThreatsAndVulnerabilities).
SetError(&Error).
Put(path)
if err != nil {
return nil, err
}
if response.IsError() {
return response, fmt.Errorf("error with operation ClearThreatsAndVulnerabilities")
}
getCSFRToken(response.Header())
return response, err
}