Class: Etcdv3::Maintenance

Inherits:
Object show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/maintenance.rb

Constant Summary collapse

ALARM_TYPES =

Sadly these are the only alarm types supported by the api right now.

{
  NONE: 0,
  NOSPACE: 1
}
ALARM_ACTIONS =
{
  get: 0,
  activate: 1, # Should only be used in testing. Not a stable feature...
  deactivate: 2
}

Instance Method Summary collapse

Constructor Details

#initialize(hostname, credentials, _timeout, metadata = {}) ⇒ Maintenance

Returns a new instance of Maintenance.



15
16
17
18
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/maintenance.rb', line 15

def initialize(hostname, credentials, _timeout,  = {})
  @stub = Etcdserverpb::Maintenance::Stub.new(hostname, credentials)
  @metadata = 
end

Instance Method Details

#alarms(action, member_id, alarm = :NONE) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/maintenance.rb', line 20

def alarms(action, member_id, alarm=:NONE)
  alarm = ALARM_TYPES[alarm]
  request = Etcdserverpb::AlarmRequest.new(
    action: ALARM_ACTIONS[action],
    memberID: member_id,
    alarm: action == :deactivate ? ALARM_TYPES[:NOSPACE] : alarm
  )
  @stub.alarm(request, metadata: @metadata)
end

#member_statusObject



30
31
32
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/maintenance.rb', line 30

def member_status
  @stub.status(Etcdserverpb::StatusRequest.new, metadata: @metadata)
end