github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/pkg/scanners/cloudformation/parser/fn_not.go (about)

     1  package parser
     2  
     3  import "github.com/aquasecurity/trivy-iac/pkg/scanners/cloudformation/cftypes"
     4  
     5  func ResolveNot(property *Property) (resolved *Property, success bool) {
     6  	if !property.isFunction() {
     7  		return property, true
     8  	}
     9  
    10  	refValue := property.AsMap()["Fn::Not"].AsList()
    11  
    12  	if len(refValue) != 1 {
    13  		return abortIntrinsic(property, "Fn::No should have at only 1 values, returning original Property")
    14  	}
    15  
    16  	funcToInvert, _ := refValue[0].resolveValue()
    17  
    18  	if funcToInvert.IsBool() {
    19  		return property.deriveResolved(cftypes.Bool, !funcToInvert.AsBool()), true
    20  	}
    21  
    22  	return property, false
    23  }