Sha256: 50c9344af3746480cdcd30dc798812bbd4193e44dfa18765c605fe52aa2e90e2

Contents?: true

Size: 665 Bytes

Versions: 4

Compression:

Stored size: 665 Bytes

Contents

class Etcdv3
  class Lease
    def initialize(hostname, credentials, metadata={})
      @stub = Etcdserverpb::Lease::Stub.new(hostname, credentials)
      @metadata = metadata
    end

    def grant_lease(ttl)
      request = Etcdserverpb::LeaseGrantRequest.new(TTL: ttl)
      @stub.lease_grant(request, metadata: @metadata)
    end

    def revoke_lease(id)
      request = Etcdserverpb::LeaseRevokeRequest.new(ID: id)
      @stub.lease_revoke(request, metadata: @metadata)
    end

    def lease_ttl(id)
      request = Etcdserverpb::LeaseTimeToLiveRequest.new(ID: id, keys: true)
      @stub.lease_time_to_live(request, metadata: @metadata)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
etcdv3-0.4.0 lib/etcdv3/lease.rb
etcdv3-0.3.2 lib/etcdv3/lease.rb
etcdv3-0.3.1 lib/etcdv3/lease.rb
etcdv3-0.3.0 lib/etcdv3/lease.rb