Add preferred endpoints logic to API/handler/DB and some CLI bits (#1529)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-09-20 12:48:38 -04:00
1 parent f9c620a5d5
commit 01d4383c1b
46 files changed
+1737 -231

No files matched your search

+13 -12
View File
@@ -13,18 +13,19 @@ import (
)
type HostSet struct {
Id string `json:"id,omitempty"`
HostCatalogId string `json:"host_catalog_id,omitempty"`
Scope *scopes.ScopeInfo `json:"scope,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CreatedTime time.Time `json:"created_time,omitempty"`
UpdatedTime time.Time `json:"updated_time,omitempty"`
Version uint32 `json:"version,omitempty"`
Type string `json:"type,omitempty"`
HostIds []string `json:"host_ids,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
AuthorizedActions []string `json:"authorized_actions,omitempty"`
Id string `json:"id,omitempty"`
HostCatalogId string `json:"host_catalog_id,omitempty"`
Scope *scopes.ScopeInfo `json:"scope,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CreatedTime time.Time `json:"created_time,omitempty"`
UpdatedTime time.Time `json:"updated_time,omitempty"`
Version uint32 `json:"version,omitempty"`
Type string `json:"type,omitempty"`
HostIds []string `json:"host_ids,omitempty"`
PreferredEndpoints []string `json:"preferred_endpoints,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
AuthorizedActions []string `json:"authorized_actions,omitempty"`
response *api.Response
}
+12
View File
@@ -97,3 +97,15 @@ func DefaultName() Option {
o.postMap["name"] = nil
}
}
func WithPreferredEndpoints(inPreferredEndpoints []string) Option {
return func(o *options) {
o.postMap["preferred_endpoints"] = inPreferredEndpoints
}
}
func DefaultPreferredEndpoints() Option {
return func(o *options) {
o.postMap["preferred_endpoints"] = nil
}
}