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.



8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
# File 'lib/models/porcelain.rb', line 8982

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



8966
8967
8968
# File 'lib/models/porcelain.rb', line 8966

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.



8968
8969
8970
# File 'lib/models/porcelain.rb', line 8968

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.



8970
8971
8972
# File 'lib/models/porcelain.rb', line 8970

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.



8972
8973
8974
# File 'lib/models/porcelain.rb', line 8972

def node_id
  @node_id
end

#node_nameObject

The name of the node.



8974
8975
8976
# File 'lib/models/porcelain.rb', line 8974

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.



8976
8977
8978
# File 'lib/models/porcelain.rb', line 8976

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.



8978
8979
8980
# File 'lib/models/porcelain.rb', line 8978

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.



8980
8981
8982
# File 'lib/models/porcelain.rb', line 8980

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



9002
9003
9004
9005
9006
9007
9008
# File 'lib/models/porcelain.rb', line 9002

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