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.



6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
# File 'lib/models/porcelain.rb', line 6076

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.



6074
6075
6076
# File 'lib/models/porcelain.rb', line 6074

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Relay.



6063
6064
6065
# File 'lib/models/porcelain.rb', line 6063

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.



6065
6066
6067
# File 'lib/models/porcelain.rb', line 6065

def name
  @name
end

#stateObject

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



6069
6070
6071
# File 'lib/models/porcelain.rb', line 6069

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



6071
6072
6073
# File 'lib/models/porcelain.rb', line 6071

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6100
6101
6102
6103
6104
6105
6106
# File 'lib/models/porcelain.rb', line 6100

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