Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delete_roleset method #449

Merged
merged 1 commit into from May 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/usage/secrets_engines/gcp.rst
Expand Up @@ -176,6 +176,22 @@ Examples

list_response = client.secrets.gcp.list_rolesets()

Delete Roleset
--------------

.. automethod:: hvac.api.secrets_engines.Gcp.delete_roleset
:noindex:

Examples
````````

.. testcode:: gcp_secrets

import hvac
client = hvac.Client(url='https://127.0.0.1:8200')

delete_response = client.secrets.gcp.delete_roleset(name='hvac-doctest')


Generate Oauth2 Access Token
----------------------------
Expand Down
22 changes: 22 additions & 0 deletions hvac/api/secrets_engines/gcp.py
Expand Up @@ -206,6 +206,28 @@ def list_rolesets(self, mount_point=DEFAULT_MOUNT_POINT):
)
return response.json()

def delete_roleset(self, name, mount_point=DEFAULT_MOUNT_POINT):
"""Delete an existing roleset by the given name.

Supported methods:
DELETE: /{mount_point}/roleset/{name} Produces: 200 application/json

:param name: Name of the role.
:type name: str | unicode
:param mount_point: The "path" the method/backend was mounted on.
:type mount_point: str | unicode
:return: The response of the request.
:rtype: requests.Response
"""
api_path = '/v1/{mount_point}/roleset/{name}'.format(
name=name,
mount_point=mount_point,
)
response = self._adapter.delete(
url=api_path,
)
return response

def generate_oauth2_access_token(self, roleset, mount_point=DEFAULT_MOUNT_POINT):
"""Generate an OAuth2 token with the scopes defined on the roleset.

Expand Down