Class: SDM::Relay

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

Relay represents a StrongDM CLI installation running in relay mode.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, name: nil, state: nil, tags: nil) ⇒ Relay

Returns a new instance of Relay.



4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
# File 'lib/models/porcelain.rb', line 4359

def initialize(
  id: nil,
  name: nil,
  state: nil,
  tags: nil
)
  if id != nil
    @id = id
  end
  if name != nil
    @name = name
  end
  if state != nil
    @state = state
  end
  if tags != nil
    @tags = tags
  end
end

Instance Attribute Details

#idObject

Unique identifier of the Relay.



4349
4350
4351
# File 'lib/models/porcelain.rb', line 4349

def id
  @id
end

#nameObject

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



4351
4352
4353
# File 'lib/models/porcelain.rb', line 4351

def name
  @name
end

#stateObject

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



4355
4356
4357
# File 'lib/models/porcelain.rb', line 4355

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



4357
4358
4359
# File 'lib/models/porcelain.rb', line 4357

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4379
4380
4381
4382
4383
4384
4385
# File 'lib/models/porcelain.rb', line 4379

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