Rego - Language Learner 1

 =============================================================================

 https://www.youtube.com/watch?v=ejH4EzmL7e0

=============================================================================

default hello := false

hello if input.message == "world"

 ----

{
    "message": "world"
}

==================

Both means the same .

default hello := false
or
default hello = false

hello = true
{
   m := hello.message
   m == "world"
}

or

hello {
   m := hello.message
   m == "world"
}

INPUT Message

{
   "message": "world"
}

====Another example of fetching the information

package play

default let_do := false

let_do = true {
   resource := input[_]
   resource.hosts == "databases"
}

 

Result :

{
    "let_do": true
}

============ 

Another Scenarios

default hello := false

hello =  "You are not allowed to do this"   // You can in face write messages instead of true or false
{
   m := hello.message
   m == "world"
}







Comments

Popular posts from this blog

Sty -OPA - Rego : What is OPA

Sty -OPA - Rego : Comparing and Constructing Values

Sty -OPA - Rego : Basic Rego Rules