Class: MistApi::StatsMxedgeServiceStat

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/stats_mxedge_service_stat.rb

Overview

StatsMxedgeServiceStat Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(ext_ip = SKIP, last_seen = SKIP, package_state = SKIP, package_version = SKIP, running_state = SKIP, uptime = SKIP) ⇒ StatsMxedgeServiceStat

Returns a new instance of StatsMxedgeServiceStat.



68
69
70
71
72
73
74
75
76
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 68

def initialize(ext_ip = SKIP, last_seen = SKIP, package_state = SKIP,
               package_version = SKIP, running_state = SKIP, uptime = SKIP)
  @ext_ip = ext_ip unless ext_ip == SKIP
  @last_seen = last_seen unless last_seen == SKIP
  @package_state = package_state unless package_state == SKIP
  @package_version = package_version unless package_version == SKIP
  @running_state = running_state unless running_state == SKIP
  @uptime = uptime unless uptime == SKIP
end

Instance Attribute Details

#ext_ipString

External IP from ep-terminator’s point of view. valid only for service having its own cloud connection

Returns:

  • (String)


15
16
17
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 15

def ext_ip
  @ext_ip
end

#last_seenFloat

Timestamp when the last stats is seen (cloud unix time, in second). valid only for service having its own stats or whole system (last among last_seen of all services)

Returns:

  • (Float)


21
22
23
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 21

def last_seen
  @last_seen
end

#package_stateString

Package/service installation state.

Returns:

  • (String)


25
26
27
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 25

def package_state
  @package_state
end

#package_versionString

Package/service installation state.

Returns:

  • (String)


29
30
31
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 29

def package_version
  @package_version
end

#running_stateString

Service running state.

Returns:

  • (String)


33
34
35
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 33

def running_state
  @running_state
end

#uptimeInteger

Service uptime.

Returns:

  • (Integer)


37
38
39
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 37

def uptime
  @uptime
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ext_ip = hash.key?('ext_ip') ? hash['ext_ip'] : SKIP
  last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP
  package_state = hash.key?('package_state') ? hash['package_state'] : SKIP
  package_version =
    hash.key?('package_version') ? hash['package_version'] : SKIP
  running_state = hash.key?('running_state') ? hash['running_state'] : SKIP
  uptime = hash.key?('uptime') ? hash['uptime'] : SKIP

  # Create object from extracted values.
  StatsMxedgeServiceStat.new(ext_ip,
                             last_seen,
                             package_state,
                             package_version,
                             running_state,
                             uptime)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ext_ip'] = 'ext_ip'
  @_hash['last_seen'] = 'last_seen'
  @_hash['package_state'] = 'package_state'
  @_hash['package_version'] = 'package_version'
  @_hash['running_state'] = 'running_state'
  @_hash['uptime'] = 'uptime'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
61
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 52

def self.optionals
  %w[
    ext_ip
    last_seen
    package_state
    package_version
    running_state
    uptime
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 109

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ext_ip: #{@ext_ip.inspect}, last_seen: #{@last_seen.inspect},"\
  " package_state: #{@package_state.inspect}, package_version: #{@package_version.inspect},"\
  " running_state: #{@running_state.inspect}, uptime: #{@uptime.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
106
# File 'lib/mist_api/models/stats_mxedge_service_stat.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ext_ip: #{@ext_ip}, last_seen: #{@last_seen}, package_state:"\
  " #{@package_state}, package_version: #{@package_version}, running_state: #{@running_state},"\
  " uptime: #{@uptime}>"
end