Update osbuild/images to v0.56.0

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-04-23 09:09:17 +02:00 committed by Achilleas Koutsou
parent 3df0c3a631
commit 5028a8c99d
159 changed files with 13207 additions and 3630 deletions

View file

@ -34,6 +34,7 @@ import (
"net/http/cookiejar"
"net/url"
"os"
"path"
"path/filepath"
"reflect"
"regexp"
@ -477,6 +478,42 @@ func (c *Client) SetCertificate(cert tls.Certificate) {
t.TLSClientConfig.Certificates = []tls.Certificate{cert}
}
// UseServiceVersion sets Client.Version to the current version of the service endpoint via /sdk/vimServiceVersions.xml
func (c *Client) UseServiceVersion(kind ...string) error {
ns := "vim"
if len(kind) != 0 {
ns = kind[0]
}
u := c.URL()
u.Path = path.Join("/sdk", ns+"ServiceVersions.xml")
res, err := c.Get(u.String())
if err != nil {
return err
}
if res.StatusCode != http.StatusOK {
return fmt.Errorf("http.Get(%s): %s", u.Path, res.Status)
}
v := struct {
Namespace *string `xml:"namespace>name"`
Version *string `xml:"namespace>version"`
}{
&c.Namespace,
&c.Version,
}
err = xml.NewDecoder(res.Body).Decode(&v)
_ = res.Body.Close()
if err != nil {
return fmt.Errorf("xml.Decode(%s): %s", u.Path, err)
}
return nil
}
// Tunnel returns a Client configured to proxy requests through vCenter's http port 80,
// to the SDK tunnel virtual host. Use of the SDK tunnel is required by LoginExtensionByCertificate()
// and optional for other methods.