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

Returns a new instance of Gateway.



4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
# File 'lib/models/porcelain.rb', line 4870

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>”.



4866
4867
4868
# File 'lib/models/porcelain.rb', line 4866

def bind_address
  @bind_address
end

#idObject

Unique identifier of the Gateway.



4856
4857
4858
# File 'lib/models/porcelain.rb', line 4856

def id
  @id
end

#listen_addressObject

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



4863
4864
4865
# File 'lib/models/porcelain.rb', line 4863

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.



4858
4859
4860
# File 'lib/models/porcelain.rb', line 4858

def name
  @name
end

#stateObject

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



4861
4862
4863
# File 'lib/models/porcelain.rb', line 4861

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



4868
4869
4870
# File 'lib/models/porcelain.rb', line 4868

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4898
4899
4900
4901
4902
4903
4904
# File 'lib/models/porcelain.rb', line 4898

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