Add rate limiting to all repp actions

This commit is contained in:
Thiago Youssef 2022-08-02 06:14:47 -03:00 committed by olegphenomenon
parent fb60466194
commit 2a58bf3849
48 changed files with 757 additions and 16 deletions

View file

@ -2,6 +2,9 @@ module Repp
module V1
module Domains
class AdminContactsController < BaseContactsController
THROTTLED_ACTIONS = %i[update].freeze
include Shunter::Integration::Throttle
def update
super

View file

@ -4,6 +4,9 @@ module Repp
class ContactsController < BaseContactsController
before_action :set_domain, only: %i[index create destroy]
THROTTLED_ACTIONS = %i[index create destroy update].freeze
include Shunter::Integration::Throttle
def_param_group :contacts_apidoc do
param :contacts, Array, required: true, desc: 'Array of new linked contacts' do
param :code, String, required: true, desc: 'Contact code'

View file

@ -4,6 +4,9 @@ module Repp
class DnssecController < BaseController
before_action :set_domain, only: %i[index create destroy]
THROTTLED_ACTIONS = %i[index create destroy].freeze
include Shunter::Integration::Throttle
def_param_group :dns_keys_apidoc do
param :flags, String, required: true, desc: '256 (KSK) or 257 (ZSK)'
param :protocol, String, required: true, desc: 'Key protocol (3)'

View file

@ -5,6 +5,9 @@ module Repp
before_action :set_domain, only: %i[index create destroy]
before_action :set_nameserver, only: %i[destroy]
THROTTLED_ACTIONS = %i[index create destroy].freeze
include Shunter::Integration::Throttle
api :GET, '/repp/v1/domains/:domain_name/nameservers'
desc "Get domain's nameservers"
def index

View file

@ -6,6 +6,9 @@ module Repp
before_action :select_renewable_domains, only: [:bulk_renew]
before_action :set_domain, only: [:create]
THROTTLED_ACTIONS = %i[create bulk_renew].freeze
include Shunter::Integration::Throttle
api :POST, 'repp/v1/domains/:domain_name/renew'
desc 'Renew domain'
param :renews, Hash, required: true, desc: 'Renew parameters' do

View file

@ -5,6 +5,9 @@ module Repp
before_action :set_domain, only: %i[update destroy]
before_action :verify_status
THROTTLED_ACTIONS = %i[update destroy].freeze
include Shunter::Integration::Throttle
api :DELETE, '/repp/v1/domains/:domain_name/statuses/:status'
param :domain_name, String, desc: 'Domain name'
desc 'Remove status from specific domain'

View file

@ -4,6 +4,9 @@ module Repp
class TransfersController < BaseController
before_action :set_domain, only: [:create]
THROTTLED_ACTIONS = %i[create].freeze
include Shunter::Integration::Throttle
api :POST, 'repp/v1/domains/:domain_name/transfer'
desc 'Transfer a specific domain'
param :transfer, Hash, required: true, desc: 'Renew parameters' do