Class: SDM::Relay

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

Relay represents a StrongDM CLI installation running in relay mode.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, name: nil, state: nil) ⇒ Relay

Returns a new instance of Relay.



4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
# File 'lib/models/porcelain.rb', line 4346

def initialize(
	id:nil \
,
	name:nil \
,
	state:nil \
)
	if id != nil
		@id = id
	end
	if name != nil
		@name = name
	end
	if state != nil
		@state = state
	end
end

Instance Attribute Details

#idObject

Unique identifier of the Relay.



4340
4341
4342
# File 'lib/models/porcelain.rb', line 4340

def id
  @id
end

#nameObject

Unique human-readable name of the Relay. Generated if not provided on create.



4342
4343
4344
# File 'lib/models/porcelain.rb', line 4342

def name
  @name
end

#stateObject

The current state of the relay. One of: “new”, “verifying_restart”, “restarting”, “started”, “stopped”, “dead”, “unknown”,



4345
4346
4347
# File 'lib/models/porcelain.rb', line 4345

def state
  @state
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4363
4364
4365
4366
4367
4368
4369
# File 'lib/models/porcelain.rb', line 4363

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