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, device: nil, gateway_filter: nil, id: nil, listen_address: nil, location: nil, maintenance_windows: nil, name: nil, state: nil, tags: nil, version: nil) ⇒ Gateway

Returns a new instance of Gateway.



5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
# File 'lib/models/porcelain.rb', line 5443

def initialize(
  bind_address: nil,
  device: nil,
  gateway_filter: nil,
  id: nil,
  listen_address: nil,
  location: nil,
  maintenance_windows: nil,
  name: nil,
  state: nil,
  tags: nil,
  version: nil
)
  @bind_address = bind_address == nil ? "" : bind_address
  @device = device == nil ? "" : device
  @gateway_filter = gateway_filter == nil ? "" : gateway_filter
  @id = id == nil ? "" : id
  @listen_address = listen_address == nil ? "" : listen_address
  @location = location == nil ? "" : location
  @maintenance_windows = maintenance_windows == nil ? [] : maintenance_windows
  @name = name == nil ? "" : name
  @state = state == nil ? "" : state
  @tags = tags == nil ? SDM::_porcelain_zero_value_tags() : tags
  @version = version == nil ? "" : version
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".



5405
5406
5407
# File 'lib/models/porcelain.rb', line 5405

def bind_address
  @bind_address
end

#deviceObject

Device is a read only device name uploaded by the gateway process when it comes online.



5408
5409
5410
# File 'lib/models/porcelain.rb', line 5408

def device
  @device
end

#gateway_filterObject

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



5411
5412
5413
# File 'lib/models/porcelain.rb', line 5411

def gateway_filter
  @gateway_filter
end

#idObject

Unique identifier of the Gateway.



5413
5414
5415
# File 'lib/models/porcelain.rb', line 5413

def id
  @id
end

#listen_addressObject

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



5415
5416
5417
# File 'lib/models/porcelain.rb', line 5415

def listen_address
  @listen_address
end

#locationObject

Location is a read only network location uploaded by the gateway process when it comes online.



5418
5419
5420
# File 'lib/models/porcelain.rb', line 5418

def location
  @location
end

#maintenance_windowsObject

Maintenance Windows define when this node is allowed to restart. If a node is requested to restart, it will check each window to determine if any of them permit it to restart, and if any do, it will. This check is repeated per window until the restart is successfully completed.

If not set here, may be set on the command line or via an environment variable on the process itself; any server setting will take precedence over local settings. This setting is ineffective for nodes below version 38.44.0.

If this setting is not applied via this remote configuration or via local configuration, the default setting is used: always allow restarts if serving no connections, and allow a restart even if serving connections between 7-8 UTC, any day.



5431
5432
5433
# File 'lib/models/porcelain.rb', line 5431

def maintenance_windows
  @maintenance_windows
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.



5433
5434
5435
# File 'lib/models/porcelain.rb', line 5433

def name
  @name
end

#stateObject

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



5436
5437
5438
# File 'lib/models/porcelain.rb', line 5436

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



5438
5439
5440
# File 'lib/models/porcelain.rb', line 5438

def tags
  @tags
end

#versionObject

Version is a read only sdm binary version uploaded by the gateway process when it comes online.



5441
5442
5443
# File 'lib/models/porcelain.rb', line 5441

def version
  @version
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5469
5470
5471
5472
5473
5474
5475
# File 'lib/models/porcelain.rb', line 5469

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