diff --git a/docs/reference/schemas/config/functions/greater.md b/docs/reference/schemas/config/functions/greater.md new file mode 100644 index 000000000..6b050fd96 --- /dev/null +++ b/docs/reference/schemas/config/functions/greater.md @@ -0,0 +1,156 @@ +--- +description: Reference for the 'greater' DSC configuration document function +ms.date: 07/24/2025 +ms.topic: reference +title: greater +--- + +# greater + +## Synopsis + +Checks whether the first value is greater than the second value. + +## Syntax + +```Syntax +greater(, ) +``` + +## Description + +The `greater()` function checks whether the first value is greater than the second value, +returning `true` if it is and otherwise `false`. You can use this function to compare two +values of the same data type. If the values are different types, like a string and an +integer, DSC returns an error for this function. + +For strings, the comparison is case-sensitive and uses lexicographic ordering based on character codes. + +## Examples + +### Example 1 - Compare two numbers + +The following example shows how you can use the function to compare two numbers. + +```yaml +# greater.example.1.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Compare numbers + type: Microsoft.DSC.Debug/Echo + properties: + output: + firstGreater: "[greater(5, 3)]" + secondGreater: "[greater(3, 5)]" + equalNumbers: "[greater(5, 5)]" +``` + +```bash +dsc config get --file greater.example.1.dsc.config.yaml +``` + +```yaml +results: +- name: Compare numbers + type: Microsoft.DSC.Debug/Echo + result: + actualState: + output: + firstGreater: true + secondGreater: false + equalNumbers: false +messages: [] +hadErrors: false +``` + +### Example 2 - Compare two strings + +The following example shows how you can use the function to compare two strings. + +```yaml +# greater.example.2.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Compare strings + type: Microsoft.DSC.Debug/Echo + properties: + output: + lexicographicGreater: "[greater('b', 'a')]" + lexicographicLess: "[greater('a', 'b')]" + caseSensitive: "[greater('a', 'A')]" +``` + +```bash +dsc config get --file greater.example.2.dsc.config.yaml +``` + +```yaml +results: +- name: Compare strings + type: Microsoft.DSC.Debug/Echo + result: + actualState: + output: + lexicographicGreater: true + lexicographicLess: false + caseSensitive: true +messages: [] +hadErrors: false +``` + +### Example 3 - Type mismatch error + +The following example shows what happens when you try to compare different types. + +```yaml +# greater.example.3.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Type mismatch + type: Microsoft.DSC.Debug/Echo + properties: + output: "[greater('5', 3)]" +``` + +```bash +dsc config get --file greater.example.3.dsc.config.yaml +``` + +This will result in an error because you cannot compare a string with a number. + +## Parameters + +### firstValue + +The first value to compare. Must be the same type as the second value. + +```yaml +Type: [number, string] +Required: true +``` + +### secondValue + +The second value to compare. Must be the same type as the first value. + +```yaml +Type: [number, string] +Required: true +``` + +The `greater()` function expects exactly two input values of the same type. +Separate each value with a comma. If the type of the second input value is +different from the first value, DSC returns an error for the function. + +String comparisons are case-sensitive and use lexicographic ordering. + +## Output + +The `greater()` function returns `true` if the first value is greater than +the second value and otherwise `false`. + +```yaml +Type: bool +``` + + diff --git a/docs/reference/schemas/config/functions/greaterOrEquals.md b/docs/reference/schemas/config/functions/greaterOrEquals.md new file mode 100644 index 000000000..d6e970ba8 --- /dev/null +++ b/docs/reference/schemas/config/functions/greaterOrEquals.md @@ -0,0 +1,158 @@ +--- +description: Reference for the 'greaterOrEquals' DSC configuration document function +ms.date: 07/24/2025 +ms.topic: reference +title: greaterOrEquals +--- + +# greaterOrEquals + +## Synopsis + +Checks whether the first value is greater than or equal to the second value. + +## Syntax + +```Syntax +greaterOrEquals(, ) +``` + +## Description + +The `greaterOrEquals()` function checks whether the first value is greater +than or equal to the second value, returning `true` if it is and otherwise `false`. +You can use this function to compare two values of the same data type. If the values +are different types, like a string and an integer, DSC returns an error for this function. + +For strings, the comparison is case-sensitive and uses lexicographic ordering based on character codes. + +## Examples + +### Example 1 - Compare two numbers + +The following example shows how you can use the function to compare two numbers. + +```yaml +# greaterOrEquals.example.1.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Compare numbers + type: Microsoft.DSC.Debug/Echo + properties: + output: + firstGreater: "[greaterOrEquals(5, 3)]" + secondGreater: "[greaterOrEquals(3, 5)]" + equalNumbers: "[greaterOrEquals(5, 5)]" +``` + +```bash +dsc config get --file greaterOrEquals.example.1.dsc.config.yaml +``` + +```yaml +results: +- name: Compare numbers + type: Microsoft.DSC.Debug/Echo + result: + actualState: + output: + firstGreater: true + secondGreater: false + equalNumbers: true +messages: [] +hadErrors: false +``` + +### Example 2 - Compare two strings + +The following example shows how you can use the function to compare two strings. + +```yaml +# greaterOrEquals.example.2.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Compare strings + type: Microsoft.DSC.Debug/Echo + properties: + output: + lexicographicGreater: "[greaterOrEquals('b', 'a')]" + lexicographicLess: "[greaterOrEquals('a', 'b')]" + equalStrings: "[greaterOrEquals('a', 'a')]" + caseSensitive: "[greaterOrEquals('Aa', 'aa')]" +``` + +```bash +dsc config get --file greaterOrEquals.example.2.dsc.config.yaml +``` + +```yaml +results: +- name: Compare strings + type: Microsoft.DSC.Debug/Echo + result: + actualState: + output: + lexicographicGreater: true + lexicographicLess: false + equalStrings: true + caseSensitive: false +messages: [] +hadErrors: false +``` + +### Example 3 - Type mismatch error + +The following example shows what happens when you try to compare different types. + +```yaml +# greaterOrEquals.example.3.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Type mismatch + type: Microsoft.DSC.Debug/Echo + properties: + output: "[greaterOrEquals('5', 3)]" +``` + +```bash +dsc config get --file greaterOrEquals.example.3.dsc.config.yaml +``` + +This will result in an error because you cannot compare a string with a number. + +## Parameters + +### firstValue + +The first value to compare. Must be the same type as the second value. + +```yaml +Type: [number, string] +Required: true +``` + +### secondValue + +The second value to compare. Must be the same type as the first value. + +```yaml +Type: [number, string] +Required: true +``` + +The `greaterOrEquals()` function expects exactly two input values of the same type. +Separate each value with a comma. If the type of the second input value is different +from the first value, DSC returns an error for the function. + +String comparisons are case-sensitive and use lexicographic ordering. + +## Output + +The `greaterOrEquals()` function returns `true` if the first value is greater than +or equal to the second value and otherwise `false`. + +```yaml +Type: bool +``` + + diff --git a/docs/reference/schemas/config/functions/less.md b/docs/reference/schemas/config/functions/less.md new file mode 100644 index 000000000..8c04bab85 --- /dev/null +++ b/docs/reference/schemas/config/functions/less.md @@ -0,0 +1,156 @@ +--- +description: Reference for the 'less' DSC configuration document function +ms.date: 07/24/2025 +ms.topic: reference +title: less +--- + +# less + +## Synopsis + +Checks whether the first value is less than the second value. + +## Syntax + +```Syntax +less(, ) +``` + +## Description + +The `less()` function checks whether the first value is less than the second value, +returning `true` if it is and otherwise `false`. You can use this function to compare +two values of the same data type. If the values are different types, like a string and +an integer, DSC returns an error for this function. + +For strings, the comparison is case-sensitive and uses lexicographic ordering based on character codes. + +## Examples + +### Example 1 - Compare two numbers + +The following example shows how you can use the function to compare two numbers. + +```yaml +# less.example.1.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Compare numbers + type: Microsoft.DSC.Debug/Echo + properties: + output: + firstLess: "[less(3, 5)]" + secondLess: "[less(5, 3)]" + equalNumbers: "[less(5, 5)]" +``` + +```bash +dsc config get --file less.example.1.dsc.config.yaml +``` + +```yaml +results: +- name: Compare numbers + type: Microsoft.DSC.Debug/Echo + result: + actualState: + output: + firstLess: true + secondLess: false + equalNumbers: false +messages: [] +hadErrors: false +``` + +### Example 2 - Compare two strings + +The following example shows how you can use the function to compare two strings. + +```yaml +# less.example.2.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Compare strings + type: Microsoft.DSC.Debug/Echo + properties: + output: + lexicographicLess: "[less('a', 'b')]" + lexicographicGreater: "[less('b', 'a')]" + caseSensitive: "[less('A', 'a')]" +``` + +```bash +dsc config get --file less.example.2.dsc.config.yaml +``` + +```yaml +results: +- name: Compare strings + type: Microsoft.DSC.Debug/Echo + result: + actualState: + output: + lexicographicLess: true + lexicographicGreater: false + caseSensitive: true +messages: [] +hadErrors: false +``` + +### Example 3 - Type mismatch error + +The following example shows what happens when you try to compare different types. + +```yaml +# less.example.3.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Type mismatch + type: Microsoft.DSC.Debug/Echo + properties: + output: "[less(1, 'b')]" +``` + +```bash +dsc config get --file less.example.3.dsc.config.yaml +``` + +This will result in an error because you cannot compare a number with a string. + +## Parameters + +### firstValue + +The first value to compare. Must be the same type as the second value. + +```yaml +Type: [number, string] +Required: true +``` + +### secondValue + +The second value to compare. Must be the same type as the first value. + +```yaml +Type: [number, string] +Required: true +``` + +The `less()` function expects exactly two input values of the same type. +Separate each value with a comma. If the type of the second input value is +different from the first value, DSC returns an error for the function. + +String comparisons are case-sensitive and use lexicographic ordering. + +## Output + +The `less()` function returns `true` if the first value is less than the second +value and otherwise `false`. + +```yaml +Type: bool +``` + + diff --git a/docs/reference/schemas/config/functions/lessOrEquals.md b/docs/reference/schemas/config/functions/lessOrEquals.md new file mode 100644 index 000000000..96a444c70 --- /dev/null +++ b/docs/reference/schemas/config/functions/lessOrEquals.md @@ -0,0 +1,160 @@ +--- +description: Reference for the 'lessOrEquals' DSC configuration document function +ms.date: 07/24/2025 +ms.topic: reference +title: lessOrEquals +--- + +# lessOrEquals + +## Synopsis + +Checks whether the first value is less than or equal to the second value. + +## Syntax + +```Syntax +lessOrEquals(, ) +``` + +## Description + +The `lessOrEquals()` function checks whether the first value is less than or +equal to the second value, returning `true` if it is and otherwise `false`. +You can use this function to compare two values of the same data type. +If the values are different types, like a string and an integer, DSC returns +an error for this function. + +For strings, the comparison is case-sensitive and uses lexicographic ordering +based on character codes. + +## Examples + +### Example 1 - Compare two numbers + +The following example shows how you can use the function to compare two numbers. + +```yaml +# lessOrEquals.example.1.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Compare numbers + type: Microsoft.DSC.Debug/Echo + properties: + output: + firstLess: "[lessOrEquals(3, 5)]" + secondLess: "[lessOrEquals(5, 3)]" + equalNumbers: "[lessOrEquals(5, 5)]" +``` + +```bash +dsc config get --file lessOrEquals.example.1.dsc.config.yaml +``` + +```yaml +results: +- name: Compare numbers + type: Microsoft.DSC.Debug/Echo + result: + actualState: + output: + firstLess: true + secondLess: false + equalNumbers: true +messages: [] +hadErrors: false +``` + +### Example 2 - Compare two strings + +The following example shows how you can use the function to compare two strings. + +```yaml +# lessOrEquals.example.2.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Compare strings + type: Microsoft.DSC.Debug/Echo + properties: + output: + lexicographicLess: "[lessOrEquals('a', 'b')]" + lexicographicGreater: "[lessOrEquals('b', 'a')]" + equalStrings: "[lessOrEquals('a', 'a')]" + caseSensitive: "[lessOrEquals('aa', 'Aa')]" +``` + +```bash +dsc config get --file lessOrEquals.example.2.dsc.config.yaml +``` + +```yaml +results: +- name: Compare strings + type: Microsoft.DSC.Debug/Echo + result: + actualState: + output: + lexicographicLess: true + lexicographicGreater: false + equalStrings: true + caseSensitive: false +messages: [] +hadErrors: false +``` + +### Example 3 - Type mismatch error + +The following example shows what happens when you try to compare different types. + +```yaml +# lessOrEquals.example.3.dsc.config.yaml +$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json +resources: +- name: Type mismatch + type: Microsoft.DSC.Debug/Echo + properties: + output: "[lessOrEquals(5, 'a')]" +``` + +```bash +dsc config get --file lessOrEquals.example.3.dsc.config.yaml +``` + +This will result in an error because you cannot compare a number with a string. + +## Parameters + +### firstValue + +The first value to compare. Must be the same type as the second value. + +```yaml +Type: [number, string] +Required: true +``` + +### secondValue + +The second value to compare. Must be the same type as the first value. + +```yaml +Type: [number, string] +Required: true +``` + +The `lessOrEquals()` function expects exactly two input values of the same type. +Separate each value with a comma. If the type of the second input value is different +from the first value, DSC returns an error for the function. + +String comparisons are case-sensitive and use lexicographic ordering. + +## Output + +The `lessOrEquals()` function returns `true` if the first value is less than or +equal to the second value and otherwise `false`. + +```yaml +Type: bool +``` + +