aws-sdk-rails 3.12.0 → 4.0.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
  SHA256:
3
- metadata.gz: 4db4f6778275cb1b836119e1d593fa7d9ebc2e629bbe4818685fdc36dffa286f
4
- data.tar.gz: 567aed0fd65308e3e1ab9df0875d2d5d3dbbe2b2228d4756dbc55edbf84e481e
3
+ metadata.gz: b049c425aa7e6e931f2000ee7a1d999883f38e0b2c1ab683e4400f1cfce24943
4
+ data.tar.gz: 5c75936fee984e6501c57658beadc693f4d1da476e1ffca643656186571db808
5
5
  SHA512:
6
- metadata.gz: 56b130425e1fcd11fd2cbcb41a8bc0159c02cc2ae821a8c95cd8553cfb3bfb63492cffaed8205e2cbd142272eb5ee6351e31a143ec12259c2ac226f511f0aec4
7
- data.tar.gz: e5db0e0c8a1e955a12ca48e57e6d2d64f4758a083cb2d9a28eec4b7c45ef6eed5084543f63b2f4714cd5ca797a16c160172fab0e61b201119205a3eef7e95a79
6
+ metadata.gz: 70a58af6bae86fef62664154d3df0ea67e2b9787642eeb97d67d9683d2512d6733b057e275593fea91ee7463a9d4a36c415be3de994302d95e9eeeee8ee815ce
7
+ data.tar.gz: 23215067c409ec282e6991eea22e308e42e968a062b19590ebb296b770bd8ea141b891b6af2f15b89f6ad63c5f72d503b3648dc117940b966358e8a91e4981c3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.12.0
1
+ 4.0.0
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aws/rails/action_mailbox/sns_notification'
4
+
5
+ module ActionMailbox
6
+ module Ingresses
7
+ module Ses
8
+ # Ingests inbound emails from Amazon SES/SNS and confirms subscriptions.
9
+ #
10
+ # Subscription requests must provide the following parameters in a JSON body:
11
+ # - +Message+: Notification content
12
+ # - +MessagId+: Notification unique identifier
13
+ # - +Timestamp+: iso8601 timestamp
14
+ # - +TopicArn+: Topic identifier
15
+ # - +Type+: Type of event ("Subscription")
16
+ #
17
+ # Inbound email events must provide the following parameters in a JSON body:
18
+ # - +Message+: Notification content
19
+ # - +MessagId+: Notification unique identifier
20
+ # - +Timestamp+: iso8601 timestamp
21
+ # - +SubscribeURL+: Topic identifier
22
+ # - +TopicArn+: Topic identifier
23
+ # - +Type+: Type of event ("SubscriptionConfirmation")
24
+ #
25
+ # All requests are authenticated by validating the provided AWS signature.
26
+ #
27
+ # Returns:
28
+ #
29
+ # - <tt>204 No Content</tt> if a request is successfully processed
30
+ # - <tt>401 Unauthorized</tt> if a request does not contain a valid signature
31
+ # - <tt>404 Not Found</tt> if the Amazon ingress has not been configured
32
+ # - <tt>422 Unprocessable Entity</tt> if a request provides invalid parameters
33
+ class InboundEmailsController < ActionMailbox::BaseController
34
+ before_action :verify_authenticity, :validate_topic, :confirm_subscription
35
+
36
+ def create
37
+ head :bad_request unless notification.message_content.present?
38
+
39
+ ActionMailbox::InboundEmail.create_and_extract_message_id!(notification.message_content)
40
+ head :no_content
41
+ end
42
+
43
+ private
44
+
45
+ def verify_authenticity
46
+ head :bad_request unless notification.present?
47
+ head :unauthorized unless notification.verified?
48
+ end
49
+
50
+ def confirm_subscription
51
+ return unless notification.type == 'SubscriptionConfirmation'
52
+ return head :ok if notification.subscription_confirmed?
53
+
54
+ Rails.logger.error('SNS subscription confirmation request rejected.')
55
+ head :unprocessable_entity
56
+ end
57
+
58
+ def validate_topic
59
+ return if valid_topic == notification.topic
60
+
61
+ Rails.logger.warn("Ignoring unknown topic: #{topic}")
62
+ head :unauthorized
63
+ end
64
+
65
+ def notification
66
+ @notification ||= Aws::Rails::ActionMailbox::SnsNotification.new(request.raw_post)
67
+ end
68
+
69
+ def topic
70
+ @topic ||= notification.topic
71
+ end
72
+
73
+ def valid_topic
74
+ ::Rails.configuration.action_mailbox.ses.subscribed_topic
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ scope '/rails/action_mailbox', module: 'action_mailbox/ingresses' do
5
+ post '/ses/inbound_emails' => 'ses/inbound_emails#create',
6
+ as: :rails_ses_inbound_emails
7
+ end
8
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ActiveJob
4
4
  module QueueAdapters
