awspec 0.55.0 → 0.56.0

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/awspec.rb +1 -0
  3. data/lib/awspec/generator/template.rb +6 -3
  4. data/lib/awspec/shared_context.rb +11 -0
  5. data/lib/awspec/type/ami.rb +7 -5
  6. data/lib/awspec/type/autoscaling_group.rb +8 -6
  7. data/lib/awspec/type/base.rb +15 -7
  8. data/lib/awspec/type/cloudfront_distribution.rb +8 -6
  9. data/lib/awspec/type/cloudtrail.rb +10 -8
  10. data/lib/awspec/type/cloudwatch_alarm.rb +9 -7
  11. data/lib/awspec/type/cloudwatch_event.rb +8 -6
  12. data/lib/awspec/type/directconnect_virtual_interface.rb +11 -4
  13. data/lib/awspec/type/ebs.rb +14 -7
  14. data/lib/awspec/type/ec2.rb +20 -13
  15. data/lib/awspec/type/elasticache.rb +13 -6
  16. data/lib/awspec/type/elasticache_cache_parameter_group.rb +15 -8
  17. data/lib/awspec/type/elasticsearch.rb +9 -7
  18. data/lib/awspec/type/elastictranscoder_pipeline.rb +7 -5
  19. data/lib/awspec/type/elb.rb +11 -9
  20. data/lib/awspec/type/iam_group.rb +8 -6
  21. data/lib/awspec/type/iam_policy.rb +8 -6
  22. data/lib/awspec/type/iam_role.rb +8 -6
  23. data/lib/awspec/type/iam_user.rb +8 -6
  24. data/lib/awspec/type/kms.rb +8 -6
  25. data/lib/awspec/type/lambda.rb +8 -6
  26. data/lib/awspec/type/launch_configuration.rb +7 -5
  27. data/lib/awspec/type/nat_gateway.rb +8 -6
  28. data/lib/awspec/type/network_acl.rb +10 -8
  29. data/lib/awspec/type/network_interface.rb +14 -12
  30. data/lib/awspec/type/rds.rb +14 -12
  31. data/lib/awspec/type/rds_db_cluster_parameter_group.rb +13 -9
  32. data/lib/awspec/type/rds_db_parameter_group.rb +13 -9
  33. data/lib/awspec/type/route53_hosted_zone.rb +11 -7
  34. data/lib/awspec/type/route_table.rb +8 -6
  35. data/lib/awspec/type/s3_bucket.rb +15 -13
  36. data/lib/awspec/type/security_group.rb +14 -13
  37. data/lib/awspec/type/ses_identity.rb +15 -13
  38. data/lib/awspec/type/subnet.rb +7 -5
  39. data/lib/awspec/type/vpc.rb +13 -11
  40. data/lib/awspec/type/waf_web_acl.rb +8 -6
  41. data/lib/awspec/version.rb +1 -1
  42. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  module Awspec::Type
2
2
  class SesIdentity < Base
3
- def initialize(id)
4
- super
5
- @resource_via_client = find_ses_identity(id)
6
- @id = @resource_via_client if @resource_via_client
3
+ def resource_via_client
4
+ @resource_via_client ||= find_ses_identity(@display_name)
5
+ end
6
+
7
+ def id
8
+ @id ||= resource_via_client if resource_via_client
7
9
  end
8
10
 
9
11
  def has_identity_policy?(name)
10
12
  res = ses_client.list_identity_policies({
11
- identity: @id
13
+ identity: id
12
14
  })
13
15
  res.policy_names.find do |policy_name|
14
16
  policy_name == name
@@ -23,17 +25,17 @@ module Awspec::Type
23
25
  dkim_attributes.each do |attribute|
24
26
  define_method attribute do
25
27
  res = ses_client.get_identity_dkim_attributes({
26
- identities: [@id]
28
+ identities: [id]
27
29
  })
28
- res.dkim_attributes[@id][attribute.to_sym]
30
+ res.dkim_attributes[id][attribute.to_sym]
29
31
  end
30
32
  end
31
33
 
32
34
  def has_dkim_tokens?(token)
33
35
  res = ses_client.get_identity_dkim_attributes({
34
- identities: [@id]
36
+ identities: [id]
35
37
  })
36
- res.dkim_attributes[@id][:tokens].include?(token)
38
+ res.dkim_attributes[id][:tokens].include?(token)
37
39
  end
38
40
 
39
41
  # notification_attributes
@@ -45,9 +47,9 @@ module Awspec::Type
45
47
  notification_attributes.each do |attribute|
46
48
  define_method attribute do
47
49
  res = ses_client.get_identity_notification_attributes({
48
- identities: [@id]
50
+ identities: [id]
49
51
  })
