Fixed issue with generate and added some documentation to funcs
This commit is contained in:
parent
7494468bed
commit
cd840b2bf0
9 changed files with 219 additions and 158 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue