(maint) add new resource api output for json_spec

This commit is contained in:
Eric Putnam 2018-02-20 14:49:45 -08:00
parent 1316975826
commit cc7ffae3a5
No known key found for this signature in database
GPG Key ID: 3FB595AA224A7751
2 changed files with 83 additions and 0 deletions

View File

@ -81,6 +81,49 @@
} }
], ],
"resource_types": [ "resource_types": [
{
"name": "apt_key",
"file": "(stdin)",
"line": 92,
"docstring": {
"text": "This type provides Puppet with the capabilities to manage GPG keys needed\nby apt to perform package validation. Apt has it's own GPG keyring that can\nbe manipulated through the `apt-key` command.\n**Autorequires**:\nIf Puppet is given the location of a key file which looks like an absolute\npath this type will autorequire that file.",
"tags": [
{
"tag_name": "summary",
"text": "Example resource type using the new API."
},
{
"tag_name": "raise",
"text": "SomeError"
},
{
"tag_name": "example",
"text": "apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F':\n source => 'http://apt.puppetlabs.com/pubkey.gpg'\n}",
"name": "here's an example"
}
]
},
"properties": [
{
"name": "ensure",
"description": "Whether this apt key should be present or absent on the target system.",
"data_type": "Enum[present, absent]"
},
{
"name": "created",
"description": "Date the key was created, in ISO format.",
"data_type": "String"
}
],
"parameters": [
{
"name": "id",
"description": "The ID of the key you want to manage.",
"data_type": "Variant[Pattern[/A(0x)?[0-9a-fA-F]{8}Z/], Pattern[/A(0x)?[0-9a-fA-F]{16}Z/], Pattern[/A(0x)?[0-9a-fA-F]{40}Z/]]",
"isnamevar": true
}
]
},
{ {
"name": "database", "name": "database",
"file": "(stdin)", "file": "(stdin)",

View File

@ -123,6 +123,46 @@ Puppet::Type.newtype(:database) do
defaultto 'warn' defaultto 'warn'
end end
end end
Puppet::ResourceApi.register_type(
name: 'apt_key',
desc: <<-EOS,
@summary Example resource type using the new API.
@raise SomeError
This type provides Puppet with the capabilities to manage GPG keys needed
by apt to perform package validation. Apt has it's own GPG keyring that can
be manipulated through the `apt-key` command.
@example here's an example
apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F':
source => 'http://apt.puppetlabs.com/pubkey.gpg'
}
**Autorequires**:
If Puppet is given the location of a key file which looks like an absolute
path this type will autorequire that file.
EOS
attributes: {
ensure: {
type: 'Enum[present, absent]',
desc: 'Whether this apt key should be present or absent on the target system.'
},
id: {
type: 'Variant[Pattern[/\A(0x)?[0-9a-fA-F]{8}\Z/], Pattern[/\A(0x)?[0-9a-fA-F]{16}\Z/], Pattern[/\A(0x)?[0-9a-fA-F]{40}\Z/]]',
behaviour: :namevar,
desc: 'The ID of the key you want to manage.',
},
# ...
created: {
type: 'String',
behaviour: :read_only,
desc: 'Date the key was created, in ISO format.',
},
},
autorequires: {
file: '$source', # will evaluate to the value of the `source` attribute
package: 'apt',
},
)
SOURCE SOURCE
end end