Sha256: a52c239abb2946102315fe539c49c32d807609574a1ac4ca96edc88e7d69df67

Contents?: true

Size: 927 Bytes

Versions: 14

Compression:

Stored size: 927 Bytes

Contents

class Etcdv3
  class Maintenance
    # Sadly these are the only alarm types supported by the api right now.
    ALARM_TYPES = {
      NONE: 0,
      NOSPACE: 1
    }

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

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

    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

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

  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/maintenance.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/maintenance.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/maintenance.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/maintenance.rb
etcdv3-0.11.5 lib/etcdv3/maintenance.rb
etcdv3-0.11.4 lib/etcdv3/maintenance.rb
etcdv3-0.11.3 lib/etcdv3/maintenance.rb
etcdv3-0.10.2 lib/etcdv3/maintenance.rb
etcdv3-0.10.1 lib/etcdv3/maintenance.rb
etcdv3-0.9.0 lib/etcdv3/maintenance.rb
etcdv3-0.8.3 lib/etcdv3/maintenance.rb
etcdv3-0.8.2 lib/etcdv3/maintenance.rb
etcdv3-0.8.1 lib/etcdv3/maintenance.rb
etcdv3-0.8.0 lib/etcdv3/maintenance.rb