mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-29 13:06:44 +00:00
feat: add quotas (#4779)
adds possibilities to cap authenticated requests and execution seconds of actions on a defined intervall
This commit is contained in:
28
internal/logstore/quotaqueriers/mock/noop.go
Normal file
28
internal/logstore/quotaqueriers/mock/noop.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package mock
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/logstore"
|
||||
"github.com/zitadel/zitadel/internal/repository/quota"
|
||||
)
|
||||
|
||||
var _ logstore.QuotaQuerier = (*inmemReporter)(nil)
|
||||
|
||||
type inmemReporter struct {
|
||||
config *quota.AddedEvent
|
||||
startPeriod time.Time
|
||||
}
|
||||
|
||||
func NewNoopQuerier(quota *quota.AddedEvent, startPeriod time.Time) *inmemReporter {
|
||||
return &inmemReporter{config: quota, startPeriod: startPeriod}
|
||||
}
|
||||
|
||||
func (i *inmemReporter) GetCurrentQuotaPeriod(context.Context, string, quota.Unit) (*quota.AddedEvent, time.Time, error) {
|
||||
return i.config, i.startPeriod, nil
|
||||
}
|
||||
|
||||
func (*inmemReporter) GetDueQuotaNotifications(context.Context, *quota.AddedEvent, time.Time, uint64) ([]*quota.NotifiedEvent, error) {
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user