Skip to content

Commit 988cef2

Browse files
authored
Merge pull request #1016 from michaeltlombardi/docs/main/output-docs
(DOCS) Add reference docs for expected resource operations stdout
2 parents 6eeef0e + 26bb232 commit 988cef2

File tree

15 files changed

+857
-99
lines changed

15 files changed

+857
-99
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
description: JSON schema reference for resource capabilities
3+
ms.date: 07/03/2025
4+
ms.topic: reference
5+
title: DSC Resource capabilities schema reference
6+
---
7+
8+
# DSC Resource capabilities schema reference
9+
10+
## Synopsis
11+
12+
Defines the operations you can invoke for a resource and how the resource behaves when invoked.
13+
14+
## Metadata
15+
16+
```yaml
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.1.0/definitions/resourceKind.json
19+
Type: array
20+
Required: true
21+
ItemsMustBeUnique: true
22+
ItemsType: string
23+
ItemsValidValues: [
24+
get,
25+
set,
26+
setHandlesExist,
27+
whatIf,
28+
test,
29+
delete,
30+
export,
31+
resolve
32+
]
33+
```
34+
35+
## Description
36+
37+
DSC resources always have at least one capability. Resource capabilities define the operations you
38+
can invoke for a resource and how the resource behaves when invoked.
39+
40+
DSC resources may have the following capabilities:
41+
42+
- `get` - The resource can retrieve the current state of an instance.
43+
- `set` - The resource can enforce the desired state for an instance.
44+
- `setHandlesExist` - The resource handles deleting an instance during a **Set** operation.
45+
- `whatIf` - The resource can report how it would change state for an instance during a **Set** operation.
46+
- `test` - The resource implements the **Test** operation and doesn't rely on synthetic testing.
47+
- `delete` - The resource can remove an instance.
48+
- `export` - The resource can enumerate every instance.
49+
- `resolve` - The resource can resolve nested instances from an external source.
50+
51+
For more information about resource capabilities, see [DSC resource capabilities][01]. For more
52+
information about the operations you can invoke for a resource, see [DSC resource operations][02].
53+
54+
[01]: ../../../concepts/resources/capabilities.md
55+
[02]: ../../../concepts/resources/operations.md

docs/reference/schemas/definitions/resourceKind.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,33 @@ title: DSC Resource kind schema reference
99

1010
## Synopsis
1111

12-
Identifies whether a resource is an adapter resource, a group resource, or a normal resource.
12+
Identifies whether a resource is an adapter resource, a group resource, an importer resource, an exporter resource, or a normal resource.
1313

1414
## Metadata
1515

