Skip to content

Commit

Permalink
feat: add tests, documentation for ecr, github_code, git_repository n…
Browse files Browse the repository at this point in the history
…odes
  • Loading branch information
tsypuk committed Jan 15, 2024
1 parent 719964c commit 675d703
Show file tree
Hide file tree
Showing 13 changed files with 417 additions and 7 deletions.
92 changes: 92 additions & 0 deletions docs/docs/aws-components/ecr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
layout: default
title: Elastic Container Registry
parent: AWS Components
nav_order: 3
date: 2024-01-15
---

# Elastic Container Registry
{: .d-inline-block .no_toc }

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

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

1. TOC
{:toc}

---


## Node Type: ``ecr``

## Rendering:

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

## Code Snippet:

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

## drawio ecr vertex:

```xml
<mxCell id="vertex:ecr:arn:i-1234567890abcdef0" parent="1" vertex="1">
<mxGeometry width="69" height="72" as="geometry"/>
</mxCell>
```
---

## Advanced for Geeks:

### Style:
```html
style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;shape=mxgraph.aws3.ecr;fillColor=#F58534;gradientColor=none;"
```

| attribute | value |
|:----------|:------|
|align| left |
|dashed| 0 |
|fillColor| #F58534 |
|gradientColor| none |
|html| 1 |
|outlineConnect| 0 |
|shape| mxgraph.aws3.ecr |
|verticalAlign| top |
|verticalLabelPosition| bottom |

### Vertex size:

| attribute | value |
|:---------|:-----------|
| width | 69 |
| height |72|

### 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:ecr:arn:i-1234567890abcdef0" value="&lt;b&gt;Name&lt;/b&gt;: Registry for images&lt;BR&gt;&lt;b&gt;ARN&lt;/b&gt;: arn:i-1234567890abcdef0&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;images&lt;/b&gt;: 23&lt;BR&gt;&lt;b&gt;ImageId&lt;/b&gt;: ami-0abcdef1234567890&lt;BR&gt;&lt;b&gt;multiarch&lt;/b&gt;: 13" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;shape=mxgraph.aws3.ecr;fillColor=#F58534;gradientColor=none;" parent="1" vertex="1">
<mxGeometry width="69" height="72" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
```

### drawio file:

Download generated ``ecr.drawio``:

[Download](output/drawio/ecr.drawio){: .btn .btn-purple }
13 changes: 13 additions & 0 deletions docs/docs/aws-components/output/drawio/ecr.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:ecr:arn:i-1234567890abcdef0" value="&lt;b&gt;Name&lt;/b&gt;: Registry for images&lt;BR&gt;&lt;b&gt;ARN&lt;/b&gt;: arn:i-1234567890abcdef0&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;images&lt;/b&gt;: 23&lt;BR&gt;&lt;b&gt;ImageId&lt;/b&gt;: ami-0abcdef1234567890&lt;BR&gt;&lt;b&gt;multiarch&lt;/b&gt;: 13" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;shape=mxgraph.aws3.ecr;fillColor=#F58534;gradientColor=none;" parent="1" vertex="1">
<mxGeometry width="69" height="72" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file added docs/docs/aws-components/output/jpg/ecr.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions docs/docs/onprem-components/git_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
layout: default
title: Git Repository
parent: ONPREM Components
nav_order: 3
date: 2024-01-15
---

# Git Repository
{: .d-inline-block .no_toc }

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

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

1. TOC
{:toc}

---


## Node Type: ``git_repository``

## Rendering:

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

## Code Snippet:

```python
{% root_include_snippet ../tests/onprem/test_git_repository.py %}
```

## drawio git_repository vertex:

```xml
<mxCell id="vertex:git_repository:arn:aws:code:eu-west-1:123456789012:repo/123" parent="1" vertex="1">
<mxGeometry width="50" height="50" as="geometry"/>
</mxCell>
```
---

## Advanced for Geeks:

### Style:
```html
style="verticalLabelPosition=bottom;html=1;verticalAlign=top;align=left;strokeColor=none;fillColor=#00BEF2;shape=mxgraph.azure.git_repository;"
```

| attribute | value |
|:----------|:------|
|align| left |
|fillColor| #00BEF2 |
|html| 1 |
|shape| mxgraph.azure.git_repository |
|strokeColor| none |
|verticalAlign| top |
|verticalLabelPosition| bottom |

### Vertex size:

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

### 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:git_repository:arn:aws:code:eu-west-1:123456789012:repo/123" value="&lt;b&gt;Name&lt;/b&gt;: git_repository&lt;BR&gt;&lt;b&gt;ID&lt;/b&gt;: arn:aws:code:eu-west-1:123456789012:repo/123&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;name&lt;/b&gt;: my-repo&lt;BR&gt;&lt;b&gt;image&lt;/b&gt;: 123456789012.dkr.ecr.eu-west-1.amazonaws.com/cluster/myapp:v2-22-00&lt;BR&gt;&lt;b&gt;imageDigest&lt;/b&gt;: sha256:5562sfsf60a6d1aaed5c2bb227d3d4ec14c755bdb446349b" style="verticalLabelPosition=bottom;html=1;verticalAlign=top;align=left;strokeColor=none;fillColor=#00BEF2;shape=mxgraph.azure.git_repository;" parent="1" vertex="1">
<mxGeometry width="50" height="50" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
```

### drawio file:

Download generated ``git_repository.drawio``:

[Download](output/drawio/git_repository.drawio){: .btn .btn-purple }
91 changes: 91 additions & 0 deletions docs/docs/onprem-components/github_code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
layout: default
title: Github code
parent: ONPREM Components
nav_order: 3
date: 2024-01-15
---

# Github code
{: .d-inline-block .no_toc }

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

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

