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.



9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
# File 'lib/models/porcelain.rb', line 9295

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_msg ⇒ Object

The error if unhealthy



9279
9280
9281
# File 'lib/models/porcelain.rb', line 9279

def error_msg
  @error_msg
end

#healthy ⇒ Object

Whether the healthcheck succeeded.



9281
9282
9283
# File 'lib/models/porcelain.rb', line 9281

def healthy
  @healthy
end

#id ⇒ Object

Unique identifier of the healthcheck.



9283
9284
9285
# File 'lib/models/porcelain.rb', line 9283

def id
  @id
end

#node_id ⇒ Object

Unique identifier of the healthcheck node.



9285
9286
9287
# File 'lib/models/porcelain.rb', line 9285

def node_id
  @node_id
end

#node_name ⇒ Object

The name of the node.



9287
9288
9289
# File 'lib/models/porcelain.rb', line 9287

def node_name
  @node_name
end

#resource_id ⇒ Object

Unique identifier of the healthcheck resource.



9289
9290
9291
# File 'lib/models/porcelain.rb', line 9289

def resource_id
  @resource_id
end

#resource_name ⇒ Object

The name of the resource.



9291
9292
9293
# File 'lib/models/porcelain.rb', line 9291

def resource_name
  @resource_name
end

#timestamp ⇒ Object

The time at which the healthcheck state was recorded.



9293
9294
9295
# File 'lib/models/porcelain.rb', line 9293

def timestamp
  @timestamp
end

Instance Method Details

#to_json(options = {}) ⇒ Object



9315
9316
9317
9318
9319
9320
9321
# File 'lib/models/porcelain.rb', line 9315

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