-
Notifications
You must be signed in to change notification settings - Fork 43
(DOCS) Define and document schema for resource manifest #90
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
Closed
Closed
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
# Command-based DSC Resource manifest schema reference | ||
|
||
Every command-based DSC Resource must have a DSC Resource manifest. The manifest must: | ||
|
||
1. Be discoverable in the `PATH` environment variable. | ||
1. Follow the naming convention `<name>.resource.json`. | ||
1. Be valid for the schema described in this document. | ||
|
||
The rest of this document describes the DSC Resource manifest schema. | ||
|
||
## Metadata | ||
|
||
| Metadata Key | Metadata Value | | ||
|:------------:|:----------------------------------------------------| | ||
| `$schema` | `https://json-schema.org/draft/2020-12/schema` | | ||
| `$id` | `https://aka.ms/dsc/schemas/resource/manifest.yaml` | | ||
| `type` | `object` | | ||
|
||
## Required Properties | ||
|
||
The manifest must include these properties: | ||
|
||
- [manifestVersion](#manifestversion) | ||
- [type](#type) | ||
- [version](#version) | ||
- [get](#get) | ||
|
||
## Properties | ||
|
||
### manifestVersion | ||
|
||
The `manifestVersion` property indicates the semantic version (semver) of the DSC Resource manifest | ||
schema that the DSC Resource manifest validates against. This property is mandatory. DSC uses this | ||
value to validate the manifest against the correct JSON schema. | ||
|
||
```yaml | ||
Type: string | ||
Required: true | ||
Valid Values: | ||
- '1.0' | ||
``` | ||
|
||
### type | ||
|
||
The `type` property represents the fully qualified the name of the DSC Resource in its namespace. | ||
It's used to specify the DSC Resource in configuration documents and as the value of the | ||
`--resource` flag when using the `dsc resource *` commands. This value must use the following | ||
syntax: | ||
|
||
```text | ||
`<owner>[.<group>][.<area>]/<name>` | ||
``` | ||
|
||
Each component must be string of alphanumeric characters and underscores. No other characters are | ||
permitted. Every DSC Resource must define an `owner` and a `name`. Use the `group` and `area` | ||
components to organize DSC Resources into related namespaces. For example: | ||
|
||
- `Microsoft.SqlServer/Database` | ||
- `Microsoft.SqlServer.Database/Role` | ||
- `Microsoft.SqlServer.Database/User` | ||
- `Microsoft.SqlServer/Endpoint` | ||
- `Microsoft.SqlServer.Endpoint/Permission` | ||
- `Microsoft.SqlServer/Login` | ||
- `Microsoft.SqlServer/MaxDop` | ||
|
||
```yaml | ||
Type: string | ||
Required: true | ||
Pattern: ^\w+(\.\w+){0,2}\/\w+$ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made the validation for the
I can remove or increase the restriction on the group/area component count. |
||
``` | ||
|
||
### version | ||
|
||
The `version` property must be the current version of the DSC Resource as a valid semantic | ||
version string. The version applies to the DSC Resource, not the software it manages. | ||
|
||
```yaml | ||
Type: string | ||
Required: true | ||
``` | ||
|
||
### description | ||
|
||
The `description` property defines a synopsis for the DSC Resource's purpose. The value for this | ||
property must be a short string. | ||
|
||
```yaml | ||
Type: string | ||
Required: false | ||
``` | ||
|
||
### tags | ||
|
||
The `tags` property defines a list of searchable terms for the DSC Resource. The value of this | ||
property must be an array of strings. Each tag must contain only alphanumeric characters and | ||
underscores. No other characters are permitted. | ||
|
||
```yaml | ||
Type: array | ||
Required: false | ||
Valid Items: | ||
Type: string | ||
Pattern: ^\w+$ | ||
``` | ||
|
||
### get | ||
|
||
The `get` property defines how to call the DSC Resource to get the current state of an instance. | ||
This property is mandatory for all DSC Resources. | ||
|
||
The value of this property must be an object. The object's `executable` property, defining the name | ||
of the command to call, is mandatory. The `args` and `input` properties are optional. For more | ||
information, see [DSC Resource manifest get property schema reference][01]. | ||
|
||
```yaml | ||
Type: object | ||
Required: true | ||
``` | ||
|
||
### set | ||
|
||
The `set` property defines how to call the DSC Resource to set the desired state of an instance. It | ||
also defines how to process the output from the DSC Resource for this method. When this property | ||
isn't defined, the DSC can't manage instances of the DSC Resource. It can only get their current | ||
state and test whether the instance is in the desired state. | ||
|
||
The value of this property must be an object. The `executable` property, defining the name of the | ||
command to call, is mandatory. The `args` `input`, `preTest`, and `returns` properties are | ||
optional. For more information, see [DSC Resource manifest set property schema reference][02]. | ||
|
||
### test | ||
|
||
The `test` property defines how to call the DSC Resource to test whether an instance is in the | ||
desired state. It also defines how to process the output from the DSC Resource for this method. | ||
When this property isn't defined, DSC performs a basic synthetic test for instances of the DSC | ||
Resource. | ||
|
||
The value of this property must be an object. The object's `executable` property, defining the name | ||
of the command to call, is mandatory. The `args` `input`, and `returns` properties are optional. | ||
For more information, see [DSC Resource manifest test property schema reference][03]. | ||
|
||
### validate | ||
|
||
The `validate` property defines how to call a DSC Group Resource to validate its instances. This | ||
property is mandatory for DSC Group Resources. DSC ignores this property for all other DSC | ||
Resources. | ||
|
||
The value of this property must be an object. The object's `executable` property, defining the name | ||
of the command to call, is mandatory. The `args` property is optional. For more information, see | ||
[DSC Resource manifest validate property schema reference][04]. | ||
|
||
### provider | ||
|
||
When specified, the `provider` property defines the DSC Resource as a DSC Resource Provider. | ||
|
||
For more information, see the [DSC Resource manifest provider property schema reference][05]. | ||
|
||
### exitCodes | ||
|
||
The `exitCodes` property defines a set of valid exit codes for the DSC Resource and their meaning. | ||
Define this property as a set of key-value pairs where: | ||
|
||
- The key is an integer that maps to a known exit code for the DSC Resource. | ||
- The value is a string describing the semantic meaning of that exit code for a human reader. | ||
|
||
DSC always interprets exit code `0` as a successful operation and any other exit code as an error. | ||
|
||
```yaml | ||
Type: object | ||
Required: false | ||
Valid Properties: | ||
Name Pattern: ^[0-9]+# | ||
Value Type: string | ||
``` | ||
|
||
### schema | ||
|
||
The `schema` property defines how DSC should get the JSON schema to validate an instance of the DSC | ||
Resource. This property must always be an object that defines one of the following properties: | ||
|
||
- `command` - When you specify the `command` property, DSC calls the defined command to get the | ||
JSON schema. | ||
- `embedded` - When you specify the `embedded` property, DSC uses the defined value as the JSON | ||
schema. | ||
|
||
For more information, see [DSC Resource manifest schema property reference][06]. | ||
|
||
```yaml | ||
Type: object | ||
Required: true | ||
``` | ||
|
||
[01]: ./methods/get.md | ||
[02]: ./methods/set.md | ||
[03]: ./methods/test.md | ||
[04]: ./methods/validate.md | ||
[05]: ./provider-property.md | ||
[06]: ./schema-property.md |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't include the
Pattern
metadata here because the semver regex is very long, but maybe we should?