Class: PlanMyStuff::Webhooks::AwsController

Inherits:
ActionController::API
  • Object
show all
Defined in:
app/controllers/plan_my_stuff/webhooks/aws_controller.rb

Constant Summary collapse

VALID_SNS_MESSAGE_TYPES =
%w[Notification].freeze

Instance Method Summary collapse

Instance Method Details

#createObject

POST /webhooks/aws



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/plan_my_stuff/webhooks/aws_controller.rb', line 11

def create
  config = PlanMyStuff.configuration

  unless config.process_aws_webhooks
    head(:ok)

    return
  end

  unless matching_service?(config.aws_service_identifier)
    head(:ok)

    return
  end

  case sns_message_params.dig(:detail, :event_name)
  when 'SERVICE_DEPLOYMENT_COMPLETED'
    handle_deployment_completed
  end

  head(:ok)
end