5
- class AmazonSqsAdapter
5
+ class SqsAdapter
6
6
  # == build request parameter of Aws::SQS::Client
7
7
  class Params
8
8
  class << self
@@ -4,7 +4,12 @@ require 'aws-sdk-sqs'
4
4
 
5
5
  module ActiveJob
6
6
  module QueueAdapters
7
- class AmazonSqsAdapter
7
+ # Set in rails config via config.active_job.queue_adapter = :sqs to use the SQS adapter
8
+ class SqsAdapter
9
+ def enqueue_after_transaction_commit?
10
+ true
11
+ end
12
+
8
13
  def enqueue(job)
9
14
  _enqueue(job)
10
15
  end
@@ -49,9 +54,5 @@ module ActiveJob
49
54
  Aws::Rails::SqsActiveJob.config.client.send_message(send_message_opts)
50
55
  end
51
56
  end
52
-
53
- # create an alias to allow `:amazon` to be used as the adapter name
54
- # `:amazon` is the convention used for ActionMailer and ActiveStorage
55
- AmazonAdapter = AmazonSqsAdapter
56
57
  end
57
58
  end
@@ -12,21 +12,21 @@ module ActiveJob
12
12
  #
13
13
  # To use this adapter, set up as:
14
14
  #
15
- # config.active_job.queue_adapter = :amazon_sqs_async
16
- class AmazonSqsAsyncAdapter < AmazonSqsAdapter
15
+ # config.active_job.queue_adapter = :sqs_async
16
+ class SqsAsyncAdapter < SqsAdapter
17
17
  private
18
18
 
19
19
  def _enqueue(job, body = nil, send_message_opts = {})
20
20
  # FIFO jobs must be queued in order, so do not queue async
21
21
  queue_url = Aws::Rails::SqsActiveJob.config.queue_url_for(job.queue_name)
22
22
  if Aws::Rails::SqsActiveJob.fifo?(queue_url)
23
- super(job, body, send_message_opts)
23
+ super
24
24
  else
25
25
  # Serialize is called here because the job’s locale needs to be
26
26
  # determined in this thread and not in some other thread.
27
27
  body = job.serialize
28
28
  Concurrent::Promises
29
- .future { super(job, body, send_message_opts) }
29
+ .future { super }
30
30
  .rescue do |e|
31
31
  Rails.logger.error "Failed to queue job #{job}. Reason: #{e}"
