-
Notifications
You must be signed in to change notification settings - Fork 9
feat(storagezone): add the ability to add, get, list, and remove stor… #19
Conversation
My overarching goal is to get storage zone management into the TF provider you've written. My Golang-foo is weak (this is in fact the first Go I've ever written. There's a lot of repetition from the Would be interested in your thoughts and guidance. |
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.
@jspizziri thanks a lot for your contribution!
It looks great overall.
Please see my review comments + also check out the warnings from the CI check.
5f5ae25
to
0b1263c
Compare
@fho please see my updates. I believe I've taken care of everything you mentioned. I refactored things to use functions with generics and I had to upgrade to go |
@jspizziri CI is failing because it uses Go 1.17 (needs to be upgraded in .github/workflows/ci.yml). I would prefer if you could split those changes into multiple PRs or at least multiple commits. It makes it easier to use the commit messages as base for changelogs, enables to revert specific changes that have introduced bugs, makes it easier to review PRs and it's also quicker to finish small changes and get them into master. :-) |
1ea304d
to
84cdfd4
Compare
@fho please see my updates. |
@fho the workflow is failing due to the linter. I checked and it looks like |
84cdfd4
to
c24ca2e
Compare
@jspizziri yes, the recent golangci-lint versions work with go 1.18 but some linters are still unsupported and get disabled when requiring go 1.18 |
bc57b8f
to
1fc8d8d
Compare
@fho alright, all the linter errors are cleaned up and the workflow is passing. |
@jspizziri awesome, thanks a lot. I like the idea with the generic resource functions! |
FYI I'm adding |
1fc8d8d
to
fbca6da
Compare
Alright, I've updated the client to add
|
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.
looks great, I added some comments
cb342b4
to
10efbb0
Compare
@jspizziri there are multiple mehtods that do not use the new resource functions, e.g.: AddCustomCertificate, RemoveCustomHostname, SetEdgeRuleEnabled could you change all to use the new resource functions, so it is consistent? |
@jspizziri fyi, I made https://github.com/simplesurance/bunny-cli public. |
8d0d4b6
to
8e4b532
Compare
I've pushed a new update. Some things of note:
LMK your thoughts from here |
12d0ead
to
436d471
Compare
Also, something I want to note that I just discovered about on PullZones: The docs say that on creation of a PZ an OriginURL is required and a StorageZoneId is optional. However, the reality is that ONE of the TWO are required. You must either specify a OriginURL OR a StorageZoneID. Furthermore, passing BOTH results in OriginURL being entirely ignored (StorageZoneID is preferred). I found this while updating the TF provider to support Storage Zones. I feel that the libs should help in this regard, and my thought was that Update: I've addressed this issue in the TF provider here simplesurance/terraform-provider-bunny#67, but I think there should be something in this package that at least warns people. |
Also, it should be noted that the refactor of pagination actually introduces a breaking change since it removes some old structs in favor of abstract ones. I've updated the commit dealing with that refactor/feature to document the breaking change. |
…esource functions upgrade pullzone to take advantaged of the abstract resource functions. a breaking change has been introduced in this version by removing PullZone specific pagination structs in favor of more abstract ones. BREAKING CHANGE: `PullZonePaginationOptions` and `PullZonePaginationReply` have been replaced with `PaginationOptions` and `PaginationReply`
436d471
to
5d45067
Compare
nice find, lets document it in the godoc for |
@jspizziri looks good! thanks a for the work again. I'm in favor of removing My plan is to fix the failing integrationtest in the bunny-terraform-go provider, then run the the terraform provider with this bunny-go version to test the change thoroughly. I expect that everything works fine but better be safe. :-) |
|
@fho if you're willing to do that I'd appreciate it. I'm quite anxious to get my hands on that tf provider as I'm sure you can imagine and whatever makes that happen the fastest is my preference (and if you do it we won't need to go through another review cycle). |
The docs say that on creation of a PZ an OriginURL is required and a StorageZoneId is optional. However, the reality is that ONE of the TWO are required. You must either specify a OriginURL OR a StorageZoneID. Furthermore, passing BOTH results in OriginURL being entirely ignored (StorageZoneID is preferred). (simplesurance/bunny-go#19 (comment))
This merge: - updates the minimum go version to 1.18, - updates golangci-lint in CI, - add support for retrieving, adding, updating and deleting storage zones - introduces resource* functions that combine calling new*Request and sendRequest, - fixes typos in some error messages GitHub Pull-Request #19
@jspizziri my idea to of passing I merged with some small changes on top, thanks a lot for the PR! |
@fho thanks! Thanks for all the work on this lib and the tf provider. Definitely going to be super helpful for us. Have you reached out to the Bunny folks to let them know about these tools? I feel like a lot of people could use the TF provider and they may want to list it here |
@jspizziri yes, they are aware of both. I also told them that it would be great if they could list them on their 3. party tools page but it did not happen 🤷. |
…age zones