MCPcopy
hub / github.com/redspread/spread / validAttach

Method validAttach

pkg/entity/entity.go:90–100  ·  view source on GitHub ↗

validAttach checks object types to see if the attach is allowed. Objects can only be attached to objects higher in the hierarchy. However, to the nature of iota Application is 0, RC is 1, ...

(e Entity)

Source from the content-addressed store, hash-verified

88// validAttach checks object types to see if the attach is allowed. Objects can
89// only be attached to objects higher in the hierarchy. However, to the nature of iota Application is 0, RC is 1, ...
90func (base base) validAttach(e Entity) error {
91 if e == nil {
92 return ErrorNilEntity
93 }
94 if e.Type() > EntityImage {
95 return ErrorInvalidAttachType
96 } else if base.Type() > e.Type() {
97 return ErrorBadAttachOrder
98 }
99 return nil
100}
101
102// setDefaults sets the bases defaults on an object
103func (base base) setDefaults(obj deploy.KubeObject) {

Callers 5

AttachMethod · 0.80
AttachMethod · 0.80
AttachMethod · 0.80
TestBaseCheckAttachFunction · 0.80
AttachMethod · 0.80

Calls 2

TypeMethod · 0.95
TypeMethod · 0.65

Tested by 1

TestBaseCheckAttachFunction · 0.64