Skip to content

Commit c4c8c5b

Browse files
committed
Add reference documentation for DSC.Packagemanagement/Brw
1 parent efcb07c commit c4c8c5b

File tree

3 files changed

+208
-0
lines changed

3 files changed

+208
-0
lines changed

docs/reference/resources/DSC/PackageManagement/Brew/examples/install-a-package-with-brew.md

Whitespace-only changes.

docs/reference/resources/DSC/PackageManagement/Brew/examples/remove-a-package.md

Whitespace-only changes.
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
---
2+
description: DSC.PackageManagement/Brew resource reference documentation
3+
ms.date: 07/03/2025
4+
ms.topic: reference
5+
title: DSC.PackageManagement/Brew
6+
---
7+
8+
# DSC.PackageManagement/Brew
9+
10+
## Synopsis
11+
12+
Manage packages using Homebrew on macOS systems.
13+
14+
> [!IMPORTANT]
15+
> The `DSC.PackageManagement/Brew` resource is a proof-of-concept example
16+
> for use with DSC. Don't use it in production.
17+
18+
## Metadata
19+
20+
```yaml
21+
Version : 0.1.0
22+
Kind : resource
23+
Tags : [macOS, brew, PackageManagement]
24+
Author : Microsoft
25+
```
26+
27+
## Instance definition syntax
28+
29+
```yaml
30+
resources:
31+
- name: <instance name>
32+
type: DSC.PackageManagement/Brew
33+
properties:
34+
# Required properties
35+
packageName: string
36+
# Instance properties
37+
_exist: boolean
38+
version: string
39+
```
40+
41+
## Description
42+
43+
The `DSC.PackageManagement/Brew` resource enables you to idempotently manage packages using Homebrew on
44+
macOS systems. The resource can:
45+
46+
- Install packages
47+
- Uninstall packages
48+
- Check if a package is installed
49+
- Verify the version of an installed package
50+
51+
> [!NOTE]
52+
> This resource only works on macOS systems with Homebrew installed.
53+
54+
## Requirements
55+
56+
- A macOS system with Homebrew installed
57+
- Administrative privileges may be required for certain package operations
58+
59+
## Capabilities
60+
61+
The resource has the following capabilities:
62+
63+
- `get` - You can use the resource to retrieve the actual state of an instance.
64+
- `set` - You can use the resource to enforce the desired state for an instance.
65+
- `export` - You can use the resource to export the current state of the system.
66+
67+
This resource uses the synthetic test functionality of DSC to determine whether an instance is in
68+
the desired state. For more information about resource capabilities, see
69+
[DSC resource capabilities][00].
70+
71+
## Examples
72+
73+
1. [Install a package with Brew][04] - Shows how to install a package using
74+
`DSC.PackageManagement/Brew` resource.
75+
2. [Remove a package][05] - Shows how to uninstall a package.
76+
77+
## Properties
78+
79+
The following list describes the properties for the resource.
80+
81+
- **Required properties:** <a id="required-properties"></a> The following properties are always
82+
required when defining an instance of the resource. An instance that doesn't define each of these
83+
properties is invalid. For more information, see the "Required resource properties" section in
84+
[DSC resource properties][01]
85+
86+
- [packageName](#packagename) - The name of the package to query or install.
87+
88+
- **Key properties:** <a id="key-properties"></a> The following properties uniquely identify an
89+
instance. If two instances of a resource have the same values for their key properties, the
90+
instances are conflicting. For more information about key properties, see the "Key resource
91+
properties" section in [DSC resource properties][02].
92+
93+
- [packageName](#packagename) (required) - The name of the package to query or install.
94+
95+
- **Instance properties:** <a id="instance-properties"></a> The following properties are optional.
96+
They define the desired state for an instance of the resource.
97+
98+
- [_exist](#_exist) - Defines whether the package should exist.
99+
- [version](#version) - The version of the package to install.
100+
101+
### packageName
102+
103+
<details><summary>Expand for <code>packageName</code> property metadata</summary>
104+
105+
```yaml
106+
Type : string
107+
IsRequired : true
108+
IsKey : true
109+
IsReadOnly : false
110+
IsWriteOnly : false
111+
```
112+
113+
</details>
114+
115+
Defines the name of the package to query or install. This property is required and serves as the key for uniquely
116+
identifying the package in the Homebrew package repository.
117+
118+
### _exist
119+
120+
<details><summary>Expand for <code>_exist</code> property metadata</summary>
121+
122+
```yaml
123+
Type : boolean
124+
IsRequired : false
125+
IsKey : false
126+
IsReadOnly : false
127+
IsWriteOnly : false
128+
DefaultValue : true
129+
```
130+
131+
</details>
132+
133+
The `_exist` canonical resource property determines whether a package should exist. When the
134+
value for `_exist` is `true`, the resource installs the package if it doesn't exist. When
135+
the value for `_exist` is `false`, the resource removes or uninstalls the package if it does exist.
136+
The default value for this property when not specified for an instance is `true`.
137+
138+
### version
139+
140+
<details><summary>Expand for <code>version</code> property metadata</summary>
141+
142+
```yaml
143+
Type : string
144+
IsRequired : false
145+
IsKey : false
146+
IsReadOnly : false
147+
IsWriteOnly : false
148+
```
149+
150+
</details>
151+
152+
Defines the version of the package to install. If not specified, the latest available version will be installed.
153+
154+
## Instance validating schema
155+
156+
The following snippet contains the JSON Schema that validates an instance of the resource. The
157+
validating schema only includes schema keywords that affect how the instance is validated. All
158+
non validating keywords are omitted.
159+
160+
```json
161+
{
162+
"type": "object",
163+
"required": ["packageName"],
164+
"additionalProperties": false,
165+
"properties": {
166+
"packageName": {
167+
"type": "string"
168+
},
169+
"version": {
170+
"type": "string"
171+
},
172+
"_exist": {
173+
"type": "boolean"
174+
}
175+
}
176+
}
177+
```
178+
179+
## Exit codes
180+
181+
The resource returns the following exit codes from operations:
182+
183+
- [0](#exit-code-0) - Success
184+
- [1](#exit-code-1) - Invalid parameter
185+
186+
### Exit code 0
187+
188+
Indicates the resource operation completed without errors.
189+
190+
### Exit code 1
191+
192+
Indicates the resource operation failed due to an invalid parameter. When the resource returns this
193+
exit code, it also emits an error message with details about the invalid parameter.
194+
195+
## See also
196+
197+
- [DSC.PackageManagement/Apt resource][03]
198+
- [For more information about Homebrew][07]
199+
200+
<!-- Link definitions -->
201+
[00]: ../../../../../concepts/resources/capabilities.md
202+
[01]: ../../../../../concepts/resources/properties.md#required-resource-properties
203+
[02]: ../../../../../concepts/resources/properties.md#key-resource-properties
204+
[03]: ../APT/index.md
205+
[04]: ./examples/install-package-with-brew.md
206+
[05]: ./examples/install-specific-version.md
207+
[06]: ./examples/remove-package.md
208+
[07]: https://brew.sh/

0 commit comments

Comments
 (0)