Last active
July 29, 2020 20:47
-
-
Save TobiG77/ef031b645183b821081a378866b03419 to your computer and use it in GitHub Desktop.
validate payload with cue vet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
payload.json: | |
{ | |
"resource_id": "/subscription/.../...", | |
"version": "2020-07-21", | |
"type": "Linux", | |
"properties": { | |
"custom_log_files": [ | |
"/var/log/dmesg", | |
"/var/log/messages" | |
] | |
} | |
} | |
rules.cue: | |
#LoggingLinuxVM: { | |
resource_id: #NonEmptyString | |
version: =~"2020-07-21" | |
type: =~"Linux" | |
properties: #LoggingPropertiesLinuxVM | |
} | |
#LoggingPropertiesLinuxVM: { | |
CustomLogFiles: [...#NonEmptyString] | |
} | |
#NonEmptyString: string & !="" | |
$: cue vet payload.json rules.cue ; echo $? | |
# passes for invalid payloads |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment