create cluster ISO image

This commit is contained in:
Lukasz Zajaczkowski
2025-02-06 14:29:01 +01:00
parent 0ecfe9672a
commit 390891fa14
12 changed files with 305 additions and 60 deletions

33
pkg/helpers/http.go Normal file
View File

@@ -0,0 +1,33 @@
package helpers
import (
"net/http"
)
type AuthorizationTokenTransport struct {
token string
transport http.RoundTripper
}
func (in *AuthorizationTokenTransport) RoundTrip(req *http.Request) (*http.Response, error) {
req.Header.Set("Authorization", "Token "+in.token)
return in.transport.RoundTrip(req)
}
func NewAuthorizationTokenTransport(token string) http.RoundTripper {
return &AuthorizationTokenTransport{token: token, transport: http.DefaultTransport}
}
type AuthorizationBearerTransport struct {
token string
transport http.RoundTripper
}
func (in *AuthorizationBearerTransport) RoundTrip(req *http.Request) (*http.Response, error) {
req.Header.Set("Authorization", "Bearer "+in.token)
return in.transport.RoundTrip(req)
}
func NewAuthorizationBearerTransport(token string) http.RoundTripper {
return &AuthorizationBearerTransport{token: token, transport: http.DefaultTransport}
}