plancontext: use helpers to determine if CUE value is secret/fs/service
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
@@ -18,6 +18,10 @@ var (
|
||||
)
|
||||
)
|
||||
|
||||
func IsFSValue(v *compiler.Value) bool {
|
||||
return v.LookupPath(fsIDPath).Exists()
|
||||
}
|
||||
|
||||
type FS struct {
|
||||
id string
|
||||
result bkgw.Reference
|
||||
@@ -54,10 +58,6 @@ func (c *fsContext) New(result bkgw.Reference) *FS {
|
||||
return fs
|
||||
}
|
||||
|
||||
func (c *fsContext) Contains(v *compiler.Value) bool {
|
||||
return v.LookupPath(fsIDPath).Exists()
|
||||
}
|
||||
|
||||
func (c *fsContext) FromValue(v *compiler.Value) (*FS, error) {
|
||||
c.l.RLock()
|
||||
defer c.l.RUnlock()
|
||||
|
@@ -16,6 +16,10 @@ var (
|
||||
)
|
||||
)
|
||||
|
||||
func IsSecretValue(v *compiler.Value) bool {
|
||||
return v.LookupPath(secretIDPath).Exists()
|
||||
}
|
||||
|
||||
type Secret struct {
|
||||
id string
|
||||
plainText string
|
||||
@@ -55,10 +59,6 @@ func (c *secretContext) New(plaintext string) *Secret {
|
||||
return secret
|
||||
}
|
||||
|
||||
func (c *secretContext) Contains(v *compiler.Value) bool {
|
||||
return v.LookupPath(secretIDPath).Exists()
|
||||
}
|
||||
|
||||
func (c *secretContext) FromValue(v *compiler.Value) (*Secret, error) {
|
||||
c.l.RLock()
|
||||
defer c.l.RUnlock()
|
||||
|
@@ -16,6 +16,10 @@ var (
|
||||
)
|
||||
)
|
||||
|
||||
func IsServiceValue(v *compiler.Value) bool {
|
||||
return v.LookupPath(serviceIDPath).Exists()
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
id string
|
||||
|
||||
@@ -62,10 +66,6 @@ func (c *serviceContext) New(unix, npipe string) *Service {
|
||||
return s
|
||||
}
|
||||
|
||||
func (c *serviceContext) Contains(v *compiler.Value) bool {
|
||||
return v.LookupPath(serviceIDPath).Exists()
|
||||
}
|
||||
|
||||
func (c *serviceContext) FromValue(v *compiler.Value) (*Service, error) {
|
||||
c.l.RLock()
|
||||
defer c.l.RUnlock()
|
||||
|
Reference in New Issue
Block a user