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, tags: nil) ⇒ Relay

Returns a new instance of Relay.



4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
# File 'lib/models/porcelain.rb', line 4750

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

Instance Attribute Details

#idObject

Unique identifier of the Relay.



4740
4741
4742
# File 'lib/models/porcelain.rb', line 4740

def id
  @id
end

#nameObject

Unique human-readable name of the Relay. Node names must include only letters, numbers, and hyphens (no spaces, underscores, or other special characters). Generated if not provided on create.



4742
4743
4744
# File 'lib/models/porcelain.rb', line 4742

def name
  @name
end

#stateObject

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



4746
4747
4748
# File 'lib/models/porcelain.rb', line 4746

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



4748
4749
4750
# File 'lib/models/porcelain.rb', line 4748

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4770
4771
4772
4773
4774
4775
4776
# File 'lib/models/porcelain.rb', line 4770

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