cloudstrap 0.31.1.pre → 0.32.5.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74614e07862ccafa1e8a578fa6096f83193a82a1
4
- data.tar.gz: 077627f919d13452fe56ec2a46721b1a081f261c
3
+ metadata.gz: e1bea105bb2688899a8f16b53bf5e1dcceb9466f
4
+ data.tar.gz: bb2c9cc629e47e893a2e34757d980eeb1a9941b1
5
5
  SHA512:
6
- metadata.gz: 141f91160f912706e61b4cda52a6abba92449120d94e65ade11cb876a9c4b474451053c514d49c794b757eb770442797b3d079133f53ab720dd57c23a2e4b019
7
- data.tar.gz: 2ed68498c3fb49ab93feb1912cade807fdb36f822d74e9c253653aa383e41d48f31014a8c05f1f4ad63e1925a1209f962f0543868bd64e6ad4361e6115fc1ae5
6
+ metadata.gz: 9f38f340ad7c12306653b4552e5bf8bd75218b6e3f5fb7e90a0af1b4446b05ffaa6866beeba212d5629a321f04c1079f5a6eeba11486f009811ddef2416ac4a7
7
+ data.tar.gz: f3474f5b31087fe2a2b39e037163f6255c86180e3e3588316d56845df0c0e9092c9955adfff88e9a6dc09752045decf05625a6bde178384af9eff2a58d240598
@@ -15,6 +15,11 @@ module Cloudstrap
15
15
  @vpcs = call_api(:describe_vpcs).vpcs
16
16
  end
17
17
 
18
+ Contract None => Bool
19
+ def vpc_exists?(vpc_id)
20
+ vpcs.any? { |vpc| vpc.vpc_id == vpc_id }
21
+ end
22
+
18
23
  Contract String => Bool
19
24
  def vpc_supports_dns?(vpc_id)
20
25
  call_api(:describe_vpc_attribute, vpc_id: vpc_id, attribute: "enableDnsSupport").enable_dns_support.value
@@ -18,10 +18,27 @@ module Cloudstrap
18
18
  @list = call_api(:describe_load_balancers).load_balancer_descriptions
19
19
  end
20
20
 
21
+ Contract None => ArrayOf[String]
22
+ def names
23
+ list.map(&:load_balancer_name)
24
+ end
25
+
21
26
  Tags = HashOf[String, String]
22
27
 
23
- Contract Args[String] => HashOf[String, Tags]
24
- def tags(*elb_names)
28
+ Contract None => HashOf[String, Tags]
29
+ def tags
30
+ @tags ||= tags!
31
+ end
32
+
33
+ Contract None => HashOf[String, Tags]
34
+ def tags!
35
+ @tags = names.each_slice(20).flat_map do |slice|
36
+ tags(slice)
37
+ end.reduce(&:merge)
38
+ end
39
+
40
+ Contract ArrayOf[String] => HashOf[String, Tags]
41
+ def tags(elb_names)
25
42
  describe_tags(*elb_names).each_with_object({}) do |description, hash|
26
43
  hash[description.load_balancer_name] = description
27
44
  .tags
@@ -30,6 +47,14 @@ module Cloudstrap
30
47
  end
31
48
  end
32
49
 
50
+ Contract String => HashOf[String, ::Aws::ElasticLoadBalancing::Types::LoadBalancerDescription]
51
+ def tagged(key)
52
+ tags.map do |name, tags|
53
+ next unless tags[key]
54
+ { tags[key] => list.find { |elb| elb.load_balancer_name == name } }
55
+ end.compact.reduce(&:merge)
56
+ end
57
+
33
58
  private
34
59
 
35
60
  Contract Args[String] => ArrayOf[::Aws::ElasticLoadBalancing::Types::TagDescription]
@@ -20,7 +20,7 @@ module Cloudstrap
20
20
 
21
21
  Contract String => Maybe[::Aws::Route53::Types::HostedZone]
22
22
  def zone(name)
23
- name.tap { |string| string.concat('.') unless string.end_with?('.') }
23
+ name = name.end_with?('.') ? name : name.dup.concat('.')
24
24
 
25
25
  zones.find { |zone| zone.name == name }
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.1.pre
4
+ version: 0.32.5.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom