Add Icon set for Oracle Cloud Services. Update scripts to handle the new provider

pull/20/head
S M 6 years ago
parent 889e4e0db3
commit 0fed03e5fb

@ -8,7 +8,7 @@
**Diagram as Code**. **Diagram as Code**.
Diagrams lets you draw the cloud system architecture **in Python code**. It was born for **prototyping** a new system architecture design without any design tools. You can also describe or visualize the existing system architecture as well. Diagrams currently supports four major providers: `AWS`, `Azure`, `GCP` and `Kubernetes`. Diagrams lets you draw the cloud system architecture **in Python code**. It was born for **prototyping** a new system architecture design without any design tools. You can also describe or visualize the existing system architecture as well. Diagrams currently supports five major providers: `AWS`, `Azure`, `GCP`, `Oracle Cloud` and `Kubernetes`.
**Diagram as Code** also allows you to **tracking** the architecture diagram changes on any **version control** system. **Diagram as Code** also allows you to **tracking** the architecture diagram changes on any **version control** system.

@ -2,23 +2,34 @@
app_root_dir="diagrams" app_root_dir="diagrams"
# NOTE: azure icon set is not latest version # NOTE: azure icon set is not latest version
providers=("aws" "azure" "gcp" "k8s") providers=("aws" "azure" "gcp" "k8s" "oci")
if ! [ -x "$(command -v round)" ]; then if ! [ -x "$(command -v round)" ]; then
echo 'round is not installed' echo 'round is not installed'
exit 1
fi fi
if ! [ -x "$(command -v inkscape)" ]; then if ! [ -x "$(command -v inkscape)" ]; then
echo 'inkscape is not installed' echo 'inkscape is not installed'
exit 1
fi
if ! [ -x "$(command -v convert)" ]; then
echo 'image magick is not installed'
exit 1
fi fi
# preprocess the resources # preprocess the resources
for pvd in "${providers[@]}"; do for pvd in "${providers[@]}"; do
# convert the svg to png for azure provider # convert the svg to png for azure provider
if [ "$pvd" = "azure" ]; then if [ "$pvd" = "azure" ]; then
echo "converting the svg to png for provider '$pvd'" echo "converting the svg to png using inkscape for provider '$pvd'"
python -m scripts.resource svg2png "$pvd" python -m scripts.resource svg2png "$pvd"
fi fi
if [ "$pvd" == "oci" ]; then
echo "converting the svg to png using image magick for provider '$pvd'"
python -m scripts.resource svg2png2 "$pvd"
fi
echo "cleaning the resource names for provider '$pvd'" echo "cleaning the resource names for provider '$pvd'"
python -m scripts.resource clean "$pvd" python -m scripts.resource clean "$pvd"
# round the all png images for aws provider # round the all png images for aws provider

@ -11,7 +11,7 @@ DIR_APP_ROOT = "diagrams"
DIR_RESOURCE = "resources" DIR_RESOURCE = "resources"
DIR_TEMPLATE = "templates" DIR_TEMPLATE = "templates"
PROVIDERS = ("base", "aws", "azure", "gcp", "k8s") PROVIDERS = ("base", "aws", "azure", "gcp", "k8s", "oci")
######################### #########################
# Resource Processing # # Resource Processing #
@ -21,12 +21,16 @@ CMD_ROUND = "round"
CMD_ROUND_OPTS = ("-w",) CMD_ROUND_OPTS = ("-w",)
CMD_SVG2PNG = "inkscape" CMD_SVG2PNG = "inkscape"
CMD_SVG2PNG_OPTS = ("-z", "-w", "256", "-h", "256", "--export-type", "png") CMD_SVG2PNG_OPTS = ("-z", "-w", "256", "-h", "256", "--export-type", "png")
CMD_SVG2PNG_IM = "convert"
CMD_SVG2PNG_IM_OPTS = ("-shave", "25%x25%", "-resize", "256x256!")
FILE_PREFIXES = { FILE_PREFIXES = {
"aws": ("amazon-", "aws-"), "aws": ("amazon-", "aws-"),
"azure": ("azure-",), "azure": ("azure-",),
"gcp": ("cloud-",), "gcp": ("cloud-",),
"k8s": (), "k8s": (),
"oci": ("OCI_",),
} }
######################### #########################
@ -49,6 +53,7 @@ UPPER_WORDS = {
"api", "cm", "ccm", "crb", "crd", "ds", "etcd", "hpa", "k8s", "ns", "psp", "pv", "pvc", "rb", "rs", "api", "cm", "ccm", "crb", "crd", "ds", "etcd", "hpa", "k8s", "ns", "psp", "pv", "pvc", "rb", "rs",
"sa", "sc", "sts", "svc", "sa", "sc", "sts", "svc",
), ),
"oci": ("oci",),
} }
# TODO: check if the classname exists # TODO: check if the classname exists
@ -198,5 +203,11 @@ ALIASES = {
"SC": "StorageClass", "SC": "StorageClass",
"Vol": "Volume", "Vol": "Volume",
}, },
},
"oci": {
"compute": {
"Vm": "VirtualMachine",
"Bm": "BareMetal"
},
} }
} }

