awspec 0.15.0 → 0.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: 246f7601c47ebc923bd6296cdd04cf6ed1a642dd
4
- data.tar.gz: 7da26f53af5ec2da25187659075122bc79cf93e2
3
+ metadata.gz: 0bb8a9241d1820e45eb6a89efa5c3155741ba7bd
4
+ data.tar.gz: 015e4dd1c035b7f8bc3eab7dc8f43956ebe16ba7
5
5
  SHA512:
6
- metadata.gz: c2bce6300309a639b3f7ae82c2d6a4019026c048552087d90d20eb525dd30cd79793c05c070b60358f1c78cbe79c054bdd33f2e360fbe81d4b97db283a20d67e
7
- data.tar.gz: 024cc4b227c6abd11740fa7e70de441f0c9e73a3c53dea13559cb7df7cd11a72e68a8d2e2c6cb1f3cd8733e36c5d337178bc3ddd7597710c78adaf45619e9eb6
6
+ metadata.gz: 320d0f037df7d383fc57aa5eb15d2f875ae46ef65097f59da389001997fbe1850a3623ce914b9d543e055e6b3cdf91078e39ba027a21fd6c9c733736c73016eb
7
+ data.tar.gz: 9cb8d832d86e157c4ffb23f29ed3d6437a2e110bac0f520c733647f07524036d1bd0141ca960abe3378aa272fabac0474d783363b64a1a227b79328391815a05
data/README.md CHANGED
@@ -102,6 +102,8 @@ $ awspec generate ec2 vpc-ab123cde >> spec/ec2_spec.rb
102
102
  - [x] ElastiCache Cache Parameter Group (`elasticache_cache_parameter_group`)
103
103
  - CloudWatch
104
104
  - [x] CloudWatch Alarm (`cloudwatch_alarm`)
105
+ - SES
106
+ - [x] SES Identity (`ses_identity`)
105
107
 
106
108
  [Resource Types more infomation here](doc/resource_types.md)
107
109
 
