You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: language/resource-api/README.md
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,6 @@ Each resource being managed must be identified by a unique title. Usually this i
77
77
78
78
If multiple attributes are defined with the `namevar` behaviour, the type SHOULD specify `title_patterns` that will tell Resource API how to get at the attributes from the title. If `title_patterns` is not specified a default pattern is applied, and matches against the first declared `namevar`.
79
79
80
-
81
80
> Note: The order of title_patterns is important. You should declare the most specific pattern first and end with the most generic.
82
81
83
82
Each title pattern contains the:
@@ -143,6 +142,8 @@ software { php:
143
142
}
144
143
```
145
144
145
+
The provider's `get` method should return a single formatted string representing all namevar values in such a way that it matches one of the title patterns as value to the `:title` key for each resource. This allows the runtime environment to present resources in a way familiar to the user.
146
+
146
147
## Resource implementation ("provider")
147
148
148
149
To affect changes, a resource requires an implementation that makes the universe's state available to Puppet, and causes the changes to bring reality to whatever state is requested in the catalog. The two fundamental operations to manage resources are reading and writing system state. These operations are implemented as `get` and `set`. The implementation itself is a basic Ruby class in the `Puppet::Provider` namespace, named after the type using CamelCase.
@@ -209,17 +210,17 @@ Once all of that is in place, instead of the `set` method, the provider needs to
209
210
210
211
*`create(context, name, should)`: This is called when a new resource should be created.
211
212
*`context`: provides utilities from the runtime environment, and is described in more detail in its own section below.
212
-
*`name`: the name or hash of the new resource.
213
+
*`name`: the name (if there is only one namevar) or hash of namevars (if there are multiple) of the new resource.
213
214
*`should`: a hash of the attributes for the new instance.
214
215
215
216
*`update(context, name, should)`: This is called when a resource should be updated.
216
217
*`context`: provides utilities from the runtime environment, and is described in more detail in its own section below.
217
-
*`name`: the name or hash of the resource to change.
218
+
*`name`: the name (if there is only one namevar) or hash of namevars (if there are multiple) of the new resource.
218
219
*`should`: a hash of the desired state of the attributes.
219
220
220
221
*`delete(context, name)`: This is called when a resource should be deleted.
221
222
*`context`: provides utilities from the runtime environment, and is described in more detail in its own section below.
222
-
*`name`: the name or hash of the resource that should be deleted.
223
+
*`name`: the name (if there is only one namevar) or hash of namevars (if there are multiple) of the new resource.
223
224
224
225
The `SimpleProvider` takes care of basic logging, and error handling.
0 commit comments