Class: Dsc::HostDetailCommand
- Defined in:
- lib/dsc/host_detail_command.rb
Overview
This class defines the arguments, options and implementation for the host_detail command/subcommand.
Fields flag collapse
-
.default_fields ⇒ Array<String>
Default fields if no argument is given.
Command definitions collapse
-
.define_commands(command_context) ⇒ void
Define all commands for this available for this (sub) command_context.
-
.define_list_command(command_context) {|list_command| ... } ⇒ void
Define
listcommand_context.
Command Implementations collapse
-
#list_command(options, args) ⇒ void
listImplementation.
Class Method Summary collapse
-
.transport_class ⇒ DeepSecurity::HostDetail
DeepSecurity object covered by this class.
Methods inherited from Command
#api_version_command, #authenticate, command_symbol, #connect, default_fields_string, define_api_version_command, define_debug_flag, define_detail_level_flag, define_fields_flag, define_global_flags, define_manager_flag, define_manager_time_command, define_misc_commands, define_outfile_flag, define_password_flag, define_port_flag, define_progress_bar_option, define_schema_command, define_tenant_flag, define_time_filter_flag, define_time_format_flag, define_username_flag, #initialize, #manager_time_command, #output, #parse_debug_level, #parse_detail_level, #parse_fields, #parse_time_filter, #parse_time_format, schema, #schema_command, #to_display_string, transport_class_name, transport_class_string, valid_debug_levels, valid_debug_levels_string, valid_detail_levels, valid_detail_levels_string, valid_fields, valid_fields_string, valid_time_filters, valid_time_filters_string
Constructor Details
This class inherits a constructor from Dsc::Command
Class Method Details
.default_fields ⇒ Array<String>
Default fields if no argument is given
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/dsc/host_detail_command.rb', line 18 def self.default_fields [ # DNS name of system :name, # fully qualified of system :display_name, # signature / pattern version currently in use :anti_malware_classic_pattern_version, :anti_malware_engine_version, :anti_malware_intelli_trap_exception_version, :anti_malware_intelli_trap_version, :anti_malware_smart_scan_pattern_version, :anti_malware_spyware_pattern_version, # Last datetime the system was active/online :overall_last_successful_communication, # OS version :platform, :host_type, # system domain or system group :host_group_name, # last/currently logged on account ] end |
.define_commands(command_context) ⇒ void
This method returns an undefined value.
Define all commands for this available for this (sub) command_context
54 55 56 57 58 59 60 |
# File 'lib/dsc/host_detail_command.rb', line 54 def self.define_commands(command_context) command_context.desc "Access #{transport_class_string()}s" command_context.command command_symbol do |host_detail_command| define_list_command(host_detail_command) define_schema_command(host_detail_command) end end |
.define_list_command(command_context) {|list_command| ... } ⇒ void
This method returns an undefined value.
Define list command_context
67 68 69 70 71 72 |
# File 'lib/dsc/host_detail_command.rb', line 67 def self.define_list_command(command_context) super(command_context) do |list_command| define_detail_level_flag(list_command) define_time_format_flag(list_command) end end |
.transport_class ⇒ DeepSecurity::HostDetail
DeepSecurity object covered by this class.
10 11 12 |
# File 'lib/dsc/host_detail_command.rb', line 10 def self.transport_class DeepSecurity::HostDetail end |
Instance Method Details
#list_command(options, args) ⇒ void
This method returns an undefined value.
list Implementation.
List all entries of the transport_class type according to given filter parameters.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/dsc/host_detail_command.rb', line 85 def list_command(, args) fields = parse_fields([:fields]) detail_level = parse_detail_level([:detail_level]) parse_time_format([:time_format]) output do |output| authenticate do |manager| hostFilter = DeepSecurity::HostFilter.all_hosts progressBar = ProgressBar.new("host_status", 100) if @show_progress_bar hostDetails = manager.host_details(hostFilter, detail_level) progressBar.set(25) if @show_progress_bar csv = CSV.new(output) csv << fields hostDetails.each do |hostDetail| progressBar.inc(75/hostDetails.size) if @show_progress_bar csv << fields.map do |attribute| begin to_display_string(hostDetail.instance_eval(attribute)) rescue => e "ERROR (#{e.})" end end end progressBar.finish if @show_progress_bar end end end |