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.



6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
# File 'lib/models/porcelain.rb', line 6426

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



6410
6411
6412
# File 'lib/models/porcelain.rb', line 6410

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.



6412
6413
6414
# File 'lib/models/porcelain.rb', line 6412

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.



6414
6415
6416
# File 'lib/models/porcelain.rb', line 6414

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.



6416
6417
6418
# File 'lib/models/porcelain.rb', line 6416

def node_id
  @node_id
end

#node_nameObject

The name of the node.



6418
6419
6420
# File 'lib/models/porcelain.rb', line 6418

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.



6420
6421
6422
# File 'lib/models/porcelain.rb', line 6420

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.



6422
6423
6424
# File 'lib/models/porcelain.rb', line 6422

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.



6424
6425
6426
# File 'lib/models/porcelain.rb', line 6424

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6446
6447
6448
6449
6450
6451
6452
# File 'lib/models/porcelain.rb', line 6446

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