<commit_before>Aiven Client |BuildStatus|_
===========================

.. |BuildStatus| image:: https://travis-ci.org/aiven/aiven-client.png?branch=master
.. _BuildStatus: https://travis-ci.org/aiven/aiven-client

Aiven is a next-generation managed cloud services platform.  Its focus is in
ease of adoption, high fault resilience, customer's peace of mind and
advanced features at competetive price points.  See https://aiven.io/ for
more information about the backend service.

aiven-client (`avn`) is the official command-line client for Aiven.

::

                        `'+;`         `'+;`
    The Aiven Crab    '@@@#@@@`     '@@@#@@@`
    ~~~~~~~~~~~~~~   #@.     #@.   @@.     #@.
                     @: ,@@   @@   @: ,@@   @@
                    ,@  @@@@@ :@  :@  @@@@@ .@
                     @  #@@@. #@   @` #@@@` @@
                     @@      `@#   @@      `@#
                      @@#. :@@+     @@#. :@@#
                       `+@@@'        `#@@@'
               ,;:`                             ,;;.
             @@@@@@#     .+@@@@@@@@@@@@@'.    `@@@@@@@
            @@@@@#    @@@@@@@@@@@@@@@@@@@@@@+    @@@@@@
             @@@   ;@@@@@@@@@@@@@@@@@@@@@@@@@@@`  `@@;
              `  `@@@@@@@@@@@        ;@@@@@@@@@@@
          `@@@  '@@@@@@@@@@@@@       @@@@@@@@@@@@@`  @@@
         '@@@` .@@@@@@@@@@@@@@@    `@@@@@@@@@@@@@@@  @@@@`
         @@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  @@@@
        '@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  @@@@
        ,:::;  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  ,:::
           :@  ,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  #@
           @@@  +@#+#@@@@@@@@@@@@@@@@@@@@@@@@@#+#@.  @@@
           @@@@        '@@@@@@@@@@@@@@@@@@@.        @@@@
           @@@  @@@@@@+  @@@@@@@@@@@@@@@@@  @@@@@@;  @@@
           @@  @@@@@@@@@  @@@@@@@@@@@@@@@ `@@@@@@@@@  @+
              @@@@@@@@@@@ :@@@@@@@@@@@@@  @@@@@@@@@@@ '
             `@@@@@@@@@@@       ```      ,@@@@@@@@@@@
             `@@@@@@   '@                :@:   @@@@@@
              @@@@@:                           @@@@@@
               @@@@@                           @@@@@
                @@@@#                         @@@@'

Platform requirements
=====================

Aiven Client has been tested and developed on Linux and Mac OS X systems.
It is a Python program that works with Python 2.7 or 3.4 or newer versions.
The only external dependency is Requests_ (and certifi_ on Windows/OSX).

.. _`Requests`: http://www.python-requests.org/
.. _`certifi`: https://certifi.io/

Installation
============

From PyPI (Linux/OSX)::

  $ python -m pip install aiven-client

From PyPI (Windows)::

  c:\> python -m pip install aiven-client

Build an RPM package (Linux)::

  $ make rpm

Basic Usage
===========

* NOTE: On Windows you may need to use ``python -m aiven.client`` instead of ``avn``.
* All commands will output the raw REST API JSON response with ``--json``

Help command
------------

::

  $ avn help

List all commands. You can use the help to also search for matching commands,
for example

::

  $ avn help kafka topic

would list all commands that have kafka *and* topic in their description.

Login and users
---------------
Login::

  $ avn user login <your@email>

Logout (revokes current access token, other sessions remain valid)::

  $ avn user logout

Expire all authentication tokens for your user, logs out all web console sessions, etc.
You will need to login again after this.::

 $ avn user tokens-expire

Manage individual access tokens::

 $ avn user access-token list
 $ avn user access-token create --description <usage_description> [--max-age-seconds <secs>] [--extend-when-used]
 $ avn user access-token update <token|token_prefix> --description <new_description>
 $ avn user access-token revoke <token|token_prefix>

Note that the system has hard limits for the number of tokens you can create. If you're
permanently done using a token you should always use ``user access-token revoke`` operation
to revoke the token so that it does not count towards the quota.

Alternatively, you can add 2 json files, first create a default config in `~/.config/aiven/aiven-credentials.json` containing the json with an auth_token:

```json
{
  "auth_token": "<PASSWORD>==",
  "user_email": "<EMAIL>"
 }
```

Second create a default config in `~/.config/aiven/aiven-client.json` containing the json with the default_project:

```json
{"default_project": "yourproject-abcd"}
```

Clouds
------
List available cloud regions::

  $ avn cloud list

Projects
--------
List projects you are a member of::

  $ avn project list

Project commands operate on the currently active project or the project
specified with the `--project NAME` switch. The active project cab be changed
with the `switch` command::

  $ avn project switch <projectname>

Show active project's details::
<commit_msg>readme: rst style fixes<commit_after>Aiven Client |BuildStatus|_
===========================

