Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions azure-devops/azure/devops/v5_0/client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,20 @@ def get_tfvc_client(self):
"""
return self._connection.get_client('azure.devops.v5_0.tfvc.tfvc_client.TfvcClient')

def get_token_admin_client(self):
"""get_token_admin_client.
Gets the 5.0 version of the TokenAdminClient
:rtype: :class:`<TokenAdminClient> <azure.devops.v5_0.token_admin.token_admin_client.TokenAdminClient>`
"""
return self._connection.get_client('azure.devops.v5_0.token_admin.token_admin_client.TokenAdminClient')

def get_token_administration_client(self):
"""get_token_administration_client.
Gets the 5.0 version of the TokenAdministrationClient
:rtype: :class:`<TokenAdministrationClient> <azure.devops.v5_0.token_administration.token_administration_client.TokenAdministrationClient>`
"""
return self._connection.get_client('azure.devops.v5_0.token_administration.token_administration_client.TokenAdministrationClient')

def get_upack_api_client(self):
"""get_upack_api_client.
Gets the 5.0 version of the UPackApiClient
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/azure/devops/v5_0/search/search_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, base_url=None, creds=None):
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

resource_area_identifier = None
resource_area_identifier = 'ea48a0a1-269c-42d8-b8ad-ddc8fcdcf578'

def fetch_code_search_results(self, request, project=None):
"""FetchCodeSearchResults.
Expand Down
18 changes: 18 additions & 0 deletions azure-devops/azure/devops/v5_0/token_admin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------

from .models import *
from .token_admin_client import TokenAdminClient

__all__ = [
'SessionToken',
'TokenAdminPagedSessionTokens',
'TokenAdminRevocation',
'TokenAdminRevocationRule',
'TokenAdminClient'
]
149 changes: 149 additions & 0 deletions azure-devops/azure/devops/v5_0/token_admin/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------

from msrest.serialization import Model


class SessionToken(Model):
"""SessionToken.

:param access_id:
:type access_id: str
:param alternate_token: This is populated when user requests a compact token. The alternate token value is self describing token.
:type alternate_token: str
:param authorization_id:
:type authorization_id: str
:param client_id:
:type client_id: str
:param display_name:
:type display_name: str
:param host_authorization_id:
:type host_authorization_id: str
:param is_public:
:type is_public: bool
:param is_valid:
:type is_valid: bool
:param public_data:
:type public_data: str
:param scope:
:type scope: str
:param source:
:type source: str
:param target_accounts:
:type target_accounts: list of str
:param token: This is computed and not returned in Get queries
:type token: str
:param user_id:
:type user_id: str
:param valid_from:
:type valid_from: datetime
:param valid_to:
:type valid_to: datetime
"""

_attribute_map = {
'access_id': {'key': 'accessId', 'type': 'str'},
'alternate_token': {'key': 'alternateToken', 'type': 'str'},
'authorization_id': {'key': 'authorizationId', 'type': 'str'},
'client_id': {'key': 'clientId', 'type': 'str'},
'display_name': {'key': 'displayName', 'type': 'str'},
'host_authorization_id': {'key': 'hostAuthorizationId', 'type': 'str'},
'is_public': {'key': 'isPublic', 'type': 'bool'},
'is_valid': {'key': 'isValid', 'type': 'bool'},
'public_data': {'key': 'publicData', 'type': 'str'},
'scope': {'key': 'scope', 'type': 'str'},
'source': {'key': 'source', 'type': 'str'},
'target_accounts': {'key': 'targetAccounts', 'type': '[str]'},
'token': {'key': 'token', 'type': 'str'},
'user_id': {'key': 'userId', 'type': 'str'},
'valid_from': {'key': 'validFrom', 'type': 'iso-8601'},
'valid_to': {'key': 'validTo', 'type': 'iso-8601'}
}

def __init__(self, access_id=None, alternate_token=None, authorization_id=None, client_id=None, display_name=None, host_authorization_id=None, is_public=None, is_valid=None, public_data=None, scope=None, source=None, target_accounts=None, token=None, user_id=None, valid_from=None, valid_to=None):
super(SessionToken, self).__init__()
self.access_id = access_id
self.alternate_token = alternate_token
self.authorization_id = authorization_id
self.client_id = client_id
self.display_name = display_name
self.host_authorization_id = host_authorization_id
self.is_public = is_public
self.is_valid = is_valid
self.public_data = public_data
self.scope = scope
self.source = source
self.target_accounts = target_accounts
self.token = token
self.user_id = user_id
self.valid_from = valid_from
self.valid_to = valid_to


class TokenAdminPagedSessionTokens(Model):
"""TokenAdminPagedSessionTokens.

:param continuation_token: The continuation token that can be used to retrieve the next page of session tokens, or <code>null</code> if there is no next page.
:type continuation_token: str
:param value: The list of all session tokens in the current page.
:type value: list of :class:`SessionToken <azure.devops.v5_0.token_admin.models.SessionToken>`
"""

_attribute_map = {
'continuation_token': {'key': 'continuationToken', 'type': 'str'},
'value': {'key': 'value', 'type': '[SessionToken]'}
}

def __init__(self, continuation_token=None, value=None):
super(TokenAdminPagedSessionTokens, self).__init__()
self.continuation_token = continuation_token
self.value = value


class TokenAdminRevocation(Model):
"""TokenAdminRevocation.

:param authorization_id: The authorization ID of the OAuth authorization to revoke.
:type authorization_id: str
"""

_attribute_map = {
'authorization_id': {'key': 'authorizationId', 'type': 'str'}
}

def __init__(self, authorization_id=None):
super(TokenAdminRevocation, self).__init__()
self.authorization_id = authorization_id


class TokenAdminRevocationRule(Model):
"""TokenAdminRevocationRule.

:param created_before: A datetime cutoff. Tokens created before this time will be rejected. This is an optional paramter. If omitted, defaults to the time at which the rule was created.
:type created_before: datetime
:param scopes: A string containing a space-delimited list of OAuth scopes. A token matching any one of the scopes will be rejected. For a list of all OAuth scopes supported by VSTS, see: https://docs.microsoft.com/en-us/vsts/integrate/get-started/authentication/oauth?view=vsts#scopes. This is a mandatory parameter.
:type scopes: str
"""

_attribute_map = {
'created_before': {'key': 'createdBefore', 'type': 'iso-8601'},
'scopes': {'key': 'scopes', 'type': 'str'}
}

def __init__(self, created_before=None, scopes=None):
super(TokenAdminRevocationRule, self).__init__()
self.created_before = created_before
self.scopes = scopes


__all__ = [
'SessionToken',
'TokenAdminPagedSessionTokens',
'TokenAdminRevocation',
'TokenAdminRevocationRule',
]
80 changes: 80 additions & 0 deletions azure-devops/azure/devops/v5_0/token_admin/token_admin_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------

from msrest import Serializer, Deserializer
from ...client import Client
from . import models


class TokenAdminClient(Client):
"""TokenAdmin
:param str base_url: Service URL
:param Authentication creds: Authenticated credentials.
"""

def __init__(self, base_url=None, creds=None):
super(TokenAdminClient, self).__init__(base_url, creds)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

resource_area_identifier = 'af68438b-ed04-4407-9eb6-f1dbae3f922e'

def list_personal_access_tokens(self, subject_descriptor, page_size=None, continuation_token=None, is_public=None):
"""ListPersonalAccessTokens.
[Preview API] Lists of all the session token details of the personal access tokens (PATs) for a particular user.
:param :class:`<str> <azure.devops.v5_0.token_admin.models.str>` subject_descriptor: The descriptor of the target user.
:param int page_size: The maximum number of results to return on each page.
:param str continuation_token: An opaque data blob that allows the next page of data to resume immediately after where the previous page ended. The only reliable way to know if there is more data left is the presence of a continuation token.
:param bool is_public: Set to false for PAT tokens and true for SSH tokens.
:rtype: :class:`<TokenAdminPagedSessionTokens> <azure.devops.v5_0.token_admin.models.TokenAdminPagedSessionTokens>`
"""
route_values = {}
if subject_descriptor is not None:
route_values['subjectDescriptor'] = self._serialize.url('subject_descriptor', subject_descriptor, 'str')
query_parameters = {}
if page_size is not None:
query_parameters['pageSize'] = self._serialize.query('page_size', page_size, 'int')
if continuation_token is not None:
query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str')
if is_public is not None:
query_parameters['isPublic'] = self._serialize.query('is_public', is_public, 'bool')
response = self._send(http_method='GET',
location_id='af68438b-ed04-4407-9eb6-f1dbae3f922e',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('TokenAdminPagedSessionTokens', response)

def create_revocation_rule(self, revocation_rule):
"""CreateRevocationRule.
[Preview API] Creates a revocation rule to prevent the further usage of any OAuth authorizations that were created before the current point in time and which match the conditions in the rule.
:param :class:`<TokenAdminRevocationRule> <azure.devops.v5_0.token_admin.models.TokenAdminRevocationRule>` revocation_rule: The revocation rule to create. The rule must specify a space-separated list of scopes, after which preexisting OAuth authorizations that match that any of the scopes will be rejected. For a list of all OAuth scopes supported by VSTS, see: https://docs.microsoft.com/en-us/vsts/integrate/get-started/authentication/oauth?view=vsts#scopes The rule may also specify the time before which to revoke tokens.
"""
content = self._serialize.body(revocation_rule, 'TokenAdminRevocationRule')
self._send(http_method='POST',
location_id='ee4afb16-e7ab-4ed8-9d4b-4ef3e78f97e4',
version='5.0-preview.1',
content=content)

def revoke_authorizations(self, revocations, is_public=None):
"""RevokeAuthorizations.
[Preview API] Revokes the listed OAuth authorizations.
:param [TokenAdminRevocation] revocations: The list of objects containing the authorization IDs of the OAuth authorizations, such as session tokens retrieved by listed a users PATs, that should be revoked.
:param bool is_public: Set to false for PAT tokens and true for SSH tokens.
"""
query_parameters = {}
if is_public is not None:
query_parameters['isPublic'] = self._serialize.query('is_public', is_public, 'bool')
content = self._serialize.body(revocations, '[TokenAdminRevocation]')
self._send(http_method='POST',
location_id='a9c08b2c-5466-4e22-8626-1ff304ffdf0f',
version='5.0-preview.1',
query_parameters=query_parameters,
content=content)

18 changes: 18 additions & 0 deletions azure-devops/azure/devops/v5_0/token_administration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------

from .models import *
from .token_administration_client import TokenAdministrationClient

__all__ = [
'SessionToken',
'TokenAdministrationRevocation',
'TokenAdminPagedSessionTokens',
'TokenAdminRevocation',
'TokenAdministrationClient'
]
Loading