awspec 0.26.2 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +13 -2
  3. data/doc/_resource_types/ebs.md +18 -0
  4. data/doc/_resource_types/ec2.md +18 -0
  5. data/doc/_resource_types/network_acl.md +18 -0
  6. data/doc/_resource_types/rds.md +18 -0
  7. data/doc/_resource_types/route_table.md +18 -0
  8. data/doc/_resource_types/security_group.md +18 -0
  9. data/doc/_resource_types/subnet.md +18 -0
  10. data/doc/_resource_types/vpc.md +18 -0
  11. data/doc/resource_types.md +152 -0
  12. data/lib/awspec/helper/finder.rb +19 -15
  13. data/lib/awspec/helper/finder/autoscaling.rb +3 -3
  14. data/lib/awspec/helper/finder/cloudwatch.rb +5 -5
  15. data/lib/awspec/helper/finder/directconnect.rb +2 -2
  16. data/lib/awspec/helper/finder/ebs.rb +7 -7
  17. data/lib/awspec/helper/finder/ec2.rb +46 -46
  18. data/lib/awspec/helper/finder/elasticache.rb +6 -6
  19. data/lib/awspec/helper/finder/elb.rb +4 -4
  20. data/lib/awspec/helper/finder/iam.rb +16 -16
  21. data/lib/awspec/helper/finder/lambda.rb +4 -4
  22. data/lib/awspec/helper/finder/rds.rb +4 -4
  23. data/lib/awspec/helper/finder/route53.rb +4 -4
  24. data/lib/awspec/helper/finder/s3.rb +6 -6
  25. data/lib/awspec/helper/finder/security_group.rb +12 -12
  26. data/lib/awspec/helper/finder/ses.rb +1 -1
  27. data/lib/awspec/helper/finder/vpc.rb +49 -49
  28. data/lib/awspec/resource_reader.rb +5 -5
  29. data/lib/awspec/type/base.rb +6 -1
  30. data/lib/awspec/type/ebs.rb +2 -0
  31. data/lib/awspec/type/ec2.rb +2 -3
  32. data/lib/awspec/type/elasticache_cache_parameter_group.rb +3 -5
  33. data/lib/awspec/type/network_acl.rb +2 -0
  34. data/lib/awspec/type/rds.rb +8 -6
  35. data/lib/awspec/type/rds_db_parameter_group.rb +3 -5
  36. data/lib/awspec/type/route53_hosted_zone.rb +0 -2
  37. data/lib/awspec/type/route_table.rb +2 -0
  38. data/lib/awspec/type/s3_bucket.rb +6 -8
  39. data/lib/awspec/type/security_group.rb +1 -2
  40. data/lib/awspec/type/ses_identity.rb +15 -15
  41. data/lib/awspec/type/subnet.rb +2 -0
  42. data/lib/awspec/type/vpc.rb +1 -2
  43. data/lib/awspec/version.rb +1 -1
  44. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 752c70ba37444287c8a4fd27aa3117947bf4b79f
4
- data.tar.gz: 9ca42f9f8cbfe053a3ec8fec356643f8b670fee2
3
+ metadata.gz: fa59fc483e42db04bdd5e454361c101f9538e8dd
4
+ data.tar.gz: aee6c2fe6f98e982fe1f3e7fe818cc6a8470fc86
5
5
  SHA512:
6
- metadata.gz: c18fb8e6043b30f7fec4a8b42f36c649e1c141895fc6555e0f4d28fc9864d39d99eea0942f5856644dd46b26be49e52ad7b1a01fcd64a21285e6c713096f67de
7
- data.tar.gz: def2845b663ba8f50742b6a5ca40003a548aab024f4ef74f6bb24063fbf292f313ecf5cf575ceccbf3958d2e126729933daee8176cb76d12f225ecf232cd5c00
6
+ metadata.gz: 4a3d5144981a32fd355a3541a44d38f669823c7d82599ce591a60139181f8adba0f4c7f013e8419ad8f24559fb27b20709d7644721086f2208118ede9253e6b2
7
+ data.tar.gz: 891c950ab29b3da5c059ea35f4340c8ffc363c5db5d7247591a29a93c15cd474846572d351cc59607e37dd10806c84b3be93dabf5efeef51f44540f5455c8641
data/Rakefile CHANGED
@@ -1,17 +1,28 @@
1
1
  require 'bundler/gem_tasks'
