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: support aws group resources #2

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README_MAIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ pdm add <your-path>/diagrams-ext/dist/diagrams-0.23.5a0-py3-none-any.whl
- ~~<https://github.com/mingrammer/diagrams/pull/439>~~
- ~~<https://github.com/mingrammer/diagrams/pull/438>~~
- [ ] overlapping cluster: <https://github.com/mingrammer/diagrams/issues/852>
- [ ] edge attr: <https://github.com/mingrammer/diagrams/issues/560>
- [x] edge attr: just input the attr as a string `**attrs: Dict`
- ~~<https://github.com/mingrammer/diagrams/issues/560>~~

- [ ] read tfstate and generate graph
- <https://github.com/cycloidio/inframap>
Expand Down
58 changes: 58 additions & 0 deletions diagrams/aws/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,64 @@ class Users(_General):
_icon = "users.png"


class Cloud(_General):
_icon = "aws-cloud.png"


class Account(_General):
_icon = "aws-account.png"


class Region(_General):
_icon = "region.png"


# Aliases

OfficeBuilding = GenericOfficeBuilding

# Cluster

from diagrams import Cluster


class ClusterCloud(Cluster):
_icon_node = Cloud
_graph_attr = {
"bgcolor": "white",
"pencolor": "#F78E04",
}

def __init__(
self,
label: str = "cloud",
direction: str = "LR",
):
super().__init__(label, direction, icon_node=self._icon_node, graph_attr=self._graph_attr)


class ClusterAccount(Cluster):
_icon_node = Account
_graph_attr = {
"bgcolor": "white",
"pencolor": "#CD2264",
}

def __init__(
self,
label: str = "account",
direction: str = "LR",
):
super().__init__(label, direction, icon_node=self._icon_node, graph_attr=self._graph_attr)


class ClusterRegion(Cluster):
_icon_node = Region
_graph_attr = {"bgcolor": "white", "pencolor": "#147EBA", "style": "rounded,dashed"}

def __init__(
self,
label: str = "region",
direction: str = "LR",
):
super().__init__(label, direction, icon_node=self._icon_node, graph_attr=self._graph_attr)
86 changes: 86 additions & 0 deletions diagrams/aws/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ class PublicSubnet(_Network):
_icon = "public-subnet.png"


class SecureSubnet(_Network):
_icon = "secure-subnet.png"


class IntraSubnet(_Network):
_icon = "intra-subnet.png"


class Route53HostedZone(_Network):
_icon = "route-53-hosted-zone.png"

Expand Down Expand Up @@ -168,3 +176,81 @@ class VpnGateway(_Network):
CLB = ElbClassicLoadBalancer
NLB = ElbNetworkLoadBalancer
GAX = GlobalAccelerator

# Cluster

from diagrams import Cluster

class ClusterVPC(Cluster):
_icon_node = VPC
_graph_attr = {
"bgcolor": "white",
"pencolor": "#8C4FFF",
}

def __init__(
self,
label: str = "vpc",
direction: str = "LR",
):
super().__init__(label, direction, icon_node=self._icon_node, graph_attr=self._graph_attr)


class ClusterPublicSubnet(Cluster):
_icon_node = PublicSubnet
_graph_attr = {
"bgcolor": "#F2F6E8",
"pencolor": "#7AA116",
}

def __init__(
self,
label: str = "public",
direction: str = "LR",
):
super().__init__(label, direction, icon_node=self._icon_node, graph_attr=self._graph_attr)


class ClusterPrivateSubnet(Cluster):
_icon_node = PrivateSubnet
_graph_attr = {
"bgcolor": "#E6F6F7",
"pencolor": "#00A4A6",
}

def __init__(
self,
label: str = "private",
direction: str = "LR",
):
super().__init__(label, direction, icon_node=self._icon_node, graph_attr=self._graph_attr)


class ClusterSecureSubnet(Cluster):
_icon_node = SecureSubnet
_graph_attr = {
"bgcolor": "#F8CECC",
"pencolor": "#B85450",
}

def __init__(
self,
label: str = "secure",
direction: str = "LR",
):
super().__init__(label, direction, icon_node=self._icon_node, graph_attr=self._graph_attr)


class ClusterIntraSubnet(Cluster):
_icon_node = IntraSubnet
_graph_attr = {
"bgcolor": "#FFE6CC",
"pencolor": "#D79B00",
}

def __init__(
self,
label: str = "intra",
direction: str = "LR",
):
super().__init__(label, direction, icon_node=self._icon_node, graph_attr=self._graph_attr)
Binary file added resources/aws/general/aws-account.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/aws/general/aws-cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/aws/general/region.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/aws/network/intra-subnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/aws/network/secure-subnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.