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.



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

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.



4347
4348
4349
# File 'lib/models/porcelain.rb', line 4347

def id
  @id
end

#nameObject

Unique human-readable name of the Relay. Node names must include only letters, numbers, and hyphens (no spaces, underscores, or other special characters). Generated if not provided on create.



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

def name
  @name
end

#stateObject

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



4353
4354
4355
# File 'lib/models/porcelain.rb', line 4353

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



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

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



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

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