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(device: nil, gateway_filter: nil, id: nil, location: nil, name: nil, state: nil, tags: nil, version: nil) ⇒ Relay

Returns a new instance of Relay.



6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
# File 'lib/models/porcelain.rb', line 6526

def initialize(
  device: nil,
  gateway_filter: nil,
  id: nil,
  location: nil,
  name: nil,
  state: nil,
  tags: nil,
  version: nil
)
  @device = device == nil ? "" : device
  @gateway_filter = gateway_filter == nil ? "" : gateway_filter
  @id = id == nil ? "" : id
  @location = location == nil ? "" : location
  @name = name == nil ? "" : name
  @state = state == nil ? "" : state
  @tags = tags == nil ? SDM::_porcelain_zero_value_tags() : tags
  @version = version == nil ? "" : version
end

Instance Attribute Details

#deviceObject

Device is a read only device name uploaded by the gateway process when it comes online.



6505
6506
6507
# File 'lib/models/porcelain.rb', line 6505

def device
  @device
end

#gateway_filterObject

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



6508
6509
6510
# File 'lib/models/porcelain.rb', line 6508

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Relay.



6510
6511
6512
# File 'lib/models/porcelain.rb', line 6510

def id
  @id
end

#locationObject

Location is a read only network location uploaded by the gateway process when it comes online.



6513
6514
6515
# File 'lib/models/porcelain.rb', line 6513

def location
  @location
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.



6515
6516
6517
# File 'lib/models/porcelain.rb', line 6515

def name
  @name
end

#stateObject

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



6519
6520
6521
# File 'lib/models/porcelain.rb', line 6519

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



6521
6522
6523
# File 'lib/models/porcelain.rb', line 6521

def tags
  @tags
end

#versionObject

Version is a read only sdm binary version uploaded by the gateway process when it comes online.



6524
6525
6526
# File 'lib/models/porcelain.rb', line 6524

def version
  @version
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6546
6547
6548
6549
6550
6551
6552
# File 'lib/models/porcelain.rb', line 6546

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