32
32
  error_handler = Aws::Rails::SqsActiveJob.config.async_queue_error_handler
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ module Rails
5
+ module ActionMailbox
6
+ # @api private
7
+ class Engine < ::Rails::Engine
8
+ config.action_mailbox.ses = ActiveSupport::OrderedOptions.new
9
+ config.action_mailbox.ses.s3_client_options ||= {}
10
+
11
+ initializer 'aws-sdk-rails.mount_engine' do |app|
12
+ app.routes.append do
13
+ mount Engine => '/'
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ module Rails
5
+ module ActionMailbox
6
+ module RSpec
7
+ # @api private
8
+ class Email
9
+ def initialize(authentic: true, topic: 'topic:arn:default', mail: default_mail, message_params: {})
10
+ @authentic = authentic
11
+ @topic = topic
12
+ @mail = mail
13
+ @message_params = message_params
14
+ end
15
+
16
+ def headers
17
+ { 'content-type' => 'application/json' }
18
+ end
19
+
20
+ def url
21
+ '/rails/action_mailbox/ses/inbound_emails'
22
+ end
23
+
24
+ def params
25
+ {
26
+ 'Type' => 'Notification',
27
+ 'TopicArn' => @topic,
28
+ 'Message' => message_json
29
+ }
30
+ end
31
+
32
+ def message_json
33
+ {
34
+ 'notificationType' => 'Received',
35
+ 'content' => @mail.encoded
36
+ }.merge(@message_params).to_json
37
+ end
38
+
39
+ def authentic?
40
+ @authentic
41
+ end
42
+
43
+ def default_mail
44
+ Mail.new
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ module Rails
5
+ module ActionMailbox
6
+ module RSpec
7
+ # @api private
8
+ class SubscriptionConfirmation
9
+ def initialize(authentic: true, topic: 'topic:arn:default')
10
+ @authentic = authentic
11
+ @topic = topic
12
+ end
13
+
14
+ def url
15
+ '/rails/action_mailbox/ses/inbound_emails'
16
+ end
17
+
18
+ def headers
19
+ { 'content-type' => 'application/json' }
20
+ end
21
+
22
+ def params
23
+ {
24
+ 'Type' => 'SubscriptionConfirmation',
25
+ 'TopicArn' => @topic,
26
+ 'SubscribeURL' => 'http://example.com/subscribe'
27
+ }
28
+ end
29
+
30
+ def authentic?
31
+ @authentic
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aws/rails/action_mailbox/rspec/email'
4
+ require 'aws/rails/action_mailbox/rspec/subscription_confirmation'
5
+ require 'aws-sdk-sns'
6
+ require 'aws/rails/action_mailbox/sns_message_verifier'
7
+
8
+ module Aws
9
+ module Rails
10
+ module ActionMailbox
11
+ # Include the `Aws::Rails::ActionMailbox::RSpec` extension in your tests, like so:
12
+ # require 'aws/rails/action_mailbox/rspec'
13
+ # RSpec.configure do |config|
14
+ # config.include Aws::Rails::ActionMailbox::RSpec
15
+ # end
16
+ # Then, in a request spec, use like so:
17
+ # RSpec.describe 'amazon emails', type: :request do
18
+ # it 'delivers a subscription notification' do
19
+ # action_mailbox_ses_deliver_subscription_confirmation
20
+ # expect(response).to have_http_status :ok
21
+ # end
22
+
23
+ # it 'delivers an email notification' do
24
+ # action_mailbox_ses_deliver_email(mail: Mail.new(to: 'user@example.com'))
25
+ # expect(ActionMailbox::InboundEmail.last.mail.recipients).to eql ['user@example.com']
26
+ # end
27
+ # end
28
+ module RSpec
29
+ def action_mailbox_ses_deliver_subscription_confirmation(options = {})
30
+ subscription_confirmation = SubscriptionConfirmation.new(**options)
31
+ stub_aws_sns_message_verifier(subscription_confirmation)
32
+ stub_aws_sns_subscription_request
33
+
34
+ post subscription_confirmation.url,
35
+ params: subscription_confirmation.params,
36
+ headers: subscription_confirmation.headers,
37
+ as: :json
38
+ end
39
+
40
+ def action_mailbox_ses_deliver_email(options = {})
41
+ email = Email.new(**options)
42
+ stub_aws_sns_message_verifier(email)
43
+
44
+ post email.url,
45
+ params: email.params,
46
+ headers: email.headers,
47
+ as: :json
48
+ end
49
+
50
+ private
51
+
52
+ def message_verifier(subscription_confirmation)
53
+ instance_double(Aws::SNS::MessageVerifier, authentic?: subscription_confirmation.authentic?)
54
+ end
55
+
56
+ def stub_aws_sns_message_verifier(notification)
57
+ allow(Aws::Rails::ActionMailbox::SnsMessageVerifier).to receive(:verifier) { message_verifier(notification) }
58
+ end
59
+
60
+ def stub_aws_sns_subscription_request
61
+ allow(Net::HTTP).to receive(:get_response).and_call_original
62
+ allow(Net::HTTP)
63
+ .to receive(:get_response)
64
+ .with(URI('http://example.com/subscribe')) { double(code: '200') }
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aws-sdk-s3'
4
+
5
+ module Aws
6
+ module Rails
7
+ module ActionMailbox
8
+ # @api private
9
+ class S3Client
10
+ class << self
11
+ def client
12
+ @client ||= build_client
13
+ end
14
+
15
+ private
16
+
17
+ def build_client
18
+ client = Aws::S3::Client.new(
19
+ **::Rails.configuration.action_mailbox.ses.s3_client_options
20
+ )
21
+ client.config.user_agent_frameworks << 'aws-sdk-rails'
22
+ client
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aws-sdk-sns'
4
+
5
+ module Aws
6
+ module Rails
7
+ module ActionMailbox
8
+ # @api private
9
+ class SnsMessageVerifier
10
+ class << self
11
+ def verifier
12
+ @verifier ||= Aws::SNS::MessageVerifier.new
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aws-sdk-sns'
4
+ require 'aws/rails/action_mailbox/s3_client'
5
+ require 'aws/rails/action_mailbox/sns_message_verifier'
6
+
7
+ module Aws
8
+ module Rails
9
+ module ActionMailbox
10
+ # @api private
11
+ class SnsNotification
12
+ class MessageContentError < StandardError; end
13
+
14
+ def initialize(request_body)
15
+ @request_body = request_body
16
+ end
17
+
18
+ def subscription_confirmed?
19
+ (200..299).cover?(confirmation_response.code.to_i)
20
+ end
21
+
22
+ def verified?
23
+ SnsMessageVerifier.verifier.authentic?(@request_body)
24
+ end
25
+
26
+ def topic
27
+ notification.fetch(:TopicArn)
28
+ end
29
+
30
+ def type
31
+ notification.fetch(:Type)
32
+ end
33
+
34
+ def message_content
35
+ raise MessageContentError, 'Incoming emails must have notificationType `Received`' unless receipt?
36
+
37
+ if content_in_s3?
38
+ s3_content
39
+ else
40
+ return message[:content] unless destination
41
+
42
+ "X-Original-To: #{destination}\n#{message[:content]}"
43
+ end
44
+ end
45
+
46
+ private
47
+
48
+ def notification
49
+ @notification ||= JSON.parse(@request_body, symbolize_names: true)
50
+ rescue JSON::ParserError => e
51
+ Rails.logger.warn("Unable to parse SNS notification: #{e}")
52
+ nil
53
+ end
54
+
55
+ def s3_content
56
+ S3Client
57
+ .client
58
+ .get_object(key: key, bucket: bucket)
59
+ .body
60
+ .string
61
+ end
62
+
63
+ def message
64
+ @message ||= JSON.parse(notification[:Message], symbolize_names: true)
65
+ end
66
+
67
+ def destination
68
+ message.dig(:mail, :destination)&.first
69
+ end
70
+
71
+ def action
72
+ return unless message[:receipt]
73
+
74
+ message.fetch(:receipt).fetch(:action)
75
+ end
76
+
77
+ def bucket
78
+ action.fetch(:bucketName)
79
+ end
80
+
81
+ def key
82
+ action.fetch(:objectKey)
83
+ end
84
+
85
+ def content_in_s3?
86
+ action&.fetch(:type) == 'S3'
87
+ end
88
+
89
+ def receipt?
90
+ message.fetch(:notificationType) == 'Received'
91
+ end
92
+
93
+ def confirmation_response
94
+ @confirmation_response ||= Net::HTTP.get_response(URI(notification[:SubscribeURL]))
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
@@ -9,7 +9,7 @@ module Aws
9
9
  before: :load_config_initializers do
