Просмотр исходного кода

Merge pull request #1415 from opencost/bolt/get-window

Add GetWindow() to AssetSet and AllocationSet
Matt Bolt 3 лет назад
Родитель
Сommit
5a9d1f5583
2 измененных файлов с 9 добавлено и 0 удалено
  1. 5 0
      pkg/kubecost/allocation.go
  2. 4 0
      pkg/kubecost/asset.go

+ 5 - 0
pkg/kubecost/allocation.go

@@ -1840,6 +1840,11 @@ func (as *AllocationSet) Resolution() time.Duration {
 	return as.Window.Duration()
 }
 
+// GetWindow returns the AllocationSet's window
+func (as *AllocationSet) GetWindow() Window {
+	return as.Window
+}
+
 // Set uses the given Allocation to overwrite the existing entry in the
 // AllocationSet under the Allocation's name.
 func (as *AllocationSet) Set(alloc *Allocation) error {

+ 4 - 0
pkg/kubecost/asset.go

@@ -2951,6 +2951,10 @@ func (as *AssetSet) Length() int {
 	return len(as.Assets)
 }
 
+func (as *AssetSet) GetWindow() Window {
+	return as.Window
+}
+
 // Resolution returns the AssetSet's window duration
 func (as *AssetSet) Resolution() time.Duration {
 	return as.Window.Duration()