TRACK: SITE RELIABILITY ENGINEERING SPEAKER: Rob Hirschfeld (@zehicle) Why JQ? Not because it’s elegant, fun or easy. JK! While APIs are JSON native, people aren’t. ● Pretty Print ● Validate JSON ● Parse JSON ● Search JSON ● Build JSON
TRACK: SITE RELIABILITY ENGINEERING SPEAKER: Rob Hirschfeld (@zehicle) A LOT! It’s so critical, we embedded it into our golang CLI so we didn’t have to install it everywhere. If you cp & suffix “drpcli” with “jq” then it becomes a JQ parser! How much does RackN JQ?
TRACK: SITE RELIABILITY ENGINEERING SPEAKER: Rob Hirschfeld (@zehicle) Distributed Infrastructure as Code with API-driven Provisioning All our API models and events are JSON All our states are JSON All our IaC templates are JSON (ok, we source them in YAML because readability) What does RackN do?
TRACK: SITE RELIABILITY ENGINEERING SPEAKER: Rob Hirschfeld (@zehicle) JSON finding cat all.json | jq ‘.[] | select(.Name==”test1”)’ Can use lots of logic! Like has, in, >, etc but, be careful of unexpected output! cat all.json | \ jq '.[] | select(.Name | startswith("test"))'
TRACK: SITE RELIABILITY ENGINEERING SPEAKER: Rob Hirschfeld (@zehicle) Building JSON maps (arrays) this is set operations…. be careful cat all.json | \ jq 'map(.Name | startswith("test"))' not what you think! cat all.json | \ jq 'map(select(.Name | startswith("test")))'
TRACK: SITE RELIABILITY ENGINEERING SPEAKER: Rob Hirschfeld (@zehicle) Thank you! Resources: Online Dev Tooling: https://jqplay.org Reference: https://stedolan.github.com/jq This is stable stuff! Last major release was 2018