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.



6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
# File 'lib/models/porcelain.rb', line 6794

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



6778
6779
6780
# File 'lib/models/porcelain.rb', line 6778

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.



6780
6781
6782
# File 'lib/models/porcelain.rb', line 6780

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.



6782
6783
6784
# File 'lib/models/porcelain.rb', line 6782

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.



6784
6785
6786
# File 'lib/models/porcelain.rb', line 6784

def node_id
  @node_id
end

#node_nameObject

The name of the node.



6786
6787
6788
# File 'lib/models/porcelain.rb', line 6786

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.



6788
6789
6790
# File 'lib/models/porcelain.rb', line 6788

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.



6790
6791
6792
# File 'lib/models/porcelain.rb', line 6790

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.



6792
6793
6794
# File 'lib/models/porcelain.rb', line 6792

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6814
6815
6816
6817
6818
6819
6820
# File 'lib/models/porcelain.rb', line 6814

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