awspec 0.84.1 → 0.85.0

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: 8913ea708bc0bd8af01f1197bc1d8783a41d9bb4
4
- data.tar.gz: d1697374a5411d9659e057886609fc00f4f5d63e
3
+ metadata.gz: 0ecc5bcbd50df3ba389eb54c44bdaf0f9eeaca97
4
+ data.tar.gz: 2b675e957707e721b63395384747effa950e9b7c
5
5
  SHA512:
6
- metadata.gz: ab84648f8284d3391d546958f5fd3c171e7ecbb30b72daab9b7e8049a104663683c1d228e2080d5f57cc04299e65f1982e8c97e678d084ac53aad1a46d907686
7
- data.tar.gz: 0b9178cdcf47a9046ca84ef6e003f08679820c9d38ae77ead3810423ac59b4ff562382fc53be34a981d8903d29991228778005d6ace259d273a510d2daa17c24
6
+ metadata.gz: 3dc3a7a3e8fd97051c647447765fcd98f6bb2a1c57867700420b47073726c5624266cddc913361f3fbca002031257b15ed879f7091473b7478d901778396823c
7
+ data.tar.gz: 01c4ea57979c011be6d80bcbef82a042868293f8a89ea8cf1cecfdc8b81284519846f64e27dccb564e7631ddd18e0b1631ff402457d1f5e2afa9dd7d41f90d30
data/.rubocop.yml CHANGED
@@ -1,9 +1,6 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.1
3
3
 
4
- Lint/Eval:
5
- Enabled: false
6
-
7
4
  Lint/HandleExceptions:
8
5
  Enabled: false
9
6
 
@@ -38,6 +35,9 @@ Metrics/PerceivedComplexity:
38
35
  Performance/StringReplacement:
39
36
  Enabled: false
40
37
 
38
+ Security/Eval:
39
+ Enabled: false
40
+
41
41
  Style/Alias:
42
42
  Enabled: false
43
43
 
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.0
4
- - 2.3.3
5
- - 2.2.6
3
+ - 2.4.1
4
+ - 2.3.4
5
+ - 2.2.7
6
6
  - 2.1.10
7
7
 
8
8
  before_install:
@@ -5,6 +5,7 @@ describe autoscaling_group('my-auto-scaling-group') do
5
5
  it { should exist }
6
6
  end
7
7
  ```
8
+
8
9
  ### have_alb_target_group
9
10
 
10
11
  ```ruby
@@ -29,6 +30,14 @@ describe autoscaling_group('my-auto-scaling-group') do
29
30
  end
30
31
  ```
31
32
 
33
+ ### have_launch_configuration
34
+
35
+ ```ruby
36
+ describe autoscaling_group('my-auto-scaling-group') do
37
+ it { should have_launch_configuration('my-lc') }
38
+ end
39
+ ```
40
+
32
41
  ### have_tag
33
42
 
34
43
  ```ruby
@@ -0,0 +1,8 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe cloudformation_stack('my-cloudformation-stack') do
5
+ it { should exist }
6
+ its(:stack_status) { should eq 'UPDATE_COMPLETE' }
7
+ end
8
+ ```
@@ -6,6 +6,7 @@
6
6
  | [alb_target_group](#alb_target_group)
7
7
  | [ami](#ami)
8
8
  | [autoscaling_group](#autoscaling_group)
9
+ | [cloudformation_stack](#cloudformation_stack)
9
10
  | [cloudfront_distribution](#cloudfront_distribution)
10
11
  | [cloudtrail](#cloudtrail)
11
12
  | [cloudwatch_alarm](#cloudwatch_alarm)
@@ -241,6 +242,7 @@ describe autoscaling_group('my-auto-scaling-group') do
241
242
  end
242
243
  ```
243
244
 
245
+
244
246
  ### have_alb_target_group
245
247
 
246
248
  ```ruby
@@ -268,6 +270,15 @@ end
268
270
  ```
269
271
 
270
272
 
273
+ ### have_launch_configuration
274
+
275
+ ```ruby
276
+ describe autoscaling_group('my-auto-scaling-group') do
277
+ it { should have_launch_configuration('my-lc') }
278
+ end
279
+ ```
280
+
281
+
271
282
  ### have_suspended_process
272
283
 
273
284
  ### have_tag
