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.



6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
# File 'lib/models/porcelain.rb', line 6957

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



6941
6942
6943
# File 'lib/models/porcelain.rb', line 6941

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.



6943
6944
6945
# File 'lib/models/porcelain.rb', line 6943

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.



6945
6946
6947
# File 'lib/models/porcelain.rb', line 6945

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.



6947
6948
6949
# File 'lib/models/porcelain.rb', line 6947

def node_id
  @node_id
end

#node_nameObject

The name of the node.



6949
6950
6951
# File 'lib/models/porcelain.rb', line 6949

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.



6951
6952
6953
# File 'lib/models/porcelain.rb', line 6951

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.



6953
6954
6955
# File 'lib/models/porcelain.rb', line 6953

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.



6955
6956
6957
# File 'lib/models/porcelain.rb', line 6955

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6977
6978
6979
6980
6981
6982
6983
# File 'lib/models/porcelain.rb', line 6977

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