Class: Etcdv3::Lease
- Inherits:
-
Object
- Object
- Etcdv3::Lease
- Defined in:
- lib/etcdv3/lease.rb
Instance Method Summary collapse
- #grant_lease(ttl) ⇒ Object
-
#initialize(hostname, credentials, metadata = {}) ⇒ Lease
constructor
A new instance of Lease.
- #lease_ttl(id) ⇒ Object
- #revoke_lease(id) ⇒ Object
Constructor Details
#initialize(hostname, credentials, metadata = {}) ⇒ Lease
Returns a new instance of Lease.
4 5 6 7 |
# File 'lib/etcdv3/lease.rb', line 4 def initialize(hostname, credentials, ={}) @stub = Etcdserverpb::Lease::Stub.new(hostname, credentials) = end |
Instance Method Details
#grant_lease(ttl) ⇒ Object
9 10 11 12 |
# File 'lib/etcdv3/lease.rb', line 9 def grant_lease(ttl) request = Etcdserverpb::LeaseGrantRequest.new(TTL: ttl) @stub.lease_grant(request, metadata: ) end |
#lease_ttl(id) ⇒ Object
19 20 21 22 |
# File 'lib/etcdv3/lease.rb', line 19 def lease_ttl(id) request = Etcdserverpb::LeaseTimeToLiveRequest.new(ID: id, keys: true) @stub.lease_time_to_live(request, metadata: ) end |
#revoke_lease(id) ⇒ Object
14 15 16 17 |
# File 'lib/etcdv3/lease.rb', line 14 def revoke_lease(id) request = Etcdserverpb::LeaseRevokeRequest.new(ID: id) @stub.lease_revoke(request, metadata: ) end |