10
10
  # Initialization Actions
11
11
  Aws::Rails.use_rails_encrypted_credentials
12
- Aws::Rails.add_action_mailer_delivery_method
12
+ Aws::Rails.add_action_mailer_delivery_method(:ses)
13
13
  Aws::Rails.add_action_mailer_delivery_method(:sesv2)
14
14
  Aws::Rails.log_to_rails_logger
15
15
  end
@@ -25,18 +25,22 @@ module Aws
25
25
  end
26
26
 
27
27
  # This is called automatically from the SDK's Railtie, but can be manually
28
- # called if you want to specify options for building the Aws::SES::Client.
28
+ # called if you want to specify options for building the Aws::SES::Client or
29
+ # Aws::SESV2::Client.
29
30
  #
30
31
  # @param [Symbol] name The name of the ActionMailer delivery method to
31
- # register.
32
+ # register, either :ses or :sesv2.
32
33
  # @param [Hash] client_options The options you wish to pass on to the
33
34
  # Aws::SES[V2]::Client initialization method.
34
- def self.add_action_mailer_delivery_method(name = :ses, client_options = {})
35
+ def self.add_action_mailer_delivery_method(name, client_options = {})
35
36
  ActiveSupport.on_load(:action_mailer) do
36
- if name == :sesv2
37
+ case name
38
+ when :ses
39
+ add_delivery_method(name, Aws::Rails::SesMailer, client_options)
40
+ when :sesv2
37
41
  add_delivery_method(name, Aws::Rails::Sesv2Mailer, client_options)
