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.



3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
# File 'lib/models/porcelain.rb', line 3801

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.



3794
3795
3796
# File 'lib/models/porcelain.rb', line 3794

def id
  @id
end

#nameObject

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



3796
3797
3798
# File 'lib/models/porcelain.rb', line 3796

def name
  @name
end

#stateObject

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



3799
3800
3801
# File 'lib/models/porcelain.rb', line 3799

def state
  @state
end

Instance Method Details

#to_json(options = {}) ⇒ Object



3817
3818
3819
3820
3821
3822
3823
# File 'lib/models/porcelain.rb', line 3817

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