Merge branch 'master' into add_humio_409

pull/423/head
gabriel-tessier 5 years ago committed by GitHub
commit 8aff63379a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,7 @@ set -e
app_root_dir="diagrams"
# NOTE: azure icon set is not latest version
providers=("onprem" "aws" "azure" "gcp" "firebase" "k8s" "alibabacloud" "oci" "programming" "saas" "elastic" "generic" "openstack" "outscale")
providers=("onprem" "aws" "azure" "gcp" "firebase" "k8s" "alibabacloud" "oci" "programming" "saas" "elastic" "generic" "openstack" "outscale" )
if ! [ -x "$(command -v round)" ]; then
echo 'round is not installed'
@ -52,6 +52,10 @@ for pvd in "${providers[@]}"; do
python -m scripts.generate "$pvd"
done
# Generate doc for custom module
echo "generating the docs for custom"
python -m scripts.generate "custom"
# run black
echo "linting the all the diagram modules"
black "$app_root_dir"/**/*.py

@ -402,6 +402,7 @@ ALIASES = {
"saas": {
"logging": {
"Datadog": "DataDog",
"Newrelic": "NewRelic"
}
},
"elastic": {

@ -24,6 +24,10 @@ class Humio(_Monitoring):
_icon = "humio.png"
class Newrelic(_Monitoring):
_icon = "newrelic.png"
class PrometheusOperator(_Monitoring):
_icon = "prometheus-operator.png"

@ -36,6 +36,10 @@ class Laravel(_Framework):
_icon = "laravel.png"
class Micronaut(_Framework):
_icon = "micronaut.png"
class Rails(_Framework):
_icon = "rails.png"

@ -8,6 +8,10 @@ class _Alerting(_Saas):
_icon_dir = "resources/saas/alerting"
class Newrelic(_Alerting):
_icon = "newrelic.png"
class Opsgenie(_Alerting):
_icon = "opsgenie.png"

@ -12,6 +12,10 @@ class Datadog(_Logging):
_icon = "datadog.png"
class Newrelic(_Logging):
_icon = "newrelic.png"
class Papertrail(_Logging):
_icon = "papertrail.png"
@ -19,3 +23,4 @@ class Papertrail(_Logging):
# Aliases
DataDog = Datadog
NewRelic = Newrelic

@ -178,7 +178,7 @@ from diagrams.onprem.analytics import Spark
from diagrams.onprem.compute import Server
from diagrams.onprem.database import PostgreSQL
from diagrams.onprem.inmemory import Redis
from diagrams.onprem.logging import Fluentd
from diagrams.onprem.aggregator import Fluentd
from diagrams.onprem.monitoring import Grafana, Prometheus
from diagrams.onprem.network import Nginx
from diagrams.onprem.queue import Kafka
@ -221,7 +221,7 @@ from diagrams.onprem.analytics import Spark
from diagrams.onprem.compute import Server
from diagrams.onprem.database import PostgreSQL
from diagrams.onprem.inmemory import Redis
from diagrams.onprem.logging import Fluentd
from diagrams.onprem.aggregator import Fluentd
from diagrams.onprem.monitoring import Grafana, Prometheus
from diagrams.onprem.network import Nginx
from diagrams.onprem.queue import Kafka
@ -283,4 +283,4 @@ with Diagram("Broker Consumers", show=False):
queue >> consumers >> Aurora("Database")
```
![rabbitmq consumers diagram](/img/rabbitmq_consumers_diagram.png)
![rabbitmq consumers diagram](/img/rabbitmq_consumers_diagram.png)

@ -0,0 +1,90 @@
---
id: custom
title: Custom
---
## Custom with local icons
For this example we use the following architecture:
```
.
├── custom_local.py
├── my_resources
│ ├── cc_heart.black.png
│ ├── cc_attribution.png
│ ├──...
```
The content of custom_local.py file:
```python
from diagrams import Diagram, Cluster
from diagrams.custom import Custom
with Diagram("Custom with local icons\n Can be downloaded here: \nhttps://creativecommons.org/about/downloads/", show=False, filename="custom_local", direction="LR"):
cc_heart = Custom("Creative Commons", "./my_resources/cc_heart.black.png")
cc_attribution = Custom("Credit must be given to the creator", "./my_resources/cc_attribution.png")
cc_sa = Custom("Adaptations must be shared\n under the same terms", "./my_resources/cc_sa.png")
cc_nd = Custom("No derivatives or adaptations\n of the work are permitted", "./my_resources/cc_nd.png")
cc_zero = Custom("Public Domain Dedication", "./my_resources/cc_zero.png")
with Cluster("Non Commercial"):
non_commercial = [Custom("Y", "./my_resources/cc_nc-jp.png") - Custom("E", "./my_resources/cc_nc-eu.png") - Custom("S", "./my_resources/cc_nc.png")]
cc_heart >> cc_attribution
cc_heart >> non_commercial
cc_heart >> cc_sa
cc_heart >> cc_nd
cc_heart >> cc_zero
```
It will generate the following diagram:
![custom local](/img/custom_local.png)
## Custom with remote icons
If your icons are hosted and can be accessed when you generate the diagrams, you can
```python
from diagrams import Diagram, Cluster
from diagrams.custom import Custom
from urllib.request import urlretrieve
with Diagram("Custom with remote icons", show=False, filename="custom_remote", direction="LR"):
# download the icon image file
diagrams_url = "https://github.com/mingrammer/diagrams/raw/master/assets/img/diagrams.png"
diagrams_icon = "diagrams.png"
urlretrieve(diagrams_url, diagrams_icon)
diagrams = Custom("Diagrams", diagrams_icon)
with Cluster("Some Providers"):
openstack_url = "https://github.com/mingrammer/diagrams/raw/master/resources/openstack/openstack.png"
openstack_icon = "openstack.png"
urlretrieve(openstack_url, openstack_icon)
openstack = Custom("OpenStack", openstack_icon)
elastic_url = "https://github.com/mingrammer/diagrams/raw/master/resources/elastic/saas/elastic.png"
elastic_icon = "elastic.png"
urlretrieve(elastic_url, elastic_icon)
elastic = Custom("Elastic", elastic_icon)
diagrams >> openstack
diagrams >> elastic
```
It will generate the following diagram:
![custom local](/img/custom_remote.png)
Another example can be found [Here](https://diagrams.mingrammer.com/docs/getting-started/examples#rabbitmq-consumers-with-custom-nodes).

@ -153,6 +153,7 @@ Node classes list of onprem provider.
- **diagrams.onprem.monitoring.Datadog**
- **diagrams.onprem.monitoring.Grafana**
- **diagrams.onprem.monitoring.Humio**
- **diagrams.onprem.monitoring.Newrelic**
- **diagrams.onprem.monitoring.PrometheusOperator**
- **diagrams.onprem.monitoring.Prometheus**
- **diagrams.onprem.monitoring.Sentry**

@ -14,6 +14,7 @@ Node classes list of programming provider.
- **diagrams.programming.framework.Flask**
- **diagrams.programming.framework.Flutter**
- **diagrams.programming.framework.Laravel**
- **diagrams.programming.framework.Micronaut**
- **diagrams.programming.framework.Rails**
- **diagrams.programming.framework.React**
- **diagrams.programming.framework.Spring**

@ -7,6 +7,7 @@ Node classes list of saas provider.
## saas.alerting
- **diagrams.saas.alerting.Newrelic**
- **diagrams.saas.alerting.Opsgenie**
- **diagrams.saas.alerting.Pushover**
@ -41,6 +42,7 @@ Node classes list of saas provider.
## saas.logging
- **diagrams.saas.logging.Datadog**, **DataDog** (alias)
- **diagrams.saas.logging.Newrelic**, **NewRelic** (alias)
- **diagrams.saas.logging.Papertrail**
## saas.media

8
poetry.lock generated

@ -91,7 +91,7 @@ immutables = ">=0.9"
[[package]]
name = "graphviz"
version = "0.15"
version = "0.16"
description = "Simple Python interface for Graphviz"
category = "main"
optional = false
@ -333,7 +333,7 @@ testing = ["jaraco.itertools", "func-timeout"]
[metadata]
lock-version = "1.1"
python-versions = "^3.6"
content-hash = "eaea28dae44851f383c06f8bd558a612247dac283eba0a4de6cdc55ff6b98677"
content-hash = "6cb154d248e0d13adbb5229f52d1c1ab9ce2ea9cfe54091cf34cd97ccb822653"
[metadata.files]
appdirs = [
@ -368,8 +368,8 @@ contextvars = [
{file = "contextvars-2.4.tar.gz", hash = "sha256:f38c908aaa59c14335eeea12abea5f443646216c4e29380d7bf34d2018e2c39e"},
]
graphviz = [
{file = "graphviz-0.15-py2.py3-none-any.whl", hash = "sha256:403b55553b235875fa521023a06d9c29b46f3a956f960d4e0a5b956bca9eb9ce"},
{file = "graphviz-0.15.zip", hash = "sha256:2b85f105024e229ec330fe5067abbe9aa0d7708921a585ecc2bf56000bf5e027"},
{file = "graphviz-0.16-py2.py3-none-any.whl", hash = "sha256:3cad5517c961090dfc679df6402a57de62d97703e2880a1a46147bb0dc1639eb"},
{file = "graphviz-0.16.zip", hash = "sha256:d2d25af1c199cad567ce4806f0449cb74eb30cf451fd7597251e1da099ac6e57"},
]
immutables = [
{file = "immutables-0.11-cp35-cp35m-macosx_10_13_x86_64.whl", hash = "sha256:bce27277a2fe91509cca69181971ab509c2ee862e8b37b09f26b64f90e8fe8fb"},

@ -11,7 +11,7 @@ include = ["resources/**/*"]
[tool.poetry.dependencies]
python = "^3.6"
graphviz = ">=0.13.2,<0.16.0"
graphviz = ">=0.13.2,<0.17.0"
jinja2 = "^2.10"
contextvars = { version = "^2.4", python = "~3.6" }

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@ -2,7 +2,7 @@ import os
import sys
from typing import Iterable
from jinja2 import Environment, FileSystemLoader, Template
from jinja2 import Environment, FileSystemLoader, Template, exceptions
import config as cfg
from . import app_root_dir, doc_root_dir, resource_dir, template_dir
@ -41,7 +41,12 @@ def gen_classes(pvd: str, typ: str, paths: Iterable[str]) -> str:
def gen_apidoc(pvd: str, typ_paths: dict) -> str:
tmpl = load_tmpl(cfg.TMPL_APIDOC)
try:
default_tmp = cfg.TMPL_APIDOC.split('.')
tmpl_file = f"{default_tmp[0]}_{pvd}.{default_tmp[1]}"
tmpl = load_tmpl(tmpl_file)
except exceptions.TemplateNotFound:
tmpl = load_tmpl(cfg.TMPL_APIDOC)
# TODO: remove
def _gen_class_name(path: str) -> str:

@ -0,0 +1,6 @@
---
id: {{ pvd }}
title: {{ pvd|up_or_title(pvd) }}
---
For a full example check: [Here](https://diagrams.mingrammer.com/docs/getting-started/examples#rabbitmq-consumers-with-custom-nodes).

@ -32,6 +32,9 @@
"nodes/azure": {
"title": "Azure"
},
"nodes/custom": {
"title": "Custom"
},
"nodes/elastic": {
"title": "Elastic"
},

@ -24,7 +24,8 @@
"nodes/elastic",
"nodes/generic",
"nodes/programming",
"nodes/saas"
"nodes/saas",
"nodes/custom"
]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Loading…
Cancel
Save