38
42
  else
39
- add_delivery_method(name, Aws::Rails::SesMailer, client_options)
43
+ raise ArgumentError, "Unknown action mailer delivery method: #{name}"
40
44
  end
41
45
  end
42
46
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Aws
4
4
  module Rails
5
+ # Configuration for AWS SQS ActiveJob.
5
6
  module SqsActiveJob
6
7
  # @return [Configuration] the (singleton) Configuration
7
8
  def self.config
@@ -17,7 +18,6 @@ module Aws
17
18
  queue_url.ends_with? '.fifo'
18
19
  end
19
20
 
20
- # Configuration for AWS SQS ActiveJob.
21
21
  # Use +Aws::Rails::SqsActiveJob.config+ to access the singleton config instance.
22
22
  class Configuration
23
23
  # Default configuration options
@@ -90,7 +90,7 @@ module Aws
90
90
  # @option options [Callable] :async_queue_error_handler An error handler
91
91
  # to be called when the async active job adapter experiances an error
92
92
  # queueing a job. Only applies when
93
- # +active_job.queue_adapter = :amazon_sqs_async+. Called with:
93
+ # +active_job.queue_adapter = :sqs_async+. Called with:
94
94
  # [error, job, job_options]
95
95
  #
96
96
  # @option options [SQS::Client] :client SQS Client to use. A default
@@ -186,13 +186,11 @@ module Aws
186
186
 
187
187
  # Avoid incompatible changes with Psych 4.0.0
188
188
  # https://bugs.ruby-lang.org/issues/17866
189
- # rubocop:disable Security/YAMLLoad
190
189
  begin
191
- YAML.load(source, aliases: true) || {}
190
+ YAML.safe_load(source, aliases: true) || {}
192
191
  rescue ArgumentError
193
- YAML.load(source) || {}
192
+ YAML.safe_load(source) || {}
194
193
  end
195
- # rubocop:enable Security/YAMLLoad
196
194
  end
197
195
  end
198
196
  end
@@ -9,20 +9,44 @@ module Aws
9
9
  class Executor
10
10
  DEFAULTS = {
11
11
  min_threads: 0,
12
- max_threads: Concurrent.processor_count,
12
+ max_threads: Integer(Concurrent.available_processor_count || Concurrent.processor_count),
13
13
  auto_terminate: true,
14
14
  idletime: 60, # 1 minute
15
- fallback_policy: :caller_runs # slow down the producer thread
16
- # TODO: Consider catching the exception and sleeping instead of using :caller_runs
15
+ fallback_policy: :abort # Concurrent::RejectedExecutionError must be handled
17
16
  }.freeze
