awspec 1.15.3 → 1.16.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: ca755a39c613bc48b0ccc9e5dba01cc0c727f7df
4
- data.tar.gz: 894571bf21f40ba2c635f0667cfee61f39792a40
3
+ metadata.gz: 9252dd0d3fea68629e0beef8ffccc4e9c5ed332d
4
+ data.tar.gz: b48df6974e6edcb4f7271d809ea9209004c39f6c
5
5
  SHA512:
6
- metadata.gz: 2731087c9c0b93a7f12f19dce2c06a86beb38cef1f685541c5f0f6f69201916823796199f8baa24175716c6ad772bc0698bde18f502cc201c9f416c195f59396
7
- data.tar.gz: 26a1b770cfa85ddf827cfbbe9f0cf1e63c37dcbec3e14ac7f573ef1e3a7ae7e4734cd0e0b548f529229be168d85f966b4d56a2a799ece93cad7ea1db7615bf6d
6
+ metadata.gz: '04684450be551fa8362385f94a304cc13747f8140b215c7ec274e5ddeb07ebc0abdb2f3ce1e60dfe9f0e2d5adf87122de8fed6eefeef35b69c3386ea59e87594'
7
+ data.tar.gz: ec1da9fc0da0d614c34c3215d2f4caa3b82f0f83fdd77ed0f360dc3c7aed8c40379f38a85416e0a7bee21c690721ec68717fca1bd468e0f5c3afc61cc152e842
@@ -0,0 +1,33 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe mq('my-mq') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### be_running, be_reboot_in_progress, be_creation_in_progress, be_creation_failed, be_deletion_in_progress
10
+
11
+ ```ruby
12
+ describe mq('my-mq') do
13
+ it { should be_running }
14
+ end
15
+ ```
16
+
17
+ ### have_security_group
18
+
19
+ ```ruby
20
+ describe mq('my-mq') do
21
+ it { should have_security_group('sg-788eab237e47f1472') }
22
+ it { should have_security_group('mq-group-name-sg') }
23
+ it { should have_security_group('my-mq-sg') }
24
+ end
25
+ ```
26
+
27
+ ### have_tag
28
+
29
+ ```ruby
30
+ describe mq('my-mq') do
31
+ it { should have_tag('Name').value('my-mq') }
32
+ end
33
+ ```
@@ -49,6 +49,7 @@
49
49
  | [lambda](#lambda)
50
50
  | [launch_configuration](#launch_configuration)
51
51
  | [launch_template](#launch_template)
52
+ | [mq](#mq)
52
53
  | [nat_gateway](#nat_gateway)
53
54
  | [network_acl](#network_acl)
54
55
  | [network_interface](#network_interface)
@@ -2225,6 +2226,48 @@ end
2225
2226
  ```
2226
2227
 
2227
2228
  ### its(:launch_template_id), its(:launch_template_name), its(:create_time), its(:created_by), its(:default_version_number), its(:latest_version_number), its(:tags)
2229
+ ## <a name="mq">mq</a>
2230
+
2231
+ MQ resource type.
2232
+
2233
+ ### exist
2234
+
2235
+ ```ruby
2236
+ describe mq('my-mq') do
2237
+ it { should exist }
2238
+ end
2239
+ ```
2240
+
2241
+
2242
+ ### be_running, be_reboot_in_progress, be_creation_in_progress, be_creation_failed, be_deletion_in_progress
2243
+
2244
+ ```ruby
2245
+ describe mq('my-mq') do
2246
+ it { should be_running }
2247
+ end
2248
+ ```
2249
+
2250
+
2251
+ ### have_security_group
2252
+
2253
+ ```ruby
2254
+ describe mq('my-mq') do
2255
+ it { should have_security_group('sg-788eab237e47f1472') }
2256
+ it { should have_security_group('mq-group-name-sg') }
2257
+ it { should have_security_group('my-mq-sg') }
2258
+ end
2259
+ ```
2260
+
2261
+
2262
+ ### have_tag
2263
+
2264
+ ```ruby
2265
+ describe mq('my-mq') do
2266
+ it { should have_tag('Name').value('my-mq') }
2267
+ end
2268
+ ```
2269
+
2270
+ ### its(:vpc_id), its(:auto_minor_version_upgrade), its(:broker_arn), its(:broker_id), its(:broker_name), its(:broker_state), its(:created), its(:deployment_mode), its(:engine_type), its(:engine_version), its(:host_instance_type), its(:pending_engine_version), its(:publicly_accessible), its(:security_groups), its(:subnet_ids)
2228
2271
  ## <a name="nat_gateway">nat_gateway</a>
2229
2272
 
2230
2273
  NatGateway resource type.
@@ -0,0 +1,19 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class Mq < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'MQ'
8
+ @type = Awspec::Type::Mq.new('my-mq')
9
+ @ret = @type.resource_via_client
10
+ @matchers = [
11
+ Awspec::Type::Mq::STATES.map { |state| 'be_' + state.tr('-', '_') }.join(', ')
12
+ ]
13
+ @ignore_matchers = Awspec::Type::Mq::STATES.map { |state| 'be_' + state.tr('-', '_') }
14
+ @describes = %w(vpc_id)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -44,6 +44,7 @@ require 'awspec/helper/finder/sns_topic'
44
44
  require 'awspec/helper/finder/emr'
45
45
  require 'awspec/helper/finder/redshift'
46
46
  require 'awspec/helper/finder/codedeploy'
47
+ require 'awspec/helper/finder/mq'
47
48
 
48
49
  require 'awspec/helper/finder/account_attributes'
49
50
 
@@ -97,6 +98,7 @@ module Awspec::Helper
97
98
  include Awspec::Helper::Finder::Emr
98
99
  include Awspec::Helper::Finder::Redshift
99
100
  include Awspec::Helper::Finder::Codedeploy
101
+ include Awspec::Helper::Finder::Mq
100
102
 
101
103
  CLIENTS = {
102
104
  ec2_client: Aws::EC2::Client,
@@ -138,7 +140,8 @@ module Awspec::Helper
138
140
  sns_client: Aws::SNS::Client,
139
141
  emr_client: Aws::EMR::Client,
140
142
  redshift_client: Aws::Redshift::Client,
141
- codedeploy_client: Aws::CodeDeploy::Client
143
+ codedeploy_client: Aws::CodeDeploy::Client,
144
+ mq_client: Aws::MQ::Client
142
145
  }
143
146
 
144
147
  CLIENT_OPTIONS = {
@@ -0,0 +1,11 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module Mq
4
+ def find_broker(broker_id)
5
+ mq_client.describe_broker({ broker_id: broker_id })
6
+ rescue
7
+ nil
8
+ end
9
+ end
10
+ end
11
+ end
@@ -13,7 +13,7 @@ module Awspec
13
13
  cloudwatch_alarm cloudwatch_event directconnect_virtual_interface
14
14
  ebs ec2 ecr_repository ecs_cluster ecs_container_instance ecs_service ecs_task_definition
15
15
  efs eks elasticache elasticache_cache_parameter_group elasticsearch elb emr firehose iam_group
16
- iam_policy iam_role iam_user kinesis kms lambda launch_configuration launch_template nat_gateway
16
+ iam_policy iam_role iam_user kinesis kms lambda launch_configuration launch_template mq nat_gateway
17
17
  network_acl network_interface nlb nlb_listener nlb_target_group
18
18
  rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
19
19
  route_table s3_bucket security_group ses_identity subnet vpc cloudfront_distribution
@@ -13,7 +13,17 @@ Aws.config[:efs] = {
13
13
  number_of_mount_targets: 1,
14
14
  life_cycle_state: 'available',
15
15
  owner_id: '123456789012',
16
- performance_mode: 'generalPurpose'
16
+ performance_mode: 'generalPurpose',
17
+ tags: [
18
+ {
19
+ value: 'my-value',
20
+ key: 'my-key'
21
+ },
22
+ {
23
+ value: 'my-efs',
24
+ key: 'Name'
25
+ }
26
+ ]
17
27
  }
18
28
  ]
19
29
  },
@@ -0,0 +1,111 @@
1
+ Aws.config[:mq] = {
2
+ stub_responses: {
3
+ describe_broker: {
4
+ auto_minor_version_upgrade: false,
5
+ created: Time.new(2019, 1, 2, 10, 10, 00, '+00:00'),
6
+ broker_arn: 'arn:aws:mq:us-east-1:910612559259:broker:broker_mq:b-abaf644d-49ed-382a-6fa0-d4034df1678e',
7
+ broker_state: 'RUNNING',
8
+ broker_id: 'b-abaf644d-49ed-382a-6fa0-d4034df1678e',
9
+ broker_name: 'broker_mq',
10
+ maintenance_window_start_time: {
11
+ day_of_week: 'WEDNESDAY',
12
+ time_zone: 'UTC',
13
+ time_of_day: '23:00'
14
+ },
15
+ broker_instances: [
16
+ {
17
+ ip_address: '10.10.10.1',
18
+ endpoints: [
19
+ 'ssl://b-abaf644d-49ed-382a-6fa0-d4034df1678e-1.mq.us-east-1.amazonaws.com:61617',
20
+ 'amqp+ssl://b-abaf644d-49ed-382a-6fa0-d4034df1678e-1.mq.us-east-1.amazonaws.com:5671',
21
+ 'stomp+ssl://b-abaf644d-49ed-382a-6fa0-d4034df1678e-1.mq.us-east-1.amazonaws.com:61614',
22
+ 'mqtt+ssl://b-abaf644d-49ed-382a-6fa0-d4034df1678e-1.mq.us-east-1.amazonaws.com:8883',
23
+ 'wss://b-abaf644d-49ed-382a-6fa0-d4034df1678e-1.mq.us-east-1.amazonaws.com:61619'
24
+ ],
25
+ console_url: 'https://b-abaf644d-49ed-382a-6fa0-d4034df1678e-1.mq.us-east-1.amazonaws.com:8162'
26
+ },
27
+ {
28
+ ip_address: '10.10.11.1',
29
+ endpoints: [
30
+ 'ssl://b-abaf644d-49ed-382a-6fa0-d4034df1678e-2.mq.us-east-1.amazonaws.com:61617',
31
+ 'amqp+ssl://b-abaf644d-49ed-382a-6fa0-d4034df1678e-2.mq.us-east-1.amazonaws.com:5671',
32
+ 'stomp+ssl://b-abaf644d-49ed-382a-6fa0-d4034df1678e-2.mq.us-east-1.amazonaws.com:61614',
33
+ 'mqtt+ssl://b-abaf644d-49ed-382a-6fa0-d4034df1678e-2.mq.us-east-1.amazonaws.com:8883',
34
+ 'wss://b-abaf644d-49ed-382a-6fa0-d4034df1678e-2.mq.us-east-1.amazonaws.com:61619'
35
+ ],
36
+ console_url: 'https://b-abaf644d-49ed-382a-6fa0-d4034df1678e-2.mq.us-east-1.amazonaws.com:8162'
37
+ }
38
+ ],
39
+ publicly_accessible: false,
40
+ configurations: {
41
+ current: {
42
+ id: 'c-c6064e54-7a02-4926-4028-78262d48e06f',
43
+ revision: 3
44
+ },
45
+ history: [
46
+ {
47
+ id: 'c-c6064e54-7a02-4926-4028-78262d48e06f',
48
+ revision: 2
49
+ }
50
+ ]
51
+ },
52
+ engine_version: '5.15.0',
53
+ engine_type: 'ActiveMQ',
54
+ deployment_mode: 'ACTIVE_STANDBY_MULTI_AZ',
55
+ users: [
56
+ {
57
+ username: 'admin'
58
+ }
59
+ ],
60
+ logs: {
61
+ audit: false,
62
+ general_log_group: '/aws/amazonmq/broker/b-abaf644d-49ed-382a-6fa0-d4034df1678e/general',
63
+ general: true,
64
+ audit_log_group: '/aws/amazonmq/broker/b-abaf644d-49ed-382a-6fa0-d4034df1678e/audit'
65
+ },
66
+ tags: {
67
+ 'Name' => 'my-mq'
68
+ },
69
+ subnet_ids: [
70
+ 'subnet-c102731fbf7b7abb9',
71
+ 'subnet-4efe21eb33f86ef91'
72
+ ],
73
+ host_instance_type: 'mq.m4.large',
74
+ security_groups: [
75
+ 'sg-788eab237e47f1472'
76
+ ]
77
+ }
78
+ }
79
+ }
80
+
81
+ Aws.config[:ec2] = {
82
+ stub_responses: {
83
+ describe_vpcs: {
84
+ vpcs: [
85
+ {
86
+ vpc_id: 'vpc-ab123cde',
87
+ tags: [
88
+ {
89
+ key: 'Name',
90
+ value: 'my-mq'
91
+ }
92
+ ]
93
+ }
94
+ ]
95
+ },
96
+ describe_security_groups: {
97
+ security_groups: [
98
+ {
99
+ group_id: 'sg-788eab237e47f1472',
100
+ group_name: 'mq-group-name-sg',
101
+ tags: [
102
+ {
103
+ key: 'Name',
104
+ value: 'my-mq-sg'
105
+ }
106
+ ]
107
+ }
108
+ ]
109
+ }
110
+ }
111
+ }
@@ -0,0 +1,57 @@
1
+ module Awspec::Type
2
+ class Mq < ResourceBase
3
+ def resource_via_client
4
+ @resource_via_client ||= find_broker(@display_name)
5
+ end
6
+
7
+ def id
8
+ @id ||= resource_via_client.broker_id if resource_via_client
9
+ end
10
+
11
+ STATES = %w(
12
+ running reboot-in-progress creation-in-progress
13
+ creation-failed deletion-in-progress
14
+ )
15
+
16
+ STATES.each do |state|
17
+ define_method state.tr('-', '_') + '?' do
18
+ resource_via_client.broker_state.downcase == state
19
+ end
20
+ end
21
+
22
+ def has_security_group?(sg_id)
23
+ return true if has_vpc_security_group_id?(sg_id)
24
+ return true if has_vpc_security_group_name?(sg_id)
25
+ return true if has_vpc_security_group_tag_name?(sg_id)
26
+ end
27
+
28
+ def has_tag?(tag_key, tag_value)
29
+ @resource_via_client.tags do |tag|
30
+ tag.key == tag_key && tag.value == tag_value
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def has_vpc_security_group_id?(sg_id)
37
+ sgs = @resource_via_client.security_groups
38
+ sgs.find do |sg|
39
+ sg == sg_id
40
+ end
41
+ end
42
+
43
+ def has_vpc_security_group_name?(sg_id)
44
+ res = select_security_group_by_group_name([sg_id])
45
+
46
+ return false unless res.count == 1
47
+ has_vpc_security_group_id?(res.first.group_id)
48
+ end
49
+
50
+ def has_vpc_security_group_tag_name?(sg_id)
51
+ res = select_security_group_by_tag_name([sg_id])
52
+
53
+ return false unless res.count == 1
54
+ has_vpc_security_group_id?(res.first.group_id)
55
+ end
56
+ end
57
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.15.3'
2
+ VERSION = '1.16.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.15.3
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-20 00:00:00.000000000 Z
11
+ date: 2019-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -269,6 +269,7 @@ files:
269
269
  - doc/_resource_types/lambda_account_settings.md
270
270
  - doc/_resource_types/launch_configuration.md
271
271
  - doc/_resource_types/launch_template.md
272
+ - doc/_resource_types/mq.md
272
273
  - doc/_resource_types/nat_gateway.md
273
274
  - doc/_resource_types/network_acl.md
274
275
  - doc/_resource_types/network_interface.md
@@ -364,6 +365,7 @@ files:
364
365
  - lib/awspec/generator/doc/type/lambda_account_settings.rb
365
366
  - lib/awspec/generator/doc/type/launch_configuration.rb
366
367
  - lib/awspec/generator/doc/type/launch_template.rb
368
+ - lib/awspec/generator/doc/type/mq.rb
367
369
  - lib/awspec/generator/doc/type/nat_gateway.rb
368
370
  - lib/awspec/generator/doc/type/network_acl.rb
369
371
  - lib/awspec/generator/doc/type/network_interface.rb
@@ -466,6 +468,7 @@ files:
466
468
  - lib/awspec/helper/finder/kinesis.rb
467
469
  - lib/awspec/helper/finder/kms.rb
468
470
  - lib/awspec/helper/finder/lambda.rb
471
+ - lib/awspec/helper/finder/mq.rb
469
472
  - lib/awspec/helper/finder/nlb.rb
470
473
  - lib/awspec/helper/finder/rds.rb
471
474
  - lib/awspec/helper/finder/redshift.rb
@@ -578,6 +581,7 @@ files:
578
581
  - lib/awspec/stub/lambda.rb
579
582
  - lib/awspec/stub/launch_configuration.rb
580
583
  - lib/awspec/stub/launch_template.rb
584
+ - lib/awspec/stub/mq.rb
581
585
  - lib/awspec/stub/nat_gateway.rb
582
586
  - lib/awspec/stub/network_acl.rb
583
587
  - lib/awspec/stub/network_interface.rb
@@ -658,6 +662,7 @@ files:
658
662
  - lib/awspec/type/lambda_account_settings.rb
659
663
  - lib/awspec/type/launch_configuration.rb
660
664
  - lib/awspec/type/launch_template.rb
665
+ - lib/awspec/type/mq.rb
661
666
  - lib/awspec/type/nat_gateway.rb
662
667
  - lib/awspec/type/network_acl.rb
663
668
  - lib/awspec/type/network_interface.rb