From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <erik@hollensbe.org>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 59BAE60FE6
 for <pve-user@lists.proxmox.com>; Wed, 16 Dec 2020 10:48:21 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 499E21A75F
 for <pve-user@lists.proxmox.com>; Wed, 16 Dec 2020 10:48:21 +0100 (CET)
Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com
 [IPv6:2607:f8b0:4864:20::333])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 8A4491A74D
 for <pve-user@lists.proxmox.com>; Wed, 16 Dec 2020 10:48:20 +0100 (CET)
Received: by mail-ot1-x333.google.com with SMTP id f16so22296072otl.11
 for <pve-user@lists.proxmox.com>; Wed, 16 Dec 2020 01:48:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=hollensbe-org.20150623.gappssmtp.com; s=20150623;
 h=mime-version:from:date:message-id:subject:to;
 bh=Ye2R3fd7J6L1dpXveR/Ht6oVcaYX/+SF7+u4i0Hf51E=;
 b=It4buQw5UfamCTcKF6wCx6LVB5SzPn+Cj8Y+z0ev9PFWvHkR18AgM/nCRa44ZalmOY
 W0nO0Gb6o1IZpfI8vvOAOMgFhfJoeU8QBU/U6vWW8S9uay5YJTqgTjCY4X1HAgPYC6/t
 TTZUzTLOXh/NgdO15iaqraNKe1Epglg0RfpMDP2aRSI9IgzR8nTgozfJ9IixrzaQVjLs
 EpyvHFtmOSnbtUJP7tqZrufsjnHKobCtRZYjMnAN7+fnldfrH3j3nzkBxCN3yrfs8nnk
 8YkK7N+5WmK93AnBrS0BAYCR2y3a5AYz5l9Cp5B6TXlKmTK6hSsHaaLRXhxebd7BwCLe
 2fsQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=Ye2R3fd7J6L1dpXveR/Ht6oVcaYX/+SF7+u4i0Hf51E=;
 b=RO50t51RDKR62TpUI8S19cPjy+ilns4JELsyS7R7XCNyQaDWFCjbm8XQbIn0cTAvpx
 mq7WLB9unUG/GnxffI2X2R9i6edwrS5phLi76Yr0mgWGsGBprE+Yetu6L0gOLeUYmeJU
 6giEITXd/ayNFyDZeIbl+DdnQwLwkCCIRP1VpmHq9t5cVGY9JBHnVHq6201wDRDKyIlo
 TLCAWcD+xnupjyBtfTTFV/xBtn4ppPPv/z113NoLBThHIE8TMEBiWCLL4y29rHlpeFFG
 g3GGYxZ3Dt7wyS7oOgpD8mAOn4FQsnRDEuEJ+Zly0wWD6E05zYQgSXgjJ+DTj5DRvFCL
 YX5g==
X-Gm-Message-State: AOAM532R5A1qor2Xua2L1vA4jChJQR6KCz1N2bk7PnJlkNHbByKg73FP
 s4UPC3mmBwFhlJhHuiE28obPqRogtbdDRe10Q+30Pgzv0Sc=
X-Google-Smtp-Source: ABdhPJzgdM/97E6BD1MgxpJmdYfOKDPaguBbcry3GxFN3CILYgKI9BnH8rkkjPdIffg6gStwp0JxQ1u4mtQKcpShwGQ=
X-Received: by 2002:a9d:2643:: with SMTP id a61mr9939036otb.158.1608112092596; 
 Wed, 16 Dec 2020 01:48:12 -0800 (PST)
MIME-Version: 1.0
From: Erik Hollensbe <erik@hollensbe.org>
Date: Wed, 16 Dec 2020 01:48:04 -0800
Message-ID: <CADHGEEKW+ckrBd9Z3iAaV-VOoL3N_anprA-hmH0fpc=FjKJoZA@mail.gmail.com>
To: pve-user@lists.proxmox.com
X-SPAM-LEVEL: Spam detection results:  0
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 HTML_MESSAGE            0.001 HTML included in message
 RCVD_IN_DNSWL_NONE     -0.0001 Sender listed at https://www.dnswl.org/,
 no trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_NONE                0.001 SPF: sender does not publish an SPF Record
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
Subject: [PVE-User] Extracting/leveraging the JSON schema
X-BeenThere: pve-user@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE user list <pve-user.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-user>, 
 <mailto:pve-user-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-user/>
List-Post: <mailto:pve-user@lists.proxmox.com>
List-Help: <mailto:pve-user-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-user>, 
 <mailto:pve-user-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 16 Dec 2020 09:48:21 -0000

I'd like to extract the JSON schema for use in generating a golang API.
Judging from brief googling I've seen others have attempted this but I was
hoping to make an effective dent in the problem. I think it'd be really
useful in terraform and other orchestration tools that are typically
written in that language (these days at least).

I reviewed the pve-common packages, specifically, the PVE::JSONSchema perl
module and it looks like a parser but not the actual API.

Best I can tell from googling and looking at the files in /usr/share/pve is
that there is a api.js (I forget the exact filename) that contains what I
seek, unfortunately it is coupled with some additional framework code to
generate it all, best I can tell?

What I'd really like to do is get ya'll up to speed so that your API can be
consumed by codegen tools that are out there. Let me know how I can help
and facilitate this. Swagger would be a bold idea/ideal here, if you're up
for considering something along those lines as well. The swagger/openapi
codegen tools are dull but effective for a lot of languages.

The PVE API is vast and I don't see the feasibility in porting it by hand
100%, especially when you consider future maintenance burdens, so something
that could generate code or dynamically configure a client would be an
ideal solution assuming it is needed and can be bootstrapped.

Thanks and I hope this message from a brand new ML user is not too forward
:)

-Erik