18
17
 
19
18
  def initialize(options = {})
20
19
  @executor = Concurrent::ThreadPoolExecutor.new(DEFAULTS.merge(options))
21
20
  @retry_standard_errors = options[:retry_standard_errors]
22
21
  @logger = options[:logger] || ActiveSupport::Logger.new($stdout)
22
+ @task_complete = Concurrent::Event.new
23
23
  end
24
24
 
25
25
  def execute(message)
26
+ post_task(message)
27
+ rescue Concurrent::RejectedExecutionError
28
+ # no capacity, wait for a task to complete
29
+ @task_complete.reset
30
+ @task_complete.wait
31
+ retry
32
+ end
33
+
34
+ def shutdown(timeout = nil)
35
+ @executor.shutdown
36
+ clean_shutdown = @executor.wait_for_termination(timeout)
37
+ if clean_shutdown
38
+ @logger.info 'Clean shutdown complete. All executing jobs finished.'
39
+ else
40
+ @logger.info "Timeout (#{timeout}) exceeded. Some jobs may not have " \
41
+ 'finished cleanly. Unfinished jobs will not be removed from ' \
42
+ 'the queue and can be ru-run once their visibility timeout ' \
43
+ 'passes.'
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ def post_task(message)
26
50
  @executor.post(message) do |message|
27
51
  job = JobRunner.new(message)
28
52
  @logger.info("Running job: #{job.id}[#{job.class_name}]")
@@ -43,19 +67,8 @@ module Aws
43
67
  else
44
68
  message.delete
45
69
  end
46
- end
47
- end
48
-
49
- def shutdown(timeout = nil)
50
- @executor.shutdown
51
- clean_shutdown = @executor.wait_for_termination(timeout)
52
- if clean_shutdown
53
- @logger.info 'Clean shutdown complete. All executing jobs finished.'
54
- else
55
- @logger.info "Timeout (#{timeout}) exceeded. Some jobs may not have " \
56
- 'finished cleanly. Unfinished jobs will not be removed from ' \
57
- 'the queue and can be ru-run once their visibility timeout ' \
58
- 'passes.'
70
+ ensure
71
+ @task_complete.set
59
72
  end
60
73
  end
61
74
  end
@@ -3,6 +3,7 @@
3
3
  module Aws
4
4
  module Rails
5
5
  module SqsActiveJob
6
+ # @api private
6
7
  class JobRunner
7
8
  attr_reader :id, :class_name
8
9
 
@@ -4,11 +4,11 @@ require 'aws-sdk-sqs'
4
4
 
5
5
  module Aws
6
6
  module Rails
7
+ # A lambda event handler to run jobs from an SQS queue trigger
8
+ # Trigger the lambda from your SQS queue
9
+ # Configure the entrypoint to: +config/environment.Aws::Rails::SqsActiveJob.lambda_job_handler+
10
+ # This will load your Rails environment, and then use this method as the handler.
7
11
  module SqsActiveJob
8
- # A lambda event handler to run jobs from an SQS queue trigger
9
- # Trigger the lambda from your SQS queue
10
- # Configure the entrypoint to: +config/environment.Aws::Rails::SqsActiveJob.lambda_job_handler+
11
- # This will load your Rails environment, and then use this method as the handler.
12
12
  def self.lambda_job_handler(event:, context:)
13
13
  return 'no records to process' unless event['Records']
14
14
 
data/lib/aws-sdk-rails.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require_relative 'aws/rails/ses_mailer'
4
4
  require_relative 'aws/rails/sesv2_mailer'
5
5
  require_relative 'aws/rails/railtie'
6
+ require_relative 'aws/rails/action_mailbox/engine'
6
7
  require_relative 'aws/rails/notifications'
7
8
  require_relative 'aws/rails/sqs_active_job/configuration'
8
9
  require_relative 'aws/rails/sqs_active_job/deduplication'
@@ -12,9 +13,9 @@ require_relative 'aws/rails/sqs_active_job/lambda_handler'
12
13
  require_relative 'aws/rails/middleware/ebs_sqs_active_job_middleware'
