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.



5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
# File 'lib/models/porcelain.rb', line 5992

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



5976
5977
5978
# File 'lib/models/porcelain.rb', line 5976

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.



5978
5979
5980
# File 'lib/models/porcelain.rb', line 5978

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.



5980
5981
5982
# File 'lib/models/porcelain.rb', line 5980

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.



5982
5983
5984
# File 'lib/models/porcelain.rb', line 5982

def node_id
  @node_id
end

#node_nameObject

The name of the node.



5984
5985
5986
# File 'lib/models/porcelain.rb', line 5984

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.



5986
5987
5988
# File 'lib/models/porcelain.rb', line 5986

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.



5988
5989
5990
# File 'lib/models/porcelain.rb', line 5988

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.



5990
5991
5992
# File 'lib/models/porcelain.rb', line 5990

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6012
6013
6014
6015
6016
6017
6018
# File 'lib/models/porcelain.rb', line 6012

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