roughed in limits model that incorporates bandwidth limit specs (#235)

This commit is contained in:
Michael Quigley
2023-03-10 14:25:29 -05:00
parent 86380d1836
commit 83ab21f00c
5 changed files with 65 additions and 21 deletions

View File

@ -0,0 +1,51 @@
package limits
import "time"
const Unlimited = -1
type Config struct {
Environments int
Shares int
Bandwidth *BandwidthConfig
}
type BandwidthConfig struct {
PerAccount *BandwidthPerPeriod
PerEnvironment *BandwidthPerPeriod
PerShare *BandwidthPerPeriod
}
type BandwidthPerPeriod struct {
Period time.Duration
Rx int64
Tx int64
Total int64
}
func DefaultConfig() *Config {
return &Config{
Environments: Unlimited,
Shares: Unlimited,
Bandwidth: &BandwidthConfig{
PerAccount: &BandwidthPerPeriod{
Period: 365 * (24 * time.Hour),
Rx: Unlimited,
Tx: Unlimited,
Total: Unlimited,
},
PerEnvironment: &BandwidthPerPeriod{
Period: 365 * (24 * time.Hour),
Rx: Unlimited,
Tx: Unlimited,
Total: Unlimited,
},
PerShare: &BandwidthPerPeriod{
Period: 365 * (24 * time.Hour),
Rx: Unlimited,
Tx: Unlimited,
Total: Unlimited,
},
},
}
}