13
14
 
14
15
  require_relative 'action_dispatch/session/dynamodb_store'
15
- require_relative 'active_job/queue_adapters/amazon_sqs_adapter'
16
- require_relative 'active_job/queue_adapters/amazon_sqs_adapter/params'
17
- require_relative 'active_job/queue_adapters/amazon_sqs_async_adapter'
16
+ require_relative 'active_job/queue_adapters/sqs_adapter'
17
+ require_relative 'active_job/queue_adapters/sqs_adapter/params'
18
+ require_relative 'active_job/queue_adapters/sqs_async_adapter'
18
19
 
19
20
  require_relative 'generators/aws_record/base'
20
21
 
@@ -141,9 +141,9 @@ module AwsRecord
141
141
 
142
142
  @primary_read_units, @primary_write_units = parse_rw_units('primary')
143
143
 
144
- @gsi_rw_units = @gsis.map do |idx|
144
+ @gsi_rw_units = @gsis.to_h do |idx|
145
145
  [idx.name, parse_rw_units(idx.name)]
146
- end.to_h
146
+ end
147
147
 
148
148
  options['table_config'].each_key do |config|
149
149
  next if config == 'primary'
@@ -54,7 +54,7 @@ module AwsRecord
54
54
 
55
55
  def parse_type_and_options(name, type, opts)
56
56
  opts ||= []
57
- [parse_type(name, type), opts.map { |opt| parse_option(name, opt) }.to_h]
57
+ [parse_type(name, type), opts.to_h { |opt| parse_option(name, opt) }]
58
58
  end
59
59
 
60
60
  def parse_option(name, opt)
@@ -19,7 +19,7 @@ module AwsRecord
19
19
 
20
20
  def parse_raw_options(raw_opts)
21
21
  raw_opts ||= []
22
- raw_opts.map { |opt| get_option_value(opt) }.to_h
22
+ raw_opts.to_h { |opt| get_option_value(opt) }
23
23
  end
24
24
 
25
25
  def get_option_value(raw_option)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-02 00:00:00.000000000 Z
11
+ date: 2024-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-record
@@ -24,6 +24,26 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk-s3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.123.0
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.123.0
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: aws-sdk-ses
29
49
  requirement: !ruby/object:Gem::Requirement
@@ -64,6 +84,26 @@ dependencies:
64
84
  - - ">="
65
85
  - !ruby/object:Gem::Version
66
86
  version: 1.34.0
87
+ - !ruby/object:Gem::Dependency
88
+ name: aws-sdk-sns
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
93
+ version: '1'
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 1.61.0
97
+ type: :runtime
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 1.61.0
67
107
  - !ruby/object:Gem::Dependency
68
108
  name: aws-sdk-sqs
69
109
  requirement: !ruby/object:Gem::Requirement
@@ -85,61 +125,61 @@ dependencies:
85
125
  - !ruby/object:Gem::Version
86
126
  version: 1.56.0
87
127
  - !ruby/object:Gem::Dependency
88
- name: aws-sessionstore-dynamodb
128
+ name: actionmailbox
89
129
  requirement: !ruby/object:Gem::Requirement
90
130
  requirements:
91
- - - "~>"
131
+ - - ">="
92
132
  - !ruby/object:Gem::Version
93
- version: '2'
133
+ version: 7.0.0
94
134
  type: :runtime
95
135
  prerelease: false
96
136
  version_requirements: !ruby/object:Gem::Requirement
97
137
  requirements:
98
- - - "~>"
138
+ - - ">="
99
139
  - !ruby/object:Gem::Version
100
- version: '2'
140
+ version: 7.0.0
101
141
  - !ruby/object:Gem::Dependency
102
- name: concurrent-ruby
142
+ name: aws-sessionstore-dynamodb
103
143
  requirement: !ruby/object:Gem::Requirement
104
144
  requirements:
105
145
  - - "~>"
106
146
  - !ruby/object:Gem::Version
107
- version: '1'
147
+ version: '2'
108
148
  type: :runtime
