Skip to content

Commit

Permalink
feat: doc generated from tests with code snapshots, images and xml du…
Browse files Browse the repository at this point in the history
…mps (lambda, sqs, sns, dynamo, apigw)
  • Loading branch information
tsypuk committed Aug 7, 2023
1 parent 1324d51 commit bd9d407
Show file tree
Hide file tree
Showing 32 changed files with 688 additions and 92 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ dist/
/__pycache__/
*/__pycache__
tests/__pycache__/
tests/*/__pycache__/
samples/tests/__pycache__/
*/tests/__pycache__/

multicloud_diagrams/__pycache__/
*.iml


#docs/docs/aws-components/output/jpg/
#docs/docs/aws-components/output/drawio/
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ endef

.PHONY: run

doc:
doc: test images
$(call colorecho, "Starting Documentation locally...")
cd docs && bundle exec just-the-docs rake search:init \
cd docs && bundle exec jekyll serve --trace

images:
/Applications/draw.io.app/Contents/MacOS/draw.io -q 100 -x -f jpg -r -o docs/docs/aws-components/output/jpg docs/docs/aws-components/output/drawio


landscape:
$(call colorecho, "Generating new Landscape...")
cd samples && poetry run python landscape.py
Expand All @@ -30,6 +34,7 @@ changelog: test
test:
$(call colorecho, "Run all Tests...")
poetry run python -m unittest -v tests/*.py
poetry run python -m unittest -v tests/aws/*.py
$(call colorecho, "Run flakehell lint...")
poetry run flakehell lint

Expand Down
18 changes: 18 additions & 0 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@
{% include components/breadcrumbs.html %}
<div id="main-content" class="main-content">
<main>

{% if site.last_edit_timestamp%}
<div class="d-flex mt-2">
{% if site.last_edit_timestamp and site.last_edit_time_format and page.date %}
<p class="text-small text-grey-dk-000 mb-0 mr-2">
{% assign page_create_date = page.date | date: "%Y-%m-%d" %}
{% assign page_file_update_date = page.path | file_date | date: "%Y-%m-%d" %}

Created: <span class="d-inline-block">{{ page_create_date }}</span>
{% if page_create_date != page_file_update_date %}
|
Updated: {{ page_file_update_date }}
{% endif %}
</p>
{% endif %}
</div>
{% endif %}

{% if site.heading_anchors != false %}
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
{% else %}
Expand Down
86 changes: 86 additions & 0 deletions docs/docs/aws-components/api_gw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
layout: default
title: API Gateway
parent: AWS Components
nav_order: 1
date: 2023-08-06
---

# API Gateway
{: .d-inline-block }

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

## Node Type: ``api_gw``

## Code Snippet:

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

## Rendering:

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


## drawio api_gw vertex:

```xml
<?xml version="1.0" ?>
<mxCell id="vertex:api_gw:esf19s3pag" parent="1" vertex="1">

<mxGeometry width="76.5" height="93" as="geometry"/>

</mxCell>

```

## Advanced for Geeks:

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

| width | height |
|:----------|:---------|
| 76.5 | 93|

### Full XML dump:
```xml
<?xml version="1.0" ?>
<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:api_gw:esf19s3pag" parent="1" vertex="1">

<mxGeometry width="76.5" height="93" as="geometry"/>

</mxCell>

</root>

</mxGraphModel>

</diagram>
</mxfile>

```

### drawio file:

Download generated ``api_gw.drawio``:

[Download](output/drawio/api_gw.drawio){: .btn .btn-purple }
3 changes: 2 additions & 1 deletion docs/docs/aws-components/aws-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ title: AWS Components
nav_order: 4
has_children: true
permalink: /docs/aws-components
date: 2023-08-06
---

# AWS Components

To make it as easy as possible to write documentation in plain Markdown, most UI components are styled using default Markdown elements with few additional CSS classes needed.
This is a comprehensive library that provides support for various AWS services. The library is regularly updated, allowing you to keep track of when each AWS service was added and supported in different versions.
{: .fs-6 .fw-300 }
76 changes: 65 additions & 11 deletions docs/docs/aws-components/dynamo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
layout: default
title: DynamoDB
parent: AWS Components
nav_order: 2
nav_order: 1
date: 2023-08-06
---

# DynamoDB
Expand All @@ -11,22 +12,75 @@ nav_order: 2
New (v0.2.0)
{: .label .label-green }

## Node Type: ``dynamo``

## Code Snippet:

```python
{% root_include ../tests/aws/test_dynamo.py 11:22 %}
{% root_include_snippet ../tests/aws/test_dynamo.py %}
```

## Rendering:

<div class="code-example" markdown="1">
![lambda](output/jpg/dynamo.jpg)


## drawio dynamo vertex:

```xml
<?xml version="1.0" ?>
<mxCell id="vertex:dynamo:arn:aws:dynamodb:eu-west-1:123456789012:table/prod-dynamo-table" parent="1" vertex="1">

<mxGeometry width="72" height="81" as="geometry"/>

</mxCell>

```

## Advanced for Geeks:

### Style:
```html
style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;shape=mxgraph.aws3.dynamo_db;fillColor=#2E73B8;gradientColor=none;"
```
### Vertex size:

| width | height |
|:----------|:---------|
| 72 | 81|

### Full XML dump:
```xml
<?xml version="1.0" ?>
<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:dynamo:arn:aws:dynamodb:eu-west-1:123456789012:table/prod-dynamo-table" parent="1" vertex="1">

<mxGeometry width="72" height="81" as="geometry"/>

</mxCell>

</root>

</mxGraphModel>

</diagram>
</mxfile>

```

### drawio file:

| head1 | head two | three |
|:-------------|:------------------|:------|
| ok | good swedish fish | nice |
| out of stock | good and plenty | nice |
| ok | good `oreos` | hmm |
| ok | good `zoute` drop | yumm |
Download generated ``dynamo.drawio``:

TODO: add image here
</div>
[Download](output/drawio/dynamo.drawio){: .btn .btn-purple }
20 changes: 0 additions & 20 deletions docs/docs/aws-components/lambda.md

This file was deleted.

86 changes: 86 additions & 0 deletions docs/docs/aws-components/lambda_function.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
layout: default
title: Lambda Function
parent: AWS Components
nav_order: 1
date: 2023-08-06
---

# Lambda Function
{: .d-inline-block }

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

## Node Type: ``lambda_function``

## Code Snippet:

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

## Rendering:

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


## drawio lambda_function vertex:

```xml
<?xml version="1.0" ?>
<mxCell id="vertex:lambda_function:arn:aws:lambda:eu-west-1:123456789012:function:producer-lambda" parent="1" vertex="1">

<mxGeometry width="69" height="72" as="geometry"/>

</mxCell>

```

## Advanced for Geeks:

### Style:
```html
style="verticalLabelPosition=bottom;html=1;verticalAlign=top;aspect=fixed;align=left;pointerEvents=1;shape=mxgraph.aws3.lambda_function;prIcon=server;fillColor=#F58534;gradientColor=none;html=1;"
```
### Vertex size:

| width | height |
|:----------|:---------|
| 69 | 72|

### Full XML dump:
```xml
<?xml version="1.0" ?>
<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:lambda_function:arn:aws:lambda:eu-west-1:123456789012:function:producer-lambda" parent="1" vertex="1">

<mxGeometry width="69" height="72" as="geometry"/>

</mxCell>

</root>

</mxGraphModel>

</diagram>
</mxfile>

```

### drawio file:

Download generated ``lambda_function.drawio``:

[Download](output/drawio/lambda_function.drawio){: .btn .btn-purple }
13 changes: 13 additions & 0 deletions docs/docs/aws-components/output/drawio/api_gw.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:api_gw:esf19s3pag" value="&lt;b&gt;Name&lt;/b&gt;: APIGW integration with DynamoDB&lt;BR&gt;&lt;b&gt;ARN&lt;/b&gt;: esf19s3pag&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;api_key_source&lt;/b&gt;: HEADER&lt;BR&gt;&lt;b&gt;endpoint_configuration&lt;/b&gt;: {'types': ['EDGE']}" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;shape=mxgraph.aws3.api_gateway;fillColor=#D9A741;gradientColor=none;" parent="1" vertex="1">
<mxGeometry width="76.5" height="93" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
13 changes: 13 additions & 0 deletions docs/docs/aws-components/output/drawio/dynamo.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:dynamo:arn:aws:dynamodb:eu-west-1:123456789012:table/prod-dynamo-table" value="&lt;b&gt;Name&lt;/b&gt;: prod-dynamo-table&lt;BR&gt;&lt;b&gt;ARN&lt;/b&gt;: arn:aws:dynamodb:eu-west-1:123456789012:table/prod-dynamo-table&lt;BR&gt;-----------&lt;BR&gt;&lt;b&gt;DeletionProtectionEnabled&lt;/b&gt;: True&lt;BR&gt;&lt;b&gt;ItemCount&lt;/b&gt;: 900&lt;BR&gt;&lt;b&gt;TableSizeBytes&lt;/b&gt;: 123" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;shape=mxgraph.aws3.dynamo_db;fillColor=#2E73B8;gradientColor=none;" parent="1" vertex="1">
<mxGeometry width="72" height="81" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

0 comments on commit bd9d407

Please sign in to comment.