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.



5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
# File 'lib/models/porcelain.rb', line 5397

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.



5376
5377
5378
# File 'lib/models/porcelain.rb', line 5376

def device
  @device
end

#gateway_filterObject

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



5379
5380
5381
# File 'lib/models/porcelain.rb', line 5379

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Relay.



5381
5382
5383
# File 'lib/models/porcelain.rb', line 5381

def id
  @id
end

#locationObject

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



5384
5385
5386
# File 'lib/models/porcelain.rb', line 5384

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.



5386
5387
5388
# File 'lib/models/porcelain.rb', line 5386

def name
  @name
end

#stateObject

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



5390
5391
5392
# File 'lib/models/porcelain.rb', line 5390

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



5392
5393
5394
# File 'lib/models/porcelain.rb', line 5392

def tags
  @tags
end

#versionObject

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



5395
5396
5397
# File 'lib/models/porcelain.rb', line 5395

def version
  @version
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5417
5418
5419
5420
5421
5422
5423
# File 'lib/models/porcelain.rb', line 5417

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