Documentation
¶
Index ¶
Constants ¶
const ( KindGateway = "gateway" KindNode = "node" KindSource = "source" KindField = "field" KindFirmware = "firmware" KindDataRepository = "data-repository" KindUser = "user" KindPolicy = "policy" KindServiceAccount = "service-account" OperationAdd = "add" OperationMerge = "merge" OperationDelete = "delete" )
Variables ¶
var ErrApplyFailed = errors.New("apply failed")
ErrApplyFailed is returned after the result table is printed when any row failed.
Functions ¶
Types ¶
type Resource ¶
type Resource struct {
Kind string
Operation string
Replace bool
Index int
Source string
Gateway *gwTY.Config
Node *nodeTY.Node
Src *sourceTY.Source
Field *fieldTY.Field
Firmware *firmwareTY.Firmware
DataRepository *dataRepoTY.Config
User *userTY.User
Policy *policyTY.Policy
ServiceAccount *svcAccountTY.ServiceAccount
Payload map[string]interface{}
}
Resource is one node, source, or field from a YAML/JSON file.
func ParseResources ¶
ParseResources reads one or more resources from YAML or JSON. Supported shapes: a single object, a list, or YAML documents separated by ---.
func (Resource) NaturalKeys ¶
func (Resource) TableResource ¶
type ResourceClient ¶
type ResourceClient interface {
FindGateway(id string) (idFound string, err error)
FindNode(id, gatewayID, nodeID string) (idFound string, err error)
FindSource(id, gatewayID, nodeID, sourceID string) (idFound string, err error)
FindField(id, gatewayID, nodeID, sourceID, fieldID string) (idFound string, err error)
FindFirmware(id string) (idFound string, err error)
FindDataRepository(id string) (idFound string, err error)
FindUser(id, username string) (idFound string, err error)
FindPolicy(id string) (idFound string, err error)
FindServiceAccount(id, name, userRef string) (idFound string, err error)
SaveGateway(resource Resource) error
SaveNode(resource Resource) error
SaveSource(resource Resource) error
SaveField(resource Resource) error
SaveFirmware(resource Resource) error
SaveDataRepository(resource Resource) error
SaveUser(resource Resource) error
SavePolicy(resource Resource) error
SaveServiceAccount(resource Resource) (token string, err error)
DeleteGateway(ids ...string) error
DeleteNode(ids ...string) error
DeleteSource(ids ...string) error
DeleteField(ids ...string) error
DeleteFirmware(ids ...string) error
DeleteDataRepository(ids ...string) error
DeleteUser(ids ...string) error
DeletePolicy(ids ...string) error
DeleteServiceAccount(ids ...string) error
GetExisting(resource Resource) ([]byte, error)
}
ResourceClient looks up and mutates nodes, sources, and fields.