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.



6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
# File 'lib/models/porcelain.rb', line 6007

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.



6005
6006
6007
# File 'lib/models/porcelain.rb', line 6005

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Relay.



5994
5995
5996
# File 'lib/models/porcelain.rb', line 5994

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.



5996
5997
5998
# File 'lib/models/porcelain.rb', line 5996

def name
  @name
end

#stateObject

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



6000
6001
6002
# File 'lib/models/porcelain.rb', line 6000

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



6002
6003
6004
# File 'lib/models/porcelain.rb', line 6002

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6031
6032
6033
6034
6035
6036
6037
# File 'lib/models/porcelain.rb', line 6031

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