module Devops
  module API3
    module Routes
      module ProjectRoutes

        def self.registered(app)

          # * *Request*
          #   - method : POST
          #   Checks if given autoscaling group is launched within stack that is handled by CID.
          #   If so, starts syncing that stack. Otherwise returns 404 error.
          #
          # * *Returns* :
          #   task_id
          app.post_with_headers '/provider_notifications/aws/:provider_account/autoscaling_groups/:id/changes' do |provider_account, group_id|
            check_privileges("stack", "r")
            json Devops::API3::Handler::Provider::ProviderNotification.new(request).autoscaling_groups_change(group_id, provider_account)
          end

          puts "ProviderNotifications routes initialized"
        end

      end
    end
  end
end