50
- res.notification_attributes[@id][attribute.to_sym]
52
+ res.notification_attributes[id][attribute.to_sym]
51
53
  end
52
54
  end
53
55
 
@@ -59,9 +61,9 @@ module Awspec::Type
59
61
  verification_attributes.each do |attribute|
60
62
  define_method attribute do
61
63
  res = ses_client.get_identity_verification_attributes({
62
- identities: [@id]
64
+ identities: [id]
63
65
  })
64
- res.verification_attributes[@id][attribute.to_sym]
66
+ res.verification_attributes[id][attribute.to_sym]
65
67
  end
66
68
  end
67
69
  end
@@ -3,10 +3,12 @@ module Awspec::Type
3
3
  aws_resource Aws::EC2::Subnet
4
4
  tags_allowed
5
5
 
6
- def initialize(id)
7
- super
8
- @resource_via_client = find_subnet(id)
9
- @id = @resource_via_client.subnet_id if @resource_via_client
6
+ def resource_via_client
7
+ @resource_via_client ||= find_subnet(@display_name)
8
+ end
9
+
10
+ def id
11
+ @id ||= resource_via_client.subnet_id if resource_via_client
10
12
  end
11
13
 
12
14
  STATES = %w(
@@ -15,7 +17,7 @@ module Awspec::Type
15
17
 
16
18
  STATES.each do |state|
17
19
  define_method state + '?' do
18
- @resource_via_client.state == state
20
+ resource_via_client.state == state
19
21
  end
20
22
  end
21
23
  end
@@ -3,10 +3,12 @@ module Awspec::Type
3
3
  aws_resource Aws::EC2::Vpc
4
4
  tags_allowed
5
5
 
6
- def initialize(id)
7
- super
8
- @resource_via_client = find_vpc(id)
9
- @id = @resource_via_client.vpc_id if @resource_via_client
6
+ def resource_via_client
7
+ @resource_via_client ||= find_vpc(@display_name)
8
+ end
9
+
10
+ def id
11
+ @id ||= resource_via_client.vpc_id if resource_via_client
10
12
  end
11
13
 
12
14
  STATES = %w(
@@ -15,20 +17,20 @@ module Awspec::Type
15
17
 
16
18
  STATES.each do |state|
17
19
  define_method state + '?' do
18
- @resource_via_client.state == state
20
+ resource_via_client.state == state
19
21
  end
20
22
  end
21
23
 
22
- def has_route_table?(id)
23
- route_table = find_route_table(id)
24
+ def has_route_table?(table_id)
25
+ route_table = find_route_table(table_id)
24
26
  return false unless route_table
25
- route_table.vpc_id == @id
27
+ route_table.vpc_id == id
26
28
  end
27
29
 
28
- def has_network_acl?(id)
29
- n = find_network_acl(id)
30
+ def has_network_acl?(table_id)
31
+ n = find_network_acl(table_id)
30
32
  return false unless n
31
- n.vpc_id == @id
33
+ n.vpc_id == id
32
34
  end
33
35
  end
34
36
  end
@@ -1,17 +1,19 @@
1
1
  module Awspec::Type
2
2
  class WafWebAcl < Base
3
- def initialize(id)
4
- super
5
- @resource_via_client = find_waf_web_acl(id)
6
- @id = @resource_via_client.web_acl_id if @resource_via_client
3
+ def resource_via_client
4
+ @resource_via_client ||= find_waf_web_acl(@display_name)
5
+ end
6
+
7
+ def id
8
+ @id ||= resource_via_client.web_acl_id if resource_via_client
7
9
  end
8
10
 
9
11
  def default_action
10
- @resource_via_client.default_action.type
12
+ resource_via_client.default_action.type
11
13
  end
12
14
 
13
15
  def has_rule?(rule_id, priority = nil, action = nil)
14
- @resource_via_client.rules.find do |rule|
16
+ resource_via_client.rules.find do |rule|
15
17
  next false if !priority.nil? && rule.priority != priority
16
18
  next false if !action.nil? && rule.action.type != action
17
19
  next true if rule.rule_id == rule_id
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.55.0'
2
+ VERSION = '0.56.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.55.0
4
+ version: 0.56.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-06 00:00:00.000000000 Z
11
+ date: 2016-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -364,6 +364,7 @@ files:
364
364
  - lib/awspec/matcher/have_tag.rb
365
365
  - lib/awspec/resource_reader.rb
366
366
  - lib/awspec/setup.rb
367
+ - lib/awspec/shared_context.rb
367
368
  - lib/awspec/stub.rb
368
369
  - lib/awspec/stub/ami.rb
369
370
  - lib/awspec/stub/autoscaling_group.rb