109
149
  prerelease: false
110
150
  version_requirements: !ruby/object:Gem::Requirement
111
151
  requirements:
112
152
  - - "~>"
113
153
  - !ruby/object:Gem::Version
114
- version: '1'
154
+ version: '2'
115
155
  - !ruby/object:Gem::Dependency
116
- name: railties
156
+ name: concurrent-ruby
117
157
  requirement: !ruby/object:Gem::Requirement
118
158
  requirements:
119
159
  - - ">="
120
160
  - !ruby/object:Gem::Version
121
- version: 5.2.0
161
+ version: 1.3.1
122
162
  type: :runtime
123
163
  prerelease: false
124
164
  version_requirements: !ruby/object:Gem::Requirement
125
165
  requirements:
126
166
  - - ">="
127
167
  - !ruby/object:Gem::Version
128
- version: 5.2.0
168
+ version: 1.3.1
129
169
  - !ruby/object:Gem::Dependency
130
- name: rails
170
+ name: railties
131
171
  requirement: !ruby/object:Gem::Requirement
132
172
  requirements:
133
173
  - - ">="
134
174
  - !ruby/object:Gem::Version
135
- version: '0'
136
- type: :development
175
+ version: 7.0.0
176
+ type: :runtime
137
177
  prerelease: false
138
178
  version_requirements: !ruby/object:Gem::Requirement
139
179
  requirements:
140
180
  - - ">="
141
181
  - !ruby/object:Gem::Version
142
- version: '0'
182
+ version: 7.0.0
143
183
  description: Integrates the AWS Ruby SDK with Ruby on Rails
144
184
  email:
145
185
  - aws-dr-rubygems@amazon.com
@@ -149,12 +189,21 @@ extensions: []
149
189
  extra_rdoc_files: []
150
190
  files:
151
191
  - VERSION
192
+ - app/controllers/action_mailbox/ingresses/ses/inbound_emails_controller.rb
152
193
  - bin/aws_sqs_active_job
194
+ - config/routes.rb
153
195
  - lib/action_dispatch/session/dynamodb_store.rb
154
- - lib/active_job/queue_adapters/amazon_sqs_adapter.rb
155
- - lib/active_job/queue_adapters/amazon_sqs_adapter/params.rb
156
- - lib/active_job/queue_adapters/amazon_sqs_async_adapter.rb
196
+ - lib/active_job/queue_adapters/sqs_adapter.rb
197
+ - lib/active_job/queue_adapters/sqs_adapter/params.rb
198
+ - lib/active_job/queue_adapters/sqs_async_adapter.rb
157
199
  - lib/aws-sdk-rails.rb
200
+ - lib/aws/rails/action_mailbox/engine.rb
201
+ - lib/aws/rails/action_mailbox/rspec.rb
202
+ - lib/aws/rails/action_mailbox/rspec/email.rb
203
+ - lib/aws/rails/action_mailbox/rspec/subscription_confirmation.rb
204
+ - lib/aws/rails/action_mailbox/s3_client.rb
205
+ - lib/aws/rails/action_mailbox/sns_message_verifier.rb
206
+ - lib/aws/rails/action_mailbox/sns_notification.rb
158
207
  - lib/aws/rails/middleware/ebs_sqs_active_job_middleware.rb
159
208
  - lib/aws/rails/notifications.rb
160
209
  - lib/aws/rails/railtie.rb
@@ -191,14 +240,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
191
240
  requirements:
192
241
  - - ">="
193
242
  - !ruby/object:Gem::Version
194
- version: '2.5'
243
+ version: '2.7'
195
244
  required_rubygems_version: !ruby/object:Gem::Requirement
196
245
  requirements:
197
246
  - - ">="
198
247
  - !ruby/object:Gem::Version
199
248
  version: '0'
200
249
  requirements: []
201
- rubygems_version: 3.4.22
250
+ rubygems_version: 3.5.5
202
251
  signing_key:
203
252
  specification_version: 4
204
253
  summary: AWS SDK for Ruby on Rails Plugin