awspec 1.8.0 → 1.9.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: 64449644204e71a922ed923381de44b9c291ba51
4
- data.tar.gz: 54c5bbf0733d7e21263b76be8a3a9cdbaf083cd6
3
+ metadata.gz: 480243f8d52f2b1cb26aafcae4143ec27bd2dcc9
4
+ data.tar.gz: 1ec635c3b5544e168e4f023ca9561d5bc2bed7f1
5
5
  SHA512:
6
- metadata.gz: 5abce1a08eab0d540f3fbafbdb63fffaa34c2eb7f8cd48fef8685f790717d335e2bd9084e0219ac122d80ce54529cfec3c41a6614b48a5291b3fd1e373914631
7
- data.tar.gz: 026ca40acff663122f710de7e7c7c6014033594b093711b3f2a4153eed5ce7e14e9daeffeffe3f0b4384eebb246d17075444a04149d2e9f58f8a65e74ce14b1e
6
+ metadata.gz: 84fd95bededb7e8847b6e0bc74fc3f31676bd889ff6001762e68bbb4e1d183be2533f62e60b2e22746fe924d5929f559bb83b5020d6b748629e6f5004aff96f5
7
+ data.tar.gz: 8c178f8ec25bef4a731e44b92d12759b11de761c2a3eb5c1bef6f94d86fe596b9dfbf1beb4a4419ad4948c5c6cc5fdc379b6fe0b665d75172da48a4d7d6e92f7
@@ -41,7 +41,7 @@ Metrics/ModuleLength:
41
41
  Metrics/PerceivedComplexity:
42
42
  Max: 15
43
43
 
44
- Naming/PredicateName:
44
+ Style/PredicateName:
45
45
  Enabled: false
46
46
 
47
47
  Performance/StringReplacement:
