refactor(analyzer): ScanDuration field in analysis
Add omitempty struct tag, rename the field to ScanDuration for consistency and make it uint instead of int.main
parent
56d57afb57
commit
981a2aa84f
|
@ -8,7 +8,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/r3labs/diff/v2"
|
||||
|
||||
"github.com/snyk/driftctl/pkg/alerter"
|
||||
"github.com/snyk/driftctl/pkg/resource"
|
||||
)
|
||||
|
@ -64,7 +63,7 @@ type serializableAnalysis struct {
|
|||
Alerts map[string][]alerter.SerializableAlert `json:"alerts"`
|
||||
ProviderName string `json:"provider_name"`
|
||||
ProviderVersion string `json:"provider_version"`
|
||||
Duration int `json:"scan_duration"`
|
||||
ScanDuration uint `json:"scan_duration,omitempty"`
|
||||
}
|
||||
|
||||
type GenDriftIgnoreOptions struct {
|
||||
|
@ -108,7 +107,7 @@ func (a Analysis) MarshalJSON() ([]byte, error) {
|
|||
bla.Coverage = a.Coverage()
|
||||
bla.ProviderName = a.ProviderName
|
||||
bla.ProviderVersion = a.ProviderVersion
|
||||
bla.Duration = int(a.Duration.Seconds())
|
||||
bla.ScanDuration = uint(a.Duration.Seconds())
|
||||
|
||||
return json.Marshal(bla)
|
||||
}
|
||||
|
@ -170,7 +169,7 @@ func (a *Analysis) UnmarshalJSON(bytes []byte) error {
|
|||
a.ProviderName = bla.ProviderName
|
||||
a.ProviderVersion = bla.ProviderVersion
|
||||
a.SetIaCSourceCount(bla.Summary.TotalIaCSourceCount)
|
||||
a.Duration = time.Duration(bla.Duration) * time.Second
|
||||
a.Duration = time.Duration(bla.ScanDuration) * time.Second
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,5 @@
|
|||
]
|
||||
},
|
||||
"provider_name": "AWS",
|
||||
"provider_version": "3.19.0",
|
||||
"scan_duration": 0
|
||||
"provider_version": "3.19.0"
|
||||
}
|
|
@ -23,6 +23,5 @@
|
|||
]
|
||||
},
|
||||
"provider_name": "AWS",
|
||||
"provider_version": "3.19.0",
|
||||
"scan_duration": 0
|
||||
"provider_version": "3.19.0"
|
||||
}
|
|
@ -91,6 +91,5 @@
|
|||
]
|
||||
},
|
||||
"provider_name": "AWS",
|
||||
"provider_version": "3.19.0",
|
||||
"scan_duration": 0
|
||||
"provider_version": "3.19.0"
|
||||
}
|
|
@ -14,6 +14,5 @@
|
|||
"coverage": 0,
|
||||
"alerts": null,
|
||||
"provider_name": "",
|
||||
"provider_version": "",
|
||||
"scan_duration": 0
|
||||
"provider_version": ""
|
||||
}
|
Loading…
Reference in New Issue