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.



8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
# File 'lib/models/porcelain.rb', line 8476

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



8460
8461
8462
# File 'lib/models/porcelain.rb', line 8460

def error_msg
  @error_msg
end

#healthyObject

Whether the healthcheck succeeded.



8462
8463
8464
# File 'lib/models/porcelain.rb', line 8462

def healthy
  @healthy
end

#idObject

Unique identifier of the healthcheck.



8464
8465
8466
# File 'lib/models/porcelain.rb', line 8464

def id
  @id
end

#node_idObject

Unique identifier of the healthcheck node.



8466
8467
8468
# File 'lib/models/porcelain.rb', line 8466

def node_id
  @node_id
end

#node_nameObject

The name of the node.



8468
8469
8470
# File 'lib/models/porcelain.rb', line 8468

def node_name
  @node_name
end

#resource_idObject

Unique identifier of the healthcheck resource.



8470
8471
8472
# File 'lib/models/porcelain.rb', line 8470

def resource_id
  @resource_id
end

#resource_nameObject

The name of the resource.



8472
8473
8474
# File 'lib/models/porcelain.rb', line 8472

def resource_name
  @resource_name
end

#timestampObject

The time at which the healthcheck state was recorded.



8474
8475
8476
# File 'lib/models/porcelain.rb', line 8474

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



8496
8497
8498
8499
8500
8501
8502
# File 'lib/models/porcelain.rb', line 8496

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