Class: Puppet::ResourceApi::TransportSchemaDef
- Inherits:
-
BaseTypeDefinition
- Object
- BaseTypeDefinition
- Puppet::ResourceApi::TransportSchemaDef
- Defined in:
- lib/puppet/resource_api/type_definition.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.
47 48 49 |
# File 'lib/puppet/resource_api/type_definition.rb', line 47 def initialize(definition) super(definition, :connection_info) end |
Instance Method Details
#notify_schema_errors(message) ⇒ Object
67 68 69 |
# File 'lib/puppet/resource_api/type_definition.rb', line 67 def notify_schema_errors() raise Puppet::DevError, end |
#validate(resource) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/puppet/resource_api/type_definition.rb', line 51 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 |