.. |BuildStatus| image:: https://travis-ci.org/aiven/aiven-client.png?branch=master
.. _BuildStatus: https://travis-ci.org/aiven/aiven-client

Aiven is a next-generation managed cloud services platform.  Its focus is in
ease of adoption, high fault resilience, customer's peace of mind and
advanced features at competetive price points.  See https://aiven.io/ for
more information about the backend service.

aiven-client (``avn``) is the official command-line client for Aiven.

::

                        `'+;`         `'+;`
    The Aiven Crab    '@@@#@@@`     '@@@#@@@`
    ~~~~~~~~~~~~~~   #@.     #@.   @@.     #@.
                     @: ,@@   @@   @: ,@@   @@
                    ,@  @@@@@ :@  :@  @@@@@ .@
                     @  #@@@. #@   @` #@@@` @@
                     @@      `@#   @@      `@#
                      @@#. :@@+     @@#. :@@#
                       `+@@@'        `#@@@'
               ,;:`                             ,;;.
             @@@@@@#     .+@@@@@@@@@@@@@'.    `@@@@@@@
            @@@@@#    @@@@@@@@@@@@@@@@@@@@@@+    @@@@@@
             @@@   ;@@@@@@@@@@@@@@@@@@@@@@@@@@@`  `@@;
              `  `@@@@@@@@@@@        ;@@@@@@@@@@@
          `@@@  '@@@@@@@@@@@@@       @@@@@@@@@@@@@`  @@@
         '@@@` .@@@@@@@@@@@@@@@    `@@@@@@@@@@@@@@@  @@@@`
         @@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  @@@@
        '@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  @@@@
        ,:::;  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  ,:::
           :@  ,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  #@
           @@@  +@#+#@@@@@@@@@@@@@@@@@@@@@@@@@#+#@.  @@@
           @@@@        '@@@@@@@@@@@@@@@@@@@.        @@@@
           @@@  @@@@@@+  @@@@@@@@@@@@@@@@@  @@@@@@;  @@@
           @@  @@@@@@@@@  @@@@@@@@@@@@@@@ `@@@@@@@@@  @+
              @@@@@@@@@@@ :@@@@@@@@@@@@@  @@@@@@@@@@@ '
             `@@@@@@@@@@@       ```      ,@@@@@@@@@@@
             `@@@@@@   '@                :@:   @@@@@@
              @@@@@:                           @@@@@@
               @@@@@                           @@@@@
                @@@@#                         @@@@'

Platform requirements
=====================

Aiven Client has been tested and developed on Linux and Mac OS X systems.
It is a Python program that works with Python 2.7 or 3.4 or newer versions.
The only external dependency is Requests_ (and certifi_ on Windows/OSX).

.. _`Requests`: http://www.python-requests.org/
.. _`certifi`: https://certifi.io/

Installation
============

From PyPI (Linux/OSX)::

  $ python -m pip install aiven-client

From PyPI (Windows)::

  c:\> python -m pip install aiven-client

Build an RPM package (Linux)::

  $ make rpm

Basic Usage
===========

* NOTE: On Windows you may need to use ``python -m aiven.client`` instead of ``avn``.
* All commands will output the raw REST API JSON response with ``--json``

Help command
------------

::

  $ avn help

List all commands. You can use the help to also search for matching commands,
for example

::

  $ avn help kafka topic

would list all commands that have kafka *and* topic in their description.

Login and users
---------------
Login::

  $ avn user login <your@email>

Logout (revokes current access token, other sessions remain valid)::

  $ avn user logout

Expire all authentication tokens for your user, logs out all web console sessions, etc.
You will need to login again after this.::

 $ avn user tokens-expire

Manage individual access tokens::

 $ avn user access-token list
 $ avn user access-token create --description <usage_description> [--max-age-seconds <secs>] [--extend-when-used]
 $ avn user access-token update <token|token_prefix> --description <new_description>
 $ avn user access-token revoke <token|token_prefix>

Note that the system has hard limits for the number of tokens you can create. If you're
permanently done using a token you should always use ``user access-token revoke`` operation
to revoke the token so that it does not count towards the quota.

Alternatively, you can add 2 json files, first create a default config in ``~/.config/aiven/aiven-credentials.json`` containing the json with an auth_token::

  {
      "auth_token": "<PASSWORD>==",
      "user_email": "<EMAIL>"
  }

Second create a default config in `~/.config/aiven/aiven-client.json` containing the json with the default_project::

  {"default_project": "yourproject-abcd"}

Clouds
------
List available cloud regions::

  $ avn cloud list

Projects
--------
List projects you are a member of::

  $ avn project list

Project commands operate on the currently active project or the project
specified with the ``--project NAME`` switch. The active project cab be changed
with the ``project switch`` command::

  $ avn project switch <projectname>

Show active project's details::

{'fraction_non_alphanumeric': 0.24588125582841155, 'fraction_numerical': 0.0010361620557455186, 'mean_word_length': 2.3122855181880575, 'pattern_counts': {'":': 6, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6660721', 'n_tokens_mistral': 3173, 'n_tokens_neox': 3024, 'n_words': 810}