Files
threshold/api/hosts/static_host_catalog.go
T
Jeff Mitchell 2926cc1000 Add initial API generation bits (#20)
* Add initial API generation bits

* Revert accidental changes to oplog
2020-05-04 10:58:20 -04:00

34 lines
725 B
Go

// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2020-05-03 14:33:51.4627143 -0400 EDT m=+0.042887101
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
}