2
+
2
3
  begin
3
4
  require 'rspec/core/rake_task'
4
5
  require 'octorelease'
5
6
  rescue LoadError
6
7
  end
7
8
 
9
+ require 'awspec'
10
+
11
+ types = Awspec::Helper::Type::TYPES.reject { |type| type == 'base' }.map do |type|
12
+ 'spec:' + type
13
+ end
14
+
8
15
  if defined?(RSpec)
9
16
  task spec: 'spec:all'
10
17
  namespace :spec do
11
18
  task all: ['spec:type', 'spec:generator_spec', 'spec:generator_doc']
12
19
 
13
- RSpec::Core::RakeTask.new(:type) do |t|
14
- t.pattern = 'spec/type/*_spec.rb'
20
+ task type: types
21
+
22
+ Awspec::Helper::Type::TYPES.map do |type|
23
+ RSpec::Core::RakeTask.new(type) do |t|
24
+ t.pattern = 'spec/type/' + type + '_spec.rb'
25
+ end
15
26
  end
16
27
 
17
28
  RSpec::Core::RakeTask.new(:generator_spec) do |t|
@@ -21,3 +21,21 @@ describe ebs('my-volume') do
21
21
  it { should be_in_use }
22
22
  end
23
23
  ```
24
+
25
+ ### advanced
26
+
27
+ `ebs` can use `Aws::EC2::Volume` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Volume.html).
28
+
29
+ ```ruby
30
+ describe ebs('my-volume') do
31
+ its('attachments.first.instance_id') { should eq 'i-ec12345a' }
32
+ end
33
+ ```
34
+
35
+ or
36
+
37
+ ```ruby
38
+ describe ebs('my-volume') do
39
+ its('resource.attachments.first.instance_id') { should eq 'i-ec12345a' }
40
+ end
41
+ ```
@@ -73,3 +73,21 @@ describe ec2('my-ec2') do
73
73
  it { should belong_to_vpc('my-vpc') }
74
74
  end
75
75
  ```
76
+
77
+ ### advanced
78
+
79
+ `ec2` can use `Aws::EC2::Instance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Instance.html).
80
+
81
+ ```ruby
82
+ describe ec2('my-ec2') do
83
+ its('vpc.id') { should eq 'vpc-ab123cde' }
84
+ end
85
+ ```
86
+
87
+ or
88
+
89
+ ```ruby
90
+ describe ec2('my-ec2') do
91
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
92
+ end
93
+ ```
@@ -33,3 +33,21 @@ describe network_acl('my-network-acl') do
33
33
  its(:outbound_entries_count) { should eq 2 }
34
34
  end
35
35
  ```
36
+
37
+ ### advanced
38
+
39
+ `network_acl` can use `Aws::EC2::NetworkAcl` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/NetworkAcl.html).
40
+
41
+ ```ruby
42
+ describe network_acl('my-network-acl') do
43
+ its('vpc.id') { should eq 'vpc-ab123cde' }
44
+ end
45
+ ```
46
+
47
+ or
48
+
49
+ ```ruby
50
+ describe network_acl('my-network-acl') do
51
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
52
+ end
53
+ ```
@@ -64,3 +64,21 @@ describe rds('my-rds') do
64
64
  it { should belong_to_vpc('my-vpc') }
65
65
  end
66
66
  ```
67
+
68
+ ### advanced
69
+
70
+ `rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
71
+
72
+ ```ruby
73
+ describe rds('my-rds') do
74
+ its('db_subnet_group.db_subnet_group_name') { should eq 'my-db-subnet-group' }
75
+ end
76
+ ```
77
+
78
+ or
79
+
80
+ ```ruby
81
+ describe rds('my-rds') do
82
+ its('resource.db_subnet_group.db_subnet_group_name') { should eq 'my-db-subnet-group' }
83
+ end
84
+ ```
@@ -24,3 +24,21 @@ describe route_table('my-route-table') do
24
24
  it { should have_subnet('my-subnet') }
25
25
  end
