Method: IPAddr.validate_ip_and_prefix

Defined in:
lib/azure/core/utility.rb

.validate_ip_and_prefix(ip, cidr) ⇒ Object



216
217
218
219
220
221
222
223
224
# File 'lib/azure/core/utility.rb', line 216

def validate_ip_and_prefix(ip, cidr)
  if cidr.to_s.empty?
    raise "Cidr is missing for IP '#{ip}'."
  elsif valid?(ip)
    raise "Ip address '#{ip}' is invalid."
  elsif !IPAddr.new(ip).private?
    raise "Ip Address #{ip} must be private."
  end
end