Skip to content
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

feature: backend should construct HFID for an upsert mutation #45

Closed
wvandeun opened this issue Aug 22, 2024 · 1 comment
Closed

feature: backend should construct HFID for an upsert mutation #45

wvandeun opened this issue Aug 22, 2024 · 1 comment
Assignees
Labels
priority/2 This issue stalls work on the project or its dependents, it's a blocker for a release type/feature New feature or request

Comments

@wvandeun
Copy link
Contributor

wvandeun commented Aug 22, 2024

Component

API Server / GraphQL

Describe the Feature Request

An upsert mutation today requires that you provide an HFID for the node you want to upsert. This is needed to be able to uniquely identify a node in the database. Basically we require the client what the HFID of a node is to send that as part of the upsert GraphQL mutation.

Giving this responsibility to the client/consumer becomes more difficult when the HFID of a node exists out of a relationship. Because then the client would need to retrieve the related node to be able to construct the HFID of the node it wants to upsert.

This feature request is to drop the requirement for a client to send the HFID as part of the upsert mutation. Instead the backend should, based on the schema, be able to construct the HFID for the node for which we receive the upsert mutation.

Describe the Use Case

We should be able to upsert a node which has an HFID which exists out of a relationship of the node, without fetching the related node of from Infrahub.

For example, given the demo schema and data, if you want to upsert an interface "Ethernet1" for "atl-1-edge1" using the SDK then we would first need to retrieve the related node (= device)

device = client.get"InfraDevice", name__value="atl1-edge1")
interface = client.create("InfraInterfaceL3, name="Ethernet1", device=device, speed=1000)
interface.save(allow_upsert=True)

What we want to achieve instead is that we can use the hfid of the device instead.

interface = client.create("InfraInterfaceL3, name="Ethernet1", device="atl1-edge1", speed=1000)
interface.save(allow_upsert=True)

interface = client.create("InfraInterfaceL3, name="Ethernet1", device={"hfid": "atl1-edge1"}, speed=1000)
interface.save(allow_upsert=True)

Additional Information

No response

@wvandeun wvandeun added the type/feature New feature or request label Aug 22, 2024
@dgarros dgarros added priority/3 Not blocking but should be fixed soon priority/2 This issue stalls work on the project or its dependents, it's a blocker for a release and removed priority/3 Not blocking but should be fixed soon labels Aug 26, 2024
@ogenstad ogenstad self-assigned this Sep 3, 2024
@exalate-issue-sync exalate-issue-sync bot added the state/planned This issue is planned to be worked on in an upcoming release. label Sep 9, 2024
@ogenstad
Copy link
Contributor

Fixed in opsmill/infrahub#4339.

@exalate-issue-sync exalate-issue-sync bot removed the state/planned This issue is planned to be worked on in an upcoming release. label Sep 18, 2024
@dgarros dgarros transferred this issue from opsmill/infrahub Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/2 This issue stalls work on the project or its dependents, it's a blocker for a release type/feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants