32 lines
628 B
Go
32 lines
628 B
Go
// Code generated by "make api"; DO NOT EDIT.
|
|
package hosts
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/mitchellh/mapstructure"
|
|
)
|
|
|
|
type StaticHostCatalog struct {
|
|
*HostCatalog
|
|
}
|
|
|
|
func (s HostCatalog) AsStaticHostCatalog() (*StaticHostCatalog, error) {
|
|
out := &StaticHostCatalog{
|
|
HostCatalog: &s,
|
|
}
|
|
decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
|
Result: out,
|
|
TagName: "json",
|
|
})
|
|
if err != nil {
|
|
return nil, fmt.Errorf("error creating map decoder: %w", err)
|
|
}
|
|
|
|
if err := decoder.Decode(s.Attributes); err != nil {
|
|
return nil, fmt.Errorf("error decoding attributes map: %w", err)
|
|
}
|
|
|
|
return out, nil
|
|
}
|