mirror of https://github.com/hashicorp/boundary
parent
b159080593
commit
0fb77358e5
@ -0,0 +1,30 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package ratelimit
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultLimiterMaxEntries is the default maximum number of quotas that
|
||||
// can be tracked by the rate limiter.
|
||||
DefaultLimiterMaxEntries = 16384 // TODO: pick a meaningful default value
|
||||
)
|
||||
|
||||
// Config is used to configure rate limits. Each config is used to specify
|
||||
// the maximum number of requests that can be made in a time period for the
|
||||
// corresponding resources and actions.
|
||||
type Config struct {
|
||||
Resources []string `hcl:"resources"`
|
||||
Actions []string `hcl:"actions"`
|
||||
Per string `hcl:"per"`
|
||||
Limit int `hcl:"limit"`
|
||||
PeriodHCL string `hcl:"period"`
|
||||
Period time.Duration `hcl:"-"`
|
||||
Unlimited bool `hcl:"unlimited"`
|
||||
}
|
||||
|
||||
// Configs is an ordered set of Config.
|
||||
type Configs []*Config
|
||||
@ -0,0 +1,6 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
// Package ratelimit provides the rate limit configuration and http middleware
|
||||
// for use by the controller's http API.
|
||||
package ratelimit
|
||||
Loading…
Reference in new issue