aws-sdk-utils 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/waf_util.rb +20 -0
  3. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f1ad8ad83113a1c1fe14340e457ff7987908ba2
4
- data.tar.gz: 73283f698ff914930081eec9d4d0111019c55177
3
+ metadata.gz: 7bcb9cd6ed38ebf703d00f256ef1cd81ddf76332
4
+ data.tar.gz: 0d334f6d7417d18d178b4fe8a62ee323da5b43da
5
5
  SHA512:
6
- metadata.gz: 5c993e474e7fc62f55c6ff38eb0f1afc62fd3c14dfc58460b8544d1a7d72ea66297c37d20492dbfeca8a0dfb58be23bb9dcf2a59595a17d8ad92c1ceb5759509
7
- data.tar.gz: 6b08c8734d1dd0ef6764b70cb78cf8942a98a21815345132d9b04d0f4b9e294412ff7aca4b6327b44d4f4d1764a8f5b57145323298d46ff1f25a93459d9997bc
6
+ metadata.gz: fe4c5b5095ad6817f6da5e33412ad626ce84a42ae92cddd81ce03a9e4fbb59a1fbf7d0c60a21d1f5f3fb28a68efbc8686459329f050220f7ce1b7d329c919bd9
7
+ data.tar.gz: 953ff6e31ad4e40586b4bc196cf74251d4712bbaacddb45ddc6b0c057d23d44c326292f3ca404fa11aaa072bece0a7e1042d6064f6bbabcc09cc3eb7c3c02834
data/lib/waf_util.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'aws-sdk'
2
+
3
+ module WafUtil
4
+
5
+
6
+ def self.get_ipset_id_by_name(ipset_name)
7
+ waf = Aws::WAF::Client.new
8
+
9
+ # short arm this - not going to have more than 100 any time this millenium
10
+ list_ip_sets_response = waf.list_ip_sets next_marker: nil,
11
+ limit: 100
12
+
13
+ found_ipset = list_ip_sets_response.ip_sets.select { |ip_set| ip_set.name == ipset_name }
14
+ if found_ipset.empty?
15
+ raise "ipset #{ipset_name} not found"
16
+ else
17
+ found_ipset.first.ip_set_id
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - someguy
@@ -33,6 +33,7 @@ files:
33
33
  - lib/aws-sdk-utils.rb
34
34
  - lib/cloudformation_converger.rb
35
35
  - lib/lambda_alias_switcher.rb
36
+ - lib/waf_util.rb
36
37
  homepage: https://github.com/stelligent/aws-sdk-utils
37
38
  licenses:
38
39
  - MIT