Class: Jets::CLI::Maintenance::Mode
- Inherits:
-
Base
- Object
- Base
- Base
- Jets::CLI::Maintenance::Mode
show all
- Defined in:
- lib/jets/cli/maintenance/mode.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods inherited from Base
#initialize
#truthy?
#check_deployed!, #check_workers!, #workers_deployed?
Methods inherited from Base
#initialize, #paginate, #paging_params, rescue_api_error
#log
#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2
#output_value, #stack_exists?
included, #reset_cache!
Methods included from Api
#api, #api_key
Instance Method Details
#are_you_sure? ⇒ Boolean
25
26
27
|
# File 'lib/jets/cli/maintenance/mode.rb', line 25
def are_you_sure?
sure?("Will enable #{role_info} maintenance mode #{for_info}")
end
|
#for_info ⇒ Object
33
34
35
|
# File 'lib/jets/cli/maintenance/mode.rb', line 33
def for_info
"for #{Jets.project.namespace}"
end
|
#off ⇒ Object
9
10
11
12
|
# File 'lib/jets/cli/maintenance/mode.rb', line 9
def off
warn "Disabling #{role_info} maintenance mode #{for_info}"
role.off
end
|
#on ⇒ Object
3
4
5
6
7
|
# File 'lib/jets/cli/maintenance/mode.rb', line 3
def on
are_you_sure?
warn "Enabling #{role_info} maintenance mode #{for_info}"
role.on
end
|
#role ⇒ Object
37
38
39
40
41
|
# File 'lib/jets/cli/maintenance/mode.rb', line 37
def role
klass = Jets::CLI::Maintenance.const_get(@options[:role].camelize)
klass.new(@options)
end
|
#role_info ⇒ Object
29
30
31
|
# File 'lib/jets/cli/maintenance/mode.rb', line 29
def role_info
@options[:role]
end
|
#status ⇒ Object
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/jets/cli/maintenance/mode.rb', line 14
def status
if @options[:all]
warn "Maintenance status for #{Jets.project.namespace}"
puts "web #{Web.new.status}"
puts "worker #{Worker.new.status}"
else
warn "#{role_info.titleize} maintenance status #{for_info}"
puts role.status
end
end
|