-
Couldn't load subscription status.
- Fork 54
(DOCS) Add reference for config functions #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SteveL-MSFT
merged 2 commits into
PowerShell:main
from
michaeltlombardi:docs/main/configuration-functions
Jan 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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://raw.githubusercontent.com/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://raw.githubusercontent.com/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 hidden or 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 up to `18446744073709551615` arguments. | ||
michaeltlombardi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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://raw.githubusercontent.com/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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.