1. TOC
{:toc}

---


## Node Type: ``github_code``

## Rendering:

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

## Code Snippet:

```python
{% root_include_snippet ../tests/onprem/test_github_code.py %}
```

## drawio github_code vertex:

```xml
<mxCell id="vertex:github_code:arn:aws:code:eu-west-1:123456789012:repo/123" parent="1" vertex="1">
<mxGeometry width="50" height="50" as="geometry"/>
</mxCell>
```
---

## Advanced for Geeks:

### Style:
```html
style="verticalLabelPosition=bottom;html=1;verticalAlign=top;align=left;strokeColor=none;fillColor=#00BEF2;shape=mxgraph.azure.github_code;pointerEvents=1;"
```

| attribute | value |
|:----------|:------|
|align| left |
|fillColor| #00BEF2 |
|html| 1 |
|pointerEvents| 1 |
|shape| mxgraph.azure.github_code |
|strokeColor| none |
|verticalAlign| top |
|verticalLabelPosition| bottom |

### Vertex size:

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

### 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:github_code:arn:aws:code:eu-west-1:123456789012:repo/123" value="&lt;b&gt;Name&lt;/b&gt;: github_code&lt;BR&gt;&lt;b&gt;ID&lt;/b&gt;: arn:aws:code:eu-west-1:123456789012:repo/123&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;name&lt;/b&gt;: my-code&lt;BR&gt;&lt;b&gt;codeDigest&lt;/b&gt;: sha256:5562sfsf60a6d1aaed5c2bb227d3d4ec14c755bdb446349b" style="verticalLabelPosition=bottom;html=1;verticalAlign=top;align=left;strokeColor=none;fillColor=#00BEF2;shape=mxgraph.azure.github_code;pointerEvents=1;" parent="1" vertex="1">
<mxGeometry width="50" height="50" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
```

### drawio file:

Download generated ``github_code.drawio``:

[Download](output/drawio/github_code.drawio){: .btn .btn-purple }
13 changes: 13 additions & 0 deletions docs/docs/onprem-components/output/drawio/git_repository.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:git_repository:arn:aws:code:eu-west-1:123456789012:repo/123" value="&lt;b&gt;Name&lt;/b&gt;: git_repository&lt;BR&gt;&lt;b&gt;ID&lt;/b&gt;: arn:aws:code:eu-west-1:123456789012:repo/123&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;name&lt;/b&gt;: my-repo&lt;BR&gt;&lt;b&gt;image&lt;/b&gt;: 123456789012.dkr.ecr.eu-west-1.amazonaws.com/cluster/myapp:v2-22-00&lt;BR&gt;&lt;b&gt;imageDigest&lt;/b&gt;: sha256:5562sfsf60a6d1aaed5c2bb227d3d4ec14c755bdb446349b" style="verticalLabelPosition=bottom;html=1;verticalAlign=top;align=left;strokeColor=none;fillColor=#00BEF2;shape=mxgraph.azure.git_repository;" parent="1" vertex="1">
<mxGeometry width="50" height="50" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
13 changes: 13 additions & 0 deletions docs/docs/onprem-components/output/drawio/github_code.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:github_code:arn:aws:code:eu-west-1:123456789012:repo/123" value="&lt;b&gt;Name&lt;/b&gt;: github_code&lt;BR&gt;&lt;b&gt;ID&lt;/b&gt;: arn:aws:code:eu-west-1:123456789012:repo/123&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;name&lt;/b&gt;: my-code&lt;BR&gt;&lt;b&gt;codeDigest&lt;/b&gt;: sha256:5562sfsf60a6d1aaed5c2bb227d3d4ec14c755bdb446349b" style="verticalLabelPosition=bottom;html=1;verticalAlign=top;align=left;strokeColor=none;fillColor=#00BEF2;shape=mxgraph.azure.github_code;pointerEvents=1;" parent="1" vertex="1">
<mxGeometry width="50" height="50" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions multicloud_diagrams/providers/aws.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,5 @@
"height": "72",
"version": "0.3.22",
"desc": "Elastic Container Registry"
},
"ec2": {
"style": "sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=#F78E04;gradientDirection=north;fillColor=#D05C17;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.ec2;",
"width": "78",
"height": "78",
"version": "0.3.22",
"desc": "Elastic Compute Cloud"
}
}
35 changes: 35 additions & 0 deletions tests/aws/test_ecr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from multicloud_diagrams import MultiCloudDiagrams
from utils.templating import TestRendering


class TestAWSVertexInIsolation(TestRendering):

def test_ecr(self):
# docs
self.node_type = 'ecr'

# given
mcd = MultiCloudDiagrams()

# when
ecr_arn = 'arn:i-1234567890abcdef0'
ecr_name = 'Registry for images'
metadata = {
"images": 23,
"ImageId": "ami-0abcdef1234567890",
"multiarch": 13,
}
mcd.add_vertex(node_id=ecr_arn, node_name=ecr_name, node_type='ecr', metadata=metadata)

# then
expected = {'id': 'vertex:ecr:arn:i-1234567890abcdef0',
'parent': '1',
'style': 'outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;shape=mxgraph.aws3.ecr;fillColor=#F58534;gradientColor=none;',
'value': '<b>Name</b>: Registry for images<BR><b>ARN</b>: '
'arn:i-1234567890abcdef0<BR>-----------<BR><b>images</b>: '
'23<BR><b>ImageId</b>: ami-0abcdef1234567890<BR><b>multiarch</b>: 13',
'vertex': '1'}
self.verify_resource(expected, mcd.mx_file, 'ECR', self.node_type)

# docs
self.mcd = mcd

0 comments on commit 675d703

Please sign in to comment.