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.



4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
# File 'lib/models/porcelain.rb', line 4824

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.



4814
4815
4816
# File 'lib/models/porcelain.rb', line 4814

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.



4816
4817
4818
# File 'lib/models/porcelain.rb', line 4816

def name
  @name
end

#stateObject

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



4820
4821
4822
# File 'lib/models/porcelain.rb', line 4820

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



4822
4823
4824
# File 'lib/models/porcelain.rb', line 4822

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4844
4845
4846
4847
4848
4849
4850
# File 'lib/models/porcelain.rb', line 4844

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