26
26
  ```
27
+
28
+ ### advanced
29
+
30
+ `route_table` can use `Aws::EC2::RouteTable` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/RouteTable.html).
31
+
32
+ ```ruby
33
+ describe route_table('my-route-table') do
34
+ its('vpc.id') { should eq 'vpc-ab123cde' }
35
+ end
36
+ ```
37
+
38
+ or
39
+
40
+ ```ruby
41
+ describe s3_bucket('my-bucket') do
42
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
43
+ end
44
+ ```
@@ -16,3 +16,21 @@ describe security_group('my-security-group-name') do
16
16
  its(:inbound) { should be_opened(22).protocol('tcp').for('sg-5a6b7cd8') }
17
17
  end
18
18
  ```
19
+
20
+ ### advanced
21
+
22
+ `security_group` can use `Aws::EC2::SecurityGroup` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/SecurityGroup.html).
23
+
24
+ ```ruby
25
+ describe security_group('my-security-group-name') do
26
+ its('group_name') { should eq 'my-security-group-name' }
27
+ end
28
+ ```
29
+
30
+ or
31
+
32
+ ```ruby
33
+ describe security_group('my-security-group-name') do
34
+ its('resource.group_name') { should eq 'my-security-group-name' }
35
+ end
36
+ ```
@@ -13,3 +13,21 @@ describe subnet('my-subnet') do
13
13
  it { should be_available }
14
14
  end
15
15
  ```
16
+
17
+ ### advanced
18
+
19
+ `subnet` can use `Aws::EC2::Subnet` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Subnet.html).
20
+
21
+ ```ruby
22
+ describe subnet('my-subnet') do
23
+ its('vpc.id') { should eq 'vpc-ab123cde' }
24
+ end
25
+ ```
26
+
27
+ or
28
+
29
+ ```ruby
30
+ describe subnet('my-subnet') do
31
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
32
+ end
33
+ ```
@@ -31,3 +31,21 @@ describe vpc('vpc-ab123cde') do
31
31
  it { should have_network_acl('my-network-acl') }
32
32
  end
33
33
  ```
34
+
35
+ ### advanced
36
+
37
+ `vpc` can use `Aws::EC2::Vpc` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Vpc.html).
38
+
39
+ ```ruby
40
+ describe vpc('my-vpc') do
41
+ its('route_tables.first.route_table_id') { should eq 'rtb-a12bcd34' }
42
+ end
43
+ ```
44
+
45
+ or
46
+
47
+ ```ruby
48
+ describe vpc('my-vpc') do
49
+ its('resource.route_tables.first.route_table_id') { should eq 'rtb-a12bcd34' }
50
+ end
51
+ ```
@@ -103,7 +103,26 @@ describe ec2('my-ec2') do
103
103
  end
104
104
  ```
105
105
 
106
+
106
107
  ### its(:instance_id), its(:image_id), its(:private_dns_name), its(:public_dns_name), its(:state_transition_reason), its(:key_name), its(:ami_launch_index), its(:instance_type), its(:launch_time), its(:placement), its(:kernel_id), its(:ramdisk_id), its(:platform), its(:monitoring), its(:subnet_id), its(:vpc_id), its(:private_ip_address), its(:public_ip_address), its(:state_reason), its(:architecture), its(:root_device_type), its(:root_device_name), its(:virtualization_type), its(:instance_lifecycle), its(:spot_instance_request_id), its(:client_token), its(:source_dest_check), its(:hypervisor), its(:iam_instance_profile), its(:ebs_optimized), its(:sriov_net_support)
108
+ ### :unlock: Advanced use
109
+
110
+ `ec2` can use `Aws::EC2::Instance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Instance.html).
111
+
112
+ ```ruby
113
+ describe ec2('my-ec2') do
114
+ its('vpc.id') { should eq 'vpc-ab123cde' }
115
+ end
116
+ ```
117
+
118
+ or
119
+
120
+ ```ruby
121
+ describe ec2('my-ec2') do
122
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
123
+ end
124
+ ```
125
+
107
126
  ## <a name="rds">rds</a>
108
127
 
109
128
  RDS resource type.
@@ -182,7 +201,26 @@ describe rds('my-rds') do
182
201
  end
183
202
  ```
184
203
 
204
+
185
205
  ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:copy_tags_to_snapshot)
206
+ ### :unlock: Advanced use
207
+
208
+ `rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
209
+
210
+ ```ruby
211
+ describe rds('my-rds') do
212
+ its('db_subnet_group.db_subnet_group_name') { should eq 'my-db-subnet-group' }
213
+ end
214
+ ```
215
+
216
+ or
217
+
218
+ ```ruby
219
+ describe rds('my-rds') do
220
+ its('resource.db_subnet_group.db_subnet_group_name') { should eq 'my-db-subnet-group' }
221
+ end
222
+ ```
223
+
186
224
  ## <a name="rds_db_parameter_group">rds_db_parameter_group</a>
