etcd3.apis.auth.
AuthAPI
[source]¶Bases: etcd3.apis.base.BaseAPI
authenticate
(name, password)[source]¶Authenticate processes an authenticate request.
Parameters: |
|
---|
role_add
(name)[source]¶RoleAdd adds a new role.
Parameters: | name (str) – name is the name of the role to add to the authentication system. |
---|
role_grant_permission
(name, key=None, permType=<authpbPermissionType.READ: 'READ'>, range_end=None, prefix=False, all=False)[source]¶RoleGrantPermission grants a permission of a specified key or range to a specified role.
Parameters: |
|
---|
role_revoke_permission
(role, key=None, range_end=None, prefix=False, all=False)[source]¶RoleRevokePermission revokes a key or range permission of a specified role.
Parameters: |
|
---|
user_add
(name, password)[source]¶UserAdd adds a new user.
Parameters: |
|
---|
user_change_password
(name, password)[source]¶UserChangePassword changes the password of a specified user.
Parameters: |
|
---|
user_delete
(name)[source]¶UserDelete deletes a specified user.
Parameters: | name (str) – name is the name of the user to delete. |
---|
user_get
(name)[source]¶UserGet gets detailed user information.
Parameters: | name (str) – name is the name of the user to get. |
---|
etcd3.apis.cluster.
ClusterAPI
[source]¶Bases: etcd3.apis.base.BaseAPI
member_add
(peerURLs)[source]¶MemberAdd adds a member into the cluster.
Parameters: | peerURLs (list of str) – peerURLs is the list of URLs the added member will use to communicate with the cluster. |
---|
etcd3.apis.kv.
KVAPI
[source]¶Bases: etcd3.apis.base.BaseAPI
compact
(revision, physical=False)[source]¶Compact compacts the event history in the etcd key-value store. The key-value store should be periodically compacted or the event history will continue to grow indefinitely.
Parameters: |
|
---|
delete_range
(key=None, range_end=None, prev_kv=False, prefix=False, all=False, txn_obj=False)[source]¶DeleteRange deletes the given range from the key-value store. A delete request increments the revision of the key-value store and generates a delete event in the event history for every deleted key.
Parameters: |
|
---|
put
(key, value, lease=0, prev_kv=False, ignore_value=False, ignore_lease=False, txn_obj=False)[source]¶Put puts the given key into the key-value store. A put request increments the revision of the key-value store and generates one event in the event history.
Parameters: |
|
---|
range
(key=None, range_end=None, limit=0, revision=None, serializable=False, keys_only=False, count_only=False, min_mod_revision=None, max_mod_revision=None, min_create_revision=None, max_create_revision=None, sort_order=<RangeRequestSortOrder.NONE: 'NONE'>, sort_target=<RangeRequestSortTarget.KEY: 'KEY'>, prefix=False, all=False, txn_obj=False)[source]¶Range gets the keys in the range from the key-value store.
Parameters: |
|
---|
txn
(compare, success, failure)[source]¶Txn processes multiple requests in a single transaction. A txn request increments the revision of the key-value store and generates events with the same revision for every completed request. It is not allowed to modify the same key several times within one txn.
Parameters: |
|
---|
etcd3.apis.lease.
LeaseAPI
[source]¶Bases: etcd3.apis.base.BaseAPI
lease_revoke
(ID)[source]¶LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.
Parameters: | ID (int) – ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted. |
---|
lease_time_to_live
(ID, keys=False)[source]¶LeaseTimeToLive retrieves lease information.
Parameters: |
|
---|
lease_grant
(TTL, ID=0)[source]¶LeaseGrant creates a lease which expires if the server does not receive a keepAlive within a given time to live period. All keys attached to the lease will be expired and deleted if the lease expires. Each expired key generates a delete event in the event history.
Parameters: |
|
---|
lease_keep_alive
(data)[source]¶PLEASE USE THE TRANSACTION UTIL
LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client to the server and streaming keep alive responses from the server to the client.
Parameters: | data – ID stream inputs of the lease to keep alive. which not works for now |
---|
lease_keep_alive_once
(ID)[source]¶this api only send keep alive once instead of streaming send multiple IDs
LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client to the server and streaming keep alive responses from the server to the client.
Parameters: | ID (int) – ID is the lease ID for the lease to keep alive. |
---|
etcd3.apis.lock.
LockAPI
[source]¶Bases: etcd3.apis.base.BaseAPI
lock
(name, lease=0)[source]¶Lock acquires a distributed shared lock on a given named lock. On success, it will return a unique key that exists so long as the lock is held by the caller. This key can be used in conjunction with transactions to safely ensure updates to etcd only occur while holding lock ownership. The lock is held until Unlock is called on the key or the lease associate with the owner expires.
Parameters: |
|
---|
unlock
(key)[source]¶Unlock takes a key returned by Lock and releases the hold on lock. The next Lock caller waiting for the lock will then be woken up and given ownership of the lock.
Parameters: |
|
---|
etcd3.apis.maintenance.
MaintenanceAPI
[source]¶Bases: etcd3.apis.base.BaseAPI
alarm
(memberID, action=<AlarmRequestAlarmAction.GET: 'GET'>, alarm=<etcdserverpbAlarmType.NONE: 'NONE'>)[source]¶Alarm activates, deactivates, and queries alarms regarding cluster health.
Parameters: |
|
---|
alarm_get
(memberID, alarm)[source]¶Queries alarms regarding cluster health.
Parameters: |
|
---|
alarm_activate
(memberID, alarm)[source]¶Activates alarms regarding cluster health.
Parameters: |
|
---|
alarm_deactivate
(memberID, alarm)[source]¶Deactivates alarms regarding cluster health.
Parameters: |
|
---|
hash
()[source]¶Hash returns the hash of the local KV state for consistency checking purpose. This is designed for testing; do not use this in production when there are ongoing transactions.
etcd3.apis.watch.
WatchAPI
[source]¶Bases: etcd3.apis.base.BaseAPI
watch
(create_request=None, cancel_request=None, **kwargs)[source]¶PLEASE USE THE WATCH UTIL
Watch watches for events happening or that have happened. Both input and output are streams; the input stream is for creating and canceling watchers and the output stream sends events. One watch RPC can watch on multiple key ranges, streaming events for several watches at once. The entire event history can be watched starting from the last compaction revision.
Parameters: |
|
---|
watch_create
(key=None, range_end=None, start_revision=None, progress_notify=None, prev_kv=None, prefix=False, all=False, no_put=False, no_delete=False, **kwargs)[source]¶WatchCreate creates a watch stream on given key or key_range
Parameters: |
|
---|
watch_cancel
(watch_id, **kwargs)[source]¶NOT SUPPORTED UNDER ETCD 3.3-
https://github.com/coreos/etcd/pull/9065
WatchCancel cancels a watch stream
Parameters: | watch_id (int) – watch_id is the watcher id to cancel so that no more events are transmitted. |
---|