Skip to content

Commit 75b746d

Browse files
(DOCS) Add --input and --file options to dsc resource export
1 parent 56144ae commit 75b746d

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

docs/reference/cli/resource/export.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,40 @@ Generates a configuration document that defines the existing instances of a spec
1313

1414
## Syntax
1515

16+
### Without instance properties
17+
1618
```sh
1719
dsc resource export [Options] --resource <RESOURCE>
1820
```
1921

22+
### Instance properties from input option
23+
24+
```sh
25+
dsc resource export --input <INPUT> --resource <RESOURCE>
26+
```
27+
28+
### Instance properties from file
29+
30+
```sh
31+
dsc resource export --file <FILE> --resource <RESOURCE>
32+
```
33+
34+
### Instance properties from stdin
35+
36+
```sh
37+
cat <FILE> | dsc resource get [Options] --resource <RESOURCE> --file -
38+
```
39+
2040
## Description
2141

2242
The `export` subcommand generates a configuration document that includes every instance of a
2343
specific resource. The resource must be specified with the `--resource` option.
2444

45+
Starting with DSC 3.1.0, You can use the `--input` or `--file` option to specify a resource
46+
instance to use as a filter for the exported resources. When you do, the specified instance is
47+
passed to the resource for use in filtering. The implementation for filtering depends on each
48+
resource, not DSC itself.
49+
2550
Only specify exportable resources with a resource manifest that defines the [export][01] section in
2651
the input configuration. If the specified resource type isn't exportable, DSC raises an error.
2752

@@ -48,6 +73,48 @@ LongSyntax : --resource <RESOURCE>
4873
ShortSyntax : -r <RESOURCE>
4974
```
5075
76+
### -i, --input
77+
78+
<a id="-i"></a>
79+
<a id="--input"></a>
80+
81+
Specifies the resource instance to use as a filter for exported resource instances.
82+
83+
The instance must be a string containing a JSON or YAML object. DSC validates the object against
84+
the resource's instance schema. If the validation fails, DSC raises an error.
85+
86+
This option is mutually exclusive with the `--file` option.
87+
88+
```yaml
89+
Type : string
90+
Mandatory : false
91+
LongSyntax : --input <INPUT>
92+
ShortSyntax : -i <INPUT>
93+
```
94+
95+
### -f, --file
96+
97+
<a id="-f"></a>
98+
<a id="--file"></a>
99+
100+
Defines the path to a file defining the resource instance to use as a filter for exported resource
101+
instances.
102+
103+
The specified file must contain a JSON or YAML object that represents valid properties for the
104+
resource. DSC validates the object against the resource's instance schema. If the validation fails,
105+
or if the specified file doesn't exist, DSC raises an error.
106+
107+
You can also use this option to pass an instance from stdin, as shown in [Example 3](#example-3).
108+
109+
This option is mutually exclusive with the `--input` option.
110+
111+
```yaml
112+
Type : string
113+
Mandatory : false
114+
LongSyntax : --file <FILE>
115+
ShortSyntax : -f <FILE>
116+
```
117+
51118
### -o, --output-format
52119

53120
<a id="-o"></a>

0 commit comments

Comments
 (0)