Class: Aws::SiteMonitor::CLI
- Inherits:
-
Thor
- Object
- Thor
- Aws::SiteMonitor::CLI
- Defined in:
- lib/aws/site_monitor/cli.rb
Instance Method Summary collapse
- #add ⇒ Object
- #clear_events ⇒ Object
- #list_events ⇒ Object
- #ls ⇒ Object
- #remove ⇒ Object
- #start ⇒ Object
Instance Method Details
#add ⇒ Object
24 25 26 27 |
# File 'lib/aws/site_monitor/cli.rb', line 24 def add site = ::Aws::SiteMonitor::Site.create(:url => .url, :instance_ids => .instance_ids) puts "added #{[:url]} to watchlist" end |
#clear_events ⇒ Object
52 53 54 |
# File 'lib/aws/site_monitor/cli.rb', line 52 def clear_events ::Aws::SiteMonitor::Event.all.map(&:destroy) end |
#list_events ⇒ Object
46 47 48 49 |
# File 'lib/aws/site_monitor/cli.rb', line 46 def list_events events = ::Aws::SiteMonitor::Event.all.map(&:attributes).join("\n") puts events.inspect end |
#ls ⇒ Object
40 41 42 43 |
# File 'lib/aws/site_monitor/cli.rb', line 40 def ls sites = ::Aws::SiteMonitor::Site.all.map(&:attributes).join("\n") puts sites.inspect end |
#remove ⇒ Object
31 32 33 34 35 36 |
# File 'lib/aws/site_monitor/cli.rb', line 31 def remove site = ::Aws::SiteMonitor::Site.find_by(:url => .url) raise ::StandardError.new("SiteNotFound #{.url}") if !site site.destroy puts "removed #{site[:url]} from watchlist" end |
#start ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/aws/site_monitor/cli.rb', line 11 def start configure! start_monitoring! sleep rescue => e puts "ERROR #{e.}" start_monitoring! end |