from diagrams import Diagram, Cluster from diagrams.onprem.vcs import Github from diagrams.azure.security import KeyVaults from diagrams.azure.devops import ApplicationInsights from diagrams.azure.compute import FunctionApps from diagrams.azure.storage import StorageAccounts, BlobStorage graph_attr = {"bgcolor": "white", "pad": "0.5"} with Diagram("Azure Stack Hub MarketPlace RSS Feed", graph_attr=graph_attr, filename="architecture", show=False): gh = Github("MarketPlace Changelog page") with Cluster("Azure Services"): func = FunctionApps("Functions App") appinsight = ApplicationInsights("Application Insights") kv = KeyVaults("Keyvault") with Cluster("Storage"): sc = StorageAccounts("Storage Account") blob = BlobStorage("rss/feed.xml") gh >> func >> sc sc - blob appinsight >> func << kv
from diagrams import Cluster, Diagram from diagrams.gcp.network import DNS from diagrams.azure.web import AppServices from diagrams.azure.database import DatabaseForMysqlServers from diagrams.azure.compute import FunctionApps from diagrams.azure.database import CosmosDb with Diagram("", show=False): dns = DNS("dns (GCP)") with Cluster("azure_virtual_network internal-it"): with Cluster("azurerm_subnet public"): snipe_it_web = AppServices("snipe-it") stns_api = FunctionApps("stns-api") with Cluster("azurerm_subnet db"): rdb = DatabaseForMysqlServers("snipe-it-db") cosmos_db = CosmosDb("stnd-db") dns >> snipe_it_web >> rdb dns >> stns_api >> cosmos_db
from diagrams import Cluster, Diagram from diagrams.azure.web import AppServices from diagrams.azure.database import SQLDatabases from diagrams.azure.web import APIConnections from diagrams.azure.compute import FunctionApps from diagrams.azure.mobile import AppServiceMobile from diagrams.programming.framework import React graph_attr = {"fontsize": "45", "bgcolor": "transparent"} with Diagram("Cashback", show=True, graph_attr=graph_attr, direction="TB"): with Cluster("Internal"): with Cluster("Azure"): checkSupplier = FunctionApps("Push Notification") apiRestFul = AppServices("ApiRestFul") sqlServerDataBase = SQLDatabases("Database") apiRestFul >> sqlServerDataBase with Cluster("Aplicativos"): reactAppClient = AppServiceMobile("App Cliente") reactAppParnet = AppServiceMobile("App Parceiro") with Cluster("External"): agendamentoApi = APIConnections("Agendamento") carteiraApi = APIConnections("Pagamento Api") cashBackApi = APIConnections("CashBack Api") reactAppClient >> apiRestFul reactAppParnet >> apiRestFul apiRestFul << checkSupplier
from diagrams.azure.compute import FunctionApps graph_attr = { "fontsize": "45" } react_url = "http://assets.stickpng.com/images/584830f5cef1014c0b5e4aa1.png" react_icon = "react.png" urlretrieve(react_url, react_icon) with Diagram("Marketplace", show=True, graph_attr=graph_attr): apiSupplier = APIConnections("Supplier Api") sapConnection = APIConnections("Order Creation") with Cluster("Azure"): checkSupplier = FunctionApps("Get Products") checkSAPStatus = FunctionApps("Order Status") apiRestFul = AppServices("ApiRestFul") sqlServerDataBase = SQLDatabases("Database") reactFrontend = Custom("WebApp", react_icon) checkSupplier >> apiRestFul reactFrontend >> apiRestFul apiRestFul << checkSAPStatus apiRestFul >> sqlServerDataBase apiSupplier << checkSupplier checkSAPStatus >> sapConnection apiRestFul >> sapConnection
"ML integrated into website", show=False, graph_attr=graph_attr, ): storage = DataLakeStorage("Historical Data", pin="true", pos="0,4") with Cluster(label="Modelling Pipeline"): ml_ws = MachineLearningServiceWorkspaces("ML Workspace", pin="true", pos="0,8") acr = ContainerRegistries("Container Registry", pin="true", pos="3,8") with Cluster("Data pipeline"): cache = CacheForRedis("Real-time DB", pin="true", pos="6,0") cache_function = FunctionApps("Update Cache Function", width="0.7", pin="true", pos="0,0") with Cluster("Prediction pipeline"): website = AppServiceEnvironments("Website", pin="true", pos="9,4") scoring_container = ContainerInstances("Real-time Scoring API", pin="true", pos="3,4") predict_function = FunctionApps("User profile enrichment", width="0.7", pin="true", pos="6,4") # storage connections storage << Edge(label="Read Training data", color="blue") << ml_ws >> Edge( label="Image with trained model", style="dashed") >> acr
#solution.py from diagrams import Diagram from diagrams.azure.integration import APIManagement from diagrams.azure.compute import FunctionApps from diagrams.azure.database import CosmosDb from diagrams.azure.network import TrafficManagerProfiles graph_attr = {"fontsize": "2", "bgcolor": "transparent"} with Diagram("Label Promo Pool", show=False, direction="TB"): tfm = TrafficManagerProfiles("Traffic Manager") apim1 = APIManagement("API-Management-UKsouth") apim2 = APIManagement("API-Management-UKwest") db = CosmosDb("db") worker1 = FunctionApps("Label-API") worker2 = FunctionApps("Label-API") worker3 = FunctionApps("Label-API") tfm >> apim1 tfm >> apim2 apim1 >> worker1 apim1 >> worker2 apim1 >> worker3 apim2 >> worker1 apim2 >> worker2 apim2 >> worker3 worker1 >> db worker2 >> db worker3 >> db
with Cluster("Hadoop", graph_attr=graph_attr): beam = Beam("\nBeam") airflow = Airflow("\nAirflow") sqoop = Hadoop("\nSqoop") beam - [airflow] - sqoop pig = Hadoop("\nPig") hive = Hive("\nHive") nifi = Nifi("\nNiFi") pig - [hive] - nifi with Cluster("Classic ETL", graph_attr=graph_attr): sql = Mssql("\nSSIS") abinitio = DataTransfer("\nAb Initio") embulk = Embulk("\nEmbulk") informatica = DataTransfer("\nInformatica") embulk - [abinitio] sql - [informatica] with Cluster("Cloud", graph_attr=graph_attr): with Cluster("Azure", graph_attr=graph_attr): adf = DataFactories("\nData\nFactory") azdatabricks = Databricks("\nDatabricks") polybase = SQLDatawarehouse("\nPolyBase\nin Synapse") fn = FunctionApps("\nAzure\nFunctions") adf - [azdatabricks] polybase - [fn] with Cluster("AWS", graph_attr=graph_attr): glue = Glue("\nGlue") awsdatabricks = Databricks("\nDatabricks") l = Lambda("\nLambda") glue - [awsdatabricks] l
from diagrams import Cluster, Diagram, Edge from diagrams.custom import Custom from diagrams.onprem.compute import Server from diagrams.azure.compute import FunctionApps img_watson_ui = "watson-ui.png" img_weather = "hg-weather.png" with Diagram("Chatbot - Messenger", show=False, direction="TB"): watson_ui = Custom("Watson UI", img_watson_ui) chatbot_api = FunctionApps("API Chatbot") weather = Custom("HG weather", img_weather) watson_ui >> Edge(color="Orange", label=" /webhook") >> chatbot_api >> weather