awspec 0.28.1 → 0.29.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20ed13efcb8640c392acddfac6a0a5549a864327
4
- data.tar.gz: 73089cd4e5a596637343845a2ca7b0e9c29ac278
3
+ metadata.gz: 6103e00c3f0aa3f83d1c10e09d1ca8a5a5c918ac
4
+ data.tar.gz: 653840c203951bbeec134d9f896fca01949a5b75
5
5
  SHA512:
6
- metadata.gz: cf67c07ceb07b99fa0f7b084603928df154f1a10fde662db419002651b7f4ba537ee306334f6d9e288d27f8c21455a8f557979e2451b325fddd0a6d57d5f3a0e
7
- data.tar.gz: 3fcc0f0602fa94a8e1a8765e4b5c410913af8468817a5f5b7a6b741c496502b12e506629536ebe9dd5b518e4c7d41fb10de08613e2d8c1e49351555d4beca83a
6
+ metadata.gz: 20a641e7724963fdc0898ceaebf578f2c4ea2c92581e8bb951bce565f878ae3afc117f0d1485ab06025f2176fc0cf157caf68723b73b15072fef7d93791ddfe2
7
+ data.tar.gz: 2c2d5d47471aa4934285029bdccea1d85f3461282e8d6ef9682420b84006a7af7b5321693d802d8b37732ff6b932fc5763d3ae3b2ecbf98c07980527a81c3822
@@ -0,0 +1,15 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe launch_configuration('my-lc') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### have_security_group
10
+
11
+ ```ruby
12
+ describe launch_configuration('my-lc') do
13
+ it { should have_security_group('my-security-group-name') }
14
+ end
15
+ ```
@@ -13,6 +13,7 @@
13
13
  | [iam_role](#iam_role)
14
14
  | [iam_user](#iam_user)
15
15
  | [lambda](#lambda)
16
+ | [launch_configuration](#launch_configuration)
16
17
  | [nat_gateway](#nat_gateway)
17
18
  | [network_acl](#network_acl)
18
19
  | [rds](#rds)
@@ -611,6 +612,28 @@ end
611
612
  This matcher does not support Amazon S3 event sources. ( [See SDK doc](http://docs.aws.amazon.com/sdkforruby/api/Aws/Lambda/Client.html#list_event_source_mappings-instance_method) )
612
613
 
613
614
  ### its(:function_name), its(:function_arn), its(:runtime), its(:role), its(:handler), its(:code_size), its(:description), its(:timeout), its(:memory_size), its(:last_modified), its(:code_sha_256), its(:version)
615
+ ## <a name="launch_configuration">launch_configuration</a>
616
+
617
+ LaunchConfiguration resource type.
618
+
619
+ ### exist
620
+
621
+ ```ruby
622
+ describe launch_configuration('my-lc') do
623
+ it { should exist }
624
+ end
625
+ ```
626
+
627
+
628
+ ### have_security_group
629
+
630
+ ```ruby
631
+ describe launch_configuration('my-lc') do
632
+ it { should have_security_group('my-security-group-name') }
633
+ end
634
+ ```
635
+
636
+ ### its(:launch_configuration_name), its(:launch_configuration_arn), its(:image_id), its(:key_name), its(:classic_link_vpc_id), its(:user_data), its(:instance_type), its(:kernel_id), its(:ramdisk_id), its(:spot_price), its(:iam_instance_profile), its(:created_time), its(:ebs_optimized), its(:associate_public_ip_address), its(:placement_tenancy)
614
637
  ## <a name="nat_gateway">nat_gateway</a>
615
638
 
616
639
  NatGateway resource type.
@@ -0,0 +1,17 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class LaunchConfiguration < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'LaunchConfiguration'
8
+ @type = Awspec::Type::LaunchConfiguration.new('my-lc')
9
+ @ret = @type.resource_via_client
10
+ @matchers = []
11
+ @ignore_matchers = []
12
+ @describes = []
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -7,6 +7,13 @@ module Awspec::Helper
7
7
  })
8
8
  res[:auto_scaling_groups].first if res[:auto_scaling_groups].count == 1
9
9
  end
10
+
11
+ def find_launch_configuration(id)
12
+ res = autoscaling_client.describe_launch_configurations({
13
+ launch_configuration_names: [id]
14
+ })
15
+ res[:launch_configurations].first if res[:launch_configurations].count == 1
16
+ end
10
17
  end
11
18
  end
12
19
  end
@@ -6,8 +6,8 @@ module Awspec
6
6
  TYPES = %w(
7
7
  autoscaling_group cloudwatch_alarm directconnect_virtual_interface
8
8
  ebs ec2 elasticache elasticache_cache_parameter_group elb iam_group
9
- iam_policy iam_role iam_user lambda nat_gateway network_acl rds
10
- rds_db_parameter_group route53_hosted_zone route_table
9
+ iam_policy iam_role iam_user lambda launch_configuration nat_gateway
10
+ network_acl rds rds_db_parameter_group route53_hosted_zone route_table
11
11
  s3_bucket security_group ses_identity subnet vpc
12
12
  )
13
13
 
@@ -0,0 +1,51 @@
1
+ Aws.config[:autoscaling] = {
2
+ stub_responses: {
3
+ describe_launch_configurations: {
4
+ launch_configurations: [
5
+ launch_configuration_name: 'my-lc',
6
+ launch_configuration_arn:
7
+ 'arn:aws:autoscaling:ap-northeast-1:123456789012:launchConfiguration:\
8
+ 1a11111b-22f2-3e33-444-55cf55e55555:launchConfigurationName/my-lc',
9
+ image_id: 'ami-abc12def',
10
+ key_name: 'my_key_pair',
11
+ security_groups: ['sg-1a2b3cd4'],
12
+ classic_link_vpc_id: nil,
13
+ classic_link_vpc_security_groups: [],
14
+ user_data: '',
15
+ instance_type: 'c3.large',
16
+ kernel_id: '',
17
+ ramdisk_id: '',
18
+ block_device_mappings: [],
19
+ instance_monitoring: {
20
+ enabled: true
21
+ },
22
+ spot_price: nil,
23
+ iam_instance_profile: nil,
24
+ created_time: Time.local(2015),
25
+ ebs_optimized: false,
26
+ associate_public_ip_address: true,
27
+ placement_tenancy: nil
28
+ ],
29
+ next_token: nil
30
+ }
31
+ }
32
+ }
33
+
34
+ Aws.config[:ec2] = {
35
+ stub_responses: {
36
+ describe_security_groups: {
37
+ security_groups: [
38
+ {
39
+ group_id: 'sg-1a2b3cd4',
40
+ group_name: 'my-security-group-name',
41
+ tags: [
42
+ {
43
+ key: 'Name',
44
+ value: 'my-security-group-tag-name'
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,21 @@
1
+ module Awspec::Type
2
+ class LaunchConfiguration < Base
3
+ def initialize(id)
4
+ super
5
+ @resource_via_client = find_launch_configuration(id)
6
+ @id = @resource_via_client[:launch_configuration_arn] if @resource_via_client
7
+ end
8
+
9
+ def has_security_group?(sg_id)
10
+ sgs = @resource_via_client[:security_groups]
11
+ ret = sgs.find do |sg|
12
+ sg == sg_id
13
+ end
14
+ return true if ret
15
+ sg2 = find_security_group(sg_id)
16
+ sgs.find do |sg|
17
+ sg == sg2[:group_id]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.28.1'
2
+ VERSION = '0.29.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.28.1
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-22 00:00:00.000000000 Z
11
+ date: 2015-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -213,6 +213,7 @@ files:
213
213
  - doc/_resource_types/iam_role.md
214
214
  - doc/_resource_types/iam_user.md
215
215
  - doc/_resource_types/lambda.md
216
+ - doc/_resource_types/launch_configuration.md
216
217
  - doc/_resource_types/nat_gateway.md
217
218
  - doc/_resource_types/network_acl.md
218
219
  - doc/_resource_types/rds.md
@@ -248,6 +249,7 @@ files:
248
249
  - lib/awspec/generator/doc/type/iam_role.rb
249
250
  - lib/awspec/generator/doc/type/iam_user.rb
250
251
  - lib/awspec/generator/doc/type/lambda.rb
252
+ - lib/awspec/generator/doc/type/launch_configuration.rb
251
253
  - lib/awspec/generator/doc/type/nat_gateway.rb
252
254
  - lib/awspec/generator/doc/type/network_acl.rb
253
255
  - lib/awspec/generator/doc/type/rds.rb
@@ -325,6 +327,7 @@ files:
325
327
  - lib/awspec/stub/iam_role.rb
326
328
  - lib/awspec/stub/iam_user.rb
327
329
  - lib/awspec/stub/lambda.rb
330
+ - lib/awspec/stub/launch_configuration.rb
328
331
  - lib/awspec/stub/nat_gateway.rb
329
332
  - lib/awspec/stub/network_acl.rb
330
333
  - lib/awspec/stub/rds.rb
@@ -351,6 +354,7 @@ files:
351
354
  - lib/awspec/type/iam_role.rb
352
355
  - lib/awspec/type/iam_user.rb
353
356
  - lib/awspec/type/lambda.rb
357
+ - lib/awspec/type/launch_configuration.rb
354
358
  - lib/awspec/type/nat_gateway.rb
355
359
  - lib/awspec/type/network_acl.rb
356
360
  - lib/awspec/type/rds.rb