-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Checklist
- There are no similar issues or pull requests for this yet.
Is your feature related to a problem? Please describe it.
Currently, to add a relationship between two elements is a little clunky (mirroring the Java API):
c1 = Container("Container 1")
c2 = Container("Container 2")
r = c1.add_relationship(destination=c2, description="Sends events to")I think we can do better in Python.
Describe the solution you would like.
By overriding __rshift__ and __irshift__ on Element then we can achieve something much cleaner:
c1 = Container("Container 1")
c2 = Container("Container 2")
c1 >> "Sends events to" >> c2The result of this expression would be the Relationship so you could continue to add technologies, tags, etc. We could also provide a shortcut that creates a general relationship with description "Uses":
c1 >> c2And we should also support constructing the relationship explicitly:
c1 >> Relationship("Sends events to", technologies="Kafka") >> c2This becomes even more useful if people choose to subtype Relationship:
c1 >> Kafka("Sends events to", topic="eventStream") >> c2(here the topic would be added to the properties collection of the Relationship)
Metadata
Metadata
Assignees
Labels
No labels