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, tags: nil) ⇒ Gateway



4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
# File 'lib/models/porcelain.rb', line 4796

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



4792
4793
4794
# File 'lib/models/porcelain.rb', line 4792

def bind_address
  @bind_address
end

#idObject

Unique identifier of the Gateway.



4782
4783
4784
# File 'lib/models/porcelain.rb', line 4782

def id
  @id
end

#listen_addressObject

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



4789
4790
4791
# File 'lib/models/porcelain.rb', line 4789

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.



4784
4785
4786
# File 'lib/models/porcelain.rb', line 4784

def name
  @name
end

#stateObject

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



4787
4788
4789
# File 'lib/models/porcelain.rb', line 4787

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



4794
4795
4796
# File 'lib/models/porcelain.rb', line 4794

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4824
4825
4826
4827
4828
4829
4830
# File 'lib/models/porcelain.rb', line 4824

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