awspec 1.15.0 → 1.16.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 +5 -5
- data/awspec.gemspec +1 -1
- data/doc/_resource_types/iam_group.md +9 -1
- data/doc/_resource_types/iam_role.md +8 -0
- data/doc/_resource_types/iam_user.md +8 -0
- data/doc/_resource_types/mq.md +33 -0
- data/doc/resource_types.md +102 -0
- data/lib/awspec/generator/doc/type/mq.rb +19 -0
- data/lib/awspec/helper/finder/mq.rb +11 -0
- data/lib/awspec/helper/finder/rds.rb +6 -4
- data/lib/awspec/helper/finder/s3.rb +1 -2
- data/lib/awspec/helper/finder/sns_topic.rb +0 -1
- data/lib/awspec/helper/finder.rb +4 -1
- data/lib/awspec/helper/type.rb +1 -1
- data/lib/awspec/stub/efs.rb +11 -1
- data/lib/awspec/stub/mq.rb +111 -0
- data/lib/awspec/type/iam_group.rb +9 -0
- data/lib/awspec/type/iam_role.rb +9 -0
- data/lib/awspec/type/iam_user.rb +9 -0
- data/lib/awspec/type/mq.rb +57 -0
- data/lib/awspec/version.rb +1 -1
- metadata +16 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 9252dd0d3fea68629e0beef8ffccc4e9c5ed332d
|
|
4
|
+
data.tar.gz: b48df6974e6edcb4f7271d809ea9209004c39f6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '04684450be551fa8362385f94a304cc13747f8140b215c7ec274e5ddeb07ebc0abdb2f3ce1e60dfe9f0e2d5adf87122de8fed6eefeef35b69c3386ea59e87594'
|
|
7
|
+
data.tar.gz: ec1da9fc0da0d614c34c3215d2f4caa3b82f0f83fdd77ed0f360dc3c7aed8c40379f38a85416e0a7bee21c690721ec68717fca1bd468e0f5c3afc61cc152e842
|
data/awspec.gemspec
CHANGED
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.add_runtime_dependency 'rspec-its'
|
|
30
30
|
spec.add_runtime_dependency 'term-ansicolor'
|
|
31
31
|
spec.add_runtime_dependency 'thor'
|
|
32
|
-
spec.add_development_dependency 'bundler', '
|
|
32
|
+
spec.add_development_dependency 'bundler', '>= 1.9', '< 2.1'
|
|
33
33
|
spec.add_development_dependency 'octorelease'
|
|
34
34
|
spec.add_development_dependency 'pry'
|
|
35
35
|
spec.add_development_dependency 'rake', '~> 12.0'
|
|
@@ -31,7 +31,7 @@ describe iam_group('my-iam-group') do
|
|
|
31
31
|
end
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
###
|
|
34
|
+
### have_inline_policy
|
|
35
35
|
|
|
36
36
|
```ruby
|
|
37
37
|
describe iam_group('my-iam-group') do
|
|
@@ -67,6 +67,14 @@ DOC
|
|
|
67
67
|
end
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
You can test absence of inline policies.
|
|
71
|
+
|
|
72
|
+
```ruby
|
|
73
|
+
describe iam_group('my-iam-group') do
|
|
74
|
+
it { should_not have_inline_policy }
|
|
75
|
+
end
|
|
76
|
+
```
|
|
77
|
+
|
|
70
78
|
### advanced
|
|
71
79
|
|
|
72
80
|
`iam_group` can use `Aws::IAM::Group` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/IAM/Group.html).
|
|
@@ -51,6 +51,14 @@ DOC
|
|
|
51
51
|
end
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
You can test absence of inline policies.
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
describe iam_role('my-iam-role') do
|
|
58
|
+
it { should_not have_inline_policy }
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
54
62
|
### advanced
|
|
55
63
|
|
|
56
64
|
`iam_role` can use `Aws::IAM::Role` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/IAM/Role.html).
|
|
@@ -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
|
+
```
|
data/doc/resource_types.md
CHANGED
|
@@ -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)
|
|
@@ -1670,6 +1671,49 @@ end
|
|
|
1670
1671
|
|
|
1671
1672
|
### have_inline_policy
|
|
1672
1673
|
|
|
1674
|
+
```ruby
|
|
1675
|
+
describe iam_group('my-iam-group') do
|
|
1676
|
+
it { should have_inline_policy('InlineEC2FullAccess') }
|
|
1677
|
+
it do
|
|
1678
|
+
should have_inline_policy('InlineEC2FullAccess').policy_document(<<-'DOC')
|
|
1679
|
+
{
|
|
1680
|
+
"Statement": [
|
|
1681
|
+
{
|
|
1682
|
+
"Action": "ec2:*",
|
|
1683
|
+
"Effect": "Allow",
|
|
1684
|
+
"Resource": "*"
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
"Effect": "Allow",
|
|
1688
|
+
"Action": "elasticloadbalancing:*",
|
|
1689
|
+
"Resource": "*"
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
"Effect": "Allow",
|
|
1693
|
+
"Action": "cloudwatch:*",
|
|
1694
|
+
"Resource": "*"
|
|
1695
|
+
},
|
|
1696
|
+
{
|
|
1697
|
+
"Effect": "Allow",
|
|
1698
|
+
"Action": "autoscaling:*",
|
|
1699
|
+
"Resource": "*"
|
|
1700
|
+
}
|
|
1701
|
+
]
|
|
1702
|
+
}
|
|
1703
|
+
DOC
|
|
1704
|
+
end
|
|
1705
|
+
end
|
|
1706
|
+
```
|
|
1707
|
+
|
|
1708
|
+
You can test absence of inline policies.
|
|
1709
|
+
|
|
1710
|
+
```ruby
|
|
1711
|
+
describe iam_group('my-iam-group') do
|
|
1712
|
+
it { should_not have_inline_policy }
|
|
1713
|
+
end
|
|
1714
|
+
```
|
|
1715
|
+
|
|
1716
|
+
|
|
1673
1717
|
### its(:path), its(:group_name), its(:group_id), its(:arn), its(:create_date)
|
|
1674
1718
|
### :unlock: Advanced use
|
|
1675
1719
|
|
|
@@ -1798,6 +1842,14 @@ DOC
|
|
|
1798
1842
|
end
|
|
1799
1843
|
```
|
|
1800
1844
|
|
|
1845
|
+
You can test absence of inline policies.
|
|
1846
|
+
|
|
1847
|
+
```ruby
|
|
1848
|
+
describe iam_role('my-iam-role') do
|
|
1849
|
+
it { should_not have_inline_policy }
|
|
1850
|
+
end
|
|
1851
|
+
```
|
|
1852
|
+
|
|
1801
1853
|
|
|
1802
1854
|
### its(:path), its(:role_name), its(:role_id), its(:arn), its(:create_date), its(:assume_role_policy_document), its(:description), its(:max_session_duration), its(:permissions_boundary), its(:tags)
|
|
1803
1855
|
### :unlock: Advanced use
|
|
@@ -1878,6 +1930,14 @@ DOC
|
|
|
1878
1930
|
end
|
|
1879
1931
|
```
|
|
1880
1932
|
|
|
1933
|
+
You can test absence of inline policies.
|
|
1934
|
+
|
|
1935
|
+
```ruby
|
|
1936
|
+
describe iam_user('my-iam-user') do
|
|
1937
|
+
it { should_not have_inline_policy }
|
|
1938
|
+
end
|
|
1939
|
+
```
|
|
1940
|
+
|
|
1881
1941
|
|
|
1882
1942
|
### belong_to_iam_group
|
|
1883
1943
|
|
|
@@ -2166,6 +2226,48 @@ end
|
|
|
2166
2226
|
```
|
|
2167
2227
|
|
|
2168
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)
|
|
2169
2271
|
## <a name="nat_gateway">nat_gateway</a>
|
|
2170
2272
|
|
|
2171
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
|
|
@@ -37,14 +37,16 @@ module Awspec::Helper
|
|
|
37
37
|
|
|
38
38
|
def select_all_rds_db_cluster_parameters(parameter_group)
|
|
39
39
|
parameters = {}
|
|
40
|
-
|
|
41
|
-
db_cluster_parameter_group_name: parameter_group
|
|
42
|
-
})
|
|
40
|
+
next_marker = nil
|
|
43
41
|
loop do
|
|
42
|
+
res = rds_client.describe_db_cluster_parameters({
|
|
43
|
+
marker: next_marker,
|
|
44
|
+
db_cluster_parameter_group_name: parameter_group
|
|
45
|
+
})
|
|
44
46
|
res.parameters.each do |param|
|
|
45
47
|
parameters[param.parameter_name] = param.parameter_value
|
|
46
48
|
end
|
|
47
|
-
(res.
|
|
49
|
+
(res.marker.present? && next_marker = res.marker) || break
|
|
48
50
|
end
|
|
49
51
|
parameters
|
|
50
52
|
end
|
|
@@ -44,7 +44,6 @@ module Awspec::Helper
|
|
|
44
44
|
# Awspec::NoExistingResource will be raised.
|
|
45
45
|
begin
|
|
46
46
|
response = sns_client.get_topic_attributes({ topic_arn: topic_arn })
|
|
47
|
-
puts response
|
|
48
47
|
topic = SnsTopic.new(response.attributes)
|
|
49
48
|
rescue Aws::SNS::Errors::NotFound
|
|
50
49
|
topic = nil
|
data/lib/awspec/helper/finder.rb
CHANGED
|
@@ -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 = {
|
data/lib/awspec/helper/type.rb
CHANGED
|
@@ -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
|
data/lib/awspec/stub/efs.rb
CHANGED
|
@@ -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
|
+
}
|
|
@@ -28,6 +28,8 @@ module Awspec::Type
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def has_inline_policy?(policy_name, document = nil)
|
|
31
|
+
return has_any_inline_policies? unless policy_name
|
|
32
|
+
|
|
31
33
|
res = iam_client.get_group_policy({
|
|
32
34
|
group_name: id,
|
|
33
35
|
policy_name: policy_name
|
|
@@ -35,5 +37,12 @@ module Awspec::Type
|
|
|
35
37
|
return JSON.parse(URI.decode(res.policy_document)) == JSON.parse(document) if document
|
|
36
38
|
res
|
|
37
39
|
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def has_any_inline_policies?
|
|
44
|
+
res = iam_client.list_group_policies(group_name: id)
|
|
45
|
+
!res.policy_names.empty?
|
|
46
|
+
end
|
|
38
47
|
end
|
|
39
48
|
end
|
data/lib/awspec/type/iam_role.rb
CHANGED
|
@@ -18,6 +18,8 @@ module Awspec::Type
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def has_inline_policy?(policy_name, document = nil)
|
|
21
|
+
return has_any_inline_policies? unless policy_name
|
|
22
|
+
|
|
21
23
|
res = iam_client.get_role_policy({
|
|
22
24
|
role_name: resource_via_client.role_name,
|
|
23
25
|
policy_name: policy_name
|
|
@@ -25,5 +27,12 @@ module Awspec::Type
|
|
|
25
27
|
return JSON.parse(URI.decode(res.policy_document)) == JSON.parse(document) if document
|
|
26
28
|
res
|
|
27
29
|
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def has_any_inline_policies?
|
|
34
|
+
res = iam_client.list_role_policies(role_name: resource_via_client.role_name)
|
|
35
|
+
!res.policy_names.empty?
|
|
36
|
+
end
|
|
28
37
|
end
|
|
29
38
|
end
|
data/lib/awspec/type/iam_user.rb
CHANGED
|
@@ -18,6 +18,8 @@ module Awspec::Type
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def has_inline_policy?(policy_name, document = nil)
|
|
21
|
+
return has_any_inline_policies? unless policy_name
|
|
22
|
+
|
|
21
23
|
res = iam_client.get_user_policy({
|
|
22
24
|
user_name: resource_via_client.user_name,
|
|
23
25
|
policy_name: policy_name
|
|
@@ -25,5 +27,12 @@ module Awspec::Type
|
|
|
25
27
|
return JSON.parse(URI.decode(res.policy_document)) == JSON.parse(document) if document
|
|
26
28
|
res
|
|
27
29
|
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def has_any_inline_policies?
|
|
34
|
+
res = iam_client.list_user_policies(user_name: resource_via_client.user_name)
|
|
35
|
+
!res.policy_names.empty?
|
|
36
|
+
end
|
|
28
37
|
end
|
|
29
38
|
end
|
|
@@ -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
|
data/lib/awspec/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2019-02-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sdk
|
|
@@ -126,16 +126,22 @@ dependencies:
|
|
|
126
126
|
name: bundler
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
|
129
|
-
- - "
|
|
129
|
+
- - ">="
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
131
|
version: '1.9'
|
|
132
|
+
- - "<"
|
|
133
|
+
- !ruby/object:Gem::Version
|
|
134
|
+
version: '2.1'
|
|
132
135
|
type: :development
|
|
133
136
|
prerelease: false
|
|
134
137
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
138
|
requirements:
|
|
136
|
-
- - "
|
|
139
|
+
- - ">="
|
|
137
140
|
- !ruby/object:Gem::Version
|
|
138
141
|
version: '1.9'
|
|
142
|
+
- - "<"
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '2.1'
|
|
139
145
|
- !ruby/object:Gem::Dependency
|
|
140
146
|
name: octorelease
|
|
141
147
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -263,6 +269,7 @@ files:
|
|
|
263
269
|
- doc/_resource_types/lambda_account_settings.md
|
|
264
270
|
- doc/_resource_types/launch_configuration.md
|
|
265
271
|
- doc/_resource_types/launch_template.md
|
|
272
|
+
- doc/_resource_types/mq.md
|
|
266
273
|
- doc/_resource_types/nat_gateway.md
|
|
267
274
|
- doc/_resource_types/network_acl.md
|
|
268
275
|
- doc/_resource_types/network_interface.md
|
|
@@ -358,6 +365,7 @@ files:
|
|
|
358
365
|
- lib/awspec/generator/doc/type/lambda_account_settings.rb
|
|
359
366
|
- lib/awspec/generator/doc/type/launch_configuration.rb
|
|
360
367
|
- lib/awspec/generator/doc/type/launch_template.rb
|
|
368
|
+
- lib/awspec/generator/doc/type/mq.rb
|
|
361
369
|
- lib/awspec/generator/doc/type/nat_gateway.rb
|
|
362
370
|
- lib/awspec/generator/doc/type/network_acl.rb
|
|
363
371
|
- lib/awspec/generator/doc/type/network_interface.rb
|
|
@@ -460,6 +468,7 @@ files:
|
|
|
460
468
|
- lib/awspec/helper/finder/kinesis.rb
|
|
461
469
|
- lib/awspec/helper/finder/kms.rb
|
|
462
470
|
- lib/awspec/helper/finder/lambda.rb
|
|
471
|
+
- lib/awspec/helper/finder/mq.rb
|
|
463
472
|
- lib/awspec/helper/finder/nlb.rb
|
|
464
473
|
- lib/awspec/helper/finder/rds.rb
|
|
465
474
|
- lib/awspec/helper/finder/redshift.rb
|
|
@@ -572,6 +581,7 @@ files:
|
|
|
572
581
|
- lib/awspec/stub/lambda.rb
|
|
573
582
|
- lib/awspec/stub/launch_configuration.rb
|
|
574
583
|
- lib/awspec/stub/launch_template.rb
|
|
584
|
+
- lib/awspec/stub/mq.rb
|
|
575
585
|
- lib/awspec/stub/nat_gateway.rb
|
|
576
586
|
- lib/awspec/stub/network_acl.rb
|
|
577
587
|
- lib/awspec/stub/network_interface.rb
|
|
@@ -652,6 +662,7 @@ files:
|
|
|
652
662
|
- lib/awspec/type/lambda_account_settings.rb
|
|
653
663
|
- lib/awspec/type/launch_configuration.rb
|
|
654
664
|
- lib/awspec/type/launch_template.rb
|
|
665
|
+
- lib/awspec/type/mq.rb
|
|
655
666
|
- lib/awspec/type/nat_gateway.rb
|
|
656
667
|
- lib/awspec/type/network_acl.rb
|
|
657
668
|
- lib/awspec/type/network_interface.rb
|
|
@@ -700,7 +711,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
700
711
|
version: '0'
|
|
701
712
|
requirements: []
|
|
702
713
|
rubyforge_project:
|
|
703
|
-
rubygems_version: 2.
|
|
714
|
+
rubygems_version: 2.6.14
|
|
704
715
|
signing_key:
|
|
705
716
|
specification_version: 4
|
|
706
717
|
summary: RSpec tests for your AWS resources.
|