ovirt

package
v0.1.1-0...-abb91c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateNewOVirtClient = func(creds *Credentials, logger *KLogr) (ovirtclient.Client, error) {
	if creds == nil {
		return nil, fmt.Errorf("credentials are emtpy")
	}

	tls := ovirtclient.TLS()
	if creds.Insecure {
		tls.Insecure()
	} else {
		if creds.CAFile != "" {
			tls.CACertsFromFile(creds.CAFile)
		}
		if creds.CABundle != "" {
			tls.CACertsFromMemory([]byte(creds.CABundle))
		}
		tls.CACertsFromSystem()
	}

	return ovirtclient.NewWithVerify(
		creds.URL,
		creds.Username,
		creds.Password,
		tls,
		logger,
		nil,
		nil,
	)
}

Functions

func NewCachedOVirtClient

func NewCachedOVirtClient(name string) *cachedOVirtClient

func NewClientService

func NewClientService(
	cfg *rest.Config,
	watchedCreds SecretsToWatch,
) *clientService

Types

type CachedOVirtClient

type CachedOVirtClient interface {
	Get() (ovirtclient.Client, error)
	WithCreateFunc(CreateOVirtClientFunc)
}

type ClientService

type ClientService interface {
	Run(context.Context)
	Shutdown(timeout time.Duration)

	NewCachedClient(name string) CachedOVirtClient
	AddListener(CredentialUpdatable) ClientService
	AddListeners(updatables ...CredentialUpdatable) ClientService
}

type CreateOVirtClientFunc

type CreateOVirtClientFunc func(creds *Credentials, logger *KLogr) (ovirtclient.Client, error)

type CredentialUpdatable

type CredentialUpdatable interface {
	SetCredentials(*Credentials)
}

type Credentials

type Credentials struct {
	URL      string
	Username string
	Password string
	CAFile   string
	Insecure bool
	CABundle string
}

func FromK8sSecret

func FromK8sSecret(secret *apicorev1.Secret) (*Credentials, error)

type KLogr

type KLogr struct {
	VDebug   int
	VInfo    int
	VWarning int
	// contains filtered or unexported fields
}

func NewKLogr

func NewKLogr(names ...string) *KLogr

func (*KLogr) Debugf

func (g *KLogr) Debugf(format string, args ...interface{})

func (*KLogr) Errorf

func (g *KLogr) Errorf(format string, args ...interface{})

func (*KLogr) Infof

func (g *KLogr) Infof(format string, args ...interface{})

func (*KLogr) Warningf

func (g *KLogr) Warningf(format string, args ...interface{})

func (*KLogr) WithContext

func (g *KLogr) WithContext(ctx context.Context) ovirtclientlog.Logger

func (*KLogr) WithVDebug

func (g *KLogr) WithVDebug(level int) *KLogr

func (*KLogr) WithVInfo

func (g *KLogr) WithVInfo(level int) *KLogr

func (*KLogr) WithVWarning

func (g *KLogr) WithVWarning(level int) *KLogr

type SecretsToWatch

type SecretsToWatch struct {
	Namespace  string
	SecretName string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL