Class: ElasticDynamoDb::Cli
- Inherits:
-
Thor
- Object
- Thor
- ElasticDynamoDb::Cli
- Includes:
- CloudWatch, Thor::Actions
- Defined in:
- lib/elasticDynamoDb/cli.rb
Defined Under Namespace
Modules: CloudWatch
Instance Attribute Summary collapse
-
#automated_reason ⇒ Object
Returns the value of attribute automated_reason.
-
#backup_folder ⇒ Object
Returns the value of attribute backup_folder.
-
#config ⇒ Object
Returns the value of attribute config.
-
#config_file_name ⇒ Object
Returns the value of attribute config_file_name.
-
#cw ⇒ Object
Returns the value of attribute cw.
-
#ddb ⇒ Object
Returns the value of attribute ddb.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#original_config_file ⇒ Object
Returns the value of attribute original_config_file.
-
#restore_in_progress ⇒ Object
Returns the value of attribute restore_in_progress.
-
#skip_cloudwatch ⇒ Object
Returns the value of attribute skip_cloudwatch.
Instance Method Summary collapse
Methods included from CloudWatch
#put_metric_alarm, #set_cloudwatch_alarms, #set_default_options
Instance Attribute Details
#automated_reason ⇒ Object
Returns the value of attribute automated_reason.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def automated_reason @automated_reason end |
#backup_folder ⇒ Object
Returns the value of attribute backup_folder.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def backup_folder @backup_folder end |
#config ⇒ Object
Returns the value of attribute config.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def config @config end |
#config_file_name ⇒ Object
Returns the value of attribute config_file_name.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def config_file_name @config_file_name end |
#cw ⇒ Object
Returns the value of attribute cw.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def cw @cw end |
#ddb ⇒ Object
Returns the value of attribute ddb.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def ddb @ddb end |
#log_file ⇒ Object
Returns the value of attribute log_file.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def log_file @log_file end |
#original_config_file ⇒ Object
Returns the value of attribute original_config_file.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def original_config_file @original_config_file end |
#restore_in_progress ⇒ Object
Returns the value of attribute restore_in_progress.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def restore_in_progress @restore_in_progress end |
#skip_cloudwatch ⇒ Object
Returns the value of attribute skip_cloudwatch.
15 16 17 |
# File 'lib/elasticDynamoDb/cli.rb', line 15 def skip_cloudwatch @skip_cloudwatch end |
Instance Method Details
#onDemand ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/elasticDynamoDb/cli.rb', line 28 def onDemand raise Thor::RequiredArgumentMissingError, 'You must supply a scale factor' if [:factor].nil? raise Thor::RequiredArgumentMissingError, 'You must supply the path to the dynamic-dyanmodb config file' if [:config_file].nil? init aws_init if [:start_timer] say "Auto pilot will start in #{[:start_timer]} minutes (#{Time.now + [:start_timer] * 60})" self.automated_reason = ask("\nType the reason for the change: ", color = :magenta) say "Waiting here for #{[:start_timer]} minutes to start fully automated" sleep [:start_timer] * 60 end process_config([:config_file], [:factor]) if [:schedule_restore] > 0 && !restore_in_progress say("#{Time.now} - Waiting here for #{[:schedule_restore]} minutes until restore") sleep [:schedule_restore] * 60 self.restore_in_progress = true say "#{Time.now} - Restoring to original config file (#{self.original_config_file})" process_config(self.original_config_file, 1) end unless [:start_cmd] || [:stop_cmd] say "All done! you may restart the dynamic-dynamodb process manually", color = :white end end |
#version ⇒ Object
59 60 61 |
# File 'lib/elasticDynamoDb/cli.rb', line 59 def version say ElasticDynamoDb::ABOUT end |