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.



5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
# File 'lib/models/porcelain.rb', line 5960

def initialize(
  gateway_filter: nil,
  id: nil,
  name: nil,
  state: nil,
  tags: nil
)
  if gateway_filter != nil
    @gateway_filter = gateway_filter
  end
  if id != nil
    @id = id
  end
  if name != nil
    @name = name
  end
  if state != nil
    @state = state
  end
  if tags != nil
    @tags = tags
  end
end

Instance Attribute Details

#gateway_filterObject

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



5948
5949
5950
# File 'lib/models/porcelain.rb', line 5948

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Relay.



5950
5951
5952
# File 'lib/models/porcelain.rb', line 5950

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.



5952
5953
5954
# File 'lib/models/porcelain.rb', line 5952

def name
  @name
end

#stateObject

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



5956
5957
5958
# File 'lib/models/porcelain.rb', line 5956

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



5958
5959
5960
# File 'lib/models/porcelain.rb', line 5958

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5984
5985
5986
5987
5988
5989
5990
# File 'lib/models/porcelain.rb', line 5984

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