@@ -20,6 +20,7 @@
20
20
  | [elasticache](#elasticache)
21
21
  | [elasticache_cache_parameter_group](#elasticache_cache_parameter_group)
22
22
  | [cloudwatch_alarm](#cloudwatch_alarm)
23
+ | [ses_identity](#ses_identity)
23
24
 
24
25
  ## <a name="ec2">ec2</a>
25
26
 
@@ -121,7 +122,7 @@ RDS resource type.
121
122
 
122
123
  ### belong_to_vpc
123
124
 
124
- #### 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)
125
+ #### 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)
125
126
  ## <a name="rds_db_parameter_group">rds_db_parameter_group</a>
126
127
 
127
128
  RdsDbParameterGroup resource type.
@@ -413,3 +414,14 @@ CloudwatchAlarm resource type.
413
414
  ### belong_to_metric
414
415
 
415
416
  #### 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)
417
+ ## <a name="ses_identity">ses_identity</a>
418
+
419
+ SesIdentity resource type.
420
+
421
+ ### exist
422
+
423
+ ### have_dkim_tokens
424
+
425
+ ### have_identity_policy
426
+
427
+ #### its(:dkim_enabled), its(:dkim_verification_status), its(:bounce_topic), its(:complaint_topic), its(:delivery_topic), its(:forwarding_enabled), its(:verification_status), its(:verification_token)
@@ -0,0 +1,22 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class SesIdentity < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'SesIdentity'
8
+ @type = Awspec::Type::SesIdentity.new('example.com')
9
+ @ret = @type.resource
10
+ @matchers = []
11
+ @ignore_matchers = []
12
+ @describes = %w(
13
+ dkim_enabled dkim_verification_status
14
+ bounce_topic complaint_topic delivery_topic
15
+ forwarding_enabled
16
+ verification_status verification_token
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -12,6 +12,7 @@ require 'awspec/helper/finder/lambda'
12
12
  require 'awspec/helper/finder/iam'
13
13
  require 'awspec/helper/finder/elasticache'
14
14
  require 'awspec/helper/finder/cloudwatch'
15
+ require 'awspec/helper/finder/ses'
15
16
 
16
17
  module Awspec::Helper
17
18
  module Finder
@@ -29,6 +30,7 @@ module Awspec::Helper
29
30
  include Awspec::Helper::Finder::Iam
30
31
  include Awspec::Helper::Finder::Elasticache
31
32
  include Awspec::Helper::Finder::Cloudwatch
33
+ include Awspec::Helper::Finder::Ses
32
34
 
33
35
  # rubocop:disable all
34
36
  def initialize(id = nil)
@@ -42,6 +44,7 @@ module Awspec::Helper
42
44
  @iam_client = Aws::IAM::Client.new
43
45
  @elasticache_client = Aws::ElastiCache::Client.new
44
46
  @cloudwatch_client = Aws::CloudWatch::Client.new
47
+ @ses_client = Aws::SES::Client.new
45
48
  end
46
49
  end
47
50
  end
@@ -0,0 +1,13 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module Ses
4
+ def find_ses_identity(id)
5
+ res = @ses_client.list_identities
6
+ ret = res[:identities].select do |identity|
7
+ identity == id
8
+ end
9
+ ret.first if ret.count == 1
10
+ end
11
+ end
12
+ end
13
+ end
@@ -6,7 +6,7 @@ module Awspec
6
6
  vpc s3 route53_hosted_zone auto_scaling_group subnet
7
7
  route_table ebs elb lambda iam_user iam_group iam_role
8
8
  iam_policy elasticache elasticache_cache_parameter_group
9
- cloudwatch_alarm
9
+ cloudwatch_alarm ses_identity
10
10
  )
11
11
 
12
12
  TYPES.each do |type|
@@ -0,0 +1,41 @@
1
+ Aws.config[:ses] = {
2
+ stub_responses: {
3
+ list_identities: {
4
+ identities: [
5
+ 'example.com'
6
+ ]
7
+ },
8
+ list_identity_policies: {
9
+ policy_names: [
10
+ 'my-identity-policy-name'
11
+ ]
12
+ },
13
+ get_identity_dkim_attributes: {
14
+ dkim_attributes: {
15
+ 'example.com' => {
16
+ dkim_enabled: false,
17
+ dkim_verification_status: 'NotStarted',
18
+ dkim_tokens: []
19
+ }
20
+ }
21
+ },
22
+ get_identity_notification_attributes: {
23
+ notification_attributes: {
24
+ 'example.com' => {
25
+ bounce_topic: 'arn:aws:sns:us-east-1:1234567890:my-sns-topic',
26
+ complaint_topic: 'arn:aws:sns:us-east-1:1234567890:my-sns-topic',
27
+ delivery_topic: 'arn:aws:sns:us-east-1:1234567890:my-sns-topic',
28
+ forwarding_enabled: true
29
+ }
30
+ }
31
+ },
32
+ get_identity_verification_attributes: {
33
+ verification_attributes: {
34
+ 'example.com' => {
35
+ verification_status: 'Success',
36
+ verification_token: 'XXXXXXXXXXXXXXXABCXXXXXXXXXXXXXXX'
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,68 @@
1
+ module Awspec::Type
2
+ class SesIdentity < Base
3
+ def initialize(id)
4
+ super
5
+ @resource = find_ses_identity(id)
6
+ @id = @resource if @resource
7
+ end
8
+
9
+ def has_identity_policy?(name)
10
+ res = @ses_client.list_identity_policies({
11
+ identity: @id
12
+ })
13
+ res[:policy_names].find do |policy_name|
14
+ policy_name == name
15
+ end
16
+ end
17
+
18
+ # dkim_attributes
19
+ dkim_attributes = %w(
20
+ dkim_enabled dkim_verification_status
21
+ )
22
+
23
+ dkim_attributes.each do |attribute|
24
+ define_method attribute do
25
+ res = @ses_client.get_identity_dkim_attributes({
26
+ identities: [@id]
27
+ })
28
+ res[:dkim_attributes][@id][attribute.to_sym]
29
+ end
30
+ end
31
+
32
+ def has_dkim_tokens?(token)
33
+ res = @ses_client.get_identity_dkim_attributes({
34
+ identities: [@id]
35
+ })
36
+ res[:dkim_attributes][@id][:tokens].include?(token)
37
+ end
38
+
39
+ # notification_attributes
40
+ notification_attributes = %w(
41
+ bounce_topic complaint_topic delivery_topic
42
+ forwarding_enabled
43
+ )
44
+
45
+ notification_attributes.each do |attribute|
46
+ define_method attribute do
47
+ res = @ses_client.get_identity_notification_attributes({
48
+ identities: [@id]
49
+ })
50
+ res[:notification_attributes][@id][attribute.to_sym]
51
+ end
52
+ end
53
+
54
+ # verification_attributes
55
+ verification_attributes = %w(
56
+ verification_status verification_token
57
+ )
58
+
59
+ verification_attributes.each do |attribute|
60
+ define_method attribute do
61
+ res = @ses_client.get_identity_verification_attributes({
62
+ identities: [@id]
63
+ })
64
+ res[:verification_attributes][@id][attribute.to_sym]
65
+ end
66
+ end
67
+ end
68
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.15.0'
2
+ VERSION = '0.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: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-29 00:00:00.000000000 Z
11
+ date: 2015-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -193,6 +193,7 @@ files:
193
193
  - lib/awspec/generator/doc/type/route_table.rb
194
194
  - lib/awspec/generator/doc/type/s3.rb
195
195
  - lib/awspec/generator/doc/type/security_group.rb
196
+ - lib/awspec/generator/doc/type/ses_identity.rb
196
197
  - lib/awspec/generator/doc/type/subnet.rb
197
198
  - lib/awspec/generator/doc/type/vpc.rb
198
199
  - lib/awspec/generator/spec/ec2.rb
@@ -217,6 +218,7 @@ files:
217
218
  - lib/awspec/helper/finder/route53.rb
218
219
  - lib/awspec/helper/finder/s3.rb
219
220
  - lib/awspec/helper/finder/security_group.rb
221
+ - lib/awspec/helper/finder/ses.rb
220
222
  - lib/awspec/helper/finder/vpc.rb
221
223
  - lib/awspec/helper/type.rb
222
224
  - lib/awspec/matcher.rb
@@ -251,6 +253,7 @@ files:
251
253
  - lib/awspec/stub/route_table.rb
252
254
  - lib/awspec/stub/s3.rb
253
255
  - lib/awspec/stub/security_group.rb
256
+ - lib/awspec/stub/ses_identity.rb
254
257
  - lib/awspec/stub/subnet.rb
255
258
  - lib/awspec/stub/vpc.rb
256
259
  - lib/awspec/toolbox.rb
@@ -273,6 +276,7 @@ files:
273
276
  - lib/awspec/type/route_table.rb
274
277
  - lib/awspec/type/s3.rb
275
278
  - lib/awspec/type/security_group.rb
279
+ - lib/awspec/type/ses_identity.rb
276
280
  - lib/awspec/type/subnet.rb
277
281
  - lib/awspec/type/vpc.rb
278
282
  - lib/awspec/version.rb