feat(cli): proxdeploy in Go
Befehle login, servers, distros, profiles, presets, vm, lxc, template list|build, batch, status, logs --follow, cancel. Renderer im Aufbau der Vorgabe (zeichengenau per Golden-File), 24-bit/256/ohne Farbe, --ascii, --quiet, --json, --dry-run; live im Terminal, zeilenweise ohne. SSE mit Wiederverbinden und Polling als Rückfall. Typen aus openapi.json per oapi-codegen; Release-Builds per cli/bauen.sh. Refs #013 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,287 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Client spricht die REST-API von ProxDeploy. Die Typen der Antworten sind aus openapi.json
|
||||
// erzeugt (typen.gen.go); Anfragen gehen als Map hinaus, damit nur gesetzte Flags mitkommen und
|
||||
// Vorlage und Server-Standards den Rest füllen.
|
||||
type Client struct {
|
||||
// Basis-URL der Instanz, z. B. https://proxdeploy.example (ohne /api/v1).
|
||||
URL string
|
||||
Token string
|
||||
Version string
|
||||
HTTP *http.Client
|
||||
}
|
||||
|
||||
func Neu(basis, token, version string) *Client {
|
||||
return &Client{
|
||||
URL: strings.TrimRight(basis, "/"),
|
||||
Token: token,
|
||||
Version: version,
|
||||
HTTP: &http.Client{Timeout: 60 * time.Second},
|
||||
}
|
||||
}
|
||||
|
||||
// Fehler ist eine Fehlerantwort der API (`{ fehler: { code, nachricht, hinweis?, felder? } }`).
|
||||
type Fehler struct {
|
||||
Status int
|
||||
Code string
|
||||
Nachricht string
|
||||
Hinweis string
|
||||
Felder map[string]string
|
||||
}
|
||||
|
||||
func (f *Fehler) Error() string { return f.Nachricht }
|
||||
|
||||
// VerbindungsFehler: die Instanz war nicht erreichbar oder hat keine API-Antwort geliefert.
|
||||
type VerbindungsFehler struct{ Ursache error }
|
||||
|
||||
func (f *VerbindungsFehler) Error() string {
|
||||
return fmt.Sprintf("ProxDeploy nicht erreichbar: %v", f.Ursache)
|
||||
}
|
||||
func (f *VerbindungsFehler) Unwrap() error { return f.Ursache }
|
||||
|
||||
// IstAnmeldefehler: Token fehlt, ist abgelaufen oder widerrufen.
|
||||
func IstAnmeldefehler(err error) bool {
|
||||
var f *Fehler
|
||||
return errors.As(err, &f) && f.Status == http.StatusUnauthorized
|
||||
}
|
||||
|
||||
func (c *Client) anfrage(ctx context.Context, methode, pfad string, rumpf any) (*http.Request, error) {
|
||||
var koerper io.Reader
|
||||
if rumpf != nil {
|
||||
daten, err := json.Marshal(rumpf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
koerper = bytes.NewReader(daten)
|
||||
}
|
||||
req, err := http.NewRequestWithContext(ctx, methode, c.URL+"/api/v1"+pfad, koerper)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if rumpf != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
}
|
||||
req.Header.Set("Accept", "application/json")
|
||||
req.Header.Set("User-Agent", "proxdeploy-cli/"+c.Version)
|
||||
if c.Token != "" {
|
||||
req.Header.Set("Authorization", "Bearer "+c.Token)
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func fehlerLesen(antwort *http.Response) error {
|
||||
daten, _ := io.ReadAll(io.LimitReader(antwort.Body, 1<<20))
|
||||
var huelle struct {
|
||||
Fehler *struct {
|
||||
Code string `json:"code"`
|
||||
Nachricht string `json:"nachricht"`
|
||||
Hinweis string `json:"hinweis"`
|
||||
Felder map[string]string `json:"felder"`
|
||||
} `json:"fehler"`
|
||||
}
|
||||
if json.Unmarshal(daten, &huelle) != nil || huelle.Fehler == nil {
|
||||
// Kein API-Format: falsche URL, Reverse-Proxy-Fehlerseite o. Ä.
|
||||
return &VerbindungsFehler{Ursache: fmt.Errorf("HTTP %d ohne API-Antwort – stimmt die URL?", antwort.StatusCode)}
|
||||
}
|
||||
return &Fehler{
|
||||
Status: antwort.StatusCode,
|
||||
Code: huelle.Fehler.Code,
|
||||
Nachricht: huelle.Fehler.Nachricht,
|
||||
Hinweis: huelle.Fehler.Hinweis,
|
||||
Felder: huelle.Fehler.Felder,
|
||||
}
|
||||
}
|
||||
|
||||
// Aufrufen schickt eine Anfrage und liest die JSON-Antwort nach `ziel` (nil = verwerfen).
|
||||
func (c *Client) Aufrufen(ctx context.Context, methode, pfad string, rumpf, ziel any) error {
|
||||
req, err := c.anfrage(ctx, methode, pfad, rumpf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
antwort, err := c.HTTP.Do(req)
|
||||
if err != nil {
|
||||
return &VerbindungsFehler{Ursache: err}
|
||||
}
|
||||
defer antwort.Body.Close()
|
||||
if antwort.StatusCode >= 400 {
|
||||
return fehlerLesen(antwort)
|
||||
}
|
||||
if ziel == nil || antwort.StatusCode == http.StatusNoContent {
|
||||
return nil
|
||||
}
|
||||
if !strings.HasPrefix(antwort.Header.Get("Content-Type"), "application/json") {
|
||||
return &VerbindungsFehler{Ursache: errors.New("Antwort ist kein JSON – stimmt die URL?")}
|
||||
}
|
||||
if err := json.NewDecoder(antwort.Body).Decode(ziel); err != nil {
|
||||
return fmt.Errorf("Antwort nicht lesbar: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) Ich(ctx context.Context) (Ich, error) {
|
||||
var ich Ich
|
||||
return ich, c.Aufrufen(ctx, http.MethodGet, "/ich", nil, &ich)
|
||||
}
|
||||
|
||||
func (c *Client) TokenAnmelden(ctx context.Context, anmeldung TokenAnmeldung) (NeuesToken, error) {
|
||||
var token NeuesToken
|
||||
return token, c.Aufrufen(ctx, http.MethodPost, "/auth/token", anmeldung, &token)
|
||||
}
|
||||
|
||||
func (c *Client) ServerListe(ctx context.Context) ([]Server, error) {
|
||||
var liste []Server
|
||||
return liste, c.Aufrufen(ctx, http.MethodGet, "/server", nil, &liste)
|
||||
}
|
||||
|
||||
func (c *Client) DistributionenListe(ctx context.Context, typ string) ([]Distribution, error) {
|
||||
pfad := "/distributionen"
|
||||
if typ != "" {
|
||||
pfad += "?typ=" + url.QueryEscape(typ)
|
||||
}
|
||||
var liste []Distribution
|
||||
return liste, c.Aufrufen(ctx, http.MethodGet, pfad, nil, &liste)
|
||||
}
|
||||
|
||||
func (c *Client) ProfileListe(ctx context.Context) ([]Profil, error) {
|
||||
var liste []Profil
|
||||
return liste, c.Aufrufen(ctx, http.MethodGet, "/profile", nil, &liste)
|
||||
}
|
||||
|
||||
func (c *Client) VorlagenListe(ctx context.Context) ([]Vorlage, error) {
|
||||
var liste []Vorlage
|
||||
return liste, c.Aufrufen(ctx, http.MethodGet, "/vorlagen", nil, &liste)
|
||||
}
|
||||
|
||||
func (c *Client) TemplatesListe(ctx context.Context, server string) ([]Template, error) {
|
||||
var liste []Template
|
||||
return liste, c.Aufrufen(ctx, http.MethodGet, "/server/"+url.PathEscape(server)+"/templates", nil, &liste)
|
||||
}
|
||||
|
||||
func (c *Client) Ausrollen(ctx context.Context, anfrage map[string]any) (AuftragAngenommen, error) {
|
||||
var a AuftragAngenommen
|
||||
return a, c.Aufrufen(ctx, http.MethodPost, "/auftraege", anfrage, &a)
|
||||
}
|
||||
|
||||
func (c *Client) Planen(ctx context.Context, anfrage map[string]any) (Plan, error) {
|
||||
var p Plan
|
||||
return p, c.Aufrufen(ctx, http.MethodPost, "/auftraege/plan", anfrage, &p)
|
||||
}
|
||||
|
||||
func (c *Client) TemplateBauen(ctx context.Context, server string, anfrage map[string]any) (AuftragAngenommen, error) {
|
||||
var a AuftragAngenommen
|
||||
return a, c.Aufrufen(ctx, http.MethodPost, "/server/"+url.PathEscape(server)+"/templates", anfrage, &a)
|
||||
}
|
||||
|
||||
func (c *Client) Auftrag(ctx context.Context, id string) (Auftrag, error) {
|
||||
var a Auftrag
|
||||
return a, c.Aufrufen(ctx, http.MethodGet, "/auftraege/"+url.PathEscape(id), nil, &a)
|
||||
}
|
||||
|
||||
func (c *Client) Log(ctx context.Context, id, ab string) ([]LogZeile, error) {
|
||||
var zeilen []LogZeile
|
||||
pfad := "/auftraege/" + url.PathEscape(id) + "/log"
|
||||
if ab != "" {
|
||||
pfad += "?ab=" + url.QueryEscape(ab)
|
||||
}
|
||||
return zeilen, c.Aufrufen(ctx, http.MethodGet, pfad, nil, &zeilen)
|
||||
}
|
||||
|
||||
func (c *Client) Abbrechen(ctx context.Context, id string) error {
|
||||
return c.Aufrufen(ctx, http.MethodPost, "/auftraege/"+url.PathEscape(id)+"/abbrechen", nil, nil)
|
||||
}
|
||||
|
||||
// Ereignis aus dem SSE-Strom eines Auftrags.
|
||||
type Ereignis struct {
|
||||
ID string
|
||||
Art string // stand, log, ende
|
||||
Daten []byte
|
||||
}
|
||||
|
||||
// Ereignisse liest den SSE-Strom bis zum Ende oder Abbruch. `ab` ist die letzte gesehene Event-ID
|
||||
// (Log-Zeile); ein Wiederverbinden mit ihr setzt genau dort fort.
|
||||
func (c *Client) Ereignisse(ctx context.Context, id, ab string, beiEreignis func(Ereignis) error) error {
|
||||
req, err := c.anfrage(ctx, http.MethodGet, "/auftraege/"+url.PathEscape(id)+"/ereignisse", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Set("Accept", "text/event-stream")
|
||||
if ab != "" {
|
||||
req.Header.Set("Last-Event-ID", ab)
|
||||
}
|
||||
// Ohne Zeitlimit: der Strom läuft, solange der Auftrag läuft (Herzschlag alle 15 s).
|
||||
strom := &http.Client{Transport: c.HTTP.Transport}
|
||||
antwort, err := strom.Do(req)
|
||||
if err != nil {
|
||||
return &VerbindungsFehler{Ursache: err}
|
||||
}
|
||||
defer antwort.Body.Close()
|
||||
if antwort.StatusCode >= 400 {
|
||||
return fehlerLesen(antwort)
|
||||
}
|
||||
if !strings.HasPrefix(antwort.Header.Get("Content-Type"), "text/event-stream") {
|
||||
return &VerbindungsFehler{Ursache: errors.New("kein Ereignisstrom (puffert ein Proxy?)")}
|
||||
}
|
||||
return sseLesen(antwort.Body, beiEreignis)
|
||||
}
|
||||
|
||||
func sseLesen(r io.Reader, beiEreignis func(Ereignis) error) error {
|
||||
leser := bufio.NewReaderSize(r, 64*1024)
|
||||
var e Ereignis
|
||||
var daten bytes.Buffer
|
||||
for {
|
||||
zeile, err := leser.ReadString('\n')
|
||||
if err != nil {
|
||||
if errors.Is(err, io.EOF) {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return &VerbindungsFehler{Ursache: err}
|
||||
}
|
||||
zeile = strings.TrimRight(zeile, "\r\n")
|
||||
switch {
|
||||
case zeile == "":
|
||||
if e.Art != "" || daten.Len() > 0 {
|
||||
if e.Art == "" {
|
||||
e.Art = "message"
|
||||
}
|
||||
// Kopie: der Puffer wird für das nächste Ereignis wiederverwendet.
|
||||
e.Daten = bytes.Clone(bytes.TrimSuffix(daten.Bytes(), []byte("\n")))
|
||||
if err := beiEreignis(e); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
e = Ereignis{}
|
||||
daten.Reset()
|
||||
case strings.HasPrefix(zeile, ":"):
|
||||
// Kommentar (Herzschlag)
|
||||
default:
|
||||
feld, wert, _ := strings.Cut(zeile, ":")
|
||||
wert = strings.TrimPrefix(wert, " ")
|
||||
switch feld {
|
||||
case "id":
|
||||
e.ID = wert
|
||||
case "event":
|
||||
e.Art = wert
|
||||
case "data":
|
||||
daten.WriteString(wert)
|
||||
daten.WriteByte('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ende signalisiert, dass der Strom regulär geschlossen wurde (Ereignis `ende`).
|
||||
var Ende = errors.New("ende")
|
||||
@@ -0,0 +1,31 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSseLesen(t *testing.T) {
|
||||
strom := ": ping\r\n\r\nid: 41\r\nevent: log\r\ndata: [1,\r\ndata: 2]\r\n\r\nevent: stand\ndata: {}\n\n: ping\n\nevent: ende\ndata: {}\n\n"
|
||||
var gesehen []Ereignis
|
||||
err := sseLesen(strings.NewReader(strom), func(e Ereignis) error {
|
||||
gesehen = append(gesehen, e)
|
||||
if e.Art == "ende" {
|
||||
return Ende
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if !errors.Is(err, Ende) {
|
||||
t.Fatalf("Fehler %v", err)
|
||||
}
|
||||
if len(gesehen) != 3 || gesehen[0].ID != "41" || string(gesehen[0].Daten) != "[1,\n2]" || gesehen[1].Art != "stand" {
|
||||
t.Errorf("gelesen: %+v", gesehen)
|
||||
}
|
||||
// Bricht der Strom vor `ende` ab, merkt der Aufrufer es (und verbindet neu).
|
||||
err = sseLesen(strings.NewReader("event: stand\ndata: {}\n\n"), func(Ereignis) error { return nil })
|
||||
if !errors.Is(err, io.ErrUnexpectedEOF) {
|
||||
t.Errorf("Abbruch: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// Package api enthält die aus cli/api/openapi.json erzeugten Typen und den HTTP-Client der CLI.
|
||||
package api
|
||||
|
||||
//go:generate go tool oapi-codegen -config ../../api/oapi-codegen.yaml ../../api/openapi.json
|
||||
@@ -0,0 +1,751 @@
|
||||
// Package api provides primitives to interact with the openapi HTTP API.
|
||||
//
|
||||
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/oapi-codegen/runtime"
|
||||
)
|
||||
|
||||
// Defines values for AuftragArt.
|
||||
const (
|
||||
AUFRAEUMEN AuftragArt = "AUFRAEUMEN"
|
||||
AUSROLLEN AuftragArt = "AUSROLLEN"
|
||||
TEMPLATEBAUEN AuftragArt = "TEMPLATE_BAUEN"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the AuftragArt enum.
|
||||
func (e AuftragArt) Valid() bool {
|
||||
switch e {
|
||||
case AUFRAEUMEN:
|
||||
return true
|
||||
case AUSROLLEN:
|
||||
return true
|
||||
case TEMPLATEBAUEN:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for AuftragGastTyp.
|
||||
const (
|
||||
LXC AuftragGastTyp = "LXC"
|
||||
VM AuftragGastTyp = "VM"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the AuftragGastTyp enum.
|
||||
func (e AuftragGastTyp) Valid() bool {
|
||||
switch e {
|
||||
case LXC:
|
||||
return true
|
||||
case VM:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for AuftragStatus.
|
||||
const (
|
||||
AuftragStatusABGEBROCHEN AuftragStatus = "ABGEBROCHEN"
|
||||
AuftragStatusAUFGERAEUMT AuftragStatus = "AUFGERAEUMT"
|
||||
AuftragStatusERFOLGREICH AuftragStatus = "ERFOLGREICH"
|
||||
AuftragStatusFEHLGESCHLAGEN AuftragStatus = "FEHLGESCHLAGEN"
|
||||
AuftragStatusLAEUFT AuftragStatus = "LAEUFT"
|
||||
AuftragStatusWARTEND AuftragStatus = "WARTEND"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the AuftragStatus enum.
|
||||
func (e AuftragStatus) Valid() bool {
|
||||
switch e {
|
||||
case AuftragStatusABGEBROCHEN:
|
||||
return true
|
||||
case AuftragStatusAUFGERAEUMT:
|
||||
return true
|
||||
case AuftragStatusERFOLGREICH:
|
||||
return true
|
||||
case AuftragStatusFEHLGESCHLAGEN:
|
||||
return true
|
||||
case AuftragStatusLAEUFT:
|
||||
return true
|
||||
case AuftragStatusWARTEND:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for AusrollAnfrageNetzModus.
|
||||
const (
|
||||
Dhcp AusrollAnfrageNetzModus = "dhcp"
|
||||
Statisch AusrollAnfrageNetzModus = "statisch"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the AusrollAnfrageNetzModus enum.
|
||||
func (e AusrollAnfrageNetzModus) Valid() bool {
|
||||
switch e {
|
||||
case Dhcp:
|
||||
return true
|
||||
case Statisch:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for AusrollAnfrageTyp.
|
||||
const (
|
||||
AusrollAnfrageTypLxc AusrollAnfrageTyp = "lxc"
|
||||
AusrollAnfrageTypVm AusrollAnfrageTyp = "vm"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the AusrollAnfrageTyp enum.
|
||||
func (e AusrollAnfrageTyp) Valid() bool {
|
||||
switch e {
|
||||
case AusrollAnfrageTypLxc:
|
||||
return true
|
||||
case AusrollAnfrageTypVm:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for IchRolle.
|
||||
const (
|
||||
ADMIN IchRolle = "ADMIN"
|
||||
OPERATOR IchRolle = "OPERATOR"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the IchRolle enum.
|
||||
func (e IchRolle) Valid() bool {
|
||||
switch e {
|
||||
case ADMIN:
|
||||
return true
|
||||
case OPERATOR:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for PhaseStatus.
|
||||
const (
|
||||
PhaseStatusERLEDIGT PhaseStatus = "ERLEDIGT"
|
||||
PhaseStatusFEHLER PhaseStatus = "FEHLER"
|
||||
PhaseStatusLAEUFT PhaseStatus = "LAEUFT"
|
||||
PhaseStatusOFFEN PhaseStatus = "OFFEN"
|
||||
PhaseStatusUEBERSPRUNGEN PhaseStatus = "UEBERSPRUNGEN"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the PhaseStatus enum.
|
||||
func (e PhaseStatus) Valid() bool {
|
||||
switch e {
|
||||
case PhaseStatusERLEDIGT:
|
||||
return true
|
||||
case PhaseStatusFEHLER:
|
||||
return true
|
||||
case PhaseStatusLAEUFT:
|
||||
return true
|
||||
case PhaseStatusOFFEN:
|
||||
return true
|
||||
case PhaseStatusUEBERSPRUNGEN:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for ProfilHerkunft.
|
||||
const (
|
||||
EIGEN ProfilHerkunft = "EIGEN"
|
||||
KATALOG ProfilHerkunft = "KATALOG"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the ProfilHerkunft enum.
|
||||
func (e ProfilHerkunft) Valid() bool {
|
||||
switch e {
|
||||
case EIGEN:
|
||||
return true
|
||||
case KATALOG:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for ProfilVariableType.
|
||||
const (
|
||||
Boolean ProfilVariableType = "boolean"
|
||||
Number ProfilVariableType = "number"
|
||||
Select ProfilVariableType = "select"
|
||||
String ProfilVariableType = "string"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the ProfilVariableType enum.
|
||||
func (e ProfilVariableType) Valid() bool {
|
||||
switch e {
|
||||
case Boolean:
|
||||
return true
|
||||
case Number:
|
||||
return true
|
||||
case Select:
|
||||
return true
|
||||
case String:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for DistributionenListeParamsTyp.
|
||||
const (
|
||||
DistributionenListeParamsTypLxc DistributionenListeParamsTyp = "lxc"
|
||||
DistributionenListeParamsTypVm DistributionenListeParamsTyp = "vm"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the DistributionenListeParamsTyp enum.
|
||||
func (e DistributionenListeParamsTyp) Valid() bool {
|
||||
switch e {
|
||||
case DistributionenListeParamsTypLxc:
|
||||
return true
|
||||
case DistributionenListeParamsTypVm:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Abschluss defines model for Abschluss.
|
||||
type Abschluss struct {
|
||||
Dauer *string `json:"dauer"`
|
||||
Ok bool `json:"ok"`
|
||||
Titel string `json:"titel"`
|
||||
Zeilen [][]string `json:"zeilen"`
|
||||
}
|
||||
|
||||
// Auftrag defines model for Auftrag.
|
||||
type Auftrag struct {
|
||||
Abschluss *Abschluss `json:"abschluss"`
|
||||
Art AuftragArt `json:"art"`
|
||||
|
||||
// BeendetAm ISO 8601
|
||||
BeendetAm *string `json:"beendetAm"`
|
||||
DistributionId *string `json:"distributionId"`
|
||||
Ergebnis *AuftragErgebnis `json:"ergebnis"`
|
||||
|
||||
// ErstelltAm ISO 8601
|
||||
ErstelltAm string `json:"erstelltAm"`
|
||||
ErstelltVon string `json:"erstelltVon"`
|
||||
Fehler *struct {
|
||||
Hinweis *string `json:"hinweis,omitempty"`
|
||||
Phase *string `json:"phase,omitempty"`
|
||||
Ursache string `json:"ursache"`
|
||||
} `json:"fehler"`
|
||||
GastTyp *AuftragGastTyp `json:"gastTyp"`
|
||||
|
||||
// GestartetAm ISO 8601
|
||||
GestartetAm *string `json:"gestartetAm"`
|
||||
Id string `json:"id"`
|
||||
Knoten *string `json:"knoten"`
|
||||
Kopf string `json:"kopf"`
|
||||
KurzId string `json:"kurzId"`
|
||||
Name *string `json:"name"`
|
||||
Phasen []Phase `json:"phasen"`
|
||||
Profile []string `json:"profile"`
|
||||
Server struct {
|
||||
Name string `json:"name"`
|
||||
Titel string `json:"titel"`
|
||||
} `json:"server"`
|
||||
Status AuftragStatus `json:"status"`
|
||||
Vmid *int `json:"vmid"`
|
||||
}
|
||||
|
||||
// AuftragArt defines model for Auftrag.Art.
|
||||
type AuftragArt string
|
||||
|
||||
// AuftragGastTyp defines model for Auftrag.GastTyp.
|
||||
type AuftragGastTyp string
|
||||
|
||||
// AuftragStatus defines model for Auftrag.Status.
|
||||
type AuftragStatus string
|
||||
|
||||
// AuftragAngenommen defines model for AuftragAngenommen.
|
||||
type AuftragAngenommen struct {
|
||||
Id string `json:"id"`
|
||||
KurzId string `json:"kurzId"`
|
||||
}
|
||||
|
||||
// AuftragErgebnis defines model for AuftragErgebnis.
|
||||
type AuftragErgebnis struct {
|
||||
Ip *string `json:"ip,omitempty"`
|
||||
Knoten *string `json:"knoten,omitempty"`
|
||||
Ssh *string `json:"ssh,omitempty"`
|
||||
Template *string `json:"template,omitempty"`
|
||||
Vmid *int `json:"vmid,omitempty"`
|
||||
}
|
||||
|
||||
// AusrollAnfrage defines model for AusrollAnfrage.
|
||||
type AusrollAnfrage struct {
|
||||
Cores *int `json:"cores,omitempty"`
|
||||
DiskGb *int `json:"diskGb,omitempty"`
|
||||
Distribution string `json:"distribution"`
|
||||
Features *struct {
|
||||
Keyctl *bool `json:"keyctl,omitempty"`
|
||||
Nesting *bool `json:"nesting,omitempty"`
|
||||
} `json:"features,omitempty"`
|
||||
Knoten *string `json:"knoten,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Netz struct {
|
||||
Bridge string `json:"bridge"`
|
||||
Dns *[]string `json:"dns,omitempty"`
|
||||
Gateway *string `json:"gateway,omitempty"`
|
||||
Ip *string `json:"ip,omitempty"`
|
||||
Modus *AusrollAnfrageNetzModus `json:"modus,omitempty"`
|
||||
Suchdomain *string `json:"suchdomain,omitempty"`
|
||||
Vlan *int `json:"vlan,omitempty"`
|
||||
} `json:"netz"`
|
||||
Profile *[]string `json:"profile,omitempty"`
|
||||
Server string `json:"server"`
|
||||
SpeicherMb *int `json:"speicherMb,omitempty"`
|
||||
StartBeiBoot *bool `json:"startBeiBoot,omitempty"`
|
||||
Storage string `json:"storage"`
|
||||
SwapMb *int `json:"swapMb,omitempty"`
|
||||
Tags *[]string `json:"tags,omitempty"`
|
||||
TemplateBauen *bool `json:"templateBauen,omitempty"`
|
||||
Typ AusrollAnfrageTyp `json:"typ"`
|
||||
Unprivilegiert *bool `json:"unprivilegiert,omitempty"`
|
||||
Variablen *map[string]map[string]AusrollAnfrage_Variablen_AdditionalProperties `json:"variablen,omitempty"`
|
||||
Vmid *int `json:"vmid,omitempty"`
|
||||
Vorlage *string `json:"vorlage,omitempty"`
|
||||
Zugang struct {
|
||||
Benutzer string `json:"benutzer"`
|
||||
SshSchluessel []string `json:"sshSchluessel"`
|
||||
} `json:"zugang"`
|
||||
}
|
||||
|
||||
// AusrollAnfrageNetzModus defines model for AusrollAnfrage.Netz.Modus.
|
||||
type AusrollAnfrageNetzModus string
|
||||
|
||||
// AusrollAnfrageTyp defines model for AusrollAnfrage.Typ.
|
||||
type AusrollAnfrageTyp string
|
||||
|
||||
// AusrollAnfrageVariablen0 defines model for AusrollAnfrage.Variablen.0.
|
||||
type AusrollAnfrageVariablen0 = string
|
||||
|
||||
// AusrollAnfrageVariablen1 defines model for AusrollAnfrage.Variablen.1.
|
||||
type AusrollAnfrageVariablen1 = float32
|
||||
|
||||
// AusrollAnfrageVariablen2 defines model for AusrollAnfrage.Variablen.2.
|
||||
type AusrollAnfrageVariablen2 = bool
|
||||
|
||||
// AusrollAnfrage_Variablen_AdditionalProperties defines model for AusrollAnfrage.variablen.AdditionalProperties.
|
||||
type AusrollAnfrage_Variablen_AdditionalProperties struct {
|
||||
union json.RawMessage
|
||||
}
|
||||
|
||||
// Distribution defines model for Distribution.
|
||||
type Distribution struct {
|
||||
Aktiv bool `json:"aktiv"`
|
||||
Familie string `json:"familie"`
|
||||
Id string `json:"id"`
|
||||
Lxc bool `json:"lxc"`
|
||||
Name string `json:"name"`
|
||||
Vm bool `json:"vm"`
|
||||
}
|
||||
|
||||
// FehlerAntwort defines model for FehlerAntwort.
|
||||
type FehlerAntwort struct {
|
||||
Fehler struct {
|
||||
Code string `json:"code"`
|
||||
Felder *map[string]string `json:"felder,omitempty"`
|
||||
Hinweis *string `json:"hinweis,omitempty"`
|
||||
Nachricht string `json:"nachricht"`
|
||||
} `json:"fehler"`
|
||||
}
|
||||
|
||||
// GeplanterAufruf defines model for GeplanterAufruf.
|
||||
type GeplanterAufruf struct {
|
||||
Methode string `json:"methode"`
|
||||
Parameter *map[string]interface{} `json:"parameter,omitempty"`
|
||||
Pfad string `json:"pfad"`
|
||||
}
|
||||
|
||||
// Ich defines model for Ich.
|
||||
type Ich struct {
|
||||
Anzeigename string `json:"anzeigename"`
|
||||
Benutzername string `json:"benutzername"`
|
||||
Rechte []string `json:"rechte"`
|
||||
Rolle IchRolle `json:"rolle"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
// IchRolle defines model for Ich.Rolle.
|
||||
type IchRolle string
|
||||
|
||||
// LogZeile defines model for LogZeile.
|
||||
type LogZeile struct {
|
||||
Id string `json:"id"`
|
||||
Nachricht string `json:"nachricht"`
|
||||
Phase *string `json:"phase"`
|
||||
Stufe string `json:"stufe"`
|
||||
|
||||
// Zeit ISO 8601
|
||||
Zeit string `json:"zeit"`
|
||||
}
|
||||
|
||||
// NeuesToken defines model for NeuesToken.
|
||||
type NeuesToken struct {
|
||||
// AblaufAm ISO 8601
|
||||
AblaufAm *string `json:"ablaufAm"`
|
||||
|
||||
// ErstelltAm ISO 8601
|
||||
ErstelltAm string `json:"erstelltAm"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Praefix string `json:"praefix"`
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
// Phase defines model for Phase.
|
||||
type Phase struct {
|
||||
// BeendetAm ISO 8601
|
||||
BeendetAm *string `json:"beendetAm,omitempty"`
|
||||
Detail *string `json:"detail"`
|
||||
|
||||
// GestartetAm ISO 8601
|
||||
GestartetAm *string `json:"gestartetAm,omitempty"`
|
||||
Hinweis *string `json:"hinweis"`
|
||||
Schluessel string `json:"schluessel"`
|
||||
Status PhaseStatus `json:"status"`
|
||||
Titel string `json:"titel"`
|
||||
Ursache *string `json:"ursache"`
|
||||
}
|
||||
|
||||
// PhaseStatus defines model for Phase.Status.
|
||||
type PhaseStatus string
|
||||
|
||||
// Plan defines model for Plan.
|
||||
type Plan struct {
|
||||
Aufrufe []GeplanterAufruf `json:"aufrufe"`
|
||||
Automatisch []string `json:"automatisch"`
|
||||
CliBefehl string `json:"cliBefehl"`
|
||||
Kopf string `json:"kopf"`
|
||||
Ok bool `json:"ok"`
|
||||
Phasen []Phase `json:"phasen"`
|
||||
Skript *string `json:"skript"`
|
||||
}
|
||||
|
||||
// Profil defines model for Profil.
|
||||
type Profil struct {
|
||||
Aktiv bool `json:"aktiv"`
|
||||
Beschreibung *string `json:"beschreibung"`
|
||||
Definition struct {
|
||||
Variables *[]ProfilVariable `json:"variables,omitempty"`
|
||||
} `json:"definition"`
|
||||
Familien []string `json:"familien"`
|
||||
Herkunft ProfilHerkunft `json:"herkunft"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// ProfilHerkunft defines model for Profil.Herkunft.
|
||||
type ProfilHerkunft string
|
||||
|
||||
// ProfilVariable defines model for ProfilVariable.
|
||||
type ProfilVariable struct {
|
||||
Default *ProfilVariable_Default `json:"default,omitempty"`
|
||||
Help *string `json:"help,omitempty"`
|
||||
Label string `json:"label"`
|
||||
Name string `json:"name"`
|
||||
Options *[]string `json:"options,omitempty"`
|
||||
Required bool `json:"required"`
|
||||
Type ProfilVariableType `json:"type"`
|
||||
}
|
||||
|
||||
// ProfilVariableDefault0 defines model for ProfilVariable.Default.0.
|
||||
type ProfilVariableDefault0 = string
|
||||
|
||||
// ProfilVariableDefault1 defines model for ProfilVariable.Default.1.
|
||||
type ProfilVariableDefault1 = float32
|
||||
|
||||
// ProfilVariableDefault2 defines model for ProfilVariable.Default.2.
|
||||
type ProfilVariableDefault2 = bool
|
||||
|
||||
// ProfilVariable_Default defines model for ProfilVariable.Default.
|
||||
type ProfilVariable_Default struct {
|
||||
union json.RawMessage
|
||||
}
|
||||
|
||||
// ProfilVariableType defines model for ProfilVariable.Type.
|
||||
type ProfilVariableType string
|
||||
|
||||
// Server defines model for Server.
|
||||
type Server struct {
|
||||
Erreichbar *bool `json:"erreichbar"`
|
||||
|
||||
// GeprueftAm ISO 8601
|
||||
GeprueftAm *string `json:"geprueftAm"`
|
||||
LetzterTest *struct {
|
||||
Cluster *struct {
|
||||
Name string `json:"name"`
|
||||
} `json:"cluster"`
|
||||
Knoten []struct {
|
||||
Name string `json:"name"`
|
||||
Online bool `json:"online"`
|
||||
SpeicherBelegt *float32 `json:"speicherBelegt"`
|
||||
SpeicherGesamt *float32 `json:"speicherGesamt"`
|
||||
} `json:"knoten"`
|
||||
} `json:"letzterTest"`
|
||||
Name string `json:"name"`
|
||||
PveVersion *string `json:"pveVersion"`
|
||||
SshAktiv bool `json:"sshAktiv"`
|
||||
Titel string `json:"titel"`
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
// Template defines model for Template.
|
||||
type Template struct {
|
||||
DistributionId *string `json:"distributionId"`
|
||||
|
||||
// GebautAm ISO 8601
|
||||
GebautAm *string `json:"gebautAm"`
|
||||
Knoten string `json:"knoten"`
|
||||
Name string `json:"name"`
|
||||
Profile []string `json:"profile"`
|
||||
Vmid int `json:"vmid"`
|
||||
}
|
||||
|
||||
// TemplateBauAnfrage defines model for TemplateBauAnfrage.
|
||||
type TemplateBauAnfrage struct {
|
||||
Bridge *string `json:"bridge,omitempty"`
|
||||
Distribution string `json:"distribution"`
|
||||
Knoten string `json:"knoten"`
|
||||
Profile *[]string `json:"profile,omitempty"`
|
||||
Storage string `json:"storage"`
|
||||
Vlan *int `json:"vlan,omitempty"`
|
||||
}
|
||||
|
||||
// TokenAnmeldung defines model for TokenAnmeldung.
|
||||
type TokenAnmeldung struct {
|
||||
Benutzername string `json:"benutzername"`
|
||||
Name string `json:"name"`
|
||||
Passwort string `json:"passwort"`
|
||||
Tage *int `json:"tage,omitempty"`
|
||||
}
|
||||
|
||||
// Vorlage defines model for Vorlage.
|
||||
type Vorlage struct {
|
||||
Beschreibung *string `json:"beschreibung"`
|
||||
Name string `json:"name"`
|
||||
Titel string `json:"titel"`
|
||||
}
|
||||
|
||||
// AuftragEreignisseParams defines parameters for AuftragEreignisse.
|
||||
type AuftragEreignisseParams struct {
|
||||
LastEventID *string `json:"Last-Event-ID,omitempty"`
|
||||
}
|
||||
|
||||
// AuftragLogParams defines parameters for AuftragLog.
|
||||
type AuftragLogParams struct {
|
||||
Ab *string `form:"ab,omitempty" json:"ab,omitempty"`
|
||||
}
|
||||
|
||||
// DistributionenListeParams defines parameters for DistributionenListe.
|
||||
type DistributionenListeParams struct {
|
||||
Typ *DistributionenListeParamsTyp `form:"typ,omitempty" json:"typ,omitempty"`
|
||||
}
|
||||
|
||||
// DistributionenListeParamsTyp defines parameters for DistributionenListe.
|
||||
type DistributionenListeParamsTyp string
|
||||
|
||||
// AusrollenJSONRequestBody defines body for Ausrollen for application/json ContentType.
|
||||
type AusrollenJSONRequestBody = AusrollAnfrage
|
||||
|
||||
// AusrollenPlanenJSONRequestBody defines body for AusrollenPlanen for application/json ContentType.
|
||||
type AusrollenPlanenJSONRequestBody = AusrollAnfrage
|
||||
|
||||
// TokenAnmeldenJSONRequestBody defines body for TokenAnmelden for application/json ContentType.
|
||||
type TokenAnmeldenJSONRequestBody = TokenAnmeldung
|
||||
|
||||
// TemplateBauenJSONRequestBody defines body for TemplateBauen for application/json ContentType.
|
||||
type TemplateBauenJSONRequestBody = TemplateBauAnfrage
|
||||
|
||||
// AsAusrollAnfrageVariablen0 returns the union data inside the AusrollAnfrage_Variablen_AdditionalProperties as a AusrollAnfrageVariablen0
|
||||
func (t AusrollAnfrage_Variablen_AdditionalProperties) AsAusrollAnfrageVariablen0() (AusrollAnfrageVariablen0, error) {
|
||||
var body AusrollAnfrageVariablen0
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromAusrollAnfrageVariablen0 overwrites any union data inside the AusrollAnfrage_Variablen_AdditionalProperties as the provided AusrollAnfrageVariablen0
|
||||
func (t *AusrollAnfrage_Variablen_AdditionalProperties) FromAusrollAnfrageVariablen0(v AusrollAnfrageVariablen0) error {
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeAusrollAnfrageVariablen0 performs a merge with any union data inside the AusrollAnfrage_Variablen_AdditionalProperties, using the provided AusrollAnfrageVariablen0
|
||||
func (t *AusrollAnfrage_Variablen_AdditionalProperties) MergeAusrollAnfrageVariablen0(v AusrollAnfrageVariablen0) error {
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
// AsAusrollAnfrageVariablen1 returns the union data inside the AusrollAnfrage_Variablen_AdditionalProperties as a AusrollAnfrageVariablen1
|
||||
func (t AusrollAnfrage_Variablen_AdditionalProperties) AsAusrollAnfrageVariablen1() (AusrollAnfrageVariablen1, error) {
|
||||
var body AusrollAnfrageVariablen1
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromAusrollAnfrageVariablen1 overwrites any union data inside the AusrollAnfrage_Variablen_AdditionalProperties as the provided AusrollAnfrageVariablen1
|
||||
func (t *AusrollAnfrage_Variablen_AdditionalProperties) FromAusrollAnfrageVariablen1(v AusrollAnfrageVariablen1) error {
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeAusrollAnfrageVariablen1 performs a merge with any union data inside the AusrollAnfrage_Variablen_AdditionalProperties, using the provided AusrollAnfrageVariablen1
|
||||
func (t *AusrollAnfrage_Variablen_AdditionalProperties) MergeAusrollAnfrageVariablen1(v AusrollAnfrageVariablen1) error {
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
// AsAusrollAnfrageVariablen2 returns the union data inside the AusrollAnfrage_Variablen_AdditionalProperties as a AusrollAnfrageVariablen2
|
||||
func (t AusrollAnfrage_Variablen_AdditionalProperties) AsAusrollAnfrageVariablen2() (AusrollAnfrageVariablen2, error) {
|
||||
var body AusrollAnfrageVariablen2
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromAusrollAnfrageVariablen2 overwrites any union data inside the AusrollAnfrage_Variablen_AdditionalProperties as the provided AusrollAnfrageVariablen2
|
||||
func (t *AusrollAnfrage_Variablen_AdditionalProperties) FromAusrollAnfrageVariablen2(v AusrollAnfrageVariablen2) error {
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeAusrollAnfrageVariablen2 performs a merge with any union data inside the AusrollAnfrage_Variablen_AdditionalProperties, using the provided AusrollAnfrageVariablen2
|
||||
func (t *AusrollAnfrage_Variablen_AdditionalProperties) MergeAusrollAnfrageVariablen2(v AusrollAnfrageVariablen2) error {
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
func (t AusrollAnfrage_Variablen_AdditionalProperties) MarshalJSON() ([]byte, error) {
|
||||
b, err := t.union.MarshalJSON()
|
||||
return b, err
|
||||
}
|
||||
|
||||
func (t *AusrollAnfrage_Variablen_AdditionalProperties) UnmarshalJSON(b []byte) error {
|
||||
err := t.union.UnmarshalJSON(b)
|
||||
return err
|
||||
}
|
||||
|
||||
// AsProfilVariableDefault0 returns the union data inside the ProfilVariable_Default as a ProfilVariableDefault0
|
||||
func (t ProfilVariable_Default) AsProfilVariableDefault0() (ProfilVariableDefault0, error) {
|
||||
var body ProfilVariableDefault0
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromProfilVariableDefault0 overwrites any union data inside the ProfilVariable_Default as the provided ProfilVariableDefault0
|
||||
func (t *ProfilVariable_Default) FromProfilVariableDefault0(v ProfilVariableDefault0) error {
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeProfilVariableDefault0 performs a merge with any union data inside the ProfilVariable_Default, using the provided ProfilVariableDefault0
|
||||
func (t *ProfilVariable_Default) MergeProfilVariableDefault0(v ProfilVariableDefault0) error {
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
// AsProfilVariableDefault1 returns the union data inside the ProfilVariable_Default as a ProfilVariableDefault1
|
||||
func (t ProfilVariable_Default) AsProfilVariableDefault1() (ProfilVariableDefault1, error) {
|
||||
var body ProfilVariableDefault1
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromProfilVariableDefault1 overwrites any union data inside the ProfilVariable_Default as the provided ProfilVariableDefault1
|
||||
func (t *ProfilVariable_Default) FromProfilVariableDefault1(v ProfilVariableDefault1) error {
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeProfilVariableDefault1 performs a merge with any union data inside the ProfilVariable_Default, using the provided ProfilVariableDefault1
|
||||
func (t *ProfilVariable_Default) MergeProfilVariableDefault1(v ProfilVariableDefault1) error {
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
// AsProfilVariableDefault2 returns the union data inside the ProfilVariable_Default as a ProfilVariableDefault2
|
||||
func (t ProfilVariable_Default) AsProfilVariableDefault2() (ProfilVariableDefault2, error) {
|
||||
var body ProfilVariableDefault2
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromProfilVariableDefault2 overwrites any union data inside the ProfilVariable_Default as the provided ProfilVariableDefault2
|
||||
func (t *ProfilVariable_Default) FromProfilVariableDefault2(v ProfilVariableDefault2) error {
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeProfilVariableDefault2 performs a merge with any union data inside the ProfilVariable_Default, using the provided ProfilVariableDefault2
|
||||
func (t *ProfilVariable_Default) MergeProfilVariableDefault2(v ProfilVariableDefault2) error {
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
func (t ProfilVariable_Default) MarshalJSON() ([]byte, error) {
|
||||
b, err := t.union.MarshalJSON()
|
||||
return b, err
|
||||
}
|
||||
|
||||
func (t *ProfilVariable_Default) UnmarshalJSON(b []byte) error {
|
||||
err := t.union.UnmarshalJSON(b)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user