Skip to content

allyn-bottorff/as3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoAS3Parse

AS3 parsing module for Go

Status

This project currently supports parsing a raw AS3 declaration into a list of Go structs. It can parse a single declaration into a list of Tenant, Application, and Virtual Server objects, including as many sub properties/objects as possible. Focus is on LTM configuration for HTTPS virtual servers.

Usage

import (
	"encoding/json"
	"os"
	as3parse "github.com/allyn-bottorff/as3"

)


// Read in a JSON object file and store the contents as a map[string]interface{}
func readJson(filePath string) map[string]interface{} {
	f, err := os.ReadFile(filePath)
	if err != nil {
		log.Fatal("Failed to read AS3 JSON file.")
	}

	jsonMap := make(map[string]interface{})

	json.Unmarshal(f, &jsonMap)

	return jsonMap

}

func main() {

	// Create a map[string]interface{}
	jsonMap := readJson("./path-to-as3.json")

	// Fill the AS3 Declaration with the parsed contents of the AS3 json
	dec := as3parse.ParseDec(jsonMap)

	// Print out basic statistic about the declaration
	dec.Summarize()

}

About

Go library for parsing F5 AS3 config syntax

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages