aws-sdk-rails 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +239 -0
  3. data/LICENSE.txt +12 -0
  4. data/VERSION +1 -1
  5. data/lib/aws/rails/action_mailbox/rspec.rb +6 -65
  6. data/lib/aws/rails/middleware/elastic_beanstalk_sqsd.rb +134 -0
  7. data/lib/aws/rails/notifications.rb +3 -6
  8. data/lib/aws/rails/railtie.rb +39 -40
  9. data/lib/aws-sdk-rails.rb +16 -8
  10. metadata +26 -152
  11. data/app/controllers/action_mailbox/ingresses/ses/inbound_emails_controller.rb +0 -79
  12. data/bin/aws_sqs_active_job +0 -6
  13. data/config/routes.rb +0 -8
  14. data/lib/action_dispatch/session/dynamodb_store.rb +0 -38
  15. data/lib/active_job/queue_adapters/sqs_adapter/params.rb +0 -78
  16. data/lib/active_job/queue_adapters/sqs_adapter.rb +0 -58
  17. data/lib/active_job/queue_adapters/sqs_async_adapter.rb +0 -39
  18. data/lib/aws/rails/action_mailbox/engine.rb +0 -21
  19. data/lib/aws/rails/action_mailbox/rspec/email.rb +0 -50
  20. data/lib/aws/rails/action_mailbox/rspec/subscription_confirmation.rb +0 -37
  21. data/lib/aws/rails/action_mailbox/s3_client.rb +0 -28
  22. data/lib/aws/rails/action_mailbox/sns_message_verifier.rb +0 -18
  23. data/lib/aws/rails/action_mailbox/sns_notification.rb +0 -99
  24. data/lib/aws/rails/middleware/ebs_sqs_active_job_middleware.rb +0 -118
  25. data/lib/aws/rails/ses_mailer.rb +0 -49
  26. data/lib/aws/rails/sesv2_mailer.rb +0 -60
  27. data/lib/aws/rails/sqs_active_job/configuration.rb +0 -184
  28. data/lib/aws/rails/sqs_active_job/deduplication.rb +0 -21
  29. data/lib/aws/rails/sqs_active_job/executor.rb +0 -77
  30. data/lib/aws/rails/sqs_active_job/job_runner.rb +0 -27
  31. data/lib/aws/rails/sqs_active_job/lambda_handler.rb +0 -63
  32. data/lib/aws/rails/sqs_active_job/poller.rb +0 -160
  33. data/lib/aws/rails/sqs_active_job.rb +0 -33
  34. data/lib/generators/aws_record/base.rb +0 -213
  35. data/lib/generators/aws_record/generated_attribute.rb +0 -138
  36. data/lib/generators/aws_record/model/USAGE +0 -24
  37. data/lib/generators/aws_record/model/model_generator.rb +0 -25
  38. data/lib/generators/aws_record/model/templates/model.erb +0 -48
  39. data/lib/generators/aws_record/model/templates/table_config.erb +0 -18
  40. data/lib/generators/aws_record/secondary_index.rb +0 -66
  41. data/lib/generators/dynamo_db/session_store_migration/USAGE +0 -13
  42. data/lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb +0 -48
  43. data/lib/generators/dynamo_db/session_store_migration/templates/dynamo_db_session_store.yml +0 -70
  44. data/lib/generators/dynamo_db/session_store_migration/templates/session_store_migration.erb +0 -9
  45. data/lib/tasks/aws_record/migrate.rake +0 -14
  46. data/lib/tasks/dynamo_db/session_store.rake +0 -10
