Class: HibernateCli
- Inherits:
-
Object
- Object
- HibernateCli
- Defined in:
- lib/hibernate/hibernate_cli.rb
Class Method Summary collapse
- .create_ec2_rule_command(options) ⇒ Object
- .create_lambda_function ⇒ Object
- .handle_rule_subcommand(subcmd, options) ⇒ Object
- .list_ec2_rule_command(options) ⇒ Object
- .remove_ec2_rule_command(options) ⇒ Object
- .setup_profile(profile) ⇒ Object
- .update_ec2_rule_command(options) ⇒ Object
Class Method Details
.create_ec2_rule_command(options) ⇒ Object
23 24 25 26 27 |
# File 'lib/hibernate/hibernate_cli.rb', line 23 def self.create_ec2_rule_command() (, i[instance_name], 'create') ec2_manager = EC2Manager.new([:instance_name]) ec2_manager.create_event_rule([:start], [:stop]) end |
.create_lambda_function ⇒ Object
6 7 8 |
# File 'lib/hibernate/hibernate_cli.rb', line 6 def self.create_lambda_function LambdaSetup.new.run end |
.handle_rule_subcommand(subcmd, options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hibernate/hibernate_cli.rb', line 10 def self.handle_rule_subcommand(subcmd, ) case subcmd when 'create' create_ec2_rule_command() when 'list' list_ec2_rule_command() when 'update' update_ec2_rule_command() when 'remove' remove_ec2_rule_command() end end |
.list_ec2_rule_command(options) ⇒ Object
29 30 31 32 |
# File 'lib/hibernate/hibernate_cli.rb', line 29 def self.list_ec2_rule_command() ec2_manager = EC2Manager.new([:instance_name]) ec2_manager.list_event_rules() end |
.remove_ec2_rule_command(options) ⇒ Object
45 46 47 48 49 |
# File 'lib/hibernate/hibernate_cli.rb', line 45 def self.remove_ec2_rule_command() (, [:rule], 'remove') ec2_manager = EC2Manager.new([:instance_name]) ec2_manager.remove_event_rule([:rule]) end |
.setup_profile(profile) ⇒ Object
2 3 4 |
# File 'lib/hibernate/hibernate_cli.rb', line 2 def self.setup_profile(profile) ENV['AWS_PROFILE'] = profile end |
.update_ec2_rule_command(options) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/hibernate/hibernate_cli.rb', line 34 def self.update_ec2_rule_command() (, i[rule], 'update') ec2_manager = EC2Manager.new([:instance_name]) ec2_manager.update_event_rule( rule_name: [:rule], start_cron: [:start], stop_cron: [:stop], state: [:state] ) end |