Class: Nucleon::Action::Cloud::Inspect

Inherits:
Object
  • Object
show all
Includes:
Mixin::Action::Registration
Defined in:
lib/nucleon/action/cloud/inspect.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.describeObject


Info



12
13
14
# File 'lib/nucleon/action/cloud/inspect.rb', line 12

def self.describe
  super(:cloud, :inspect, 950)
end

Instance Method Details

#argumentsObject




30
31
32
# File 'lib/nucleon/action/cloud/inspect.rb', line 30

def arguments
  [ :elements ]
end

#configureObject


Settings



19
20
21
22
23
24
25
26
# File 'lib/nucleon/action/cloud/inspect.rb', line 19

def configure
  super do
    codes :configuration_parse_failed
    
    register_array :elements
    register_translator :format, :json
  end
end

#executeObject


Operations



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/nucleon/action/cloud/inspect.rb', line 37

def execute
  super do |node, network|
    ensure_network(network) do
      if settings[:elements].empty?
        data = network.config.export
      else
        data = network.config.get(settings[:elements])
      end
      if network.config.status == code.success
        render data, :format => settings[:format]
      else
        myself.status = code.configuration_parse_failed
      end
    end
  end
end