configurator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchPublicKeyFromURL

func FetchPublicKeyFromURL(url string) (*jwtauth.JWTAuth, error)

func LoadAccessToken

func LoadAccessToken()

func NewParams

func NewParams() util.Params

Create a set of params with all default values.

func SaveDefaultConfig

func SaveDefaultConfig(path string)

func VerifyScope

func VerifyScope(testScopes []string, r *http.Request) (bool, error)

func WithVerbosity

func WithVerbosity() util.Option

Types

type BMC

type BMC struct {
}

type ClientOption

type ClientOption func(*SmdClient)

func WithAccessToken

func WithAccessToken(token string) ClientOption

func WithCertPool

func WithCertPool(certPool *x509.CertPool) ClientOption

func WithCertPoolFile

func WithCertPoolFile(certPath string) ClientOption

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

func WithHost

func WithHost(host string) ClientOption

func WithPort

func WithPort(port int) ClientOption

type Component

type Component struct {
	ID                  string      `json:"ID"`
	Type                string      `json:"Type"`
	State               string      `json:"State,omitempty"`
	Flag                string      `json:"Flag,omitempty"`
	Enabled             *bool       `json:"Enabled,omitempty"`
	SwStatus            string      `json:"SoftwareStatus,omitempty"`
	Role                string      `json:"Role,omitempty"`
	SubRole             string      `json:"SubRole,omitempty"`
	NID                 json.Number `json:"NID,omitempty"`
	Subtype             string      `json:"Subtype,omitempty"`
	NetType             string      `json:"NetType,omitempty"`
	Arch                string      `json:"Arch,omitempty"`
	Class               string      `json:"Class,omitempty"`
	ReservationDisabled bool        `json:"ReservationDisabled,omitempty"`
	Locked              bool        `json:"Locked,omitempty"`
}

type Config

type Config struct {
	Version     string            `yaml:"version,omitempty"`
	Server      Server            `yaml:"server,omitempty"`
	SmdClient   SmdClient         `yaml:"smd,omitempty"`
	AccessToken string            `yaml:"access-token,omitempty"`
	Targets     map[string]Target `yaml:"targets,omitempty"`
	PluginDirs  []string          `yaml:"plugins,omitempty"`
	CertPath    string            `yaml:"cacert,omitempty"`
	Options     Options           `yaml:"options,omitempty"`
}

func LoadConfig

func LoadConfig(path string) Config

func NewConfig

func NewConfig() Config

Creates a new config with default parameters.

func (*Config) SaveConfig

func (config *Config) SaveConfig(path string)

type EthernetInterface

type EthernetInterface struct {
	Id          string
	Description string
	MacAddress  string
	LastUpdate  string
	ComponentId string
	Type        string
	IpAddresses []IPAddr
}

type IPAddr

type IPAddr struct {
	IpAddress string `json:"IPAddress"`
	Network   string `json:"Network"`
}

type Jwks

type Jwks struct {
	Uri     string `yaml:"uri"`
	Retries int    `yaml:"retries,omitempty"`
}

type Node

type Node struct {
}

type Options

type Options struct{}

type RedfishEndpoint

type RedfishEndpoint struct {
	ID          string `json:"ID"`
	Type        string `json:"Type"`
	Name        string `json:"Name,omitempty"` // user supplied descriptive name
	Hostname    string `json:"Hostname"`
	Domain      string `json:"Domain"`
	FQDN        string `json:"FQDN"`
	Enabled     bool   `json:"Enabled"`
	UUID        string `json:"UUID,omitempty"`
	User        string `json:"User"`
	Password    string `json:"Password"` // Temporary until more secure method
	UseSSDP     bool   `json:"UseSSDP,omitempty"`
	MACRequired bool   `json:"MACRequired,omitempty"`
	MACAddr     string `json:"MACAddr,omitempty"`
	IPAddr      string `json:"IPAddress,omitempty"`
}

type Server

type Server struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
	Jwks Jwks   `yaml:"jwks,omitempty"`
}

type SmdClient

type SmdClient struct {
	http.Client `json:"-"`
	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 ...ClientOption) SmdClient

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

func (*SmdClient) FetchComponents

func (client *SmdClient) FetchComponents(opts ...util.Option) ([]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(opts ...util.Option) ([]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(opts ...util.Option) ([]RedfishEndpoint, error)

type Target

type Target struct {
	PluginPath    string   `yaml:"plugin,omitempty"`
	TemplatePaths []string `yaml:"templates,omitempty"`
	FilePaths     []string `yaml:"files,omitempty"`
	RunTargets    []string `yaml:"targets,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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