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.



4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
# File 'lib/models/porcelain.rb', line 4403

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



4399
4400
4401
# File 'lib/models/porcelain.rb', line 4399

def bind_address
  @bind_address
end

#idObject

Unique identifier of the Gateway.



4389
4390
4391
# File 'lib/models/porcelain.rb', line 4389

def id
  @id
end

#listen_addressObject

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



4396
4397
4398
# File 'lib/models/porcelain.rb', line 4396

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.



4391
4392
4393
# File 'lib/models/porcelain.rb', line 4391

def name
  @name
end

#stateObject

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



4394
4395
4396
# File 'lib/models/porcelain.rb', line 4394

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



4401
4402
4403
# File 'lib/models/porcelain.rb', line 4401

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4431
4432
4433
4434
4435
4436
4437
# File 'lib/models/porcelain.rb', line 4431

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