awspec 0.49.0 → 0.50.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 +4 -4
- data/.travis.yml +3 -2
- data/README.md +4 -0
- data/doc/resource_types.md +14 -2
- data/lib/awspec/generator.rb +1 -0
- data/lib/awspec/generator/doc/type/cloudwatch_event.rb +17 -0
- data/lib/awspec/generator/spec/cloudwatch_event.rb +27 -0
- data/lib/awspec/helper/finder.rb +3 -0
- data/lib/awspec/helper/finder/cloudwatch_event.rb +15 -0
- data/lib/awspec/helper/type.rb +1 -1
- data/lib/awspec/stub/cloudfront_distribution.rb +2 -0
- data/lib/awspec/stub/cloudwatch_event.rb +15 -0
- data/lib/awspec/type/cloudwatch_event.rb +17 -0
- data/lib/awspec/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0115d1e32df283cce263ed572dc81184da88922
|
|
4
|
+
data.tar.gz: 01b94d7a11b2ca745a69933b61547072a422be36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7d14db16d8c43130e70e4d046f7403b2dd402acbff5e1529435839c03965ded951b875e0c8a164058b12e0fea61a1543144395756d79b4d20d5109cbe8cf003b
|
|
7
|
+
data.tar.gz: 2484777564f8c4657072b83627cb11018498ba0b5e6e694f20ee7a26cf018c15780f0b7d5657c58259805ffb08dd785180c2bde17069c41e4710b86b305ea374
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -96,6 +96,10 @@ $ AWS_PROFILE=mycreds bundle exec rake spec
|
|
|
96
96
|
|
|
97
97
|
[Resource Types infomation here](doc/resource_types.md)
|
|
98
98
|
|
|
99
|
+
## awspec AWS key/secrets precedence
|
|
100
|
+
|
|
101
|
+
Dependent on [awsecrets](https://github.com/k1LoW/awsecrets#awsecrets-config-precedence).
|
|
102
|
+
|
|
99
103
|
## References
|
|
100
104
|
|
|
101
105
|
awspec is inspired by Serverspec.
|
data/doc/resource_types.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
| [autoscaling_group](#autoscaling_group)
|
|
5
5
|
| [cloudtrail](#cloudtrail)
|
|
6
6
|
| [cloudwatch_alarm](#cloudwatch_alarm)
|
|
7
|
+
| [cloudwatch_event](#cloudwatch_event)
|
|
7
8
|
| [directconnect_virtual_interface](#directconnect_virtual_interface)
|
|
8
9
|
| [ebs](#ebs)
|
|
9
10
|
| [ec2](#ec2)
|
|
@@ -188,6 +189,17 @@ end
|
|
|
188
189
|
```
|
|
189
190
|
|
|
190
191
|
### its(:alarm_name), its(:alarm_arn), its(:alarm_description), its(:alarm_configuration_updated_timestamp), its(:actions_enabled), its(:state_value), its(:state_reason), its(:state_reason_data), its(:state_updated_timestamp), its(:metric_name), its(:namespace), its(:statistic), its(:period), its(:unit), its(:evaluation_periods), its(:threshold), its(:comparison_operator)
|
|
192
|
+
## <a name="cloudwatch_event">cloudwatch_event</a>
|
|
193
|
+
|
|
194
|
+
CloudwatchEvent resource type.
|
|
195
|
+
|
|
196
|
+
### exist
|
|
197
|
+
|
|
198
|
+
### be_enable
|
|
199
|
+
|
|
200
|
+
### be_scheduled
|
|
201
|
+
|
|
202
|
+
### its(:name), its(:arn), its(:event_pattern), its(:state), its(:description), its(:schedule_expression), its(:role_arn)
|
|
191
203
|
## <a name="directconnect_virtual_interface">directconnect_virtual_interface</a>
|
|
192
204
|
|
|
193
205
|
DirectconnectVirtualInterface resource type.
|
|
@@ -1140,7 +1152,7 @@ end
|
|
|
1140
1152
|
```
|
|
1141
1153
|
|
|
1142
1154
|
|
|
1143
|
-
### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn), its(:promotion_tier)
|
|
1155
|
+
### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn), its(:promotion_tier), its(:db_instance_arn)
|
|
1144
1156
|
### :unlock: Advanced use
|
|
1145
1157
|
|
|
1146
1158
|
`rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
|
|
@@ -1671,7 +1683,7 @@ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
|
|
|
1671
1683
|
end
|
|
1672
1684
|
```
|
|
1673
1685
|
|
|
1674
|
-
### its(:id), its(:status), its(:last_modified_time), its(:domain_name), its(:comment), its(:price_class), its(:enabled), its(:web_acl_id)
|
|
1686
|
+
### its(:id), its(:arn), its(:status), its(:last_modified_time), its(:domain_name), its(:comment), its(:price_class), its(:enabled), its(:web_acl_id)
|
|
1675
1687
|
## <a name="elastictranscoder_pipeline">elastictranscoder_pipeline</a>
|
|
1676
1688
|
|
|
1677
1689
|
ElastictranscoderPipeline resource type.
|
data/lib/awspec/generator.rb
CHANGED
|
@@ -7,6 +7,7 @@ require 'awspec/generator/spec/route53_hosted_zone'
|
|
|
7
7
|
require 'awspec/generator/spec/elb'
|
|
8
8
|
require 'awspec/generator/spec/iam_policy'
|
|
9
9
|
require 'awspec/generator/spec/cloudwatch_alarm'
|
|
10
|
+
require 'awspec/generator/spec/cloudwatch_event'
|
|
10
11
|
require 'awspec/generator/spec/network_acl'
|
|
11
12
|
require 'awspec/generator/spec/route_table'
|
|
12
13
|
require 'awspec/generator/spec/subnet'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Awspec::Generator
|
|
2
|
+
module Doc
|
|
3
|
+
module Type
|
|
4
|
+
class CloudwatchEvent < Base
|
|
5
|
+
def initialize
|
|
6
|
+
super
|
|
7
|
+
@type_name = 'CloudwatchEvent'
|
|
8
|
+
@type = Awspec::Type::CloudwatchEvent.new('my-cloudwatch-event')
|
|
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,27 @@
|
|
|
1
|
+
module Awspec::Generator
|
|
2
|
+
module Spec
|
|
3
|
+
class CloudwatchEvent
|
|
4
|
+
include Awspec::Helper::Finder
|
|
5
|
+
def generate_all
|
|
6
|
+
events = select_all_cloudwatch_events
|
|
7
|
+
raise 'Not Found alarm' if events.empty?
|
|
8
|
+
ERB.new(event_spec_template, nil, '-').result(binding).chomp
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def event_spec_template
|
|
12
|
+
template = <<-'EOF'
|
|
13
|
+
<% events.each do |event| %>
|
|
14
|
+
describe cloudwatch_event('<%= event.name %>') do
|
|
15
|
+
it { should exist }
|
|
16
|
+
<%- if event.state == 'ENABLED' -%>
|
|
17
|
+
it { should be_enable }
|
|
18
|
+
<% end -%>
|
|
19
|
+
it { should be_scheduled('<%= event.schedule_expression %>') }
|
|
20
|
+
end
|
|
21
|
+
<% end %>
|
|
22
|
+
EOF
|
|
23
|
+
template
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/lib/awspec/helper/finder.rb
CHANGED
|
@@ -13,6 +13,7 @@ require 'awspec/helper/finder/lambda'
|
|
|
13
13
|
require 'awspec/helper/finder/iam'
|
|
14
14
|
require 'awspec/helper/finder/elasticache'
|
|
15
15
|
require 'awspec/helper/finder/cloudwatch'
|
|
16
|
+
require 'awspec/helper/finder/cloudwatch_event'
|
|
16
17
|
require 'awspec/helper/finder/ses'
|
|
17
18
|
require 'awspec/helper/finder/directconnect'
|
|
18
19
|
require 'awspec/helper/finder/ami'
|
|
@@ -36,6 +37,7 @@ module Awspec::Helper
|
|
|
36
37
|
include Awspec::Helper::Finder::Iam
|
|
37
38
|
include Awspec::Helper::Finder::Elasticache
|
|
38
39
|
include Awspec::Helper::Finder::Cloudwatch
|
|
40
|
+
include Awspec::Helper::Finder::CloudwatchEvent
|
|
39
41
|
include Awspec::Helper::Finder::Ses
|
|
40
42
|
include Awspec::Helper::Finder::Directconnect
|
|
41
43
|
include Awspec::Helper::Finder::Ami
|
|
@@ -54,6 +56,7 @@ module Awspec::Helper
|
|
|
54
56
|
iam_client: Aws::IAM::Client,
|
|
55
57
|
elasticache_client: Aws::ElastiCache::Client,
|
|
56
58
|
cloudwatch_client: Aws::CloudWatch::Client,
|
|
59
|
+
cloudwatch_event_client: Aws::CloudWatchEvents::Client,
|
|
57
60
|
ses_client: Aws::SES::Client,
|
|
58
61
|
directconnect_client: Aws::DirectConnect::Client,
|
|
59
62
|
cloudfront_client: Aws::CloudFront::Client,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Awspec::Helper
|
|
2
|
+
module Finder
|
|
3
|
+
module CloudwatchEvent
|
|
4
|
+
def find_cloudwatch_event(id)
|
|
5
|
+
cloudwatch_event_client.list_rules.rules.find do |rule|
|
|
6
|
+
rule.name == id || rule.arn == id
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def select_all_cloudwatch_events
|
|
11
|
+
cloudwatch_event_client.list_rules.rules
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/awspec/helper/type.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Awspec
|
|
|
4
4
|
require 'awspec/type/base'
|
|
5
5
|
|
|
6
6
|
TYPES = %w(
|
|
7
|
-
ami autoscaling_group cloudtrail cloudwatch_alarm directconnect_virtual_interface
|
|
7
|
+
ami autoscaling_group cloudtrail cloudwatch_alarm cloudwatch_event directconnect_virtual_interface
|
|
8
8
|
ebs ec2 elasticache elasticache_cache_parameter_group elb iam_group
|
|
9
9
|
iam_policy iam_role iam_user lambda launch_configuration nat_gateway
|
|
10
10
|
network_acl network_interface rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
|
|
@@ -11,6 +11,7 @@ Aws.config[:cloudfront] = {
|
|
|
11
11
|
[
|
|
12
12
|
{
|
|
13
13
|
id: 'E1ABCDEFG2HIJK',
|
|
14
|
+
arn: 'arn:aws:cloudfront:ap-northeast-1:1234567890:alarm:my-cloudfront-1',
|
|
14
15
|
status: 'Deployed',
|
|
15
16
|
last_modified_time: Time.new(2015, 1, 2, 10, 00, 00, '+00:00'),
|
|
16
17
|
domain_name: 'abcdefghijklmn.cloudfront.net',
|
|
@@ -106,6 +107,7 @@ Aws.config[:cloudfront] = {
|
|
|
106
107
|
},
|
|
107
108
|
{
|
|
108
109
|
id: 'E2CLOUDFRONTXX',
|
|
110
|
+
arn: 'arn:aws:cloudfront:ap-northeast-1:1234567890:alarm:my-cloudfront-2',
|
|
109
111
|
status: 'Deployed',
|
|
110
112
|
last_modified_time: Time.new(2016, 3, 2, 10, 00, 00, '+00:00'),
|
|
111
113
|
domain_name: '123456789zyxw.cloudfront.net',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# rubocop:disable all
|
|
2
|
+
Aws.config[:cloudwatchevents] = {
|
|
3
|
+
stub_responses: {
|
|
4
|
+
list_rules: {
|
|
5
|
+
rules: [
|
|
6
|
+
{
|
|
7
|
+
name: 'my-cloudwatch-event',
|
|
8
|
+
state: 'ENABLED',
|
|
9
|
+
schedule_expression: 'cron(* * * * * *)',
|
|
10
|
+
arn: 'arn:aws:events:ap-northeast-1:1234567890:rule/my_cloudwatch_event'
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Awspec::Type
|
|
2
|
+
class CloudwatchEvent < Base
|
|
3
|
+
def initialize(id)
|
|
4
|
+
super
|
|
5
|
+
@resource_via_client = find_cloudwatch_event(id)
|
|
6
|
+
@id = @resource_via_client.arn if @resource_via_client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def enable?
|
|
10
|
+
@resource_via_client.state == 'ENABLED'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def scheduled?(schedule)
|
|
14
|
+
@resource_via_client.schedule_expression == schedule
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
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: 0.
|
|
4
|
+
version: 0.50.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- k1LoW
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-08-
|
|
11
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -255,6 +255,7 @@ files:
|
|
|
255
255
|
- lib/awspec/generator/doc/type/cloudfront_distribution.rb
|
|
256
256
|
- lib/awspec/generator/doc/type/cloudtrail.rb
|
|
257
257
|
- lib/awspec/generator/doc/type/cloudwatch_alarm.rb
|
|
258
|
+
- lib/awspec/generator/doc/type/cloudwatch_event.rb
|
|
258
259
|
- lib/awspec/generator/doc/type/directconnect_virtual_interface.rb
|
|
259
260
|
- lib/awspec/generator/doc/type/ebs.rb
|
|
260
261
|
- lib/awspec/generator/doc/type/ec2.rb
|
|
@@ -282,6 +283,7 @@ files:
|
|
|
282
283
|
- lib/awspec/generator/doc/type/subnet.rb
|
|
283
284
|
- lib/awspec/generator/doc/type/vpc.rb
|
|
284
285
|
- lib/awspec/generator/spec/cloudwatch_alarm.rb
|
|
286
|
+
- lib/awspec/generator/spec/cloudwatch_event.rb
|
|
285
287
|
- lib/awspec/generator/spec/directconnect.rb
|
|
286
288
|
- lib/awspec/generator/spec/ebs.rb
|
|
287
289
|
- lib/awspec/generator/spec/ec2.rb
|
|
@@ -310,6 +312,7 @@ files:
|
|
|
310
312
|
- lib/awspec/helper/finder/cloudfront.rb
|
|
311
313
|
- lib/awspec/helper/finder/cloudtrail.rb
|
|
312
314
|
- lib/awspec/helper/finder/cloudwatch.rb
|
|
315
|
+
- lib/awspec/helper/finder/cloudwatch_event.rb
|
|
313
316
|
- lib/awspec/helper/finder/directconnect.rb
|
|
314
317
|
- lib/awspec/helper/finder/ebs.rb
|
|
315
318
|
- lib/awspec/helper/finder/ec2.rb
|
|
@@ -354,6 +357,7 @@ files:
|
|
|
354
357
|
- lib/awspec/stub/cloudfront_distribution.rb
|
|
355
358
|
- lib/awspec/stub/cloudtrail.rb
|
|
356
359
|
- lib/awspec/stub/cloudwatch_alarm.rb
|
|
360
|
+
- lib/awspec/stub/cloudwatch_event.rb
|
|
357
361
|
- lib/awspec/stub/directconnect_virtual_interface.rb
|
|
358
362
|
- lib/awspec/stub/duplicated_resource_type.rb
|
|
359
363
|
- lib/awspec/stub/ebs.rb
|
|
@@ -388,6 +392,7 @@ files:
|
|
|
388
392
|
- lib/awspec/type/cloudfront_distribution.rb
|
|
389
393
|
- lib/awspec/type/cloudtrail.rb
|
|
390
394
|
- lib/awspec/type/cloudwatch_alarm.rb
|
|
395
|
+
- lib/awspec/type/cloudwatch_event.rb
|
|
391
396
|
- lib/awspec/type/directconnect_virtual_interface.rb
|
|
392
397
|
- lib/awspec/type/ebs.rb
|
|
393
398
|
- lib/awspec/type/ec2.rb
|
|
@@ -435,7 +440,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
435
440
|
version: '0'
|
|
436
441
|
requirements: []
|
|
437
442
|
rubyforge_project:
|
|
438
|
-
rubygems_version: 2.
|
|
443
|
+
rubygems_version: 2.5.1
|
|
439
444
|
signing_key:
|
|
440
445
|
specification_version: 4
|
|
441
446
|
summary: RSpec tests for your AWS resources.
|