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

Returns a new instance of Relay.



5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
# File 'lib/models/porcelain.rb', line 5264

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

Instance Attribute Details

#gateway_filterObject

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



5252
5253
5254
# File 'lib/models/porcelain.rb', line 5252

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Relay.



5254
5255
5256
# File 'lib/models/porcelain.rb', line 5254

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.



5256
5257
5258
# File 'lib/models/porcelain.rb', line 5256

def name
  @name
end

#stateObject

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



5260
5261
5262
# File 'lib/models/porcelain.rb', line 5260

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



5262
5263
5264
# File 'lib/models/porcelain.rb', line 5262

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5278
5279
5280
5281
5282
5283
5284
# File 'lib/models/porcelain.rb', line 5278

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