Checklist
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" >> c2
The 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":
And we should also support constructing the relationship explicitly:
c1 >> Relationship("Sends events to", technologies="Kafka") >> c2
This 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)
Checklist
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):
I think we can do better in Python.
Describe the solution you would like.
By overriding
__rshift__and__irshift__onElementthen we can achieve something much cleaner:The result of this expression would be the
Relationshipso you could continue to add technologies, tags, etc. We could also provide a shortcut that creates a general relationship with description "Uses":And we should also support constructing the relationship explicitly:
This becomes even more useful if people choose to subtype
Relationship:(here the topic would be added to the properties collection of the Relationship)