Module: AwsIpRanges
- Defined in:
- lib/aws_ip_ranges.rb,
lib/aws_ip_ranges/version.rb
Overview
Retrieves the IP ranges from AWS.
Constant Summary collapse
- DEFAULT_HOST_URL =
"https://ip-ranges.amazonaws.com/"- VERSION =
"0.1.1"
Class Method Summary collapse
-
.fetch(only_ipv6: false, only_ipv4: false, region: nil, service: nil, base_url: DEFAULT_HOST_URL) ⇒ Array<IPAddr>
Fetches the latest list of IP ranges from AWS.
Class Method Details
.fetch(only_ipv6: false, only_ipv4: false, region: nil, service: nil, base_url: DEFAULT_HOST_URL) ⇒ Array<IPAddr>
Fetches the latest list of IP ranges from AWS.
28 29 30 31 32 33 34 35 |
# File 'lib/aws_ip_ranges.rb', line 28 def fetch(only_ipv6: false, only_ipv4: false, region: nil, service: nil, base_url: DEFAULT_HOST_URL) ip_ranges = fetch_ip_ranges(base_url, only_ipv6: only_ipv6, only_ipv4: only_ipv4) ip_ranges = filter_by_region(ip_ranges, region) ip_ranges = filter_by_service(ip_ranges, service) ip_ranges.map do |ip_range| IPAddr.new(ip_range["ip_prefix"]) end end |