Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12243380
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d611d08
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+# -------------------------------------------------------------
+# Nasqueron - API
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description: Build API files
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+API_FILES=infra/servers.json
+YAML_TO_JSON=_utils/yaml2json.py
+
+RM=rm -f
+
+# -------------------------------------------------------------
+# Main targets
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+all: $(API_FILES)
+
+clean:
+ ${RM} ${API_FILES}
+
+# -------------------------------------------------------------
+# API targets
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+infra/servers.json:
+ ${YAML_TO_JSON} infra/datasource.yml servers > infra/servers.json
diff --git a/_utils/yaml2json.py b/_utils/yaml2json.py
new file mode 100755
index 0000000..62dfd1a
--- /dev/null
+++ b/_utils/yaml2json.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+
+# -------------------------------------------------------------
+# Nasqueron - API
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description: Create a JSON document from a YAML datasource
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+
+import json
+import sys
+import yaml
+
+
+# -------------------------------------------------------------
+# Convert
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def to_json(source_path, key=None):
+ with open(source_path) as fd:
+ data = yaml.safe_load(fd)
+
+ if key:
+ data = data[key]
+
+ return json.dumps(data, indent=4)
+
+
+# -------------------------------------------------------------
+# Application entry point
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def run(source_path, key=None):
+ print(to_json(source_path, key))
+
+
+if __name__ == "__main__":
+ argc = len(sys.argv)
+
+ if argc < 2:
+ print(f"Usage: {sys.argv[0]} <YAML datasource> [key to take]", file=sys.stderr)
+ sys.exit(1)
+
+ run(*sys.argv[1:3])
diff --git a/index.html b/index.html
index 9ad53a4..da3c5a1 100644
--- a/index.html
+++ b/index.html
@@ -1,24 +1,25 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Nasqueron API</title>
</head>
<body>
<h1>Nasqueron API</h1>
<h2>Reference documents</h2>
<ul>
<li><strong><a href="/sites.json">/sites.json</a></strong> — List of the Nasqueron web sites</li>
</ul>
<h2>Infrastructure</h2>
<ul>
<li><strong><a href="/servers-log/all.json">/servers-log/all.json</a></strong> — Servers log</li>
<li><strong><a href="/docker/registry">/docker/registry</a></strong> — Docker registry API</li>
+ <li><strong><a href="/infra/servers.json">/infra/servers.json</a></strong> — Servers list</li>
</ul>
<h2>Tools</h2>
<ul>
<li><strong><a href="/datasources">/datasources</a></strong> — Datasources</li>
</ul>
</body>
</html>
diff --git a/infra/datasource.yml b/infra/datasource.yml
new file mode 100644
index 0000000..b357634
--- /dev/null
+++ b/infra/datasource.yml
@@ -0,0 +1,31 @@
+servers:
+
+ windriver:
+ name: WindRiver
+ hostname: windriver.nasqueron.org
+ description: Development server
+ configurator: salt
+
+ ysul:
+ name: Ysul
+ hostname: ysul.nasqueron.org
+ description: Development server (legacy)
+ configurator: salt
+
+ cloudhugger:
+ name: CloudHugger
+ hostname: cloudhugger.nasqueron.org
+ description: OpenSearch testing
+ configurator: salt
+
+ docker-001:
+ name: docker-001
+ hostname: docker-001.nasqueron.org
+ description: Docker engine (prod)
+ configurator: salt
+
+ dwellers:
+ name: Dwellers
+ hostname: dwellers.nasqueron.org
+ description: Docker engine (dev)
+ configurator: salt
diff --git a/infra/servers.json b/infra/servers.json
new file mode 100644
index 0000000..497a076
--- /dev/null
+++ b/infra/servers.json
@@ -0,0 +1,32 @@
+{
+ "windriver": {
+ "name": "WindRiver",
+ "hostname": "windriver.nasqueron.org",
+ "description": "Development server",
+ "configurator": "salt"
+ },
+ "ysul": {
+ "name": "Ysul",
+ "hostname": "ysul.nasqueron.org",
+ "description": "Development server (legacy)",
+ "configurator": "salt"
+ },
+ "cloudhugger": {
+ "name": "CloudHugger",
+ "hostname": "cloudhugger.nasqueron.org",
+ "description": "OpenSearch testing",
+ "configurator": "salt"
+ },
+ "docker-001": {
+ "name": "docker-001",
+ "hostname": "docker-001.nasqueron.org",
+ "description": "Docker engine (prod)",
+ "configurator": "salt"
+ },
+ "dwellers": {
+ "name": "Dwellers",
+ "hostname": "dwellers.nasqueron.org",
+ "description": "Docker engine (dev)",
+ "configurator": "salt"
+ }
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Oct 12, 13:19 (2 m, 16 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3064948
Default Alt Text
(5 KB)
Attached To
Mode
rAPI Nasqueron API
Attached
Detach File
Event Timeline
Log In to Comment