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.



6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
# File 'lib/models/porcelain.rb', line 6647

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



6631
6632
6633
# File 'lib/models/porcelain.rb', line 6631

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.



6633
6634
6635
# File 'lib/models/porcelain.rb', line 6633

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.



6635
6636
6637
# File 'lib/models/porcelain.rb', line 6635

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.



6637
6638
6639
# File 'lib/models/porcelain.rb', line 6637

def node_id
  @node_id
end

#node_nameObject

The name of the node.



6639
6640
6641
# File 'lib/models/porcelain.rb', line 6639

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.



6641
6642
6643
# File 'lib/models/porcelain.rb', line 6641

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.



6643
6644
6645
# File 'lib/models/porcelain.rb', line 6643

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.



6645
6646
6647
# File 'lib/models/porcelain.rb', line 6645

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6667
6668
6669
6670
6671
6672
6673
# File 'lib/models/porcelain.rb', line 6667

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