class Puppet::ResourceApi::TransportSchemaDef

RSAPI Transport schema

Public Class Methods

new(definition) click to toggle source
# File lib/puppet/resource_api/type_definition.rb, line 93
def initialize(definition)
  super(definition, :connection_info)
end

Public Instance Methods

notify_schema_errors(message) click to toggle source
# File lib/puppet/resource_api/type_definition.rb, line 113
def notify_schema_errors(message)
  raise Puppet::DevError, message
end
validate(resource) click to toggle source
# File lib/puppet/resource_api/type_definition.rb, line 97
def validate(resource)
  # enforce mandatory attributes
  missing_attrs = []

  attributes.each do |name, _options|
    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