@@ -1,48 +0,0 @@
1
- require 'aws-record'
2
- <% if has_validations? -%>
3
- require 'active_model'
4
- <% end -%>
5
-
6
- <% module_namespacing do -%>
7
- class <%= class_name %>
8
- include Aws::Record
9
- <% if options.key? :scaffold -%>
10
- extend ActiveModel::Naming
11
- <% end -%>
12
- <% if has_validations? -%>
13
- include ActiveModel::Validations
14
- <% end -%>
15
- <% if options.key? :password_digest -%>
16
- include ActiveModel::SecurePassword
17
- <% end -%>
18
- <% if mutation_tracking_disabled? -%>
19
- disable_mutation_tracking
20
- <% end -%>
21
-
22
- <% attributes.each do |attribute| -%>
23
- <%= attribute.type %> :<%= attribute.name %><% *opts, last_opt = attribute.options.to_a %><%= ', ' if last_opt %><% opts.each do |opt| %><%= opt[0] %>: <%= opt[1] %>, <% end %><% if last_opt %><%= last_opt[0] %>: <%= last_opt[1] %><% end %>
24
- <% end -%>
25
- <% gsis.each do |index| %>
26
- global_secondary_index(
27
- :<%= index.name %>,
28
- hash_key: :<%= index.hash_key -%>,<%- if index.range_key %>
29
- range_key: :<%= index.range_key -%>,<%- end %>
30
- projection: {
31
- projection_type: <%= index.projection_type %>
32
- }
33
- )
34
- <% end -%>
35
- <% if !required_attrs.empty? -%>
36
- validates_presence_of <% *req, last_req = required_attrs -%><% req.each do |required_validation|-%>:<%= required_validation %>, <% end -%>:<%= last_req %>
37
- <% end -%>
38
- <% length_validations.each do |attribute, validation| -%>
39
- validates_length_of :<%= attribute %>, within: <%= validation %>
40
- <% end -%>
41
- <% if options['table_name'] -%>
42
- set_table_name "<%= options['table_name'] %>"
43
- <% end -%>
44
- <% if options.key? :password_digest -%>
45
- has_secure_password
46
- <% end -%>
47
- end
48
- <% end -%>
@@ -1,18 +0,0 @@
1
- require 'aws-record'
2
-
3
- module ModelTableConfig
4
- def self.config
5
- Aws::Record::TableConfig.define do |t|
6
- t.model_class <%= class_name %>
7
-
8
- t.read_capacity_units <%= primary_read_units %>
9
- t.write_capacity_units <%= primary_write_units %>
10
- <%- gsis.each do |index| %>
11
- t.global_secondary_index(:<%= index.name %>) do |i|
12
- i.read_capacity_units <%= gsi_rw_units[index.name][0] %>
13
- i.write_capacity_units <%= gsi_rw_units[index.name][1] %>
14
- end
15
- <%- end -%>
16
- end
17
- end
18
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AwsRecord
4
- module Generators
5
- class SecondaryIndex
6
- PROJ_TYPES = %w[ALL KEYS_ONLY INCLUDE].freeze
7
- attr_reader :name, :hash_key, :range_key, :projection_type
8
-
9
- class << self
10
- def parse(key_definition)
11
- name, index_options = key_definition.split(':')
12
- index_options = index_options.split(',') if index_options
13
- opts = parse_raw_options(index_options)
14
-
15
- new(name, opts)
16
- end
17
-
18
- private
19
-
20
- def parse_raw_options(raw_opts)
21
- raw_opts ||= []
22
- raw_opts.to_h { |opt| get_option_value(opt) }
23
- end
24
-
25
- def get_option_value(raw_option)
26
- case raw_option
27
-
28
- when /hkey\{(\w+)\}/
29
- [:hash_key, ::Regexp.last_match(1)]
30
- when /rkey\{(\w+)\}/
31
- [:range_key, ::Regexp.last_match(1)]
32
- when /proj_type\{(\w+)\}/
33
- [:projection_type, ::Regexp.last_match(1)]
34
- else
35
- raise ArgumentError, "Invalid option for secondary index #{raw_option}"
36
- end
37
- end
38
- end
39
-
40
- def initialize(name, opts)
41
- raise ArgumentError, 'You must provide a name' unless name
42
- raise ArgumentError, 'You must provide a hash key' unless opts[:hash_key]
43
-
44
- if opts.key? :projection_type
45
- unless PROJ_TYPES.include? opts[:projection_type]
46
- raise ArgumentError, "Invalid projection type #{opts[:projection_type]}"
47
- end
48
- if opts[:projection_type] != 'ALL'
49
- raise NotImplementedError, 'ALL is the only projection type currently supported'
50
- end
51
- else
52
- opts[:projection_type] = 'ALL'
53
- end
54
-
55
- if opts[:hash_key] == opts[:range_key]
56
- raise ArgumentError, "#{opts[:hash_key]} cannot be both the rkey and hkey for gsi #{name}"
57
- end
58
-
59
- @name = name
60
- @hash_key = opts[:hash_key]
61
- @range_key = opts[:range_key]
62
- @projection_type = "\"#{opts[:projection_type]}\""
63
- end
64
- end
65
- end
66
- end
@@ -1,13 +0,0 @@
1
- Description:
2
- Generates a migration file for deleting and a creating a DynamoDB
3
- sessions table, and a configuration file for the session store.
4
-
5
- Example:
6
- rails generate dynamo_db:session_store_migration <MIGRATION_NAME>
7
-
8
- This will create:
9
- db/migrate/#{VERSION}_#{MIGRATION_NAME}.rb
10
- config/dynamo_db_session_store.yml
11
-
12
- The migration will be run when the command rake db:migrate is run
13
- in the command line.
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rails/generators/named_base'
4
-
5
- # This class generates a migration file for deleting and creating
6
- # a DynamoDB sessions table.
7
- module DynamoDb
8
- module Generators
9
- # Generates an ActiveRecord migration that creates and deletes a DynamoDB
10
- # Session table.
11
- class SessionStoreMigrationGenerator < Rails::Generators::NamedBase
12
- include Rails::Generators::Migration
13
-
14
- source_root File.expand_path('templates', __dir__)
15
-
16
- # Desired name of migration class
17
- argument :name, type: :string, default: 'create_dynamo_db_sessions_table'
18
-
19
- # @return [Rails Migration File] migration file for creation and deletion
20
- # of a DynamoDB session table.
21
- def generate_migration_file
22
- migration_template(
23
- 'session_store_migration.erb',
24
- "db/migrate/#{name.underscore}.rb"
25
- )
26
- end
27
-
28
- def copy_sample_config_file
29
- template(
30
- 'dynamo_db_session_store.yml',
31
- 'config/dynamo_db_session_store.yml'
32
- )
33
- end
34
-
35
- # Next migration number - must be implemented
36
- def self.next_migration_number(_dir = nil)
37
- Time.now.utc.strftime('%Y%m%d%H%M%S')
38
- end
39
-
40
- private
41
-
42
- # @return [String] activerecord migration version
43
- def migration_version
44
- "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}"
45
- end
46
- end
47
- end
48
- end
@@ -1,70 +0,0 @@
1
- # Uncomment and manipulate the key value pairs below
2
- # in order to configure the DynamoDB Session Store Application.
3
-
4
- # [String] The secret key for HMAC encryption. This defaults to
5
- # `Rails.application.secret_key_base`. You can use a different key if desired.
6
- #
7
- # secret_key: SECRET_KEY
8
-
9
- # [String] Session table name.
10
- #
11
- # table_name: Sessions
12
-
13
- # [String] Session table hash key name.
14
- #
15
- # table_key: session_id
16
-
17
- # [Boolean] Define as true or false depending on if you want a strongly
18
- # consistent read.
19
- # See AWS DynamoDB documentation for table consistent_read for more
20
- # information on this setting.
21
- #
22
- # consistent_read: true
23
-
24
- # [Integer] Maximum number of reads consumed per second before
25
- # DynamoDB returns a ThrottlingException. See AWS DynamoDB documentation
26
- # or table read_capacity for more information on this setting.
27
- #
28
- # read_capacity: 10
29
-
30
- # [Integer] Maximum number of writes consumed per second before
31
- # DynamoDB returns a ThrottlingException. See AWS DynamoDB documentation
32
- # or table write_capacity for more information on this setting.
33
- #
34
- # write_capacity: 5
35
-
36
- # [Boolean] Define as true or false depending on whether you want all errors to be
37
- # raised up the stack.
38
- #
39
- # raise_errors: false
40
-
41
- # [Integer] Maximum number of seconds earlier
42
- # from the current time that a session was created.
43
- # By default this is 7 days.
44
- #
45
- # max_age: 604800
46
-
47
- # [Integer] Maximum number of seconds
48
- # before the current time that the session was last accessed.
49
- # By default this is 5 hours.
50
- #
51
- # max_stale: 18000
52
-
53
- # [Boolean] Define as true or false for whether you want to enable locking
54
- # for all accesses to session data.
55
- #
56
- # enable_locking: false
57
-
58
- # [Integer] Time in milleseconds after which lock will expire.
59
- #
60
- # lock_expiry_time: 500
61
-
62
- # [Integer] Time in milleseconds to wait before retrying to obtain
63
- # lock once an attempt to obtain lock has been made and has failed.
64
- #
65
- # lock_retry_delay: 500
66
-
67
- # [Integer] Maximum time in seconds to wait to acquire lock
68
- # before giving up.
69
- #
70
- # lock_max_wait_time: 1
@@ -1,9 +0,0 @@
1
- class <%= name.camelize %> < ActiveRecord::Migration[<%= migration_version %>]
2
- def up
3
- Aws::SessionStore::DynamoDB::Table.create_table
4
- end
5
-
6
- def down
7
- Aws::SessionStore::DynamoDB::Table.delete_table
8
- end
9
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- desc 'Run all table configs in table_config folder'
4
- namespace :aws_record do
5
- task migrate: :environment do
6
- Dir[File.join('db', 'table_config', '**/*.rb')].each do |filename|
7
- puts "running #{filename}"
8
- require(File.expand_path(filename))
9
-
10
- table_config = ModelTableConfig.config
11
- table_config.migrate! unless table_config.compatible?
12
- end
13
- end
14
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- namespace 'dynamo_db' do
4
- namespace 'session_store' do
5
- desc 'Clean up old sessions in the Amazon DynamoDB session store table.'
6
- task clean: :environment do
7
- Aws::SessionStore::DynamoDB::GarbageCollection.collect_garbage
8
- end
9
- end
10
- end