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.


6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
# File 'lib/models/porcelain.rb', line 6866

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


6850
6851
6852
# File 'lib/models/porcelain.rb', line 6850

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.


6852
6853
6854
# File 'lib/models/porcelain.rb', line 6852

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.


6854
6855
6856
# File 'lib/models/porcelain.rb', line 6854

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.


6856
6857
6858
# File 'lib/models/porcelain.rb', line 6856

def node_id
  @node_id
end

#node_nameObject

The name of the node.


6858
6859
6860
# File 'lib/models/porcelain.rb', line 6858

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.


6860
6861
6862
# File 'lib/models/porcelain.rb', line 6860

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.


6862
6863
6864
# File 'lib/models/porcelain.rb', line 6862

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.


6864
6865
6866
# File 'lib/models/porcelain.rb', line 6864

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object


6886
6887
6888
6889
6890
6891
6892
# File 'lib/models/porcelain.rb', line 6886

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