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(id: nil, name: nil, state: nil, listen_address: nil, bind_address: nil) ⇒ Gateway

Returns a new instance of Gateway.



3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
# File 'lib/models/porcelain.rb', line 3841

def initialize(
  id: nil,
  name: nil,
  state: nil,
  listen_address: nil,
  bind_address: nil
)
  if id != nil
    @id = id
  end
  if name != nil
    @name = name
  end
  if state != nil
    @state = state
  end
  if listen_address != nil
    @listen_address = listen_address
  end
  if bind_address != nil
    @bind_address = bind_address
  end
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>”.



3839
3840
3841
# File 'lib/models/porcelain.rb', line 3839

def bind_address
  @bind_address
end

#idObject

Unique identifier of the Gateway.



3829
3830
3831
# File 'lib/models/porcelain.rb', line 3829

def id
  @id
end

#listen_addressObject

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



3836
3837
3838
# File 'lib/models/porcelain.rb', line 3836

def listen_address
  @listen_address
end

#nameObject

Unique human-readable name of the Gateway. Generated if not provided on create.



3831
3832
3833
# File 'lib/models/porcelain.rb', line 3831

def name
  @name
end

#stateObject

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



3834
3835
3836
# File 'lib/models/porcelain.rb', line 3834

def state
  @state
end

Instance Method Details

#to_json(options = {}) ⇒ Object



3865
3866
3867
3868
3869
3870
3871
# File 'lib/models/porcelain.rb', line 3865

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