Class: Proxy::Monitoring::Api
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Proxy::Monitoring::Api
- Extended by:
- DependencyInjection
- Includes:
- Log
- Defined in:
- lib/smart_proxy_monitoring/monitoring_api.rb
Instance Method Summary collapse
Methods included from DependencyInjection
Instance Method Details
#log_provider_errors ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/smart_proxy_monitoring/monitoring_api.rb', line 85 def log_provider_errors yield rescue Proxy::Monitoring::NotFound => e log_halt 404, e rescue Proxy::Monitoring::ConnectionError => e log_halt 503, e rescue Proxy::Monitoring::AuthenticationError => e log_halt 500, e rescue Exception => e log_halt 400, e end |
#strip_domain(name) ⇒ Object
101 102 103 104 105 |
# File 'lib/smart_proxy_monitoring/monitoring_api.rb', line 101 def strip_domain(name) domain = Proxy::Monitoring::Plugin.settings.strip_domain name.slice!(domain) unless domain.nil? name end |
#validate_dns_name!(name) ⇒ Object
97 98 99 |
# File 'lib/smart_proxy_monitoring/monitoring_api.rb', line 97 def validate_dns_name!(name) raise Proxy::Monitoring::Error, "Invalid DNS name #{name}" unless /^([a-zA-Z0-9]([-a-zA-Z0-9]+)?\.?)+$/.match?(name) end |