Sha256: 5425dc5e92eb69b65c06c776b73a853a7b30e4d76d4a438f28606190c5b2241b

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

module Nucleon
module Action
module Cloud
class Inspect < CORL.plugin_class(:nucleon, :cloud_action)
  
  include Mixin::Action::Registration
  
  #-----------------------------------------------------------------------------
  # Info
  
  def self.describe
    super(:cloud, :inspect, 950)
  end
 
  #-----------------------------------------------------------------------------
  # Settings
 
  def configure
    super do
      codes :configuration_parse_failed
      
      register_array :elements
      register_translator :format, :json
    end
  end
  
  #---
   
  def arguments
    [ :elements ]
  end
  
  #-----------------------------------------------------------------------------
  # Operations
   
  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
end
end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
corl-0.5.1 lib/nucleon/action/cloud/inspect.rb