* Rename FriendlyName to Name * Standardize on connection parameters for the server being addr This syncs up WATCHTOWER_ADDR and -addr (formerly -address) and frees up -address to be used in resources (which it is). * Add description fields
59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
// Code generated by "make api"; DO NOT EDIT.
|
|
package hosts
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
|
|
"github.com/fatih/structs"
|
|
|
|
"github.com/hashicorp/watchtower/api"
|
|
"github.com/hashicorp/watchtower/api/internal/strutil"
|
|
)
|
|
|
|
type HostCatalog struct {
|
|
Client *api.Client `json:"-"`
|
|
|
|
defaultFields []string
|
|
|
|
// The ID of the host
|
|
// Output only.
|
|
Id *string `json:"id,omitempty"`
|
|
// The type of the resource, to help differentiate schemas
|
|
Type *string `json:"type,omitempty"`
|
|
// Optional name for identification purposes
|
|
Name *string `json:"name,omitempty"`
|
|
// Optional user-set description for identification purposes
|
|
Description *string `json:"description,omitempty"`
|
|
// The time this host was created
|
|
// Output only.
|
|
CreatedTime time.Time `json:"created_time,omitempty"`
|
|
// The time this host was last updated
|
|
// Output only.
|
|
UpdatedTime time.Time `json:"updated_time,omitempty"`
|
|
// Whether the catalog is disabled
|
|
Disabled *bool `json:"disabled,omitempty"`
|
|
// Attributes specific to the catalog type
|
|
Attributes map[string]interface {
|
|
} `json:"attributes,omitempty"`
|
|
}
|
|
|
|
func (s *HostCatalog) SetDefault(key string) {
|
|
s.defaultFields = strutil.AppendIfMissing(s.defaultFields, key)
|
|
}
|
|
|
|
func (s *HostCatalog) UnsetDefault(key string) {
|
|
s.defaultFields = strutil.StrListDelete(s.defaultFields, key)
|
|
}
|
|
|
|
func (s HostCatalog) MarshalJSON() ([]byte, error) {
|
|
m := structs.Map(s)
|
|
if m == nil {
|
|
m = make(map[string]interface{})
|
|
}
|
|
for _, k := range s.defaultFields {
|
|
m[k] = nil
|
|
}
|
|
return json.Marshal(m)
|
|
}
|