Class: MiqAeMethodService::MiqAeServiceHost

Inherits:
MiqAeServiceModelBase show all
Includes:
MiqAeServiceCustomAttributeMixin
Defined in:
lib/miq_automation_engine/service_models/miq_ae_service_host.rb

Constant Summary collapse

METHODS_WITH_NO_ARGS =
%w(scan)

Constants inherited from MiqAeServiceModelBase

MiqAeMethodService::MiqAeServiceModelBase::DELIMS, MiqAeMethodService::MiqAeServiceModelBase::EXPOSED_ATTR_BLACK_LIST, MiqAeMethodService::MiqAeServiceModelBase::SERVICE_MODEL_GLOB, MiqAeMethodService::MiqAeServiceModelBase::SERVICE_MODEL_PATH, MiqAeMethodService::MiqAeServiceModelBase::UNWISE

Instance Method Summary collapse

Methods inherited from MiqAeServiceModelBase

ar_base_model, ar_method, #ar_method, association, association=, associations, #associations, base_class, base_model, inherited, #initialize, #inspect, #inspect_all, method_missing, #method_missing, model_name_from_active_record_model, model_name_from_file, #model_suffix, normalize, #object_class, #object_send, #reload, respond_to_missing?, service_models, #tag_assign, #tag_unassign, #taggable?, taggable?, #tagged_with?, #tags, #virtual_column_names, #virtual_columns_inspect, wrap_results, #wrap_results

Methods included from Vmdb::Logging

#_log

Methods included from MiqAeServiceObjectCommon

#[], #[]=, #attributes, #attributes=, #class_name, #current_field_name, #current_field_type, #current_message, #decrypt, #id, #instance_name, #name, #namespace, #parent

Constructor Details

This class inherits a constructor from MiqAeMethodService::MiqAeServiceModelBase

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MiqAeMethodService::MiqAeServiceModelBase

Instance Method Details

#credentials(type = :remote) ⇒ Object


50
51
52
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 50

def credentials(type = :remote)
  object_send(:auth_user_pwd, type)
end

#current_cpu_usageObject


91
92
93
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 91

def current_cpu_usage
  object_send(:current_cpu_usage)
end

#current_memory_headroomObject


95
96
97
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 95

def current_memory_headroom
  object_send(:current_memory_headroom)
end

#current_memory_usageObject


87
88
89
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 87

def current_memory_usage
  object_send(:current_memory_usage)
end

#ems_custom_get(key) ⇒ Object


60
61
62
63
64
65
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 60

def ems_custom_get(key)
  ar_method do
    c1 = @object.ems_custom_attributes.find_by(:name => key.to_s)
    c1.try(:value)
  end
end

#ems_custom_keysObject


54
55
56
57
58
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 54

def ems_custom_keys
  ar_method do
    @object.ems_custom_attributes.collect(&:name)
  end
end

#ems_custom_set(attribute, value) ⇒ Object


67
68
69
70
71
72
73
74
75
76
77
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 67

def ems_custom_set(attribute, value)
  MiqQueue.put(
    :class_name  => @object.class.name,
    :instance_id => @object.id,
    :method_name => 'set_custom_field',
    :zone        => @object.my_zone,
    :role        => 'ems_operations',
    :args        => [attribute, value]
  ) if @object.is_vmware?
  true
end

#get_realtime_metric(metric, range, function) ⇒ Object


83
84
85
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 83

def get_realtime_metric(metric, range, function)
  object_send(:get_performance_metric, :realtime, metric, range, function)
end

#ssh_exec(script) ⇒ Object


79
80
81
# File 'lib/miq_automation_engine/service_models/miq_ae_service_host.rb', line 79

def ssh_exec(script)
  object_send(:ssh_run_script, script)
end