Class: MCollective::DDL::DataDDL
- Defined in:
- lib/mcollective/ddl/dataddl.rb
Overview
A DDL file for the data query plugins.
Query plugins can today take only one input by convention in the DDL that is called :query, otherwise the input is identical to the standard input.
metadata :name => “Agent”,
:description => "Meta data about installed MColletive Agents",
:author => "R.I.Pienaar <[email protected]>",
:license => "ASL 2.0",
:version => "1.0",
:url => "https://docs.puppetlabs.com/mcollective/",
:timeout => 1
dataquery :description => “Agent Meta Data” do
input :query,
:prompt => "Agent Name",
:description => "Valid agent name",
:type => :string,
:validation => /^[\w\_]+$/,
:maxlength => 20
[:license, :timeout, :description, :url, :version, :author].each do |item|
output item,
:description => "Agent #{item}",
:display_as => item.to_s.capitalize
end
end
Instance Attribute Summary
Attributes inherited from Base
#entities, #meta, #pluginname, #plugintype, #requirements, #usage
Instance Method Summary collapse
- #dataquery(input, &block) ⇒ Object
-
#dataquery_interface ⇒ Object
Returns the interface for the data query.
- #input(argument, properties) ⇒ Object
Methods inherited from Base
#findddlfile, #help, #initialize, #loadddlfile, #metadata, #output, #requires, #template_for_plugintype, #validate_input_argument, #validate_requirements
Constructor Details
This class inherits a constructor from MCollective::DDL::Base
Instance Method Details
#dataquery(input, &block) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mcollective/ddl/dataddl.rb', line 31 def dataquery(input, &block) raise "Data queries need a :description" unless input.include?(:description) raise "Data queries can only have one definition" if @entities[:data] @entities[:data] = {:description => input[:description], :input => {}, :output => {}} @current_entity = :data block.call if block_given? @current_entity = nil end |
#dataquery_interface ⇒ Object
Returns the interface for the data query
51 52 53 |
# File 'lib/mcollective/ddl/dataddl.rb', line 51 def dataquery_interface @entities[:data] || {} end |
#input(argument, properties) ⇒ Object
44 45 46 47 48 |
# File 'lib/mcollective/ddl/dataddl.rb', line 44 def input(argument, properties) raise "The only valid input name for a data query is 'query'" if argument != :query super end |