@ -0,0 +1,26 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Compute(_OCI):
_type = "compute"
_icon_dir = "resources/oci/compute"
class Bm(_Compute):
_icon = "bm.png"
class Container(_Compute):
_icon = "container.png"
class Vm(_Compute):
_icon = "vm.png"
# Aliases
VirtualMachine = Vm
BareMetal = Bm

@ -0,0 +1,31 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Connectivity(_OCI):
_type = "connectivity"
_icon_dir = "resources/oci/connectivity"
class Backbone(_Connectivity):
_icon = "backbone.png"
class Customerdatacenter(_Connectivity):
_icon = "customerdatacenter.png"
class Customerpremisesequip(_Connectivity):
_icon = "customerpremisesequip.png"
class Fastconnect(_Connectivity):
_icon = "fastconnect.png"
class Vpn(_Connectivity):
_icon = "vpn.png"
# Aliases

@ -0,0 +1,15 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Database(_OCI):
_type = "database"
_icon_dir = "resources/oci/database"
class Databaseservice(_Database):
_icon = "databaseservice.png"
# Aliases

@ -0,0 +1,19 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Devops(_OCI):
_type = "devops"
_icon_dir = "resources/oci/devops"
class Apiservice(_Devops):
_icon = "apiservice.png"
class Resourcemgmt(_Devops):
_icon = "resourcemgmt.png"
# Aliases

@ -0,0 +1,27 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Edge(_OCI):
_type = "edge"
_icon_dir = "resources/oci/edge"
class Cdn(_Edge):
_icon = "cdn.png"
class Dns(_Edge):
_icon = "dns.png"
class Emaildelivery(_Edge):
_icon = "emaildelivery.png"
class Waf(_Edge):
_icon = "waf.png"
# Aliases

@ -0,0 +1,51 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Monitoring(_OCI):
_type = "monitoring"
_icon_dir = "resources/oci/monitoring"
class Alarm(_Monitoring):
_icon = "alarm.png"
class Event(_Monitoring):
_icon = "event.png"
class Healthcheck(_Monitoring):
_icon = "healthcheck.png"
class Logging(_Monitoring):
_icon = "logging.png"
class Notifications(_Monitoring):
_icon = "notifications.png"
class Queuing(_Monitoring):
_icon = "queuing.png"
class Search(_Monitoring):
_icon = "search.png"
class Streaming(_Monitoring):
_icon = "streaming.png"
class Telemetry(_Monitoring):
_icon = "telemetry.png"
class Workflow(_Monitoring):
_icon = "workflow.png"
# Aliases

@ -0,0 +1,43 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Network(_OCI):
_type = "network"
_icon_dir = "resources/oci/network"
class Drg(_Network):
_icon = "drg.png"
class Firewall(_Network):
_icon = "firewall.png"
class Internetgateway(_Network):
_icon = "internetgateway.png"
class Loadbalance(_Network):
_icon = "loadbalance.png"
class Routetable(_Network):
_icon = "routetable.png"
class Securitylists(_Network):
_icon = "securitylists.png"
class Service_Gateway(_Network):
_icon = "service_gateway.png"
class Vcloudnetwork(_Network):
_icon = "vcloudnetwork.png"
# Aliases

@ -0,0 +1,51 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Security(_OCI):
_type = "security"
_icon_dir = "resources/oci/security"
class Audit(_Security):
_icon = "audit.png"
class Compartments(_Security):
_icon = "compartments.png"
class Ddos(_Security):
_icon = "ddos.png"
class Encryption(_Security):
_icon = "encryption.png"
class Groups(_Security):
_icon = "groups.png"
class Id_Access(_Security):
_icon = "id_access.png"
class Keymgmt(_Security):
_icon = "keymgmt.png"
class Ocid(_Security):
_icon = "ocid.png"
class Policies(_Security):
_icon = "policies.png"
class Tagging(_Security):
_icon = "tagging.png"
# Aliases

@ -0,0 +1,39 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Storage(_OCI):
_type = "storage"
_icon_dir = "resources/oci/storage"
class Backuprestore(_Storage):
_icon = "backuprestore.png"
class Blockstorage(_Storage):
_icon = "blockstorage.png"
class Buckets(_Storage):
_icon = "buckets.png"
class Datatransfer(_Storage):
_icon = "datatransfer.png"
class Filestorage(_Storage):
_icon = "filestorage.png"
class Objectstorage(_Storage):
_icon = "objectstorage.png"
class Storagegateway(_Storage):
_icon = "storagegateway.png"
# Aliases

