apache / libcloud

Apache Libcloud is a Python library which hides differences between different cloud provider APIs and allows you to manage different cloud resources through a unified and easy to use API.
https://libcloud.apache.org
Apache License 2.0
2.04k stars 925 forks source link

[Feature] DigitalOceean Firewall #1678

Open ccrvlh opened 2 years ago

ccrvlh commented 2 years ago

I couldn't find DigitalOcean's firewall feature. I can start working on it right away. Would it make sense for PR? Thanks!

ccrvlh commented 2 years ago

I guess this could be implemented with a series of extensions methods, somewhat similar to what already exists for the floating ip resource.

Probably the biggest design decision here is whether to use a similar approach as the one used for EC2 security groups, in which rules and sources are being handled directly on a method, or to go with an object-first approach and make a new object for rules/sources (the two nested objects that DOs firewall uses).

Maybe making it closer to EC2 could be a good idea: if there was a strong enough argument to make firewall part of the core (non ex) lib in the future, the APIs would already be similar. With this directive I would be happy to start working on this.

Kami commented 2 years ago

@lowercase00 That approach reasonable to me.

It's also worth noting that some APIs (e.g. storage) support both approaches - driver methods call object methods or vice versa.

So the object approach is really just a convenience.

ccrvlh commented 2 years ago

Thanks @Kami, I'll push a few commits to my local fork before a PR and let you know how things evolve