Fixed issue with generate and added some documentation to funcs

This commit is contained in:
David Allen 2024-07-08 16:11:10 -06:00
parent 7494468bed
commit cd840b2bf0
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
9 changed files with 219 additions and 158 deletions

View file

@ -15,6 +15,7 @@ import (
"github.com/OpenCHAMI/configurator/internal/util"
)
type ClientOption func(*SmdClient)
type SmdClient struct {
http.Client `json:"-"`
Host string `yaml:"host"`
@ -22,10 +23,6 @@ type SmdClient struct {
AccessToken string `yaml:"access-token"`
}
type Params = map[string]any
type Option func(Params)
type ClientOption func(*SmdClient)
func NewSmdClient(opts ...ClientOption) SmdClient {
client := SmdClient{}
for _, opt := range opts {
@ -80,14 +77,14 @@ func WithSecureTLS(certPath string) ClientOption {
return WithCertPool(certPool)
}
func WithVerbosity() Option {
func WithVerbosity() util.Option {
return func(p util.Params) {
p["verbose"] = true
}
}
func NewParams() Params {
return Params{
func NewParams() util.Params {
return util.Params{
"verbose": false,
}
}