Skip to content

Commit

Permalink
feat: add managed kafka service
Browse files Browse the repository at this point in the history
  • Loading branch information
tsypuk committed Jan 8, 2024
1 parent dccb771 commit 5eaa391
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 0 deletions.
100 changes: 100 additions & 0 deletions docs/docs/aws-components/kafka.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
layout: default
title: Managed Kafka Service
parent: AWS Components
nav_order: 3
date: 2024-01-08
---

# Managed Kafka Service
{: .d-inline-block .no_toc }

New (v0.3.20)
{: .label .label-green }

## Table of contents
{: .no_toc .text-delta }

1. TOC
{:toc}

---


## Node Type: ``kafka``

## Rendering:

![lambda](output/jpg/kafka.jpg)

## Code Snippet:

```python
{% root_include_snippet ../tests/aws/test_kafka.py %}
```

## drawio kafka vertex:

```xml
<mxCell id="vertex:kafka:arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94" parent="1" vertex="1">
<mxGeometry width="78" height="78" as="geometry"/>
</mxCell>
```
---

## Advanced for Geeks:

### Style:
```html
style="sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=#945DF2;gradientDirection=north;fillColor=#5A30B5;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.managed_streaming_for_kafka;"
```

| attribute | value |
|:----------|:------|
|align| left |
|aspect| fixed |
|dashed| 0 |
|fillColor| #5A30B5 |
|fontColor| #232F3E |
|fontSize| 12 |
|fontStyle| 0 |
|gradientColor| #945DF2 |
|gradientDirection| north |
|html| 1 |
|outlineConnect| 0 |
|resIcon| mxgraph.aws4.managed_streaming_for_kafka |
|shape| mxgraph.aws4.resourceIcon |
|sketch| 0 |
|strokeColor| #ffffff |
|verticalAlign| top |
|verticalLabelPosition| bottom |

### Vertex size:

| attribute | value |
|:---------|:-----------|
| width | 78 |
| height |78|

### Full XML dump:
```xml
<mxfile host="multicloud-diagrams" agent="PIP package multicloud-diagrams. Generate resources in draw.io compatible format for Cloud infrastructure. Copyrights @ Roman Tsypuk 2023. MIT license." type="MultiCloud">
<diagram id="diagram_1" name="AWS components">
<mxGraphModel dx="1015" dy="661" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="vertex:kafka:arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94" value="&lt;b&gt;Name&lt;/b&gt;: arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94&lt;BR&gt;&lt;b&gt;ARN&lt;/b&gt;: arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;connectivity&lt;/b&gt;: CONNECTED&lt;BR&gt;&lt;b&gt;topics&lt;/b&gt;: 13&lt;BR&gt;&lt;b&gt;messages&lt;/b&gt;: 2048" style="sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=#945DF2;gradientDirection=north;fillColor=#5A30B5;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.managed_streaming_for_kafka;" parent="1" vertex="1">
<mxGeometry width="78" height="78" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
```

### drawio file:

Download generated ``kafka.drawio``:

[Download](output/drawio/kafka.drawio){: .btn .btn-purple }
13 changes: 13 additions & 0 deletions docs/docs/aws-components/output/drawio/kafka.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<mxfile host="multicloud-diagrams" agent="PIP package multicloud-diagrams. Generate resources in draw.io compatible format for Cloud infrastructure. Copyrights @ Roman Tsypuk 2023. MIT license." type="MultiCloud">
<diagram id="diagram_1" name="AWS components">
<mxGraphModel dx="1015" dy="661" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="vertex:kafka:arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94" value="&lt;b&gt;Name&lt;/b&gt;: arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94&lt;BR&gt;&lt;b&gt;ARN&lt;/b&gt;: arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;connectivity&lt;/b&gt;: CONNECTED&lt;BR&gt;&lt;b&gt;topics&lt;/b&gt;: 13&lt;BR&gt;&lt;b&gt;messages&lt;/b&gt;: 2048" style="sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=#945DF2;gradientDirection=north;fillColor=#5A30B5;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.managed_streaming_for_kafka;" parent="1" vertex="1">
<mxGeometry width="78" height="78" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file added docs/docs/aws-components/output/jpg/kafka.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions multicloud_diagrams/providers/aws.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,12 @@
"height": "78",
"version": "0.3.17",
"desc": "Elastic Compute Cloud"
},
"kafka": {
"style": "sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=#945DF2;gradientDirection=north;fillColor=#5A30B5;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.managed_streaming_for_kafka;",
"width": "78",
"height": "78",
"version": "0.3.20",
"desc": "Managed Kafka Service"
}
}
36 changes: 36 additions & 0 deletions tests/aws/test_kafka.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from multicloud_diagrams import MultiCloudDiagrams
from utils.templating import TestRendering


class TestAWSVertexInIsolation(TestRendering):

def test_kafka_service(self):
# docs
self.node_type = 'kafka'

# given
mcd = MultiCloudDiagrams()

# when
kafka_arn = 'arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94'
kafka_name = 'arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94'
metadata = {
"connectivity": "CONNECTED",
"topics": "13",
"messages": "2048",
}
mcd.add_vertex(node_id=kafka_arn, node_name=kafka_name, node_type='kafka', metadata=metadata)

# then
expected = {'id': 'vertex:kafka:arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94',
'parent': '1',
'style': 'sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=#945DF2;gradientDirection=north;fillColor=#5A30B5;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.managed_streaming_for_kafka;',
'value': '<b>Name</b>: '
'arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94<BR><b>ARN</b>: '
'arn:aws:mks:eu-west-1:123456789012/kafka/562320f29dbdc94<BR>-----------<BR><b>connectivity</b>: '
'CONNECTED<BR><b>topics</b>: 13<BR><b>messages</b>: 2048',
'vertex': '1'}
self.verify_resource(expected, mcd.mx_file, 'kafka', self.node_type)

# docs
self.mcd = mcd

0 comments on commit 5eaa391

Please sign in to comment.