- Add find.py with find_secret() function for searching secrets - Add delete.py with delete_secret() function for deleting secrets - Update key_manager.rst documentation with new sections Change-Id: Id6db6bc2871700f04a636a66fb71fc0e3a5e7283 Signed-off-by: Kim-Yukyung <yukyung116@gmail.com>
2.7 KiB
Using OpenStack Key Manager
Before working with the Key Manager service, you'll need to create a
connection to your OpenStack cloud by following the connect user guide. This will
provide you with the conn variable used in the examples
below.
Table of Contents
Note
Some interactions with the Key Manager service differ from that of
other services in that resources do not have a proper id
parameter, which is necessary to make some calls. Instead, resources
have a separately named id attribute, e.g., the Secret resource has
secret_id.
The examples below outline when to pass in those id values.
Create a Secret
The Key Manager service allows you to create new secrets by passing
the attributes of the ~openstack.key_manager.v1.secret.Secret to the ~openstack.key_manager.v1._proxy.Proxy.create_secret
method.
../examples/key_manager/create.py
List Secrets
Once you have stored some secrets, they are available for you to list
via the ~openstack.key_manager.v1._proxy.Proxy.secrets
method. This method returns a generator, which yields each ~openstack.key_manager.v1.secret.Secret.
../examples/key_manager/list.py
The ~openstack.key_manager.v1._proxy.Proxy.secrets method
can also make more advanced queries to limit the secrets that are
returned.
../examples/key_manager/list.py
Get Secret Payload
Once you have received a ~openstack.key_manager.v1.secret.Secret, you can
obtain the payload for it by passing the secret's id value to the ~openstack.key_manager.v1._proxy.Proxy.secrets
method. Use the ~openstack.key_manager.v1.secret.Secret.secret_id
attribute when making this request.
../examples/key_manager/get.py
Find Secret
To find a secret by name or ID, use the ~openstack.key_manager.v1._proxy.Proxy.find_secret
method. This method can search for a ~openstack.key_manager.v1.secret.Secret by either
its name or ID, making it flexible when you don't have the exact secret
ID.
../examples/key_manager/find.py
Delete Secret
To delete a secret, use the ~openstack.key_manager.v1._proxy.Proxy.delete_secret
method. The secret can be identified by its ID or by using ~openstack.key_manager.v1._proxy.Proxy.find_secret to
locate it by name first.
../examples/key_manager/delete.py