Skip to content

Commit 5229401

Browse files
committed
Add schema for secret
1 parent 4750f77 commit 5229401

File tree

3 files changed

+127
-0
lines changed

3 files changed

+127
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# yaml-language-server: $schema=https://json-schema.org/draft/2020-12/schema
2+
$schema: https://json-schema.org/draft/2020-12/schema
3+
$id: <HOST>/<PREFIX>/<VERSION>/extension/manifest.secret.yaml
4+
5+
title: Secret operation command
6+
description: >-
7+
Defines how DSC must call the DSC extension to retrieve a secret value.
8+
markdownDescription: | # VS Code only
9+
***
10+
[_Online Documentation_][00]
11+
***
12+
13+
Defines how DSC must call the DSC extension to retrieve a secret value. An
14+
extension that defines this field in its manifest has the `secret` capability.
15+
16+
The secret operation is expected to output a single line to stdout containing
17+
the secret text. If the extension outputs no data to stdout, DSC treats it as
18+
"no secret returned". If the extension outputs multiple lines, DSC treats that
19+
as an error.
20+
21+
For details about the output format, see
22+
[Secret extension operation stdout][01].
23+
24+
[00]: <DOCS_BASE_URL>/reference/schemas/extension/manifest/secret?<DOCS_VERSION_PIN>
25+
[01]: <DOCS_BASE_URL>/reference/schemas/extension/stdout/secret?<DOCS_VERSION_PIN>
26+
27+
type: object
28+
required:
29+
- executable
30+
properties:
31+
executable:
32+
$ref: /<PREFIX>/<VERSION>/definitions/commandExecutable.yaml
33+
markdownDescription: |
34+
***
35+
[_Online Documentation_][01]
36+
***
37+
38+
Defines the name of the command to run. The value must be the name of a command discoverable
39+
in the system's `PATH` environment variable or the full path to the command. A file extension
40+
is only required when the command isn't recognizable by the operating system as an
41+
executable.
42+
43+
[01]: <DOCS_BASE_URL>/reference/schemas/extension/manifest/secret?<DOCS_VERSION_PIN>#executable
44+
args:
45+
title: Arguments
46+
description: >-
47+
Defines an ordered list of arguments to pass to the command.
48+
markdownDescription: |
49+
***
50+
[_Online Documentation_][01]
51+
***
52+
53+
Defines an ordered list of arguments to pass to the command. Items can be plain strings or
54+
structured entries indicating which argument name should receive the secret name or the vault
55+
name.
56+
57+
DSC expands structured entries as follows:
58+
59+
- `{ "nameArg": "<flag>" }` expands to `"<flag>", "<secret-name>"`.
60+
- `{ "vaultArg": "<flag>" }` expands to `"<flag>", "<vault-name>"` (only when a vault is
61+
specified by the caller).
62+
63+
[01]: <DOCS_BASE_URL>/reference/schemas/extension/manifest/secret?<DOCS_VERSION_PIN>#args
64+
type: array
65+
items:
66+
anyOf:
67+
- type: string
68+
- type: object
69+
additionalProperties: false
70+
required:
71+
- nameArg
72+
properties:
73+
nameArg:
74+
type: string
75+
- type: object
76+
additionalProperties: false
77+
required:
78+
- vaultArg
79+
properties:
80+
vaultArg:
81+
type: string
82+
83+
defaultSnippets: # VS Code only
84+
- label: ' Define without arguments'
85+
markdownDescription: |
86+
Define the `secret` command for the extension when no arguments are required.
87+
body:
88+
executable: ${2:executable_name}
89+
- label: ' Define with arguments (flags + name)'
90+
markdownDescription: |-
91+
Define the `secret` command where the secret name is passed to a specific flag.
92+
body:
93+
executable: ${2:executable_name}
94+
args:
95+
- ${3:--get-secret}
96+
- nameArg: ${4:--name}
97+
- label: ' Define with arguments (flags + name + vault)'
98+
markdownDescription: |-
99+
Define the `secret` command where both the secret name and the vault name are passed.
100+
body:
101+
executable: ${2:executable_name}
102+
args:
103+
- ${3:--get-secret}
104+
- nameArg: ${4:--name}
105+
- vaultArg: ${5:--vault}

schemas/src/extension/manifest.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ properties:
459459
characters are permitted.
460460
discover:
461461
$ref: /<PREFIX>/<VERSION>/extension/manifest.discover.yaml
462+
secret:
463+
$ref: /<PREFIX>/<VERSION>/extension/manifest.secret.yaml
462464
exitCodes:
463465
# This setting in the root of the schema implies exit codes must have the
464466
# same meaning across all executions. What about implementations that
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# yaml-language-server: $schema=https://json-schema.org/draft/2020-12/schema
2+
$schema: https://json-schema.org/draft/2020-12/schema
3+
$id: <HOST>/<PREFIX>/<VERSION>/extension/stdout/secret.yaml
4+
5+
title: Secret extension operation stdout
6+
description: >-
7+
Represents the secret text returned by a DSC extension for a secret request.
8+
markdownDescription: | # VS Code only
9+
***
10+
[_Online Documentation_][00]
11+
***
12+
13+
Represents the secret text returned by a DSC extension for a secret request. DSC expects the
14+
extension to emit a single line containing only the secret value. An empty output indicates that
15+
no secret is available. If multiple lines are emitted, DSC treats it as an error.
16+
17+
[00]: <DOCS_BASE_URL>/reference/schemas/extension/stdout/secret?<DOCS_VERSION_PIN>
18+
19+
type: string
20+
minLength: 0

0 commit comments

Comments
 (0)