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

Returns a new instance of Relay.



5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
# File 'lib/models/porcelain.rb', line 5746

def initialize(
  id: nil,
  name: nil,
  state: nil,
  tags: nil,
  gateway_filter: 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
  if gateway_filter != nil
    @gateway_filter = gateway_filter
  end
end

Instance Attribute Details

#gateway_filterObject

GatewayFilter can be used to restrict the peering between relays and gateways.



5744
5745
5746
# File 'lib/models/porcelain.rb', line 5744

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Relay.



5733
5734
5735
# File 'lib/models/porcelain.rb', line 5733

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.



5735
5736
5737
# File 'lib/models/porcelain.rb', line 5735

def name
  @name
end

#stateObject

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



5739
5740
5741
# File 'lib/models/porcelain.rb', line 5739

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



5741
5742
5743
# File 'lib/models/porcelain.rb', line 5741

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5770
5771
5772
5773
5774
5775
5776
# File 'lib/models/porcelain.rb', line 5770

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