Skip to content

Commit

Permalink
feat: add redis node
Browse files Browse the repository at this point in the history
  • Loading branch information
tsypuk committed Jan 8, 2024
1 parent a65eec1 commit 09c2085
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/docs/aws-components/output/drawio/redis.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:redis:arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94" value="&lt;b&gt;Name&lt;/b&gt;: arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94&lt;BR&gt;&lt;b&gt;ARN&lt;/b&gt;: arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;connectivity&lt;/b&gt;: CONNECTED&lt;BR&gt;&lt;b&gt;cluster_nodes&lt;/b&gt;: 3&lt;BR&gt;&lt;b&gt;volume&lt;/b&gt;: 15GB" style="sketch=0;aspect=fixed;html=1;align=left;image;fontSize=12;image=img/lib/mscae/Cache_Redis_Product.svg;labelBackgroundColor=none;" parent="1" vertex="1">
<mxGeometry width="50" height="42" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file added docs/docs/aws-components/output/jpg/redis.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions docs/docs/aws-components/redis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
layout: default
title: Redis
parent: AWS Components
nav_order: 3
date: 2024-01-08
---

# Redis
{: .d-inline-block .no_toc }

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

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

1. TOC
{:toc}

---


## Node Type: ``redis``

## Rendering:

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

## Code Snippet:

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

## drawio redis vertex:

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

## Advanced for Geeks:

### Style:
```html
style="sketch=0;aspect=fixed;html=1;align=left;image;fontSize=12;image=img/lib/mscae/Cache_Redis_Product.svg;labelBackgroundColor=none;"
```

| attribute | value |
|:----------|:------|
|align| left |
|aspect| fixed |
|fontSize| 12 |
|html| 1 |
|image| |
|image| img/lib/mscae/Cache_Redis_Product.svg |
|labelBackgroundColor| none |
|sketch| 0 |

### Vertex size:

| attribute | value |
|:---------|:-----------|
| width | 50 |
| height |42|

### 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:redis:arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94" value="&lt;b&gt;Name&lt;/b&gt;: arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94&lt;BR&gt;&lt;b&gt;ARN&lt;/b&gt;: arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;connectivity&lt;/b&gt;: CONNECTED&lt;BR&gt;&lt;b&gt;cluster_nodes&lt;/b&gt;: 3&lt;BR&gt;&lt;b&gt;volume&lt;/b&gt;: 15GB" style="sketch=0;aspect=fixed;html=1;align=left;image;fontSize=12;image=img/lib/mscae/Cache_Redis_Product.svg;labelBackgroundColor=none;" parent="1" vertex="1">
<mxGeometry width="50" height="42" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
```

### drawio file:

Download generated ``redis.drawio``:

[Download](output/drawio/redis.drawio){: .btn .btn-purple }
7 changes: 7 additions & 0 deletions multicloud_diagrams/providers/aws.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,12 @@
"height": "78",
"version": "0.3.20",
"desc": "Managed Kafka Service"
},
"redis": {
"style": "sketch=0;aspect=fixed;html=1;align=left;image;fontSize=12;image=img/lib/mscae/Cache_Redis_Product.svg;labelBackgroundColor=none;",
"width": "50",
"height": "42",
"version": "0.3.20",
"desc": "Redis"
}
}
36 changes: 36 additions & 0 deletions tests/aws/test_redis.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_redis_service(self):
# docs
self.node_type = 'redis'

# given
mcd = MultiCloudDiagrams()

# when
kafka_arn = 'arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94'
kafka_name = 'arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94'
metadata = {
"connectivity": "CONNECTED",
"cluster_nodes": "3",
"volume": "15GB",
}
mcd.add_vertex(node_id=kafka_arn, node_name=kafka_name, node_type='redis', metadata=metadata)

# then
expected = {'id': 'vertex:redis:arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94',
'parent': '1',
'style': 'sketch=0;aspect=fixed;html=1;points=[];align=left;image;fontSize=12;image=img/lib/mscae/Cache_Redis_Product.svg;',
'value': '<b>Name</b>: '
'arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94<BR><b>ARN</b>: '
'arn:aws:redis:eu-west-1:123456789012/redis/562320f29dbdc94<BR>-----------<BR><b>connectivity</b>: '
'CONNECTED<BR><b>cluster_nodes</b>: 3<BR><b>volume</b>: 15GB',
'vertex': '1'}
self.verify_resource(expected, mcd.mx_file, 'redis', self.node_type)

# docs
self.mcd = mcd

0 comments on commit 09c2085

Please sign in to comment.