1616
```yaml
1717
SchemaDialect: https://json-schema.org/draft/2020-12/schema
1818
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.1.0/definitions/resourceKind.json
1919
Type: string
20-
ValidValues: [resource, adapter, group, importer]
20+
ValidValues: [resource, adapter, group, importer, exporter]
2121
```
2222
2323
## Description
2424
25-
DSC supports three kinds of command-based DSC Resources:
25+
DSC supports several kinds of command resources:
2626
27-
- `resource` - Indicates that the manifest isn't for a group or adapter resource.
27+
- `resource` - Indicates that the manifest is for a typical resource.
2828
- `group` - Indicates that the manifest is for a [group resource](#group-resources).
2929
- `adapter` - Indicates that the manifest is for an [adapter resource](#adapter-resources).
3030
- `importer` - Indicates that the manifest is for an [importer resource](#importer-resources).
3131
- `exporter` - Indicates that the manifest is for an [exporter resource](#exporter-resources).
3232

33-
When `kind` isn't defined in the resource manifest, DSC infers the value for the property. If the
34-
`adapter` property is defined in the resource manifest, DSC infers the value of `kind` as
35-
`adapter`. If the `adapter` property isn't defined, DSC infers the value of `kind` as `resource`.
36-
DSC can't infer whether a manifest is for a group or importer resource.
33+
When `kind` isn't defined in the resource manifest for a command resource, DSC infers the value for
34+
the property. If the `adapter` property is defined in the resource manifest, DSC infers the value
35+
of `kind` as `adapter`. If the `adapter` property isn't defined, DSC infers the value of `kind` as
36+
`resource`. DSC can't infer whether a manifest is for a group, importer, or exporter resource.
3737

38-
When defining a group resource, always explicitly define the `kind` property in the manifest as
39-
`group`. When defining an importer resource, always explicitly define the `kind` property in the
40-
manifest as `importer`.
38+
When defining a group, importer, or exporter resource with a resource manifest, always explicitly define `kind`.
4139

4240
### Adapter resources
4341

docs/reference/schemas/outputs/resource/list.md

Lines changed: 20 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -79,70 +79,22 @@ Pattern: ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z
7979

8080
### capabilities
8181

82-
Defines the operations and behaviors the resource is implemented to support. This property is an
83-
array of capabilities. Resources always have the `Get` capability, but the other capabilities are
84-
optional and depend on the resource.
85-
86-
The following list describes the available capabilities for a resource:
87-
88-
- <a id="capability-get" ></a> `get` - The resource supports retrieving the current state of an
89-
instance. All DSC Resources must have this capability. A resource has this capability when it
90-
defines the mandatory [get][07] property in its resource manifest.
91-
- <a id="capability-set" ></a> `set` - The resource supports enforcing the desired state of an
92-
instance. A resource has this capability when it defines the [set][08] property in its resource
93-
manifest. Resources without this capability can't be used with the [dsc resource set][09] or
94-
[dsc config set][10] commands unless they're in a Microsoft.DSC/Assertion group as a nested
95-
instance.
96-
- <a id="capability-sethandlesexist" ></a> `setHandlesExist` - The resource supports the
97-
[_exist property][11] directly. A resource has this capability when it defines the
98-
[handlesExist][12] property as `true` in the definition of the [set][08] command property in its
99-
resource manifest.
100-
101-
When a resource has this capability, the `_exist` property is part of the resource's instance
102-
schema and the resource handles deleting instances of the resource in its `set` command.
103-
104-
When a resource doesn't have this capability, when DSC finds an instance of the resource with
105-
`_exist` set to `false`, it handles calling the [delete][13] operation for the resource.
106-
107-
If the resource doesn't have this capability or the `delete` capability, DSC raises an error when
108-
an instance defines `_exist` as `false`.
109-
- <a id="capability-whatif" ></a> `whatIf` - The resource supports returning explicit information
110-
about how it will modify state when a user calls [dsc config set][10] with the [--what-if][14]
111-
option. A resource has this capability when it defines the [What-if operation][15] in its
112-
resource manifest.
113-
114-
When a resource has this capability, DSC calls the defined command with its arguments when a
115-
user executes the `dsc config set` command with the `--what-if` option.
116-
117-
When a resource doesn't have this capability, DSC synthesizes how the resource will change and
118-
instance by converting the `Test` result for the instance into a `Set` result. The synthetic
119-
operation can't indicate potential issues or changes that can't be determined by comparing the
120-
result of the `Test` operation against the resource's desired state. For example, the credentials
121-
used to test a resource might be valid for that operation, but not have permissions to actually
122-
modify the system state. Only a resource with this capability can fully report whether and how
123-
the resource will change system state.
124-
- <a id="capability-test" ></a> `test` - The resource supports validating the desired state of an
125-
instance against the current state of the instance. A resource has this capability when it
126-
defines the [test][16] property in its resource manifest.
127-
128-
If a resource doesn't have the `test` capability, DSC uses a synthetic test for instances of the
129-
resource. The synthetic test compares each property for the desired state of an instance against
130-
the actual state. The synthetic test uses strict, case-sensitive equivalence. If the desired
131-
state for a property and the actual state aren't the same, DSC marks the property as out of the
132-
desired state.
133-
- <a id="capability-delete" ></a> `delete` - The resource supports removing an instance. A resource
134-
has this capability when it defines the [delete][13] property in its resource manifest. This
135-
capability isn't mutually exclusive with the `setHandlesExist` property. A resource can handle
136-
the `_exist` property in set operations and be called directly with [dsc resource delete][17] to
137-
remove an instance.
138-
- <a id="capability-export" ></a> `export` - The resource supports enumerating every instance of
139-
the resource. A resource has this capability when it defines the [export][18] property in its
140-
resource manifest. Only resources with this capability are usable with the
141-
[dsc resource export][19] and [dsc config export][20] commands.
142-
- <a id="capability-resolve" ></a> `resolve` - The resource supports resolving nested resource
143-
instances from an external source. A resource has this capability when it defines the
144-
[resolve][21] property in its resource manifest. This functionality is primarily used by
145-
[importer resources][22].
82+
DSC resources always have at least one capability. Resource capabilities define the operations you
83+
can invoke for a resource and how the resource behaves when invoked.
84+
85+
DSC resources may have the following capabilities:
86+
87+
- `get` - The resource can retrieve the current state of an instance.
88+
- `set` - The resource can enforce the desired state for an instance.
89+
- `setHandlesExist` - The resource handles deleting an instance during a **Set** operation.
90+
- `whatIf` - The resource can report how it would change state for an instance during a **Set** operation.
91+
- `test` - The resource implements the **Test** operation and doesn't rely on synthetic testing.
92+
- `delete` - The resource can remove an instance.
93+
- `export` - The resource can enumerate every instance.
94+
- `resolve` - The resource can resolve nested instances from an external source.
95+
96+
For more information about resource capabilities, see [DSC resource capabilities][07]. For more
97+
information about the operations you can invoke for a resource, see [DSC resource operations][08].
14698

14799
```yaml
148100
Type: array
@@ -239,7 +191,7 @@ Required: true
239191

240192
Represents the values defined in the resource's manifest. This value is `null` for resources that
241193
aren't command-based. For more information on the value for this property, see
242-
[Command-based DSC Resource manifest schema reference][23].
194+
[Command-based DSC Resource manifest schema reference][09].
243195

244196
```yaml
245197
Type: [object, 'null']
@@ -253,20 +205,6 @@ Required: true
253205
[04]: ../../definitions/resourceKind.md#group-resources
254206
[05]: ../../resource/manifest/root.md#kind
255207
[06]: ../../definitions/resourceKind.md
256-
[07]: ../../resource/manifest/get.md
257-
[08]: ../../resource/manifest/set.md
258-
[09]: ../../../cli/resource/set.md
259-
[10]: ../../../cli/config/set.md
260-
[11]: ../../resource/properties/exist.md
261-
[12]: ../../resource/manifest/set.md#handlesexist
262-
[13]: ../../resource/manifest/delete.md
263-
[14]: ../../../cli/config/set.md#-w---what-if
264-
[15]: ../../resource/manifest/whatif.md
265-
[16]: ../../resource/manifest/test.md
266-
[17]: ../../../cli/resource/delete.md
267-
[18]: ../../resource/manifest/export.md
268-
[19]: ../../../cli/resource/export.md
269-
[20]: ../../../cli/config/export.md
270-
[21]: ../../resource/manifest/resolve.md
271-
[22]: ../../definitions/resourceKind.md#importer-resources
272-
[23]: ../../resource/manifest/root.md
208+
[07]: ../../../../concepts/resources/capabilities.md
209+
[08]: ../../../../concepts/resources/operations.md
210+
[09]: ../../resource/manifest/root.md

docs/reference/schemas/resource/manifest/root.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,23 +166,24 @@ Required: false
166166

167167
### kind
168168

169-
The `kind` property defines how DSC should handle the resource. DSC supports three kinds of
170-
command-based DSC Resources: `Resource`, `Group`, and `Adapter`.
169+
The `kind` property defines how DSC should handle the resource. DSC supports several kinds
170+
of DSC resources: `resource`, `group`, `adapter`, `importer`, and `exporter`.
171171

172172
When `kind` isn't defined in the resource manifest, DSC infers the value for the property. If the
173173
`adapter` property is defined in the resource manifest, DSC infers the value of `kind` as
174-
`Adapter`. If the `adapter` property isn't defined, DSC infers the value of `kind` as `Resource`.
175-
DSC can't infer whether a manifest is for a group resource.
174+
`adapter`. If the `adapter` property isn't defined, DSC infers the value of `kind` as `resource`.
175+
DSC can't infer whether a manifest is for a `group` or `importer` resource.
176176

177177
When defining a group resource, always explicitly define the `kind` property in the manifest as
178-
`Group`.
178+
`group`. When defining an importer resource, always explicitly define the `kind` property in the
179+
manifest as `importer`.
179180

180181
For more information, see [DSC Resource kind schema reference][02].
181182

182183
```yaml
183184
Type: string
184185
Required: false
185-
ValidValues: [Resource, Adapter, Group]
186+
ValidValues: [resource, adapter, group, importer, exporter]
186187
```
187188

188189
### tags
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
description: JSON schema reference for the expected stdout from the delete resource operation
3+
ms.date: 02/28/2025
4+
ms.topic: reference
5+
title: DSC resource delete operation stdout schema reference
6+
---
7+
8+
# DSC resource delete operation stdout schema reference
9+
10+
## Synopsis
11+
12+
DSC doesn't expect the **Delete** operation for a resource to return any JSON to stdout.
13+
14+
## Metadata
15+
16+
```yaml
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.1.0/resource/stdout/delete.json
19+
Type: 'null'
20+
```
21+
22+
## Description
23+
24+
DSC resources that implement the **Delete** operation shouldn't emit any data to stdout. DSC
25+
doesn't expect any output for the **Delete** operation and ignores any data emitted to stdout when
26+
invoking the operation.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
description: JSON schema reference for the expected stdout from the export resource operation
3+
ms.date: 07/29/2025
4+
ms.topic: reference
5+
title: DSC resource export operation stdout schema reference
6+
---
7+
8+
# DSC resource export operation stdout schema reference
9+
10+
## Synopsis
11+
12+
Represents the actual state of a resource instance in DSC. DSC expects every JSON Line emitted to
13+
stdout for the **Export** operation to adhere to this schema.
14+
15+
## Metadata
16+
17+
```yaml
18+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
19+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.1.0/resource/stdout/export.json
20+
Type: object
21+
```
22+
23+
## Description
24+
25+
DSC expects a resource implementing the **Export** operation to return a series of JSON Lines.
26+
27+
The data that DSC expects depends on whether the resource kind is defined as `exporter`:
28+
29+
- When the resource kind is `exporter`, DSC expects the resource to return JSON Lines representing
30+
DSC resource instance definitions to recursively export.
31+
- When the resource kind isn't `exporter`, DSC expects the resource to return JSON Lines
32+
representing the actual state of every instance of the resource on the system.
33+
34+
## Typical resource expected output
35+
36+
DSC expects a typical resource implementing the **Export** operation to return a series of JSON
37+
Lines.
38+
39+
Each JSON Line represents the actual state of a resource instance in DSC. DSC expects every JSON
40+
Line emitted to stdout for the **Export** operation to adhere to this schema.
41+
42+
The output must be a JSON object. The object must be a valid representation of an instance of the
43+
resource.
44+
45+
Command resources define their instance schema with the [schema.command][01] or
46+
[schema.embedded][02] fields in their resource manifest. If a command resource returns JSON that is
47+
invalid against the resource instance schema, DSC raises an error.
48+
49+
Adapted resource instances are validated by their adapter when the adapter invokes them.
50+
51+
## Exporter resource expected output
52+
53+
DSC expects an exporter resource (one with the [kind][03] field in its manifest set to `exporter`)
54+
to return a series of JSON Lines.
55+
56+
Each JSON Line represents a DSC resource instance definition to recursively invoke the **Export**
57+
operation for. DSC expects every JSON Line emitted to stdout for the **Export** operation to adhere
58+
to this schema.
59+
60+
The output must be a JSON object adhering to [DSC resource instance][04] schema, rather than the
61+
instance schema for a specific resource. DSC expects the object to define at least the [name][05]
62+
and [type][06] fields. If the object defines the [properties][07] field, DSC passes those
63+
properties to the resource when recursively exporting it so that the resource may filter the
64+
exported instance results.
65+
66+
<!-- Reference link definitions -->
67+
[01]: ../manifest/schema/property.md
68+
[02]: ../manifest/schema/embedded.md
69+
[03]: ../manifest/root.md#kind
70+
[04]: ../../config/resource.md
71+
[05]: ../../config/resource.md#name
72+
[06]: ../../config/resource.md#type
73+
[07]: ../../config/resource.md#properties-1
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
description: JSON schema reference for the expected stdout from the get resource operation
3+
ms.date: 07/29/2025
4+
ms.topic: reference
5+
title: DSC resource get operation stdout schema reference
6+
---
7+
8+
# DSC resource get operation stdout schema reference
9+
10+
## Synopsis
11+
12+
Represents the actual state of a resource instance in DSC. DSC expects the JSON Line emitted to
13+
stdout for the **Get** operation to adhere to this schema.
14+
15+
## Metadata
16+
17+
```yaml
18+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
19+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3.1.0/resource/stdout/get.json
20+
Type: object
21+
```
22+
23+
## Description
24+
25+
Represents the actual state of a resource instance in DSC. DSC expects the JSON Line emitted to
26+
stdout for the **Get** operation to adhere to this schema.
27+
28+
The output must be a JSON object. The object must be a valid representation of an instance of the
29+
resource.
30+
31+
Command resources define their instance schema with the [schema.command][01] or
32+
[schema.embedded][02] fields in their resource manifest. If a command resource returns JSON that is
33+
invalid against the resource instance schema, DSC raises an error.
34+
35+
Adapted resource instances are validated by their adapter when the adapter invokes them.
36+
37+
<!-- Reference link definitions -->
38+
[01]: ../manifest/schema/property.md
39+
[02]: ../manifest/schema/embedded.md

0 commit comments

Comments
 (0)