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.



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
4430
4431
# File 'lib/models/porcelain.rb', line 4405

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



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

def bind_address
  @bind_address
end

#idObject

Unique identifier of the Gateway.



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

def id
  @id
end

#listen_addressObject

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



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

def listen_address
  @listen_address
end

#nameObject

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



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

def name
  @name
end

#stateObject

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



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

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



4403
4404
4405
# File 'lib/models/porcelain.rb', line 4403

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



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

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