Class: MistApi::UtilsServicePing

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

Overview

UtilsServicePing 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(host = nil, service = nil, count = 10, node = SKIP, size = 56, tenant = SKIP, additional_properties = nil) ⇒ UtilsServicePing

Returns a new instance of UtilsServicePing.



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/mist_api/models/utils_service_ping.rb', line 63

def initialize(host = nil, service = nil, count = 10, node = SKIP,
               size = 56, tenant = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @count = count unless count == SKIP
  @host = host
  @node = node unless node == SKIP
  @service = service
  @size = size unless size == SKIP
  @tenant = tenant unless tenant == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/mist_api/models/utils_service_ping.rb', line 14

def count
  @count
end

#hostString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/mist_api/models/utils_service_ping.rb', line 18

def host
  @host
end

#nodeHaClusterNodeEnum

only for HA. enum: ‘node0`, `node1`

Returns:



22
23
24
# File 'lib/mist_api/models/utils_service_ping.rb', line 22

def node
  @node
end

#serviceString

Ping packet takes the same path as the service

Returns:

  • (String)


26
27
28
# File 'lib/mist_api/models/utils_service_ping.rb', line 26

def service
  @service
end

#sizeInteger

Ping packet takes the same path as the service

Returns:

  • (Integer)


30
31
32
# File 'lib/mist_api/models/utils_service_ping.rb', line 30

def size
  @size
end

#tenantString

Tenant context in which the packet is sent

Returns:

  • (String)


34
35
36
# File 'lib/mist_api/models/utils_service_ping.rb', line 34

def tenant
  @tenant
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/mist_api/models/utils_service_ping.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  host = hash.key?('host') ? hash['host'] : nil
  service = hash.key?('service') ? hash['service'] : nil
  count = hash['count'] ||= 10
  node = hash.key?('node') ? hash['node'] : SKIP
  size = hash['size'] ||= 56
  tenant = hash.key?('tenant') ? hash['tenant'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UtilsServicePing.new(host,
                       service,
                       count,
                       node,
                       size,
                       tenant,
                       additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/mist_api/models/utils_service_ping.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['count'] = 'count'
  @_hash['host'] = 'host'
  @_hash['node'] = 'node'
  @_hash['service'] = 'service'
  @_hash['size'] = 'size'
  @_hash['tenant'] = 'tenant'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/mist_api/models/utils_service_ping.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
# File 'lib/mist_api/models/utils_service_ping.rb', line 49

def self.optionals
  %w[
    count
    node
    size
    tenant
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



114
115
116
117
118
119
# File 'lib/mist_api/models/utils_service_ping.rb', line 114

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} count: #{@count.inspect}, host: #{@host.inspect}, node: #{@node.inspect},"\
  " service: #{@service.inspect}, size: #{@size.inspect}, tenant: #{@tenant.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
# File 'lib/mist_api/models/utils_service_ping.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} count: #{@count}, host: #{@host}, node: #{@node}, service: #{@service},"\
  " size: #{@size}, tenant: #{@tenant}, additional_properties: #{@additional_properties}>"
end