Skip to content

Commit

Permalink
Added function IsBucketThrottled
Browse files Browse the repository at this point in the history
Signed-off-by: Shubhendu Ram Tripathi <[email protected]>
  • Loading branch information
shtripat committed Dec 12, 2023
1 parent 8105625 commit 249cd39
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion quota-commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type BucketQuota struct {
Rate uint64 `json:"rate"` // Indicates bandwidth rate allocated per bucket
Requests uint64 `json:"requests"` // Indicates number of requests allocated per bucket
Type QuotaType `json:"quotatype,omitempty"`
ThrottleRules []BucketThrottleRule `json:"throttleRules"` // indocates list of throttle rules per bucket
ThrottleRules []BucketThrottleRule `json:"throttleRules"` // indicates list of throttle rules per bucket
}

// IsValid returns false if quota is invalid
Expand All @@ -74,6 +74,11 @@ func (q BucketQuota) IsValid() bool {
return true
}

// IsBucketThrottled returns true if throttle rules set for the bucket
func (q BucketQuota) IsBucketThrottled() bool {
return len(q.ThrottleRules) > 0
}

// GetBucketQuota - get info on a user
func (adm *AdminClient) GetBucketQuota(ctx context.Context, bucket string) (q BucketQuota, err error) {
queryValues := url.Values{}
Expand Down

0 comments on commit 249cd39

Please sign in to comment.