@ -44,6 +44,12 @@ from diagrams.gcp.ml import AutoML
from diagrams.k8s.compute import Pod, StatefulSet from diagrams.k8s.compute import Pod, StatefulSet
from diagrams.k8s.network import Service from diagrams.k8s.network import Service
from diagrams.k8s.storage import PV, PVC, StorageClass from diagrams.k8s.storage import PV, PVC, StorageClass
...
# Oracle resources
from diagrams.oci.compute import VirtualMachine, Container
from diagrams.oci.network import Firewall
from diagrams.oci.storage import Filestorage, Storagegateway
``` ```
You can find all available nodes list in [Here](https://diagrams.mingrammer.com/docs/nodes/aws). You can find all available nodes list in [Here](https://diagrams.mingrammer.com/docs/nodes/aws).

@ -0,0 +1,83 @@
---
id: oci
title: OCI
---
Node classes list of oci provider.
## oci.compute
- **diagrams.oci.compute.Bm**, **BareMetal** (alias)
- **diagrams.oci.compute.Container**
- **diagrams.oci.compute.Vm**, **VirtualMachine** (alias)
## oci.connectivity
- **diagrams.oci.connectivity.Backbone**
- **diagrams.oci.connectivity.Customerdatacenter**
- **diagrams.oci.connectivity.Customerpremisesequip**
- **diagrams.oci.connectivity.Fastconnect**
- **diagrams.oci.connectivity.Vpn**
## oci.database
- **diagrams.oci.database.Databaseservice**
## oci.devops
- **diagrams.oci.devops.Apiservice**
- **diagrams.oci.devops.Resourcemgmt**
## oci.edge
- **diagrams.oci.edge.Cdn**
- **diagrams.oci.edge.Dns**
- **diagrams.oci.edge.Emaildelivery**
- **diagrams.oci.edge.Waf**
## oci.monitoring
- **diagrams.oci.monitoring.Alarm**
- **diagrams.oci.monitoring.Event**
- **diagrams.oci.monitoring.Healthcheck**
- **diagrams.oci.monitoring.Logging**
- **diagrams.oci.monitoring.Notifications**
- **diagrams.oci.monitoring.Queuing**
- **diagrams.oci.monitoring.Search**
- **diagrams.oci.monitoring.Streaming**
- **diagrams.oci.monitoring.Telemetry**
- **diagrams.oci.monitoring.Workflow**
## oci.network
- **diagrams.oci.network.Drg**
- **diagrams.oci.network.Firewall**
- **diagrams.oci.network.Internetgateway**
- **diagrams.oci.network.Loadbalance**
- **diagrams.oci.network.Routetable**
- **diagrams.oci.network.Securitylists**
- **diagrams.oci.network.Service_Gateway**
- **diagrams.oci.network.Vcloudnetwork**
## oci.security
- **diagrams.oci.security.Audit**
- **diagrams.oci.security.Compartments**
- **diagrams.oci.security.Ddos**
- **diagrams.oci.security.Encryption**
- **diagrams.oci.security.Groups**
- **diagrams.oci.security.Id_Access**
- **diagrams.oci.security.Keymgmt**
- **diagrams.oci.security.Ocid**
- **diagrams.oci.security.Policies**
- **diagrams.oci.security.Tagging**
## oci.storage
- **diagrams.oci.storage.Backuprestore**
- **diagrams.oci.storage.Blockstorage**
- **diagrams.oci.storage.Buckets**
- **diagrams.oci.storage.Datatransfer**
- **diagrams.oci.storage.Filestorage**
- **diagrams.oci.storage.Objectstorage**
- **diagrams.oci.storage.Storagegateway**

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@ -57,11 +57,22 @@ def cleaner_k8s(f):
return f.lower() return f.lower()
def cleaner_oci(f):
f = f.replace("-", "_")
f = f.replace("_grey", "")
for p in cfg.FILE_PREFIXES["oci"]:
if f.startswith(p):
f = f[len(p) :]
break
return f.lower()
cleaners = { cleaners = {
"aws": cleaner_aws, "aws": cleaner_aws,
"azure": cleaner_azure, "azure": cleaner_azure,
"gcp": cleaner_gcp, "gcp": cleaner_gcp,
"k8s": cleaner_k8s, "k8s": cleaner_k8s,
"oci": cleaner_oci,
} }
@ -105,11 +116,26 @@ def svg2png(pvd: str) -> None:
[_convert(root, path) for path in svgs] [_convert(root, path) for path in svgs]
def svg2png2(pvd: str) -> None:
"""Convert the svg into png using image magick"""
def _convert(base: str, path: str):
path_src = os.path.join(base, path)
path_dest = path_src.replace(".svg", ".png")
subprocess.call([cfg.CMD_SVG2PNG_IM, *cfg.CMD_SVG2PNG_IM_OPTS, path_src, path_dest])
subprocess.call(['rm', path_src])
for root, _, files in os.walk(resource_dir(pvd)):
svgs = filter(lambda f: f.endswith(".svg"), files)
[_convert(root, path) for path in svgs]
# fmt: off # fmt: off
commands = { commands = {
"clean": clean_png, "clean": clean_png,
"round": round_png, "round": round_png,
"svg2png": svg2png, "svg2png": svg2png,
"svg2png2": svg2png2,
} }
# fmt: on # fmt: on

Loading…
Cancel
Save