gh warp vault query, you can supply a query to locate one or more credentials and optionally retrieve only a specific property or nested value.
Quick Example
The following example demonstrates how VaultQL can be used in a shell scripting scenario. Credentials are queried from Warp Vault and passed into GitHub Enterprise Importer.Query Syntax
A query is specified at the beginning of the command and must be enclosed in parentheses. An optional extraction path (to pull out a specific property) is appended immediately after the closing parenthesis.General Format
- Query Elements: A comma-separated list of key/value pairs used to match provider properties.
- Extraction Path: A dot-prefixed path indicating which property to return from the matched provider.
Query Elements
Each element in the query helps narrow down your search. There are two types of elements:Top-Level Properties
These match properties at the root level of a provider’s JSON. Supported Keys Thetype and uuid keys are always available.
Syntax Example:
Searches for a provider with the specified UUID:
(uuid:C3AA88A0-0B1A-4567-B45F-6DB024F15FDE)
Searches for providers of type GitHubDestination:
(type:GitHubDestination)
Data Path Elements
These match properties within the provider’s “data” field. When using these in a query, begin the element with a period (.).
Syntax Example
Matches a provider whose data contains the key organization_slug with the value your-github-org-slug:
(.organization_slug:"your-github-org-slug")
Optional Elements
You can use the? prefix to mark a query element as optional. This helps refine the search when some properties might not be available on every provider.
Syntax Example
The following query indicates that while it’s preferable for the returned provider to have an organization_slug of org3, it isn’t mandatory for the match:
(?.organization_slug:"org3")
Multiple elements are separated by commas. All non-optional elements must match for a provider to be considered, while optional elements contribute to a “best match” ranking if several providers qualify.
Extraction Paths
After the closing parenthesis of your query, you can specify an extraction path to return just one property instead of the entire provider JSON. Syntax Example Returns the value oforganization_slug from the matching provider:
password field inside the credentials object of a Bitbucket Server provider:
Examples
Full Provider Retrieval Returns the complete JSON object for the provider with the specified UUID:type:DemoProvider- Only providers of type
DemoProviderare considered.
- Only providers of type
?.organization_slug:"org3"- Prefers a provider with an organization slug of
org3.
- Prefers a provider with an organization slug of
?.access_scope:"global"- Alternatively, a provider with
globalaccess_scopeis acceptable.
- Alternatively, a provider with
.pat- Returns only the personal access token from the matched provider.
pat value of the provider that best matches the criteria.
Strict Queries
The following strict query requires a DemoProvider with an exact organization_slug of org3. If no provider meets all criteria, nothing is returned (and an error is reported).