Class: Seira::Pods

Inherits:
Object
  • Object
show all
Includes:
Commands
Defined in:
lib/seira/pods.rb

Constant Summary collapse

VALID_ACTIONS =
%w[help list delete logs top run connect].freeze
SUMMARY =
"Manage your application's pods.".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Commands

#gcloud, gcloud, kubectl, #kubectl, #tsh, tsh

Constructor Details

#initialize(app:, action:, args:, context:) ⇒ Pods

Returns a new instance of Pods.



12
13
14
15
16
17
18
# File 'lib/seira/pods.rb', line 12

def initialize(app:, action:, args:, context:)
  @app = app
  @action = action
  @context = context
  @args = args
  @pod_name = args[0]
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



10
11
12
# File 'lib/seira/pods.rb', line 10

def action
  @action
end

#appObject (readonly)

Returns the value of attribute app.



10
11
12
# File 'lib/seira/pods.rb', line 10

def app
  @app
end

#argsObject (readonly)

Returns the value of attribute args.



10
11
12
# File 'lib/seira/pods.rb', line 10

def args
  @args
end

#contextObject (readonly)

Returns the value of attribute context.



10
11
12
# File 'lib/seira/pods.rb', line 10

def context
  @context
end

#pod_nameObject (readonly)

Returns the value of attribute pod_name.



10
11
12
# File 'lib/seira/pods.rb', line 10

def pod_name
  @pod_name
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/seira/pods.rb', line 20

def run
  case action
  when 'help'
    run_help
  when 'list'
    run_list
  when 'delete'
    run_delete
  when 'logs'
    run_logs
  when 'top'
    run_top
  when 'connect'
    run_connect
  else
    fail "Unknown command encountered"
  end
end