2024-03-22 09:56:30 -07:00
|
|
|
from typing import Annotated, List, Union
|
2022-10-06 13:50:53 -07:00
|
|
|
|
2024-03-22 09:56:30 -07:00
|
|
|
import strawberry
|
|
|
|
import strawberry_django
|
|
|
|
|
|
|
|
__all__ = (
|
|
|
|
'CabledObjectMixin',
|
|
|
|
'PathEndpointMixin',
|
|
|
|
)
|
2022-10-06 13:50:53 -07:00
|
|
|
|
2022-07-07 12:48:44 -04:00
|
|
|
|
2024-03-22 09:56:30 -07:00
|
|
|
@strawberry.type
|
|
|
|
class CabledObjectMixin:
|
|
|
|
cable: Annotated["CableType", strawberry.lazy('dcim.graphql.types')] | None
|
2022-10-06 13:50:53 -07:00
|
|
|
|
2024-03-29 11:54:31 -07:00
|
|
|
link_peers: List[Annotated[Union[
|
2024-03-22 09:56:30 -07:00
|
|
|
Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')],
|
|
|
|
Annotated["ConsolePortType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["ConsoleServerPortType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["FrontPortType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["PowerFeedType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["PowerOutletType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["RearPortType", strawberry.lazy('dcim.graphql.types')],
|
2024-03-29 11:54:31 -07:00
|
|
|
], strawberry.union("LinkPeerType")]]
|
2023-02-24 06:36:39 +01:00
|
|
|
|
|
|
|
|
2024-03-22 09:56:30 -07:00
|
|
|
@strawberry.type
|
2023-02-24 06:36:39 +01:00
|
|
|
class PathEndpointMixin:
|
|
|
|
|
2024-03-29 11:54:31 -07:00
|
|
|
connected_endpoints: List[Annotated[Union[
|
2024-03-22 09:56:30 -07:00
|
|
|
Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')],
|
|
|
|
Annotated["ConsolePortType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["ConsoleServerPortType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["FrontPortType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["PowerFeedType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["PowerOutletType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')],
|
|
|
|
Annotated["ProviderNetworkType", strawberry.lazy('circuits.graphql.types')],
|
|
|
|
Annotated["RearPortType", strawberry.lazy('dcim.graphql.types')],
|
2024-03-29 11:54:31 -07:00
|
|
|
], strawberry.union("ConnectedEndpointType")]]
|