Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.8 KB

File metadata and controls

49 lines (37 loc) · 1.8 KB
description ms.date ms.topic title
JSON schema reference for the '_exist' well-known DSC Resource property.
10/05/2023
reference
DSC Resource _exist property schema

DSC Resource _exist property schema

Synopsis

Indicates whether an instance should exist.

Metadata

SchemaDialect: https://json-schema.org/draft/2020-12/schema
SchemaID:      https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/resource/properties/exist.json
Type:          boolean
DefaultValue:  true

Description

The _exist property indicates that the resource can enforce whether instances exist, handling whether an instance should be added, updated, or removed during a set operation. This property provides shared semantics for DSC Resources and integrating tools, but doesn't enable any additional built-in processing with DSC.

Resources should only define this property when their implementation adheres to the following behavior contract:

  1. When the desired state for _exist is true, the resource expects the instance to exist. If it doesn't exist, the resource creates or adds the instance during the set operation.

  2. When the desired state for _exist is false, the resource expects the instance to not exist. If it does exist, the resource deletes or removes the instance during the set operation.

  3. When the get operation queries for an instance that doesn't exist, the returned JSON always defines the _exist property as false.

    The resource may omit the _exist property from the result JSON when the instance exists.

To add this property to a resource's instance schema, define the property with the following snippet:

"_exist": {
  "$ref": "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/resource/properties/exist.json"
}