-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-v2): full rewrite of AWS based on the new PlantUML preprocessor
- Loading branch information
Showing
624 changed files
with
15,990 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea/ | ||
.idea/ | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# AWS V2 | ||
|
||
## Include the library | ||
|
||
Include remotely the library: | ||
```plantuml | ||
@startuml | ||
!global $AWS_LIB_BRANCH="master" | ||
!global $AWS_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/" + $AWS_LIB_BRANCH + "/aws-v2" | ||
!includeurl $AWS_LIB_BASE_URL/library.puml | ||
@enduml | ||
``` | ||
|
||
Include locally the library: | ||
```plantuml | ||
@startuml | ||
!global $INCLUSION_MODE="local" | ||
!include library.puml | ||
@enduml | ||
``` | ||
|
||
## Include the sub-libraries | ||
|
||
Additional sub-libraries can be included. | ||
|
||
```plantuml | ||
@startuml | ||
includeSubLibrary("groups") | ||
includeSubLibrary("elements/Compute") | ||
includeSubLibrary("elements/SecurityIdentityCompliance") | ||
includeSubLibrary("elements/Storage") | ||
includeSubLibrary("elements/General") | ||
@enduml | ||
``` | ||
|
||
## Sub libraries | ||
|
||
- [The Groups](groups.md) | ||
- [The Elements](elements/README.md) | ||
|
||
## Examples | ||
|
||
### Git to S3 Webhooks | ||
|
||
![example: Git to S3 Webhooks](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/aws-v2/example-git_to_s3_webhooks.puml) | ||
|
||
The source: [example-git_to_s3_webhooks.puml](example-git_to_s3_webhooks.puml) | ||
|
||
### Chef Automate Architecture on AWS | ||
|
||
![example: Chef Automate Architecture on AWS](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/aws-v2/example-chef_automate_architecture_on_aws.puml) | ||
|
||
The source: [example-chef_automate_architecture_on_aws.puml](example-chef_automate_architecture_on_aws.puml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
#!/usr/bin/env bash | ||
input_icons_type="svg" | ||
input_icons_flavor="Light" | ||
|
||
case ${input_icons_type} in | ||
svg) | ||
icons_url="https://d1.awsstatic.com/webteam/architecture-icons/AWS-Architecture-Icons_SVG_20200131.abfc4fb34450d2294f8c65d2dcc9ea1602b6a449.zip" | ||
;; | ||
png) | ||
icons_url="https://d1.awsstatic.com/webteam/architecture-icons/AWS-Architecture-Icons_PNG_20200131.361768486d709f4d0ffca86995b4bf8a7cf5b5ac.zip" | ||
;; | ||
*) | ||
echo "icons type not manged" | ||
;; | ||
esac | ||
|
||
current_dir=$(pwd) | ||
lib_dir="${current_dir}/aws-v2" | ||
tmp_dir="${lib_dir}/tmp" | ||
input_icons_zip="${tmp_dir}/icons_${input_icons_type}.zip" | ||
input_icons_dir="${tmp_dir}/AWS-Architecture-Icons-${input_icons_type}" | ||
input_icons_light_dir="${input_icons_dir}/*Light" | ||
|
||
output_icons_type="png" | ||
output_icons_x50_dir="${lib_dir}/icons-50x50" | ||
output_dir_elements="${lib_dir}/elements" | ||
git_branch="master" | ||
|
||
shopt -s globstar | ||
mkdir -p ${tmp_dir} | ||
|
||
if [[ ! -f ${input_icons_zip} ]]; then | ||
wget ${icons_url} -O ${input_icons_zip} | ||
fi | ||
|
||
if [[ ! -d "${input_icons_dir}" ]]; then | ||
unzip -q -o ${input_icons_zip} -d ${tmp_dir} | ||
mv ${tmp_dir}/AWS-Architecture-Icons_* ${input_icons_dir} | ||
rm -Rf ${tmp_dir}/__* | ||
fi | ||
|
||
# | ||
# CONVERT AWS ICONS | ||
# | ||
mkdir -p ${output_icons_x50_dir} | ||
cd ${input_icons_light_dir} | ||
for input_file in **/*.${input_icons_type}; do | ||
new_file=$(echo ${input_file} | sed -r 's/ *(&|,| ) */-/gi' | sed -r 's/--/-/gi' | sed -r 's/\/_Instance//gi') | ||
# skip extension | ||
new_file="${new_file%.*}" | ||
# skip suffix _light-bg | ||
new_file=${new_file/_light-bg/} | ||
# from `snake-case` to `CamelCase` | ||
new_file=$(echo ${new_file,,} | sed -r 's/(^|-|_|\.)([a-z,0-9])/\U\2/gi' | sed -r 's/(\/.)/\U\1/gi') | ||
# add extension | ||
new_file="${new_file}.${output_icons_type}" | ||
echo "convert $input_file -> $new_file" | ||
icons_x50="${output_icons_x50_dir}/${new_file}" | ||
mkdir -p $(dirname ${icons_x50}) | ||
if [[ ! -f ${icons_x50} ]]; then | ||
convert -quality 100 -density 1200 -background none -resize 50x50 "$input_file" ${icons_x50} | ||
fi | ||
done | ||
|
||
sync | ||
|
||
# | ||
# CONVERT ICONS TO ELEMENTS | ||
# | ||
cd ${output_icons_x50_dir} | ||
|
||
mkdir -p ${output_dir_elements} | ||
|
||
# initialize the README | ||
elements_readme_file="${output_dir_elements}/README.md" | ||
echo "# Elements" > ${elements_readme_file} | ||
echo "" >> ${elements_readme_file} | ||
|
||
for package_name in */; do | ||
package_name=${package_name%*/} | ||
|
||
echo "- [${package_name}](${package_name}.md)" >> ${elements_readme_file} | ||
|
||
# initialize the package file | ||
package_file="${output_dir_elements}/${package_name}.puml" | ||
echo "' the content of this file has been automatically generated" > ${package_file} | ||
echo "@startuml" >> ${package_file} | ||
|
||
# initialize the example file | ||
example_file="${output_dir_elements}/${package_name}.example.puml" | ||
echo "' the content of this file has been automatically generated" > ${example_file} | ||
|
||
# initialize the documentation file | ||
documentation_file="${output_dir_elements}/${package_name}.md" | ||
echo "# ${package_name}" > ${documentation_file} | ||
echo "" >> ${documentation_file} | ||
|
||
# iterate over all elements of the package | ||
index=0 | ||
for element_file in ${package_name}/*.${output_icons_type}; do | ||
element_name=$(basename ${element_file%.*}) | ||
|
||
echo " - [${element_name}](${package_name}.md#${element_name})" >> ${elements_readme_file} | ||
|
||
# library | ||
echo '!function '${element_name}'($id, $name="", $tech="")' >> ${package_file} | ||
echo ' card $id <<AwsElement>> [' >> ${package_file} | ||
echo ' <img:getIcon("'${package_name}'/'${element_name}'")>' >> ${package_file} | ||
echo ' !if ($name)' >> ${package_file} | ||
echo ' $name' >> ${package_file} | ||
echo ' !endif' >> ${package_file} | ||
echo ' !if ($tech)' >> ${package_file} | ||
echo ' <size:11>[$tech]</size>' >> ${package_file} | ||
echo ' !endif' >> ${package_file} | ||
echo ' ]' >> ${package_file} | ||
echo '!endfunction' >> ${package_file} | ||
|
||
# example | ||
echo "@startuml(id=${element_name})" >> ${example_file} | ||
echo '!global $AWS_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/'${git_branch}'/aws-v2"' >> ${example_file} | ||
echo '!includeurl $AWS_LIB_BASE_URL/library.puml' >> ${example_file} | ||
echo 'includeSubLibrary("elements/'${package_name}'")' >> ${example_file} | ||
echo ${element_name}'("element'${index}'", "an optional name", "an optional technology")' >> ${example_file} | ||
echo "@enduml" >> ${example_file} | ||
|
||
# documentation | ||
echo "## ${element_name}" >> ${documentation_file} | ||
echo '!['${element_name}'](../icons-50x50/'${element_file}')' >> ${documentation_file} | ||
echo "\`\`\`plantuml" >> ${documentation_file} | ||
echo '!global $AWS_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/'${git_branch}'/aws-v2"' >> ${documentation_file} | ||
echo '!includeurl $AWS_LIB_BASE_URL/library.puml' >> ${documentation_file} | ||
echo 'includeSubLibrary("elements/'${package_name}'")' >> ${documentation_file} | ||
echo ${element_name}'("element'${index}'", "an optional name")' >> ${documentation_file} | ||
echo "\`\`\`" >> ${documentation_file} | ||
echo '<a target="_blank" href="http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/'${git_branch}'/aws-v2/elements/'${package_name}'.example.puml&idx='${index}'&'${element_name}'">render the snippet with PlantUML server</a>' >> ${documentation_file} | ||
echo "" >> ${documentation_file} | ||
#echo '!['${element_name}'](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/'${git_branch}'/aws-v2/elements/'${package_name}'.example.puml&idx='${index}'&'${element_name}')' >> ${documentation_file} | ||
#echo "" >> ${documentation_file} | ||
|
||
index=$((index+1)) | ||
done | ||
|
||
echo "@enduml" >> ${package_file} | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/usr/bin/env bash | ||
current_dir=$(pwd) | ||
lib_dir="${current_dir}/aws-v2" | ||
tmp_dir="${lib_dir}/tmp" | ||
git_branch="master" | ||
|
||
plantuml_url=http://sourceforge.net/projects/plantuml/files/plantuml.jar/download | ||
plantuml_jar="${tmp_dir}/plantuml.jar" | ||
|
||
if [[ ! -f "${plantuml_jar}" ]]; then | ||
wget ${plantuml_url} -O ${plantuml_jar} | ||
fi | ||
|
||
# initialize the package file | ||
groups_file="${lib_dir}/groups.puml" | ||
echo "' the content of this file has been automatically generated" > ${groups_file} | ||
|
||
# initialize the example file | ||
example_file="${lib_dir}/groups.example.puml" | ||
echo "' the content of this file has been automatically generated" > ${example_file} | ||
|
||
# initialize the documentation file | ||
documentation_file="${lib_dir}/groups.md" | ||
echo "# Groups" > ${documentation_file} | ||
echo "" >> ${documentation_file} | ||
|
||
group_icons_dir="${lib_dir}/icons-50x50/GroupIcons" | ||
output_sprites="${lib_dir}/sprites.puml" | ||
if [[ ! -f ${output_sprites} ]]; then | ||
echo "' the content of this file has been automatically generated" > ${output_sprites} | ||
echo "@startuml(id=sprites)" >> ${output_sprites} | ||
cd ${group_icons_dir} | ||
for icon in *.png; do | ||
echo "sprititfy ${icon}" | ||
convert -quality 100 -resize 20x20 ${icon} ${tmp_dir}/SpriteGroup${icon} | ||
java -jar ${plantuml_jar} -encodesprite 16z ${tmp_dir}/SpriteGroup${icon} >> ${output_sprites} | ||
done | ||
echo "@enduml" >> ${output_sprites} | ||
fi | ||
|
||
echo "@startuml(id=groups)" >> ${groups_file} | ||
csv_file="${current_dir}/aws-v2/groups.csv" | ||
index=0 | ||
tail -n +2 ${csv_file} | while IFS=, read -r Name FrontColor BackgroundColor BorderThick BorderStyle BorderColor Sprite; do | ||
Stereotype="Group"$(echo ${Name,,} | sed -r 's/(^|-|_|\.| )([a-z,0-9])/\U\2/gi' | sed -r 's/(\/.)/\U\1/gi') | ||
echo "process: $Stereotype $Name $FrontColor $BackgroundColor $BorderThick $BorderStyle $BorderColor $Sprite" | ||
spriteValue="" | ||
if [[ ! -z "$Sprite" ]]; then | ||
spriteValue='<$SpriteGroup'${Sprite}'> ' | ||
fi | ||
# library | ||
echo '!function '${Stereotype}'($id, $name="'${Name}'", $tech="")' >> ${groups_file} | ||
echo ' !if ($tech)' >> ${groups_file} | ||
echo ' Rectangle $id <<'${Stereotype}'>> as "'${spriteValue}'<size:18>$name</size> <size:11><color:$COLOR_GREY>[$tech]</color></size>"' >> ${groups_file} | ||
echo ' !else' >> ${groups_file} | ||
echo ' Rectangle $id <<'${Stereotype}'>> as "'${spriteValue}'<size:18>$name</size>"' >> ${groups_file} | ||
echo ' !endif' >> ${groups_file} | ||
echo '!endfunction' >> ${groups_file} | ||
echo 'skinparam Rectangle<<'${Stereotype}'>> {' >> ${groups_file} | ||
echo ' StereotypeFontColor '${FrontColor} >> ${groups_file} | ||
echo ' BorderThickness '${BorderThick} >> ${groups_file} | ||
echo ' BorderColor '${BorderColor} >> ${groups_file} | ||
if [[ ! -z "$BorderStyle" ]]; then | ||
echo ' BorderStyle '${BorderStyle} >> ${groups_file} | ||
fi | ||
echo ' FontStyle none' >> ${groups_file} | ||
echo ' FontColor '${FrontColor} >> ${groups_file} | ||
echo ' FontSize 20' >> ${groups_file} | ||
echo ' BackgroundColor '${BackgroundColor} >> ${groups_file} | ||
echo ' shadowing false' >> ${groups_file} | ||
echo '}' >> ${groups_file} | ||
|
||
# example | ||
echo "@startuml(id=${Stereotype})" >> ${example_file} | ||
echo '!global $AWS_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/'${git_branch}'/aws-v2"' >> ${example_file} | ||
echo '!includeurl $AWS_LIB_BASE_URL/library.puml' >> ${example_file} | ||
#echo '!global $INCLUSION_MODE="local"' >> ${example_file} | ||
#echo '!include library.puml' >> ${example_file} | ||
echo 'includeSubLibrary("groups")' >> ${example_file} | ||
echo ${Stereotype}'("group", "an optional name") {' >> ${example_file} | ||
echo ' note "the group area of '${Stereotype}'" as '${Stereotype}'Note' >> ${example_file} | ||
echo '}' >> ${example_file} | ||
echo "@enduml" >> ${example_file} | ||
|
||
# documentation | ||
echo "## ${Stereotype}" >> ${documentation_file} | ||
echo "\`\`\`plantuml" >> ${documentation_file} | ||
echo '!global $AWS_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/'${git_branch}'/aws-v2"' >> ${documentation_file} | ||
echo '!includeurl $AWS_LIB_BASE_URL/library.puml' >> ${documentation_file} | ||
echo 'includeSubLibrary("groups")' >> ${documentation_file} | ||
echo ${Stereotype}'("element'${index}'", "an optional name")' >> ${documentation_file} | ||
echo "\`\`\`" >> ${documentation_file} | ||
#echo '<a target="_blank" href="http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/'${git_branch}'/aws-v2/groups.example.puml&idx='${index}'&'${Stereotype}'">'${Stereotype}'</a>' >> ${documentation_file} | ||
echo "" >> ${documentation_file} | ||
echo '!['${Stereotype}'](http://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/tmorin/plantuml-libs/master/aws-v2/groups.example.puml&idx='${index}'&'${Stereotype}')' >> ${documentation_file} | ||
echo "" >> ${documentation_file} | ||
|
||
index=$((index+1)) | ||
done | ||
|
||
echo "@enduml" >> ${groups_file} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@startuml | ||
|
||
!if (%get_variable_value("$INCLUSION_MODE") == "remote") | ||
!if (%not(%variable_exists("$AWS_LIB_BRANCH"))) | ||
!global $AWS_LIB_BRANCH="master" | ||
!endif | ||
!if (%not(%variable_exists("$AWS_LIB_BASE_URL"))) | ||
!global $AWS_LIB_BASE_URL="https://raw.githubusercontent.com/tmorin/plantuml-libs/" + $AWS_LIB_BRANCH + "/aws-v2" | ||
!endif | ||
!if (%not(%variable_exists("$IMAGE_BASE_PATH"))) | ||
!global $IMAGE_BASE_PATH=$AWS_LIB_BASE_URL + "/" | ||
!endif | ||
!else | ||
!if (%not(%variable_exists("$IMAGE_BASE_PATH"))) | ||
!global $IMAGE_BASE_PATH="" | ||
!endif | ||
!endif | ||
|
||
!global $COLOR_DARK_BLUE="#232F3D" | ||
!global $COLOR_LIGHT_BLUE="#007CBC" | ||
!global $COLOR_LIGHT_BLUE_BG="#E6F2F9" | ||
!global $COLOR_RED="#DF3312" | ||
!global $COLOR_ORANGE="#D86613" | ||
!global $COLOR_GREEN="#1D8900" | ||
!global $COLOR_GREY="#5A6B86" | ||
!global $COLOR_GREY_BG="#EBEDF0" | ||
!global $COLOR_VIOLET="#CD2264" | ||
|
||
@enduml |
Oops, something went wrong.