Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct { // DeduplicationID is used for deduplicating quota allocation/free calls in the case of // failed RPCs and retries. This should be a UUID per call, where the same // UUID is used for retries of the same quota allocation or release call. DeduplicationID string // The amount of quota being allocated or released. QuotaAmount int64 }
Args controls the quota requested
type Manager ¶
type Manager interface { Start() Apply(authContext *auth.Context, o product.AuthorizedOperation, args Args) (*Result, error) Close() }
A Manager tracks multiple Apigee quotas
func NewManager ¶
NewManager constructs and starts a new Manager. Call Close when done.
type Options ¶
type Options struct { // Client is a configured HTTPClient Client *http.Client // BaseURL of the Apigee internal proxy BaseURL *url.URL // Org is organization Org string // Env is environment Env string }
Options allows us to specify options for how this auth manager will run
type Request ¶
type Request struct { Identifier string `json:"identifier"` Weight int64 `json:"weight"` Interval int64 `json:"interval"` Allow int64 `json:"allow"` TimeUnit string `json:"timeUnit"` }
A Request is sent to Apigee's quota server to allocate quota.
type Result ¶
type Result struct { Allowed int64 `json:"allowed"` Used int64 `json:"used"` Exceeded int64 `json:"exceeded"` ExpiryTime int64 `json:"expiryTime"` // in seconds Timestamp int64 `json:"timestamp"` }
A Result is a response from Apigee's quota server that gives information about how much quota is available. Note that Used will never exceed Allowed, but Exceeded will be positive in that case.
type ResultCache ¶
type ResultCache struct {
// contains filtered or unexported fields
}
ResultCache is a structure to track Results by ID, bounded by size
func (*ResultCache) Add ¶
func (d *ResultCache) Add(id string, result *Result)
Add a Result to the cache
func (*ResultCache) Get ¶
func (d *ResultCache) Get(id string) *Result
Get a Result from the cache, nil if none
Click to show internal directories.
Click to hide internal directories.