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.



6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
# File 'lib/models/porcelain.rb', line 6326

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.



6305
6306
6307
# File 'lib/models/porcelain.rb', line 6305

def device
  @device
end

#gateway_filterObject

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



6308
6309
6310
# File 'lib/models/porcelain.rb', line 6308

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Relay.



6310
6311
6312
# File 'lib/models/porcelain.rb', line 6310

def id
  @id
end

#locationObject

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



6313
6314
6315
# File 'lib/models/porcelain.rb', line 6313

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.



6315
6316
6317
# File 'lib/models/porcelain.rb', line 6315

def name
  @name
end

#stateObject

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



6319
6320
6321
# File 'lib/models/porcelain.rb', line 6319

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



6321
6322
6323
# File 'lib/models/porcelain.rb', line 6321

def tags
  @tags
end

#versionObject

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



6324
6325
6326
# File 'lib/models/porcelain.rb', line 6324

def version
  @version
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6346
6347
6348
6349
6350
6351
6352
# File 'lib/models/porcelain.rb', line 6346

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