Sponsored by AppSignal
Would you like to see your link here? Contact us
Notesclub

Azure APRL processing

content/aprl_parsing.livemd

Azure APRL processing

Mix.install([
  {:ex_azure_resiliency_queries,
   path: "C:\\github\\chgeuer\\_resiliency\\ex_azure_resiliency_queries"},
  {:req, "~> 0.4.9"},
  {:kino, "~> 0.12.3"},
  {:jsonrs, "~> 0.3.3"}
])

Introduction

This is an experiment to try parsing the Markdown files in the APRL repo. An example would be the storage account description at https://raw.githubusercontent.com/Azure/Azure-Proactive-Resiliency-Library/main/docs/content/services/storage/storage-Account/_index.md

Parser

Let’s copy&paste some stuff from previous nimble_parsec work, or RTFM on hexdocs.pm

alias Azure.ProactiveResiliencyLibrary.Processor, as: APRLProcessor

load_content = &File.read!/1

aprl_local_folder =
  "c:\\github\\chgeuer\\_resiliency\\Azure-Proactive-Resiliency-Library"
  |> String.replace("\\", "/")

processed =
  "#{aprl_local_folder}/docs/content/services/**/_index.md"
  |> Path.wildcard()
  |> APRLProcessor.parse_file_tree(load_content)

elixir_code =
  processed |> inspect(limit: :infinity, pretty: true, printable_limit: :infinity)

# File.write!("C:\\Users\\chgeuer\\Desktop\\1.json", processed |> Jsonrs.encode!(pretty: true))
# File.write!("C:\\Users\\chgeuer\\Desktop\\aprl.ex", elixir_code)

# elixir_code
# |> IO.puts()
File.write!("C:\\Users\\chgeuer\\aprl.ex", elixir_code)