@@ -279,6 +290,20 @@ end
279
290
  ```
280
291
 
281
292
  ### its(:auto_scaling_group_name), its(:auto_scaling_group_arn), its(:launch_configuration_name), its(:min_size), its(:max_size), its(:desired_capacity), its(:default_cooldown), its(:availability_zones), its(:load_balancer_names), its(:target_group_arns), its(:health_check_type), its(:health_check_grace_period), its(:created_time), its(:placement_group), its(:vpc_zone_identifier), its(:enabled_metrics), its(:status), its(:termination_policies), its(:new_instances_protected_from_scale_in)
293
+ ## <a name="cloudformation_stack">cloudformation_stack</a>
294
+
295
+ CloudformationStack resource type.
296
+
297
+ ### exist
298
+
299
+ ```ruby
300
+ describe cloudformation_stack('my-cloudformation-stack') do
301
+ it { should exist }
302
+ its(:stack_status) { should eq 'UPDATE_COMPLETE' }
303
+ end
304
+ ```
305
+
306
+ ### its(:stack_id), its(:stack_name), its(:change_set_id), its(:description), its(:parameters), its(:creation_time), its(:last_updated_time), its(:stack_status), its(:stack_status_reason), its(:disable_rollback), its(:notification_arns), its(:timeout_in_minutes), its(:capabilities), its(:role_arn)
282
307
  ## <a name="cloudfront_distribution">cloudfront_distribution</a>
283
308
 
284
309
  CloudfrontDistribution resource type.
@@ -0,0 +1,17 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class CloudformationStack < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'CloudformationStack'
8
+ @type = Awspec::Type::CloudformationStack.new('my-cloudformation-stack')
9
+ @ret = @type.resource_via_client
10
+ @matchers = []
11
+ @ignore_matchers = []
12
+ @describes = []
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -31,6 +31,7 @@ require 'awspec/helper/finder/acm'
31
31
  require 'awspec/helper/finder/cloudwatch_logs'
32
32
  require 'awspec/helper/finder/dynamodb'
33
33
  require 'awspec/helper/finder/sqs'
34
+ require 'awspec/helper/finder/cloudformation'
34
35
 
35
36
  require 'awspec/helper/finder/account_attributes'
36
37
 
@@ -69,6 +70,7 @@ module Awspec::Helper
69
70
  include Awspec::Helper::Finder::CloudwatchLogs
70
71
  include Awspec::Helper::Finder::Dynamodb
71
72
  include Awspec::Helper::Finder::Sqs
73
+ include Awspec::Helper::Finder::Cloudformation
72
74
 
73
75
  CLIENTS = {
74
76
  ec2_client: Aws::EC2::Client,
@@ -98,7 +100,8 @@ module Awspec::Helper
98
100
  acm_client: Aws::ACM::Client,
99
101
  cloudwatch_logs_client: Aws::CloudWatchLogs::Client,
100
102
  dynamodb_client: Aws::DynamoDB::Client,
101
- sqs_client: Aws::SQS::Client
103
+ sqs_client: Aws::SQS::Client,
104
+ cloudformation_client: Aws::CloudFormation::Client
102
105
  }
103
106
 
104
107
  CLIENT_OPTIONS = {
@@ -0,0 +1,12 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module Cloudformation
4
+ def find_cloudformation_stack(id)
5
+ res = cloudformation_client.describe_stacks({
6
+ stack_name: id
7
+ })
8
+ res.stacks.single_resource(id)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -15,7 +15,7 @@ module Awspec
15
15
  network_acl network_interface rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
16
16
  route_table s3_bucket security_group ses_identity subnet vpc cloudfront_distribution
17
17
  elastictranscoder_pipeline waf_web_acl customer_gateway vpn_gateway vpn_connection internet_gateway acm
18
- cloudwatch_logs dynamodb_table eip sqs alb_listener alb_target_group
18
+ cloudwatch_logs dynamodb_table eip sqs alb_listener alb_target_group cloudformation_stack
19
19
  )
20
20
 
21
21
  ACCOUNT_ATTRIBUTES = %w(
@@ -0,0 +1,49 @@
1
+ # rubocop:disable Metrics/LineLength
2
+ Aws.config[:cloudformation] = {
3
+ stub_responses: {
4
+ describe_stacks: {
5
+ stacks: [
6
+ {
7
+ stack_id:
8
+ 'arn:aws:cloudformation:ap-northeast-1:123456789012:stack/my-cloudformation-stack/8ksdf6d0-7jia-1lo7-a9j7-5dca9ff482',
9
+ stack_name: 'my-cloudformation-stack',
10
+ change_set_id: nil,
11
+ description: 'The AWS CloudFormation template for this Serverless application',
12
+ parameters: [],
13
+ creation_time: Time.new(2015, 1, 2, 10, 10, 00, '+00:00'),
14
+ last_updated_time: Time.new(2015, 1, 2, 10, 10, 00, '+00:00'),
15
+ stack_status: 'UPDATE_COMPLETE',
16
+ stack_status_reason: nil,
17
+ disable_rollback: false,
18
+ notification_arns: [],
19
+ timeout_in_minutes: nil,
20
+ capabilities: %w(CAPABILITY_IAM CAPABILITY_NAMED_IAM),
21
+ outputs:
22
+ [
23
+ {
24
+ output_key: 'HandlerLambdaFunctionQualifiedArn',
25
+ output_value:
26
+ 'arn:aws:lambda:ap-northeast-1:123456789012:function:my-cloudformation-stack-handler:1',
27
+ description: 'Current Lambda function version'
28
+ },
29
+ {
30
+ output_key: 'ServerlessDeploymentBucketName',
31
+ output_value:
32
+ 'bucket-serverlessdeploymentbuck-sdifase69cjs',
33
+ description: nil
34
+ }
35
+ ],
36
+ role_arn: nil,
37
+ tags:
38
+ [
39
+ {
40
+ key: 'STAGE',
41
+ value: 'production'
42
+ }
43
+ ]
44
+ }
45
+ ],
46
+ next_token: nil
47
+ }
48
+ }
49
+ }
@@ -31,6 +31,10 @@ module Awspec::Type
31
31
  end
32
32
  end
33
33
 
34
+ def has_launch_configuration?(name)
35
+ @resource_via_client.launch_configuration_name == name
36
+ end
37
+
34
38
  def has_alb_target_group?(id)
35
39
  target_group = find_alb_target_group(id)
36
40
  target_groups = select_alb_target_group_by_autoscaling_group_name(@resource_via_client.auto_scaling_group_name)
@@ -0,0 +1,11 @@
1
+ module Awspec::Type
2
+ class CloudformationStack < ResourceBase
3
+ def resource_via_client
4
+ @resource_via_client ||= find_cloudformation_stack(@display_name)
5
+ end
6
+
7
+ def id
8
+ @id ||= resource_via_client.stack_name if resource_via_client
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.84.1'
2
+ VERSION = '0.85.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.84.1
4
+ version: 0.85.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
@@ -212,6 +212,7 @@ files:
212
212
  - doc/_resource_types/alb_target_group.md
213
213
  - doc/_resource_types/ami.md
214
214
  - doc/_resource_types/autoscaling_group.md
215
+ - doc/_resource_types/cloudformation_stack.md
215
216
  - doc/_resource_types/cloudfront_distribution.md
216
217
  - doc/_resource_types/cloudtrail.md
217
218
  - doc/_resource_types/cloudwatch_alarm.md
@@ -284,6 +285,7 @@ files:
284
285
  - lib/awspec/generator/doc/type/ami.rb
285
286
  - lib/awspec/generator/doc/type/autoscaling_group.rb
286
287
  - lib/awspec/generator/doc/type/base.rb
288
+ - lib/awspec/generator/doc/type/cloudformation_stack.rb
287
289
  - lib/awspec/generator/doc/type/cloudfront_distribution.rb
288
290
  - lib/awspec/generator/doc/type/cloudtrail.rb
289
291
  - lib/awspec/generator/doc/type/cloudwatch_alarm.rb
@@ -373,6 +375,7 @@ files:
373
375
  - lib/awspec/helper/finder/alb.rb
374
376
  - lib/awspec/helper/finder/ami.rb
375
377
  - lib/awspec/helper/finder/autoscaling.rb
378
+ - lib/awspec/helper/finder/cloudformation.rb
376
379
  - lib/awspec/helper/finder/cloudfront.rb
377
380
  - lib/awspec/helper/finder/cloudtrail.rb
378
381
  - lib/awspec/helper/finder/cloudwatch.rb
@@ -441,6 +444,7 @@ files:
441
444
  - lib/awspec/stub/alb_target_group.rb
442
445
  - lib/awspec/stub/ami.rb
443
446
  - lib/awspec/stub/autoscaling_group.rb
447
+ - lib/awspec/stub/cloudformation_stack.rb
444
448
  - lib/awspec/stub/cloudfront_distribution.rb
445
449
  - lib/awspec/stub/cloudtrail.rb
446
450
  - lib/awspec/stub/cloudwatch_alarm.rb
@@ -502,6 +506,7 @@ files:
502
506
  - lib/awspec/type/ami.rb
503
507
  - lib/awspec/type/autoscaling_group.rb
504
508
  - lib/awspec/type/base.rb
509
+ - lib/awspec/type/cloudformation_stack.rb
505
510
  - lib/awspec/type/cloudfront_distribution.rb
506
511
  - lib/awspec/type/cloudtrail.rb
507
512
  - lib/awspec/type/cloudwatch_alarm.rb