-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rate limiting (for a zone) #161
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
rate_limiting.go
Outdated
|
||
import ( | ||
"encoding/json" | ||
"github.com/pkg/errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the style elsewhere in this project (presumably because most people are using goimports
) is to put external imports at the end, after a blank line.
rate_limiting_example_test.go
Outdated
|
||
import ( | ||
"fmt" | ||
cloudflare "github.com/cloudflare/cloudflare-go" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
rate_limiting.go
Outdated
// RateLimit is a policy than can be applied to limit traffic within a customer domain | ||
type RateLimit struct { | ||
ID string `json:"id,omitempty"` | ||
Disabled bool `json:"disabled,omitempty"` // api defaults to false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if the comment is necessary here as bool also defaults to false
+ cleanup review comments
27b4a26
to
d42835d
Compare
Thanks guys. I addressed the comments from @jamesog, also I realised today that the empty struct values were different than the api defaults when completely omitting a field in a couple of places - |
Adds support for the rate limiting API. Mostly standard CRUD calls to API with marshalling etc. For listing, I allowed the caller to specify pagination options or call ListAll directly