187
225
 
188
226
  RdsDbParameterGroup resource type.
@@ -227,7 +265,26 @@ describe security_group('my-security-group-name') do
227
265
  end
228
266
  ```
229
267
 
268
+
230
269
  ### its(:inbound_rule_count), its(:outbound_rule_count), its(:inbound_permissions_count), its(:outbound_permissions_count), its(:owner_id), its(:group_name), its(:group_id), its(:description), its(:vpc_id)
270
+ ### :unlock: Advanced use
271
+
272
+ `security_group` can use `Aws::EC2::SecurityGroup` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/SecurityGroup.html).
273
+
274
+ ```ruby
275
+ describe security_group('my-security-group-name') do
276
+ its('group_name') { should eq 'my-security-group-name' }
277
+ end
278
+ ```
279
+
280
+ or
281
+
282
+ ```ruby
283
+ describe security_group('my-security-group-name') do
284
+ its('resource.group_name') { should eq 'my-security-group-name' }
285
+ end
286
+ ```
287
+
231
288
  ## <a name="vpc">vpc</a>
232
289
 
233
290
  VPC resource type.
@@ -269,7 +326,26 @@ describe vpc('vpc-ab123cde') do
269
326
  end
270
327
  ```
271
328
 
329
+
272
330
  ### its(:vpc_id), its(:state), its(:cidr_block), its(:dhcp_options_id), its(:instance_tenancy), its(:is_default)
331
+ ### :unlock: Advanced use
332
+
333
+ `vpc` can use `Aws::EC2::Vpc` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Vpc.html).
334
+
335
+ ```ruby
336
+ describe vpc('my-vpc') do
337
+ its('route_tables.first.route_table_id') { should eq 'rtb-a12bcd34' }
338
+ end
339
+ ```
340
+
341
+ or
342
+
343
+ ```ruby
344
+ describe vpc('my-vpc') do
345
+ its('resource.route_tables.first.route_table_id') { should eq 'rtb-a12bcd34' }
346
+ end
347
+ ```
348
+
273
349
  ## <a name="s3_bucket">s3_bucket</a>
274
350
 
275
351
  S3Bucket resource type.
@@ -454,7 +530,26 @@ describe subnet('my-subnet') do
454
530
  end
455
531
  ```
456
532
 
533
+
457
534
  ### its(:subnet_id), its(:state), its(:vpc_id), its(:cidr_block), its(:available_ip_address_count), its(:availability_zone), its(:default_for_az), its(:map_public_ip_on_launch)
535
+ ### :unlock: Advanced use
536
+
537
+ `subnet` can use `Aws::EC2::Subnet` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Subnet.html).
538
+
539
+ ```ruby
540
+ describe subnet('my-subnet') do
541
+ its('vpc.id') { should eq 'vpc-ab123cde' }
542
+ end
543
+ ```
544
+
545
+ or
546
+
547
+ ```ruby
548
+ describe subnet('my-subnet') do
549
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
550
+ end
551
+ ```
552
+
458
553
  ## <a name="route_table">route_table</a>
459
554
 
460
555
  RouteTable resource type.
@@ -488,7 +583,26 @@ describe route_table('my-route-table') do
488
583
  end
489
584
  ```
490
585
 
586
+
491
587
  ### its(:route_table_id), its(:vpc_id)
588
+ ### :unlock: Advanced use
589
+
590
+ `route_table` can use `Aws::EC2::RouteTable` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/RouteTable.html).
591
+
592
+ ```ruby
593
+ describe route_table('my-route-table') do
594
+ its('vpc.id') { should eq 'vpc-ab123cde' }
595
+ end
596
+ ```
597
+
598
+ or
599
+
600
+ ```ruby
601
+ describe s3_bucket('my-bucket') do
602
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
603
+ end
604
+ ```
605
+
492
606
  ## <a name="ebs">ebs</a>
493
607
 
494
608
  EBS resource type.
@@ -519,7 +633,26 @@ describe ebs('my-volume') do
519
633
  end
