Class: Puppet::ResourceApi::TransportSchemaDef
- Inherits:
-
BaseTypeDefinition
- Object
- BaseTypeDefinition
- Puppet::ResourceApi::TransportSchemaDef
- Defined in:
- lib/puppet_x/puppetlabs/panos/transport_shim.rb
Overview
RSAPI Transport schema
Instance Attribute Summary
Attributes inherited from BaseTypeDefinition
Instance Method Summary collapse
-
#initialize(definition) ⇒ TransportSchemaDef
constructor
A new instance of TransportSchemaDef.
- #notify_schema_errors(message) ⇒ Object
- #validate(resource) ⇒ Object
Methods inherited from BaseTypeDefinition
#check_schema, #check_schema_keys, #check_schema_values, #name, #namevars, #validate_schema
Constructor Details
#initialize(definition) ⇒ TransportSchemaDef
Returns a new instance of TransportSchemaDef.
45 46 47 |
# File 'lib/puppet_x/puppetlabs/panos/transport_shim.rb', line 45 def initialize(definition) super(definition, :connection_info) end |
Instance Method Details
#notify_schema_errors(message) ⇒ Object
65 66 67 |
# File 'lib/puppet_x/puppetlabs/panos/transport_shim.rb', line 65 def notify_schema_errors() # do nothing to satisfy tasks end |
#validate(resource) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/puppet_x/puppetlabs/panos/transport_shim.rb', line 49 def validate(resource) # enforce mandatory attributes missing_attrs = [] attributes.each do |name, | type = @data_type_cache[attributes[name][:type]] if resource[name].nil? && !(type.instance_of? Puppet::Pops::Types::POptionalType) missing_attrs << name end end error_msg = "The following mandatory attributes were not provided:\n * " + missing_attrs.join(", \n * ") raise Puppet::ResourceError, error_msg if missing_attrs.any? end |