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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
Mount
=====
.. contents::
:local:
:depth: 1
Manipulate secret backends
--------------------------
.. doctest:: sys_mount
backends = client.sys.list_mounted_secrets_engines()['data']
client.sys.enable_secrets_engine('aws', path='aws-us-east-1')
client.sys.disable_secrets_engine('mysql')
client.sys.tune_mount_configuration(path='test', default_lease_ttl='3600s', max_lease_ttl='8600s')
client.sys.read_mount_configuration(path='test')
client.sys.move_backend('aws-us-east-1', 'aws-east')
List Mounted Secrets Engines
----------------------------
.. automethod:: hvac.api.system_backend.Mount.list_mounted_secrets_engines
:noindex:
Examples
````````
.. testcode:: sys_mount
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
secrets_engines_list = client.sys.list_mounted_secrets_engines()['data']
print('The following secrets engines are mounted: %s' % ', '.join(sorted(secrets_engines_list.keys())))
Example output:
.. testoutput:: sys_mount
The following secrets engines are mounted: cubbyhole/, identity/, secret/, sys/
Enable Secrets Engine
---------------------
.. automethod:: hvac.api.system_backend.Mount.enable_secrets_engine
:noindex:
Examples
````````
.. testcode:: sys_mount
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
client.sys.enable_secrets_engine(
backend_type='kv',
path='hvac-kv',
)
Disable Secrets Engine
----------------------
.. automethod:: hvac.api.system_backend.Mount.disable_secrets_engine
:noindex:
Examples
````````
.. testsetup:: sys_mount_disable
client.sys.enable_secrets_engine(
backend_type='kv',
path='hvac-kv',
)
.. testcode:: sys_mount_disable
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
client.sys.disable_secrets_engine(
path='hvac-kv',
)
Read Mount Configuration
------------------------
.. automethod:: hvac.api.system_backend.Mount.read_mount_configuration
:noindex:
Examples
````````
.. testcode:: sys_mount
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
secret_backend_tuning = client.sys.read_mount_configuration(path='hvac-kv')
print('The max lease TTL for the "hvac-kv" backend is: {max_lease_ttl}'.format(
max_lease_ttl=secret_backend_tuning['data']['max_lease_ttl'],
))
Example output:
.. testoutput:: sys_mount
The max lease TTL for the "hvac-kv" backend is: 2764800
Tune Mount Configuration
------------------------
.. automethod:: hvac.api.system_backend.Mount.tune_mount_configuration
:noindex:
Examples
````````
.. testcode:: sys_mount
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
client.sys.tune_mount_configuration(
path='hvac-kv',
default_lease_ttl='3600s',
max_lease_ttl='8600s',
)
Move Backend
------------
.. automethod:: hvac.api.system_backend.Mount.move_backend
:noindex:
Examples
````````
.. testsetup:: sys_mount_move
client.sys.enable_secrets_engine(
backend_type='kv',
path='hvac-kv',
)
.. testcode:: sys_mount_move
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
client.sys.move_backend(
from_path='hvac-kv',
to_path='kv-hvac',
)
|