Skip to content

Commit

Permalink
[sc-107098] Added method to list entries in managed prefix list
Browse files Browse the repository at this point in the history
  • Loading branch information
anosulchik committed Mar 13, 2024
1 parent 1c040df commit 33d3ae9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
MovableInkAWS (2.8.10)
MovableInkAWS (2.8.11)
aws-sdk-athena (~> 1)
aws-sdk-autoscaling (~> 1)
aws-sdk-cloudwatch (~> 1)
Expand Down
12 changes: 12 additions & 0 deletions lib/movable_ink/aws/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,18 @@ def elastic_ip_address_exist?(public_ip:)
# returns false if it ran out of API retries
return false
end

def get_managed_prefix_list_entries(managed_prefix_list_name)
entries = []
run_with_backoff do
result = ec2.describe_managed_prefix_lists({filters: [{name: "prefix-list-name", values: [managed_prefix_list_name]}]})
raise MovableInk::AWS::Errors::ServiceError if result.prefix_lists.nil? || result.prefix_lists[0].nil?
prefix_list_id = result.prefix_lists[0].prefix_list_id
result = ec2.get_managed_prefix_list_entries({prefix_list_id: prefix_list_id})
entries = result.data.entries.map {|e| e.cidr}
end
return entries
end
end
end
end
2 changes: 1 addition & 1 deletion lib/movable_ink/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module MovableInk
class AWS
VERSION = '2.8.10'
VERSION = '2.8.11'
end
end

0 comments on commit 33d3ae9

Please sign in to comment.