-
Notifications
You must be signed in to change notification settings - Fork 11
/
security_scans.go
74 lines (67 loc) · 2.17 KB
/
security_scans.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
package morpheus
import (
"fmt"
"time"
)
var (
// SecurityScansPath is the API endpoint for securityScans
SecurityScansPath = "/api/security-scans"
)
// SecurityScan structures for use in request and response payloads
type SecurityScan struct {
ID int64 `json:"id"`
SecurityPackage struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Type struct {
ID int64 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
} `json:"type"`
} `json:"securityPackage"`
Server struct {
ID int64 `json:"id"`
Name string `json:"name"`
} `json:"server"`
Status string `json:"status"`
ScanDate time.Time `json:"scanDate"`
ScanDuration int64 `json:"scanDuration"`
TestCount int64 `json:"testCount"`
RunCount int64 `json:"runCount"`
PassCount int64 `json:"passCount"`
FailCount int64 `json:"failCount"`
OtherCount int64 `json:"otherCount"`
ScanScore int64 `json:"scanScore"`
ExternalId interface{} `json:"externalId"`
CreatedBy string `json:"createdBy"`
UpdatedBy string `json:"updatedBy"`
DateCreated time.Time `json:"dateCreated"`
LastUpdated time.Time `json:"lastUpdated"`
}
// ListSecurityScansResult structure parses the list securityScans response payload
type ListSecurityScansResult struct {
SecurityScans *[]SecurityScan `json:"securityScans"`
Meta *MetaResult `json:"meta"`
}
type GetSecurityScanResult struct {
SecurityScan *SecurityScan `json:"securityScan"`
}
// ListSecurityScans lists all security scans
func (client *Client) ListSecurityScans(req *Request) (*Response, error) {
return client.Execute(&Request{
Method: "GET",
Path: SecurityScansPath,
QueryParams: req.QueryParams,
Result: &ListSecurityScansResult{},
})
}
// GetSecurityScan gets a security scan
func (client *Client) GetSecurityScan(id int64, req *Request) (*Response, error) {
return client.Execute(&Request{
Method: "GET",
Path: fmt.Sprintf("%s/%d", SecurityScansPath, id),
QueryParams: req.QueryParams,
Result: &GetSecurityScanResult{},
})
}