The JSON encoding of the DeleteRange [RPC response][etcdrpc].
##### Protobuf reply
The protobuf encoding of the DeleteRange [RPC response][etcdrpc].
#### Examples
``` bash
./etcdctl put foo bar
OK
./etcdctl del foo
1
./etcdctl range foo
```
### TXN [options]
TXN reads multiple etcd requests from standard input and applies them as a single atomic transaction.
A transaction consists of list of conditions, a list of requests to apply if all the conditions are true, and a list of requests to apply if any condition is false.
#### Options
- hex -- print out keys and values as hex encoded string
- interactive -- input transaction with interactive prompting
Watch watches events stream on keys or prefixes, [key or prefix, range_end) if `range-end` is given. The watch command runs until it encounters an error or is terminated by the user.
On success, prints a humanized table of the member IDs, statuses, names, peer addresses, and client addresses. On failure, prints an error message and returns with a non-zero exit code.
##### JSON reply
On success, prints a JSON listing of the member IDs, statuses, names, peer addresses, and client addresses. On failure, prints an error message and returns with a non-zero exit code.
##### Protobuf reply
The protobuf encoding of the MEMBER LIST [RPC response][member_list_rpc].
On success, prints a humanized table of each endpoint URL, ID, version, database size, leadership status, raft term, and raft status. On failure, returns with a non-zero exit code.
##### JSON reply
On success, prints a line of JSON encoding each endpoint URL, ID, version, database size, leadership status, raft term, and raft status. On failure, returns with a non-zero exit code.
##### Protobuf reply
ENDPOINT STATUS does not support protobuf encoded output.
SNAPSHOT RESTORE creates an etcd data directory for an etcd cluster member from a backend database snapshot and a new cluster configuration. Restoring the snapshot into each member for a new cluster configuration will initialize a new etcd cluster preloaded by the snapshot data.
#### Options
The snapshot restore options closely resemble to those used in the `etcd` command for defining a cluster.
- data-dir -- Path to the data directory. Uses \<name\>.etcd if none given.
- initial-cluster -- The initial cluster configuration for the restored etcd cluster.
- initial-cluster-token -- Initial cluster token for the restored etcd cluster.
- initial-advertise-peer-urls -- List of peer URLs for the member being restored.
- name -- Human-readable name for the etcd cluster member being restored.
#### Return value
- On success, a new etcd data directory is initialized.
- Error string if the data directory could not be completely initialized. Exit code is non-zero.
#### Example
Save a snapshot, restore into a new 3 node cluster, and start the cluster:
- Exit code is zero when migration is finished successfully.
- Error string if migration failed. Exit code is non-zero.
#### Default transformer
If user does not provide a transformer program, migrate command will use the default transformer. The default transformer transforms `storev2` formatted keys into `mvcc` formatted keys according to the following Go program:
Users can provide a customized 1:n transformer function that transforms a key from the v2 store to any number of keys in the mvcc store. The migration program writes JSON formatted [v2 store keys][v2key] to the transformer program's stdin, reads protobuf formatted [mvcc keys][v3key] back from the transformer program's stdout, and finishes migration by saving the transformed keys into the mvcc store.
The provided transformer should read until EOF and flush the stdout before exiting to ensure data integrity.
`auth enable` activates authentication on an etcd cluster and `auth disable` deactivates. When authentication is enabled, etcd checks all requests for appropriate authorization.
#### Return value
##### Simple reply
-`Authentication Enabled`. Exit code is zero.
- Error string if AUTH failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl user add root
etcdctl user grant-role root root
etcdctl user get root
etcdctl role add root
etcdctl role get root
etcdctl auth enable
# Authentication Enabled
```
### ROLE ADD \<role name\>
`role add` creates a role.
#### Return value
##### Simple reply
-`Role <role name> created`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 role add myrole
```
### ROLE DELETE \<role name\>
`role delete` deletes a role.
#### Return value
##### Simple reply
-`Role <role name> deleted`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 role delete myrole
# Role myrole deleted
```
### ROLE GET \<role name\>
`role get` lists detailed role information.
#### Return value
##### Simple reply
- Detailed role information. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 role get myrole
# Role myrole
# KV Read:
# foo
# KV Write:
# foo
```
### ROLE GRANT-PERMISSION \<role name\> \<permission type\> \<key\> [endkey]
`role grant-permission` grants a key to a role.
#### Return value
##### Simple reply
-`Role <role name> updated`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 role grant-permission myrole readwrite foo
# Role myrole updated
```
### ROLE REVOKE-PERMISSION \<role name\> \<permission type\> \<key\> [endkey]
`role revoke-permission` revokes a key from a role.
#### Return value
##### Simple reply
-`Permission of key <key> is revoked from role <role name>`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 role revoke-permission myrole foo
# Permission of key foo is revoked from role myrole
```
### USER ADD \<user name\>
`user add` creates a user.
#### Return value
##### Simple reply
-`User <user name> created`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 user add myuser
# Password of myuser:
# Type password of myuser again for confirmation:
# User myuser created
```
### USER DELETE \<user name\>
`user delete` deletes a user.
#### Return value
##### Simple reply
-`User <user name> deleted`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 user delete myuser
# User myuser deleted
```
### USER GET \<user name\>
`user get` lists detailed user information.
#### Return value
##### Simple reply
- Detailed user information. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 user get myuser
# User: myuser
# Roles:
```
### USER PASSWD \<user name\>
`user passwd` changes a user's password.
#### Options
- interactive -- if true, read password in interactive terminal
#### Return value
##### Simple reply
-`Password updated`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 user passwd myuser
# Password of myuser:
# Type password of myuser again for confirmation:
# Password updated
```
### USER GRANT-ROLE \<user name\> \<role name\>
`user grant-role` grants a role to a user
#### Return value
##### Simple reply
-`Role <role name> is granted to user <user name>`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 user grant-role userA roleA
# Role roleA is granted to user userA
```
### USER REVOKE-ROLE \<user name\> \<role name\>
`user revoke-role` revokes a role from a user
#### Return value
##### Simple reply
-`Role <role name> is revoked from user <user name>`. Exit code is zero.
- Error string if failed. Exit code is non-zero.
#### Examples
``` bash
etcdctl --user=root:123 user revoke-role userA roleA
etcdctl is still in its early stage. We try out best to ensure fully compatible releases, however we might break compatibility to fix bugs or improve commands. If we intend to release a version of etcdctl with backward incompatibilities, we will provide notice prior to release and have instructions on how to upgrade.
Input includes the command name, its flags, and its arguments. We ensure backward compatibility of the input of normal commands in non-interactive mode.
Output includes output from etcdctl and its exit code. etcdctl provides `simple` output format by default.
We ensure compatibility for the `simple` output format of normal commands in non-interactive mode. Currently, we do not ensure
backward compatibility for `JSON` format and the format in non-interactive mode. Currently, we do not ensure backward compatibility of utility commands.