title: How to add functions like generating random UUID in velocity template for request/response mapping in API gateway
body: <p>I am creating a request mapping template for AWS API gateway. In that template I want to customize the request params based on certain conditions and apply operators.</p>
  
  <pre><code> #foreach($header in $input.params().header.keySet())
       #if($header=="id")#set($idVal = 
       $util.escapeJavaScript($input.params().header.get($header)))
           #if($idVal.matches("^[0-9a-f]{4}-[0-9A-Z]{3}$"))
               "$header":"$idVal"
           #else
             #set($random = UUID.randomUUID())
            "$header":"$random"
           #end
       #else
  </code></pre>
  
  <p>For example, in the above template based on if condition I want to generate randomUUID and add to the header. But when I test, the id value is set to empty string. </p>
  
  <p>How can I use packages and java functions support in velocity template mapping api gateway? Also, please share any reference to wellformed template, it would be really useful to learn more.</p>