File: kv.rst

package info (click to toggle)
python-hvac 2.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,800 kB
  • sloc: python: 29,360; makefile: 42; sh: 14
file content (38 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
KV Secrets Engines
==================

The :py:class:`hvac.api.secrets_engines.Kv` instance under the :py:attr:`Client class's secrets.kv attribute<hvac.v1.Client.secrets.kv>` is a wrapper to expose either version 1 (:py:class:`KvV1<hvac.api.secrets_engines.KvV1>`) or version 2 of the key/value secrets engines' API methods (:py:class:`KvV2<hvac.api.secrets_engines.KvV2>`). At present, this class defaults to version 2 when accessing methods on the instance.



Setting the Default KV Version
------------------------------

.. code:: python

    import hvac
    client = hvac.Client()

    client.secrets.kv.default_kv_version = 1
    client.secrets.kv.read_secret(path='hvac')  # => calls hvac.api.secrets_engines.KvV1.read_secret

Explicitly Calling a KV Version Method
--------------------------------------

.. code:: python

    import hvac
    client = hvac.Client()

    client.secrets.kv.v1.read_secret(path='hvac')
    client.secrets.kv.v2.read_secret_version(path='hvac')


Specific KV Version Usage
-------------------------

.. toctree::
   :maxdepth: 2

   ../secrets_engines/kv_v1
   ../secrets_engines/kv_v2