-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Extend Cloudflare provider #456
base: master
Are you sure you want to change the base?
Extend Cloudflare provider #456
Conversation
This adds support for firewall Rate Limits as well as for Page Rules.
for page := 1; ; page++ { | ||
rateLimits, resultInfo, err := api.ListRateLimits(zoneID, cf.PaginationOptions{Page: page, PerPage: 10}) | ||
if err != nil { | ||
log.Println(err) |
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.
you return error, not need log in resource level
|
||
pageRules, err := api.ListPageRules(zoneID) | ||
if err != nil { | ||
log.Println(err) |
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
|
||
zones, err := api.ListZones() | ||
if err != nil { | ||
panic(err) |
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.
why panic if it's return error?
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.
To be honest, I was copying the other services in this provider. I assumed there were reasons beyond my understanding for this madness... :)
I can definitely make it more proper Go, tho. Gimme a day or two.
func (g *PageRulesGenerator) InitResources() error { | ||
api, err := g.initializeAPI() | ||
if err != nil { | ||
panic(err) |
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.
why panic if it's return error?
// Getting all firewall filters | ||
tmpRes, err := f(api, zone.ID, zone.Name) | ||
if err != nil { | ||
panic(err) |
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.
why panic if it's return error?
@zorkian Thanks for you contribution. |
This adds support for firewall Rate Limits as well as for Page Rules in the Cloudflare provider.