client

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Params)

func WithAccessToken

func WithAccessToken(token string) Option

func WithCertPool

func WithCertPool(certPool *x509.CertPool) Option

func WithCertPoolFile

func WithCertPoolFile(certPath string) Option

FIXME: Need to check for errors when reading from a file

func WithHost

func WithHost(host string) Option

type Params

type Params struct {
	Host        string `yaml:"host"`
	AccessToken string `yaml:"access-token"`
	Transport   *http.Transport
}

func ToParams

func ToParams(opts ...Option) *Params

type SmdClient

type SmdClient struct {
	http.Client `json:"-" yaml:"-"`
	Host        string `yaml:"host"`
	Port        int    `yaml:"port"`
	AccessToken string `yaml:"access-token"`
}

An struct that's meant to extend functionality of the base HTTP client by adding commonly made requests to SMD. The implemented functions are can be used in generator plugins to fetch data when it is needed to substitute values for the Jinja templates used.

func NewSmdClient

func NewSmdClient(opts ...Option) SmdClient

Constructor function that allows supplying Option arguments to set things like the host, port, access token, etc.

func (*SmdClient) FetchComponents

func (client *SmdClient) FetchComponents(verbose bool) ([]configurator.Component, error)

Fetch the components from SMD using its API. An access token may be required if the SMD service SMD_JWKS_URL envirnoment variable is set.

func (*SmdClient) FetchEthernetInterfaces

func (client *SmdClient) FetchEthernetInterfaces(verbose bool) ([]configurator.EthernetInterface, error)

Fetch the ethernet interfaces from SMD service using its API. An access token may be required if the SMD service SMD_JWKS_URL envirnoment variable is set.

func (*SmdClient) FetchRedfishEndpoints

func (client *SmdClient) FetchRedfishEndpoints(verbose bool) ([]configurator.RedfishEndpoint, error)

TODO: improve implementation of this function

Jump to

Keyboard shortcuts

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