o |nh2!@s8dZddlmZmZddlmZdZGdddeZdS)zGithub methods module.) exceptionsutils) VaultApiBasegithubc@speZdZdZdddefddZefddZdefddZefd d Zdefd d Z efd dZ defddZ dS)GithubzeGitHub Auth Method (API). Reference: https://www.vaultproject.io/api/auth/github/index.html NcCs>d|i}|t|||dtjd|d}|jj||dS)aConfigure the connection parameters for GitHub. This path honors the distinction between the create and update capabilities inside ACL policies. Supported methods: POST: /auth/{mount_point}/config. Produces: 204 (empty body) :param organization: The organization users must be part of. :type organization: str | unicode :param base_url: The API endpoint to use. Useful if you are running GitHub Enterprise or an API-compatible authentication server. :type base_url: str | unicode :param ttl: Duration after which authentication will be expired. :type ttl: str | unicode :param max_ttl: Maximum duration after which authentication will be expired. :type max_ttl: str | unicode :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The response of the configure_method request. :rtype: requests.Response organization)base_urlttlmax_ttl/v1/auth/{mount_point}/config mount_pointurljson)updater remove_nones format_url_adapterpost)selfrrr r r paramsapi_pathrG/usr/local/lib/python3.10/dist-packages/hvac/api/auth_methods/github.py configures$  zGithub.configurecCstjd|d}|jj|dS)a_Read the GitHub configuration. Supported methods: GET: /auth/{mount_point}/config. Produces: 200 application/json :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The JSON response of the read_configuration request. :rtype: dict r r rrrrget)rr rrrrread_configurationCs  zGithub.read_configurationcCr|durg}t|trtdd|Ds"d}t|j|t|ddd|i}tj d||d }|j j ||d S) atMap a list of policies to a team that exists in the configured GitHub organization. Supported methods: POST: /auth/{mount_point}/map/teams/{team_name}. Produces: 204 (empty body) :param team_name: GitHub team name in "slugified" format :type team_name: str | unicode :param policies: Comma separated list of policies to assign :type policies: List[str] :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The response of the map_github_teams request. :rtype: requests.Response Ncs|]}t|tVqdSN isinstancestr.0prrr h  z"Github.map_team..Vunsupported policies argument provided "{arg}" ({arg_type}), required type: List[str]"argarg_typevalue,,/v1/auth/{mount_point}/map/teams/{team_name}r team_namer r$listallrParamValidationErrorformattypejoinrrrr)rr3policiesr error_msgrrrrrmap_teamUs. zGithub.map_teamcCtjd||d}|jj|dS)aRead the GitHub team policy mapping. Supported methods: GET: /auth/{mount_point}/map/teams/{team_name}. Produces: 200 application/json :param team_name: GitHub team name :type team_name: str | unicode :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The JSON response of the read_team_mapping request. :rtype: dict r1r2rr)rr3r rrrrread_team_mapping zGithub.read_team_mappingcCr ) abMap a list of policies to a specific GitHub user exists in the configured organization. Supported methods: POST: /auth/{mount_point}/map/users/{user_name}. Produces: 204 (empty body) :param user_name: GitHub user name :type user_name: str | unicode :param policies: Comma separated list of policies to assign :type policies: List[str] :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The response of the map_github_users request. :rtype: requests.Response Ncsr!r"r#r&rrrr)r*z"Github.map_user..r+r,r/r0,/v1/auth/{mount_point}/map/users/{user_name}r user_namerr4)rrCr;r r<rrrrrmap_users. zGithub.map_usercCr>)aRead the GitHub user policy mapping. Supported methods: GET: /auth/{mount_point}/map/users/{user_name}. Produces: 200 application/json :param user_name: GitHub user name :type user_name: str | unicode :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The JSON response of the read_user_mapping request. :rtype: dict rArBrr)rrCr rrrrread_user_mappingr@zGithub.read_user_mappingTcCs(d|i}tjd|d}|jj|||dS)aLogin using GitHub access token. Supported methods: POST: /auth/{mount_point}/login. Produces: 200 application/json :param token: GitHub personal API token. :type token: str | unicode :param use_token: if True, uses the token in the response received from the auth request to set the "token" attribute on the the :py:meth:`hvac.adapters.Adapter` instance under the _adapter Client attribute. :type use_token: bool :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The JSON response of the login request. :rtype: dict tokenz/v1/auth/{mount_point}/loginr )r use_tokenr)rrrlogin)rrFrGr rrrrrrHsz Github.login) __name__ __module__ __qualname____doc__DEFAULT_MOUNT_POINTrrr=r?rDrErHrrrrr s 4 + ,rN)rLhvacrrhvac.api.vault_api_baserrMrrrrrs