@@ -0,0 +1,7 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe apigateway('my-apigateway') do
5
+ it { should exist }
6
+ end
7
+ ```
@@ -0,0 +1,7 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe kinesis('my-kinesis') do
5
+ it { should exist }
6
+ end
7
+ ```
@@ -5,6 +5,7 @@
5
5
  | [alb_listener](#alb_listener)
6
6
  | [alb_target_group](#alb_target_group)
7
7
  | [ami](#ami)
8
+ | [apigateway](#apigateway)
8
9
  | [autoscaling_group](#autoscaling_group)
9
10
  | [cloudformation_stack](#cloudformation_stack)
10
11
  | [cloudfront_distribution](#cloudfront_distribution)
@@ -36,6 +37,7 @@
36
37
  | [iam_role](#iam_role)
37
38
  | [iam_user](#iam_user)
38
39
  | [internet_gateway](#internet_gateway)
40
+ | [kinesis](#kinesis)
39
41
  | [kms](#kms)
40
42
  | [lambda](#lambda)
41
43
  | [launch_configuration](#launch_configuration)
@@ -236,6 +238,19 @@ end
236
238
 
237
239
  `ami` can use `Aws::EC2::Image` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Image.html).
238
240
 
241
+ ## <a name="apigateway">apigateway</a>
242
+
243
+ Apigateway resource type.
244
+
245
+ ### exist
246
+
247
+ ```ruby
248
+ describe apigateway('my-apigateway') do
249
+ it { should exist }
250
+ end
251
+ ```
252
+
253
+ ### its(:id), its(:name), its(:description), its(:created_date), its(:version), its(:warnings), its(:binary_media_types), its(:minimum_compression_size), its(:api_key_source), its(:policy)
239
254
  ## <a name="autoscaling_group">autoscaling_group</a>
240
255
 
241
256
  AutoscalingGroup resource type.
@@ -1668,6 +1683,19 @@ end
1668
1683
  ```
1669
1684
 
1670
1685
  ### its(:internet_gateway_id)
1686
+ ## <a name="kinesis">kinesis</a>
1687
+
1688
+ Kinesis resource type.
1689
+
1690
+ ### exist
1691
+
1692
+ ```ruby
1693
+ describe kinesis('my-kinesis') do
1694
+ it { should exist }
1695
+ end
1696
+ ```
1697
+
1698
+ ### its(:stream_name), its(:stream_arn), its(:stream_status), its(:retention_period_hours), its(:stream_creation_timestamp), its(:encryption_type), its(:key_id), its(:open_shard_count), its(:consumer_count)
1671
1699
  ## <a name="kms">kms</a>
1672
1700
 
1673
1701
  Kms resource type.
@@ -0,0 +1,17 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class Apigateway < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'Apigateway'
8
+ @type = Awspec::Type::Apigateway.new('my-apigateway')
9
+ @ret = @type.resource_via_client
10
+ @matchers = []
11
+ @ignore_matchers = []
12
+ @describes = []
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class Kinesis < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'Kinesis'
8
+ @type = Awspec::Type::Kinesis.new('my-kinesis')
9
+ @ret = @type.resource_via_client
10
+ @matchers = []
11
+ @ignore_matchers = []
12
+ @describes = []
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -36,6 +36,8 @@ require 'awspec/helper/finder/sqs'
36
36
  require 'awspec/helper/finder/cloudformation'
37
37
  require 'awspec/helper/finder/ssm_parameter'
38
38
  require 'awspec/helper/finder/codebuild'
39
+ require 'awspec/helper/finder/apigateway'
40
+ require 'awspec/helper/finder/kinesis'
39
41
 
40
42
  require 'awspec/helper/finder/account_attributes'
41
43
 
@@ -81,6 +83,8 @@ module Awspec::Helper
81
83
  include Awspec::Helper::Finder::SsmParameter
82
84
  include Awspec::Helper::Finder::Cloudformation
83
85
  include Awspec::Helper::Finder::Codebuild
86
+ include Awspec::Helper::Finder::Apigateway
87
+ include Awspec::Helper::Finder::Kinesis
84
88
 
85
89
  CLIENTS = {
86
90
  ec2_client: Aws::EC2::Client,
@@ -114,7 +118,9 @@ module Awspec::Helper
114
118
  sqs_client: Aws::SQS::Client,
115
119
  ssm_client: Aws::SSM::Client,
116
120
  cloudformation_client: Aws::CloudFormation::Client,
117
- codebuild_client: Aws::CodeBuild::Client
121
+ codebuild_client: Aws::CodeBuild::Client,
122
+ apigateway_client: Aws::APIGateway::Client,
123
+ kinesis_client: Aws::Kinesis::Client
118
124
  }
119
125
 
120
126
  CLIENT_OPTIONS = {
@@ -0,0 +1,21 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module Apigateway
4
+ def find_apigateway_by_id(id)
5
+ rest_apis = apigateway_client.get_rest_apis
6
+ rest_apis.items.each do |item|
7
+ return item if item.id == id
8
+ end
9
+ nil
10
+ end
11
+
12
+ def find_apigateway_by_name(name)
13
+ rest_apis = apigateway_client.get_rest_apis
14
+ rest_apis.items.each do |item|
15
+ return item if item.name == name
16
+ end
17
+ nil
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module Kinesis
4
+ def find_kinesis_by_stream_name(name)
5
+ kinesis_client.list_streams.stream_names.each do |stream|
6
+ if stream == name
7
+ return kinesis_client.describe_stream_summary({ stream_name: name }).stream_description_summary
8
+ end
9
+ end
10
+ nil
11
+ end
12
+ end
13
+ end
14
+ end
@@ -8,11 +8,11 @@ module Awspec
8
8
  require 'awspec/type/account_attribute'
9
9
 
10
10
  TYPES = %w(
11
- alb alb_listener alb_target_group ami autoscaling_group cloudtrail
11
+ alb alb_listener alb_target_group ami apigateway autoscaling_group cloudtrail
12
12
  cloudwatch_alarm cloudwatch_event directconnect_virtual_interface
13
13
  ebs ec2 ecr_repository ecs_cluster ecs_container_instance ecs_service ecs_task_definition
14
14
  efs elasticache elasticache_cache_parameter_group elasticsearch elb firehose iam_group
15
- iam_policy iam_role iam_user kms lambda launch_configuration nat_gateway
15
+ iam_policy iam_role iam_user kinesis kms lambda launch_configuration nat_gateway
16
16
  network_acl network_interface nlb nlb_listener nlb_target_group
17
17
  rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
18
18
  route_table s3_bucket security_group ses_identity subnet vpc cloudfront_distribution
@@ -0,0 +1,75 @@
1
+ Aws.config[:apigateway] = {
2
+ stub_responses: {
3
+ get_rest_api: {
4
+ id: 'ohx0shePof',
5
+ name: 'my-apigateway',
6
+ description: 'Zamboni is awesome',
7
+ created_date: Time.at(1_530_826_668),
8
+ version: 'xyzzy',
9
+ warnings: [
10
+ 'Do not stop on tracks!',
11
+ 'I brake for hallucinations.'
12
+ ],
13
+ binary_media_types: [
14
+ '*/*'
15
+ ],
16
+ minimum_compression_size: 123,
17
+ api_key_source: 'HEADER',
18
+ policy: 'Honesty',
19
+ endpoint_configuration: {
20
+ types: [
21
+ 'EDGE'
22
+ ]
23
+ }
24
+ },
25
+ get_rest_apis: {
26
+ position: '1',
27
+ items: [
28
+ {
29
+ id: '111',
30
+ name: 'first-apigateway',
31
+ description: 'first api gateway',
32
+ created_date: Time.at(1_444_826_668),
33
+ version: 'plover',
34
+ warnings: [
35
+ 'Do not take with alcohol'
36
+ ],
37
+ binary_media_types: [
38
+ '*/*'
39
+ ],
40
+ minimum_compression_size: 456,
41
+ api_key_source: 'HEADER',
42
+ policy: 'Insurance',
43
+ endpoint_configuration: {
44
+ types: [
45
+ 'EDGE'
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ id: 'ohx0shePof',
51
+ name: 'my-apigateway',
52
+ description: 'Zamboni is awesome',
53
+ created_date: Time.at(1_530_826_668),
54
+ version: 'xyzzy',
55
+ warnings: [
56
+ 'Do not stop on tracks!',
57
+ 'I brake for hallucinations.'
58
+ ],
59
+ binary_media_types: [
60
+ '*/*'
61
+ ],
62
+ minimum_compression_size: 123,
63
+ api_key_source: 'HEADER',
64
+ policy: 'Honesty',
65
+
66
+ endpoint_configuration: {
67
+ types: [
68
+ 'EDGE'
69
+ ]
70
+ }
71
+ }
72
+ ]
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,37 @@
1
+ Aws.config[:kinesis] = {
2
+ stub_responses: {
3
+ list_streams: {
4
+ stream_names: [
5
+ 'my-kinesis',
6
+ 'second-stream',
7
+ 'third-stream'
8
+ ],
9
+ has_more_streams: false
10
+ },
11
+ describe_stream_summary: {
12
+ stream_description_summary: {
13
+ stream_name: 'my-kinesis',
14
+ stream_arn: 'arn:aws:kinesis:us-east-2:194648440784:stream/my-kinesis-staging-default-aws-resources',
15
+ stream_status: 'ACTIVE',
16
+ retention_period_hours: 24,
17
+ stream_creation_timestamp: Time.at(1_529_001_577),
18
+ enhanced_monitoring: [
19
+ {
20
+ shard_level_metrics: %w(
21
+ IncomingBytes
22
+ OutgoingRecords
23
+ IteratorAgeMilliseconds
24
+ IncomingRecords
25
+ ReadProvisionedThroughputExceeded
26
+ WriteProvisionedThroughputExceeded
27
+ OutgoingBytes
28
+ )
29
+ }
30
+ ],
31
+ encryption_type: 'KMS',
32
+ key_id: 'arn:aws:kms:us-east-2:194648440784:alias/my-kinesis-staging-default-key',
33
+ open_shard_count: 1
34
+ }
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,83 @@
1
+ module Awspec::Type
2
+ class Apigateway < ResourceBase
3
+ aws_resource Aws::APIGateway::Client
4
+
5
+ def cache_values(res)
6
+ @id = res.id
7
+ @name = res.name
8
+ @description = res.description
9
+ @created_date = res.created_date
10
+ @version = res.version
11
+ @warnings = res.warnings
12
+ @binary_media_types = res.binary_media_types
13
+ @minimum_compression_size = res.minimum_compression_size
14
+ @api_key_source = res.api_key_source
15
+ @policy = res.policy
16
+ @endpoint_configuration = res.endpoint_configuration
17
+ end
18
+
19
+ def resource_via_client
20
+ return unless @resource_via_client.nil?
21
+
22
+ @resource_via_client = find_apigateway_by_id(@display_name)
23
+ return @resource_via_client if @resource_via_client
24
+
25
+ @resource_via_client = find_apigateway_by_name(@display_name)
26
+ end
27
+
28
+ def id
29
+ cache_values(resource_via_client) if @id.nil?
30
+ @id
31
+ end
32
+
33
+ def name
34
+ cache_values(resource_via_client) if @name.nil?
35
+ @name
36
+ end
37
+
38
+ def description
39
+ cache_values(resource_via_client) if @description.nil?
40
+ @description
41
+ end
42
+
43
+ def created_date
44
+ cache_values(resource_via_client) if @created_date.nil?
45
+ @created_date
46
+ end
47
+
48
+ def version
49
+ cache_values(resource_via_client) if @version.nil?
50
+ @version
51
+ end
52
+
53
+ def warnings
54
+ cache_values(resource_via_client) if @warnings.nil?
55
+ @warnings
56
+ end
57
+
58
+ def binary_media_types
59
+ cache_values(resource_via_client) if @binary_media_types.nil?
60
+ @binary_media_types
61
+ end
62
+
63
+ def minimum_compression_size
64
+ cache_values(resource_via_client) if @minimum_compression_size.nil?
65
+ @minimum_compression_size
66
+ end
67
+
68
+ def api_key_source
69
+ cache_values(resource_via_client) if @api_key_source.nil?
70
+ @api_key_source
71
+ end
72
+
73
+ def policy
74
+ cache_values(resource_via_client) if @policy.nil?
75
+ @policy
76
+ end
77
+
78
+ def endpoint_configuration
79
+ cache_values(resource_via_client) if @endpoint_configuration.nil?
80
+ @endpoint_configuration
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,73 @@
1
+ module Awspec::Type
2
+ class Kinesis < ResourceBase
3
+ aws_resource Aws::Kinesis::Client
4
+
5
+ def cache_values(res)
6
+ @id = res.stream_name
7
+ @stream_name = res.stream_name
8
+ @stream_arn = res.stream_arn
9
+ @stream_status = res.stream_status
10
+ @retention_period_hours = res.retention_period_hours
11
+ @stream_creation_timestamp = res.stream_creation_timestamp
12
+ @enhanced_monitoring = res.enhanced_monitoring
13
+ @encryption_type = res.encryption_type
14
+ @key_id = res.key_id
15
+ @open_shard_count = res.open_shard_count
16
+ end
17
+
18
+ def resource_via_client
19
+ return @resource_via_client unless @resource_via_client.nil?
20
+ @resource_via_client = find_kinesis_by_stream_name(@display_name)
21
+ end
22
+
23
+ def id
24
+ cache_values(resource_via_client) if @id.nil?
25
+ @id
26
+ end
27
+
28
+ def stream_name
29
+ cache_values(resource_via_client) if @stream_name.nil?
30
+ @stream_name
31
+ end
32
+
33
+ def stream_arn
34
+ cache_values(resource_via_client) if @stream_arn.nil?
35
+ @stream_arn
36
+ end
37
+
38
+ def stream_status
39
+ cache_values(resource_via_client) if @stream_status.nil?
40
+ @stream_status
41
+ end
42
+
43
+ def retention_period_hours
44
+ cache_values(resource_via_client) if @retention_period_hours.nil?
45
+ @retention_period_hours
46
+ end
47
+
48
+ def stream_creation_timestamp
49
+ cache_values(resource_via_client) if @stream_creation_timestamp.nil?
50
+ @stream_creation_timestamp
51
+ end
52
+
53
+ def enhanced_monitoring
54
+ cache_values(resource_via_client) if @enhanced_monitoring.nil?
55
+ @enhanced_monitoring
56
+ end
57
+
58
+ def encryption_type
59
+ cache_values(resource_via_client) if @encryption_type.nil?
60
+ @encryption_type
61
+ end
62
+
63
+ def key_id
64
+ cache_values(resource_via_client) if @key_id.nil?
65
+ @key_id
66
+ end
67
+
68
+ def open_shard_count
69
+ cache_values(resource_via_client) if @open_shard_count.nil?
70
+ @open_shard_count
71
+ end
72
+ end
73
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.8.0'
2
+ VERSION = '1.9.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: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2018-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -219,6 +219,7 @@ files:
219
219
  - doc/_resource_types/alb_listener.md
220
220
  - doc/_resource_types/alb_target_group.md
221
221
  - doc/_resource_types/ami.md
222
+ - doc/_resource_types/apigateway.md
222
223
  - doc/_resource_types/autoscaling_group.md
223
224
  - doc/_resource_types/cloudformation_stack.md
224
225
  - doc/_resource_types/cloudfront_distribution.md
@@ -249,6 +250,7 @@ files:
249
250
  - doc/_resource_types/iam_role.md
250
251
  - doc/_resource_types/iam_user.md
251
252
  - doc/_resource_types/internet_gateway.md
253
+ - doc/_resource_types/kinesis.md
252
254
  - doc/_resource_types/kms.md
253
255
  - doc/_resource_types/lambda.md
254
256
  - doc/_resource_types/lambda_account_settings.md
@@ -298,6 +300,7 @@ files:
298
300
  - lib/awspec/generator/doc/type/alb_listener.rb
299
301
  - lib/awspec/generator/doc/type/alb_target_group.rb
300
302
  - lib/awspec/generator/doc/type/ami.rb
303
+ - lib/awspec/generator/doc/type/apigateway.rb
301
304
  - lib/awspec/generator/doc/type/autoscaling_group.rb
302
305
  - lib/awspec/generator/doc/type/base.rb
303
306
  - lib/awspec/generator/doc/type/cloudformation_stack.rb
@@ -331,6 +334,7 @@ files:
331
334
  - lib/awspec/generator/doc/type/iam_role.rb
332
335
  - lib/awspec/generator/doc/type/iam_user.rb
333
336
  - lib/awspec/generator/doc/type/internet_gateway.rb
337
+ - lib/awspec/generator/doc/type/kinesis.rb
334
338
  - lib/awspec/generator/doc/type/kms.rb
335
339
  - lib/awspec/generator/doc/type/lambda.rb
336
340
  - lib/awspec/generator/doc/type/lambda_account_settings.rb
@@ -400,6 +404,7 @@ files:
400
404
  - lib/awspec/helper/finder/acm.rb
401
405
  - lib/awspec/helper/finder/alb.rb
402
406
  - lib/awspec/helper/finder/ami.rb
407
+ - lib/awspec/helper/finder/apigateway.rb
403
408
  - lib/awspec/helper/finder/autoscaling.rb
404
409
  - lib/awspec/helper/finder/cloudformation.rb
405
410
  - lib/awspec/helper/finder/cloudfront.rb
@@ -421,6 +426,7 @@ files:
421
426
  - lib/awspec/helper/finder/elb.rb
422
427
  - lib/awspec/helper/finder/firehose.rb
423
428
  - lib/awspec/helper/finder/iam.rb
429
+ - lib/awspec/helper/finder/kinesis.rb
424
430
  - lib/awspec/helper/finder/kms.rb
425
431
  - lib/awspec/helper/finder/lambda.rb
426
432
  - lib/awspec/helper/finder/nlb.rb
@@ -479,6 +485,7 @@ files:
479
485
  - lib/awspec/stub/alb_listener.rb
480
486
  - lib/awspec/stub/alb_target_group.rb
481
487
  - lib/awspec/stub/ami.rb
488
+ - lib/awspec/stub/apigateway.rb
482
489
  - lib/awspec/stub/autoscaling_group.rb
483
490
  - lib/awspec/stub/cloudformation_stack.rb
484
491
  - lib/awspec/stub/cloudfront_distribution.rb
@@ -513,6 +520,7 @@ files:
513
520
  - lib/awspec/stub/iam_role.rb
514
521
  - lib/awspec/stub/iam_user.rb
515
522
  - lib/awspec/stub/internet_gateway.rb
523
+ - lib/awspec/stub/kinesis.rb
516
524
  - lib/awspec/stub/kms.rb
517
525
  - lib/awspec/stub/lambda.rb
518
526
  - lib/awspec/stub/launch_configuration.rb
@@ -546,6 +554,7 @@ files:
546
554
  - lib/awspec/type/alb_listener.rb
547
555
  - lib/awspec/type/alb_target_group.rb
548
556
  - lib/awspec/type/ami.rb
557
+ - lib/awspec/type/apigateway.rb
549
558
  - lib/awspec/type/autoscaling_group.rb
550
559
  - lib/awspec/type/base.rb
551
560
  - lib/awspec/type/cloudformation_stack.rb
@@ -579,6 +588,7 @@ files:
579
588
  - lib/awspec/type/iam_role.rb
580
589
  - lib/awspec/type/iam_user.rb
581
590
  - lib/awspec/type/internet_gateway.rb
591
+ - lib/awspec/type/kinesis.rb
582
592
  - lib/awspec/type/kms.rb
583
593
  - lib/awspec/type/lambda.rb
584
594
  - lib/awspec/type/lambda_account_settings.rb