Przeglądaj źródła

Add ResetAdjustments method

Sean Holcomb 5 lat temu
rodzic
commit
2292b106da
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10 0
      pkg/kubecost/allocation.go

+ 10 - 0
pkg/kubecost/allocation.go

@@ -470,6 +470,16 @@ func (a *Allocation) PVBytes() float64 {
 	return a.PVByteHours() / (a.Minutes() / 60.0)
 }
 
+// ResetAdjustments sets all cost adjustment fields to zero
+func (a *Allocation) ResetAdjustments() {
+	a.CPUCostAdjustment = 0.0
+	a.GPUCostAdjustment = 0.0
+	a.RAMCostAdjustment = 0.0
+	a.PVCostAdjustment = 0.0
+	a.NetworkCostAdjustment = 0.0
+	a.LoadBalancerCostAdjustment = 0.0
+}
+
 // MarshalJSON implements json.Marshaler interface
 func (a *Allocation) MarshalJSON() ([]byte, error) {
 	buffer := bytes.NewBufferString("{")