@@ -11,17 +11,37 @@ import (
11
11
12
12
type PolicyViolation struct {
13
13
UUID uuid.UUID
14
- Component Component `json:"component"`
15
- Project Project `json:"project"`
16
- PolicyCondition * PolicyCondition `json:"policyCondition,omitempty"`
17
- Type string `json:"type"`
18
- Text string `json:"text"`
14
+ Component Component `json:"component"`
15
+ Project Project `json:"project"`
16
+ PolicyCondition * PolicyCondition `json:"policyCondition,omitempty"`
17
+ Type string `json:"type"`
18
+ Text string `json:"text"`
19
+ Analysis * ViolationAnalysis `json:"analysis,omitempty"`
19
20
}
20
21
21
22
type PolicyViolationService struct {
22
23
client * Client
23
24
}
24
25
26
+ func (pvs PolicyViolationService ) GetAll (ctx context.Context , suppressed bool , po PageOptions ) (p Page [PolicyViolation ], err error ) {
27
+ params := map [string ]string {
28
+ "suppressed" : strconv .FormatBool (suppressed ),
29
+ }
30
+
31
+ req , err := pvs .client .newRequest (ctx , http .MethodGet , "/api/v1/violation" , withParams (params ), withPageOptions (po ))
32
+ if err != nil {
33
+ return
34
+ }
35
+
36
+ res , err := pvs .client .doRequest (req , & p .Items )
37
+ if err != nil {
38
+ return
39
+ }
40
+
41
+ p .TotalCount = res .TotalCount
42
+ return
43
+ }
44
+
25
45
func (pvs PolicyViolationService ) GetAllForProject (ctx context.Context , projectUUID uuid.UUID , suppressed bool , po PageOptions ) (p Page [PolicyViolation ], err error ) {
26
46
params := map [string ]string {
27
47
"suppressed" : strconv .FormatBool (suppressed ),
0 commit comments