Created
March 3, 2021 11:44
-
-
Save pkutaj/75df87756af52d854ce1b9e15ced898f to your computer and use it in GitHub Desktop.
query-consul.ps1
This file contains 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
function query-consul ([string]$customer, [string]$queryString, [int]$context, [switch]$detailed) { | |
$consulURL = "https://consul.foo.net/ui/eu-central-1/kv/customer/$customer" | |
elseif ($detailed) { | |
consul kv get -recurse -detailed customer/$customer | | |
Select-String $queryString -Context 1, $context | |
} | |
else { | |
consul kv get -recurse customer/$customer | | |
Select-String $queryString -Context 1, $context | |
} | |
<# | |
.SYNOPSIS | |
- Function querying Hashicorp Consul'KV for the a string in question | |
.DESCRIPTION | |
- Provide an empty string to query all folders | |
- Run with -detailed flag to get richer outout | |
- You can provide -context [int] to get richer output | |
#> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment