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 token_type support to create_kubernetes_role #664

Merged
merged 2 commits into from
Feb 5, 2021
Merged
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion hvac/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ def get_kubernetes_configuration(self, mount_point='kubernetes'):
return self._adapter.get(url)

def create_kubernetes_role(self, name, bound_service_account_names, bound_service_account_namespaces, ttl="",
max_ttl="", period="", policies=None, mount_point='kubernetes'):
max_ttl="", period="", policies=None, mount_point='kubernetes', token_type=""):
devlounge marked this conversation as resolved.
Show resolved Hide resolved
"""POST /auth/<mount_point>/role/:name

:param name: Name of the role.
Expand All @@ -1646,6 +1646,7 @@ def create_kubernetes_role(self, name, bound_service_account_names, bound_servic
:type policies: list.
:param mount_point: The "path" the k8s auth backend was mounted on. Vault currently defaults to "kubernetes".
:type mount_point: str.
:type token_type: str.
:return: Will be an empty body with a 204 status code upon success
:rtype: requests.Response.
"""
Expand All @@ -1661,6 +1662,9 @@ def create_kubernetes_role(self, name, bound_service_account_names, bound_servic
'period': period,
'policies': policies,
}
if token_type:
params['token_type'] = token_type

url = 'v1/auth/{0}/role/{1}'.format(mount_point, name)
return self._adapter.post(url, json=params)

Expand Down