Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Not possible to describe includes and excludes on Create #256

Open
displague opened this issue Apr 2, 2021 · 0 comments
Open

Not possible to describe includes and excludes on Create #256

displague opened this issue Apr 2, 2021 · 0 comments

Comments

@displague
Copy link
Contributor

Include and Exclude fields are provided by GetOptions which are commonly accepted in read-only methods like Get and List.

The Equinix Metal API also supports Include and Exclude parameters for Create and Update methods (POST,PUT).
Having these include fields expanded in create responses could help developers avoid a secondary round-trip API fetch.

How would CreateOpts be introduced? Does this have to break the signature of all Create/Update methods?

Consider how this is handled in gometal, where .Execute() is called after preparing the API call. A similar approach that does not break packngo compatibility could look like client.Projects.ResetIncludes().Including("users").Create(...).

Some decision would need to be made about when the Includes and Excludes would be cleared. Would they be cleared manually? Would includes be cleared after each request?

Within an ServiceOp (Devices, Projects, Users) the same set of includes are generally available, so this could be considered a service feature, except that some service methods are a level deeper (Projects.GetBGP), where the same includes do not apply. The EM API ignores invalid includes, but do we really want to send invalid arguments? This behavior is undocumented and therefor more prone to change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant