|
| 1 | +# coding=utf-8 |
| 2 | +# -------------------------------------------------------------------------- |
| 3 | +# Generated file, DO NOT EDIT |
| 4 | +# Changes may cause incorrect behavior and will be lost if the code is |
| 5 | +# regenerated. |
| 6 | +# -------------------------------------------------------------------------- |
| 7 | + |
| 8 | + |
| 9 | +from msrest.universal_http import ClientRequest |
| 10 | +from .git_client_base import GitClientBase |
| 11 | + |
| 12 | + |
| 13 | +class GitClient(GitClientBase): |
| 14 | + """Git |
| 15 | + :param str base_url: Service URL |
| 16 | + :param Authentication creds: Authenticated credentials. |
| 17 | + """ |
| 18 | + |
| 19 | + def __init__(self, base_url=None, creds=None): |
| 20 | + super(GitClient, self).__init__(base_url, creds) |
| 21 | + |
| 22 | + def get_vsts_info(self, relative_remote_url): |
| 23 | + url = self._client.format_url(relative_remote_url.rstrip('/') + '/vsts/info') |
| 24 | + request = ClientRequest(method='GET', url=url) |
| 25 | + headers = {'Accept': 'application/json'} |
| 26 | + if self._suppress_fedauth_redirect: |
| 27 | + headers['X-TFS-FedAuthRedirect'] = 'Suppress' |
| 28 | + if self._force_msa_pass_through: |
| 29 | + headers['X-VSS-ForceMsaPassThrough'] = 'true' |
| 30 | + response = self._send_request(request, headers) |
| 31 | + return self._deserialize('VstsInfo', response) |
| 32 | + |
| 33 | + @staticmethod |
| 34 | + def get_vsts_info_by_remote_url(remote_url, credentials, |
| 35 | + suppress_fedauth_redirect=True, |
| 36 | + force_msa_pass_through=True): |
| 37 | + request = ClientRequest(method='GET', url=remote_url.rstrip('/') + '/vsts/info') |
| 38 | + headers = {'Accept': 'application/json'} |
| 39 | + if suppress_fedauth_redirect: |
| 40 | + headers['X-TFS-FedAuthRedirect'] = 'Suppress' |
| 41 | + if force_msa_pass_through: |
| 42 | + headers['X-VSS-ForceMsaPassThrough'] = 'true' |
| 43 | + git_client = GitClient(base_url=remote_url, creds=credentials) |
| 44 | + response = git_client._send_request(request, headers) |
| 45 | + return git_client._deserialize('VstsInfo', response) |
0 commit comments