Class: SDM::Healthcheck

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

Healthcheck defines the status of the link between a node and a resource

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_msg: nil, healthy: nil, id: nil, node_id: nil, node_name: nil, resource_id: nil, resource_name: nil, timestamp: nil) ⇒ Healthcheck

Returns a new instance of Healthcheck.



6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
# File 'lib/models/porcelain.rb', line 6289

def initialize(
  error_msg: nil,
  healthy: nil,
  id: nil,
  node_id: nil,
  node_name: nil,
  resource_id: nil,
  resource_name: nil,
  timestamp: nil
)
  @error_msg = error_msg == nil ? "" : error_msg
  @healthy = healthy == nil ? false : healthy
  @id = id == nil ? "" : id
  @node_id = node_id == nil ? "" : node_id
  @node_name = node_name == nil ? "" : node_name
  @resource_id = resource_id == nil ? "" : resource_id
  @resource_name = resource_name == nil ? "" : resource_name
  @timestamp = timestamp == nil ? nil : timestamp
end

Instance Attribute Details

#error_msgObject

The error if unhealthy



6273
6274
6275
# File 'lib/models/porcelain.rb', line 6273

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.



6275
6276
6277
# File 'lib/models/porcelain.rb', line 6275

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.



6277
6278
6279
# File 'lib/models/porcelain.rb', line 6277

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.



6279
6280
6281
# File 'lib/models/porcelain.rb', line 6279

def node_id
  @node_id
end

#node_nameObject

The name of the node.



6281
6282
6283
# File 'lib/models/porcelain.rb', line 6281

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.



6283
6284
6285
# File 'lib/models/porcelain.rb', line 6283

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.



6285
6286
6287
# File 'lib/models/porcelain.rb', line 6285

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.



6287
6288
6289
# File 'lib/models/porcelain.rb', line 6287

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6309
6310
6311
6312
6313
6314
6315
# File 'lib/models/porcelain.rb', line 6309

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end