Skip to content

Commit f7d0cb1

Browse files
(SCHEMA) Update schema source for exporter resource kind.
1 parent 213f54a commit f7d0cb1

File tree

2 files changed

+73
-10
lines changed

2 files changed

+73
-10
lines changed

schemas/src/definitions/resourceKind.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ enum:
1313
- adapter
1414
- group
1515
- importer
16+
- exporter
1617

1718
# VS Code only
1819

@@ -56,3 +57,12 @@ markdownEnumDescriptions:
5657
Indicates that the manifest is for a resource that resolves an external source to DSC
5758
resource instances. DSC processes the resolved instances as nested instances for the importer
5859
resource.
60+
- | # exporter
61+
<!-- force a line break -->
62+
63+
Indicates that the manifest is for a resource that only implements the **Export** operation
64+
to use for inventory and fact-gathering scenarios. For exporter resources, DSC expects the
65+
resource to return one or more resource definitions to recursively export, rather than the
66+
actual state of instances.
67+
68+
For more information about the expected output, see [Export resource operation stdout][02].

schemas/src/resource/stdout/export.yaml

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,73 @@ markdownDescription: | # VS Code only
1111
[_Online Documentation_][00]
1212
***
1313
14-
Represents the actual state of a resource instance in DSC. DSC expects every JSON Line emitted to
15-
stdout for the **Export** operation to adhere to this schema.
14+
DSC expects a resource implementing the **Export** operation to return a series of JSON Lines.
1615
17-
The output must be a JSON object. The object must be a valid representation of an instance of the
18-
resource.
16+
The data that DSC expects depends on whether the resource kind is defined as `exporter`:
1917
20-
Command resources define their instance schema with the [schema.command][01] or
21-
[schema.embedded][02] fields in their resource manifest. If a command resource returns JSON that
22-
is invalid against the resource instance schema, DSC raises an error.
23-
24-
Adapted resource instances are validated by their adapter when the adapter invokes them.
18+
- When the resource kind is `exporter`, DSC expects the resource to return JSON Lines
19+
representing DSC resource instance definitions to recursively export.
20+
- When the resource kind isn't `exporter`, DSC expects the resource to return JSON Lines
21+
representing the actual state of every instance of the resource on the system.
2522
2623
[00]: <DOCS_BASE_URL>/reference/schemas/resource/stdout/export?<DOCS_VERSION_PIN>
2724
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/schema/command?<DOCS_VERSION_PIN>
2825
[02]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/schema/embedded?<DOCS_VERSION_PIN>
2926
30-
type: object
27+
anyOf:
28+
- title: Typical resource expected output
29+
description: >-
30+
Defines the expected output for a resource whose `kind` isn't `exporter` as the actual state
31+
of every existing instance of that resource on the system.
32+
type: object
33+
markdownDescription: | # VS Code only
34+
***
35+
[_Online Documentation_][00]
36+
***
37+
38+
DSC expects a typical resource implementing the **Export** operation to return a series of
39+
JSON Lines.
40+
41+
Each JSON Line represents the actual state of a resource instance in DSC. DSC expects every
42+
JSON Line emitted to stdout for the **Export** operation to adhere to this schema.
43+
44+
The output must be a JSON object. The object must be a valid representation of an instance of
45+
the resource.
46+
47+
Command resources define their instance schema with the [schema.command][01] or
48+
[schema.embedded][02] fields in their resource manifest. If a command resource returns JSON that
49+
is invalid against the resource instance schema, DSC raises an error.
50+
51+
Adapted resource instances are validated by their adapter when the adapter invokes them.
52+
53+
[00]: <DOCS_BASE_URL>/reference/schemas/resource/stdout/export?<DOCS_VERSION_PIN>#typical-resource-expected-output
54+
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/schema/command?<DOCS_VERSION_PIN>
55+
[02]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/schema/embedded?<DOCS_VERSION_PIN>
56+
- title: Exporter resource expected output
57+
description: >-
58+
Defines the expected output for an `exporter` resource as a resource instance definition to
59+
recursively invoke the **Export** operation for.
60+
$ref: /<PREFIX>/<VERSION>/config/document.resource.yaml
61+
markdownDescription: | # VS Code only
62+
***
63+
[_Online Documentation_][00]
64+
***
65+
66+
DSC expects an exporter resource (one with the `kind` field in its manifest set to
67+
`exporter`) to return a series of JSON Lines.
68+
69+
Each JSON Line represents a DSC resource instance definition to recursively invoke the
70+
**Export** operation for. DSC expects every JSON Line emitted to stdout for the **Export**
71+
operation to adhere to this schema.
72+
73+
The output must be a JSON object adhering to [DSC resource instance][01] schema, rather than
74+
the instance schema for a specific resource. DSC expects the object to define at least the
75+
[name][02] and [type][03] fields. If the object defines the [properties][04] field, DSC
76+
passes those properties to the resource when recursively exporting it so that the resource
77+
may filter the exported instance results.
78+
79+
[00]: <DOCS_BASE_URL>/reference/schemas/resource/stdout/export?<DOCS_VERSION_PIN>#typical-resource-expected-output
80+
[01]: <DOCS_BASE_URL>/reference/schemas/config/resource?<DOCS_VERSION_PIN>
81+
[02]: <DOCS_BASE_URL>/reference/schemas/config/resource?<DOCS_VERSION_PIN>#name
82+
[02]: <DOCS_BASE_URL>/reference/schemas/config/resource?<DOCS_VERSION_PIN>#type
83+
[02]: <DOCS_BASE_URL>/reference/schemas/config/resource?<DOCS_VERSION_PIN>#properties-1

0 commit comments

Comments
 (0)