From b6337a48a957e054a871f2bb28851c06382d8ef4 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 10 Mar 2023 14:32:00 -0500 Subject: [PATCH] incorporate a separate 'warning' and 'limit' threshold (#235) --- controller/limits/model.go | 52 ++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/controller/limits/model.go b/controller/limits/model.go index 7622005e..9f14c2a9 100644 --- a/controller/limits/model.go +++ b/controller/limits/model.go @@ -17,10 +17,15 @@ type BandwidthConfig struct { } type BandwidthPerPeriod struct { - Period time.Duration - Rx int64 - Tx int64 - Total int64 + Period time.Duration + Warning *Bandwidth + Limit *Bandwidth +} + +type Bandwidth struct { + Rx int64 + Tx int64 + Total int64 } func DefaultConfig() *Config { @@ -30,21 +35,42 @@ func DefaultConfig() *Config { Bandwidth: &BandwidthConfig{ PerAccount: &BandwidthPerPeriod{ Period: 365 * (24 * time.Hour), - Rx: Unlimited, - Tx: Unlimited, - Total: Unlimited, + Warning: &Bandwidth{ + Rx: Unlimited, + Tx: Unlimited, + Total: Unlimited, + }, + Limit: &Bandwidth{ + Rx: Unlimited, + Tx: Unlimited, + Total: Unlimited, + }, }, PerEnvironment: &BandwidthPerPeriod{ Period: 365 * (24 * time.Hour), - Rx: Unlimited, - Tx: Unlimited, - Total: Unlimited, + Warning: &Bandwidth{ + Rx: Unlimited, + Tx: Unlimited, + Total: Unlimited, + }, + Limit: &Bandwidth{ + Rx: Unlimited, + Tx: Unlimited, + Total: Unlimited, + }, }, PerShare: &BandwidthPerPeriod{ Period: 365 * (24 * time.Hour), - Rx: Unlimited, - Tx: Unlimited, - Total: Unlimited, + Warning: &Bandwidth{ + Rx: Unlimited, + Tx: Unlimited, + Total: Unlimited, + }, + Limit: &Bandwidth{ + Rx: Unlimited, + Tx: Unlimited, + Total: Unlimited, + }, }, }, }