520
634
  ```
521
635
 
636
+
522
637
  ### its(:volume_id), its(:size), its(:snapshot_id), its(:availability_zone), its(:state), its(:create_time), its(:volume_type), its(:iops), its(:encrypted), its(:kms_key_id)
638
+ ### :unlock: Advanced use
639
+
640
+ `ebs` can use `Aws::EC2::Volume` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Volume.html).
641
+
642
+ ```ruby
643
+ describe ebs('my-volume') do
644
+ its('attachments.first.instance_id') { should eq 'i-ec12345a' }
645
+ end
646
+ ```
647
+
648
+ or
649
+
650
+ ```ruby
651
+ describe ebs('my-volume') do
652
+ its('resource.attachments.first.instance_id') { should eq 'i-ec12345a' }
653
+ end
654
+ ```
655
+
523
656
  ## <a name="elb">elb</a>
524
657
 
525
658
  ELB resource type.
@@ -958,7 +1091,26 @@ describe network_acl('my-network-acl') do
958
1091
  end
959
1092
  ```
960
1093
 
1094
+
961
1095
  ### its(:inbound_entries_count), its(:outbound_entries_count), its(:network_acl_id), its(:vpc_id), its(:is_default)
1096
+ ### :unlock: Advanced use
1097
+
1098
+ `network_acl` can use `Aws::EC2::NetworkAcl` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/NetworkAcl.html).
1099
+
1100
+ ```ruby
1101
+ describe network_acl('my-network-acl') do
1102
+ its('vpc.id') { should eq 'vpc-ab123cde' }
1103
+ end
1104
+ ```
1105
+
1106
+ or
1107
+
1108
+ ```ruby
1109
+ describe network_acl('my-network-acl') do
1110
+ its('resource.vpc.id') { should eq 'vpc-ab123cde' }
1111
+ end
1112
+ ```
1113
+
962
1114
  ## <a name="directconnect_virtual_interface">directconnect_virtual_interface</a>
963
1115
 
964
1116
  DirectconnectVirtualInterface resource type.
@@ -17,7 +17,6 @@ require 'awspec/helper/finder/directconnect'
17
17
 
18
18
  module Awspec::Helper
19
19
  module Finder
20
- attr_reader :ec2_client
21
20
  include Awspec::Helper::Finder::Vpc
22
21
  include Awspec::Helper::Finder::Ec2
23
22
  include Awspec::Helper::Finder::SecurityGroup
@@ -34,20 +33,25 @@ module Awspec::Helper
34
33
  include Awspec::Helper::Finder::Ses
35
34
  include Awspec::Helper::Finder::Directconnect
36
35
 
37
- # rubocop:disable all
38
- def initialize(id = nil)
39
- @ec2_client = Aws::EC2::Client.new
40
- @rds_client = Aws::RDS::Client.new
41
- @route53_client = Aws::Route53::Client.new
42
- @s3_client = Aws::S3::Client.new
43
- @autoscaling_client = Aws::AutoScaling::Client.new
44
- @elb_client = Aws::ElasticLoadBalancing::Client.new
45
- @lambda_client = Aws::Lambda::Client.new
46
- @iam_client = Aws::IAM::Client.new
47
- @elasticache_client = Aws::ElastiCache::Client.new
48
- @cloudwatch_client = Aws::CloudWatch::Client.new
49
- @ses_client = Aws::SES::Client.new
50
- @directconnect_client = Aws::DirectConnect::Client.new
36
+ CLIENTS = {
37
+ ec2_client: Aws::EC2::Client,
38
+ rds_client: Aws::RDS::Client,
39
+ route53_client: Aws::Route53::Client,
40
+ s3_client: Aws::S3::Client,
41
+ autoscaling_client: Aws::AutoScaling::Client,
42
+ elb_client: Aws::ElasticLoadBalancing::Client,
43
+ lambda_client: Aws::Lambda::Client,
44
+ iam_client: Aws::IAM::Client,
45
+ elasticache_client: Aws::ElastiCache::Client,
46
+ cloudwatch_client: Aws::CloudWatch::Client,
47
+ ses_client: Aws::SES::Client,
48
+ directconnect_client: Aws::DirectConnect::Client
49
+ }
50
+
51
+ CLIENTS.each do |method_name, client|
52
+ define_method method_name do
53
+ eval "@#{method_name} ||= #{client}.new"
54
+ end
51
55
  end
52
56
  end
53
57
  end