11 Aug 2023 01:26 PM
I am trying to write a json file to create automatically applied tags with rules for entities I am entering in my input yaml for monaco. In the json file, I am trying to write a condition where I'll check whether a certain key exists under the 'parameters' field in yaml; if the key exists, then I'll add the required code block in final json to add that rule and if the key doesn't exist, I'll move onto the next block. With this approach, I am trying to dynamically build a json that'll have the code blocks to create rule only for entities who are present in the yaml file. When I am using the if conditions and the key isn't present, it is showing error that the mentioned key in json isn't present. I tried golang syntax to check if the key exists, but that also didn't work. Kindly suggest whether it's possible to execute in go templating in json and if it's possible, please guide with the syntax. I am attaching the example yaml file and the json that contains the two syntax I have tried so far.
Solved! Go to Solution.
11 Aug 2023 03:35 PM
Hi,
To avoid complexity I would recommend it:
I would try to avoid Go templating since Dynatrace is saying this in the documentation:
Best regards