Skip to content

Commit

Permalink
Merge pull request #664 from devlounge/patch-1
Browse files Browse the repository at this point in the history
add token_type support to create_kubernetes_role
  • Loading branch information
jeffwecan committed Feb 5, 2021
2 parents 95a4acb + c78e058 commit 4bf882a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hvac/v1/__init__.py
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, token_type="", mount_point='kubernetes'):
"""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

0 comments on commit 4bf882a

Please sign in to comment.