Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
droplets: refactor how to assign resources (#1500)
This refactors how we move created resources to projects to make it generic-ish. As long as the resource implements the `URN()` method, we can use a helper that performs the assign resources call. This is not quite ideal due to how the commands are architected. Because we double-wrap the raw godo resources (first in a wrapper struct, then in the type alias for a slice of those wrapped structs), Go's type system isn't able to recognize those slices as implementing a slice of `urner` interfaces. What it can do though, is recognize each individual element of those slices as implementing the `urner` interface, so the method I created will only accept a single `urner`, despite the call to assign resources accepting an slice of URNs. I think the tradeoff is worth it, since each command that can support the projects functionality can use the same `moveToProject`, and what we lose in efficiency by having multiple calls to assign resources in some instances, we gain in consistency.
- Loading branch information