Class: SDM::Gateway

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

Gateway represents a StrongDM CLI installation running in gateway mode.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bind_address: nil, gateway_filter: nil, id: nil, listen_address: nil, name: nil, state: nil, tags: nil) ⇒ Gateway

Returns a new instance of Gateway.



2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
# File 'lib/models/porcelain.rb', line 2841

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

Instance Attribute Details

#bind_addressObject

The hostname/port tuple which the gateway daemon will bind to. If not provided on create, set to "0.0.0.0:listen_address_port".



2825
2826
2827
# File 'lib/models/porcelain.rb', line 2825

def bind_address
  @bind_address
end

#gateway_filterObject

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



2828
2829
2830
# File 'lib/models/porcelain.rb', line 2828

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Gateway.



2830
2831
2832
# File 'lib/models/porcelain.rb', line 2830

def id
  @id
end

#listen_addressObject

The public hostname/port tuple at which the gateway will be accessible to clients.



2832
2833
2834
# File 'lib/models/porcelain.rb', line 2832

def listen_address
  @listen_address
end

#nameObject

Unique human-readable name of the Gateway. Node names must include only letters, numbers, and hyphens (no spaces, underscores, or other special characters). Generated if not provided on create.



2834
2835
2836
# File 'lib/models/porcelain.rb', line 2834

def name
  @name
end

#stateObject

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



2837
2838
2839
# File 'lib/models/porcelain.rb', line 2837

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



2839
2840
2841
# File 'lib/models/porcelain.rb', line 2839

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



2859
2860
2861
2862
2863
2864
2865
# File 'lib/models/porcelain.rb', line 2859

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