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.



4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
# File 'lib/models/porcelain.rb', line 4393

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.



4383
4384
4385
# File 'lib/models/porcelain.rb', line 4383

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.



4385
4386
4387
# File 'lib/models/porcelain.rb', line 4385

def name
  @name
end

#stateObject

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



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

def state
  @state
end

#tagsObject

Tags is a map of key, value pairs.



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

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



4413
4414
4415
4416
4417
4418
4419
# File 'lib/models/porcelain.rb', line 4413

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